Adds 2 movie recording modes imported from VBA-rr.

Frame display is modified to indicate the currently selected mode.
This commit is contained in:
aquanull 2018-04-05 08:18:53 +08:00
parent e7adca9132
commit f16f6548bb
8 changed files with 215 additions and 25 deletions

View File

@ -61,6 +61,7 @@ extern bool disableMovieMessages;
extern bool replaceP2StartWithMicrophone;
extern bool SingleInstanceOnly;
extern bool Show_FPS;
extern int movieRecordMode;
extern bool oldInputDisplay;
extern bool fullSaveStateLoads;
extern int frameSkipAmt;
@ -470,6 +471,7 @@ static CFGSTRUCT fceuconfig[] =
AC(replaceP2StartWithMicrophone),
AC(SingleInstanceOnly),
AC(Show_FPS),
AC(movieRecordMode),
ENDCFGSTRUCT
};

View File

@ -1856,7 +1856,7 @@ BEGIN
MENUITEM "&Stop Movie", MENU_STOP_MOVIE
MENUITEM "Play from &Beginning", ID_FILE_PLAYMOVIEFROMBEGINNING
MENUITEM "&Toggle Recording/Playing", ID_FILE_TOGGLE_RECORDING_MOVIE
POPUP "&Modify"
POPUP "&Quickly Modify"
BEGIN
MENUITEM "&Insert 1 Frame", ID_FILE_INSERT_1_FRAME
MENUITEM "&Delete 1 Frame", ID_FILE_DELETE_1_FRAME
@ -1864,6 +1864,14 @@ BEGIN
MENUITEM "&Truncate at Current Frame", ID_FILE_TRUNCATE_MOVIE
END
MENUITEM SEPARATOR
POPUP "Record &Mode"
BEGIN
MENUITEM "&Next Record Mode", ID_FILE_NEXTRECORDMODE
MENUITEM SEPARATOR
MENUITEM "&Truncate", ID_FILE_RECORDMODE_TRUNCATE
MENUITEM "&Overwrite[W]", ID_FILE_RECORDMODE_OVERWRITE
MENUITEM "&Insert[I]", ID_FILE_RECORDMODE_INSERT
END
MENUITEM "&Read-only", ID_FILE_MOVIE_TOGGLEREAD
END
POPUP "&AVI/Wav"
@ -2273,6 +2281,12 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Truncate at Current Frame", FCEUX_CONTEXT_TRUNCATE_MOVIE
END
POPUP "Record Mode"
BEGIN
MENUITEM "&Truncate", FCEUX_CONTEXT_RECORDMODE_TRUNCATE
MENUITEM "&Overwrite[W]", FCEUX_CONTEXT_RECORDMODE_OVERWRITE
MENUITEM "&Insert[I]", FCEUX_CONTEXT_RECORDMODE_INSERT
END
MENUITEM SEPARATOR
MENUITEM "Undo savestate", FCEUX_CONTEXT_UNDOSAVESTATE
MENUITEM "Rewind to last auto-save", FCEUX_CONTEXT_REWINDTOLASTAUTO
@ -2298,6 +2312,12 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Truncate at Current Frame", FCEUX_CONTEXT_TRUNCATE_MOVIE
END
POPUP "Record Mode"
BEGIN
MENUITEM "&Truncate", FCEUX_CONTEXT_RECORDMODE_TRUNCATE
MENUITEM "&Overwrite[W]", FCEUX_CONTEXT_RECORDMODE_OVERWRITE
MENUITEM "&Insert[I]", FCEUX_CONTEXT_RECORDMODE_INSERT
END
MENUITEM SEPARATOR
MENUITEM "Undo savestate", FCEUX_CONTEXT_UNDOSAVESTATE
MENUITEM "Undo loadstate", FCEUX_CONTEXT_UNDOLOADSTATE
@ -2324,6 +2344,12 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Truncate at Current Frame", FCEUX_CONTEXT_TRUNCATE_MOVIE
END
POPUP "Record Mode"
BEGIN
MENUITEM "&Truncate", FCEUX_CONTEXT_RECORDMODE_TRUNCATE
MENUITEM "&Overwrite[W]", FCEUX_CONTEXT_RECORDMODE_OVERWRITE
MENUITEM "&Insert[I]", FCEUX_CONTEXT_RECORDMODE_INSERT
END
MENUITEM SEPARATOR
MENUITEM "Undo savestate", FCEUX_CONTEXT_UNDOSAVESTATE
MENUITEM "Rewind to last auto-save", FCEUX_CONTEXT_REWINDTOLASTAUTO
@ -2349,6 +2375,12 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Truncate at Current Frame", FCEUX_CONTEXT_TRUNCATE_MOVIE
END
POPUP "Record Mode"
BEGIN
MENUITEM "&Truncate", FCEUX_CONTEXT_RECORDMODE_TRUNCATE
MENUITEM "&Overwrite[W]", FCEUX_CONTEXT_RECORDMODE_OVERWRITE
MENUITEM "&Insert[I]", FCEUX_CONTEXT_RECORDMODE_INSERT
END
MENUITEM SEPARATOR
MENUITEM "Undo savestate", FCEUX_CONTEXT_UNDOSAVESTATE
MENUITEM "Undo loadstate", FCEUX_CONTEXT_UNDOLOADSTATE

