* Tracer: fixed crash when logging undefined opcodes

* Hexeditor: display 0x4000-0x5FFF properly (fixes #545)
* Hexeditor: Ctrl+F opens Find dialog
* Code/Data Logger: fixed VROM dumping in Old PPU mode
* updated docs

[[Split portion of a mixed commit.]]
This commit is contained in:
ansstuff 2012-09-28 15:55:14 +00:00
parent 058434b7e7
commit 40c9e1b30b
11 changed files with 87 additions and 56 deletions

View File

@ -1,9 +1,14 @@
28-Sep-2012 - AnS - CDLogger: fixed VROM dumping in old ppu mode
28-Sep-2012 - AnS - Hexeditor: Ctrl+F opens Find dialog
28-Sep-2012 - AnS - Hexeditor: display 0x4000-0x5FFF properly
28-Sep-2012 - AnS - Tracer: fixed crash when logging undefined opcodes
26-Sep-2012 - AnS - Debugger: "Name" button in Bookmarks, total revamp of Bookmarks
26-Sep-2012 - AnS - Debugger: single click on any address copies this address to the "Seek To" field and "Bookmark Add" field
26-Sep-2012 - AnS - Fixed replay engine bug that doubles the last input of the movie
26-Sep-2012 - AnS - Tracer: RTS instructions output caller address/name
23-Sep-2012 - AnS - Lua: clear previous frame drawings at the beginning of every frame
23-Sep-2012 - AnS - Debugger: fixed mouseover when using Symbolic debug; mouseover works for the disassembly window too
23-Sep-2012 - CaH4e3 - CDLogger: Now can log VROM access (CHR banks of the ROM) when NewPPU is enabled
22-Sep-2012 - AnS - Tracer: added "Symbolic trace", "Log current Frame number", "Log emulator messages", "Log breakpoint hits" options
11-Sep-2012 - AnS - new Lua function: emu.setlagflag()
11-Sep-2012 - AnS - Debugger: deleting a breakpoint leaves selection in the Breakpoints list

View File

@ -268,7 +268,7 @@ uint8 GetMem(uint16 A) {
case 7: return VRAMBuffer;
}
}
else if ((A >= 0x4000) && (A < 0x6000)) return 0xFF; //fix me
//else if ((A >= 0x4000) && (A < 0x6000)) return 0xFF; // AnS: removed the dummy
if (GameInfo) return ARead[A](A); //adelikat: 11/17/09: Prevent crash if this is called with no game loaded.
else return 0;
}

View File

