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

Author Topic: Changing encoding in Phantasy Star Generations 2 (PS2)  (Read 3463 times)

tryphon

  • Hero Member
  • *****
  • Posts: 722
    • View Profile
Changing encoding in Phantasy Star Generations 2 (PS2)
« on: October 07, 2012, 08:01:20 am »
Hi everybody,

I spent some time recently on helping someone to translate PSG2 into english. I've made a tool to extract and reinsert text (you can test it at pscave board), I've figured out how to change characters' size (easy) and how to make them right aligned in menus (much harder).

I precise I'm not a skilled romhacker (it's the first time I dive into a game code) and I had to learn some stuff (noticeably MIPS assembler language) but I have some knowledge on coding.

What I'd like to do is to change the encoding of text.

They are encoded in a subset of SHIFT-JIS, with 2 bytes per character, and I'd like to have them in a 1 byte encoding (ASCII, or a custom one).

I know where the encoding table is stored : in the ELF file (named SLPM_625.53), it begins at 0x152b08. Once in memory, it must be located at 0x251b08.

The problem is that in the disassembled code (I use ps2dis), there is no pointer to this address. There are some pointers to addresses a little before of a little after the table, but all the pieces of code I have checked use these areas for storing registers values, and don't read anything in the table area.

I have tried to check portion of codes where there seems to be a loop where a register is incremented by 2, but as you may imagine, there are some thousands of possible portions.

Do you have an idea of a strategy to find the portion of code I should study to change the encoding ?

If you don't, do you know documents, tools (especially, is it possible to use ome debug mode of PCSX2 ?), websites that could help me for that purpose ?

Thanks in advance.

EDIT : I think I've localized the area. Now trying to figure out how to change it without breaking everything...
« Last Edit: October 07, 2012, 06:47:31 pm by tryphon »

LostTemplar

  • Hero Member
  • *****
  • Posts: 906
    • View Profile
    • au-ro-ra.net
Re: Changing encoding in Phantasy Star Generations 2 (PS2)
« Reply #1 on: October 08, 2012, 03:58:12 am »
If you don't, do you know documents, tools (especially, is it possible to use ome debug mode of PCSX2 ?), websites that could help me for that purpose ?

As far as I'm aware the debugger of PCSX2 is non-functional at the moment, and wasn't very practical anyway. I always wonder how the developers (of any emulator) are able to debug their emulator efficiently without having a good built-in debugger, but alas.

tryphon

  • Hero Member
  • *****
  • Posts: 722
    • View Profile
Re: Changing encoding in Phantasy Star Generations 2 (PS2)
« Reply #2 on: October 08, 2012, 07:59:36 am »
I downloaded a modified old version here (0.9.2 I think) with debugger, but didn't manage to make it work : as soon as I want to go back to the game (after defining breakpoints) it crashes. I'm less in a need for it since I (think I) have found the routines I was looking after, but if someone know a good tuto on how to hack PS2 games with PCSX2 debuger, I'd be grateful :) 

Hiei-

  • Sr. Member
  • ****
  • Posts: 373
    • View Profile
Re: Changing encoding in Phantasy Star Generations 2 (PS2)
« Reply #3 on: October 12, 2012, 12:46:55 pm »
Great work  :thumbsup:

Fei Wong

  • Jr. Member
  • **
  • Posts: 25
    • View Profile
Re: Changing encoding in Phantasy Star Generations 2 (PS2)
« Reply #4 on: October 13, 2012, 02:36:18 pm »
FINALLY! someone's working on a Gnerations game!! i would love to see the two of them in english someday...so keep up the good work and good luck!  :beer:

tryphon

  • Hero Member
  • *****
  • Posts: 722
    • View Profile
Re: Changing encoding in Phantasy Star Generations 2 (PS2)
« Reply #5 on: October 13, 2012, 05:35:12 pm »
An english version of Generations 1 exists already (by Kyence). You can find about it at pscave.com (forum seems down for now).

As for PSG2, Kyence has started tanslating it, and I offered my help for technical stuff.

CUE had already wrote a decompression and compression tool.

Up to now :
- I dumped the scripts
- I can change the font, and the size of chars (monospaced) ; I modified the right-justifying text routine to work properly when changing font size
- I modified the string decryption routine so as to use 8 bits encoding

From now :
- I work on adding VWF support but it will break the right justifying thing, so I'm not sure I'll succeed.

Then it'll be translators' job (I hope we'll get some help) :)