2006-06-15 04:19:30 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "MemoryViewMIPS.h"
|
|
|
|
#include "win32/InputBox.h"
|
2006-07-13 02:44:13 +00:00
|
|
|
#include "../PS2VM.h"
|
2006-06-15 04:19:30 +00:00
|
|
|
|
|
|
|
#define ID_MEMORYVIEW_GOTOADDRESS 40001
|
|
|
|
|
|
|
|
using namespace Framework;
|
|
|
|
|
|
|
|
CMemoryViewMIPS::CMemoryViewMIPS(HWND hParent, RECT* pR, CMIPS* pCtx) :
|
|
|
|
CMemoryView(hParent, pR)
|
|
|
|
{
|
|
|
|
m_pCtx = pCtx;
|
|
|
|
|
|
|
|
SetMemorySize(0x02004000);
|
|
|
|
|
|
|
|
m_pOnMachineStateChangeHandler = new CEventHandlerMethod<CMemoryViewMIPS, int>(this, &CMemoryViewMIPS::OnMachineStateChange);
|
|
|
|
|
|
|
|
CPS2VM::m_OnMachineStateChange.InsertHandler(m_pOnMachineStateChangeHandler);
|
|
|
|
}
|
|
|
|
|
|
|
|
CMemoryViewMIPS::~CMemoryViewMIPS()
|
|
|
|
{
|
|
|
|
CPS2VM::m_OnMachineStateChange.RemoveHandler(m_pOnMachineStateChangeHandler);
|
|
|
|
}
|
|
|
|
|
2006-07-09 00:45:09 +00:00
|
|
|
long CMemoryViewMIPS::OnRightButtonUp(int nX, int nY)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
|
|
|
POINT pt;
|
|
|
|
HMENU hMenu;
|
|
|
|
|
|
|
|
pt.x = nX;
|
|
|
|
pt.y = nY;
|
|
|
|
ClientToScreen(m_hWnd, &pt);
|
|
|
|
|
|
|
|
hMenu = CreatePopupMenu();
|
|
|
|
InsertMenu(hMenu, 0, MF_BYPOSITION, ID_MEMORYVIEW_GOTOADDRESS, _X("Goto Address..."));
|
|
|
|
//Goto register?
|
|
|
|
|
|
|
|
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_hWnd, NULL);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
long CMemoryViewMIPS::OnCommand(unsigned short nID, unsigned short nCmd, HWND hSender)
|
|
|
|
{
|
|
|
|
switch(nID)
|
|
|
|
{
|
|
|
|
case ID_MEMORYVIEW_GOTOADDRESS:
|
|
|
|
GotoAddress();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
HFONT CMemoryViewMIPS::GetFont()
|
|
|
|
{
|
|
|
|
return CreateFont(-11, 0, 0, 0, 400, 0, 0, 0, 0, 1, 2, 1, 49, _X("Courier New"));
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 CMemoryViewMIPS::GetByte(uint32 nAddress)
|
|
|
|
{
|
|
|
|
return m_pCtx->m_pMemoryMap->GetByte(nAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryViewMIPS::OnMachineStateChange(int nDummy)
|
|
|
|
{
|
|
|
|
Redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMemoryViewMIPS::GotoAddress()
|
|
|
|
{
|
|
|
|
uint32 nAddress;
|
|
|
|
const xchar* sValue;
|
|
|
|
|
|
|
|
if(CPS2VM::m_nStatus == PS2VM_STATUS_RUNNING)
|
|
|
|
{
|
|
|
|
MessageBeep(-1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-07-11 03:33:40 +00:00
|
|
|
Win32::CInputBox i(_X("Goto Address"), _X("Enter new address:"), _X("00000000"));
|
2006-06-15 04:19:30 +00:00
|
|
|
sValue = i.GetValue(m_hWnd);
|
|
|
|
|
|
|
|
if(sValue != NULL)
|
|
|
|
{
|
|
|
|
xsscanf(sValue, _X("%x"), &nAddress);
|
|
|
|
ScrollToAddress(nAddress);
|
|
|
|
}
|
|
|
|
}
|