CDLogger improvements

This commit is contained in:
CaH4e3 2013-02-27 11:05:06 +00:00
parent e52c48b1c3
commit ba537f66db
6 changed files with 69 additions and 25 deletions

View File

@ -61,7 +61,8 @@ extern int newppu;
int CDLogger_wndx=0, CDLogger_wndy=0;
bool autosaveCDL = true;
bool autoresumeCDLogging = true;
bool autoloadCDL = true;
bool autoresumeCDLogging = false;
extern uint8 *NSFDATA;
extern int NSFMaxBank;
@ -91,7 +92,8 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
//-------------------------------------------------------
if (!(fileDropped.find(".cdl") == string::npos) && (fileDropped.find(".cdl") == fileDropped.length()-4))
{
LoadCDLog(fileDropped.c_str());
if(!LoadCDLog(fileDropped.c_str()))
FCEUD_PrintError("Error Opening CDL File!");
}
else
{
@ -123,13 +125,23 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
InitLog();
ResetLog();
RenameLog("");
if (autoloadCDL) {
char nameo[2048];
strcpy(nameo, GetRomPath());
strcat(nameo, GetRomName());
strcat(nameo, ".cdl");
LoadCDLog(nameo);
}
SetDlgItemText(hCDLogger, ID_CDLFILENAME, loadedcdfile);
CheckDlgButton(hCDLogger, IDC_AUTOSAVECDL, autosaveCDL ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hCDLogger, IDC_AUTOLOADCDL, autoloadCDL ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hCDLogger, IDC_AUTORESUMECDLOGGING, autoresumeCDLogging ? BST_CHECKED : BST_UNCHECKED);
CDLoggerPPUChanged();
break;
case WM_CLOSE:
case WM_QUIT:
if (autosaveCDL)
SaveCDLogFile();
if (PauseLogging())
{
FreeLog();
@ -175,6 +187,9 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case IDC_AUTOSAVECDL:
autosaveCDL = (IsDlgButtonChecked(hCDLogger, IDC_AUTOSAVECDL) == BST_CHECKED);
break;
case IDC_AUTOLOADCDL:
autoloadCDL = (IsDlgButtonChecked(hCDLogger, IDC_AUTOLOADCDL) == BST_CHECKED);
break;
case IDC_AUTORESUMECDLOGGING:
autoresumeCDLogging = (IsDlgButtonChecked(hCDLogger, IDC_AUTORESUMECDLOGGING) == BST_CHECKED);
break;
@ -196,10 +211,7 @@ bool LoadCDLog(const char* nameo)
FP = fopen(nameo, "rb");
if (FP == NULL)
{
FCEUD_PrintError("Error Opening CDL File!");
return false;
}
for(i = 0;i < (int)cdloggerdataSize;i++)
{
@ -251,7 +263,8 @@ void LoadCDLogFile()
ofn.hwndOwner = hCDLogger;
if (!GetOpenFileName(&ofn))
return;
LoadCDLog(nameo);
if(!LoadCDLog(nameo))
FCEUD_PrintError("Error Opening CDL File!");
}
void SaveCDLogFileAs()
@ -269,7 +282,7 @@ void SaveCDLogFileAs()
strcpy(nameo, loadedcdfile);
} else
{
strcpy(nameo, LoadedRomFName);
strcpy(nameo, GetRomName());
strcat(nameo, ".cdl");
}
ofn.lpstrDefExt = "cdl";
@ -288,7 +301,8 @@ void SaveCDLogFile()
if (loadedcdfile[0] == 0)
{
char nameo[2048];
strcpy(nameo, LoadedRomFName);
strcpy(nameo, GetRomPath());
strcat(nameo, GetRomName());
strcat(nameo, ".cdl");
RenameLog(nameo);
}
@ -386,7 +400,7 @@ void SaveStrippedRom(int invert)
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;
ofn.lpstrTitle="Save Stripped File As...";
strcpy(sromfilename,GetRomName());
strcpy(sromfilename, GetRomName());
if (GameInfo->type==GIT_NSF) {
ofn.lpstrFilter=NSFfilter;
ofn.lpstrDefExt = "nsf";
@ -476,6 +490,7 @@ void CDLoggerROMClosed()
SaveCDLogFile();
}
}
void CDLoggerROMChanged()
{
if (hCDLogger)
@ -492,7 +507,8 @@ void CDLoggerROMChanged()
// try to load respective CDL file
char nameo[2048];
strcpy(nameo, LoadedRomFName);
strcpy(nameo, GetRomPath());
strcat(nameo, GetRomName());
strcat(nameo, ".cdl");
/*

View File

@ -98,6 +98,7 @@ extern int Tracer_wndx, Tracer_wndy;
extern int CDLogger_wndx, CDLogger_wndy;
extern bool autoresumeCDLogging;
extern bool autosaveCDL;
extern bool autoloadCDL;
extern int GGConv_wndx, GGConv_wndy;
extern int MetaPosX,MetaPosY;
extern int MLogPosX,MLogPosY;
@ -182,7 +183,7 @@ static CFGSTRUCT fceuconfig[] =
NAC("sound",soundo),
NAC("sicon",status_icon),
AC(newppu),
AC(newppu),
NACS("odroms",directory_names[0]),
NACS("odnonvol",directory_names[1]),
@ -302,6 +303,7 @@ static CFGSTRUCT fceuconfig[] =
AC(CDLogger_wndx),
AC(CDLogger_wndy),
AC(autosaveCDL),
AC(autoloadCDL),
AC(autoresumeCDLogging),
AC(GGConv_wndx),
AC(GGConv_wndy),

View File

@ -1082,3 +1082,25 @@ char *GetRomName()
return mystring;
}
char *GetRomPath()
{
//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 = drv; //Pull out the Path only
Rom.append(dir);
}
else
Rom = "";
char*mystring = (char*)malloc(2048*sizeof(char));
strcpy(mystring, Rom.c_str()); //Convert string to char*
return mystring;
}

View File

@ -60,6 +60,7 @@ 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
char *GetRomPath(); //Checks if rom is loaded, if so, outputs the Rom path only
///Contains the names of the default directories.
static const char *default_directory_names[13] = {

View File

@ -12,7 +12,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Íåéòðàëüíûé resources
// Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
@ -1574,7 +1574,7 @@ BEGIN
DEFPUSHBUTTON "&OK",IDOK,67,52,50,14
END
CDLOGGER DIALOGEX 0, 0, 307, 242
CDLOGGER DIALOGEX 0, 0, 307, 253
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Code Data Logger"
@ -1582,12 +1582,12 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Load...",BTN_CDLOGGER_LOAD,7,123,50,14
PUSHBUTTON "Save",BTN_CDLOGGER_SAVE,249,107,50,14
GROUPBOX "Code/Data Log Status",ID_CDL,3,3,300,174,BS_CENTER
GROUPBOX "Code/Data Log Status",ID_CDL,3,7,300,183,BS_CENTER
DEFPUSHBUTTON "Start",BTN_CDLOGGER_START_PAUSE,127,107,50,14
GROUPBOX "Address Label Logger",65534,3,179,300,59,BS_CENTER
PUSHBUTTON "Load...",111,7,218,50,14,WS_DISABLED
PUSHBUTTON "Start",112,127,218,50,14,WS_DISABLED
PUSHBUTTON "Save...",113,249,218,50,14,WS_DISABLED
GROUPBOX "Address Label Logger",65534,3,192,300,59,BS_CENTER
PUSHBUTTON "Load...",111,7,231,50,14,WS_DISABLED
PUSHBUTTON "Start",112,127,231,50,14,WS_DISABLED
PUSHBUTTON "Save...",113,249,231,50,14,WS_DISABLED
LTEXT "4067 - 29.5%",LBL_CDLOGGER_CODECOUNT,34,29,72,11
GROUPBOX "PRG Logged as Code",65533,25,18,84,27
GROUPBOX "PRG Logged as Data",65532,113,18,84,27
@ -1597,8 +1597,8 @@ BEGIN
LTEXT "Itsa me, the Code/Data Logger! Press Start to play!",65530,67,80,172,11
PUSHBUTTON "Reset Log",BTN_CDLOGGER_RESET,7,107,50,14
PUSHBUTTON "Save as...",BTN_CDLOGGER_SAVE_AS,250,123,50,14
PUSHBUTTON "Save Stripped Data...",BTN_CDLOGGER_SAVE_STRIPPED,117,157,89,14
PUSHBUTTON "Save Unused Data...",BTN_CDLOGGER_SAVE_UNUSED,210,157,89,14
PUSHBUTTON "Save Stripped Data...",BTN_CDLOGGER_SAVE_STRIPPED,117,170,89,14
PUSHBUTTON "Save Unused Data...",BTN_CDLOGGER_SAVE_UNUSED,210,170,89,14
LTEXT "4067 - 29.5%",LBL_CDLOGGER_RENDERCOUNT,34,58,72,11
GROUPBOX "CHR Rendered",ID_CHR1,25,47,84,27
GROUPBOX "CHR Logged as Data",ID_CHR2,113,47,84,27
@ -1611,6 +1611,8 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,142,149,12
CONTROL " Auto-save .CDL when closing ROMs",IDC_AUTOSAVECDL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,142,133,12
CONTROL " Auto-load .CDL when opening CDLogger",IDC_AUTOLOADCDL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,155,144,12
END
PPUVIEW DIALOGEX 44, 38, 355, 246
@ -2130,12 +2132,12 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
#endif // Íåéòðàëüíûé resources
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Ðóññêèé (Ðîññèÿ) resources
// Russian (Russia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
@ -2188,12 +2190,12 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
#endif // Ðóññêèé (Ðîññèÿ) resources
#endif // Russian (Russia) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Àíãëèéñêèé (ÑØÀ) resources
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@ -2427,7 +2429,7 @@ IDB_BITMAP_SELECTED17 BITMAP "res\\te_17_selected.bmp"
IDB_BITMAP_SELECTED18 BITMAP "res\\te_18_selected.bmp"
IDB_BITMAP_SELECTED19 BITMAP "res\\te_19_selected.bmp"
IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp"
#endif // Àíãëèéñêèé (ÑØÀ) resources
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -625,6 +625,7 @@
#define IDC_CHECK_BOOKMARKS 1205
#define IDC_SUPERIMPOSE2 1205
#define IDC_RUN_AUTO 1205
#define IDC_AUTOLOADCDL 1205
#define IDC_C_SEARCH 1206
#define IDC_CHECK5 1206
#define IDC_CHECK_GREENZONE 1206