[Debugger] Have memory viewer to be able to write to rom
This commit is contained in:
parent
0ffb6bb159
commit
95358b1ac1
|
@ -9,6 +9,8 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include <Project64-core/ExceptionHandler.h>
|
||||||
|
#include <Common/MemoryManagement.h>
|
||||||
|
|
||||||
#include "DebuggerUI.h"
|
#include "DebuggerUI.h"
|
||||||
#include "Symbols.h"
|
#include "Symbols.h"
|
||||||
|
@ -342,6 +344,8 @@ LRESULT CDebugMemoryView::OnMemoryModified(LPNMHDR lpNMHDR)
|
||||||
m_CurrentData[Pos] = (BYTE)Value;
|
m_CurrentData[Pos] = (BYTE)Value;
|
||||||
|
|
||||||
//sb
|
//sb
|
||||||
|
__except_try()
|
||||||
|
{
|
||||||
if (m_DataVAddrr)
|
if (m_DataVAddrr)
|
||||||
{
|
{
|
||||||
if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
||||||
|
@ -356,6 +360,22 @@ LRESULT CDebugMemoryView::OnMemoryModified(LPNMHDR lpNMHDR)
|
||||||
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
uint32_t PhysicalAddress = m_DataStartLoc + Pos;
|
||||||
|
if (!m_DataVAddrr || g_MMU->TranslateVaddr(PhysicalAddress, PhysicalAddress))
|
||||||
|
{
|
||||||
|
if (PhysicalAddress > 0x10000000 && (PhysicalAddress - 0x10000000) < g_Rom->GetRomSize())
|
||||||
|
{
|
||||||
|
uint8_t * ROM = g_Settings->LoadBool(Game_LoadRomToMemory) ? g_MMU->Rdram() + 0x10000000: g_Rom->GetRomAddress();
|
||||||
|
ProtectMemory(ROM, g_Rom->GetRomSize(), MEM_READWRITE);
|
||||||
|
ROM[(PhysicalAddress - 0x10000000) ^ 3] = (uint8_t)Value;
|
||||||
|
ProtectMemory(ROM, g_Rom->GetRomSize(), MEM_READONLY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
__except_catch()
|
||||||
|
{
|
||||||
|
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
|
||||||
|
}
|
||||||
Insert_MemoryLineDump(LineNumber);
|
Insert_MemoryLineDump(LineNumber);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue