mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
Add game folder to app data
This commit is contained in:
parent
51d3551114
commit
c8cc8a2520
3 changed files with 11 additions and 8 deletions
|
@ -45,11 +45,6 @@ public:
|
||||||
window = SDL_CreateWindow("Alber", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL);
|
window = SDL_CreateWindow("Alber", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL);
|
||||||
glContext = SDL_GL_CreateContext(window);
|
glContext = SDL_GL_CreateContext(window);
|
||||||
|
|
||||||
// Get path for saving files (AppData on Windows, /home/user/.local/share/ApplcationName on Linux, etc)
|
|
||||||
char* appData = SDL_GetPrefPath(nullptr, "Alber");
|
|
||||||
IOFile::setAppDataDir(appData);
|
|
||||||
SDL_free(appData);
|
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,9 +107,9 @@ public:
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setAppDataDir(const char* dir) {
|
static void setAppDataDir(const std::filesystem::path& dir) {
|
||||||
if (!dir) Helpers::panic("Failed to set app data directory");
|
if (dir == "") Helpers::panic("Failed to set app data directory");
|
||||||
appData = std::filesystem::path(dir);
|
appData = dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::filesystem::path getAppData() { return IOFile::appData; }
|
static std::filesystem::path getAppData() { return IOFile::appData; }
|
||||||
|
|
|
@ -49,6 +49,14 @@ void Emulator::runFrame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Emulator::loadROM(const std::filesystem::path& path) {
|
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();
|
kernel.initializeFS();
|
||||||
auto extension = path.extension();
|
auto extension = path.extension();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue