diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp index e96a9358e..f709e07c0 100755 --- a/desmume/src/frontend/windows/main.cpp +++ b/desmume/src/frontend/windows/main.cpp @@ -4817,6 +4817,11 @@ DOKEYDOWN: RunConfig(CONFIGSCREEN_HOTKEY); return 0; case IDM_FIRMSETTINGS: + if (AreMovieEmulationSettingsActive()) + { + MessageBox(hwnd, "The current settings have been set by a movie. Reset or unload the current game if you want to restore your saved settings.\n\n" + "If you make changes here, the new settings will overwrite your currently saved settings.", "Movie Settings Active", MB_OK); + } RunConfig(CONFIGSCREEN_FIRMWARE); return 0; case IDM_SOUNDSETTINGS: @@ -4826,6 +4831,11 @@ DOKEYDOWN: RunConfig(CONFIGSCREEN_WIFI); return 0; case IDM_EMULATIONSETTINGS: + if (AreMovieEmulationSettingsActive()) + { + MessageBox(hwnd, "The current settings have been set by a movie. Reset or unload the current game if you want to restore your saved settings.\n\n" + "If you make changes here (whether you reset now or not), the new settings will overwrite your currently saved settings.", "Movie Settings Active", MB_OK); + } RunConfig(CONFIGSCREEN_EMULATION); return 0; case IDM_MICROPHONESETTINGS: @@ -5874,7 +5884,7 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L if(romloaded) val = MessageBox(hDlg, "The current ROM needs to be reset to apply changes.\nReset now ?", "DeSmuME", (MB_YESNO | MB_ICONQUESTION)); - + UnloadMovieEmulationSettings(); CommonSettings.UseExtBIOS = IsDlgCheckboxChecked(hDlg, IDC_USEEXTBIOS); cur = GetDlgItem(hDlg, IDC_ARM9BIOS); diff --git a/desmume/src/movie.cpp b/desmume/src/movie.cpp index bf14bd107..1d005c295 100644 --- a/desmume/src/movie.cpp +++ b/desmume/src/movie.cpp @@ -66,7 +66,7 @@ bool movie_readonly = true; char curMovieFilename[512] = {0}; MovieData currMovieData; -MovieData oldSettings = NULL; +MovieData* oldSettings = NULL; // Loading a movie calls NDS_Reset, which calls UnloadMovieEmulationSettings. Don't unload settings on that call. bool firstReset = false; @@ -555,12 +555,17 @@ static void LoadSettingsFromMovie(MovieData movieData) } void UnloadMovieEmulationSettings() { - if (&oldSettings && !firstReset) + if (oldSettings && !firstReset) { - LoadSettingsFromMovie(oldSettings); + LoadSettingsFromMovie(*oldSettings); + delete oldSettings; oldSettings = NULL; } } +bool AreMovieEmulationSettingsActive() +{ + return (bool)oldSettings; +} //begin playing an existing movie const char* _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe) { @@ -622,7 +627,7 @@ const char* _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tas //poweron(true); // set emulation/firmware settings - oldSettings = MovieData(true); + oldSettings = new MovieData(true); LoadSettingsFromMovie(currMovieData); firstReset = true; diff --git a/desmume/src/movie.h b/desmume/src/movie.h index 84d9b1e40..e7b1ea398 100644 --- a/desmume/src/movie.h +++ b/desmume/src/movie.h @@ -273,6 +273,7 @@ bool FCEUI_MovieGetInfo(EMUFILE &fp, MOVIE_INFO &info, bool skipFrameCount); void FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, std::string sramfname, const DateTime &rtcstart); const char* _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _pauseframe); // returns NULL on success, errmsg on failure void UnloadMovieEmulationSettings(); +bool AreMovieEmulationSettingsActive(); void FCEUI_StopMovie(); void FCEUMOV_AddInputState(); void FCEUMOV_HandlePlayback();