Allow overriding config/data paths in emulator

This commit is contained in:
Jonian Guveli 2024-07-09 14:48:22 +03:00
parent 0a49dc0af7
commit ea03d135da
2 changed files with 8 additions and 4 deletions

View file

@ -87,6 +87,7 @@ class Emulator {
bool frameDone = false; bool frameDone = false;
Emulator(); Emulator();
Emulator(const std::filesystem::path& configPath);
~Emulator(); ~Emulator();
void step(); void step();
@ -129,10 +130,10 @@ class Emulator {
Renderer* getRenderer() { return gpu.getRenderer(); } Renderer* getRenderer() { return gpu.getRenderer(); }
u64 getTicks() { return cpu.getTicks(); } u64 getTicks() { return cpu.getTicks(); }
std::filesystem::path getConfigPath(); virtual std::filesystem::path getConfigPath();
std::filesystem::path getAndroidAppPath(); virtual std::filesystem::path getAndroidAppPath();
// Get the root path for the emulator's app data // Get the root path for the emulator's app data
std::filesystem::path getAppDataRoot(); virtual std::filesystem::path getAppDataRoot();
std::span<u8> getSMDH(); std::span<u8> getSMDH();
}; };

View file

@ -17,7 +17,10 @@ __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 1;
#endif #endif
Emulator::Emulator() Emulator::Emulator()
: config(getConfigPath()), kernel(cpu, memory, gpu, config), cpu(memory, kernel, *this), gpu(memory, config), memory(cpu.getTicksRef(), config), : Emulator(getConfigPath()) {}
Emulator::Emulator(const std::filesystem::path& configPath)
: config(configPath), kernel(cpu, memory, gpu, config), cpu(memory, kernel, *this), gpu(memory, config), memory(cpu.getTicksRef(), config),
cheats(memory, kernel.getServiceManager().getHID()), lua(*this), running(false) cheats(memory, kernel.getServiceManager().getHID()), lua(*this), running(false)
#ifdef PANDA3DS_ENABLE_HTTP_SERVER #ifdef PANDA3DS_ENABLE_HTTP_SERVER
, ,