From b7fc64fe7ec41d87291fe6349ff4278d6824ae11 Mon Sep 17 00:00:00 2001 From: ugetab Date: Tue, 4 May 2010 16:33:20 +0000 Subject: [PATCH] Added Goto command for Hex Editor. --- changelog.txt | 1 + src/drivers/win/memview.cpp | 33 ++++++++++++++++++++++++++++++++- src/drivers/win/res.rc | 1 + src/drivers/win/resource.h | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 6801f4cc..d6cb07e4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,4 @@ +04-may-2010 - ugetab - Win32 - Added "Goto" command for hex editor. 28-april-2010 - ugetab - Added microphone support option. When enabled, Port 2 Start activates the Microphone. Movies also support this. 25-april-2010 - FatRatKnight - Fixed a potential desync that plays out an extra frame without an update to the frame count involving heavy lua use, joypad.get, and a loadstate. 23-april-2010 - ugetab - Win32 - Added Tools>GUI option to partially disable visual themes, so the emulator can be made to look like it did in 2.1.1 and earlier releases. diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 3931210c..84c0d26a 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -36,6 +36,7 @@ #include "main.h" #include "string.h" #include "help.h" +#include "Win32InputBox.h" using namespace std; @@ -223,6 +224,28 @@ void UndoLastPatch(){ return; } +void GotoAddress(HWND hwnd) { + char* gotoaddressstring; + int gotoaddress; + char* gototitle; + + gototitle = (char*)malloc(18); + gotoaddressstring = (char*)malloc(8); + gotoaddressstring[0] = '\0'; + sprintf(gototitle, "%s%X%s", "Goto (0-", MaxSize-1, ")"); + if(CWin32InputBox::InputBox(gototitle, "Goto which address:", gotoaddressstring, 8, false, hwnd) == IDOK) + { + if(EOF != sscanf(gotoaddressstring, "%x", &gotoaddress)) + { + if (gotoaddress > (MaxSize-1)) + gotoaddress = (MaxSize-1); + CursorStartAddy = gotoaddress; + CursorEndAddy = -1; + ChangeMemViewFocus(EditingMode,CursorStartAddy,-1); + } + } +} + static void FlushUndoBuffer(){ struct UNDOSTRUCT *tmp; while(undo_list!= 0){ @@ -1061,7 +1084,11 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa MemViewCallB(hMemView,WM_COMMAND,MENU_MV_EDIT_PASTE,0); return 0; case 0x5a: //Ctrl+Z - UndoLastPatch(); + UndoLastPatch(); break; + case 0x41: //Ctrl+A + // Fall through to Ctrl+G + case 0x47: //Ctrl+G + GotoAddress(hwnd); break; } } @@ -1479,6 +1506,10 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa KillMemView(); return 0; + case MENU_MV_FILE_GOTO_ADDRESS: + GotoAddress(hwnd); + return 0; + case MENU_MV_EDIT_UNDO: UndoLastPatch(); return 0; diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 5f381ea0..574c49d7 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -261,6 +261,7 @@ BEGIN MENUITEM "&Ram", MENU_MV_FILE_DUMP_RAM MENUITEM "&PPU Memory", MENU_MV_FILE_DUMP_PPU END + MENUITEM "&Goto Address\tCtrl+A", MENU_MV_FILE_GOTO_ADDRESS MENUITEM SEPARATOR MENUITEM "&Close\tAlt+F4", ID_MEMWVIEW_FILE_CLOSE END diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 42599c9f..5ebd6af4 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -618,6 +618,7 @@ #define ID_FILE_CLOSECTRL40216 40216 #define ID_MEMWVIEW_FILE_CLOSE 40217 #define ID_FILE_CLOSE40218 40218 +#define MENU_MV_FILE_GOTO_ADDRESS 40219 #define MENU_BASIC_BOT2 40220 #define ID_FILE_OPENLUAWINDOW 40229 #define ID_FILE_CLOSELUAWINDOWS 40230