lab313ru / ghidra_psx_ldr

Sony Playstation PSX executables loader for GHIDRA
231 stars 31 forks source link

Incorrect $gp value #57

Closed Kneesnap closed 2 years ago

Kneesnap commented 2 years ago

I'm a little surprised I didn't notice this sooner, but ghidra_psx_loader does not detect the correct $gp value.

I suspect the issue is in this code, but it could get in the other $gp detection too. https://github.com/lab313ru/ghidra_psx_ldr/blob/410b1a4f73edc5d31d37e7c28f5b165181f4c22b/src/main/java/psyq/PsyqLoader.java#L639-L662

For a prototype build of a game I'm working on, $gp is getting set to 0x800C9780, but the correct value is 0x800B9780. $800C9780 is in the middle of the .bss section, while $800B9780 is the start of the '.sdata' function. Using a debugger, it seems like every function I've tested is using 0x800B9780 and not 0x800B9780.

Game: Frogger (SLUS0506) PROTOTYPE (Build 50b) PsyQ Ver: 4.0

lab313ru commented 2 years ago

Thanks.