News:

11 March 2016 - Forum Rules

Main Menu

Dragon Quest Monsters (GBC) Delocalized

Started by nejimakipiyo, July 07, 2020, 05:40:38 PM

Previous topic - Next topic

ProstatePunch

Good stuff!  Looking forward to the title screen swap once you get that done.

And anxiously awaiting the patch!

nejimakipiyo

Hello everyone! I've been making some headway with this lately. The conservative version of the patch is completed, ready to go. I finally figured out how to set up extraction and insertion, thanks to generous help from Chicken Knife and abw, so now I'm working very hard on a complete rewrite of the script for the Delocalized version of the patch. I intend to publish both patches at the same time, likely later this month.

Unfortunately I'm still a long way off from being able to include the Japanese/German "Dragon Quest" title screen. My intention was to extract English text and insert it, after revision, into the German ROM. However, the text isn't all in the same place in that ROM, so that idea quickly went out the window!  :banghead:

It seems likely that the first version of the Delocalized patch will still be using the "Dragon Warrior" screen and the English version ROM -- at least until I level up my hacking skills beyond simple extraction and insertion!

ProstatePunch

Any chance you can post a small tutorial video on that when you do figure it out?  It something I've been interested in doing myself.  I'd love to know what tools you used.

nejimakipiyo

Here's another update! The script insertion was completed, and I'm now doing a playtest to check for bugs and errors. I found this... and may need some help or advice...



'VILLAGER' and 'TALISMAN' are the names of two Travelers' Gates in the original localization that I changed in my translation to 'Waiting' and 'Defending' due to mistranslations. In all other areas of the game, those names have been changed. For some reason, this particular list doesn't want to take the new names. There is an area in the ROM that I thought was the right thing to change, because the names of all of the gates appear in a list.



However, you can see here that after 'BEGINNING' I already have the names 'WAITING' and 'DEFENDING'.

I couldn't find any other place where 'VILLAGER' and 'TALISMAN' appear in capital letters like that, and I couldn't find them in the tile editor either.

Any suggestions?


Quote from: Stories8106 on August 09, 2020, 12:14:36 AM
Any chance you can post a small tutorial video on that when you do figure it out?  It something I've been interested in doing myself.  I'd love to know what tools you used.

I don't really do videos, sorry! But I used abw's abcde software, which you can find on this website. I also used a lot of blood, sweat, and tears, help from my pal Chicken Knife, and help from abw when silly mistakes went over our heads.   :crazy:

Reld

I don't know jack about this game or how it works, but from your screenshot it looks like that text doesn't align to the tile grid. Based on all of the other screenshots (and the text on the right side of this most recent one) I'm guessing it's not using a variable width font. I'm guessing the text on the left is stored as a tile map, or possibly several strips of mini tile maps. I'm not sure what you meant by "I couldn't find them in the tile editor either", so maybe you already thought of that and I'm way off base.

Chicken Knife



Here's the only spot I see in the ROM where letters don't seem to align to their horizontal 8x8 tile boxes. But we have this weird situation here with how they are encoded. When I look over the DWM graphics, most of them fit in the traditional way in their own 8x8 boxes, but some of the graphics do not, and it's not something that can be solved by the hitting plus and minus keys. It seems like garbage data is mixed in with the legitimate graphics data, but I suspect it has to do with some kind of alternate encoding system. The title screen graphics suffer from the same scenario, and it's the only reason we can't swap out the title logo.

Reld

Looks like compression to me, with the "junk" data probably being instructions to copy or repeat certain bytes.

Chicken Knife

#27
I was thinking the same thing. It would be nice to get underneath that scheme and be able to redraw what is needed, but I don't know if that's realistic for us right now. I'm dealing with my own quagmire of DQ3 background drawing issues at this moment, so this compression routine is something I'd need to return to down the road with a higher skill level. At least it's a pre-existing issue and not something introduced by the patch. If anyone has experience handling this kind of thing and could suggest a workable approach or felt like pitching in, it would not be unwelcome.

blipform

How do I access that portal screen? I'd like to try debugging it.

nejimakipiyo

Quote from: blipform on September 11, 2020, 07:10:55 PM
How do I access that portal screen? I'd like to try debugging it.

This screen is a list provided to you by talking to this NPC in the Chamber of Travelers' Gates.



