Bit-Slicer icon indicating copy to clipboard operation
Bit-Slicer copied to clipboard

Addresses not corresponding to addresses in ROM

Open btelwy opened this issue 1 year ago • 1 comments

I'm not sure whether this is an issue with the program or an inevitable limitation, but when I use the memory viewer with OpenEmu (I'm not able to use or test it with any other emulators at the moment for a variety of reasons) the addresses that are picked up are significantly larger than are possible with the ROM. For example, the SNES ROM I'm trying to analyze for romhacking purposes has addresses from 0x00 to 0xFFFFF, but I keep picking up addresses in the range of 0x7FAF58175106, when I know from viewing the ROM in a hex editor that this address is actually 0x4D106. Without knowing the address of a value in the ROM, and without being able to find it by searching up the bytes in the hex editor probably since the values in-game keep fluctuating, I have no way of finding the value in the hex editor, and so I'm not able to make use of the information I find when searching and debugging.

Initially, I thought this problem was related to #34, and I thought it could be solved by setting the base address to wherever the ROM starts in the RAM, or by subtracting a constant from the addresses that are found in the search window to get them to match the addresses in the ROM. But while it does work to subtract an amount to get the corresponding address, that amount varies, and I can only figure it out when I already know the correct address in the hex editor. For example, I found one string at 0x7FAF58175106 in the search window and at 0x4D106 in the ROM, so I thought I could subtract all the addresses by 0x7FAF58128000, but then I found a string at 0x7FE67A943613 in the search window and at 0x1B613 in the ROM, which has a difference of 0x7FE67A928000. I tested this with a GBA game as well and had the same issue of addresses being too large for the ROM.

I understand the problem probably comes from using a debugger separate from the emulator instead of an emulator with a debugger, so the addresses not matching may be unavoidable, but this is what I have access to, and it's been working really well. Is there any way to solve or get around this problem? Thanks for your help, and sorry if I made any mistakes.

btelwy avatar Jul 03 '23 06:07 btelwy

The addresses "being large" is not surprising. The emulator needs to dynamically allocate memory to store things for the ROM you want to play.

For the address mapping not being as straight forward as you'd hope (just add/subtract each address with a constant), this probably has to do with understanding how the emulator maps out and partitions the data. (This may not be OpenEmu, but could be whatever underlying engine/core it is using). It may be worth seeing if data that is normally related and close together still appears as close together with your emulator.

zorgiepoo avatar Jul 04 '23 19:07 zorgiepoo