beardypig / ghidra-emotionengine

Ghidra Processor for the Play Station 2's Emotion Engine MIPS based CPU
Apache License 2.0
200 stars 34 forks source link

Recover global GP register writes non functioning in Ghidra 10 #78

Open weirdbeardgame opened 2 years ago

weirdbeardgame commented 2 years ago

Game: Fatal Frame 2. More specifically the European demo with the debug functionality

OS: Arch Linux

Ghidra: 10.1.4

Issue: In Ghidra 9 any function that uses GP register for anything reads writes etc all variables and values related will resolve name-wise and appear correct. In Ghidra 10 this will not occur and all globals will appear as random addresses unless the initial value on the GP register is manually set using set register GP(64)

What it's currently showing: Current

What it should be showing: Should

astrelsky commented 2 years ago

Try opening the python interpreter in the Window toolbar and enter the following

createLabel(toAddr("0x3f57f0"), "_mips_gp_value", True)

After the label is created the problem should go away once you re-run the constant reference analyzer. There is definitely a bug somewhere though since it was set fine in the past.

weirdbeardgame commented 2 years ago

@astrelsky That definitely made it work at least so. Thanks

astrelsky commented 2 years ago

@astrelsky That definitely made it work at least so. Thanks

Well that's a good sign. May you check the Ghidra application.log for any errors coming from the constant analyzer before you added the label? It will help narrow down the root problem.

weirdbeardgame commented 2 years ago

Yeah totally, where would I find that on arch?

astrelsky commented 2 years ago

Yeah totally, where would I find that on arch?

It should be in ~/.ghidra/ghidra_version_folder/application.log I don't have the actual paths on hand but you should be able to locate it with that.