SF [ 2040463 ] Add an "author" text field in the record movie dialog; also, fixes to the old savestate support concerning what to do when movie data is found

This commit is contained in:
zeromus 2008-08-10 04:03:50 +00:00
parent 8309deab65
commit 1cb06319e9
8 changed files with 57 additions and 25 deletions

View File

@ -1,5 +1,6 @@
---version 2.0.2 released---
09-aug-2008 - zeromus - SF [ 2040463 ] Add an "author" text field in the record movie dialog
09-aug-2008 - zeromus - re-enable support for old-format savestates.
09-aug-2008 - zeromus - SF [ 2041944 ] Savestates remember Lua painting
09-aug-2008 - zeromus - support loading movies from archives
@ -15,7 +16,7 @@
07-aug-2008 - adelikat - put in -32000 protection on all dialogs that remember x,y
06-aug-2008 - adelikat - change config filename from fceu98.cfg to fceux.cfg
06-aug-2008 - zeromus - add lagcounter and lagflag to savestate
06-aug-2008 - zeromus - SF case 2040448 (View Slots bug - does not include new savestate naming)
06-aug-2008 - zeromus - SF [ 2040448 ] View Slots bug - does not include new savestate naming
06-aug-2008 - zeromus - restore the debugger snap functionality
06-aug-2008 - zeromus - add memory.readbyterange to emulua
06-aug-2008 - zeromus - auto-fill .fcs extension in save state as dialog

View File

@ -798,6 +798,7 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
LONG lIndex = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCURSEL, 0, 0);
p->szFilename = GetRecordPath(hwndDlg);
p->recordFrom = (int)lIndex;
p->author = GetDlgItemText<500>(hwndDlg,IDC_EDIT_AUTHOR);
if(lIndex>=3)
p->szSavestateFilename = GetSavePath(hwndDlg);
EndDialog(hwndDlg, 1);
@ -862,7 +863,7 @@ void FCEUD_MovieRecordTo()
EMOVIE_FLAG flags = MOVIE_FLAG_NONE;
if(p.recordFrom == 0) flags = MOVIE_FLAG_FROM_POWERON;
FCEUI_SaveMovie(p.szFilename, flags);
FCEUI_SaveMovie(p.szFilename, flags, p.author);
}
if(p.szFilename)

View File

@ -1086,19 +1086,21 @@ BEGIN
PUSHBUTTON "Find Next",IDC_MEMVIEWFIND_NEXT,225,7,50,14
END
IDD_RECORDINP DIALOGEX 0, 0, 276, 65
IDD_RECORDINP DIALOGEX 0, 0, 276, 86
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Record input"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",1,168,47,50,14
GROUPBOX "",65501,3,0,269,43
RTEXT "File:",65500,28,12,24,10,SS_CENTERIMAGE | NOT WS_GROUP
PUSHBUTTON "Cancel",2,222,47,50,14
DEFPUSHBUTTON "OK",1,167,66,50,14
GROUPBOX "",65501,3,0,269,60
RTEXT "File:",65500,28,11,24,10,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT
PUSHBUTTON "Cancel",2,221,66,50,14
EDITTEXT IDC_EDIT_FILENAME,55,10,189,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BUTTON_BROWSEFILE,249,10,18,14
COMBOBOX IDC_COMBO_RECORDFROM,55,25,189,154,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Record From:",65498,9,27,43,8
RTEXT "Record From:",65498,9,27,43,8,0,WS_EX_RIGHT
EDITTEXT IDC_EDIT_AUTHOR,55,41,189,14,ES_AUTOHSCROLL
RTEXT "Author:",65502,18,43,34,10,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT
END
IDD_REPLAYINP DIALOGEX 0, 0, 300, 164
@ -1417,6 +1419,11 @@ BEGIN
BOTTOMMARGIN, 74
END
"IDD_RECORDINP", DIALOG
BEGIN
BOTTOMMARGIN, 66
END
"IDD_REPLAYINP", DIALOG
BEGIN
BOTTOMMARGIN, 146

View File

@ -358,6 +358,7 @@
#define IDC_BUTTON9 1148
#define IDC_LIST2 1149
#define CHECK_SOUND_MUTETURBO 1179
#define IDC_EDIT_AUTHOR 1180
#define MENU_NETWORK 40040
#define MENU_PALETTE 40041
#define MENU_SOUND 40042
@ -542,7 +543,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 124
#define _APS_NEXT_COMMAND_VALUE 40254
#define _APS_NEXT_CONTROL_VALUE 1180
#define _APS_NEXT_CONTROL_VALUE 1181
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -2,6 +2,7 @@
#define WIN_WINDOW_H
#include "common.h"
#include <string>
// Type definitions
@ -10,6 +11,7 @@ struct CreateMovieParameters
char* szFilename; // on Dialog creation, this is the default filename to display. On return, this is the filename that the user chose.
int recordFrom; // 0 = "Power-On", 1 = "Reset", 2 = "Now", 3+ = savestate file in szSavestateFilename
char* szSavestateFilename;
std::string author;
};
extern char *recent_files[];
@ -30,4 +32,11 @@ void UpdateCheckedMenuItems();
void SetMainWindowStuff();
void GetMouseData(uint32 (&md)[3]);
template<int BUFSIZE>
inline std::string GetDlgItemText(HWND hDlg, int nIDDlgItem) {
char buf[BUFSIZE];
GetDlgItemText(hDlg, nIDDlgItem, buf, BUFSIZE);
return buf;
}
#endif

