hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.4k stars 2.19k forks source link

Struct viewer debugging tool #19629

Closed kotcrab closed 2 days ago

kotcrab commented 1 week ago

This PR adds struct viewer debugging tool. It visualizes objects data in game memory using data types and symbols fetched from your Ghidra project. It also allows to set memory breakpoints and edit field values which is helpful when reverse engineering unknown types.

This is how it looks in action:

image

The types are fetched over REST API that Ghidra exposes with my ghidra-rest-api extension. This allows for a very efficient workflow where you can edit some types in Ghidra and instantly refresh them in Struct viewer to see updated object memory layout.

How to try it

If you don't have a Ghidra project

I prepared mock API you can use for testing this without setting up Ghidra at all. You will just need Mockoon and the API json I prepared here. With that in Mockoon do File -> Open local environment, select json file then press the green button to start the mock server. The types and symbols are for Fate/Extra CCC, with that game booted you can open the Struct viewer and press the Connect button. Now you can start exploring the globals, for most interesting see g_logoTask and g_TitleTask (the first one will be populated when logos are visible and the second one after getting to the title screen).

If you have a Ghidra project

Then you just need to install my ghidra-rest-api extension, start API server in Ghidra. Open the Struct viewer and press the Connect button. Note that your Ghidra image should be at 0x8804000 for globals to align.

Linblow commented 3 days ago

Good idea, I like that

kotcrab commented 3 days ago

Good point, added now and few more comments. I also added more setup info to the initial UI: image

Let me know if there's anything more you would like changed.

hrydgard commented 2 days ago

Very nice, good idea to show it in the UI too!

Minor, we generally only use // for comments, even large blocks, but I'm not gonna block this on that, just letting you know for future changes.