View File

@ -833,6 +833,9 @@
#define MENU_DEBUGGER 40080
#define MENU_MEMORY_WATCH 40081
#define MENU_RAMFILTER 40082
#define ID_FILE_RECENT 40100
#define MEMW_HELP_WCOMMANDS 40101
#define MEMW_OPTIONS_LOADLASTFILE 40102
#define MEMW_FILE_NEW 40103
#define MEMW_FILE_OPEN 40104
#define MEMW_FILE_SAVE 40105
@ -840,13 +843,20 @@
#define MEMW_FILE_RECENT 40107
#define MEMW_FILE_CLOSE 40108
#define MEMW_OPTIONS_LOADSTART 40109
#define MEMW_HELP_WCOMMANDS 40113
#define MEMW_OPTIONS_LOADLASTFILE 40114
#define ID_FILE_RECENT 40117
#define ID_FILE_RECORDMODE_TRUNCATE 40110
#define ID_FILE_RECORDMODE_OVERWRITE 40111
#define ID_FILE_RECORDMODE_INSERT 40112
#define ID_FILE_RECORDMODE_XOR 40113
#define FCEUX_CONTEXT_RECORDMODE_TRUNCATE 40115
#define FCEUX_CONTEXT_RECORDMODE_OVERWRITE 40116
#define FCEUX_CONTEXT_RECORDMODE_INSERT 40117
#define FCEUX_CONTEXT_RECORDMODE_XOR 40118
#define MENU_RECORD_WAV 40120
#define MENU_STOP_WAV 40121
#define MENU_TASEDIT 40124
#define MENU_PAUSEAFTERPLAYBACK 40126
#define ID_FILE_NEXTRECORDMODE 40127
#define ID_FILE_PREVRECORDMODE 40128
#define ACCEL_CTRL_O 40130
#define ACCEL_CTRL_E 40131
#define ACCEL_CTRL_W 40132

View File

