diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index d1404e2a5..54ccaf9ec 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -969,8 +969,15 @@ void MMU_Reset() //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.load_rom(bleh.c_str()); + BackupDevice tempBackupDevice; + bool bleh2 = MMU_new.backupDevice.isMovieMode; + if(bleh2) tempBackupDevice = MMU_new.backupDevice; + reconstruct(&MMU_new); + if(bleh2) { + MMU_new.backupDevice = tempBackupDevice; + MMU_new.backupDevice.reset_hardware(); + } + else MMU_new.backupDevice.load_rom(bleh.c_str()); MMU_timing.arm7codeFetch.Reset(); MMU_timing.arm7dataFetch.Reset(); diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index 97ea94292..6eef382ca 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -339,18 +339,23 @@ void BackupDevice::movie_mode() reset(); } -void BackupDevice::reset() +void BackupDevice::reset_hardware() { + write_enable = FALSE; com = 0; addr = addr_counter = 0; - flushPending = false; - lazyFlushPending = false; - data.resize(0); - write_enable = FALSE; - data_autodetect.resize(0); motionInitState = MOTION_INIT_STATE_IDLE; motionFlag = MOTION_FLAG_NONE; state = DETECTING; + flushPending = false; + lazyFlushPending = false; +} + +void BackupDevice::reset() +{ + reset_hardware(); + data.resize(0); + data_autodetect.resize(0); addr_size = 0; loadfile(); diff --git a/desmume/src/mc.h b/desmume/src/mc.h index 93b5f31a8..8875558cd 100644 --- a/desmume/src/mc.h +++ b/desmume/src/mc.h @@ -82,6 +82,7 @@ public: void reset(); void close_rom(); + void reset_hardware(); bool save_state(EMUFILE* os); bool load_state(EMUFILE* is); @@ -120,13 +121,13 @@ public: public: //SHOULD BE PRIVATE!!!!!!!! std::string filename; + bool isMovieMode; private: bool write_enable; //is write enabled? u32 com; //persistent command actually handled u32 addr_size, addr_counter; u32 addr; - bool isMovieMode; std::vector data; std::vector data_autodetect; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 73b163a3c..a5535dd0a 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -3779,7 +3779,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM DesEnableMenuItem(mainMenu, IDM_FILE_RECORDAVI, romloaded); DesEnableMenuItem(mainMenu, IDM_FILE_RECORDWAV, romloaded); DesEnableMenuItem(mainMenu, IDM_EJECTCARD, romloaded && movieMode == MOVIEMODE_INACTIVE); - DesEnableMenuItem(mainMenu, IDM_RESET, romloaded && movieMode != MOVIEMODE_PLAY); + DesEnableMenuItem(mainMenu, IDM_RESET, romloaded && !(movieMode == MOVIEMODE_PLAY && movie_readonly)); DesEnableMenuItem(mainMenu, IDM_CLOSEROM, romloaded); DesEnableMenuItem(mainMenu, IDM_SHUT_UP, romloaded); DesEnableMenuItem(mainMenu, IDM_CHEATS_LIST, romloaded); @@ -6059,7 +6059,7 @@ static LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam void ResetGame() { - if(movieMode != MOVIEMODE_PLAY) + if(!(movieMode == MOVIEMODE_PLAY && movie_readonly)) { NDS_Reset(); if(movieMode == MOVIEMODE_INACTIVE && !emu_paused)