User:闇甦兄/mips32

=PSX standards= Unlike say SNES games which were all built from the ground up in 65816 assembler, there are some standards you can assume when working with PSX discs.

The executable file
The most important file on the CD is the easiest to spot. It will always have a name like SLUS_32.19 or something like that. This is an enforced sony naming convention. This file is the executable file that contains all of the code for the game. All of it. Altogether this code basically defines the "rules of the game" and how it is to be run. Structurally it's going to be the same as any executable file, such as solitaire.exe, except it's been compiled into MIPS32 machine code instead of whatever is on your windows machine.

Contents of the executable
Obviously the executable is going to contain the code needed to run the game, but it also contains data known as resources.

These are probably the things you're looking for. Things that are blobs of "data" but aren't big enough to be in other files, or are always needed so having them in other files that aren't always loaded into RAM wouldn't make sense. Things like stat tables, item tables, small often used images, bits of text for menus or other things that always need to be available. Sometimes these may be in a file named system.bin though.

An important thing to note is that this executable file will always be in RAM. Wherever it's loaded to, it should remain there forever. Likewise, the resources it contains won't change or move. You can count on anything you find in the executable file being there foreever.

=== Out of three games I have worked with, two used the standard sony playstation development libraries, while one didn't. Square seems to have their own PSX library for developing games, so FFT didn't follow the standard. Langrisser 4 and Digimon World both used the standard library, so structurally they shared some things in common.

For instance, x0000 up to xFFFF in PSX main ram is part of the playstation kernel, and houses stuff like the interrupt routine and other "standard" features, but only if the developers decided to use the sony libraries. This space in FFT was used by all sort of stuff

C/psxlib
PSX games were virtually all written in C. To have a good understanding of playstation game data, having knowledge of C is helpful. I mean really pseudo arcane knowledge of C though. Like what an array really is at the lowest level.

Machine level array
An array is the address of its first element. Basically an array is identical to a pointer at the machine level - it's just the address of the 0th element of the array it references. So when you write something like this in C

myArray[0] references the value held in the 0th element of the array, but what is "myArray" by itself when it's not dereferenced? It's identical to a pointer - it just holds the address of the 0th element of the array. This means somewhere in psx RAM there's usually going to be a 4 byte pointer/array pointing at this array of data, and that's something you're going to run into or be looking for often.

psxlib Compiled C
Solid C knowledge will make it worlds easier when you are rummaging through data.