fixed saving/loading movies in sdl port

This commit is contained in:
punkrockguy318 2008-07-03 06:35:37 +00:00
parent 48e8f5d378
commit 7429008e25
4 changed files with 45 additions and 11 deletions

View File

@ -569,6 +569,11 @@ Config::parse(int argc,
*
* Lines beginning with # are ignored.
*/
char* Config::getConfigDirectory()
{
return strdup(_dir.c_str());
}
int
Config::_load()
{

View File

@ -76,6 +76,13 @@ public:
*/
int parse(int, char **);
/**
* Returns the directory of the configuration files.
*
*/
char* getConfigDirectory();
/**
* Save all of the current configuration options to the
* configuration file.

View File

@ -2,3 +2,5 @@
Config *InitConfig(void);
void UpdateEMUCore(Config *);

View File

@ -92,6 +92,9 @@ static uint32 FTrainerData = 0;
static uint8 TopRiderData = 0;
static uint8 BWorldData[1+13+1];
int movie_slot = 1;
static void UpdateFKB(void);
static void UpdateGamepad(void);
static void UpdateQuizKing(void);
@ -142,6 +145,8 @@ _keyonly(int a)
static int g_fkbEnabled = 0;
/**
* Parse keyboard commands and execute accordingly.
*/
@ -217,7 +222,15 @@ KeyboardCommands()
g_config->getOption("SDL.Hotkeys.SaveState", &key);
if(_keyonly(key)) {
if(is_shift) {
FCEUI_SaveMovie(NULL,MOVIE_FLAG_NONE);
char* fname = g_config->getConfigDirectory();
char fnum[2];
strcat(fname, "/fcm/");
sprintf(fnum, "%d", movie_slot);
strcat(fname, fnum);
strcat(fname, ".fcm");
FCEUI_printf("Recording movie to %s\n", fname);
FCEUI_SaveMovie(fname, MOVIE_FLAG_NONE);
} else {
FCEUI_SaveState(NULL);
}
@ -227,8 +240,15 @@ KeyboardCommands()
// f7 to load state, Shift-f7 to load movie
if(_keyonly(key)) {
if(is_shift) {
//mbg merge 7/23/06 loadmovie takes another arg now
FCEUI_LoadMovie(NULL, false, false, false);
char* fname = g_config->getConfigDirectory();
char fnum[2];
strcat(fname, "/fcm/");
sprintf(fnum, "%d", movie_slot);
strcat(fname, fnum);
strcat(fname, ".fcm");
FCEUI_printf("Playing back movie located at %s\n", fname);
FCEUI_LoadMovie(fname , false, false, false);
} else {
FCEUI_LoadState(NULL);
}
@ -332,9 +352,9 @@ do { \
} \
FCEUI_DispMessage("Barcode: %s", bbuf); \
} else { \
/*if(is_shift) { \
FCEUI_SelectMovie(x,1); \
} else */{ \
if(is_shift) { \
movie_slot = x; \
} else { \
FCEUI_SelectState(x,1); \
} \
} \