+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  PSX experts: Any idea why my translation fails to load on hardware?
Pages: [1]
Author Topic: PSX experts: Any idea why my translation fails to load on hardware?  (Read 1 times)
Kil
Guest
« on: July 13, 2011, 10:03:07 am »

Hi I've mostly finished my English translation for Langrisser 4 PSX. People who tried to play it on a PSX/PSP reported that the game would sit at the loading screen at certain points so it's unplayable on real hardware at the moment. I've thought hard about what the problem could be, but the fact that it absolutely doesn't occur during emulation means I can't dig around in pSX debugger to find out what's wrong.

One weird thing about this all is that it works fine when loading the first few scenario scripts. At the end of the scenario 2 battle when it tries to load the epilogue, it fails to load.

Now there's essentially nothing strange about that particular data, yet it always fails to load. All the scripts are inside a 25MB file called SCEN.DAT on the CD. The scripts in SCEN.DAT are accessed by a simple virtual file system in this file. The VFS is just 4 byte little endian pointers to the start of each script's data. The game code reads the pointer of the script it wants and the pointer after it, and using these two values, seems to calculate the size/location of the data it wants and then fetches it from the CD (this part is fuzzy for me because I don't really know about the intricacies of how the PSX CD system works or CDROMs in general.) I took all of this into account when I made my text extraction/insertion tool so it automatically rewrites these pointers based on how big the new text is (The size of the dat file remains the same though - I erased stuff from an unused scenario for space).

Regardless of all that, I think the key to figuring this mystery out is the fact that the entire translation works fine on emulators, and only fails at certain points on real hardware. Whatever the problem is, it must be so miniscule and specialized that emulators aren't accurate enough to freeze over it. I assume some aspects of the PSX CD system have been abstracted in these emulators and just aren't emulated accurately, so there's no way to figure out the problem inside of an emulator debugger.

Some more info:
All of the files on the translated CD are the same size as the original, I've carefully seen to that
Made sure to pad the end of all data in rebuilt files to multiples of 0x800 as they should be
Poured over the output of all my rebuilt files in a hex editor numerous times - the troublesome data looks normal
I use CDMAGE to rebuild the CD/insert translated files
There are ASM hacks in the new executable but they don't seem to be the problem
The SYSTEM.BIN file (has a similar VFS in it) was also translated, but that loads fine

Any ideas?
Gemini
Guest
« Reply #1 on: July 13, 2011, 10:54:23 am »

If it just hangs and kills the console, I say it's a memory alignment issue.
Kil
Guest
« Reply #2 on: July 13, 2011, 12:15:33 pm »

There is some data after the text which is pushed and repointed... the PSX can't load anything with the lw opcode unless it's word aligned right? Yes, some of those are probably misaligned.

God damn it, this had me stumped for over a month.

I'm a bit surprised emulators allow misaligned memory reads, but I guess it is much faster than checking each memory read, and no real games are going to be reading any misaligned memory anyway.
« Last Edit: July 13, 2011, 12:26:04 pm by Kil »
Gemini
Guest
« Reply #3 on: July 13, 2011, 06:14:49 pm »

The PlayStation emulator on the PSP actually crashes whenever a misaligned read/write takes place. It's a very good way to test stuff before even burning yet another CD.
Kil
Guest
« Reply #4 on: July 13, 2011, 08:12:49 pm »

Well you were right apparently as my tester says everything's working now. The data after the text was sometimes being aligned to halfwords so any script had a 50% chance of crashing. Thanks.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC