clean up movie some code; no longer write savestate with play-from-poweron movies; change main logging format to text (the header still needs to be changed)

This commit is contained in:
zeromus 2008-05-22 07:43:48 +00:00
parent 9477c03c09
commit 047808ba93
8 changed files with 909 additions and 824 deletions

View File

@ -23,15 +23,17 @@ FCEU MM - CaH4e3\n\
FCEU TAS - blip & nitsuja\n\ FCEU TAS - blip & nitsuja\n\
FCEU TAS+ - Luke Gustafson\n\ FCEU TAS+ - Luke Gustafson\n\
FCEUX\n\ FCEUX\n\
- CaH4e3, Luke Gustafson\n\ - rheiny, zeromus\n\
- Matthew Gambrell, Sebastian Porst\n\ - CaH4e3, Luke Gustafson, Sebastian Porst\n\
- adelikat, _mz\n\
\n\ \n\
"__TIME__" "__DATE__"\n"; "__TIME__" "__DATE__"\n";
if(aboutString) return aboutString;
const char *compilerString = FCEUD_GetCompilerString(); const char *compilerString = FCEUD_GetCompilerString();
//allocate the string and concatenate the template with the compiler string //allocate the string and concatenate the template with the compiler string
if(aboutString) free(aboutString);
aboutString = (char*)malloc(strlen(aboutTemplate) + strlen(compilerString) + 1); aboutString = (char*)malloc(strlen(aboutTemplate) + strlen(compilerString) + 1);
sprintf(aboutString,"%s%s",aboutTemplate,compilerString); sprintf(aboutString,"%s%s",aboutTemplate,compilerString);
return aboutString; return aboutString;

View File

@ -175,9 +175,11 @@ void FCEUI_LoadState(char *fname);
void FCEUD_SaveStateAs(void); void FCEUD_SaveStateAs(void);
void FCEUD_LoadStateFrom(void); void FCEUD_LoadStateFrom(void);
#define MOVIE_FLAG_FROM_RESET (1<<1) //movie was recorded from poweron. the alternative is from a savestate
#define MOVIE_FLAG_FROM_POWERON (1<<3)
#define MOVIE_FLAG_PAL (1<<2) #define MOVIE_FLAG_PAL (1<<2)
#define MOVIE_FLAG_FROM_POWERON (1<<3) // value is temporary onle, gets converted to reset
#define MOVIE_MAX_METADATA 512 #define MOVIE_MAX_METADATA 512
typedef struct typedef struct

View File

@ -223,7 +223,7 @@ void UpdateReplayDialog(HWND hwndDlg)
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_READONLY),(info.read_only)? FALSE : TRUE); // disable read-only checkbox if the file access is read-only EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_READONLY),(info.read_only)? FALSE : TRUE); // disable read-only checkbox if the file access is read-only
SendDlgItemMessage(hwndDlg,IDC_CHECK_READONLY,BM_SETCHECK,info.read_only ? BST_CHECKED : (ReplayDialogReadOnlyStatus ? BST_CHECKED : BST_UNCHECKED), 0); SendDlgItemMessage(hwndDlg,IDC_CHECK_READONLY,BM_SETCHECK,info.read_only ? BST_CHECKED : (ReplayDialogReadOnlyStatus ? BST_CHECKED : BST_UNCHECKED), 0);
SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_RECORDEDFROM),(info.flags & MOVIE_FLAG_FROM_RESET) ? "Reset or Power-On" : "Savestate"); SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_RECORDEDFROM),(info.flags & MOVIE_FLAG_FROM_POWERON) ? "Power-On" : "Savestate");
if(info.movie_version > 1) if(info.movie_version > 1)
{ {
char emuStr[128]; char emuStr[128];
@ -863,10 +863,9 @@ void FCEUD_MovieRecordTo()
free(p.szSavestateFilename); free(p.szSavestateFilename);
} }
FCEUI_SaveMovie( uint8 flags = 0;
p.szFilename, if(p.recordFrom == 0) flags = MOVIE_FLAG_FROM_POWERON;
(p.recordFrom == 0) ? MOVIE_FLAG_FROM_POWERON : ((p.recordFrom == 1) ? MOVIE_FLAG_FROM_RESET : 0), FCEUI_SaveMovie(p.szFilename, flags, meta);
meta);
} }
if(p.szFilename) if(p.szFilename)

View File

