diff --git a/src/frontend/qt_sdl/EmuInstance.h b/src/frontend/qt_sdl/EmuInstance.h index 4afff782..e7854bab 100644 --- a/src/frontend/qt_sdl/EmuInstance.h +++ b/src/frontend/qt_sdl/EmuInstance.h @@ -128,9 +128,12 @@ private: std::string baseGBAROMName; std::string baseGBAAssetName; + // HACK +public: std::unique_ptr ndsSave; std::unique_ptr gbaSave; std::unique_ptr firmwareSave; +private: std::unique_ptr backupState; bool savestateLoaded; diff --git a/src/frontend/qt_sdl/Platform.cpp b/src/frontend/qt_sdl/Platform.cpp index c77bdfd3..427e8978 100644 --- a/src/frontend/qt_sdl/Platform.cpp +++ b/src/frontend/qt_sdl/Platform.cpp @@ -29,14 +29,14 @@ #include #include #include -#include +//#include #include #include #include #include "Platform.h" #include "Config.h" -#include "ROMManager.h" +#include "main.h" #include "CameraManager.h" #include "LAN_Socket.h" #include "LAN_PCap.h" @@ -52,6 +52,9 @@ std::string EmuDirectory; extern CameraManager* camManager[2]; +// REMOVE ME +extern EmuInstance* testinst; + void emuStop(); // TEMP @@ -520,25 +523,28 @@ void Sleep(u64 usecs) void WriteNDSSave(const u8* savedata, u32 savelen, u32 writeoffset, u32 writelen) { - if (ROMManager::NDSSave) - ROMManager::NDSSave->RequestFlush(savedata, savelen, writeoffset, writelen); + EmuInstance* inst = testinst; + if (inst->ndsSave) + inst->ndsSave->RequestFlush(savedata, savelen, writeoffset, writelen); } void WriteGBASave(const u8* savedata, u32 savelen, u32 writeoffset, u32 writelen) { - if (ROMManager::GBASave) - ROMManager::GBASave->RequestFlush(savedata, savelen, writeoffset, writelen); + EmuInstance* inst = testinst; + if (inst->gbaSave) + inst->gbaSave->RequestFlush(savedata, savelen, writeoffset, writelen); } void WriteFirmware(const Firmware& firmware, u32 writeoffset, u32 writelen) { - if (!ROMManager::FirmwareSave) + EmuInstance* inst = testinst; + if (!inst->firmwareSave) return; if (firmware.GetHeader().Identifier != GENERATED_FIRMWARE_IDENTIFIER) { // If this is not the default built-in firmware... // ...then write the whole thing back. - ROMManager::FirmwareSave->RequestFlush(firmware.Buffer(), firmware.Length(), writeoffset, writelen); + inst->firmwareSave->RequestFlush(firmware.Buffer(), firmware.Length(), writeoffset, writelen); } else { @@ -555,7 +561,7 @@ void WriteFirmware(const Firmware& firmware, u32 writeoffset, u32 writelen) { // If we're writing to the access points... const u8* buffer = firmware.GetExtendedAccessPointPosition(); u32 length = sizeof(firmware.GetExtendedAccessPoints()) + sizeof(firmware.GetAccessPoints()); - ROMManager::FirmwareSave->RequestFlush(buffer, length, writeoffset - eapstart, writelen); + inst->firmwareSave->RequestFlush(buffer, length, writeoffset - eapstart, writelen); } }