SF [ 2047004 ] Moviefilenames without extension don't automatically get fm2
This commit is contained in:
parent
8498dac6c2
commit
215d329804
|
@ -2,6 +2,7 @@
|
||||||
10-aug-2008 - punkrockguy318 - SDL: cleaned up the SConsruct
|
10-aug-2008 - punkrockguy318 - SDL: cleaned up the SConsruct
|
||||||
10-aug-2008 - punkrockguy318 - SDL: fixed issue where fceu would lock up when file dialogs were opened during fullscreen
|
10-aug-2008 - punkrockguy318 - SDL: fixed issue where fceu would lock up when file dialogs were opened during fullscreen
|
||||||
|
|
||||||
|
11-aug-2008 - zeromus - SF [ 2047004 ] Moviefilenames without extension don't automatically get fm2
|
||||||
10-aug-2008 - zeromus - upgrade to cah4e3's latest mapper 163&164 code to fix a crash in a game
|
10-aug-2008 - zeromus - upgrade to cah4e3's latest mapper 163&164 code to fix a crash in a game
|
||||||
10-aug-2008 - zeromus - remove cnrom chr rom size limit for homebrew roms
|
10-aug-2008 - zeromus - remove cnrom chr rom size limit for homebrew roms
|
||||||
10-aug-2008 - punkrockguy318 - SDL: fixed bug where fceux would close when file dialogs were closed
|
10-aug-2008 - punkrockguy318 - SDL: fixed bug where fceux would close when file dialogs were closed
|
||||||
|
|
|
@ -149,8 +149,8 @@ void FCEUD_SoundVolumeAdjust(int);
|
||||||
int FCEUI_SelectState(int, int);
|
int FCEUI_SelectState(int, int);
|
||||||
|
|
||||||
//"fname" overrides the default save state filename code if non-NULL.
|
//"fname" overrides the default save state filename code if non-NULL.
|
||||||
void FCEUI_SaveState(char *fname);
|
void FCEUI_SaveState(const char *fname);
|
||||||
void FCEUI_LoadState(char *fname);
|
void FCEUI_LoadState(const char *fname);
|
||||||
|
|
||||||
void FCEUD_SaveStateAs(void);
|
void FCEUD_SaveStateAs(void);
|
||||||
void FCEUD_LoadStateFrom(void);
|
void FCEUD_LoadStateFrom(void);
|
||||||
|
|
|
@ -59,9 +59,9 @@ static char* GetReplayPath(HWND hwndDlg)
|
||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* GetRecordPath(HWND hwndDlg)
|
static std::string GetRecordPath(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
char* fn=0;
|
std::string fn;
|
||||||
char szChoice[MAX_PATH];
|
char szChoice[MAX_PATH];
|
||||||
char szDrive[MAX_PATH]={0};
|
char szDrive[MAX_PATH]={0};
|
||||||
char szDirectory[MAX_PATH]={0};
|
char szDirectory[MAX_PATH]={0};
|
||||||
|
@ -71,10 +71,17 @@ static char* GetRecordPath(HWND hwndDlg)
|
||||||
GetDlgItemText(hwndDlg, IDC_EDIT_FILENAME, szChoice, sizeof(szChoice));
|
GetDlgItemText(hwndDlg, IDC_EDIT_FILENAME, szChoice, sizeof(szChoice));
|
||||||
|
|
||||||
_splitpath(szChoice, szDrive, szDirectory, szFilename, szExt);
|
_splitpath(szChoice, szDrive, szDirectory, szFilename, szExt);
|
||||||
|
|
||||||
|
//make sure that there is an extension of fm2
|
||||||
|
if(stricmp(szExt,".fm2")) {
|
||||||
|
strcpy(szExt,".fm2");
|
||||||
|
_makepath(szChoice,szDrive,szDirectory,szFilename,szExt);
|
||||||
|
}
|
||||||
|
|
||||||
if(szDrive[0]=='\0' && szDirectory[0]=='\0')
|
if(szDrive[0]=='\0' && szDirectory[0]=='\0')
|
||||||
fn=strdup(FCEU_MakePath(FCEUMKF_MOVIE, szChoice).c_str()); // need to make a full path
|
fn=FCEU_MakePath(FCEUMKF_MOVIE, szChoice); // need to make a full path
|
||||||
else
|
else
|
||||||
fn=strdup(szChoice); // given a full path
|
fn= szChoice; // given a full path
|
||||||
|
|
||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
@ -654,14 +661,13 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
static void UpdateRecordDialog(HWND hwndDlg)
|
static void UpdateRecordDialog(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
int enable=0;
|
int enable=0;
|
||||||
char* fn=0;
|
|
||||||
|
|
||||||
fn=GetRecordPath(hwndDlg);
|
std::string fn=GetRecordPath(hwndDlg);
|
||||||
|
|
||||||
if(fn)
|
if(fn!="")
|
||||||
{
|
{
|
||||||
if(access(fn, F_OK) ||
|
if(access(fn.c_str(), F_OK) ||
|
||||||
!access(fn, W_OK))
|
!access(fn.c_str(), W_OK))
|
||||||
{
|
{
|
||||||
LONG lCount = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCOUNT, 0, 0);
|
LONG lCount = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCOUNT, 0, 0);
|
||||||
LONG lIndex = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCURSEL, 0, 0);
|
LONG lIndex = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCURSEL, 0, 0);
|
||||||
|
@ -671,31 +677,30 @@ static void UpdateRecordDialog(HWND hwndDlg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(fn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EnableWindow(GetDlgItem(hwndDlg,IDOK),enable ? TRUE : FALSE);
|
EnableWindow(GetDlgItem(hwndDlg,IDOK),enable ? TRUE : FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateRecordDialogPath(HWND hwndDlg, const char* fname)
|
static void UpdateRecordDialogPath(HWND hwndDlg, const std::string &fname)
|
||||||
{
|
{
|
||||||
char* baseMovieDir = strdup(FCEU_GetPath(FCEUMKF_MOVIE).c_str());
|
char* baseMovieDir = strdup(FCEU_GetPath(FCEUMKF_MOVIE).c_str());
|
||||||
char* fn=0;
|
char* fn=0;
|
||||||
|
|
||||||
// display a shortened filename if the file exists in the base movie directory
|
// display a shortened filename if the file exists in the base movie directory
|
||||||
if(!strncmp(fname, baseMovieDir, strlen(baseMovieDir)))
|
if(!strncmp(fname.c_str(), baseMovieDir, strlen(baseMovieDir)))
|
||||||
{
|
{
|
||||||
char szDrive[MAX_PATH]={0};
|
char szDrive[MAX_PATH]={0};
|
||||||
char szDirectory[MAX_PATH]={0};
|
char szDirectory[MAX_PATH]={0};
|
||||||
char szFilename[MAX_PATH]={0};
|
char szFilename[MAX_PATH]={0};
|
||||||
char szExt[MAX_PATH]={0};
|
char szExt[MAX_PATH]={0};
|
||||||
|
|
||||||
_splitpath(fname, szDrive, szDirectory, szFilename, szExt);
|
_splitpath(fname.c_str(), szDrive, szDirectory, szFilename, szExt);
|
||||||
fn=(char*)malloc(strlen(szFilename)+strlen(szExt)+1);
|
fn=(char*)malloc(strlen(szFilename)+strlen(szExt)+1);
|
||||||
_makepath(fn, "", "", szFilename, szExt);
|
_makepath(fn, "", "", szFilename, szExt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fn=strdup(fname);
|
fn=strdup(fname.c_str());
|
||||||
|
|
||||||
if(fn)
|
if(fn)
|
||||||
{
|
{
|
||||||
|
@ -713,8 +718,7 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
p = (struct CreateMovieParameters*)lParam;
|
p = (struct CreateMovieParameters*)lParam;
|
||||||
UpdateRecordDialogPath(hwndDlg, p->szFilename);
|
UpdateRecordDialogPath(hwndDlg, p->szFilename);
|
||||||
free(p->szFilename);
|
p->szFilename = "";
|
||||||
p->szFilename = 0;
|
|
||||||
|
|
||||||
SendMessage(GetDlgItem(hwndDlg,IDC_EDIT_AUTHOR), CCM_SETUNICODEFORMAT, TRUE, 0);
|
SendMessage(GetDlgItem(hwndDlg,IDC_EDIT_AUTHOR), CCM_SETUNICODEFORMAT, TRUE, 0);
|
||||||
|
|
||||||
|
@ -855,7 +859,7 @@ void FCEUD_MovieRecordTo()
|
||||||
{
|
{
|
||||||
// attempt to load the savestate
|
// attempt to load the savestate
|
||||||
// FIXME: pop open a messagebox if this fails
|
// FIXME: pop open a messagebox if this fails
|
||||||
FCEUI_LoadState(p.szSavestateFilename);
|
FCEUI_LoadState(p.szSavestateFilename.c_str());
|
||||||
{
|
{
|
||||||
extern int loadStateFailed;
|
extern int loadStateFailed;
|
||||||
|
|
||||||
|
@ -866,17 +870,12 @@ void FCEUD_MovieRecordTo()
|
||||||
FCEUD_PrintError(str);
|
FCEUD_PrintError(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(p.szSavestateFilename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EMOVIE_FLAG flags = MOVIE_FLAG_NONE;
|
EMOVIE_FLAG flags = MOVIE_FLAG_NONE;
|
||||||
if(p.recordFrom == 0) flags = MOVIE_FLAG_FROM_POWERON;
|
if(p.recordFrom == 0) flags = MOVIE_FLAG_FROM_POWERON;
|
||||||
FCEUI_SaveMovie(p.szFilename, flags, p.author);
|
FCEUI_SaveMovie(p.szFilename.c_str(), flags, p.author);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p.szFilename)
|
|
||||||
free(p.szFilename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
struct CreateMovieParameters
|
struct CreateMovieParameters
|
||||||
{
|
{
|
||||||
char* szFilename; // on Dialog creation, this is the default filename to display. On return, this is the filename that the user chose.
|
std::string 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
|
int recordFrom; // 0 = "Power-On", 1 = "Reset", 2 = "Now", 3+ = savestate file in szSavestateFilename
|
||||||
char* szSavestateFilename;
|
std::string szSavestateFilename;
|
||||||
std::wstring author;
|
std::wstring author;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -517,7 +517,7 @@ std::string FCEU_MakePath(int type, const char* filebase)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FCEU_MakeFName(int type, int id1, char *cd1)
|
std::string FCEU_MakeFName(int type, int id1, const char *cd1)
|
||||||
{
|
{
|
||||||
char ret[FILENAME_MAX] = "";
|
char ret[FILENAME_MAX] = "";
|
||||||
struct stat tmpstat;
|
struct stat tmpstat;
|
||||||
|
|
|
@ -81,7 +81,7 @@ int FCEU_fisarchive(FCEUFILE*);
|
||||||
void GetFileBase(const char *f);
|
void GetFileBase(const char *f);
|
||||||
std::string FCEU_GetPath(int type);
|
std::string FCEU_GetPath(int type);
|
||||||
std::string FCEU_MakePath(int type, const char* filebase);
|
std::string FCEU_MakePath(int type, const char* filebase);
|
||||||
std::string FCEU_MakeFName(int type, int id1, char *cd1);
|
std::string FCEU_MakeFName(int type, int id1, const char *cd1);
|
||||||
void FCEU_SplitArchiveFilename(std::string src, std::string& archive, std::string& file, std::string& fileToOpen);
|
void FCEU_SplitArchiveFilename(std::string src, std::string& archive, std::string& file, std::string& fileToOpen);
|
||||||
|
|
||||||
#define FCEUMKF_STATE 1
|
#define FCEUMKF_STATE 1
|
||||||
|
|
|
@ -410,7 +410,7 @@ bool FCEUSS_SaveMS(std::ostream* outstream, int compressionLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FCEUSS_Save(char *fname)
|
void FCEUSS_Save(const char *fname)
|
||||||
{
|
{
|
||||||
std::fstream* st = 0;
|
std::fstream* st = 0;
|
||||||
char *fn;
|
char *fn;
|
||||||
|
@ -608,7 +608,7 @@ bool FCEUSS_LoadFP(std::istream* is, ENUM_SSLOADPARAMS params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FCEUSS_Load(char *fname)
|
bool FCEUSS_Load(const char *fname)
|
||||||
{
|
{
|
||||||
std::fstream* st;
|
std::fstream* st;
|
||||||
|
|
||||||
|
@ -758,7 +758,7 @@ int FCEUI_SelectState(int w, int show)
|
||||||
return oldstate;
|
return oldstate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCEUI_SaveState(char *fname)
|
void FCEUI_SaveState(const char *fname)
|
||||||
{
|
{
|
||||||
if(!FCEU_IsValidUI(FCEUI_SAVESTATE)) return;
|
if(!FCEU_IsValidUI(FCEUI_SAVESTATE)) return;
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ void FCEUI_SaveState(char *fname)
|
||||||
|
|
||||||
int loadStateFailed = 0; // hack, this function should return a value instead
|
int loadStateFailed = 0; // hack, this function should return a value instead
|
||||||
|
|
||||||
void FCEUI_LoadState(char *fname)
|
void FCEUI_LoadState(const char *fname)
|
||||||
{
|
{
|
||||||
if(!FCEU_IsValidUI(FCEUI_LOADSTATE)) return;
|
if(!FCEU_IsValidUI(FCEUI_LOADSTATE)) return;
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ enum ENUM_SSLOADPARAMS
|
||||||
SSLOADPARAM_BACKUP,
|
SSLOADPARAM_BACKUP,
|
||||||
};
|
};
|
||||||
|
|
||||||
void FCEUSS_Save(char *);
|
void FCEUSS_Save(const char *);
|
||||||
bool FCEUSS_Load(char *);
|
bool FCEUSS_Load(const char *);
|
||||||
|
|
||||||
//zlib values: 0 (none) through 9 (max) or -1 (default)
|
//zlib values: 0 (none) through 9 (max) or -1 (default)
|
||||||
bool FCEUSS_SaveMS(std::ostream* outstream, int compressionLevel);
|
bool FCEUSS_SaveMS(std::ostream* outstream, int compressionLevel);
|
||||||
|
|
Loading…
Reference in New Issue