@ -506,7 +506,7 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
if(EmulationPaused&2) if(EmulationPaused&2)
EmulationPaused &= ~1; // clear paused flag temporarily (frame advance) EmulationPaused &= ~1; // clear paused flag temporarily (frame advance)
else if(EmulationPaused&1 || FCEU_BotMode()) else if((EmulationPaused&1) || FCEU_BotMode())
{ {
memcpy(XBuf, XBackBuf, 256*256); memcpy(XBuf, XBackBuf, 256*256);
FCEU_PutImage(); FCEU_PutImage();

File diff suppressed because it is too large Load Diff

View File

@ -311,7 +311,7 @@ void NetplayUpdate(uint8 *joyp)
{ {
FILE *fp = FetchFile(FCEU_de32lsb(buf)); FILE *fp = FetchFile(FCEU_de32lsb(buf));
if(!fp) return; if(!fp) return;
if(FCEUSS_LoadFP(fp,1)) if(FCEUSS_LoadFP(fp,SSLOADPARAM_BACKUP))
{ {
fclose(fp); fclose(fp);
FCEU_DispMessage("Remote state loaded."); FCEU_DispMessage("Remote state loaded.");

View File

@ -391,9 +391,9 @@ void FCEUSS_Save(char *fname)
} }
} }
int FCEUSS_LoadFP(FILE *st, int make_backup) int FCEUSS_LoadFP(FILE *st, ENUM_SSLOADPARAMS params)
{ {
if(make_backup==2 && suppress_scan_chunks) if(params==SSLOADPARAM_DUMMY && suppress_scan_chunks)
return 1; return 1;
int x; int x;
@ -401,8 +401,8 @@ int FCEUSS_LoadFP(FILE *st, int make_backup)
int stateversion; int stateversion;
char* fn=0; char* fn=0;
/* Make temporary savestate in case something screws up during the load */ //Make temporary savestate in case something screws up during the load
if(make_backup==1) if(params == SSLOADPARAM_BACKUP)
{ {
fn=FCEU_MakeFName(FCEUMKF_NPTEMP,0,0); fn=FCEU_MakeFName(FCEUMKF_NPTEMP,0,0);
FILE *fp; FILE *fp;
@ -423,7 +423,7 @@ int FCEUSS_LoadFP(FILE *st, int make_backup)
} }
} }
if(make_backup!=2) if(params!=SSLOADPARAM_DUMMY)
{ {
FCEUMOV_PreLoad(); FCEUMOV_PreLoad();
} }
@ -440,12 +440,12 @@ int FCEUSS_LoadFP(FILE *st, int make_backup)
{ {
stateversion=header[3] * 100; stateversion=header[3] * 100;
} }
if(make_backup==2) if(params == SSLOADPARAM_DUMMY)
{ {
scan_chunks=1; scan_chunks=1;
} }
x=ReadStateChunks(st,*(uint32*)(header+4)); x=ReadStateChunks(st,*(uint32*)(header+4));
if(make_backup==2) if(params == SSLOADPARAM_DUMMY)
{ {
scan_chunks=0; scan_chunks=0;
return 1; return 1;
@ -467,14 +467,14 @@ int FCEUSS_LoadFP(FILE *st, int make_backup)
if(fn) if(fn)
{ {
if(!x || make_backup==2) //is make_backup==2 possible?? oh well. if(!x || params == SSLOADPARAM_DUMMY) //is make_backup==2 possible?? oh well.
{ {
/* Oops! Load the temporary savestate */ /* Oops! Load the temporary savestate */
FILE *fp; FILE *fp;
if((fp=fopen(fn,"rb"))) if((fp=fopen(fn,"rb")))
{ {
FCEUSS_LoadFP(fp,0); FCEUSS_LoadFP(fp,SSLOADPARAM_NOBACKUP);
fclose(fp); fclose(fp);
} }
unlink(fn); unlink(fn);
@ -521,7 +521,7 @@ int FCEUSS_Load(char *fname)
//If in bot mode, don't do a backup when loading. //If in bot mode, don't do a backup when loading.
//Otherwise you eat at the hard disk, since so many //Otherwise you eat at the hard disk, since so many
//states are being loaded. //states are being loaded.
if(FCEUSS_LoadFP(st,FCEU_BotMode()?0:1)) if(FCEUSS_LoadFP(st,FCEU_BotMode()?SSLOADPARAM_NOBACKUP:SSLOADPARAM_BACKUP))
{ {
if(!fname) if(!fname)
{ {

View File

@ -20,10 +20,17 @@
#include <stdio.h> #include <stdio.h>
enum ENUM_SSLOADPARAMS
{
SSLOADPARAM_NOBACKUP,
SSLOADPARAM_BACKUP,
SSLOADPARAM_DUMMY
};
void FCEUSS_Save(char *); void FCEUSS_Save(char *);
int FCEUSS_Load(char *); int FCEUSS_Load(char *);
int FCEUSS_SaveFP(FILE *); int FCEUSS_SaveFP(FILE *);
int FCEUSS_LoadFP(FILE *, int); int FCEUSS_LoadFP(FILE *, ENUM_SSLOADPARAMS);
extern int CurrentState; extern int CurrentState;
void FCEUSS_CheckStates(void); void FCEUSS_CheckStates(void);
@ -34,6 +41,8 @@ typedef struct {
char *desc; char *desc;
} SFORMAT; } SFORMAT;
void ResetExState(void (*PreSave)(void),void (*PostSave)(void)); void ResetExState(void (*PreSave)(void),void (*PostSave)(void));
void AddExState(void *v, uint32 s, int type, char *desc); void AddExState(void *v, uint32 s, int type, char *desc);