Further normalized all of the Open/Save dialog filters, and static_cast several annoying warnings into oblivion.

This commit is contained in:
ugetab 2010-05-08 02:30:40 +00:00
parent 3862bf0827
commit 8c58b23e77
12 changed files with 25 additions and 25 deletions

View File

@ -219,7 +219,7 @@ void LoadCDLog (const char* nameo)
} }
void LoadCDLogFile(){ void LoadCDLogFile(){
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0\0"; const char filter[]="Code Data Log File (*.CDL)\0*.cdl\0\0";
char nameo[2048]; char nameo[2048];
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));
@ -237,7 +237,7 @@ void LoadCDLogFile(){
} }
void SaveCDLogFileAs(){ void SaveCDLogFileAs(){
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0All Files (*.*)\0*.*\0\0"; const char filter[]="Code Data Log File (*.CDL)\0*.cdl\0All Files (*.*)\0*.*\0\0";
char nameo[2048]; char nameo[2048];
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));
@ -310,8 +310,8 @@ void UpdateCDLogger(){
void SaveStrippedRom(){ //this is based off of iNesSave() void SaveStrippedRom(){ //this is based off of iNesSave()
//todo: make this support nsfs //todo: make this support nsfs
const char NESfilter[]="Stripped iNes Rom file(*.NES)\0*.nes\0All Files (*.*)\0*.*\0\0"; const char NESfilter[]="Stripped iNes Rom file (*.NES)\0*.nes\0All Files (*.*)\0*.*\0\0";
const char NSFfilter[]="Stripped NSF file(*.NSF)\0*.nsf\0All Files (*.*)\0*.*\0\0"; const char NSFfilter[]="Stripped NSF file (*.NSF)\0*.nsf\0All Files (*.*)\0*.*\0\0";
char sromfilename[MAX_PATH]; char sromfilename[MAX_PATH];
FILE *fp; FILE *fp;
OPENFILENAME ofn; OPENFILENAME ofn;

View File

@ -1556,7 +1556,7 @@ void FCEUI_UseInputPreset(int preset)
static void PresetExport(int preset) static void PresetExport(int preset)
{ {
const char filter[]="Input Preset File(*.pre)\0*.pre\0All Files (*.*)\0*.*\0\0"; const char filter[]="Input Preset File (*.pre)\0*.pre\0All Files (*.*)\0*.*\0\0";
char nameo[2048]; char nameo[2048];
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));
@ -1597,7 +1597,7 @@ static void PresetExport(int preset)
static void PresetImport(int preset) static void PresetImport(int preset)
{ {
const char filter[]="Input Preset File(*.pre)\0*.pre\0\0"; const char filter[]="Input Preset File (*.pre)\0*.pre\0\0";
char nameo[2048]; char nameo[2048];
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));

View File

@ -275,7 +275,7 @@ INT_PTR CALLBACK DlgLuaScriptDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
ZeroMemory( (LPVOID)&ofn, sizeof(OPENFILENAME) ); ZeroMemory( (LPVOID)&ofn, sizeof(OPENFILENAME) );
ofn.lStructSize = sizeof(OPENFILENAME); ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hAppWnd; ofn.hwndOwner = hAppWnd;
ofn.lpstrFilter = "Lua scripts (*.lua)\0*.lua\0All files (*.*)\0*.*\0\0"; ofn.lpstrFilter = "Lua scripts (*.lua)\0*.lua\0All Files (*.*)\0*.*\0\0";
ofn.lpstrFile = szFileName; ofn.lpstrFile = szFileName;
ofn.lpstrDefExt = "lua"; ofn.lpstrDefExt = "lua";
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;

View File

@ -371,7 +371,7 @@ int LoadTable(const char* nameo)
//should return -1, otherwise returns the line number it had the error on //should return -1, otherwise returns the line number it had the error on
int LoadTableFile(){ int LoadTableFile(){
const char filter[]="Table Files (*.TBL)\0*.tbl\0All files (*.*)\0*.*\0\0"; const char filter[]="Table Files (*.TBL)\0*.tbl\0All Files (*.*)\0*.*\0\0";
char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead? char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead?
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));

View File

@ -398,7 +398,7 @@ bool iftextchanged()
//Save as... //Save as...
static void SaveMemWatch() static void SaveMemWatch()
{ {
const char filter[]="Memory address list(*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0"; const char filter[]="Memory address list (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0";
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));
@ -497,7 +497,7 @@ static void QuickSaveMemWatch() //Save rather than Save as
//Open Memwatch File //Open Memwatch File
static void LoadMemWatch() static void LoadMemWatch()
{ {
const char filter[]="Memory address list(*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0"; const char filter[]="Memory address list (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0";
char watchfcontents[2048]; char watchfcontents[2048];
//Now clear last file used variable (memwLastFilename) //Now clear last file used variable (memwLastFilename)

View File

@ -31,7 +31,7 @@ bool SetPalette(const char* nameo)
**/ **/
int LoadPaletteFile() int LoadPaletteFile()
{ {
const char filter[]="All usable files(*.pal)\0*.pal\0All files (*.*)\0*.*\0\0"; const char filter[]="All usable files (*.pal)\0*.pal\0All Files (*.*)\0*.*\0\0";
bool success = false; bool success = false;
char nameo[2048]; char nameo[2048];

View File

@ -658,7 +658,7 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
memset(&ofn, 0, sizeof(ofn)); memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg; ofn.hwndOwner = hwndDlg;
ofn.lpstrFilter = "FCEUX Movie Files (*.fm2)\0*.fm2\0Archive files(*.zip,*.rar,*.7z)\0*.zip;*.rar;*.7z\0All files(*.*)\0*.*\0\0"; ofn.lpstrFilter = "FCEUX Movie Files (*.fm2)\0*.fm2\0Archive Files (*.zip,*.rar,*.7z)\0*.zip;*.rar;*.7z\0All Files (*.*)\0*.*\0\0";
ofn.lpstrFile = szFile; ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile); ofn.nMaxFile = sizeof(szFile);
ofn.lpstrInitialDir = pn; ofn.lpstrInitialDir = pn;
@ -873,7 +873,7 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
memset(&ofn, 0, sizeof(ofn)); memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg; ofn.hwndOwner = hwndDlg;
ofn.lpstrFilter = "FCEU Save State(*.fc?)\0*.fc?\0\0"; ofn.lpstrFilter = "FCEU Save State (*.fc?)\0*.fc?\0\0";
ofn.lpstrFile = szChoice; ofn.lpstrFile = szChoice;
ofn.lpstrDefExt = "fcs"; ofn.lpstrDefExt = "fcs";
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
@ -920,7 +920,7 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
memset(&ofn, 0, sizeof(ofn)); memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg; ofn.hwndOwner = hwndDlg;
ofn.lpstrFilter = "FCEUX Movie File (*.fm2)\0*.fm2\0All files(*.*)\0*.*\0\0"; ofn.lpstrFilter = "FCEUX Movie File (*.fm2)\0*.fm2\0All Files (*.*)\0*.*\0\0";
ofn.lpstrFile = szChoice; ofn.lpstrFile = szChoice;
//ofn.lpstrDefExt = "fm2"; //ofn.lpstrDefExt = "fm2";
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;

View File

@ -163,7 +163,7 @@ void UpdateTasEdit()
} }
static int old_movie_readonly=-1; static int old_movie_readonly=-1;
if (old_movie_readonly != movie_readonly) if ((!old_movie_readonly) == movie_readonly) //Originally (old_movie_readonly = movie_readonly)
{ {
old_movie_readonly = movie_readonly; old_movie_readonly = movie_readonly;
if (movie_readonly) if (movie_readonly)
@ -267,7 +267,7 @@ bool JumpToFrame(int index)
return false; return false;
} }
if (index<currMovieData.records.size() && if (static_cast<unsigned int>(index)<currMovieData.records.size() &&
!currMovieData.records[index].savestate.empty() && !currMovieData.records[index].savestate.empty() &&
MovieData::loadSavestateFrom(&currMovieData.records[index].savestate)) MovieData::loadSavestateFrom(&currMovieData.records[index].savestate))
{ {
@ -281,7 +281,7 @@ bool JumpToFrame(int index)
FCEUI_ToggleEmulationPause(); FCEUI_ToggleEmulationPause();
int i = index>0? index-1:0; int i = index>0? index-1:0;
if (i>=currMovieData.records.size()) if (static_cast<unsigned int>(i)>=currMovieData.records.size())
i=currMovieData.records.size()-1; i=currMovieData.records.size()-1;
/* Search for an earlier frame, and try warping to the current. */ /* Search for an earlier frame, and try warping to the current. */
@ -597,7 +597,7 @@ static bool Paste()
// Extract number of frames // Extract number of frames
sscanf (pGlobal+3, "%d", &range); sscanf (pGlobal+3, "%d", &range);
if (currMovieData.records.size()<pos+range) if (currMovieData.records.size()<static_cast<unsigned int>(pos+range))
{ {
currMovieData.insertEmpty(currMovieData.records.size(),pos+range-currMovieData.records.size()); currMovieData.insertEmpty(currMovieData.records.size(),pos+range-currMovieData.records.size());
} }
@ -938,7 +938,7 @@ static void Import()
//Takes current inputlog and saves it as a .fm2 file //Takes current inputlog and saves it as a .fm2 file
static void Export() static void Export()
{ {
const char filter[]="FCEUX Movie File(*.fm2)\0*.fm2\0All Files (*.*)\0*.*\0\0"; const char filter[]="FCEUX Movie File (*.fm2)\0*.fm2\0All Files (*.*)\0*.*\0\0";
char fname[2048] = {0}; char fname[2048] = {0};
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));

View File

@ -583,7 +583,7 @@ int PromptForCDLogger(void){
} }
void ShowLogDirDialog(void){ void ShowLogDirDialog(void){
const char filter[]="6502 Trace Log File(*.log)\0*.log;*.txt\0" "6502 Trace Log File(*.txt)\0*.log;*.txt\0All Files (*.*)\0*.*\0\0"; //'" "' used to prevent octal conversion on the numbers const char filter[]="6502 Trace Log File (*.log)\0*.log;*.txt\0" "6502 Trace Log File (*.txt)\0*.log;*.txt\0All Files (*.*)\0*.*\0\0"; //'" "' used to prevent octal conversion on the numbers
char nameo[2048]; char nameo[2048];
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));

View File

@ -33,7 +33,7 @@ int CloseWave()
/// @return Flag that indicates failure (0) or success (1). /// @return Flag that indicates failure (0) or success (1).
bool CreateSoundSave() bool CreateSoundSave()
{ {
const char filter[]="MS WAVE(*.wav)\0*.wav\0All Files (*.*)\0*.*\0\0"; const char filter[]="MS WAVE (*.wav)\0*.wav\0All Files (*.*)\0*.*\0\0";
char nameo[2048]; char nameo[2048];
OPENFILENAME ofn; OPENFILENAME ofn;

View File

@ -230,7 +230,7 @@ static void ConvertFCM(HWND hwndOwner)
memset(&ofn, 0, sizeof(ofn)); memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndOwner; ofn.hwndOwner = hwndOwner;
ofn.lpstrFilter = "FCEU <2.0 Movie Files (*.fcm)\0*.fcm\0All files(*.*)\0*.*\0\0"; ofn.lpstrFilter = "FCEU <2.0 Movie Files (*.fcm)\0*.fcm\0All Files (*.*)\0*.*\0\0";
ofn.lpstrFile = new char[640*1024]; //640K should be enough for anyone ofn.lpstrFile = new char[640*1024]; //640K should be enough for anyone
ofn.lpstrFile[0] = 0; ofn.lpstrFile[0] = 0;
ofn.nMaxFile = 640*1024; ofn.nMaxFile = 640*1024;
@ -1077,7 +1077,7 @@ bool ALoad(char *nameo, char* innerFilename)
/// @param initialdir Directory that's pre-selected in the Open File dialog. /// @param initialdir Directory that's pre-selected in the Open File dialog.
void LoadNewGamey(HWND hParent, const char *initialdir) void LoadNewGamey(HWND hParent, const char *initialdir)
{ {
const char filter[] = "All usable files(*.nes,*.nsf,*.fds,*.unf,*.zip,*.rar,*.7z,*.gz)\0*.nes;*.nsf;*.fds;*.unf;*.zip;*.rar;*.7z;*.gz\0All non-compressed usable files(*.nes,*.nsf,*.fds,*.unf)\0*.nes;*.nsf;*.fds;*.unf\0All files (*.*)\0*.*\0\0"; const char filter[] = "All usable files (*.nes,*.nsf,*.fds,*.unf,*.zip,*.rar,*.7z,*.gz)\0*.nes;*.nsf;*.fds;*.unf;*.zip;*.rar;*.7z;*.gz\0All non-compressed usable files (*.nes,*.nsf,*.fds,*.unf)\0*.nes;*.nsf;*.fds;*.unf\0All Files (*.*)\0*.*\0\0";
char nameo[2048]; char nameo[2048];
// Create the Open File dialog // Create the Open File dialog

View File

@ -126,7 +126,7 @@ void MovieData::TryDumpIncremental()
if(movieMode == MOVIEMODE_TASEDIT) if(movieMode == MOVIEMODE_TASEDIT)
{ {
//only log the savestate if we are appending to the green zone //only log the savestate if we are appending to the green zone
if (turbo && pauseframe!=-1 && currFrameCounter<currMovieData.records.size()) if (turbo && pauseframe!=-1 && static_cast<unsigned int>(currFrameCounter)<currMovieData.records.size())
{ {
if (turbo && pauseframe-256>currFrameCounter && ((currFrameCounter-pauseframe)&0xff)) if (turbo && pauseframe-256>currFrameCounter && ((currFrameCounter-pauseframe)&0xff))
return; return;
@ -144,7 +144,7 @@ void MovieData::TryDumpIncremental()
} else if (currFrameCounter < currMovieData.greenZoneCount || !movie_readonly) } else if (currFrameCounter < currMovieData.greenZoneCount || !movie_readonly)
{ {
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION); MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION);
} else if (currFrameCounter > currMovieData.greenZoneCount && currMovieData.greenZoneCount<currMovieData.records.size()) } else if (currFrameCounter > currMovieData.greenZoneCount && static_cast<unsigned int>(currMovieData.greenZoneCount)<currMovieData.records.size())
{ {
/* May be required in some malformed TAS projects. */ /* May be required in some malformed TAS projects. */
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION); MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION);