Win32 - All savefile dialogs generate a default filename

This commit is contained in:
adelikat 2009-06-26 18:20:15 +00:00
parent d328b9513a
commit ba44fe906f
4 changed files with 10 additions and 7 deletions

View File

@ -26,6 +26,7 @@
#include "debugger.h" #include "debugger.h"
#include "tracer.h" #include "tracer.h"
#include "cdlogger.h" #include "cdlogger.h"
#include "main.h" //for GetRomName()
#define INESPRIV #define INESPRIV
#include "../../ines.h" #include "../../ines.h"
@ -206,7 +207,7 @@ void LoadCDLog (const char* nameo)
void LoadCDLogFile(){ void LoadCDLogFile(){
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0"; 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; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn); ofn.lStructSize=sizeof(ofn);
@ -224,14 +225,14 @@ void LoadCDLogFile(){
void SaveCDLogFileAs(){ void SaveCDLogFileAs(){
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0"; 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; OPENFILENAME ofn;
memset(&ofn,0,sizeof(ofn)); memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn); ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance; ofn.hInstance=fceu_hInstance;
ofn.lpstrTitle="Save Code Data Log File As..."; ofn.lpstrTitle="Save Code Data Log File As...";
ofn.lpstrFilter=filter; ofn.lpstrFilter=filter;
nameo[0]=0; strcpy(nameo,GetRomName());
ofn.lpstrFile=nameo; ofn.lpstrFile=nameo;
ofn.nMaxFile=256; ofn.nMaxFile=256;
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; 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.hInstance=fceu_hInstance;
ofn.lpstrTitle="Save Stripped Rom File As..."; ofn.lpstrTitle="Save Stripped Rom File As...";
ofn.lpstrFilter=filter; ofn.lpstrFilter=filter;
sromfilename[0]=0; strcpy(sromfilename,GetRomName());
ofn.lpstrFile=sromfilename; ofn.lpstrFile=sromfilename;
ofn.nMaxFile=256; ofn.nMaxFile=256;
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;

View File

@ -24,7 +24,7 @@ void FCEUD_SaveStateAs()
ofn.lpstrTitle = "Save State As..."; ofn.lpstrTitle = "Save State As...";
ofn.lpstrFilter = filter; ofn.lpstrFilter = filter;
ofn.lpstrDefExt = "fcs"; ofn.lpstrDefExt = "fcs";
nameo[0] = 0; strcpy(nameo,FCEU_MakeFName(FCEUMKF_STATE,CurrentState,0).c_str());
ofn.lpstrFile = nameo; ofn.lpstrFile = nameo;
std::string initdir = FCEU_GetPath(FCEUMKF_STATE); std::string initdir = FCEU_GetPath(FCEUMKF_STATE);
ofn.lpstrInitialDir = initdir.c_str(); ofn.lpstrInitialDir = initdir.c_str();

View File

@ -31,6 +31,7 @@
#include "cdlogger.h" #include "cdlogger.h"
#include "tracer.h" #include "tracer.h"
#include "memview.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 //Used to determine the current hotkey mapping for the pause key in order to display on the dialog
#include "mapinput.h" #include "mapinput.h"
@ -583,7 +584,7 @@ void ShowLogDirDialog(void){
ofn.hInstance=fceu_hInstance; ofn.hInstance=fceu_hInstance;
ofn.lpstrTitle="Log Trace As..."; ofn.lpstrTitle="Log Trace As...";
ofn.lpstrFilter=filter; ofn.lpstrFilter=filter;
nameo[0]=0; strcpy(nameo,GetRomName());
ofn.lpstrFile=nameo; ofn.lpstrFile=nameo;
ofn.nMaxFile=256; ofn.nMaxFile=256;
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;

View File

@ -21,6 +21,7 @@
#include "common.h" #include "common.h"
#include "../../wave.h" #include "../../wave.h"
#include "main.h" //For GetRomName()
int CloseWave() int CloseWave()
{ {
@ -43,7 +44,7 @@ bool CreateSoundSave()
ofn.hInstance=fceu_hInstance; ofn.hInstance=fceu_hInstance;
ofn.lpstrTitle="Log Sound As..."; ofn.lpstrTitle="Log Sound As...";
ofn.lpstrFilter=filter; ofn.lpstrFilter=filter;
nameo[0]=0; strcpy(nameo,GetRomName());
ofn.lpstrFile=nameo; ofn.lpstrFile=nameo;
ofn.nMaxFile=256; ofn.nMaxFile=256;
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;