Dragon Quest IV (NDS) English + Party Chat Script Patcher for Japan ROM

Overview

Dragon Quest IV (NDS) English + Party Chat Script Patcher for Japan ROM

Patches English script files from the US version of Dragon Quest IV for Nintendo DS and Android so they are rendered nicely when used with the Japan ROM. Addresses various issues caused by the Japan game code being not fully compatible with English script files.

Party Chat

Why?

The US version of Dragon Quest IV for the Nintendo DS did not have party chat (https://dragon-quest.org/wiki/Party_Chat) and seems to completely disable party chat in the game code, so it is not normally possible to play DQIV on DS with party chat in English. The Android version has English party chat script files that are compatible with the Japan ROM, but using English script files are not handled well by the Japan ROM code - among other things, control characters meant to be evaluated to switch between gendered pronouns and singular/plural words are not supported, so they render as literals instead of being evaluated. While it is technically possible to simply place the raw English script files as-is into the Japan ROM, these issues make it a subpar experience.

This patcher attempts to address those issues by replacing control character blocks with normal text, reflowing text so words are not split at the edge of the text box, and other tweaks to improve the overall experience. It is intended to allow a version of DQIV on DS with party chat, with a minimum of jank caused by the Japan ROM code not being meant for English text.

One potential approach that could provide an even better experience would be to alter the US version's code to re-enable party chat. In theory this would allow using the party chat files from the Android version as-is, without any script patching. Making this change is beyond my abilities and seems to require a nontrivial amount of code changes. If someone is able to do that it would make this script completely obsolete and me very happy.

Prerequisites

Tools:

Files:

  • Nintendo DS Japan DQIV ROM
  • From Nintendo DS US DQIV ROM: English .mpt. files located in data/data/MESS/en (153 files total)
    • Load the NDS US ROM in dslazy and unpack it. The unpacked files are in the NDS_UNPACK directory where your dslazy executable is.
    • An alternative is to use the same files from the Japan ROM. The US ROM contains updated script files that fixes some formatting issues (menu options are better named) and is preferred, but the Japan ROM files should work fine.
  • From Android DQIV OBB: English Party Chat .mpt files - b0500000.mpt to b0552000.mpt (46 files total), located in com.square_enix.android_googleplay.dq4/main.11100.com.square_enix.android_googleplay.dq4.obb/assets/msg/en
    • After installing the Android DQIV app, you should be able to find the OBB by mounting your phone as a USB storage device and navigating to Android/obb. .obb files are basically zip files and can be extracted with any zip utility. You can rename the .obb file and change the extension to .zip to make extraction easier.
    • The Android OBB also includes the other non-party-chat en script files that may work instead of the US ROM files. However I ran into blackscreen issues when using these files on the JA ROM, so prefer using the NDS ones. YMMV

Quick Start

  1. Make sure there is an empty folder named en in the same directory as the dqiv_patch.py script file. If you cloned this repo/downloaded as a zip it should already be present, but if not create it.
  2. Copy NDS US ROM .mpt files from the unpacked folder to the en directory.
  3. Copy Android OBB party chat .mpt files to the en directory
  4. Run python dqiv_patch.py
  5. Find output files in out directory.
  6. Load the JA ROM in dslazy and unpack it. Copy the contents of out to /NDS_UNPACK/data/data/mess, replacing the folder of the same name (en if you ran with default settings).
  7. Pack the ROM in dslazy.

You have now generated a JA ROM with patched English script which includes party chat. This ROM will still use Japanese text by default, but can be switched to English with the Action Replay code 02106404 00000001.

Alternatively, you can run python dqiv_patch.py --lang ja to generate a ja output folder. Copy this to the /NDS_UNPACK/data/data/mess directory, replacing the ja folder, and pack the ROM is dslazy. This ROM will show the English script without requiring an Action Replay code. This version adds speaker names to the actual text - this is because the ja language mode does not show speaker names floating above the text box, instead expecting them to be in the actual text.

en language mode:
Party Chat

ja language mode:
Party Chat

There are several command line arguments available, run python dqiv_patch.py -h to see documentation. For example you can run the script with --gender m to generate a script with male gender pronouns, --gender f for female pronouns, or --gender b to include both.

Comparison Screenshots

Before

Using the raw English script files on a JA ROM:

Chapter Before Battle Before Reflow Before Control Before Item Before

After

With patched script files:

Chapter After Battle After Reflow After Control After Item After

Approach

For each file:

  • Seek until we find a @a start boundary. Write all bytes until the start boundary to the output file as-is.
  • Next, seek until we find a @b nametag end boundary. Everything between @a and @b is the speaker name of the dialogue segment.
  • Seek to @c2@ end boundary. Determine length of segment.
  • Remove each %0 and add equal number of empty spaces at end of segment.
    • These appear to be used to selectively capitalize or add prefixes like "A " where appropriate. Guess is that the JA ROM does not have code that supports this, so if not stripped the %0 appears as-is in text.
  • Find control segments and reduce them based on the following rules. Control segments can be nested so are recursively reduced.
    • Change each plural-variable block e.g. %H***%Xyou%Yyouse%Z to plural equivalent, padding end with spaces.
      • These cases appear to be handling player character events.
      • Always pick the latter of the two options, since often there is more than one party member.
    • Change each plural-variable block e.g. %M***%Xthem%Yit%Z to singular equivalent, padding end with spaces.
      • These cases appear to be handling item-related events, e.g. "you can't use them/it".
      • Always pick the latter of the two options (singular) because it sounds OK even when there is more than one item.
    • Change each context-specific block e.g. %O***%Xthe girls'%Yyour%Z to the first option.
      • These seem to be handling different cases when certain party members are present(?).
      • Use the second option since it seems to read fine in practice.
    • Change each context-specific block e.g. %L***%X%Y%Z to the second option.
      • These cases appear in dialogue where one or both sisters (Meena and Maya) can be present.
      • Pick the second case since it reads OK if both sisters are present.
    • Change each gender-variable block e.g. %A***%Xsir%Z%B090%Xlady%Z to gender-neutral equivalent, padding end with spaces.
      • If no matching rule is found or only one option, warn and default to first item.
      • Rules:
        • his/her/its to their
        • he/she/* to they
        • man/woman to person
        • him/her/it to them
        • feen/wan to person
        • laddie/lassie to child
        • gent/wench to one
        • himself/herself/itself to themself
        • son/girl to young one
        • *sir/*lady to friend
        • *boy/*lady to young one
        • *ero/*eroine to warrior
        • *guy/*girl to person
        • monsieur/mademoiselle to friend
  • Fix grammar issues caused by replacements, special case substitutions
    • Rules:
      • they's to they are
      • What luck! to Found - this makes the standard item discovery text flow better since we cannot use the %0 control character to add the proper prefix.
  • Re-layout line by first converting all newlines into spaces. Then split segments into lines with a max limit (usually 43) on space boundaries, changing spaces to newlines. There is a strange issue where the game auto-advances text boxes under certain conditions which can make the text box auto-advance to an empty screen. Because of this I remove newlines from end of each line, which seems to fix this issue without causing any other problems.
  • Pad the segment to match the original segment's length.
  • Repeat

Each resulting file should be the same size as the original. Each text segment should also be the exact same size as the original. The game expects text segments to start and end at specific places and resizing the text segments causes errors when the game tries to display text.

The file b0801000.mpt contains text used in battles. Battle text is rendered in a smaller font, so the normal 43-char line limit causes strange line splits in some places. Instead I reflow with line limit of 45 (this causes the enemy death text to flow better).

Additionally, we apply a special patch to shorten chapter names in b1007000.mpt. The en chapter titles overflow the JA ROM chapter heading text boxes so are shortened.

Known issues

  • Sometimes garbage characters like % may appear, which don't belong to control character segments. This can be caused by certain special characters that aren't handled correctly on the JA ROM.
  • Since we are forced to pick a single plural/singular substitution, sometimes the text will not have the correct plural/singular word choice.
  • Since the max line size is fixed for the reflow logic, sometimes when item or monster names are substituted into text it will cause the line to exceed the max line size. This will cause the words to be split at the edge of the text box. I have added line-specific fixes to address this when I notice issues, and can do so for any reported cases.
  • Enemy critical hits show ACTOR instead of the enemy name, probably because of some difference in the JA vs. EN ROM code causing the name substitution to break.
  • Some text may overflow since the English script doesn't fix into text boxes expected for the JA ROM. Most obvious example is the chapter names on the save/load screen.
  • When ROM language is changed to English, the name selection screen is still in Japanese, but the main character is always referred to as "Solo"/"Sophia" in game. This appears to be hardcoded in the JA ROM and I don't know how to fix this.
  • When ROM language is set to Japanese (default), the game will still use the Japanese name selection screen and save/display the main character name in Japanese. Changing this seems to require changing the ROM code which I don't know how to do.
  • Most item and enemy names are lowercased. The actual item strings are in lowercase, and the code to handle uppercasing them when appropriate doesn't seem to work in the JA ROM.
    Item Text Issue
  • The map screen shows "Map Info" and other strings showing shop info in Japanese. Although the "Map Info" string is present in the en script files, the JA ROM seems to be hardcoded to show this string in Japanese. Replacing the corresponding file in the ja folder doesn't help. A few other strings are also affected in inventory screens, may be others I haven't found.
    Map Text Issue
  • When there is more than one monster type in a battle, all monster names after the first one have %0 prepended to them. This appears to be getting added in code, so is not possible to strip out by modifying the script data.
  • When using en language mode, if there are multiple named speakers in one dialogue, the speaker nametag won't update correctly. For example if Maya is the first speaker and Meena responds in the same dialogue, the nametag will say Maya the whole time. This doesn't occur in ja language mode and this patch script is not altering the speaker names during patching, so this appears to be a code bug in the Japan ROM.
Comments
  • "ja" mode rom will have "en" mode formatting if action replay code is used

    So i was fiddling with this trying to make a rom that will be both:

    1. English by Default.
    2. Have English formatting (names above).

    And i realized that if i use a "--lang ja" rom + action replay code 02106404 00000001 i get exactly that.

    Am i insane or that just works and was stated and i didn't get it. (again)

    opened by MediaMaquina 2
  • Untranslated Japanese text

    Untranslated Japanese text

    I'm playing through Chapter 1 and some text when I press party chat is untranslated by either the patch or the AR code. Healie is also only saying elipses, but I assume that's just all he says right now. I'm unfamiliar with the game so if this isn't part of the party chat fix my apologies. https://imgur.com/a/NaHRZlP unknown (5)

    opened by iongammarays 1
  • Torneko Appraise

    Torneko Appraise

    Minor issue but I got to ch3 and the menu text for Torneko's appraise is still in Japanese, though you can click on it as usual and the actual appraisal is in english. don't know if you've noticed.

    image

    opened by Ditogalaxy 1
  • Ch5, Parthenia, Kiryl has party chat line when he's incapacitated

    Ch5, Parthenia, Kiryl has party chat line when he's incapacitated

    When entering Parthenia the first time, when using party chat, Kiryl has a line even though he is not a useable party member by that point.

    2022051712452300-0A347E222F9DAE29C9514AB6C262481F

    Also uploaded a save file, just enter Parthenia and use party chat to see the erroneous line. Dragon Quest IV - Michibikareshi Monotachi (Party Chat).zip

    opened by ugoplatamia 3
  • Broken conversation with Princess Veronica in Chapter 2

    Broken conversation with Princess Veronica in Chapter 2

    After completing the tournament, the dialog with Princess Veronica (from interacting with her, not the cutscene dialog) is broken, at least in JP locale. What I get is (>= I press A to continue): "Princess Veronica*Thanks to Tsarevna Alena, I will no longer have to go through a marriage not of my choosing. [Large blank space - complete text box]

    Princess Veronica*young one [small blank space - previous line still visible, but there's blank lines before the next dialog]

    Princess Veronica*Oops! Listen to me saying silly things! Please just forget I said anything." In addition, several other conversations in this section (such as with King Norman, and the maid upstairs, although not seeming to be missing dialog like the conversation with Veronica, have the large blank space behavior, where even though all the dialog has been written out, the dialog scrolls out of the box as if more dialog was being written, leaving a completely blank text box until you press a. From what I can tell, only (and, so far, all) the dialogs that are triggered after completing the tournament experience this issue (e.g. the guard saying "This is King Norman's throne room" does not have it happen), though party talk does not seem to have the issue.

    opened by NikoofDeath 0
  • Dialog has wrong amount of blips

    Dialog has wrong amount of blips

    Playing through the game, I notice a lot of the times dialog will have blips continue well after the text has finished, and sometimes (its far less noticeable) the blips stop before the text has finished. My assumption is this due to the blips being set based off the Japanese text instead of the English text, or maybe (but I doubt it) being based on the proper english text, rather than the edited ones.

    opened by NikoofDeath 2
  • Text automatically overflows into new box

    Text automatically overflows into new box

    It seems that some single text boxes are getting too much text in them in the script, as an example:

    When there is a box with a lot of text once the first box is done

    it overflows into a new one

    So if you don't read all of "When there is a box with a lot of text once the first box is done" by the time the word "done" is typed out, you miss out on whatever you didn't read, since it automatically goes to a second box that just says "it overflows into a new one". My guess is this could be avoided by automatically splitting the text boxes if there are too many characters?

    opened by NikoofDeath 1
  • Tiny issue: Class name of male Hero is Heroine

    Tiny issue: Class name of male Hero is Heroine

    Thank you for making this patch I didn't know I needed this until I saw it. But I just have a tiny issue. The class name of the male hero is Heroine and I don't know if and how I messed up.

    opened by FFRyu 2
Releases(v1.0.0)
Owner
Aric Huang
Aric Huang
A playable version of Chess – classic two-player, various AI levels, and the crazyhouse variant! Written in Python 3

A playable version of Chess – classic two-player, various AI levels, and the crazyhouse variant! Written in Python 3. Requires the installation of PIL/Pillow and Requests

1 Dec 24, 2021
Ultimaze est un jeu en 2.5D, réalisé dans le cadre d'un projet de NSI.

Ultimaze Ultimaze est un jeu en 2.5D, réalisé dans le cadre d'un projet de NSI. La consigne était d'utiliser la librairie pygame pour créer un jeu en

parlabarbedeMerlin 3 Sep 17, 2022
Multi minecraft server helper for python

呐 Yuki 您的群组服操作小助手。 使用Python3编写。使用 .yaml 配置文件记录子服,配合Screen管理Linux系统上的Minecraft子服,支持MCDR子服与非MCDR子服。 功能: 开启所有子服 关闭所有子服 重载所有子服MCDR 重载所有子服ChatBridge 使用方法:

3 Mar 17, 2022
Rock Paper Scissors Game with PyQt5

Rock-Paper-Scissors-Game rock paper scissors is a old game that all of us played it but this time let's play with computer Description This is Rock Pa

MohammadAli.HBA 4 Nov 11, 2021
Game code for Evennia servers designed for use with ALPACASclient.

ALPACASgame Game code for Evennia servers designed for use with ALPACASclient. This code is meant to be a type of "compatability layer" between the AL

FreeDelete Software 1 Nov 07, 2021
Rock Paper Scissors Games with Python

This is a classic Rock, Paper, Scissors game with some ASCII aesthetics. After the welcome message, the game asks you to choose between the three choices. Then it let the computer choose its choice.

p.katekomol 1 Jan 24, 2022
A Python based program that displays Your Minecraft Server's Status Infos.

Minecraft-server-Status This (very) small python script allows you to view any Minecraft server's status Information Usage Download the file, install

Jonas_Jones 2 Oct 05, 2022
An interactive pygame implementation of Conway's Game of Life

Game of Life An interactive pygame implementation of Conway's Game of Life Installation Clone the repo and navigate into it. git clone https://github.

Ethan 1 Dec 05, 2021
A Cataclysm: Dark Days Ahead launcher with additional features

CDDA Game Launcher A Cataclysm: Dark Days Ahead launcher with additional features. Download here. Implemented features Launching the game Detecting th

Rémy Roy 402 Jan 02, 2023
Hexagon game. Two players: AI and User. Implemented using Alpha-Beta pruning to find optimal solution for agent.

Hexagon game. Two players: AI and User. Implemented using Alpha-Beta pruning to find optimal solution for agent.

Anton 1 Oct 18, 2021
Vac-Man in Python

Vac-Man in Python This is my personal version of Vax-man game using python, which is the first assignment of EA Software Engineering Virtual Experienc

ZiXiang Luo 3 Jan 05, 2022
Mastermind-Game - A game to test programming and logical skills

Bem vindo ao jogo Mastermind! O jogo consiste em adivinhar uma senha que será ge

Marcelo Daros 0 Jan 27, 2022
A top-down arcade space shooter made in pygame.

About: Journey Through Space is a top-down arcade shooter made in pygame. You play as a pilot who was left behind after a battle and the goal is to go

Crimson Sane 0 Jan 01, 2022
Atari2600 Training / Evaluation with RLlib

Training Atari2600 by Reinforcement Learning Train Atari2600 and check how it works! How to Setup You can setup packages on your local env. $ make set

Jinwoo Park (Curt) 1 Dec 12, 2021
用于 blivechat 的图形界面

blivechat GUI 用于 blivechat 的图形界面。 有朋友在搞 Vtuber,像 blivechat 类似的项目能通过自定义 CSS 的方式在 OBS 上添加一个非常好看的聊天栏。但是想要在桌面端看到弹幕的话得要再开一个浏览器页面,十分不方便。就想写一个背景透明的浮窗浏览器。 挺喜欢

Silence 11 Dec 29, 2022
Automates cubemap generation for Source Engine games.

AutoCube Automates cubemap generation for Source Engine games during compile-time. Download: see the release page Installation Using with CompilePal A

5 Feb 18, 2022
This repository has the lessons of the gamming programming course

learning-python-game-programming This repository has the lessons of the gamming programming course Na faculdade, estou fazendo a disciplina de program

Mateus Faustino 1 Nov 16, 2021
Made with pygame. Multiplayer game using socket module and threading.

Rock Paper Scissor made with python-pygame. Poorly made, as a beginner in programming. Multiplayer with server code and client code provided.

AllenJo 1 Dec 29, 2021
Vitrix is an open-source FPS video game coded in python

Vitrix is an open-source FPS video game coded in python Table of contents Usage Game Server Installing Requirements Hardware Requirements Software Req

Vitrix 1 Feb 13, 2022
This project is an exciting fun game for beginners to build up

This project is an exciting fun game for beginners to build up. The program generates a random number from 1 to 10, or 1 to 100 any range that is specified and the user must guess the number after a

PyLaboratory 0 Feb 07, 2022