News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Snes9x base address  (Read 734 times)

lesyriad

  • Newbie
  • *
  • Posts: 1
    • View Profile
Snes9x base address
« on: May 02, 2018, 03:51:56 am »
So Im working on a project and Im hoping for some help to make my job easier.  When Snes9x load a rom it allocates ram to load it into so each time it loads the rom get loaded into a different memory address.  Im trying to watch the ram of Snes9x but each reload means I have to start over to find the address Im trying to watch.   Short of going to snes9x source code and finding the loading code and finding the pointer that points to the base address of the rom does anybody know it off the top of their head?  Or even what module in the source code will handle the allocating so I can debug break it?  Thanks

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6615
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Snes9x base address
« Reply #1 on: May 02, 2018, 11:59:37 am »
If you're trying to cheat, why not use built-in cheat features? Then you won't have to worry about where SNES9x loads the ROM.
"My watch says 30 chickens" Google, 2018

zhade

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • zhaDe's stuff
Re: Snes9x base address
« Reply #2 on: May 07, 2018, 05:48:51 pm »
I ran into the exact same problem, took me quite a while to figure it out, but its really simple:

Even if the emu allocates different RAM region each time, it uses the same pointer to refer to it, which is at a static address
To find it, first find the ROM region then search in the RAM for the address of the the start of the ROM region (but byte reversed, like for "123456" you would search for "563412".

If you are using Geiger's Snes9X debugger:

[006C052C] {x 4} pointer to RAM
[006C0530] {x 4} pointer to ROM
[006C0534] {x 4} pointer to SRAM
[006C0538] {x 4} pointer to VRAM

I have kept a doc with some more RAM addresses if you want more.. dont know if it defers with other versions of snes9x or not

Marcelo_20XX

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Snes9x base address
« Reply #3 on: June 14, 2018, 09:53:37 pm »
Do you know by chance the base address for the libretro port of SNES9X2010? I don't need the built in cheat system because I want to blank large areas of the VRAM for getting rid HUDs in some games, so knowing the base address could potentially make my life easier when creating trainers for that matter thanks in advance...

zhade

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • zhaDe's stuff
Re: Snes9x base address
« Reply #4 on: June 23, 2018, 10:57:30 am »
Im not sure I understand what you mean about the base address.. you mean fixed pointers like the ones I posted for geiger's snes9x ?

Im sorry I don't. But It probably can be found easily by loading a ROM and then searching in the program's RAM for the first few ROM bytes.
Using cheat engine for example, Search for the first like 6 Bytes of the ROM, once you locate it, Search the RAM again for the memory address where it starts and you'll have the ROM pointer, which should be static.
Logically, Other important pointers like VRAM, RAM etc.. should be close-by.

Just remember to to flip the bytes order when searching for the pointer like I said.
If you find the ROM Bytes at address 0x10804020, you'll want to search for 0x20408010

Also, snes9x has many open-source ports, if the source code is available for this one, it might help to figure out the other pointers close to the ROM pointer