From 84f637865f5b9818c03dfacdd02ad3cb5c682abe Mon Sep 17 00:00:00 2001 From: nitsuja Date: Tue, 4 Aug 2009 10:06:01 +0000 Subject: [PATCH] win32: some dialog flags/extensions fixes, minor menu readability/grammar fixes, and changing some instances of "Gens" to "DeSmuME" --- desmume/src/windows/7zip.h | 2 +- desmume/src/windows/OpenArchive.cpp | 18 +++++++++--------- desmume/src/windows/OpenArchive.h | 6 +++--- desmume/src/windows/gbaslot_config.cpp | 4 ++-- desmume/src/windows/hotkey.cpp | 3 ++- desmume/src/windows/main.cpp | 25 +++++++++++++++---------- desmume/src/windows/memView.cpp | 4 ++-- desmume/src/windows/ramwatch.cpp | 6 +++--- desmume/src/windows/replay.cpp | 3 ++- desmume/src/windows/resources.rc | Bin 687680 -> 687680 bytes 10 files changed, 39 insertions(+), 32 deletions(-) diff --git a/desmume/src/windows/7zip.h b/desmume/src/windows/7zip.h index 98fd44a3f..ec7caa726 100644 --- a/desmume/src/windows/7zip.h +++ b/desmume/src/windows/7zip.h @@ -4,7 +4,7 @@ #include "NDSSystem.h" // 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 void InitDecoder(); diff --git a/desmume/src/windows/OpenArchive.cpp b/desmume/src/windows/OpenArchive.cpp index 207a19970..f2f49021e 100644 --- a/desmume/src/windows/OpenArchive.cpp +++ b/desmume/src/windows/OpenArchive.cpp @@ -1,5 +1,5 @@ -#include "common.h" -#include "main.h" +#include "common.h" +#include "main.h" #include "driver.h" #include #include @@ -147,7 +147,7 @@ int ChooseItemFromArchive(ArchiveFile& archive, bool autoChooseIfOnly1, const ch #define DEFAULT_EXTENSION ".tmp" -#define DEFAULT_CATEGORY "gens" +#define DEFAULT_CATEGORY "desmume" static struct TempFiles { @@ -284,7 +284,7 @@ static struct TempFiles { char gbgFile[1024]; GetTempPath(1024, gbgFile); - strcat(gbgFile, "GensTempFileRecords"); + strcat(gbgFile, "DesmumeTempFileRecords"); char key[64]; int i = 0; while(true) @@ -301,7 +301,7 @@ static struct TempFiles { char gbgFile[1024]; GetTempPath(1024, gbgFile); - strcat(gbgFile, "GensTempFileRecords"); + strcat(gbgFile, "DesmumeTempFileRecords"); char key[64]; int i = 0; int deleteSlot = -1; @@ -337,9 +337,9 @@ static struct TempFiles private: static void CleanOutGarbageRegistry() { - char gbgFile[1024]; + char gbgFile[1024 + 48]; GetTempPath(1024, gbgFile); - strcat(gbgFile, "GensTempFileRecords"); + strcat(gbgFile, "DesmumeTempFileRecords"); char key[64]; int i = 0; @@ -376,8 +376,8 @@ void ReleaseTempFileCategory(const char* cat, const char* exceptionFilename) // example input Name: "C:\games.zip" -// example output LogicalName: "C:\games.zip|Sonic.smd" -// example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\Gens\dec3.tmp" +// example output LogicalName: "C:\games.zip|Sonic.nds" +// example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\Desmume\dec3.tmp" // 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) { diff --git a/desmume/src/windows/OpenArchive.h b/desmume/src/windows/OpenArchive.h index 52a04c89c..0b0d340fb 100644 --- a/desmume/src/windows/OpenArchive.h +++ b/desmume/src/windows/OpenArchive.h @@ -15,8 +15,8 @@ // for you to load with fopen or whatever, // unless the function fails (or is cancelled) in which case it will return false. // example input Name: "C:\games.zip" -// example output LogicalName: "C:\games.zip|Sonic.smd" -// example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\Gens\rom7A37.smd" +// example output LogicalName: "C:\games.zip|Sonic.nds" +// 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 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); // 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); // the rest of these are more internal utility functions, diff --git a/desmume/src/windows/gbaslot_config.cpp b/desmume/src/windows/gbaslot_config.cpp index 79e05940e..4f5db81e4 100644 --- a/desmume/src/windows/gbaslot_config.cpp +++ b/desmume/src/windows/gbaslot_config.cpp @@ -127,7 +127,7 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) ofn.lpstrFile = filename; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "img"; - ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT; + ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT | OFN_PATHMUSTEXIST; if(!GetOpenFileName(&ofn)) return FALSE; @@ -271,7 +271,7 @@ BOOL CALLBACK GbaSlotGBAgame(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) ofn.lpstrFile = filename; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "gba"; - ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; + ofn.Flags = OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST; if(!GetOpenFileName(&ofn)) return FALSE; diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index f198a834b..c20ea5d8d 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -93,7 +93,8 @@ void HK_PrintScreen(int param) ofn.lpstrTitle = "Print Screen Save As"; ofn.nMaxFile = MAX_PATH; 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); diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index f7afddf4d..64fbd8001 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1293,7 +1293,7 @@ void LoadSaveStateInfo() { 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); } } @@ -2237,7 +2237,7 @@ void AviRecordTo() ofn.nMaxFile = MAX_PATH; - ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; + ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; if(GetSaveFileName(&ofn)) { @@ -2293,7 +2293,7 @@ void WavRecordTo() ofn.lpstrTitle = "Save WAV as"; ofn.nMaxFile = MAX_PATH; - ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; + ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; if(GetSaveFileName(&ofn)) { @@ -2394,7 +2394,7 @@ LRESULT OpenFile() ofn.lpstrFile = filename; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "nds"; - ofn.Flags = OFN_NOCHANGEDIR; + ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; char buffer[MAX_PATH]; 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)) { - 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); 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)); ofn.lStructSize = sizeof(ofn); 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.lpstrFile = SavName; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "dst"; + ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; char buffer[MAX_PATH]; ZeroMemory(buffer, sizeof(buffer)); @@ -3275,11 +3277,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); 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.lpstrFile = SavName; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "dst"; + ofn.Flags = OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; char buffer[MAX_PATH]; ZeroMemory(buffer, sizeof(buffer)); @@ -3351,6 +3354,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM ofn.lpstrFile = ImportSavName; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "duc"; + ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; char buffer[MAX_PATH]; ZeroMemory(buffer, sizeof(buffer)); @@ -3380,6 +3384,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM ofn.lpstrFile = ImportSavName; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "sav"; + ofn.Flags = OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; if(!GetSaveFileName(&ofn)) { @@ -4104,7 +4109,7 @@ LRESULT CALLBACK EmulationSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, L ofn.lpstrFile = fileName; ofn.nMaxFile = 256; ofn.lpstrDefExt = "bin"; - ofn.Flags = OFN_NOCHANGEDIR; + ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; char buffer[MAX_PATH]; ZeroMemory(buffer, sizeof(buffer)); @@ -4216,7 +4221,7 @@ LRESULT CALLBACK MicrophoneSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, ofn.lpstrFile = fileName; ofn.nMaxFile = 256; ofn.lpstrDefExt = "bin"; - ofn.Flags = OFN_NOCHANGEDIR; + ofn.Flags = OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; char buffer[MAX_PATH]; ZeroMemory(buffer, sizeof(buffer)); diff --git a/desmume/src/windows/memView.cpp b/desmume/src/windows/memView.cpp index 08d77983c..d4100f9fe 100644 --- a/desmume/src/windows/memView.cpp +++ b/desmume/src/windows/memView.cpp @@ -275,7 +275,7 @@ BOOL CALLBACK MemView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ofn.lpstrFile = fileName; ofn.nMaxFile = 256; ofn.lpstrDefExt = "txt"; - ofn.Flags = OFN_NOCHANGEDIR; + ofn.Flags = OFN_NOCHANGEDIR | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; if(GetSaveFileName(&ofn)) { @@ -356,7 +356,7 @@ BOOL CALLBACK MemView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ofn.lpstrFile = fileName; ofn.nMaxFile = 256; ofn.lpstrDefExt = "bin"; - ofn.Flags = OFN_NOCHANGEDIR; + ofn.Flags = OFN_NOCHANGEDIR | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; if(GetSaveFileName(&ofn)) { diff --git a/desmume/src/windows/ramwatch.cpp b/desmume/src/windows/ramwatch.cpp index e217ad785..89e1390a6 100644 --- a/desmume/src/windows/ramwatch.cpp +++ b/desmume/src/windows/ramwatch.cpp @@ -442,7 +442,7 @@ int Change_File_S(char *Dest, char *Dir, char *Titre, char *Filter, char *Ext, H ofn.lpstrInitialDir = Dir; ofn.lpstrTitle = Titre; ofn.lpstrDefExt = Ext; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY; + ofn.Flags = OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN; if (GetSaveFileName(&ofn)) return 1; @@ -455,7 +455,7 @@ bool Save_Watches() Rom_Name = path.GetRomName(); strncpy(Str_Tmp,Rom_Name.c_str(),512); 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"); if (!WatchFile) WatchFile = fopen(Str_Tmp,"w+b"); @@ -589,7 +589,7 @@ bool Load_Watches(bool clear) Rom_Name = path.GetRomName(); strncpy(Str_Tmp,Rom_Name.c_str(),512); 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); } diff --git a/desmume/src/windows/replay.cpp b/desmume/src/windows/replay.cpp index bcf9c49c9..0ecb871cc 100644 --- a/desmume/src/windows/replay.cpp +++ b/desmume/src/windows/replay.cpp @@ -86,6 +86,7 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP ofn.lpstrTitle = "Replay Movie from File"; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "dsm"; + ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST; GetOpenFileName(&ofn); strcpy(playfilename, filename); Describe(hwndDlg); @@ -158,7 +159,7 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP ofn.lpstrTitle = "Record a new movie"; ofn.lpstrDefExt = "dsm"; ofn.nMaxFile = MAX_PATH; - ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; + ofn.Flags = OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; GetSaveFileName(&ofn); //If user did not specify an extension, add .dsm for them diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 8d26419dc43dad01d6d03643d696953543f00eb5..4df0876437198b0ef5a83f8186210f1f6d756c8a 100644 GIT binary patch delta 111 zcmX@`NAtiR&4w1n7N!>FEi6Btu)8r7G2}DkPEY*KB0Rl8fs<>x!+&FEi6BtOs{ytVl`Poj$^Wbh*EpZQx+g*1!6WJX5Sw3l;e*M Qs**iIoZI&ZakXRv0MC&gaR2}S