This guy can probably be accessed within the first 20-30 mins of gameplay time, depending on your luck and speed getting through the Gate of Beginning. Otherwise, you can use the save file I'm going to PM you.

blipform

#30
Thanks for the save assist! Started some work and it's doing some type of vram copy routine @ ROM0:1590. Source comes from R056:6CAB [$15acab]. Some type of hand-painted vwf tiles.

15acab = 8 raw - [code 01] [02 05]

Some decompression routine kicks in here. I'll update as I understand more.

September 12, 2020, 11:46:56 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

It's a LZ* copier routine, 12-bit window + 4-bit length (with extension to 8-bit). The buffer wrap code I don't get but I'll see if I can cook some tool to help along.

September 12, 2020, 03:02:49 PM - (Auto Merged - Double Posts are not allowed before 7 days.)

Here's the unpacked bitmaps.
https://github.com/blipform/Dragon_Warrior_Monsters_1/raw/decrunch/portal_list.7z

With the source code here.
https://github.com/blipform/Dragon_Warrior_Monsters_1/tree/decrunch


Still have to figure out the packer.

September 12, 2020, 10:49:18 PM - (Auto Merged - Double Posts are not allowed before 7 days.)

So the good news is my packer works, and produces slightly tinier sizes (often 2-3 byte savings).
https://github.com/blipform/Dragon_Warrior_Monsters_1/tree/crunch


There's a 16-bit ptr table @ 15801f-15803e for the bitmaps. I'm not sure if your edits will fit in-place but you could either: recompress all graphics for some savings or just shove the large ones at end of bank $56.


I expect some problems using the tools but I'll hang around for this part.


As a side-note, this LZ was decent. Instead of using bitflags, it reserves an unused byte code as the escape. Which saves some shift math time and space. And you can use the pre-buffer space for zero'es compression.

September 12, 2020, 10:59:31 PM - (Auto Merged - Double Posts are not allowed before 7 days.)

I am now somewhat interested in trying to port the German title logo over to USA also. As much as I think it should be simple, I've been surprised many times over before though. Let's find out!

September 12, 2020, 11:11:10 PM - (Auto Merged - Double Posts are not allowed before 7 days.)

Uploaded new cruncher exe tools; forgot to static link the gcc dependency libs so no one has to hunt them down.

September 13, 2020, 12:03:11 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

And title logo patch for USA rom.
https://github.com/blipform/Dragon_Warrior_Monsters_1/raw/title_logo/german_title_logo.ips


Short answer is:
1. Found German logo (16f455, 16faf7)
2. Recrunched it to save some bytes
3. Replaced original English logo (16f455, 16fa8d)
4. Remapped ptrs (16c041, 16c043)

5. Found German nametable (17e56a)
6. Replaced USA nametable (17e583)

https://github.com/blipform/Dragon_Warrior_Monsters_1/tree/title_logo

nejimakipiyo

#31
Quote from: blipform on September 12, 2020, 11:11:26 AM
And title logo patch for USA rom.
https://github.com/blipform/Dragon_Warrior_Monsters_1/tree/title_logo

Holy crap! Thank you SO MUCH for doing this!  :beer:
That's one major goal for my hack down. And if I can accomplish the fix for the list of Travelers' Gates, it's pretty much done (pending a complete play test).

I'm going to be up front and say that I understand very little of what you wrote in that post, but I'm going to take my time and read through everything slowly to try to learn from it. I'm glad to know it seems do-able, at least!

Thanks again! :cookie: :cookie:

Edit:
This happens during the title screen sequence, after company logos and before the "Dragon Quest Monsters" screen.  :'(


Edit 2:
the dwm_decrunch.exe file doesn't seem to want to work for me. I ran the batch file, which appears to have extracted the same 16 .bin files that are in the portal list zip. I believe I will only need to edit the 2nd and 3rd files (not sure how to edit .bin files?), since those are the only names I intend to change. However, I'm not sure why the .exe is not working for me. Do you have any ideas?


blipform

Oh no! Didn't think of checking the intro sequence. I'll locate and update the logo patch.


You can open the bin files using a tile editor like YY-CHR.
http://www.romhacking.net/utilities/958/

Just drag-drop file into editor. Switch format to 2BPP GB. Then draw away! Although you could draw mixed-case for the whole list to get fancy.


Exe file is command-line driven.
dwm1_crunch.exe   
dwm1_crunch.exe 

But otherwise I have no idea why it would fail.

