Fix define on flatpak, add cwd behavior.

This commit is contained in:
Dario 2025-05-03 19:20:27 -03:00
parent c70908bfd6
commit 094f47d5b5
2 changed files with 9 additions and 2 deletions

View file

@ -28,7 +28,7 @@
"./N64Recomp us.rev1.toml",
"./RSPRecomp aspMain.us.rev1.toml",
"./RSPRecomp njpgdspMain.us.rev1.toml",
"cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_MAKE_PROGRAM=ninja -DPATCHES_C_COMPILER=clang -DPATCHES_LD=ld.lld -DRECOMP_FLATPAK -G Ninja -S . -B cmake-build",
"cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_MAKE_PROGRAM=ninja -DPATCHES_C_COMPILER=clang -DPATCHES_LD=ld.lld -DRECOMP_FLATPAK=ON -G Ninja -S . -B cmake-build",
"cmake --build cmake-build --config Release --target Zelda64Recompiled --parallel",
"rm -rf assets/scss",
"mkdir -p /app/bin",

View file

@ -601,7 +601,14 @@ int main(int argc, char** argv) {
// Force wasapi on Windows, as there seems to be some issue with sample queueing with directsound currently.
SDL_setenv("SDL_AUDIODRIVER", "wasapi", true);
#endif
//printf("Current dir: %ls\n", std::filesystem::current_path().c_str());
#if defined(__linux__) && defined(RECOMP_FLATPAK)
// When using Flatpak, applications tend to launch from the home directory by default.
// Mods might use the current working directory to store the data, so we switch it to a directory
// with persistent data storage and write permissions under Flatpak to ensure it works.
std::error_code ec;
std::filesystem::current_path("/var/data", ec);
#endif
// Initialize SDL audio and set the output frequency.
SDL_InitSubSystem(SDL_INIT_AUDIO);