From ba44fe906f3ae87a5e26ed9e453bce788aad2e32 Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 26 Jun 2009 18:20:15 +0000 Subject: [PATCH] Win32 - All savefile dialogs generate a default filename --- src/drivers/win/cdlogger.cpp | 9 +++++---- src/drivers/win/state.cpp | 2 +- src/drivers/win/tracer.cpp | 3 ++- src/drivers/win/wave.cpp | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/drivers/win/cdlogger.cpp b/src/drivers/win/cdlogger.cpp index 0176b0d3..6dee6f92 100644 --- a/src/drivers/win/cdlogger.cpp +++ b/src/drivers/win/cdlogger.cpp @@ -26,6 +26,7 @@ #include "debugger.h" #include "tracer.h" #include "cdlogger.h" +#include "main.h" //for GetRomName() #define INESPRIV #include "../../ines.h" @@ -206,7 +207,7 @@ void LoadCDLog (const char* nameo) void LoadCDLogFile(){ const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0"; - char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead? + char nameo[2048]; OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn)); ofn.lStructSize=sizeof(ofn); @@ -224,14 +225,14 @@ void LoadCDLogFile(){ void SaveCDLogFileAs(){ const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0"; - char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead? + char nameo[2048]; OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn)); ofn.lStructSize=sizeof(ofn); ofn.hInstance=fceu_hInstance; ofn.lpstrTitle="Save Code Data Log File As..."; ofn.lpstrFilter=filter; - nameo[0]=0; + strcpy(nameo,GetRomName()); ofn.lpstrFile=nameo; ofn.nMaxFile=256; ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; @@ -320,7 +321,7 @@ void SaveStrippedRom(){ //this is based off of iNesSave() ofn.hInstance=fceu_hInstance; ofn.lpstrTitle="Save Stripped Rom File As..."; ofn.lpstrFilter=filter; - sromfilename[0]=0; + strcpy(sromfilename,GetRomName()); ofn.lpstrFile=sromfilename; ofn.nMaxFile=256; ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; diff --git a/src/drivers/win/state.cpp b/src/drivers/win/state.cpp index 11772a95..741121fe 100644 --- a/src/drivers/win/state.cpp +++ b/src/drivers/win/state.cpp @@ -24,7 +24,7 @@ void FCEUD_SaveStateAs() ofn.lpstrTitle = "Save State As..."; ofn.lpstrFilter = filter; ofn.lpstrDefExt = "fcs"; - nameo[0] = 0; + strcpy(nameo,FCEU_MakeFName(FCEUMKF_STATE,CurrentState,0).c_str()); ofn.lpstrFile = nameo; std::string initdir = FCEU_GetPath(FCEUMKF_STATE); ofn.lpstrInitialDir = initdir.c_str(); diff --git a/src/drivers/win/tracer.cpp b/src/drivers/win/tracer.cpp index 4880231d..4adff466 100644 --- a/src/drivers/win/tracer.cpp +++ b/src/drivers/win/tracer.cpp @@ -31,6 +31,7 @@ #include "cdlogger.h" #include "tracer.h" #include "memview.h" +#include "main.h" //for GetRomName() //Used to determine the current hotkey mapping for the pause key in order to display on the dialog #include "mapinput.h" @@ -583,7 +584,7 @@ void ShowLogDirDialog(void){ ofn.hInstance=fceu_hInstance; ofn.lpstrTitle="Log Trace As..."; ofn.lpstrFilter=filter; - nameo[0]=0; + strcpy(nameo,GetRomName()); ofn.lpstrFile=nameo; ofn.nMaxFile=256; ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; diff --git a/src/drivers/win/wave.cpp b/src/drivers/win/wave.cpp index feda4c71..826eb90e 100644 --- a/src/drivers/win/wave.cpp +++ b/src/drivers/win/wave.cpp @@ -21,6 +21,7 @@ #include "common.h" #include "../../wave.h" +#include "main.h" //For GetRomName() int CloseWave() { @@ -43,7 +44,7 @@ bool CreateSoundSave() ofn.hInstance=fceu_hInstance; ofn.lpstrTitle="Log Sound As..."; ofn.lpstrFilter=filter; - nameo[0]=0; + strcpy(nameo,GetRomName()); ofn.lpstrFile=nameo; ofn.nMaxFile=256; ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;