Implemented a "full savestate-movie load" mode similar to the implementation in VBA-rr & SNES9x-rr.

In this mode loading a savestate in read+write doesn't truncate the movie to its frame count immediately.  Instead it waits 

until input is recording into the movie (next frame).  For win32 this feature is togglable in movie options and the context 

menu.  For SDL this is off by default and a toggle will need to be added.
This commit is contained in:
adelikat 2010-05-18 15:31:53 +00:00
parent 8f222b3c91
commit fdbbb5bbc0
7 changed files with 58 additions and 36 deletions

View File

@ -1,3 +1,4 @@
18-may-2010 - adelikat - Implemented a "full savestate-movie load" mode similar to the implementation in VBA-rr & SNES9x-rr. In this mode loading a savestate in read+write doesn't truncate the movie to its frame count immediately. Instead it waits until input is recording into the movie (next frame). For win32 this feature is togglable in movie options and the context menu. For SDL this is off by default and a toggle will need to be added.
17-may-2010 - adelikat - Made gamepad 2 off by default.
17-may-2010 - adelikat - Movies - fully implemented "bulletproof" read-only
17-may-2010 - zeromus - Movie loading (& movie-savestate saving/loading) should now be faster due to the use of a emufile class instead of std::ostream for dumping

View File

@ -64,6 +64,7 @@ extern bool pauseWhileActive; //adelikat: Cheats dialog
extern bool AVIdisableMovieMessages;
extern bool replaceP2StartWithMicrophone;
extern bool oldInputDisplay;
extern bool fullSaveStateLoads;
//window positions and sizes:
extern int ChtPosX,ChtPosY;
@ -231,6 +232,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(debuggerAutoload),
AC(allowUDLR),
AC(debuggerSaveLoadDEBFiles),
AC(fullSaveStateLoads),
//window positions
AC(ChtPosX),

View File

@ -31,6 +31,7 @@ extern bool movieSubtitles; //In fceu.cpp - Toggle for displaying movie subtitle
extern bool subtitlesOnAVI; //In movie.cpp - Toggle for putting movie subtitles in an AVI
extern bool autoMovieBackup;//In fceu.cpp - Toggle that determines if movies should be backed up automatically before altering them
extern bool bindSavestate ; //Toggle that determines if a savestate filename will include the movie filename
extern bool fullSaveStateLoads; //Toggle that does "VBA style" loadstates in record mode. Input is truncated on next frame instead of immediately
void UpdateCheckBoxes(HWND hwndDlg)
{
@ -99,6 +100,10 @@ BOOL CALLBACK MovieOptionsCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
case IDC_MOVIE_CLOSE:
CloseMovieOptionsDialog(hwndDlg);
break;
case IDC_FULLSAVESTATES:
fullSaveStateLoads ^= 1;
break;
}
}
}

View File

