[Debugger] Make AddressRange inclusive in the JS API

This commit is contained in:
shygoo 2018-12-09 18:44:30 -06:00
parent 90c94f5109
commit d3aadf75cc
3 changed files with 21 additions and 21 deletions

View File

@ -91,15 +91,15 @@ function AddressRange(start, end)
Object.freeze(this) Object.freeze(this)
} }
const ADDR_ANY = new AddressRange(0x00000000, 0x100000000) const ADDR_ANY = new AddressRange(0x00000000, 0xFFFFFFFF)
const ADDR_ANY_KUSEG = new AddressRange(0x00000000, 0x80000000) const ADDR_ANY_KUSEG = new AddressRange(0x00000000, 0x7FFFFFFF)
const ADDR_ANY_KSEG0 = new AddressRange(0x80000000, 0xA0000000) const ADDR_ANY_KSEG0 = new AddressRange(0x80000000, 0x9FFFFFFF)
const ADDR_ANY_KSEG1 = new AddressRange(0xA0000000, 0xC0000000) const ADDR_ANY_KSEG1 = new AddressRange(0xA0000000, 0xBFFFFFFF)
const ADDR_ANY_KSEG2 = new AddressRange(0xC0000000, 0x100000000) const ADDR_ANY_KSEG2 = new AddressRange(0xC0000000, 0xFFFFFFFF)
const ADDR_ANY_RDRAM = new AddressRange(0x80000000, 0x80800000) const ADDR_ANY_RDRAM = new AddressRange(0x80000000, 0x807FFFFF)
const ADDR_ANY_RDRAM_UNC = new AddressRange(0xA0000000, 0xA0800000) const ADDR_ANY_RDRAM_UNC = new AddressRange(0xA0000000, 0xA07FFFFF)
const ADDR_ANY_CART_ROM = new AddressRange(0x90000000, 0x96000000) const ADDR_ANY_CART_ROM = new AddressRange(0x90000000, 0x95FFFFFF)
const ADDR_ANY_CART_ROM_UNC = new AddressRange(0xB0000000, 0xB6000000) const ADDR_ANY_CART_ROM_UNC = new AddressRange(0xB0000000, 0xB5FFFFFF)
const asm = { const asm = {
gprname: function(num) gprname: function(num)

View File

@ -51,7 +51,7 @@ void CScriptHook::InvokeByAddressInRange(uint32_t address)
int nCallbacks = m_Callbacks.size(); int nCallbacks = m_Callbacks.size();
for (int i = 0; i < nCallbacks; i++) 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); m_Callbacks[i].scriptInstance->Invoke(m_Callbacks[i].heapptr, address);
return; return;
@ -64,7 +64,7 @@ void CScriptHook::InvokeByAddressInRange_MaskedOpcode(uint32_t pc, uint32_t opco
int nCallbacks = m_Callbacks.size(); int nCallbacks = m_Callbacks.size();
for (int i = 0; i < nCallbacks; i++) 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)) 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 registers = m_Callbacks[i].param3;
uint32_t value = m_Callbacks[i].param4; uint32_t value = m_Callbacks[i].param4;
if (!(pc == startAddress || (pc >= startAddress && pc < endAddress))) if (!(pc == startAddress || (pc >= startAddress && pc <= endAddress)))
{ {
continue; continue;
} }

View File

@ -855,18 +855,18 @@ server.on('connection', function(socket)
Creates an immutable object with <span class="snip">start</span> and <span class="snip">end</span> address properties.<br> Creates an immutable object with <span class="snip">start</span> and <span class="snip">end</span> address properties.<br>
The following <b>AddressRange</b> objects are defined globally: The following <b>AddressRange</b> objects are defined globally:
<pre> <pre>
<b>ADDR_ANY</b> 0x00000000 : 0x100000000 Any 32-bit address <b>ADDR_ANY</b> 0x00000000 : 0xFFFFFFFF Any 32-bit address
<b>ADDR_ANY_KUSEG</b> 0x00000000 : 0x80000000 MIPS user mode TLB mapped segment <b>ADDR_ANY_KUSEG</b> 0x00000000 : 0x7FFFFFFF MIPS user mode TLB mapped segment
<b>ADDR_ANY_KSEG0</b> 0x80000000 : 0xA0000000 MIPS cached unmapped segment <b>ADDR_ANY_KSEG0</b> 0x80000000 : 0x9FFFFFFF MIPS cached unmapped segment
<b>ADDR_ANY_KSEG1</b> 0xA0000000 : 0xC0000000 MIPS uncached unmapped segment <b>ADDR_ANY_KSEG1</b> 0xA0000000 : 0xBFFFFFFF MIPS uncached unmapped segment
<b>ADDR_ANY_KSEG2</b> 0xC0000000 : 0x100000000 MIPS kernel mode TLB mapped segment <b>ADDR_ANY_KSEG2</b> 0xC0000000 : 0xFFFFFFFF MIPS kernel mode TLB mapped segment
<b>ADDR_ANY_RDRAM</b> 0x80000000 : 0x80800000 Cached RDRAM <b>ADDR_ANY_RDRAM</b> 0x80000000 : 0x807FFFFF Cached RDRAM
<b>ADDR_ANY_RDRAM_UNC</b> 0xA0000000 : 0xA0800000 Uncached RDRAM <b>ADDR_ANY_RDRAM_UNC</b> 0xA0000000 : 0xA07FFFFF Uncached RDRAM
<b>ADDR_ANY_CART_ROM</b> 0x90000000 : 0x96000000 Cached cartridge ROM <b>ADDR_ANY_CART_ROM</b> 0x90000000 : 0x95FFFFFF Cached cartridge ROM
<b>ADDR_ANY_CART_ROM_UNC</b> 0xB0000000 : 0xB6000000 Uncached cartridge ROM <b>ADDR_ANY_CART_ROM_UNC</b> 0xB0000000 : 0xB5FFFFFF Uncached cartridge ROM
</pre> </pre>
</div> </div>
</div> </div>