@ -173,8 +173,8 @@ MB_OK);
if(!newppu)
{
if(MessageBox(hCDLogger,
"In order for CHR data logging to take effect, the New PPU engine logger must also be enabled.\
Would you like to enable new PPU engine now?","Enable new PPU engine?",
"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();
@ -264,7 +264,8 @@ void LoadCDLogFile(){
LoadCDLog(nameo);
}
void SaveCDLogFileAs(){
void SaveCDLogFileAs()
{
const char filter[]="Code Data Log File (*.CDL)\0*.cdl\0All Files (*.*)\0*.*\0\0";
char nameo[2048];
OPENFILENAME ofn;
@ -287,10 +288,10 @@ void SaveCDLogFileAs(){
void SaveCDLogFile(){ //todo make this button work before you've saved as
FILE *FP;
FP = fopen(loadedcdfile,"wb");
if(FP == NULL){
FCEUD_PrintError("Error Opening File");
if(FP == NULL)
{
SaveCDLogFileAs();
return;
}
fwrite(cdloggerdata,PRGsize[0],1,FP);
@ -436,13 +437,21 @@ void SaveStrippedRom(int invert){ //this is based off of iNesSave()
if(VROM_size)
{
for(i = 0; i < (int)CHRsize[0]; i++){
unsigned char vchar;
if(cdloggervdata[i] & 1)
vchar = invert?0:VROM[i];
else
vchar = invert?VROM[i]:0;
fputc(vchar, fp);
if(!newppu)
{
for(i = 0; i < (int)CHRsize[0]; i++)
{
unsigned char vchar;
if(cdloggervdata[i] & 1)
vchar = invert?0:VROM[i];
else
vchar = invert?VROM[i]:0;
fputc(vchar, fp);
}
} else
{
// since old ppu doesn't log VROM access, just dump it to the file
fwrite(VROM,CHRsize[0],1,fp);
}
}
}

Binary file not shown.

View File

@ -317,18 +317,23 @@ int BlockingCheck()
if(hCheat)
if(IsChild(hCheat, msg.hwnd))
handled = IsDialogMessage(hCheat, &msg);
if(hwndMemWatch)
if(!handled && hMemFind)
{
if(IsChild(hMemFind, msg.hwnd))
handled = IsDialogMessage(hMemFind, &msg);
}
if(!handled && hwndMemWatch)
{
if(IsChild(hwndMemWatch,msg.hwnd))
handled = TranslateAccelerator(hwndMemWatch,fceu_hAccel,&msg);
if(!handled)
handled = IsDialogMessage(hwndMemWatch,&msg);
}
if(RamSearchHWnd)
if(!handled && RamSearchHWnd)
{
handled |= IsDialogMessage(RamSearchHWnd, &msg);
handled = IsDialogMessage(RamSearchHWnd, &msg);
}
if(RamWatchHWnd)
if(!handled && RamWatchHWnd)
{
if(IsDialogMessage(RamWatchHWnd, &msg))
{

View File

@ -521,12 +521,12 @@ void UpdateMemoryView(int draw_all)
void UpdateCaption()
{
char str[100];
char EditString[3][20] = {"RAM","PPU Memory","ROM"};
char EditString[3][20] = {"RAM","PPU","ROM"};
if(CursorEndAddy == -1){
sprintf(str,"Hex Editor - Editing %s Offset 0x%06x",EditString[EditingMode],CursorStartAddy);
sprintf(str,"Hex Editor - %s Offset 0x%06x",EditString[EditingMode],CursorStartAddy);
} else {
sprintf(str,"Hex Editor - Editing %s Offset 0x%06x - 0x%06x, 0x%x bytes selected ",
sprintf(str,"Hex Editor - %s Offset 0x%06x - 0x%06x, 0x%x bytes selected ",
EditString[EditingMode],CursorStartAddy,CursorEndAddy,CursorEndAddy-CursorStartAddy+1);
}
SetWindowText(hMemView,str);
@ -775,8 +775,13 @@ void InputData(char *input){
for(i = 0;i < datasize;i++){
addr = CursorStartAddy+i;
if(EditingMode == 0)BWrite[addr](addr,data[i]);
if(EditingMode == 1){
if (EditingMode == 0)
{
// RAM (system bus)
BWrite[addr](addr,data[i]);
} else if (EditingMode == 1)
{
// PPU
addr &= 0x3FFF;
if(addr < 0x2000)
VPage[addr>>10][addr] = data[i]; //todo: detect if this is vrom and turn it red if so
@ -784,8 +789,9 @@ void InputData(char *input){
vnapage[(addr>>10)&0x3][addr&0x3FF] = data[i]; //todo: this causes 0x3000-0x3f00 to mirror 0x2000-0x2f00, is this correct?
if((addr >= 0x3F00) && (addr < 0x3FFF))
PALRAM[addr&0x1F] = data[i];
}
if(EditingMode == 2){
} else if (EditingMode == 2)
{
// ROM
ApplyPatch(addr,datasize,data);
break;
}
@ -1126,6 +1132,8 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// Fall through to Ctrl+G
case 0x47: //Ctrl+G
GotoAddress(hwnd); break;
case 0x46: //Ctrl+F
OpenFindDialog(); break;
}
}
@ -1622,6 +1630,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
for(i = 0;i < DataAmount;i++)OldValues[i] = -1;
UpdateColorTable();
UpdateCaption();
return 0;
// ################################## Start of SP CODE ###########################
@ -1905,8 +1914,14 @@ void FindNext(){
}
void OpenFindDialog() {
if((!hMemView) || (hMemFind))return;
hMemFind = CreateDialog(fceu_hInstance,"MEMVIEWFIND",hMemView,MemFindCallB);
void OpenFindDialog()
{
if (!hMemView)
return;
if (hMemFind)
// set focus to the text field
SendMessage(hMemFind, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMemFind, IDC_MEMVIEWFIND_WHAT), true);
else
hMemFind = CreateDialog(fceu_hInstance,"MEMVIEWFIND",hMemView,MemFindCallB);
return;
}

View File

@ -9,5 +9,5 @@ void UndoLastPatch();
void SetHexEditorAddress(int gotoaddress);
extern HWND hMemView;
extern HWND hMemView, hMemFind;
extern int EditingMode;

View File

@ -55,7 +55,6 @@ int storeDebuggerPreferences(FILE* f)
bookmarks_name.resize(size);
if (fwrite(&size, sizeof(unsigned int), 1, f) != 1) return 1;
// Write the data of those bookmarks
char buffer[256];
for (i = 0; i < (int)size; ++i)
{
if (fwrite(&bookmarks_addr[i], sizeof(unsigned int), 1, f) != 1) return 1;

View File

@ -332,7 +332,6 @@ BEGIN
MENUITEM "&Paste", MENU_MV_EDIT_PASTE
MENUITEM SEPARATOR
MENUITEM "&Find...", MENU_MV_EDIT_FIND
MENUITEM "Find &Next", MENU_MV_EDIT_FIND_NEXT
END
POPUP "&View"
BEGIN
@ -1356,7 +1355,7 @@ BEGIN
GROUPBOX "Direction",-1,9,29,65,44
CONTROL "Up",IDC_MEMVIEWFIND_DIR_UP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,18,43,25,10
CONTROL "Down",IDC_MEMVIEWFIND_DIR_DOWN,"Button",BS_AUTORADIOBUTTON,18,56,35,10
PUSHBUTTON "Find Next",IDC_MEMVIEWFIND_NEXT,225,7,50,14
DEFPUSHBUTTON "Find Next",IDC_MEMVIEWFIND_NEXT,225,7,50,14
END
IDD_RECORDINP DIALOGEX 0, 0, 276, 86

View File

@ -418,7 +418,7 @@ void FCEUD_TraceInstruction()
sprintf(str_disassembly, "OVERFLOW");
} else
{
char* a;
char* a = 0;
switch (size)
{
case 0:
@ -456,37 +456,38 @@ void FCEUD_TraceInstruction()
break;
}
if (logging_options & LOG_SYMBOLIC)
if (a)
{
// Insert Name and Comment lines if needed
str_decoration[0] = 0;
decorateAddress(X.PC, str_decoration);
if (str_decoration[0])
if (logging_options & LOG_SYMBOLIC)
{
// divide the str_decoration into strings (Name, Comment1, Comment2, ...)
char* start_pos = str_decoration;
char* end_pos = strstr(str_decoration, "\r");
while (end_pos)
// Insert Name and Comment lines if needed
str_decoration[0] = 0;
decorateAddress(X.PC, str_decoration);
if (str_decoration[0])
{
end_pos[0] = 0; // set \0 instead of \r
OutputLogLine(start_pos, true);
end_pos += 2;
start_pos = end_pos;
end_pos = strstr(end_pos, "\r");
// divide the str_decoration into strings (Name, Comment1, Comment2, ...)
char* start_pos = str_decoration;
char* end_pos = strstr(str_decoration, "\r");
while (end_pos)
{
end_pos[0] = 0; // set \0 instead of \r
OutputLogLine(start_pos, true);
end_pos += 2;
start_pos = end_pos;
end_pos = strstr(end_pos, "\r");
}
}
replaceNames(ramBankNames, a);
replaceNames(loadedBankNames, a);
replaceNames(lastBankNames, a);
}
replaceNames(ramBankNames, a);
replaceNames(loadedBankNames, a);
replaceNames(lastBankNames, a);
strcpy(str_disassembly, a);
}
strcpy(str_disassembly, a);
}
// special case: an RTS opcode
if (size == 1 && GetMem(addr - 1) == 0x60)
{
// special case: an RTS opcode
// add "----------" to emphasize the end of subroutine
strcat(str_disassembly, " ");
for (int j = strlen(str_disassembly); j < (LOG_DISASSEMBLY_MAX_LEN - 1); ++j)
@ -504,8 +505,6 @@ void FCEUD_TraceInstruction()
}
// Start filling the str_temp line: Frame number, AXYS state, Processor status, Tabs, Address, Data, Disassembly
if (logging_options & LOG_FRAME_NUMBER)
{
sprintf(str_temp, "%06u: ", currFrameCounter);

Binary file not shown.