From d3aadf75cc87128d839ada09e7986691b47a4cd9 Mon Sep 17 00:00:00 2001 From: shygoo Date: Sun, 9 Dec 2018 18:44:30 -0600 Subject: [PATCH] [Debugger] Make AddressRange inclusive in the JS API --- Source/Project64/UserInterface/API.js | 18 +++++++++--------- .../UserInterface/Debugger/ScriptHook.cpp | 6 +++--- apidoc.htm | 18 +++++++++--------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Source/Project64/UserInterface/API.js b/Source/Project64/UserInterface/API.js index 2dc524ece..96b7af450 100644 --- a/Source/Project64/UserInterface/API.js +++ b/Source/Project64/UserInterface/API.js @@ -91,15 +91,15 @@ function AddressRange(start, end) Object.freeze(this) } -const ADDR_ANY = new AddressRange(0x00000000, 0x100000000) -const ADDR_ANY_KUSEG = new AddressRange(0x00000000, 0x80000000) -const ADDR_ANY_KSEG0 = new AddressRange(0x80000000, 0xA0000000) -const ADDR_ANY_KSEG1 = new AddressRange(0xA0000000, 0xC0000000) -const ADDR_ANY_KSEG2 = new AddressRange(0xC0000000, 0x100000000) -const ADDR_ANY_RDRAM = new AddressRange(0x80000000, 0x80800000) -const ADDR_ANY_RDRAM_UNC = new AddressRange(0xA0000000, 0xA0800000) -const ADDR_ANY_CART_ROM = new AddressRange(0x90000000, 0x96000000) -const ADDR_ANY_CART_ROM_UNC = new AddressRange(0xB0000000, 0xB6000000) +const ADDR_ANY = new AddressRange(0x00000000, 0xFFFFFFFF) +const ADDR_ANY_KUSEG = new AddressRange(0x00000000, 0x7FFFFFFF) +const ADDR_ANY_KSEG0 = new AddressRange(0x80000000, 0x9FFFFFFF) +const ADDR_ANY_KSEG1 = new AddressRange(0xA0000000, 0xBFFFFFFF) +const ADDR_ANY_KSEG2 = new AddressRange(0xC0000000, 0xFFFFFFFF) +const ADDR_ANY_RDRAM = new AddressRange(0x80000000, 0x807FFFFF) +const ADDR_ANY_RDRAM_UNC = new AddressRange(0xA0000000, 0xA07FFFFF) +const ADDR_ANY_CART_ROM = new AddressRange(0x90000000, 0x95FFFFFF) +const ADDR_ANY_CART_ROM_UNC = new AddressRange(0xB0000000, 0xB5FFFFFF) const asm = { gprname: function(num) diff --git a/Source/Project64/UserInterface/Debugger/ScriptHook.cpp b/Source/Project64/UserInterface/Debugger/ScriptHook.cpp index fecf459a6..9a9f616f6 100644 --- a/Source/Project64/UserInterface/Debugger/ScriptHook.cpp +++ b/Source/Project64/UserInterface/Debugger/ScriptHook.cpp @@ -51,7 +51,7 @@ void CScriptHook::InvokeByAddressInRange(uint32_t address) int nCallbacks = m_Callbacks.size(); for (int i = 0; i < nCallbacks; i++) { - if (address == m_Callbacks[i].param || (address >= m_Callbacks[i].param && address < m_Callbacks[i].param2)) + if (address == m_Callbacks[i].param || (address >= m_Callbacks[i].param && address <= m_Callbacks[i].param2)) { m_Callbacks[i].scriptInstance->Invoke(m_Callbacks[i].heapptr, address); return; @@ -64,7 +64,7 @@ void CScriptHook::InvokeByAddressInRange_MaskedOpcode(uint32_t pc, uint32_t opco int nCallbacks = m_Callbacks.size(); for (int i = 0; i < nCallbacks; i++) { - if (pc == m_Callbacks[i].param || (pc >= m_Callbacks[i].param && pc < m_Callbacks[i].param2)) + if (pc == m_Callbacks[i].param || (pc >= m_Callbacks[i].param && pc <= m_Callbacks[i].param2)) { if ((m_Callbacks[i].param3 & m_Callbacks[i].param4) == (opcode & m_Callbacks[i].param4)) { @@ -86,7 +86,7 @@ void CScriptHook::InvokeByAddressInRange_GPRValue(uint32_t pc) uint32_t registers = m_Callbacks[i].param3; uint32_t value = m_Callbacks[i].param4; - if (!(pc == startAddress || (pc >= startAddress && pc < endAddress))) + if (!(pc == startAddress || (pc >= startAddress && pc <= endAddress))) { continue; } diff --git a/apidoc.htm b/apidoc.htm index 57f7a1c64..1a3fc4709 100644 --- a/apidoc.htm +++ b/apidoc.htm @@ -855,18 +855,18 @@ server.on('connection', function(socket) Creates an immutable object with start and end address properties.
The following AddressRange objects are defined globally:
-ADDR_ANY              0x00000000 : 0x100000000 Any 32-bit address
+ADDR_ANY              0x00000000 : 0xFFFFFFFF Any 32-bit address
 
-ADDR_ANY_KUSEG        0x00000000 : 0x80000000  MIPS user mode TLB mapped segment
-ADDR_ANY_KSEG0        0x80000000 : 0xA0000000  MIPS cached unmapped segment
-ADDR_ANY_KSEG1        0xA0000000 : 0xC0000000  MIPS uncached unmapped segment
-ADDR_ANY_KSEG2        0xC0000000 : 0x100000000 MIPS kernel mode TLB mapped segment
+ADDR_ANY_KUSEG        0x00000000 : 0x7FFFFFFF  MIPS user mode TLB mapped segment
+ADDR_ANY_KSEG0        0x80000000 : 0x9FFFFFFF  MIPS cached unmapped segment
+ADDR_ANY_KSEG1        0xA0000000 : 0xBFFFFFFF  MIPS uncached unmapped segment
+ADDR_ANY_KSEG2        0xC0000000 : 0xFFFFFFFF MIPS kernel mode TLB mapped segment
 
-ADDR_ANY_RDRAM        0x80000000 : 0x80800000 Cached RDRAM
-ADDR_ANY_RDRAM_UNC    0xA0000000 : 0xA0800000 Uncached RDRAM
+ADDR_ANY_RDRAM        0x80000000 : 0x807FFFFF Cached RDRAM
+ADDR_ANY_RDRAM_UNC    0xA0000000 : 0xA07FFFFF Uncached RDRAM
 
-ADDR_ANY_CART_ROM     0x90000000 : 0x96000000 Cached cartridge ROM
-ADDR_ANY_CART_ROM_UNC 0xB0000000 : 0xB6000000 Uncached cartridge ROM
+ADDR_ANY_CART_ROM     0x90000000 : 0x95FFFFFF Cached cartridge ROM
+ADDR_ANY_CART_ROM_UNC 0xB0000000 : 0xB5FFFFFF Uncached cartridge ROM