nejimakipiyo

Quote from: blipform on September 14, 2020, 03:11:21 PM
Oh no! Didn't think of checking the intro sequence. I'll locate and update the logo patch.


You can open the bin files using a tile editor like YY-CHR.
http://www.romhacking.net/utilities/958/

Just drag-drop file into editor. Switch format to 2BPP GB. Then draw away! Although you could draw mixed-case for the whole list to get fancy.


Exe file is command-line driven.
dwm1_crunch.exe   
dwm1_crunch.exe 

But otherwise I have no idea why it would fail.

Thank you again! YYCHR opened in 2BPP MX but I switched to GB and can edit now. This will take some time, but thankfully nothing too difficult compared to the garbled nonsense I was looking at before!  :laugh:

I had been trying to open the .exe from Explorer, not command prompt, so I can do that too. I don't foresee future problems (we hope). :-X

blipform

#34
Tilemap locations:
german rom 17e4f3  [$77 bytes]
usa rom 17e4f1  [$92 bytes]

Which gives us this patch
https://github.com/blipform/Dragon_Warrior_Monsters_1/raw/title_logo/german_title_logo.ips


I'll add some user prompt support to the exe and note an update here when it happens.

__________________________________________________


Summary of previous posts:

1. LZ just means dictionary compression, based on previous data. So
abcdeabcdabc ==>
abcde[abcd][abc] ==>
abcde[lz1][lz2]

We can copy from the previous "abcde" string to recreate the next strings. Save space.


2. The teleporter names have a ptr table @ $15801f, 2 bytes each entry or 16-bits. If the new packed data doesn't fit, you'll know to look here when shuffling everything around.


3. German logo uses same packing math as the gate names. I chose to make it smaller since it doesn't fit in the USA rom so easily.

Tilemaps are basically stored "raw" and copied over. So using the bgb vram viewer -- bg map window, I was able to find the rom locations. Turns out German uses smaller maps than USA so I didn't need to move anything around.

A tilemap is a bunch of painting codes that draws the screen: [tile 00][tile 01]..[tile 50].


Hope that simplifies everything.



EDIT1

Exe tools are updated and now ask for input if run directly
https://github.com/blipform/Dragon_Warrior_Monsters_1/tree/crunch
https://github.com/blipform/Dragon_Warrior_Monsters_1/tree/decrunch

nejimakipiyo

Thanks again, blipform -- this title patch works perfectly!  ;D
And great update with the tools!


Now I've got some questions about using the crunch/decrunch tools. Yesterday I drew the letters for how I want to rename the 2 gates.




But when I tried to save them, I get this notification.



I saved it both ways just in case, but either way when I crunch the files again it doesn't seem to work with the ROM. I suspect I'm missing a very important step and suspect it may have to do with redirecting the pointers, because I haven't messed with that yet. My main source of hesitation here is that when I crunch the files again, it outputs new filenames and I'm not really sure what's happening or which files I should be using. Is it correct to assume that the new filenames (for example portal_name2.p.bin) are in new locations in the ROM and I should be finding those addresses, or do I have to move them elsewhere in the ROM myself?

blipform

#36
Oh, right. That step. I choose 'no' to keep file size the same; otherwise it adds lots more junk bytes which usually you do not want.


portal_name2.p.bin is the new product you want to manually re-insert back into the ROM. But! You'll have to check the old compressed size to make sure it fits first. I use storall's asar mod to do the insertion for me and checking / ptr remapping; it's like xkas but extended for other systems, but more than a bit buggy.
https://github.com/storall/asar/tree/_storall_
https://github.com/storall/asar/raw/_storall_/bin/asar.exe


If you are absolutely sure it fits, you can do a command-line insert
dwm1_crunch portal_name2.bin rom.gbc 0x15ad0f
dwm1_crunch portal_name3.bin rom.gbc 0x15ad7d


portal_name1.bin  -- in: $67 bytes, out: $90 bytes, $15aca8 - $15ad0e
portal_name2.bin  -- in: $6e bytes, out: $90 bytes, $15ad0f - $15ad7c
portal_name3.bin  -- in: $61 bytes, out: $90 bytes, $15ad7d - $15addd
portal_name4.bin  -- in: $52 bytes, out: $90 bytes, $15adde - $15ae2f
portal_name5.bin  -- in: $66 bytes, out: $90 bytes, $15ae30 - $15ae95
portal_name6.bin  -- in: $40 bytes, out: $90 bytes, $15ae96 - $15aed5
portal_name7.bin  -- in: $4f bytes, out: $90 bytes, $15aed6 - $15af24
portal_name8.bin  -- in: $65 bytes, out: $90 bytes, $15af25 - $15af89
portal_name9.bin  -- in: $50 bytes, out: $90 bytes, $15af8a - $15afd9
portal_name10.bin -- in: $32 bytes, out: $90 bytes, $15afda - $15b00b
portal_name11.bin -- in: $52 bytes, out: $90 bytes, $15b00c - $15b05d
portal_name12.bin -- in: $63 bytes, out: $90 bytes, $15b05e - $15b0c0
portal_name13.bin -- in: $76 bytes, out: $90 bytes, $15b0c1 - $15b136
portal_name14.bin -- in: $79 bytes, out: $90 bytes, $15b137 - $15b1af
portal_name15.bin -- in: $68 bytes, out: $90 bytes, $15b1b0 - $15b217
portal_name16.bin -- in: $79 bytes, out: $90 bytes, $15b218 - $15b290



If it doesn't fit, you'll have to manually move your portal_name2.bin somewhere else in ROM (like $15b2xx-15bfff area) and remap the pointer table. Or recompress all 16 and remap the ptr table to fit in-place. There's lots of empty space though.


September 15, 2020, 04:34:02 PM

Fixed command-line. $ hex support doesn't exist yet, only 0x. I'm going to modify the crunchers to accept $ and prompt for insertion support.


September 15, 2020, 06:09:13 PM

Both crunchers are updated.

nejimakipiyo

Quote from: blipform on September 15, 2020, 03:41:38 PM
I use storall's asar mod to do the insertion for me and checking / ptr remapping; it's like xkas but extended for other systems, but more than a bit buggy.
https://github.com/storall/asar/tree/_storall_
https://github.com/storall/asar/raw/_storall_/bin/asar.exe


I downloaded this, and my first confusion was when it asks me for a patch name. I considered that might mean the new file for the 2nd portal name, even though that's a .bin file. I don't have an .ips for this yet.
So I progressed under my (probably false) assumption, and now it is telling me that the ROM title looks like garbage.
All I did was shorten the ROM title to DWM to make it easier to type into command prompts.
Any ideas what I'm missing here? I feel like if I could get to the point where I generate the kind of list you posted above, the rest of the steps would flow very easily to me.


blipform

#38
I'm not great at explaining but I'll keep poking at it! Let me think ..

____________________________________________________


You could directly insert back into ROM if you're feeling lucky about it.


dwm1_crunch
-- in_file name: portal_name2.bin
-- out_file name: dwm.gbc
-- out_file offset: $15ad0f


In my case, I'm okay because it's smaller than original.

old = $15ad0f - $15ad7c
new = $15ad0f - $15ad7a (+2 bytes)

____________________________________________________


The alternate way


dwm1_crunch
-- in_file name: portal_name2.bin
-- out_file name: portal_name2.p.bin
-- out_file offset: -1


This creates a new file named "portal_name2.p.bin". Let me get back on the asar follow-up ..


September 17, 2020, 01:33:14 PM


I chose to re-crunch all 16 names. And created this asar script.
https://raw.githubusercontent.com/blipform/Dragon_Warrior_Monsters_1/crunch/gate_names.txt


Which we run this way with command-line:
asar --no-title-check gate_names.txt dwm.gbc

or


asar.exe
-- Enter patch name: gate_names.txt
-- Enter ROM name: dwm.gbc
-- Warning .. title .. lala: yes



note: storall's asar version currently has some dumb bug with incbin. So you'll need to edit "arch gb.cpu" --> "arch nes.cpu" to get the inserter working. I already reported it and hoping for an updated version.


If you only want to re-insert names 2+3, it should be "simple" enough to modify the script. But experience has shown me otherwise many times.

nejimakipiyo

Hello again! Sorry for the long delay in responding - I didn't have the time to attempt this stuff recently until now.

Well, as you might expect, I'm back with more questions.

I tried using the dwm_crunch program, which resulted in my game refusing to load. I suspect this means the file I tried to insert is too big to go where I was trying to put it. Guess I'm not very lucky.  :laugh:




I was going to attempt the Asar way again, but that .txt file you sent me for the patch name resulted in a 404 error.