View File

@ -465,10 +465,10 @@ static bool LoadFM2(MovieData& movieData, std::istream* fp, int size, bool stopA
char buf[9];
std::ios::pos_type curr = fp->tellg();
fp->read(buf,9);
fp->seekg(curr);
if(fp->fail()) return false;
if(memcmp(buf,"version 3",9))
return false;
fp->seekg(curr);
std::string key,value;
enum {
@ -764,7 +764,7 @@ static void openRecordingMovie(const char* fname)
//begin recording a new movie
//TODO - BUG - the record-from-another-savestate doesnt work.
void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags)
void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::string author)
{
if(!FCEU_IsValidUI(FCEUI_RECORDMOVIE))
return;
@ -781,6 +781,7 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags)
currMovieData = MovieData();
currMovieData.guid.newGuid();
currMovieData.comments.push_back("author " + author);
currMovieData.palFlag = FCEUI_GetCurrentVidSystem(0,0)!=0;
currMovieData.romChecksum = GameInfo->MD5;
currMovieData.romFilename = FileBase;
@ -957,19 +958,19 @@ bool FCEUMOV_ReadState(std::istream* is, uint32 size)
movie_readonly = true;
}
////write the state to disk so we can reload
//std::vector<char> buf(size);
//fread(&buf[0],1,size,st);
////---------
////(debug)
////FILE* wtf = fopen("d:\\wtf.txt","wb");
////fwrite(&buf[0],1,size,wtf);
////fclose(wtf);
////---------
//memorystream mstemp(&buf);
MovieData tempMovieData = MovieData();
if(!LoadFM2(tempMovieData, is, size, false))
std::ios::pos_type curr = is->tellg();
if(!LoadFM2(tempMovieData, is, size, false)) {
is->seekg((uint32)curr+size);
extern bool FCEU_state_loading_old_format;
if(FCEU_state_loading_old_format) {
if(movieMode == MOVIEMODE_PLAY || movieMode == MOVIEMODE_RECORD) {
FCEUI_StopMovie();
FCEU_PrintError("You have tried to use an old savestate while playing a movie. This is unsupported (since the old savestate has old-format movie data in it which can't be converted on the fly)");
}
}
return false;
}
//complex TAS logic for when a savestate is loaded:
//----------------

View File

@ -230,7 +230,7 @@ extern int currFrameCounter;
extern char curMovieFilename[512];
//---------
void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags);
void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::string author);
void FCEUI_LoadMovie(const char *fname, bool read_only, bool tasedit, int _stopframe);
void FCEUI_MoviePlayFromBeginning(void);
void FCEUI_StopMovie(void);

View File

@ -54,6 +54,9 @@ static void (*SPostSave)(void);
static int SaveStateStatus[10];
static int StateShow;
//tells the save system innards that we're loading the old format
bool FCEU_state_loading_old_format;
#define SFMDATA_SIZE (64)
static SFORMAT SFMDATA[SFMDATA_SIZE];
static int SFEXINDEX;
@ -234,7 +237,13 @@ static bool ReadStateChunks(std::istream* is, int32 totalsize)
case 1:if(!ReadStateChunk(is,SFCPU,size)) ret=false;break;
case 3:if(!ReadStateChunk(is,FCEUPPU_STATEINFO,size)) ret=false;break;
case 4:if(!ReadStateChunk(is,FCEUCTRL_STATEINFO,size)) ret=false;break;
case 7:if(!FCEUMOV_ReadState(is,size)) ret=false;break;
case 7:
if(!FCEUMOV_ReadState(is,size)) {
//allow this to fail in old-format savestates.
if(!FCEU_state_loading_old_format)
ret=false;
}
break;
case 0x10:if(!ReadStateChunk(is,SFMDATA,size)) ret=false; break;
// now it gets hackier:
@ -546,7 +555,10 @@ bool FCEUSS_LoadFP(std::istream* is, ENUM_SSLOADPARAMS params)
if(memcmp(header,"FCSX",4)) {
//its not an fceux save file.. perhaps it is an fceu savefile
is->seekg(0);
return FCEUSS_LoadFP_old(is,params)!=0;
FCEU_state_loading_old_format = true;
bool ret = FCEUSS_LoadFP_old(is,params)!=0;
FCEU_state_loading_old_format = false;
return ret;
}
int totalsize = FCEU_de32lsb(header + 4);