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"
// 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();

View File

@ -1,5 +1,5 @@
#include "common.h"
#include "main.h"
#include "common.h"
#include "main.h"
#include "driver.h"
#include <windows.h>
#include <stdio.h>
@ -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)
{

View File

@ -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,

View File

@ -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;

View File

@ -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);

View File

@ -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));

View File

@ -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))
{

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.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);
}

View File

@ -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

Binary file not shown.