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

Author Topic: Advice on finding pointers using PPSSPP  (Read 340 times)

kenaku

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Advice on finding pointers using PPSSPP
« on: June 22, 2020, 11:05:35 am »
Hello, i am just beginning at romhacking and decided to start with Tales of Rebirth (PsP), so far i have pointer tables for  things like items, equipment, skills and the like, but even though i know where the menu text is inside the ISO and where is loaded into memory and can't find any pointer to it. Can someone give me an advice at this?

FAST6191

  • Hero Member
  • *****
  • Posts: 2894
    • View Profile
Re: Advice on finding pointers using PPSSPP
« Reply #1 on: June 23, 2020, 01:37:47 pm »
Are there no sections of random (though probably getting larger and larger) numbers at the start or end of the text file? Or other files that maybe have a different extension to the text or are relatively speaking far smaller, or maybe one other file along with a bunch of text?

Being the PSP I could possibly expect to see it be some kind of scripted (basically pointer/length value at the start of each section) or parsed format (it has a little end of line value it uses to detect a new line/section). Fixed length could be an option but tends to be reserved for menus as even Japanese struggles with that for normal spoken text.
Outside chance that the text is in the ISO/ROM but the pointers are housed in the binary.

If we have to play debugger then that is an option. You would want to watch how it parses out the text and fetches it from memory for graphical stuff and then where it finds that in the ROM. That will find it but it is tedious
There are some tricks you can do with relative search if you get really bored and have the text files but don't want to play debugger (you get to figure out where the end of line/section things are and then search for that relative difference), however if it has come to that then I would just bust out the debugger and watch how the text section works.

[Unknown]

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
    • PPSSPP
Re: Advice on finding pointers using PPSSPP
« Reply #2 on: July 04, 2020, 11:25:21 pm »
Unlike older cartridge based systems, the PSP loads everything into RAM.  The disc is only accessed through function calls.

The primary binary (EBOOT.BIN) is loaded to RAM with its BSS etc., much like a program on PC.  Typically (basically always), this will start at 0x08004000.

Many PSP games use relocation, but I think Tales of Rebirth doesn't.  Because of that, global variables are probably hardcoded addresses.

But because memory is dynamically allocated (and can be consumed by plugins, or video player libraries, etc.), games very rarely hardcode memory addresses in files on the UMD.  Instead, you'll see offsets into memory from a base or offsets into the file data more common - honestly, a lot like PC.

For example, games may have a file with strings for a certain area, with a table in the beginning that points to each table (by file offset.)  Then, strings may be referred to in some other file by bytecode/scripting/whatever by their numeric offset into that table (i.e. string #5.)

More importantly, games often use "virtual filesystems".  It's a bit annoying.  In the case of ToR, I assume DAT.BIN and FLD.BIN are some form of this.  On startup, basically the first thing the game does is open these files, seem to 0x3FF400 in DAT.BIN, and read an image (maybe the boot logo?)

So offsets in the file are probably hardcoded in the binary somewhere.  Then offsets into those subfiles (to the actual strings you found) are probably next.

The UMD was slow and the PSP had a decent amount of RAM (considering, 24 MB user RAM isn't a lot but it's way more than the GBA or DS), so games would typically read whole chunks.  It's unlikely it reads each string one-by-one from the file or works in direct offsets to strings within the file.

-[Unknown]