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

Author Topic: Dragon Quest IV (PSX)  (Read 7525 times)

markus-projects

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #20 on: September 15, 2020, 02:34:41 pm »
Thanks to everybody wishing us good luck :)

The truth is that I recently played for the first time DQ I.II on SNES (a translated version from evilteam brasil). DQ3 on SNES comes next for me (translated by DQ Translations). When I searched for a translated version of DQ4 PSX and I found nothing I thought, well how hard can it be... ^^

That is why I would also like to focus on the DQ4, as Chicken Knife said.
@erinnk @LadyCannock I updated the code and my blog post what I found out. You can look into it and also contact me.

There are good and bad news:

The good news are that I understood the LZS scheme and it seems that every compressed block can be decompressed. That said, I could successfully extract the TIM images, for example. I also looked into the various subblock types and made some notes what they could contain.

The bad news are that there seems to be no dialog text encoded in the usual japanese encodings (JIS, etc). I guess that they use a self-made font image to render the dialogs and that they maybe use their own coding scheme to address the letters. I guess someone has to look into the executable to debug what really happens. I am not familiar with the opcodes of PSX and did not found a clue. Maybe someone can help me and tell me, how dialog text is loaded, from where it is loaded and how it is encoded. In particular, I would like to know where the first dialog word %u3069%u3046%u3057%u305F is hidden in the data  ;)

« Last Edit: September 16, 2020, 03:35:54 am by markus-projects »

erinnk

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #21 on: September 16, 2020, 11:16:45 am »
Markus, can you share your extraction code?

September 16, 2020, 11:25:30 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Without having looked closer, I'm thinking perhaps the text is simply encoded as indices into the font you found. That would make sense. The way to locate the intro dialogue, especially where there's substantial repetition, is to find repeated bytes, I think... especially lines like this: "勇者さま 勇者さま……"  There's going to be four bytes (or double bytes) followed by something different, followed by those same four bytes.
« Last Edit: September 16, 2020, 11:25:30 am by erinnk »

markus-projects

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #22 on: September 16, 2020, 11:52:33 am »
Markus, can you share your extraction code?

Without having looked closer, I'm thinking perhaps the text is simply encoded as indices into the font you found. That would make sense. The way to locate the intro dialogue, especially where there's substantial repetition, is to find repeated bytes, I think... especially lines like this: "勇者さま 勇者さま……"  There's going to be four bytes (or double bytes) followed by something different, followed by those same four bytes.

Everything of the code is at https://github.com/mschroeder-github/dragon-hackst-4.
I also thought about this possibility. I could try to find these patterns.

markus-projects

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #23 on: November 22, 2020, 07:51:01 am »
Hi,

it's been some time now since I worked on the hacking because of actual work.
After I finished DQ III in my leisure time, I thought for a moment why not playing the DS or Mobile version of DQ IV.
However, I came this far and I want to continue this hacking journey.

I have some important updates in my blog post.
The new sections are:
  • Use Dragon Quest VII to find the text
  • Text-Blocks
  • The text decoding routine
  • Translated Text from Dragon Quest IV Mobile Version
You can read the details here http://markus-projects.net/dragon-hackst-iv/.
TL;DR: I used DQ VII (en + jp version) to identify the block that contain the text; analysed and parsed the text blocks in IV; debugged the text routine in the PSX-EXE of DQ IV and as a sideline found the dialogs (en+jp) in UTF-8 text files in the Mobile version of IV.

Next steps and help or advice needed

