Win32 - texthooker and memory watch use ROM name as default file name in Save as dialog box
This commit is contained in:
parent
9ac49d11a1
commit
e29081de7a
|
@ -63,6 +63,8 @@
|
|||
#include "sound.h"
|
||||
#include "wave.h"
|
||||
#include "video.h"
|
||||
#include "utils/xstring.h"
|
||||
#include <string.h>
|
||||
|
||||
//---------------------------
|
||||
//mbg merge 6/29/06 - new aboutbox
|
||||
|
@ -880,3 +882,21 @@ void FCEUD_ToggleStatusIcon(void)
|
|||
UpdateCheckedMenuItems();
|
||||
}
|
||||
|
||||
char *GetRomName()
|
||||
{
|
||||
//The purpose of this function is to format the ROM name stored in LoadedRomFName
|
||||
//And return a char array with just the name with path or extension
|
||||
//The purpose of this function is to populate a save as dialog with the ROM name as a default filename
|
||||
extern char LoadedRomFName[2048]; //Contains full path of ROM
|
||||
std::string Rom; //Will contain the formatted path
|
||||
if(GameInfo) //If ROM is loaded
|
||||
{
|
||||
char drv[PATH_MAX], dir[PATH_MAX], name[PATH_MAX], ext[PATH_MAX];
|
||||
splitpath(LoadedRomFName,drv,dir,name,ext); //Extract components of the ROM path
|
||||
Rom = name; //Pull out the Name only
|
||||
}
|
||||
char*mystring = (char*)malloc(2048*sizeof(char));
|
||||
strcpy(mystring, Rom.c_str()); //Convert string to char*
|
||||
|
||||
return mystring;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ extern int vmod;
|
|||
|
||||
extern char* directory_names[14];
|
||||
|
||||
char *GetRomName(); //Checks if rom is loaded, if so, outputs the Rom name with no directory path or file extension
|
||||
|
||||
///Contains the names of the default directories.
|
||||
static const char *default_directory_names[13] = {
|
||||
"", // roms
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "../../utils/xstring.h"
|
||||
#include "help.h"
|
||||
#include <string>
|
||||
#include "main.h"
|
||||
const int NUMWATCHES = 24;
|
||||
const int LABELLENGTH = 64;
|
||||
const int ADDRESSLENGTH = 16;
|
||||
|
@ -366,8 +367,10 @@ static void SaveMemWatch()
|
|||
ofn.hInstance=fceu_hInstance;
|
||||
ofn.lpstrTitle="Save Memory Watch As...";
|
||||
ofn.lpstrFilter=filter;
|
||||
memwLastFilename[0]=0;
|
||||
ofn.lpstrFile=memwLastFilename;
|
||||
char nameo[2048];
|
||||
if (!memwLastFilename[0])
|
||||
strcpy(nameo,GetRomName());
|
||||
ofn.lpstrFile=nameo;
|
||||
ofn.nMaxFile=256;
|
||||
ofn.Flags=OFN_EXPLORER|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT;
|
||||
std::string initdir = FCEU_GetPath(FCEUMKF_MEMW);
|
||||
|
|
|
@ -40,13 +40,12 @@
|
|||
#include "..\..\video.h" //needed for XBuf
|
||||
#include "cdlogger.h" //needed for TextHookerLoadTable
|
||||
#include "fceu.h"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
char *textToTrans; // buffer to hold the text that needs translating
|
||||
char *transText; //holds the translated text
|
||||
|
||||
extern void FCEUD_BlitScreen(uint8 *XBuf); //needed for pause, not sure where this is defined...
|
||||
|
||||
//adelikat merge 7/1/08 - had to add these extern variables
|
||||
//------------------------------
|
||||
extern uint8 PALRAM[0x20];
|
||||
|
@ -686,7 +685,7 @@ int TextHookerSaveTableFile(){
|
|||
ofn.hInstance=fceu_hInstance;
|
||||
ofn.lpstrTitle="Load Table File...";
|
||||
ofn.lpstrFilter=filter;
|
||||
nameo[0]=0;
|
||||
strcpy(nameo,GetRomName());
|
||||
ofn.lpstrFile=nameo;
|
||||
ofn.lpstrDefExt="tht";
|
||||
ofn.nMaxFile=256;
|
||||
|
|
Loading…
Reference in New Issue