Interface: Added a function to get/set the ARM9 next instruction (#517)

* Interface: Added a function to set the ARM9 next instruction

* Comment about potential JIT issues

* Interface: Made setting next instructions no-op with JIT
This commit is contained in:
Marco Köpcke 2022-04-01 00:06:37 +02:00 committed by GitHub
parent 1cec82613b
commit b86a7748b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -481,6 +481,18 @@ EXPORTED void desmume_memory_write_register(char* register_name, u32 value)
}
}
EXPORTED u32 desmume_memory_get_next_instruction()
{
return CommonSettings.use_jit ? 0 : NDS_ARM9.next_instruction;
}
EXPORTED void desmume_memory_set_next_instruction(u32 value)
{
if (!CommonSettings.use_jit) {
NDS_ARM9.next_instruction = value;
}
}
INLINE void memory_register_hook(int addr, MemHookType hook_type, int size, memory_cb_fnc cb)
{
for(unsigned int i = addr; i != addr+size; i++)

View File

@ -129,6 +129,12 @@ EXPORTED void desmume_memory_write_long(int address, unsigned long value);
EXPORTED u32 desmume_memory_read_register(char* register_name);
EXPORTED void desmume_memory_write_register(char* register_name, u32 value);
// Get the next instruction address that the ARM9 processor will execute.
// NOTE: This will NOT work with JIT enabled. NULL will be returned.
EXPORTED u32 desmume_memory_get_next_instruction();
// Get the next instruction address that the ARM9 processor will execute. Should be combined with setting the PC register (r15).
// NOTE: This is a no-op with JIT enabled.
EXPORTED void desmume_memory_set_next_instruction(u32 value);
EXPORTED void desmume_memory_register_write(int address, int size, memory_cb_fnc cb);
EXPORTED void desmume_memory_register_read(int address, int size, memory_cb_fnc cb);