The text is compressed (no wonder we didn't find the dialog text in Shift-JIS) and it needs to be uncompressed, then translated and again be compressed. I looked into the assembler code to understand what has to be done, but didn't understand it completely. Does this 0x80 pointer mechanism (dataED part) look familiar to someone? Is it some kind of LZ variant or another encoding (see e.g. https://en.wikibooks.org/wiki/Data_Compression/Dictionary_compression#dictionary_algorithms). I guess it should output DAMI- (engl. Dummy) for this example.


Any help on this is appreciated.
 

Guadozoku

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #24 on: November 22, 2020, 01:02:56 pm »
Gotta disagree with using the mobile version text. They translation with its phonetic accents is annoying to read. Either translate from scratch or use the NES version as a base and translate the party chat.

CoolCatBomberMan

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #25 on: November 22, 2020, 03:17:54 pm »
Gotta disagree with using the mobile version text. They translation with its phonetic accents is annoying to read. Either translate from scratch or use the NES version as a base and translate the party chat.

Or, y'know, rewrite the mobile text to remove the accents. e.g. wee bairns > children

Choppasmith

  • Full Member
  • ***
  • Posts: 195
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #26 on: November 22, 2020, 09:13:20 pm »
Hi,

it's been some time now since I worked on the hacking because of actual work.
After I finished DQ III in my leisure time, I thought for a moment why not playing the DS or Mobile version of DQ IV.
However, I came this far and I want to continue this hacking journey.

I have some important updates in my blog post.
The new sections are:
  • Use Dragon Quest VII to find the text
  • Text-Blocks
  • The text decoding routine
  • Translated Text from Dragon Quest IV Mobile Version
You can read the details here http://markus-projects.net/dragon-hackst-iv/.
TL;DR: I used DQ VII (en + jp version) to identify the block that contain the text; analysed and parsed the text blocks in IV; debugged the text routine in the PSX-EXE of DQ IV and as a sideline found the dialogs (en+jp) in UTF-8 text files in the Mobile version of IV.

Next steps and help or advice needed

The text is compressed (no wonder we didn't find the dialog text in Shift-JIS) and it needs to be uncompressed, then translated and again be compressed. I looked into the assembler code to understand what has to be done, but didn't understand it completely. Does this 0x80 pointer mechanism (dataED part) look familiar to someone? Is it some kind of LZ variant or another encoding (see e.g. https://en.wikibooks.org/wiki/Data_Compression/Dictionary_compression#dictionary_algorithms). I guess it should output DAMI- (engl. Dummy) for this example.


Any help on this is appreciated.

Just a thought, but maybe someone on ZenHAX, a community that deals with compression in files could help? They're pretty open to taking requests.
https://zenhax.com/index.php

Or, y'know, rewrite the mobile text to remove the accents. e.g. wee bairns > children
Yeah those early DQ DS releases were a bit obnoxious and Shloc found a nice balance in later releases. That's definitely the plan for me if/when I get to DW4/DQ4.
« Last Edit: November 22, 2020, 09:27:32 pm by Choppasmith »

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 465
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #27 on: November 25, 2020, 08:15:09 am »
Honestly, the accents in DQIV's contemporary script are so entirely pervasive that I think someone would have to rewrite over half of the text to actually lose the accents. And then, have fun getting the tone / style of the writing to match. Keeping accents but tweaking the most extreme elements would be the better route if you really wanted to go that way.

If my team were to be involved, we'd use the NES script as something of a base because it reads well and is very accurate. Then we'd uncensor and do fresh additions of the added remake lines present for PSX. Knowing that the conventions for spell / monster / item names we came up with for our previous work can't/won't make everyone happy, we could create two versions, one with our Delocalized namings and the other with contemporary namings.

If that isn't the route markus is looking to go, perhaps he'd be willing to share the tools he crafts after completion so we could use them to do the script we envision as well.

kaine23

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #28 on: January 06, 2021, 09:28:50 am »
i like this idea!!

markus-projects

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #29 on: January 10, 2021, 09:25:45 am »
After some time in vacation and between the year I successfully managed to patch the game in order to replace the first dialog of the first scene.
I wrote how I did it as usual in my blog post (corresponding code is also uploaded in github).



However, to make it clear: I don't know if this method works every time. It is still not 100% solved but a way to go. I think the textblock patching works quite fine but the dialog pointer changing is very tricky and not 100% fail-safe yet.

Because this is new to me: Does it makes sense now to create an official entry in the https://www.romhacking.net/translations/ section to upload resources and have a working context with other interested users?
Maybe translators would like to download the 925 CSV files I extracted to start translating as Chicken Knife suggested. Every UTF-8 file corresponds to a textblock that can be patched in the HBD1PS1D.Q41 file. The name of the file (do not change it) is the ID of the textblock.

For testing, I entered something for the first dialog and patched the game to make the screenshot you see above.


A big help during research was a user named rveach who investigated translating DQ7 years ago.

What is still missing is patching in-game text, status messages and dialog options.
Because of my full-time job I am not sure how much time I can invest, but for questions I will be available.

Chicken Knife

  • Sr. Member
  • ****
  • Posts: 465
    • View Profile
Re: Dragon Quest IV (PSX)
« Reply #30 on: January 12, 2021, 08:59:56 pm »
@markus-projects

Spectacular work. It's amazing seeing this all being realized.

nejimakipiyo and I looked over the blog to some extent. If we were more technically gifted--and in my case, if I wasn't caught in such a demanding work situation at this time, we would certainly dive into translating and inserting. nejimakipiyo, normally busy with their GBC retranslation & RPG Maker projects, does have a lot more time than I do right now, but they would need a ton of hand holding with the technicals.

Understanding that life balance is a challenge for you as well, if your project either gets to the point where you have tools that are friendly enough for folks with no PSX hacking experience, or if you wanted to do some serious hand holding, we would be ready to get to work on the translating / writing end of it in the near future.