Add game folder to app data

This commit is contained in:
wheremyfoodat 2023-03-18 22:58:45 +02:00
parent 51d3551114
commit c8cc8a2520
3 changed files with 11 additions and 8 deletions

View file

@ -49,6 +49,14 @@ void Emulator::runFrame() {
}
bool Emulator::loadROM(const std::filesystem::path& path) {
// Get path for saving files (AppData on Windows, /home/user/.local/share/ApplcationName on Linux, etc)
// Inside that path, we be use a game-specific folder as well. Eg if we were loading a ROM called PenguinDemo.3ds, the savedata would be in
// %APPDATA%/Alber/PenguinDemo/SaveData on Windows, and so on. We do this because games save data in their own filesystem on the cart
char* appData = SDL_GetPrefPath(nullptr, "Alber");
const std::filesystem::path dataPath = std::filesystem::path(appData) / path.filename().stem();
IOFile::setAppDataDir(dataPath);
SDL_free(appData);
kernel.initializeFS();
auto extension = path.extension();