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

Author Topic: Creating a kanji table and extracting text from Live-A-Live (SNES)  (Read 560 times)

Malio

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hey, this is my first time trying to do any kind of rom hack.  I'm trying to extract the text from Live-A-Live so that I can translate it as practice.  The table file seems to not be any of the standard ones, so I've slowly been working through the intro's to the 7 chapters in WindHex and I've build this partial table:
https://pastebin.com/xjnsNRmp

From this, I've successfully extracted the intros (2A29F-2A695), which I have posted below.
https://pastebin.com/rn4ehQEW

The way I've done this is that I looked up a section by relative search and then from there I've slowly filled in the character table by hand by comparing the game to the hexcodes in WindHex.  This has been a slow process, and I was wondering if there was a faster way that I could build the kanji table to extract the text before attempting a larger section.  I tried using a tile viewer such as tilemolester or yy-chr, but I couldn't find anything definitive..  Around 00148C00, it looks like there is maybe some text, but I'm rather unsure.

FAST6191

  • Hero Member
  • *****
  • Posts: 2574
    • View Profile
Re: Creating a kanji table and extracting text from Live-A-Live (SNES)
« Reply #1 on: August 15, 2019, 07:48:19 pm »
Faster ways to generate a table than comparing to the text or using relative search for Japanese? Plenty, indeed most are.

If you have some text already then why not change it? Know what one bit of text says. Leave the start and end of the stuff you know and change the middle to the start of your list of things to check. Rinse and repeat for the rest of the list of possibilities/things you want to know. This might also be the only way you learn some characters, or some types of punctuation if they are in the game but not used by the final script. You can improve this further by doing runs and patterns rather than limiting yourself to a known section and figuring out what you changed.

If you are lucky you might even be able to change something in RAM and have it be reflected on screen.
I also like name entry/high score entry here -- they are not always the same but sometimes they are and that means you can literally choose characters in real time and see what they correspond to. Most SNES era games won't do Japanese characters for such things (or will be limited to Kana if they do) but you might be lucky.

The tile stuff varies a bit by system but if it is going to be one of those games where things get loaded in at will then the order of the characters in the pictorial representation usually corresponds to the order in the encoding/table. For Japanese then you are more likely to get a few gaps where certain values are just not used but still worth looking into.

Probably not for the SNES but on filesystem based systems you can get text encodings noted in the font file. The DS NTFR font format being a good example of this.

After this you probably start to head into either probability based setups, mathematical analysis and linguistic analysis. For Japanese then does it match the order of certain existing encodings, does it match the order of a given printing of a dictionary, does it match the order of the various levels of kanji tests for that/some year... - programmers are lazy by design and are not likely to hand encode a decent selection of kanji.

After this then time for assembly type analysis. If you know where some text is located in the game then you can follow its journey from the ROM into a character on screen. That will necessarily take you through how it decodes it and thus give you the keys to the kingdom. I seldom see hackers go in for this method for text (if I am figuring out custom compression, how a damage calculation or greater part of a battle engine works, or how any number of other things work or are handled by the game then I will go for some fun here with the disassembler/debugger but for text I do usually find the other methods get it done soon enough).


I have a few others detailed in http://www.romhacking.net/forum/index.php?topic=14708 but the ones above are the main methods I would use.

Malio

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Creating a kanji table and extracting text from Live-A-Live (SNES)
« Reply #2 on: August 16, 2019, 12:16:41 pm »
Thanks for the advise, FAST.  I've started using your method of changing characters in the middle of a section and experimenting with unknown charcters and it seems to be working really well.  Modifying the ram is a bit beyond me, so I think this will be my best bet for the moment. 

Through this I've discovered that the kanji are stored in order of their reading, with 愛悪安暗案闇 being the first 6, all starting with あ, which seems similar to sjis, though this kanji table is truncated down to 768 values. That should speed things up quite a lot.

FAST6191

  • Hero Member
  • *****
  • Posts: 2574
    • View Profile
Re: Creating a kanji table and extracting text from Live-A-Live (SNES)
« Reply #3 on: August 16, 2019, 02:25:38 pm »
RAM wise then it will vary with emulators (I would be surprised if SNES debuggers lacked this but I have been surprised at times) but some have editors in their RAM viewers, some might want an external program (see something like emuhaste). In a pinch you can also use a cheat function as those tend to work on RAM or at least have options for it.

That said if using the game as an oracle works for you then carry on. Worst that usually happens there is it crashes, in which case restore backup and carry on.
RAM based stuff can also be tricky if the time between sticking it in RAM and rendering the text is too short and can't be forced to rerender by a menu or something. That said where you are here presumably tapping in numbers with a hex editor, reopening the ROM and either loading a suitable savestate (careful with that, or at least do it before the text gets rendered) then the RAM stuff will probably look like the hex editor part but miss the 30 odd seconds it probably takes to reopen it.


Malio

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Creating a kanji table and extracting text from Live-A-Live (SNES)
« Reply #5 on: August 20, 2019, 05:39:20 pm »
That's precisely what I was working on!  This will save me hours of worth.  Thanks a lot.