diff --git a/changelog.txt b/changelog.txt index 3ac8ac9b..9d2fe6ad 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +---version 2.0.2 released--- + +06-aug-2008 - zeromus - auto-fill .fcs extension in save state as dialog +06-aug-2008 - zeromus - mmc5 - 64KB games now work correctly +06-aug-2008 - zeromus - mmc5 - use of chr A regs for BG in sprite 8x8 mode is fixed +06-aug-2008 - zeromus - debugger - debugger window is now resizeable + ---version 2.0.1 released--- 04-aug-2008 - reorganize display toggle options in the menu diff --git a/src/drivers/win/debugger.cpp b/src/drivers/win/debugger.cpp index aef61836..7b59fc00 100644 --- a/src/drivers/win/debugger.cpp +++ b/src/drivers/win/debugger.cpp @@ -55,7 +55,7 @@ int WP_edit=-1; int ChangeWait=0,ChangeWait2=0; uint8 debugger_open=0; HWND hDebug; -static HFONT hFont,hNewFont; +static HFONT hFont; static SCROLLINFO si; #define INVALID_START_OFFSET 1 @@ -271,7 +271,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { // ################################## End of SP CODE ########################### char str[35000]={0},chr[34]={0}; - int size,i,j; + int size; uint8 opcode[3]; // ################################## Start of SP CODE ########################### @@ -283,7 +283,13 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { si.nPos = addr; SetScrollInfo(GetDlgItem(hWnd,scrollid),SB_CTL,&si,TRUE); - for (i = 0; i < 34; i++) { + //figure out how many lines we can draw + RECT rect; + GetWindowRect(hWnd,&rect); + int lines = (rect.bottom-rect.top)/13; + + + for (int i = 0; i < lines; i++) { if (addr > 0xFFFF) break; if(addr >= 0x8000) sprintf(chr, "%02X:%04X", getBank(addr), addr); @@ -310,7 +316,7 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr) { } break; } - for (j = 0; j < size; j++) { + for (int j = 0; j < size; j++) { sprintf(chr, "%02X ", opcode[j] = GetMem(addr++)); strcat(str,chr); } @@ -642,8 +648,8 @@ BOOL CALLBACK AssemblerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar CenterWindow(hwndDlg); //set font - SendDlgItemMessage(hwndDlg,IDC_ASSEMBLER_DISASSEMBLY,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_ASSEMBLER_PATCH_DISASM,WM_SETFONT,(WPARAM)hNewFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_ASSEMBLER_DISASSEMBLY,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_ASSEMBLER_PATCH_DISASM,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); //set limits SendDlgItemMessage(hwndDlg,IDC_ASSEMBLER_HISTORY,CB_LIMITTEXT,20,0); @@ -818,12 +824,53 @@ void DebuggerExit() { FCEUI_Debugger().badopbreak = 0; debugger_open = 0; - DeleteObject(hNewFont); DestroyWindow(hDebug); } +static RECT currDebuggerRect; +static RECT newDebuggerRect; + +//used to move all child items in the dialog when you resize (except for the dock fill controls which are resized) +BOOL CALLBACK DebuggerEnumWindowsProc(HWND hwnd, LPARAM lParam) +{ + int dx = (newDebuggerRect.right-newDebuggerRect.left)-(currDebuggerRect.right-currDebuggerRect.left); + int dy = (newDebuggerRect.bottom-newDebuggerRect.top)-(currDebuggerRect.bottom-currDebuggerRect.top); + + HWND editbox = GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY); + HWND icontray = GetDlgItem(hDebug,IDC_DEBUGGER_ICONTRAY); + HWND addrline = GetDlgItem(hDebug,IDC_DEBUGGER_ADDR_LINE); + HWND vscr = GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY_VSCR); + + RECT crect; + GetWindowRect(hwnd,&crect); + ScreenToClient(hDebug,(LPPOINT)&crect); + ScreenToClient(hDebug,((LPPOINT)&crect)+1); + + if(hwnd == editbox) { + crect.right += dx; + crect.bottom += dy; + SetWindowPos(hwnd,0,0,0,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER | SWP_NOMOVE); + GetScrollInfo(GetDlgItem(hDebug,IDC_DEBUGGER_DISASSEMBLY_VSCR),SB_CTL,&si); + Disassemble(hDebug, IDC_DEBUGGER_DISASSEMBLY, IDC_DEBUGGER_DISASSEMBLY_VSCR, si.nPos); + } else if(hwnd == icontray) { + crect.bottom += dy; + SetWindowPos(hwnd,0,0,0,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER | SWP_NOMOVE); + } else if(hwnd == addrline) { + crect.top += dy; + SetWindowPos(hwnd,0,crect.left,crect.top,0,0,SWP_NOZORDER | SWP_NOSIZE); + } else if(hwnd == vscr) { + crect.bottom += dy; + crect.left += dx; + crect.right += dx; + SetWindowPos(hwnd,0,crect.left,crect.top,crect.right-crect.left,crect.bottom-crect.top,SWP_NOZORDER); + } else { + crect.left += dx; + SetWindowPos(hwnd,0,crect.left,crect.top,0,0,SWP_NOZORDER | SWP_NOSIZE); + } + return TRUE; +} + BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - LOGFONT lf; RECT wrect; char str[256]={0},*ptr,dotdot[4]; int tmp,tmp2; @@ -837,6 +884,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara extern int loadDebugDataFailed; SetWindowPos(hwndDlg,0,DbgPosX,DbgPosY,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER); + GetWindowRect(hwndDlg,&currDebuggerRect); si.cbSize = sizeof(SCROLLINFO); si.fMask = SIF_ALL; @@ -847,20 +895,15 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara SetScrollInfo(GetDlgItem(hwndDlg,IDC_DEBUGGER_DISASSEMBLY_VSCR),SB_CTL,&si,TRUE); //setup font - hFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0); - GetObject(hFont, sizeof(LOGFONT), &lf); - strcpy(lf.lfFaceName,"Courier"); - hNewFont = CreateFontIndirect(&lf); - - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_DISASSEMBLY,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_A,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_X,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_Y,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PC,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_STACK_CONTENTS,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PCSEEK,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,WM_SETFONT,(WPARAM)hNewFont,FALSE); - SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_SPR,WM_SETFONT,(WPARAM)hNewFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_DISASSEMBLY,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_A,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_X,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_Y,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PC,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_STACK_CONTENTS,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PCSEEK,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_PPU,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); + SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_SPR,WM_SETFONT,(WPARAM)debugSystem->hFixedFont,FALSE); //text limits SendDlgItemMessage(hwndDlg,IDC_DEBUGGER_VAL_A,EM_SETLIMITTEXT,2,0); @@ -914,6 +957,17 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara FillBreakList(hwndDlg); break; } + + case WM_SIZE: { + GetWindowRect(hwndDlg,&newDebuggerRect); + EnumChildWindows(hwndDlg,DebuggerEnumWindowsProc,0); + currDebuggerRect = newDebuggerRect; + InvalidateRect(hwndDlg,0,TRUE); + UpdateWindow(hwndDlg); + break; + } + + case WM_CLOSE: case WM_QUIT: //exitdebug: diff --git a/src/drivers/win/debuggersp.cpp b/src/drivers/win/debuggersp.cpp index e6f6dae6..2e163ace 100644 --- a/src/drivers/win/debuggersp.cpp +++ b/src/drivers/win/debuggersp.cpp @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #include "common.h" #include "debuggersp.h" #include "debugger.h" diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index b69dadb1..5cca5f30 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -829,8 +829,8 @@ BEGIN LTEXT "Value",MW_ValueLabel2,231,7,19,8 END -DEBUGGER DIALOGEX 54, 74, 547, 306 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +DEBUGGER DIALOGEX 54, 74, 548, 305 +STYLE DS_SETFONT | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "6502 Debugger" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN @@ -872,8 +872,7 @@ BEGIN EDITTEXT IDC_DEBUGGER_VAL_PPU,367,182,25,12,ES_UPPERCASE | ES_WANTRETURN EDITTEXT IDC_DEBUGGER_VAL_SPR,417,182,15,12,ES_UPPERCASE | ES_WANTRETURN LTEXT "Scanline:",IDC_DEBUGGER_VAL_SLINE,435,183,50,10 - CONTROL "",55535,"Static",SS_BLACKFRAME,5,6,10,289 - LTEXT "",IDC_DEBUGGER_ADDR_LINE,5,296,538,10 + LTEXT "",IDC_DEBUGGER_ADDR_LINE,5,295,538,10 CONTROL "Break on Bad Opcode",IDC_DEBUGGER_BREAK_ON_BAD_OP, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,437,118,90,10 CONTROL "Symbolic debugging",IDC_DEBUGGER_ENABLE_SYMBOLIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,347,200,79,10 @@ -884,6 +883,7 @@ BEGIN PUSHBUTTON "Add",IDC_DEBUGGER_BOOKMARK_ADD,421,239,40,14 PUSHBUTTON "Delete",IDC_DEBUGGER_BOOKMARK_DEL,421,255,40,14 PUSHBUTTON "Rom Patcher",IDC_DEBUGGER_ROM_PATCHER,489,198,49,14 + CONTROL "",IDC_DEBUGGER_ICONTRAY,"Static",SS_BLACKFRAME,5,6,10,289 END TRACER DIALOGEX 65527, 65513, 398, 319 @@ -1386,6 +1386,11 @@ BEGIN BOTTOMMARGIN, 268 END + "DEBUGGER", DIALOG + BEGIN + RIGHTMARGIN, 547 + END + "MONITOR", DIALOG BEGIN LEFTMARGIN, 7 diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index c47e11ce..3f5d8375 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -515,6 +515,7 @@ #define FCEU_DISPLAY_LAGCOUNTER 40235 #define MENU_DISPLAY_INPUTDISPLAY 40236 #define MENU_DISPLAY_LAGCOUNTER 40237 +#define IDC_DEBUGGER_ICONTRAY 55535 #define MW_ValueLabel2 65423 #define MW_ValueLabel1 65426