* CDLogger: code cleanup
* CDLogger: removed obnoxious reminder about NewPPU * CDLogger: added current CDL filename field * CDLogger: added default CDL naming * CDLogger: added "Auto-save .CDL when closing ROMs" option * CDLogger: added "Auto-resume logging when loading ROMs" option
This commit is contained in:
parent
71f4affe5c
commit
009ece83d4
|
@ -370,6 +370,7 @@ int condition(watchpointinfo* wp)
|
|||
|
||||
volatile int codecount, datacount, undefinedcount;
|
||||
unsigned char *cdloggerdata;
|
||||
unsigned int cdloggerdataSize = 0;
|
||||
static int indirectnext;
|
||||
|
||||
int debug_loggingCD;
|
||||
|
|
|
@ -76,6 +76,7 @@ void LogCDVectors(int which);
|
|||
void LogCDData(uint8 *opcode, uint16 A, int size);
|
||||
extern volatile int codecount, datacount, undefinedcount;
|
||||
extern unsigned char *cdloggerdata;
|
||||
extern unsigned int cdloggerdataSize;
|
||||
|
||||
extern int debug_loggingCD;
|
||||
static INLINE void FCEUI_SetLoggingCD(int val) { debug_loggingCD = val; }
|
||||
|
|
|
@ -35,10 +35,20 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
bool LoadCDLog(const char* nameo);
|
||||
void LoadCDLogFile();
|
||||
void SaveCDLogFileAs();
|
||||
void SaveCDLogFile();
|
||||
void SaveStrippedRom(int invert);
|
||||
void CDLoggerROMClosed();
|
||||
void CDLoggerROMChanged();
|
||||
void CDLoggerPPUChanged();
|
||||
bool PauseLogging();
|
||||
void StartLogging();
|
||||
void FreeLog();
|
||||
void InitLog();
|
||||
void ResetLog();
|
||||
void RenameLog(const char* newName);
|
||||
|
||||
extern iNES_HEADER head; //defined in ines.c
|
||||
extern uint8 *trainerpoo;
|
||||
|
@ -46,9 +56,12 @@ extern uint8 *trainerpoo;
|
|||
//---------CDLogger VROM
|
||||
extern volatile int rendercount, vromreadcount, undefinedvromcount;
|
||||
extern unsigned char *cdloggervdata;
|
||||
extern unsigned int cdloggerVideoDataSize;
|
||||
extern int newppu;
|
||||
|
||||
int CDLogger_wndx=0, CDLogger_wndy=0;
|
||||
bool autosaveCDL = true;
|
||||
bool autoresumeCDLogging = true;
|
||||
|
||||
extern uint8 *NSFDATA;
|
||||
extern int NSFMaxBank;
|
||||
|
@ -56,20 +69,20 @@ static uint8 NSFLoadLow;
|
|||
static uint8 NSFLoadHigh;
|
||||
|
||||
HWND hCDLogger;
|
||||
char loadedcdfile[1024];
|
||||
char loadedcdfile[2048] = {0};
|
||||
|
||||
//Prototypes
|
||||
void LoadCDLog (const char* nameo);
|
||||
|
||||
BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch(uMsg) {
|
||||
BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_DROPFILES:
|
||||
{
|
||||
UINT len;
|
||||
char *ftmp;
|
||||
|
||||
len=DragQueryFile((HDROP)wParam,0,0,0)+1;
|
||||
if((ftmp=(char*)malloc(len))) {
|
||||
if((ftmp=(char*)malloc(len)))
|
||||
{
|
||||
DragQueryFile((HDROP)wParam,0,ftmp,len);
|
||||
string fileDropped = ftmp;
|
||||
//adelikat: Drag and Drop only checks file extension, the internal functions are responsible for file error checking
|
||||
|
@ -90,16 +103,15 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
|
||||
break;
|
||||
|
||||
case WM_MOVE: {
|
||||
if (!IsIconic(hwndDlg)) {
|
||||
case WM_MOVE:
|
||||
{
|
||||
if (!IsIconic(hwndDlg))
|
||||
{
|
||||
RECT wrect;
|
||||
GetWindowRect(hwndDlg,&wrect);
|
||||
CDLogger_wndx = wrect.left;
|
||||
CDLogger_wndy = wrect.top;
|
||||
|
||||
#ifdef WIN32
|
||||
WindowBoundsCheckNoResize(CDLogger_wndx,CDLogger_wndy,wrect.right);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
};
|
||||
|
@ -108,78 +120,45 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
if (CDLogger_wndy==-32000) CDLogger_wndy=0;
|
||||
SetWindowPos(hwndDlg,0,CDLogger_wndx,CDLogger_wndy,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER);
|
||||
hCDLogger = hwndDlg;
|
||||
codecount = datacount = rendercount = vromreadcount = 0;
|
||||
undefinedcount = PRGsize[0];
|
||||
cdloggerdata = (unsigned char*)malloc(PRGsize[0]); //mbg merge 7/18/06 added cast
|
||||
ZeroMemory(cdloggerdata,PRGsize[0]);
|
||||
if(CHRsize[0] != 0)
|
||||
{
|
||||
undefinedvromcount = CHRsize[0];
|
||||
cdloggervdata = (unsigned char*)malloc(CHRsize[0]);
|
||||
ZeroMemory(cdloggervdata,CHRsize[0]);
|
||||
}
|
||||
InitLog();
|
||||
ResetLog();
|
||||
RenameLog("");
|
||||
SetDlgItemText(hCDLogger, ID_CDLFILENAME, loadedcdfile);
|
||||
CheckDlgButton(hCDLogger, IDC_AUTOSAVECDL, autosaveCDL ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hCDLogger, IDC_AUTORESUMECDLOGGING, autoresumeCDLogging ? BST_CHECKED : BST_UNCHECKED);
|
||||
CDLoggerPPUChanged();
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT:
|
||||
if((logging) && (logging_options & LOG_NEW_INSTRUCTIONS)){
|
||||
MessageBox(hCDLogger,
|
||||
"The Trace logger is currently using this for some of its features.\
|
||||
Please turn the trace logger off and try again.","Unable to Pause Code/Data Logger", MB_OK);
|
||||
break;
|
||||
}
|
||||
FCEUI_SetLoggingCD(0);
|
||||
free(cdloggerdata);
|
||||
free(cdloggervdata);
|
||||
cdloggerdata=0;
|
||||
cdloggervdata=0;
|
||||
if (PauseLogging())
|
||||
{
|
||||
FreeLog();
|
||||
RenameLog("");
|
||||
hCDLogger = 0;
|
||||
EndDialog(hwndDlg,0);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch(HIWORD(wParam)) {
|
||||
case BN_CLICKED:
|
||||
switch(LOWORD(wParam)) {
|
||||
case BTN_CDLOGGER_RESET:
|
||||
codecount = datacount = rendercount = vromreadcount = 0;
|
||||
undefinedcount = PRGsize[0];
|
||||
ZeroMemory(cdloggerdata,PRGsize[0]);
|
||||
if(CHRsize[0] != 0)
|
||||
switch(HIWORD(wParam))
|
||||
{
|
||||
undefinedvromcount = CHRsize[0];
|
||||
ZeroMemory(cdloggervdata,CHRsize[0]);
|
||||
}
|
||||
case BN_CLICKED:
|
||||
{
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case BTN_CDLOGGER_RESET:
|
||||
{
|
||||
ResetLog();
|
||||
UpdateCDLogger();
|
||||
break;
|
||||
}
|
||||
case BTN_CDLOGGER_LOAD:
|
||||
LoadCDLogFile();
|
||||
break;
|
||||
case BTN_CDLOGGER_START_PAUSE:
|
||||
if(FCEUI_GetLoggingCD()){
|
||||
if((logging) && (logging_options & LOG_NEW_INSTRUCTIONS)){
|
||||
MessageBox(hCDLogger,
|
||||
"The Trace logger is currently using this for some of its features.\
|
||||
Please turn the trace logger off and try again.","Unable to Pause Code/Data Logger", MB_OK);
|
||||
break;
|
||||
}
|
||||
FCEUI_SetLoggingCD(0);
|
||||
EnableTracerMenuItems();
|
||||
SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Start");
|
||||
}
|
||||
else{
|
||||
if(!newppu)
|
||||
{
|
||||
if(MessageBox(hCDLogger,
|
||||
"In order for CHR data logging to take effect, the New PPU engine must also be enabled.\
|
||||
Would you like to enable New PPU engine now?","Enable New PPU engine?",
|
||||
MB_YESNO) == IDYES)
|
||||
{
|
||||
FCEU_TogglePPU();
|
||||
}
|
||||
}
|
||||
FCEUI_SetLoggingCD(1);
|
||||
EnableTracerMenuItems();
|
||||
SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Pause");
|
||||
}
|
||||
if (FCEUI_GetLoggingCD())
|
||||
PauseLogging();
|
||||
else
|
||||
StartLogging();
|
||||
break;
|
||||
case BTN_CDLOGGER_SAVE_AS:
|
||||
SaveCDLogFileAs();
|
||||
|
@ -193,9 +172,16 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
case BTN_CDLOGGER_SAVE_UNUSED:
|
||||
SaveStrippedRom(1);
|
||||
break;
|
||||
case IDC_AUTOSAVECDL:
|
||||
autosaveCDL = (IsDlgButtonChecked(hCDLogger, IDC_AUTOSAVECDL) == BST_CHECKED);
|
||||
break;
|
||||
case IDC_AUTORESUMECDLOGGING:
|
||||
autoresumeCDLogging = (IsDlgButtonChecked(hCDLogger, IDC_AUTORESUMECDLOGGING) == BST_CHECKED);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_MOVING:
|
||||
break;
|
||||
|
@ -203,31 +189,36 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void LoadCDLog (const char* nameo)
|
||||
bool LoadCDLog(const char* nameo)
|
||||
{
|
||||
FILE *FP;
|
||||
int i,j;
|
||||
|
||||
strcpy(loadedcdfile,nameo);
|
||||
|
||||
FP = fopen(loadedcdfile,"rb");
|
||||
if(FP == NULL){
|
||||
FCEUD_PrintError("Error Opening File");
|
||||
return;
|
||||
FP = fopen(nameo, "rb");
|
||||
if (FP == NULL)
|
||||
{
|
||||
FCEUD_PrintError("Error Opening CDL File!");
|
||||
return false;
|
||||
}
|
||||
|
||||
for(i = 0;i < (int)PRGsize[0];i++){
|
||||
for(i = 0;i < (int)cdloggerdataSize;i++)
|
||||
{
|
||||
j = fgetc(FP);
|
||||
if(j == EOF)break;
|
||||
if((j & 1) && !(cdloggerdata[i] & 1))codecount++; //if the new byte has something logged and
|
||||
if((j & 2) && !(cdloggerdata[i] & 2))datacount++; //and the old one doesn't. Then increment
|
||||
if((j & 3) && !(cdloggerdata[i] & 3))undefinedcount--; //the appropriate counter.
|
||||
if (j == EOF)
|
||||
break;
|
||||
if ((j & 1) && !(cdloggerdata[i] & 1))
|
||||
codecount++; //if the new byte has something logged and
|
||||
if ((j & 2) && !(cdloggerdata[i] & 2))
|
||||
datacount++; //and the old one doesn't. Then increment
|
||||
if ((j & 3) && !(cdloggerdata[i] & 3))
|
||||
undefinedcount--; //the appropriate counter.
|
||||
cdloggerdata[i] |= j;
|
||||
}
|
||||
|
||||
if(CHRsize[0] != 0)
|
||||
if(cdloggerVideoDataSize != 0)
|
||||
{
|
||||
for(i = 0;i < (int)cdloggerVideoDataSize;i++)
|
||||
{
|
||||
for(i = 0;i < (int)CHRsize[0];i++){
|
||||
j = fgetc(FP);
|
||||
if(j == EOF)break;
|
||||
if((j & 1) && !(cdloggervdata[i] & 1))rendercount++; //if the new byte has something logged and
|
||||
|
@ -238,11 +229,13 @@ void LoadCDLog (const char* nameo)
|
|||
}
|
||||
|
||||
fclose(FP);
|
||||
RenameLog(nameo);
|
||||
UpdateCDLogger();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
void LoadCDLogFile(){
|
||||
void LoadCDLogFile()
|
||||
{
|
||||
const char filter[]="Code Data Log File (*.CDL)\0*.cdl\0\0";
|
||||
char nameo[2048];
|
||||
OPENFILENAME ofn;
|
||||
|
@ -256,21 +249,29 @@ void LoadCDLogFile(){
|
|||
ofn.nMaxFile=256;
|
||||
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
|
||||
ofn.hwndOwner = hCDLogger;
|
||||
if(!GetOpenFileName(&ofn))return;
|
||||
if (!GetOpenFileName(&ofn))
|
||||
return;
|
||||
LoadCDLog(nameo);
|
||||
}
|
||||
|
||||
void SaveCDLogFileAs()
|
||||
{
|
||||
const char filter[]="Code Data Log File (*.CDL)\0*.cdl\0All Files (*.*)\0*.*\0\0";
|
||||
char nameo[2048];
|
||||
char nameo[2048] = {0};
|
||||
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;
|
||||
strcpy(nameo,GetRomName());
|
||||
if (loadedcdfile[0])
|
||||
{
|
||||
strcpy(nameo, loadedcdfile);
|
||||
} else
|
||||
{
|
||||
strcpy(nameo, LoadedRomFName);
|
||||
strcat(nameo, ".cdl");
|
||||
}
|
||||
ofn.lpstrDefExt = "cdl";
|
||||
ofn.lpstrFile = nameo;
|
||||
ofn.nMaxFile = 256;
|
||||
|
@ -278,21 +279,30 @@ void SaveCDLogFileAs()
|
|||
ofn.hwndOwner = hCDLogger;
|
||||
if (!GetSaveFileName(&ofn))
|
||||
return;
|
||||
strcpy(loadedcdfile,nameo);
|
||||
RenameLog(nameo);
|
||||
SaveCDLogFile();
|
||||
}
|
||||
|
||||
void SaveCDLogFile(){ //todo make this button work before you've saved as
|
||||
void SaveCDLogFile()
|
||||
{
|
||||
if (loadedcdfile[0] == 0)
|
||||
{
|
||||
char nameo[2048];
|
||||
strcpy(nameo, LoadedRomFName);
|
||||
strcat(nameo, ".cdl");
|
||||
RenameLog(nameo);
|
||||
}
|
||||
|
||||
FILE *FP;
|
||||
FP = fopen(loadedcdfile, "wb");
|
||||
if(FP == NULL) // removed deadly recurrence
|
||||
if (FP == NULL)
|
||||
{
|
||||
FCEUD_PrintError("Error Saving File");
|
||||
return;
|
||||
}
|
||||
fwrite(cdloggerdata,PRGsize[0],1,FP);
|
||||
if(CHRsize[0] != 0)
|
||||
fwrite(cdloggervdata,CHRsize[0],1,FP);
|
||||
fwrite(cdloggerdata, cdloggerdataSize, 1, FP);
|
||||
if(cdloggerVideoDataSize != 0)
|
||||
fwrite(cdloggervdata, cdloggerVideoDataSize, 1, FP);
|
||||
fclose(FP);
|
||||
}
|
||||
|
||||
|
@ -327,21 +337,21 @@ void UpdateCDLogger()
|
|||
float fvromreadcount = vromreadcount;
|
||||
float fundefinedcount = undefinedcount;
|
||||
float fundefinedvromcount = undefinedvromcount;
|
||||
float fromsize = PRGsize[0];
|
||||
float fvromsize = CHRsize[0] != 0 ? CHRsize[0] : 1;
|
||||
float fromsize = cdloggerdataSize;
|
||||
float fvromsize = (cdloggerVideoDataSize != 0) ? cdloggerVideoDataSize : 1;
|
||||
|
||||
sprintf(str,"0x%06x %.2f%%",codecount,fcodecount/fromsize*100);
|
||||
sprintf(str,"0x%06x %.2f%%", codecount, (fcodecount / fromsize) * 100);
|
||||
SetDlgItemText(hCDLogger, LBL_CDLOGGER_CODECOUNT, str);
|
||||
sprintf(str,"0x%06x %.2f%%",datacount,fdatacount/fromsize*100);
|
||||
sprintf(str,"0x%06x %.2f%%", datacount,(fdatacount / fromsize) * 100);
|
||||
SetDlgItemText(hCDLogger, LBL_CDLOGGER_DATACOUNT, str);
|
||||
sprintf(str,"0x%06x %.2f%%",undefinedcount,fundefinedcount/fromsize*100);
|
||||
sprintf(str,"0x%06x %.2f%%", undefinedcount, (fundefinedcount / fromsize) * 100);
|
||||
SetDlgItemText(hCDLogger, LBL_CDLOGGER_UNDEFCOUNT, str);
|
||||
|
||||
sprintf(str,"0x%06x %.2f%%",rendercount,frendercount/fvromsize*100);
|
||||
sprintf(str,"0x%06x %.2f%%", rendercount, (frendercount / fvromsize) * 100);
|
||||
SetDlgItemText(hCDLogger, LBL_CDLOGGER_RENDERCOUNT, str);
|
||||
sprintf(str,"0x%06x %.2f%%",vromreadcount,fvromreadcount/fvromsize*100);
|
||||
sprintf(str,"0x%06x %.2f%%", vromreadcount, (fvromreadcount / fvromsize) * 100);
|
||||
SetDlgItemText(hCDLogger, LBL_CDLOGGER_VROMREADCOUNT, str);
|
||||
sprintf(str,"0x%06x %.2f%%",undefinedvromcount,fundefinedvromcount/fvromsize*100);
|
||||
sprintf(str,"0x%06x %.2f%%", undefinedvromcount, (fundefinedvromcount / fvromsize) * 100);
|
||||
SetDlgItemText(hCDLogger, LBL_CDLOGGER_UNDEFVROMCOUNT, str);
|
||||
return;
|
||||
}
|
||||
|
@ -369,7 +379,7 @@ void SaveStrippedRom(int invert)
|
|||
|
||||
if(codecount == 0)
|
||||
{
|
||||
MessageBox(NULL, "Unable to Generate Stripped Rom. Get Something Logged and try again.", "Error", MB_OK);
|
||||
MessageBox(NULL, "Unable to Generate Stripped ROM. Get Something Logged and try again.", "Error", MB_OK);
|
||||
return;
|
||||
}
|
||||
memset(&ofn,0,sizeof(ofn));
|
||||
|
@ -441,9 +451,9 @@ void SaveStrippedRom(int invert)
|
|||
fputc(pchar, fp);
|
||||
}
|
||||
|
||||
if(CHRsize[0] != 0)
|
||||
if(cdloggerVideoDataSize != 0)
|
||||
{
|
||||
// since an old ppu at least log the 2007 ppu read accesses, so need to save anyway...
|
||||
// since the OldPPU at least logs the $2007 read accesses, we should save the data anyway
|
||||
for(i = 0; i < (int)CHRsize[0]; i++) {
|
||||
unsigned char vchar;
|
||||
if(cdloggervdata[i] & 3)
|
||||
|
@ -457,3 +467,122 @@ void SaveStrippedRom(int invert)
|
|||
fclose(fp);
|
||||
}
|
||||
|
||||
void CDLoggerROMClosed()
|
||||
{
|
||||
if (hCDLogger)
|
||||
{
|
||||
PauseLogging();
|
||||
if (autosaveCDL)
|
||||
SaveCDLogFile();
|
||||
}
|
||||
}
|
||||
void CDLoggerROMChanged()
|
||||
{
|
||||
if (hCDLogger)
|
||||
{
|
||||
FreeLog();
|
||||
InitLog();
|
||||
ResetLog();
|
||||
RenameLog("");
|
||||
UpdateCDLogger();
|
||||
}
|
||||
|
||||
if (!autoresumeCDLogging)
|
||||
return;
|
||||
|
||||
// try to load respective CDL file
|
||||
char nameo[2048];
|
||||
strcpy(nameo, LoadedRomFName);
|
||||
strcat(nameo, ".cdl");
|
||||
|
||||
/*
|
||||
// if the new CDL is the same (and arrays size is the same), don't do anything
|
||||
if (hCDLogger
|
||||
&& strcmp(loadedcdfile, nameo) == 0
|
||||
&& PRGsize[0] == cdloggerdataSize
|
||||
&& CHRsize[0] == cdloggerVideoDataSize)
|
||||
return;
|
||||
*/
|
||||
|
||||
FILE *FP;
|
||||
FP = fopen(nameo, "rb");
|
||||
if (FP != NULL)
|
||||
{
|
||||
// .cdl file with this ROM name exists
|
||||
fclose(FP);
|
||||
if (!hCDLogger)
|
||||
DoCDLogger();
|
||||
if (LoadCDLog(nameo))
|
||||
StartLogging();
|
||||
}
|
||||
}
|
||||
void CDLoggerPPUChanged()
|
||||
{
|
||||
if (newppu)
|
||||
SetDlgItemText(hCDLogger, ID_CHR1, "CHR Rendered");
|
||||
else
|
||||
SetDlgItemText(hCDLogger, ID_CHR1, "!!! Enable NewPPU !!!");
|
||||
}
|
||||
|
||||
bool PauseLogging()
|
||||
{
|
||||
// can't pause while Trace Logger is using
|
||||
if ((logging) && (logging_options & LOG_NEW_INSTRUCTIONS))
|
||||
{
|
||||
MessageBox(hCDLogger, "The Trace Logger is currently using this for some of its features.\nPlease turn the Trace Logger off and try again.","Unable to Pause Code/Data Logger", MB_OK);
|
||||
return false;
|
||||
}
|
||||
FCEUI_SetLoggingCD(0);
|
||||
EnableTracerMenuItems();
|
||||
SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Start");
|
||||
return true;
|
||||
}
|
||||
void StartLogging()
|
||||
{
|
||||
FCEUI_SetLoggingCD(1);
|
||||
EnableTracerMenuItems();
|
||||
SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Pause");
|
||||
}
|
||||
|
||||
void FreeLog()
|
||||
{
|
||||
if (cdloggerdata)
|
||||
{
|
||||
free(cdloggerdata);
|
||||
cdloggerdata = 0;
|
||||
cdloggerdataSize = 0;
|
||||
}
|
||||
if (cdloggervdata)
|
||||
{
|
||||
free(cdloggervdata);
|
||||
cdloggervdata = 0;
|
||||
cdloggerVideoDataSize = 0;
|
||||
}
|
||||
}
|
||||
void InitLog()
|
||||
{
|
||||
cdloggerdataSize = PRGsize[0];
|
||||
cdloggerdata = (unsigned char*)malloc(cdloggerdataSize);
|
||||
cdloggerVideoDataSize = CHRsize[0];
|
||||
if(cdloggerVideoDataSize != 0)
|
||||
cdloggervdata = (unsigned char*)malloc(cdloggerVideoDataSize);
|
||||
}
|
||||
void ResetLog()
|
||||
{
|
||||
codecount = datacount = rendercount = vromreadcount = 0;
|
||||
undefinedcount = cdloggerdataSize;
|
||||
ZeroMemory(cdloggerdata, cdloggerdataSize);
|
||||
if(cdloggerVideoDataSize != 0)
|
||||
{
|
||||
undefinedvromcount = cdloggerVideoDataSize;
|
||||
ZeroMemory(cdloggervdata, cdloggerVideoDataSize);
|
||||
}
|
||||
}
|
||||
void RenameLog(const char* newName)
|
||||
{
|
||||
strcpy(loadedcdfile, newName);
|
||||
if (hCDLogger)
|
||||
{
|
||||
SetDlgItemText(hCDLogger, ID_CDLFILENAME, loadedcdfile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,6 +96,8 @@ extern int logging_options;
|
|||
extern int log_lines_option;
|
||||
extern int Tracer_wndx, Tracer_wndy;
|
||||
extern int CDLogger_wndx, CDLogger_wndy;
|
||||
extern bool autoresumeCDLogging;
|
||||
extern bool autosaveCDL;
|
||||
extern int GGConv_wndx, GGConv_wndy;
|
||||
extern int MetaPosX,MetaPosY;
|
||||
extern int MLogPosX,MLogPosY;
|
||||
|
@ -299,6 +301,8 @@ static CFGSTRUCT fceuconfig[] =
|
|||
AC(Tracer_wndy),
|
||||
AC(CDLogger_wndx),
|
||||
AC(CDLogger_wndy),
|
||||
AC(autosaveCDL),
|
||||
AC(autoresumeCDLogging),
|
||||
AC(GGConv_wndx),
|
||||
AC(GGConv_wndy),
|
||||
AC(TextHookerPosX),
|
||||
|
|
|
@ -375,7 +375,7 @@ int LoadTable(const char* nameo)
|
|||
//should return -1, otherwise returns the line number it had the error on
|
||||
int LoadTableFile(){
|
||||
const char filter[]="Table Files (*.TBL)\0*.tbl\0All Files (*.*)\0*.*\0\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);
|
||||
|
|
|
@ -1574,37 +1574,43 @@ BEGIN
|
|||
DEFPUSHBUTTON "&OK",IDOK,67,52,50,14
|
||||
END
|
||||
|
||||
CDLOGGER DIALOGEX 0, 0, 315, 243
|
||||
CDLOGGER DIALOGEX 0, 0, 307, 242
|
||||
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"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Load...",BTN_CDLOGGER_LOAD,7,105,50,14
|
||||
PUSHBUTTON "Save",BTN_CDLOGGER_SAVE,257,105,50,14
|
||||
GROUPBOX "Code/Data Log Status",-1,3,4,308,155,BS_CENTER
|
||||
PUSHBUTTON "Start",BTN_CDLOGGER_START_PAUSE,129,105,50,14
|
||||
GROUPBOX "Address Label Logger",65534,3,161,308,79,BS_CENTER
|
||||
PUSHBUTTON "Load...",111,7,219,50,14,WS_DISABLED
|
||||
PUSHBUTTON "Start",112,129,219,50,14,WS_DISABLED
|
||||
PUSHBUTTON "Save...",113,257,219,50,14,WS_DISABLED
|
||||
LTEXT "4067 - 29.5%",LBL_CDLOGGER_CODECOUNT,40,31,68,11
|
||||
GROUPBOX "PRG Logged as Code",65533,29,20,84,27
|
||||
GROUPBOX "PRG Logged as Data",65532,117,20,84,27
|
||||
LTEXT "7092 - 37.2%",LBL_CDLOGGER_DATACOUNT,128,31,65,9
|
||||
GROUPBOX "PRG not Logged",65531,205,20,79,27
|
||||
LTEXT "6072 - 32.7%",LBL_CDLOGGER_UNDEFCOUNT,216,31,60,8
|
||||
LTEXT "Itsa me the Code/Data Logger! Press Start to play!",65530,69,80,172,12
|
||||
PUSHBUTTON "Reset Log",BTN_CDLOGGER_RESET,7,90,50,14
|
||||
PUSHBUTTON "Save as...",BTN_CDLOGGER_SAVE_AS,257,90,50,14
|
||||
PUSHBUTTON "Save Stripped iNes Rom...",BTN_CDLOGGER_SAVE_STRIPPED,208,125,99,14
|
||||
PUSHBUTTON "Save Unused Data...",BTN_CDLOGGER_SAVE_UNUSED,208,140,99,14
|
||||
LTEXT "4067 - 29.5%",LBL_CDLOGGER_RENDERCOUNT,40,60,68,11
|
||||
GROUPBOX "CHR Rendered",-1,29,50,84,27
|
||||
GROUPBOX "CHR Logged as Data",-1,117,50,84,27
|
||||
LTEXT "7092 - 37.2%",LBL_CDLOGGER_VROMREADCOUNT,128,60,65,9
|
||||
GROUPBOX "CHR not Logged",-1,205,50,79,27
|
||||
LTEXT "6072 - 32.7%",LBL_CDLOGGER_UNDEFVROMCOUNT,216,60,60,8
|
||||
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
|
||||
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
|
||||
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
|
||||
LTEXT "7092 - 37.2%",LBL_CDLOGGER_DATACOUNT,122,29,71,9
|
||||
GROUPBOX "PRG not Logged",65531,201,18,79,27
|
||||
LTEXT "6072 - 32.7%",LBL_CDLOGGER_UNDEFCOUNT,210,29,66,8
|
||||
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
|
||||
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
|
||||
LTEXT "7092 - 37.2%",LBL_CDLOGGER_VROMREADCOUNT,122,58,71,9
|
||||
GROUPBOX "CHR not Logged",ID_CHR3,201,47,79,27
|
||||
LTEXT "6072 - 32.7%",LBL_CDLOGGER_UNDEFVROMCOUNT,210,58,66,9
|
||||
LTEXT "CDL file:",ID_STATIC,12,94,29,11
|
||||
LTEXT "",ID_CDLFILENAME,43,94,252,11,SS_PATHELLIPSIS
|
||||
CONTROL " Auto-resume logging when loading ROMs",IDC_AUTORESUMECDLOGGING,
|
||||
"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
|
||||
END
|
||||
|
||||
PPUVIEW DIALOGEX 44, 38, 355, 246
|
||||
|
@ -2083,7 +2089,6 @@ BEGIN
|
|||
|
||||
"CDLOGGER", DIALOG
|
||||
BEGIN
|
||||
BOTTOMMARGIN, 238
|
||||
END
|
||||
|
||||
"PPUVIEW", DIALOG
|
||||
|
|
|
@ -611,12 +611,15 @@
|
|||
#define IDC_NOTES_TO_SUBTITLES 1203
|
||||
#define IDC_MATCH_CASE 1203
|
||||
#define IDC_COPY_INPUT 1203
|
||||
#define IDC_AUTORESUMECDLOGGING 1203
|
||||
#define IDC_VOLUMEGROUP 1204
|
||||
#define IDC_OMITBLANK 1204
|
||||
#define IDC_CHECK3 1204
|
||||
#define IDC_CHECK_MARKERS 1204
|
||||
#define IDC_RECORDING 1204
|
||||
#define IDC_COPY_MARKERS 1204
|
||||
#define IDC_AUTORESUMECDLOGGING2 1204
|
||||
#define IDC_AUTOSAVECDL 1204
|
||||
#define IDC_RAMLIST 1205
|
||||
#define IDC_CHECK4 1205
|
||||
#define IDC_CHECK_BOOKMARKS 1205
|
||||
|
@ -720,6 +723,10 @@
|
|||
#define ID_CANCEL 1281
|
||||
#define IDC_AUTOSAVE_PROJECT 1282
|
||||
#define IDC_SILENT_AUTOSAVE 1283
|
||||
#define ID_CHR1 1283
|
||||
#define ID_CHR2 1284
|
||||
#define ID_CHR3 1285
|
||||
#define ID_STATIC 1286
|
||||
#define MENU_NETWORK 40040
|
||||
#define MENU_PALETTE 40041
|
||||
#define MENU_SOUND 40042
|
||||
|
@ -1161,18 +1168,20 @@
|
|||
#define ID_ENABLE_AUTORESUME 40579
|
||||
#define ID_CONFIG_COMPACTQUICKSAVING 40580
|
||||
#define ID_CONFIG_SAVING_OPTIONS 40581
|
||||
#define ID_CDLFILENAME 40582
|
||||
#define IDC_DEBUGGER_ICONTRAY 55535
|
||||
#define MW_ValueLabel2 65423
|
||||
#define MW_ValueLabel1 65426
|
||||
#define IDC_BOOKMARK_NAME_TEXT 65535
|
||||
#define ID_CDL 65535
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 290
|
||||
#define _APS_NEXT_COMMAND_VALUE 40582
|
||||
#define _APS_NEXT_CONTROL_VALUE 1283
|
||||
#define _APS_NEXT_COMMAND_VALUE 40583
|
||||
#define _APS_NEXT_CONTROL_VALUE 1287
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -34,8 +34,8 @@ extern PIANO_ROLL piano_roll;
|
|||
extern EDITOR editor;
|
||||
|
||||
// resources
|
||||
const char recordingCheckbox[10] = "Recording";
|
||||
const char recordingCheckboxBlankPattern[16] = "Recording blank";
|
||||
const char recordingCheckbox[11] = " Recording";
|
||||
const char recordingCheckboxBlankPattern[17] = " Recording blank";
|
||||
|
||||
const char recordingModes[5][4] = { "All",
|
||||
"1P",
|
||||
|
|
|
@ -683,7 +683,7 @@ int TextHookerSaveTableFile(){
|
|||
|
||||
//init the "Save File" dialogue
|
||||
const char filter[]="Table Files (*.THT)\0*.tht\0All Files (*.*)\0*.*\0\0";
|
||||
char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead?
|
||||
char nameo[2048];
|
||||
OPENFILENAME ofn;
|
||||
//StopSound(); //mbg merge 6/30/08
|
||||
memset(&ofn,0,sizeof(ofn));
|
||||
|
|
|
@ -53,9 +53,11 @@
|
|||
#ifdef WIN32
|
||||
#include "drivers/win/pref.h"
|
||||
|
||||
extern void CDLoggerROMClosed();
|
||||
extern void CDLoggerROMChanged();
|
||||
extern void ResetDebugStatisticsCounters();
|
||||
extern void SetMainWindowText();
|
||||
|
||||
extern void CDLoggerPPUChanged();
|
||||
extern bool TaseditorIsRecording();
|
||||
|
||||
extern int32 fps_scale;
|
||||
|
@ -132,6 +134,7 @@ void FCEU_TogglePPU(void) {
|
|||
}
|
||||
#ifdef WIN32
|
||||
SetMainWindowText();
|
||||
CDLoggerPPUChanged();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -151,6 +154,7 @@ static void FCEU_CloseGame(void)
|
|||
{
|
||||
FCEUD_PrintError("Couldn't store debugging data");
|
||||
}
|
||||
CDLoggerROMClosed();
|
||||
#endif
|
||||
|
||||
if (FCEUnetplay) {
|
||||
|
@ -484,6 +488,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
|||
|
||||
#if defined (WIN32) || defined (WIN64)
|
||||
DoDebuggerDataReload(); // Reloads data without reopening window
|
||||
CDLoggerROMChanged();
|
||||
#endif
|
||||
|
||||
if (AutoResumePlay && (GameInfo->type != GIT_NSF))
|
||||
|
|
|
@ -438,6 +438,7 @@ inline void FFCEUX_PPUWrite_Default(uint32 A, uint8 V) {
|
|||
|
||||
volatile int rendercount, vromreadcount, undefinedvromcount, LogAddress = -1;
|
||||
unsigned char *cdloggervdata;
|
||||
unsigned int cdloggerVideoDataSize = 0;
|
||||
|
||||
int GetCHRAddress(int A){
|
||||
int result;
|
||||
|
|
Loading…
Reference in New Issue