Alert the user when opening emulation/firmware settings while they are set by a movie.

This commit is contained in:
SuuperW 2018-09-01 12:34:17 -05:00
parent 80047bff91
commit 3645ff4e77
3 changed files with 21 additions and 5 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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();