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

Author Topic: How can I capture metrics from an emulated (SNES) game?  (Read 301 times)

Brandie18

  • Newbie
  • *
  • Posts: 1
    • View Profile
How can I capture metrics from an emulated (SNES) game?
« on: May 22, 2019, 12:24:59 am »
My goal is to emulate a game (e.g., Super Bombliss) using an Android emulator (e.g., Snes9x EX+) and to capture game metrics (e.g., score and level) as the game is played.

I assume I would need to modify the open-source emulator and/or to modify the ROM to do this, but I need some guidance on the best approach. Thanks!

Jorpho

  • Hero Member
  • *****
  • Posts: 4116
  • The cat screams with the voice of a man.
    • View Profile
Re: How can I capture metrics from an emulated (SNES) game?
« Reply #1 on: May 22, 2019, 09:27:55 am »
All you need to do is find the spot in the emulated console's RAM where those values are stored, and then you can do whatever you want with them.  (In theory, if there's a suitable Android debugging app, you could even look at the RAM used by the emulator itself, but Android probably has security features to make that difficult.)

Many emulators already contain a RAM search functionality for the purpose of designing cheats, so that's not a problem.
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

FAST6191

  • Hero Member
  • *****
  • Posts: 2554
    • View Profile
Re: How can I capture metrics from an emulated (SNES) game?
« Reply #2 on: May 22, 2019, 09:52:10 am »
On a PC I would probably first point you at the emulators for that system with Lua (the tool assisted speedrun set make extensive use of that one so they are usually where you would find them). After that then there are tools that will watch the memory of another program and do things. Emuhaste, artmoney and such things being ones aimed specifically at emulators, many hex editors, debuggers and whatnot will be able to reach out and touch another program's memory too -- might have to tell your antivirus to ignore them or run in admin mode of some form (this would be an example of a legitimate use for such functionality but 99% of the time on a normal user's system it is virus activity so security tends to want to notice and block it..

Debugging emulators might also have so called watchpoints. These will wait for changes to a given thing and note what various memory areas say at the time. Harder to do with timestamps unless the game has an internal timer you care to use for it but an option.

Debugging and lua emulators are a bit thin on the ground in android from what I have seen (we fairly regularly see requests for the latter, and... there is a reason few hackers do any real work on android at this point. This leaves having a debugger watch over the emulator and do what it needs to do. I can't say I have looked to see what memory models android emulators use.

Roundabout option, possibly even one with some more things. Have the emulator make a new savestate every so often. You could then take your collection of savestates, run a script on them to fish out the information for each savestate and plot the results of that. You have the added bonus of also having savestates of those points and after that so you can go replay or try to figure out what happened. Depending upon the system then this could take a bit of storage space to pull off.
I don't know if android has an equivalent to something like autohotkey that will allow you to press a button every so often (so press make savestate) and you will also have to figure out a way to make new save states every time (most things I see might give you a few slots rather than making a new one with a new timestamp), if the emulator source code is not available then I would probably do something like set up a file server (good old FTP or something) and have my PC reach in and grab the savestate every time it is made before handling renaming/storage duties its end.