bsnes-plus icon indicating copy to clipboard operation
bsnes-plus copied to clipboard

Search and save memory values for watching?

Open metasprite opened this issue 5 years ago • 2 comments

Cheat editor is almost a memory watch tool, but not, since it stores "codes" instead of showing memory values with notes. It's very useful for finding info about a game like how an object's position, velocity and state changes. Maybe the cheat editor code can be copied and repurposed to have a memory watch? I tried to do it but failed since I can't understand Qt and the codebase.

metasprite avatar Sep 02 '18 05:09 metasprite

This is, indeed, a feature I felt that was sorely missing. I am going to try to modify the memory watch window and see if I can add "watches" in there. Meanwhile, I'm just posting here to say that I second metasprite idea and I hope to see it officially implemented someday.

libTorrentUser avatar Oct 02 '22 17:10 libTorrentUser

As promissed, attached is a patch that can be applied to the bsnes-plus v05 release.

The patch adds a watch list right below the memory editor. This was my first time playing with Qt, so I'm hoping I didn't do anything too stupid. I tried to follow the existing code with regards to Qt objects ownership (i.e., I assume that the moment I attach something to a parent object, that parent object becomes the owner and will take care of deleting it when destroyed).

Ah, at first I was automatically saving and loading the watch list, using the debugger section in the Config object. But then I realized the user can open multiple watch windows at once, and saving and loading the watches automatically like that would mess things up. Because of that, I simply decided to implement a "Save to file" button and let the user save and load watches whenever he wants to.

The watch list is saved in a JSON-like format and , when loading a watch list from file, the code performs absolutely no checks at all and simply trusts the user has selected a valid file.

PS: any plans to upgrade the code to the latest bsnes release? The lack of some cool stuff present in c++17, like std::string_view gave me a bunch of headaches. The latest bsnes release also added the "local" option to the makefile, with enables the always sweet "-march=native" (and -mtune=native, with a little bit of sed-ing :)) watch.patch.zip

libTorrentUser avatar Oct 08 '22 18:10 libTorrentUser