win32: some dialog flags/extensions fixes, minor menu readability/grammar fixes, and changing some instances of "Gens" to "DeSmuME"

This commit is contained in:
nitsuja 2009-08-04 10:06:01 +00:00
parent 194723d96d
commit 84f637865f
10 changed files with 39 additions and 32 deletions

View File

@ -4,7 +4,7 @@
#include "NDSSystem.h" #include "NDSSystem.h"
// 7zip file extraction // 7zip file extraction
// NOTE: if you want to add support for opening files within archives to some part of Gens, // NOTE: if you want to add support for opening files within archives to some part of DeSmuME,
// consider using the higher-level interface provided by OpenArchive.h instead // consider using the higher-level interface provided by OpenArchive.h instead
void InitDecoder(); void InitDecoder();

View File

@ -147,7 +147,7 @@ int ChooseItemFromArchive(ArchiveFile& archive, bool autoChooseIfOnly1, const ch
#define DEFAULT_EXTENSION ".tmp" #define DEFAULT_EXTENSION ".tmp"
#define DEFAULT_CATEGORY "gens" #define DEFAULT_CATEGORY "desmume"
static struct TempFiles static struct TempFiles
{ {
@ -284,7 +284,7 @@ static struct TempFiles
{ {
char gbgFile[1024]; char gbgFile[1024];
GetTempPath(1024, gbgFile); GetTempPath(1024, gbgFile);
strcat(gbgFile, "GensTempFileRecords"); strcat(gbgFile, "DesmumeTempFileRecords");
char key[64]; char key[64];
int i = 0; int i = 0;
while(true) while(true)
@ -301,7 +301,7 @@ static struct TempFiles
{ {
char gbgFile[1024]; char gbgFile[1024];
GetTempPath(1024, gbgFile); GetTempPath(1024, gbgFile);
strcat(gbgFile, "GensTempFileRecords"); strcat(gbgFile, "DesmumeTempFileRecords");
char key[64]; char key[64];
int i = 0; int i = 0;
int deleteSlot = -1; int deleteSlot = -1;
@ -337,9 +337,9 @@ static struct TempFiles
private: private:
static void CleanOutGarbageRegistry() static void CleanOutGarbageRegistry()
{ {
char gbgFile[1024]; char gbgFile[1024 + 48];
GetTempPath(1024, gbgFile); GetTempPath(1024, gbgFile);
strcat(gbgFile, "GensTempFileRecords"); strcat(gbgFile, "DesmumeTempFileRecords");
char key[64]; char key[64];
int i = 0; int i = 0;
@ -376,8 +376,8 @@ void ReleaseTempFileCategory(const char* cat, const char* exceptionFilename)
// example input Name: "C:\games.zip" // example input Name: "C:\games.zip"
// example output LogicalName: "C:\games.zip|Sonic.smd" // example output LogicalName: "C:\games.zip|Sonic.nds"
// example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\Gens\dec3.tmp" // example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\Desmume\dec3.tmp"
// assumes arguments are character buffers with 1024 bytes each // assumes arguments are character buffers with 1024 bytes each
bool ObtainFile(const char* Name, char *const & LogicalName, char *const & PhysicalName, const char* category, const char** ignoreExtensions, int numIgnoreExtensions) bool ObtainFile(const char* Name, char *const & LogicalName, char *const & PhysicalName, const char* category, const char** ignoreExtensions, int numIgnoreExtensions)
{ {

View File

@ -15,8 +15,8 @@
// for you to load with fopen or whatever, // for you to load with fopen or whatever,
// unless the function fails (or is cancelled) in which case it will return false. // unless the function fails (or is cancelled) in which case it will return false.
// example input Name: "C:\games.zip" // example input Name: "C:\games.zip"
// example output LogicalName: "C:\games.zip|Sonic.smd" // example output LogicalName: "C:\games.zip|Sonic.nds"
// example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\Gens\rom7A37.smd" // example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\DeSmuME\rom7A37.smd"
// assumes the three name arguments are unique character buffers with exactly 1024 bytes each // assumes the three name arguments are unique character buffers with exactly 1024 bytes each
bool ObtainFile(const char* Name, char *const & LogicalName, char *const & PhysicalName, const char* category=NULL, const char** ignoreExtensions=NULL, int numIgnoreExtensions=0); bool ObtainFile(const char* Name, char *const & LogicalName, char *const & PhysicalName, const char* category=NULL, const char** ignoreExtensions=NULL, int numIgnoreExtensions=0);
@ -31,7 +31,7 @@ bool ObtainFile(const char* Name, char *const & LogicalName, char *const & Physi
void ReleaseTempFileCategory(const char* category, const char* exceptionFilename=NULL); void ReleaseTempFileCategory(const char* category, const char* exceptionFilename=NULL);
// sets the parent window of subsequent archive selector dialogs // sets the parent window of subsequent archive selector dialogs
// NULL resets this to the default (main Gens emulator window) // NULL resets this to the default (main emulator window)
void SetArchiveParentHWND(void* hwnd=NULL); void SetArchiveParentHWND(void* hwnd=NULL);
// the rest of these are more internal utility functions, // the rest of these are more internal utility functions,

View File

@ -127,7 +127,7 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
ofn.lpstrFile = filename; ofn.lpstrFile = filename;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "img"; ofn.lpstrDefExt = "img";
ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT; ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT | OFN_PATHMUSTEXIST;
if(!GetOpenFileName(&ofn)) return FALSE; if(!GetOpenFileName(&ofn)) return FALSE;
@ -271,7 +271,7 @@ BOOL CALLBACK GbaSlotGBAgame(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
ofn.lpstrFile = filename; ofn.lpstrFile = filename;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "gba"; ofn.lpstrDefExt = "gba";
ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST;
if(!GetOpenFileName(&ofn)) return FALSE; if(!GetOpenFileName(&ofn)) return FALSE;

View File

@ -93,7 +93,8 @@ void HK_PrintScreen(int param)
ofn.lpstrTitle = "Print Screen Save As"; ofn.lpstrTitle = "Print Screen Save As";
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrFile = outFilename; ofn.lpstrFile = outFilename;
ofn.Flags = OFN_OVERWRITEPROMPT; ofn.lpstrDefExt = "png";
ofn.Flags = OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
std::string filename = path.getpath(path.SCREENSHOTS); std::string filename = path.getpath(path.SCREENSHOTS);

View File

@ -1293,7 +1293,7 @@ void LoadSaveStateInfo()
{ {
if(savestates[i].exists) if(savestates[i].exists)
{ {
sprintf(ntxt, "%d %s", i+1, savestates[i].date); sprintf(ntxt, "&%d %s", i+1, savestates[i].date);
UpdateSaveStateMenu(i, ntxt); UpdateSaveStateMenu(i, ntxt);
} }
} }
@ -2237,7 +2237,7 @@ void AviRecordTo()
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
if(GetSaveFileName(&ofn)) if(GetSaveFileName(&ofn))
{ {
@ -2293,7 +2293,7 @@ void WavRecordTo()
ofn.lpstrTitle = "Save WAV as"; ofn.lpstrTitle = "Save WAV as";
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
if(GetSaveFileName(&ofn)) if(GetSaveFileName(&ofn))
{ {
@ -2394,7 +2394,7 @@ LRESULT OpenFile()
ofn.lpstrFile = filename; ofn.lpstrFile = filename;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "nds"; ofn.lpstrDefExt = "nds";
ofn.Flags = OFN_NOCHANGEDIR; ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
char buffer[MAX_PATH]; char buffer[MAX_PATH];
ZeroMemory(buffer, sizeof(buffer)); ZeroMemory(buffer, sizeof(buffer));
@ -3014,9 +3014,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
//------------------------------------------------------- //-------------------------------------------------------
else if (!(fileDropped.find(".ds") == string::npos)) else if (!(fileDropped.find(".ds") == string::npos))
{ {
if (fileDropped.find(".ds") == fileDropped.length()-4) //Check to see it is both at the end (file extension) and there is on more character size_t extIndex = fileDropped.find(".ds");
if (extIndex <= fileDropped.length()-4) //Check to see it is both at the end (file extension) and there is on more character
{ {
if ((fileDropped[fileDropped.length()-1] >= '0' && fileDropped[fileDropped.length()-1] <= '9') || fileDropped[fileDropped.length()-1] == 't') //If last character is 0-9 (making .ds0 - .ds9) or .dst if ((fileDropped[extIndex+3] >= '0' && fileDropped[extIndex+3] <= '9') || fileDropped[extIndex+3] == '-' || fileDropped[extIndex+3] == 't') //If last character is 0-9 (making .ds0 - .ds9) or .dst
{ {
savestate_load(filename); savestate_load(filename);
Update_RAM_Watch(); //adelikat: TODO this should be a single function call in main, that way we can expand as future dialogs need updating Update_RAM_Watch(); //adelikat: TODO this should be a single function call in main, that way we can expand as future dialogs need updating
@ -3245,11 +3246,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
ZeroMemory(&ofn, sizeof(ofn)); ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd; ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "DeSmuME Savestate (*.dst)\0*.dst\0All files (*.*)\0*.*\0\0"; ofn.lpstrFilter = "DeSmuME Savestate (*.dst or *.ds#)\0*.dst;*.ds0*;*.ds1*;*.ds2*;*.ds3*;*.ds4*;*.ds5*;*.ds6*;*.ds7*;*.ds8*;*.ds9*;*.ds-*\0DeSmuME Savestate (*.dst only)\0*.dst\0All files (*.*)\0*.*\0\0";
ofn.nFilterIndex = 1; ofn.nFilterIndex = 1;
ofn.lpstrFile = SavName; ofn.lpstrFile = SavName;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "dst"; ofn.lpstrDefExt = "dst";
ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
char buffer[MAX_PATH]; char buffer[MAX_PATH];
ZeroMemory(buffer, sizeof(buffer)); ZeroMemory(buffer, sizeof(buffer));
@ -3275,11 +3277,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
ZeroMemory(&ofn, sizeof(ofn)); ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd; ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "DeSmuME Savestate (*.dst)\0*.dst\0\0"; ofn.lpstrFilter = "DeSmuME Savestate (*.dst or *.ds#)\0*.dst;*.ds0*;*.ds1*;*.ds2*;*.ds3*;*.ds4*;*.ds5*;*.ds6*;*.ds7*;*.ds8*;*.ds9*;*.ds-*\0DeSmuME Savestate (*.dst only)\0*.dst\0All files (*.*)\0*.*\0\0";
ofn.nFilterIndex = 1; ofn.nFilterIndex = 1;
ofn.lpstrFile = SavName; ofn.lpstrFile = SavName;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "dst"; ofn.lpstrDefExt = "dst";
ofn.Flags = OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
char buffer[MAX_PATH]; char buffer[MAX_PATH];
ZeroMemory(buffer, sizeof(buffer)); ZeroMemory(buffer, sizeof(buffer));
@ -3351,6 +3354,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
ofn.lpstrFile = ImportSavName; ofn.lpstrFile = ImportSavName;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "duc"; ofn.lpstrDefExt = "duc";
ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
char buffer[MAX_PATH]; char buffer[MAX_PATH];
ZeroMemory(buffer, sizeof(buffer)); ZeroMemory(buffer, sizeof(buffer));
@ -3380,6 +3384,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
ofn.lpstrFile = ImportSavName; ofn.lpstrFile = ImportSavName;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "sav"; ofn.lpstrDefExt = "sav";
ofn.Flags = OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
if(!GetSaveFileName(&ofn)) if(!GetSaveFileName(&ofn))
{ {
@ -4104,7 +4109,7 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L
ofn.lpstrFile = fileName; ofn.lpstrFile = fileName;
ofn.nMaxFile = 256; ofn.nMaxFile = 256;
ofn.lpstrDefExt = "bin"; ofn.lpstrDefExt = "bin";
ofn.Flags = OFN_NOCHANGEDIR; ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
char buffer[MAX_PATH]; char buffer[MAX_PATH];
ZeroMemory(buffer, sizeof(buffer)); ZeroMemory(buffer, sizeof(buffer));
@ -4216,7 +4221,7 @@ LRESULT CALLBACK MicrophoneSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam,
ofn.lpstrFile = fileName; ofn.lpstrFile = fileName;
ofn.nMaxFile = 256; ofn.nMaxFile = 256;
ofn.lpstrDefExt = "bin"; ofn.lpstrDefExt = "bin";
ofn.Flags = OFN_NOCHANGEDIR; ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
char buffer[MAX_PATH]; char buffer[MAX_PATH];
ZeroMemory(buffer, sizeof(buffer)); ZeroMemory(buffer, sizeof(buffer));

View File

@ -275,7 +275,7 @@ BOOL CALLBACK MemView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
ofn.lpstrFile = fileName; ofn.lpstrFile = fileName;
ofn.nMaxFile = 256; ofn.nMaxFile = 256;
ofn.lpstrDefExt = "txt"; ofn.lpstrDefExt = "txt";
ofn.Flags = OFN_NOCHANGEDIR; ofn.Flags = OFN_NOCHANGEDIR | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
if(GetSaveFileName(&ofn)) if(GetSaveFileName(&ofn))
{ {
@ -356,7 +356,7 @@ BOOL CALLBACK MemView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
ofn.lpstrFile = fileName; ofn.lpstrFile = fileName;
ofn.nMaxFile = 256; ofn.nMaxFile = 256;
ofn.lpstrDefExt = "bin"; ofn.lpstrDefExt = "bin";
ofn.Flags = OFN_NOCHANGEDIR; ofn.Flags = OFN_NOCHANGEDIR | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
if(GetSaveFileName(&ofn)) if(GetSaveFileName(&ofn))
{ {

View File

@ -442,7 +442,7 @@ int Change_File_S(char *Dest, char *Dir, char *Titre, char *Filter, char *Ext, H
ofn.lpstrInitialDir = Dir; ofn.lpstrInitialDir = Dir;
ofn.lpstrTitle = Titre; ofn.lpstrTitle = Titre;
ofn.lpstrDefExt = Ext; ofn.lpstrDefExt = Ext;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY; ofn.Flags = OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN;
if (GetSaveFileName(&ofn)) return 1; if (GetSaveFileName(&ofn)) return 1;
@ -455,7 +455,7 @@ bool Save_Watches()
Rom_Name = path.GetRomName(); Rom_Name = path.GetRomName();
strncpy(Str_Tmp,Rom_Name.c_str(),512); strncpy(Str_Tmp,Rom_Name.c_str(),512);
strcat(Str_Tmp,".wch"); strcat(Str_Tmp,".wch");
if(Change_File_S(Str_Tmp, Gens_Path, "Save Watches", "GENs Watchlist\0*.wch\0All Files\0*.*\0\0", "wch", RamWatchHWnd)) if(Change_File_S(Str_Tmp, Gens_Path, "Save Watches", "DeSmuME Watchlist\0*.wch\0All Files\0*.*\0\0", "wch", RamWatchHWnd))
{ {
FILE *WatchFile = fopen(Str_Tmp,"r+b"); FILE *WatchFile = fopen(Str_Tmp,"r+b");
if (!WatchFile) WatchFile = fopen(Str_Tmp,"w+b"); if (!WatchFile) WatchFile = fopen(Str_Tmp,"w+b");
@ -589,7 +589,7 @@ bool Load_Watches(bool clear)
Rom_Name = path.GetRomName(); Rom_Name = path.GetRomName();
strncpy(Str_Tmp,Rom_Name.c_str(),512); strncpy(Str_Tmp,Rom_Name.c_str(),512);
strcat(Str_Tmp,".wch"); strcat(Str_Tmp,".wch");
if(Change_File_L(Str_Tmp, Watch_Dir, "Load Watches", "GENs Watchlist\0*.wch\0All Files\0*.*\0\0", "wch", RamWatchHWnd)) if(Change_File_L(Str_Tmp, Watch_Dir, "Load Watches", "DeSmuME Watchlist\0*.wch\0All Files\0*.*\0\0", "wch", RamWatchHWnd))
{ {
return Load_Watches(clear, Str_Tmp); return Load_Watches(clear, Str_Tmp);
} }

View File

@ -86,6 +86,7 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
ofn.lpstrTitle = "Replay Movie from File"; ofn.lpstrTitle = "Replay Movie from File";
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "dsm"; ofn.lpstrDefExt = "dsm";
ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
GetOpenFileName(&ofn); GetOpenFileName(&ofn);
strcpy(playfilename, filename); strcpy(playfilename, filename);
Describe(hwndDlg); Describe(hwndDlg);
@ -158,7 +159,7 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
ofn.lpstrTitle = "Record a new movie"; ofn.lpstrTitle = "Record a new movie";
ofn.lpstrDefExt = "dsm"; ofn.lpstrDefExt = "dsm";
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; ofn.Flags = OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
GetSaveFileName(&ofn); GetSaveFileName(&ofn);
//If user did not specify an extension, add .dsm for them //If user did not specify an extension, add .dsm for them

Binary file not shown.