@ -122,6 +122,7 @@ extern BOOL CALLBACK ReplayMetadataDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wP
extern bool CheckFileExists(const char* filename); //Receives a filename (fullpath) and checks to see if that file exists
extern bool oldInputDisplay;
extern int RAMInitOption;
extern int movieRecordMode;
//AutoFire-----------------------------------------------
void ShowNetplayConsole(void); //mbg merge 7/17/06 YECH had to add
@ -417,6 +418,9 @@ void UpdateCheckedMenuItems()
CheckMenuItem(fceumenu, polo2[x], *polo[x] ? MF_CHECKED : MF_UNCHECKED);
}
//File Menu
CheckMenuItem(fceumenu, ID_FILE_RECORDMODE_TRUNCATE, movieRecordMode == MOVIE_RECORD_MODE_TRUNCATE ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, ID_FILE_RECORDMODE_OVERWRITE, movieRecordMode == MOVIE_RECORD_MODE_OVERWRITE ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, ID_FILE_RECORDMODE_INSERT, movieRecordMode == MOVIE_RECORD_MODE_INSERT ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, ID_FILE_MOVIE_TOGGLEREAD, movie_readonly ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, ID_FILE_OPENLUAWINDOW, LuaConsoleHWnd ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(fceumenu, ID_AVI_ENABLEHUDRECORDING, FCEUI_AviEnableHUDrecording() ? MF_CHECKED : MF_UNCHECKED);
@ -510,6 +514,9 @@ void UpdateContextMenuItems(HMENU context, int whichContext)
EnableMenuItem(context, FCEUX_CONTEXT_DELETE_1_FRAME, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(context, FCEUX_CONTEXT_TRUNCATE_MOVIE, MF_BYCOMMAND | MF_GRAYED);
}
CheckMenuItem(context, FCEUX_CONTEXT_RECORDMODE_TRUNCATE, movieRecordMode == MOVIE_RECORD_MODE_TRUNCATE ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(context, FCEUX_CONTEXT_RECORDMODE_OVERWRITE, movieRecordMode == MOVIE_RECORD_MODE_OVERWRITE ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(context, FCEUX_CONTEXT_RECORDMODE_INSERT, movieRecordMode == MOVIE_RECORD_MODE_INSERT ? MF_CHECKED : MF_UNCHECKED);
//Undo Loadstate
if (CheckBackupSaveStateExist() && (undoLS || redoLS))
@ -1804,6 +1811,24 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
case ID_FILE_TRUNCATE_MOVIE:
FCEUI_MovieTruncate();
break;
case ID_FILE_NEXTRECORDMODE:
FCEUI_MovieNextRecordMode();
break;
case ID_FILE_PREVRECORDMODE:
FCEUI_MoviePrevRecordMode();
break;
case FCEUX_CONTEXT_RECORDMODE_TRUNCATE:
case ID_FILE_RECORDMODE_TRUNCATE:
FCEUI_MovieRecordModeTruncate();
break;
case FCEUX_CONTEXT_RECORDMODE_OVERWRITE:
case ID_FILE_RECORDMODE_OVERWRITE:
FCEUI_MovieRecordModeOverwrite();
break;
case FCEUX_CONTEXT_RECORDMODE_INSERT:
case ID_FILE_RECORDMODE_INSERT:
FCEUI_MovieRecordModeInsert();
break;
//Record Avi/Wav submenu
case MENU_RECORD_AVI:
@ -2944,6 +2969,31 @@ void UpdateMenuHotkeys()
combined = "&Read only\t" + combo;
ChangeMenuItemText(ID_FILE_MOVIE_TOGGLEREAD, combined);
//Next Record Mode
combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_NEXT_RECORD_MODE]);
combined = "&Next Record Mode\t" + combo;
ChangeMenuItemText(ID_FILE_NEXTRECORDMODE, combined);
//Prev Record Mode
combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_PREV_RECORD_MODE]);
combined = "&Prev Record Mode\t" + combo;
ChangeMenuItemText(ID_FILE_PREVRECORDMODE, combined);
//Record Mode Truncate
combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_RECORD_MODE_TRUNCATE]);
combined = "&Truncate\t" + combo;
ChangeMenuItemText(ID_FILE_RECORDMODE_TRUNCATE, combined);
//Record Mode Overwrite
combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_RECORD_MODE_OVERWRITE]);
combined = "&Overwrite[W]\t" + combo;
ChangeMenuItemText(ID_FILE_RECORDMODE_OVERWRITE, combined);
//Record Mode Insert
combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_RECORD_MODE_INSERT]);
combined = "&Insert[I]\t" + combo;
ChangeMenuItemText(ID_FILE_RECORDMODE_INSERT, combined);
//Screenshot
combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SCREENSHOT]);
combined = "&Screenshot\t" + combo;

View File

@ -819,7 +819,12 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_MOVIE_TRUNCATE, EMUCMDTYPE_MOVIE, FCEUI_MovieTruncate, 0, 0, "Truncate Movie At Current Frame", 0 },
{ EMUCMD_MOVIE_STOP, EMUCMDTYPE_MOVIE, FCEUI_StopMovie, 0, 0, "Stop Movie", 0 },
{ EMUCMD_MOVIE_READONLY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleReadOnly, 0, 0, "Toggle Read-Only", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_FRAME_DISPLAY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleFrameDisplay, 0, 0, "Toggle Frame Display", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_NEXT_RECORD_MODE, EMUCMDTYPE_MOVIE, FCEUI_MovieNextRecordMode, 0, 0, "Next Record Mode", 0 },
{ EMUCMD_MOVIE_PREV_RECORD_MODE, EMUCMDTYPE_MOVIE, FCEUI_MoviePrevRecordMode, 0, 0, "Prev Record Mode", 0 },
{ EMUCMD_MOVIE_RECORD_MODE_TRUNCATE, EMUCMDTYPE_MOVIE, FCEUI_MovieRecordModeTruncate, 0, 0, "Record Mode Truncate", 0 },
{ EMUCMD_MOVIE_RECORD_MODE_OVERWRITE, EMUCMDTYPE_MOVIE, FCEUI_MovieRecordModeOverwrite, 0, 0, "Record Mode Overwrite", 0 },
{ EMUCMD_MOVIE_RECORD_MODE_INSERT, EMUCMDTYPE_MOVIE, FCEUI_MovieRecordModeInsert, 0, 0, "Record Mode Insert", 0 },
{ EMUCMD_MOVIE_FRAME_DISPLAY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleFrameDisplay, 0, 0, "Toggle Frame Display", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_INPUT_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUI_ToggleInputDisplay, 0, 0, "Toggle Input Display", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_ICON_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUD_ToggleStatusIcon, 0, 0, "Toggle Status Icon", EMUCMDFLAG_TASEDITOR },

View File

@ -253,6 +253,12 @@ enum EMUCMD
EMUCMD_MOVIE_INSERT_1_FRAME,
EMUCMD_MOVIE_DELETE_1_FRAME,
EMUCMD_MOVIE_NEXT_RECORD_MODE,
EMUCMD_MOVIE_PREV_RECORD_MODE,
EMUCMD_MOVIE_RECORD_MODE_TRUNCATE,
EMUCMD_MOVIE_RECORD_MODE_OVERWRITE,
EMUCMD_MOVIE_RECORD_MODE_INSERT,
EMUCMD_MAX
};

View File

@ -98,6 +98,7 @@ int input_display = 0;
int frame_display = 0;
int rerecord_display = 0;
bool fullSaveStateLoads = false; //Option for loading a savestates full contents in read+write mode instead of up to the frame count in the savestate (useful as a recovery option)
int movieRecordMode = 0; //Option for various movie recording modes such as TRUNCATE (normal), OVERWRITE etc.
SFORMAT FCEUMOV_STATEINFO[]={
{ &currFrameCounter, 4|FCEUSTATE_RLSB, "FCNT"},
@ -762,6 +763,27 @@ static const char *GetMovieModeStr()
return ".";
}
static const char *GetMovieReadOnlyStr()
{
if (movieMode == MOVIEMODE_RECORD)
return movie_readonly ? " R-O" : "";
else
return movie_readonly ? "" : " R+W";
}
static const char *GetMovieRecordModeStr()
{
switch (movieRecordMode)
{
case MOVIE_RECORD_MODE_OVERWRITE:
return " [W]";
case MOVIE_RECORD_MODE_INSERT:
return " [I]";
default:
return "";
}
}
static EMUFILE *openRecordingMovie(const char* fname)
{
if (osRecordingMovie)
@ -1241,14 +1263,29 @@ 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
//aquanull: now it supports other recording modes that don't necessarily truncate further frame data
//If the user chooses it can be delayed to here
if (fullSaveStateLoads && (currFrameCounter < (int)currMovieData.records.size()))
currMovieData.truncateAt(currFrameCounter);
if (currFrameCounter < (int)currMovieData.records.size())
switch (movieRecordMode)
{
case MOVIE_RECORD_MODE_OVERWRITE:
currMovieData.records[currFrameCounter].Clone(mr);
break;
case MOVIE_RECORD_MODE_INSERT:
//FIXME: this could be very insufficient
currMovieData.records.insert(currMovieData.records.begin() + currFrameCounter, mr);
break;
//case MOVIE_RECORD_MODE_TRUNCATE:
default:
//Adelikat: in normal mode, this is done at the time of loading a savestate in read+write mode
currMovieData.truncateAt(currFrameCounter);
currMovieData.records.push_back(mr);
break;
}
else
currMovieData.records.push_back(mr);
mr.dump(&currMovieData, osRecordingMovie,currMovieData.records.size()); // to disk
currMovieData.records.push_back(mr);
mr.dump(&currMovieData, osRecordingMovie, currFrameCounter); // to disk
}
currFrameCounter++;
@ -1285,33 +1322,39 @@ void FCEU_DrawMovies(uint8 *XBuf)
// not the best place, but just working
assert((NULL != osRecordingMovie) == (movieMode == MOVIEMODE_RECORD));
if(frame_display)
if (frame_display)
{
char counterbuf[32] = {0};
int color = 0x20;
if(movieMode == MOVIEMODE_PLAY)
sprintf(counterbuf,"%d/%d",currFrameCounter,(int)currMovieData.records.size());
else if(movieMode == MOVIEMODE_RECORD)
sprintf(counterbuf,"%d",currFrameCounter);
else if (movieMode == MOVIEMODE_FINISHED)
if (movieMode == MOVIEMODE_PLAY)
{
sprintf(counterbuf,"%d/%d (finished)",currFrameCounter,(int)currMovieData.records.size());
sprintf(counterbuf, "%d/%d%s%s", currFrameCounter, (int)currMovieData.records.size(), GetMovieRecordModeStr(), GetMovieReadOnlyStr());
} else if (movieMode == MOVIEMODE_RECORD)
{
if (movieRecordMode == MOVIE_RECORD_MODE_TRUNCATE)
sprintf(counterbuf, "%d%s%s (record)", currFrameCounter, GetMovieRecordModeStr(), GetMovieReadOnlyStr()); // nearly classic
else
sprintf(counterbuf, "%d/%d%s%s (record)", currFrameCounter, (int)currMovieData.records.size(), GetMovieRecordModeStr(), GetMovieReadOnlyStr());
} else if (movieMode == MOVIEMODE_FINISHED)
{
sprintf(counterbuf,"%d/%d%s%s (finished)",currFrameCounter,(int)currMovieData.records.size(), GetMovieRecordModeStr(), GetMovieReadOnlyStr());
color = 0x17; //Show red to get attention
} else if(movieMode == MOVIEMODE_TASEDITOR)
} else if (movieMode == MOVIEMODE_TASEDITOR)
{
sprintf(counterbuf,"%d",currFrameCounter);
} else
sprintf(counterbuf,"%d (no movie)",currFrameCounter);
if(counterbuf[0])
if (counterbuf[0])
DrawTextTrans(ClipSidesOffset+XBuf+FCEU_TextScanlineOffsetFromBottom(30)+1, 256, (uint8*)counterbuf, color+0x80);
}
if(rerecord_display && movieMode != MOVIEMODE_INACTIVE)
if (rerecord_display && movieMode != MOVIEMODE_INACTIVE)
{
char counterbuf[32] = {0};
sprintf(counterbuf,"%d",currMovieData.rerecordCount);
sprintf(counterbuf, "%d", currMovieData.rerecordCount);
if(counterbuf[0])
if (counterbuf[0])
DrawTextTrans(ClipSidesOffset+XBuf+FCEU_TextScanlineOffsetFromBottom(50)+1, 256, (uint8*)counterbuf, 0x28+0x80);
}
}
@ -1668,9 +1711,9 @@ void FCEUI_MovieToggleReadOnly()
strcpy(message, "Movie is now Read-Only");
else
strcpy(message, "Movie is now Read+Write");
strcat(message, GetMovieModeStr());
FCEU_DispMessage(message, 0);
FCEU_DispMessage(message,0);
}
void FCEUI_MovieToggleRecording()
@ -1820,6 +1863,31 @@ void FCEUI_MovieTruncate()
FCEU_DispMessage(message, 0);
}
void FCEUI_MovieNextRecordMode()
{
movieRecordMode = (movieRecordMode + 1) % MOVIE_RECORD_MODE_MAX;
}
void FCEUI_MoviePrevRecordMode()
{
movieRecordMode = (movieRecordMode + MOVIE_RECORD_MODE_MAX - 1) % MOVIE_RECORD_MODE_MAX;
}
void FCEUI_MovieRecordModeTruncate()
{
movieRecordMode = MOVIE_RECORD_MODE_TRUNCATE;
}
void FCEUI_MovieRecordModeOverwrite()
{
movieRecordMode = MOVIE_RECORD_MODE_OVERWRITE;
}
void FCEUI_MovieRecordModeInsert()
{
movieRecordMode = MOVIE_RECORD_MODE_INSERT;
}
void FCEUI_MoviePlayFromBeginning(void)
{
if (movieMode == MOVIEMODE_TASEDITOR)

View File

@ -65,6 +65,16 @@ enum EMOVIEMODE
MOVIEMODE_FINISHED = 16
};
enum EMOVIERECORDMODE
{
MOVIE_RECORD_MODE_TRUNCATE = 0,
MOVIE_RECORD_MODE_OVERWRITE = 1,
MOVIE_RECORD_MODE_INSERT = 2,
//MOVIE_RECORD_MODE_XOR = 3,
MOVIE_RECORD_MODE_MAX
};
enum EMOVIECMD
{
MOVIECMD_RESET = 1,
@ -267,6 +277,8 @@ extern bool freshMovie;
extern bool movie_readonly;
extern bool autoMovieBackup;
extern bool fullSaveStateLoads;
extern int movieRecordMode;
//--------------------------------------------------
void FCEUI_MakeBackupMovie(bool dispMessage);
void FCEUI_CreateMovieFile(std::string fn);
@ -281,6 +293,11 @@ void FCEUI_MovieToggleRecording();
void FCEUI_MovieInsertFrame();
void FCEUI_MovieDeleteFrame();
void FCEUI_MovieTruncate();
void FCEUI_MovieNextRecordMode();
void FCEUI_MoviePrevRecordMode();
void FCEUI_MovieRecordModeTruncate();
void FCEUI_MovieRecordModeOverwrite();
void FCEUI_MovieRecordModeInsert();
bool FCEUI_GetMovieToggleReadOnly();
void FCEUI_SetMovieToggleReadOnly(bool which);
int FCEUI_GetMovieLength();