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

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

View File

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

View File

@ -24,7 +24,7 @@
#include "dface.h"
#include "input.h"
#include "config.h"
#include "sdl-video.h"
@ -91,6 +91,9 @@ static uint32 MahjongData = 0;
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);
@ -140,7 +143,9 @@ _keyonly(int a)
#define keyonly(__a) _keyonly(MKK(__a))
static int g_fkbEnabled = 0;
static int g_fkbEnabled = 0;
/**
* Parse keyboard commands and execute accordingly.
@ -216,8 +221,16 @@ KeyboardCommands()
g_config->getOption("SDL.Hotkeys.SaveState", &key);
if(_keyonly(key)) {
if(is_shift) {
FCEUI_SaveMovie(NULL,MOVIE_FLAG_NONE);
if(is_shift) {
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);
}
@ -226,9 +239,16 @@ KeyboardCommands()
g_config->getOption("SDL.Hotkeys.LoadState", &key);
// 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);
if(is_shift) {
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,11 +352,11 @@ 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); \
} \
} \
} \
} while(0)