@ -15,10 +15,8 @@
// Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@ -35,7 +33,7 @@ ICON_2 ICON "res/ICON_2.ico"
// Menu
//
FCEUMENU MENU
FCEUMENU MENU
BEGIN
POPUP "&File"
BEGIN
@ -212,7 +210,7 @@ BEGIN
END
END
TASEDITMENU MENU
TASEDITMENU MENU
BEGIN
POPUP "&File"
BEGIN
@ -250,7 +248,7 @@ BEGIN
END
END
MEMVIEWMENU MENU
MEMVIEWMENU MENU
BEGIN
POPUP "&File"
BEGIN
@ -293,7 +291,7 @@ BEGIN
END
END
MEMWATCHMENU MENU
MEMWATCHMENU MENU
BEGIN
POPUP "&File "
BEGIN
@ -320,7 +318,7 @@ BEGIN
END
END
TASEDITCONTEXTMENUS MENU
TASEDITCONTEXTMENUS MENU
BEGIN
POPUP "Stray"
BEGIN
@ -343,7 +341,7 @@ BEGIN
END
END
FCEUCONTEXTMENUS MENU
FCEUCONTEXTMENUS MENU
BEGIN
POPUP "Game+Movie+readonly"
BEGIN
@ -390,11 +388,13 @@ BEGIN
MENUITEM "Undo loadstate", FCEUX_CONTEXT_UNDOLOADSTATE
MENUITEM "Rewind to last auto-save", FCEUX_CONTEXT_REWINDTOLASTAUTO
MENUITEM SEPARATOR
MENUITEM "&Mode: Full state-movie loads", ID_CONTEXT_FULLSAVESTATES
MENUITEM SEPARATOR
MENUITEM "Help...", FCEU_CONTEXT_MOVIEHELP
END
END
RAMWATCH_MENU MENU
RAMWATCH_MENU MENU
BEGIN
POPUP "File"
BEGIN
@ -422,7 +422,7 @@ BEGIN
END
END
CHEATCONTEXTMENUS MENU
CHEATCONTEXTMENUS MENU
BEGIN
POPUP "CheatListPopup"
BEGIN
@ -432,7 +432,7 @@ BEGIN
END
END
DEBUGCONTEXTMENUS MENU
DEBUGCONTEXTMENUS MENU
BEGIN
POPUP "DebugListPopup"
BEGIN
@ -440,7 +440,7 @@ BEGIN
END
END
LUAWINDOW_MENU MENU
LUAWINDOW_MENU MENU
BEGIN
POPUP "Console"
BEGIN
@ -500,7 +500,7 @@ BEGIN
LTEXT "Avi Output",IDC_STATIC,10,208,34,8
END
DWBDIALOG DIALOG 33, 99, 250, 56
DWBDIALOG DIALOG 33, 99, 250, 56
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "DWB!"
FONT 8, "MS Sans Serif"
@ -510,7 +510,7 @@ BEGIN
PUSHBUTTON "Close",BTN_CLOSE,188,33,50,14
END
FKBDIALOG DIALOG 13, 72, 402, 194
FKBDIALOG DIALOG 13, 72, 402, 194
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Family Keyboard Configuration"
FONT 8, "MS Sans Serif"
@ -689,7 +689,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX,174,18,142,12
END
MAHJONGDIALOG DIALOG 65510, 106, 340, 110
MAHJONGDIALOG DIALOG 65510, 106, 340, 110
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "mahjong"
FONT 8, "MS Sans Serif"
@ -790,7 +790,7 @@ BEGIN
CTEXT "Tint",65463,123,34,85,8
END
POWERPADDIALOG DIALOG 30, 123, 131, 119
POWERPADDIALOG DIALOG 30, 123, 131, 119
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Power Pad Configuration"
FONT 8, "MS Sans Serif"
@ -811,7 +811,7 @@ BEGIN
PUSHBUTTON "12",311,91,59,16,12
END
QUIZKINGDIALOG DIALOG 30, 123, 160, 74
QUIZKINGDIALOG DIALOG 30, 123, 160, 74
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "quiz king"
FONT 8, "MS Sans Serif"
@ -878,12 +878,12 @@ BEGIN
CONTROL "Set high-priority thread.",CB_SET_HIGH_PRIORITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,24,146,12
END
MOVIEOPTIONS DIALOGEX 65520, 76, 127, 157
MOVIEOPTIONS DIALOGEX 65520, 76, 147, 213
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Movie Options"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",IDC_MOVIE_CLOSE,35,138,49,14
DEFPUSHBUTTON "Close",IDC_MOVIE_CLOSE,35,194,49,14
CONTROL "Pause after playback",IDC_MOVIE_PAUSEAFTERPLAYBACK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,17,83,10
CONTROL "Bind savestates to movies",IDC_MOVIE_BINDSAVESTATES,
@ -893,9 +893,13 @@ BEGIN
CONTROL "Display movie subtitles",IDC_MOVIE_DISPLAYSUBTITLES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,77,87,10
CONTROL "Put movie subtitles in AVI",IDC_MOVIE_SUBTITLESINAVI,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,93,95,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,93,95,10
CONTROL "Automatically backup movies",IDC_MOVIE_AUTOBACKUP,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,113,107,10
CONTROL "Load full savestate-movies",IDC_FULLSAVESTATES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,135,99,10
LTEXT "loaded states in record mode not",IDC_STATIC,19,147,104,8
LTEXT "truncated until next frame",IDC_STATIC,23,157,80,8
LTEXT "(VBA-rr & SNES9x style)",IDC_STATIC,18,167,72,8
END
DWBDIALOGSIMPLE DIALOGEX 33, 99, 250, 39
@ -1658,7 +1662,7 @@ BEGIN
PUSHBUTTON "&Cancel",IDCANCEL,120,80,50,14
END
IDD_PROMPT DIALOG 0, 0, 186, 68
IDD_PROMPT DIALOG 0, 0, 186, 68
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Input Prompt"
FONT 8, "Ms Shell Dlg 2"
@ -1675,7 +1679,7 @@ END
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
GUIDELINES DESIGNINFO
BEGIN
"DIRCONFIG", DIALOG
BEGIN
@ -1740,9 +1744,9 @@ BEGIN
"MOVIEOPTIONS", DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 118
RIGHTMARGIN, 138
TOPMARGIN, 8
BOTTOMMARGIN, 152
BOTTOMMARGIN, 208
END
"MEMWATCH", DIALOG
@ -1852,13 +1856,11 @@ END
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@ -1881,7 +1883,7 @@ END
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
GUIDELINES DESIGNINFO
BEGIN
"IDD_REPLAY_METADATA", DIALOG
BEGIN
@ -1923,7 +1925,7 @@ END
// Accelerator
//
IDR_ACCELERATOR1 ACCELERATORS
IDR_ACCELERATOR1 ACCELERATORS
BEGIN
"B", ACCEL_CTRL_B, VIRTKEY, CONTROL, NOINVERT
VK_DELETE, ACCEL_CTRL_DELETE, VIRTKEY, CONTROL, NOINVERT
@ -1937,7 +1939,7 @@ BEGIN
"W", ACCEL_CTRL_W, VIRTKEY, CONTROL, NOINVERT
END
IDR_RWACCELERATOR ACCELERATORS
IDR_RWACCELERATOR ACCELERATORS
BEGIN
"N", RAMMENU_FILE_NEW, VIRTKEY, CONTROL
"O", RAMMENU_FILE_OPEN, VIRTKEY, CONTROL
@ -1958,7 +1960,7 @@ END
//
IDB_TE_ARROW BITMAP "res/te_arrow.bmp"
#endif // English (U.S.) resources
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -423,6 +423,7 @@
#define CB_ENABLECONTEXTMENU 1203
#define DEBUGAUTOLOAD 1203
#define IDC_CHEAT_PAUSEWHENACTIVE 1203
#define IDC_FULLSAVESTATES 1203
#define IDC_VOLUMEGROUP 1204
#define IDC_RAMLIST 1205
#define IDC_C_SEARCH 1206
@ -785,6 +786,9 @@
#define ID_AVI_DISMOVIEMESS 40404
#define ID_AVI_DISMOVIEMESSAGE 40405
#define ID_INPUTDISPLAY_OLDSTYLEDISP 40406
#define ID_GAME_RECOVERY 40407
#define ID_SAVESTATE_RECOVERY 40408
#define ID_CONTEXT_FULLSAVESTATES 40409
#define IDC_DEBUGGER_ICONTRAY 55535
#define MW_ValueLabel2 65423
#define MW_ValueLabel1 65426
@ -794,7 +798,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 160
#define _APS_NEXT_COMMAND_VALUE 40407
#define _APS_NEXT_COMMAND_VALUE 40410
#define _APS_NEXT_CONTROL_VALUE 1257
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -492,6 +492,8 @@ void UpdateContextMenuItems(HMENU context, int whichContext)
string undoSavestate = "Undo savestate";
string redoSavestate = "Redo savestate";
CheckMenuItem(context,ID_CONTEXT_FULLSAVESTATES,MF_BYCOMMAND | fullSaveStateLoads?MF_CHECKED:MF_UNCHECKED);
//Undo Loadstate
if (CheckBackupSaveStateExist() && (undoLS || redoLS))
EnableMenuItem(context,FCEUX_CONTEXT_UNDOLOADSTATE,MF_BYCOMMAND | MF_ENABLED);
@ -950,9 +952,6 @@ void AddRecentMovieFile(const char *filename)
UpdateRecentMovieArray(filename, recent_movie, MAX_NUMBER_OF_MOVIE_RECENT_FILES, recentmoviemenu, MENU_MOVIE_RECENT, MOVIE_FIRST_RECENT_FILE);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Hides the main menu.
@ -2092,6 +2091,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
case FCEU_CONTEXT_MOVIEHELP:
OpenHelpWindow(moviehelp);
break;
case ID_CONTEXT_FULLSAVESTATES:
fullSaveStateLoads ^= 1;
break;
//No Game - Help
case FCEU_CONTEXT_FCEUHELP:

View File

@ -1133,6 +1133,11 @@ void FCEUMOV_AddInputState()
mr.commands = _currCommand;
_currCommand = 0;
//Adelikat: in normal mode, this is done at the time of loading a savestate in read+write mode
//If the user chooses it can be delayed to here
if (fullSaveStateLoads && (currFrameCounter < (int)currMovieData.records.size()))
currMovieData.truncateAt(currFrameCounter);
mr.dump(&currMovieData, osRecordingMovie,currMovieData.records.size());
currMovieData.records.push_back(mr);
}
@ -1171,7 +1176,7 @@ void FCEU_DrawMovies(uint8 *XBuf)
if(movieMode == MOVIEMODE_PLAY)
sprintf(counterbuf,"%d/%d",currFrameCounter,currMovieData.records.size());
else if(movieMode == MOVIEMODE_RECORD)
sprintf(counterbuf,"%d",currMovieData.records.size());
sprintf(counterbuf,"%d",currFrameCounter/*currMovieData.records.size()*/);
else if (movieMode == MOVIEMODE_FINISHED)
sprintf(counterbuf,"%d/%d (finished)",currFrameCounter,currMovieData.records.size());
else