From a570e7a054897b1665b64356efd931a7bb43b328 Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 23 Sep 2009 18:48:45 +0000 Subject: [PATCH] fix a bad bug in savefile handling introduced a few revisions ago due to changes in initialization/reset code flow, always a desmume weakness and area of confusion.... but maybe not for long --- desmume/src/MMU.cpp | 4 ++++ desmume/src/NDSSystem.cpp | 1 - desmume/src/mc.cpp | 2 ++ desmume/src/mc.h | 4 +++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index f3ce67408..e8b96067e 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -971,7 +971,11 @@ void MMU_Reset() MMU.dscard[ARMCPU_ARM7].transfer_count = 0; MMU.dscard[ARMCPU_ARM7].mode = CardMode_Normal; + //HACK!!! + //until we improve all our session tracking stuff, we need to save the backup memory filename + std::string bleh = MMU_new.backupDevice.filename; new(&MMU_new) MMU_struct_new; + MMU_new.backupDevice.filename = bleh; MMU_timing.arm7codeFetch.Reset(); MMU_timing.arm7dataFetch.Reset(); diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index f30c4826a..b3c7a1c9f 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -2397,7 +2397,6 @@ void NDS_Reset() } MMU_Reset(); - MMU_new.backupDevice.reset(); //ARM7 BIOS IRQ HANDLER if(CommonSettings.UseExtBIOS == true) diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index d3aa92169..d82fb680d 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -263,6 +263,8 @@ bool BackupDevice::load_state(EMUFILE* is) BackupDevice::BackupDevice() { + isMovieMode = false; + reset(); } //due to unfortunate shortcomings in the emulator architecture, diff --git a/desmume/src/mc.h b/desmume/src/mc.h index 1675ee4e2..01a2b754e 100644 --- a/desmume/src/mc.h +++ b/desmume/src/mc.h @@ -112,6 +112,9 @@ public: //way too much if we flush whenever we read. void lazy_flush(); +public: //SHOULD BE PRIVATE!!!!!!!! + std::string filename; + private: bool write_enable; //is write enabled? u32 com; //persistent command actually handled @@ -119,7 +122,6 @@ private: u32 addr; bool isMovieMode; - std::string filename; std::vector data; std::vector data_autodetect; enum STATE {