+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Fun with Dragon Warrior 4 compression
Pages: [1]
Author Topic: Fun with Dragon Warrior 4 compression  (Read 1 times)
Reiska
Guest
« on: July 24, 2011, 10:35:28 am »

So I got it in my mind I want to see if I can make a counterpart to my DW3 spellname patch for DW4.  Of course, all the text is compressed in DW4.

Luckily, Bongo` wrote a nice utility to handle that compression.  Trouble is, it's supposed to be packaged with a dw4.tbl file, and it's not; given no readable text in the ROM I'm at a loss as to how I could go about creating a table from scratch, and googling turns up nothing at all.

By chance, does anyone have a copy of the table file for DW4?
ETG
Guest
« Reply #1 on: July 24, 2011, 11:23:37 am »

To make a .tbl file is easy. Open the game up in an emulator (like FCEUX) and watch the PPU viewer. You should see the the text on the right half at the top. The .tbl format is "XX=Y", where XX is the hex number of the tile and Y is the letter on the tile.


Infact it should look like this:
Code:
00=
01=0
02=1
03=2
04=3
05=4
06=5
07=6
08=7
09=8
0A=9
0B=a
0C=b
0D=c
0E=d
0F=e
10=f
11=g
12=h
13=i
14=j
15=k
16=l
17=m
18=n
19=o
1A=p
1B=q
1C=r
1D=s
1E=t
1F=u
20=v
21=w
22=x
23=y
24=z
25=A
26=B
27=C
28=D
29=E
2A=F
2B=G
2C=H
2D=I
2E=J
2F=K
30=L
31=M
32=N
33=O
34=P
35=Q
36=R
37=S
38=T
39=U
3A=V
3B=W
3C=X
3D=Y
3E=Z
3F=
65=_
66="
67="
68='
69='
6A='
6B='
6D=?
6E=!
6F=-
70=*
71=:
75=(
76=)
77=,
78=.

There are some issues you might want to take notice of. There are proper open and close quotation marks, multiple commas, text border pieces, and other icons in DW4, so if you come across anything funny, those might be part of it.
Reiska
Guest
« Reply #2 on: July 24, 2011, 09:00:13 pm »

Hmm, I hadn't thought of that.  Thanks Smiley

Unfortunately, the program doesn't seem to dump the spell name data, so I couldn't get into what I was actually going for, but it's progress at least. Tongue

EDIT:  I should look around more.  http://www.romhacking.net/utils/615/ got me there.

EDIT 2:  Successfully inserted both spell and item names from the DS version into the NES version.  It doesn't crash, and the spells seem to work. 

That said, this poses a new problem: I can't get the script dumper (mentioned in my original post) to create text files - it always produces "Error: Could not open DATA File for compressing." when I select "dump data block to a text file" from the project menu, and I need to be able to do script edits to make a releaseable patch out of this (by correcting in-script references to the item and spell names and such, particularly key items).

EDIT 3: Scratch that, figured out that problem too, it didn't like spaces in the rom filename.  Here we go!
« Last Edit: July 25, 2011, 06:18:17 am by Reiska »
Tito Santana
Guest
« Reply #3 on: July 25, 2011, 05:47:22 pm »

Quote from: Reiska on July 24, 2011, 09:00:13 pm
EDIT 3: Scratch that, figured out that problem too, it didn't like spaces in the rom filename.  Here we go!

For future use, most DOS programs can use files with spaces in the name but you have to put quotes around the title.
Azkadellia
Guest
« Reply #4 on: July 25, 2011, 06:12:12 pm »

Thing is, this is a Windows program.
Reiska
Guest
« Reply #5 on: July 26, 2011, 09:57:10 pm »

Okay, so I've hit an impasse again.  I got the monster names in (though I had to shorten a few to fit).

On the other hand, I hate Huffman compression.  Despite the fact that my uncompressed script is 303 bytes smaller than the original script, it doesn't compress as well as the original script, and as a result won't fit in the rom.

At a loss as to how to proceed.

For anyone familiar with the program, here's a dump of what happens (it's a bit lengthy)...

Spoiler: (View)

'G:\\dw4.nes' loaded successfully!
'Huffman BIT Code Table Data' was created successfully!
//-------------------- Process completed --------------------\\\\
Table file 'c:\\nes\\dw4.tbl' loaded successfully!
Located directory 'G:\\\\Comp_0', Successfully opened.
Located directory 'G:\\\\Comp_1', Successfully opened.
Located directory 'G:\\\\Comp_2', Successfully opened.
Located directory 'G:\\\\Comp_3', Successfully opened.
Located directory 'G:\\\\Comp_4', Successfully opened.
Located directory 'G:\\\\Comp_5', Successfully opened.
Located directory 'G:\\\\Comp_6', Successfully opened.
-------------- Huffman BIT Data 'SORTED' --------------
$00=100
$0F=000
$19=1100
$1D=0011
$1E=0100
$0B=0110
$18=0010
$16=11010
$12=11100
$1F=01110
$13=10110
$1C=10100
$17=101110
$11=111110
$6A=010100
$21=010110
$23=111100
$0E=101010
$0D=110110
$10=011110
$46=111111
$6C=0111110
$6E=1110110
$2D=1111010
$0C=1110100
$20=1101110
$15=0101010
$1A=1010110
$77=0101110
$78=1011110
$2C=01011110
$68=10101110
$72=11101110
$38=10111110
$49=11011110
$44=01111110
$4F=11101010
$6D=11110110
$3D=111011110
$71=101111111
$29=010111110
$25=111101110
$26=010101100
$2F=011111110
$31=110111110
$34=111010110
$4B=010101111
$37=101111110
$27=010101110
$3B=101011110
$43=0101111111
$33=1010111111
$2B=1111011110
$36=1110101111
$14=1111011111
$24=1010111110
$28=1110101110
$4E=1101111111
$30=0101011010
$22=0101111110
$32=1101111110
$48=01010110110
$1B=01111111110
$2A=11101111110
$4C=01111111101
$3E=11101111100
$47=01111111100
$39=111011111011
$3A=010101101110
$01=111011111010
$02=0111111111100
$50=1110111111100
$6F=0101011011110
$2E=0111111111111
$55=0111111111110
$35=0111111111101
$40=1110111111110
$06=01010110111110
$57=010101101111110
$41=111011111110100
$05=111011111111110
$51=111011111111100
$07=111011111110110
$4A=111011111110111
$56=111011111110101
$03=1110111111111010
$3C=0101011011111111
$08=1110111111111011
$04=1110111111111110
$53=0101011011111110
$09=11101111111111110
$58=111011111111111110
$54=111011111111111111
 
Created '895' bits from '92' codes.
Parent Node: '89 [$59]'.
//-------------------- Process completed --------------------\\\\
Located directory 'G:\\\\Comp_0', Successfully opened.
'C:\\nes\\Comp_0\\DW4_Bank_0_00.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_01.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_02.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_03.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_04.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_05.dat' compressed successfully.
Duplicate pointer stored. Pointer Index = '6'.
Duplicate pointer stored. Pointer Index = '7'.
Duplicate pointer stored. Pointer Index = '8'.
'C:\\nes\\Comp_0\\DW4_Bank_0_09.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_10.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_11.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_12.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_13.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_14.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_15.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_16.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_17.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_18.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_19.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_20.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_21.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_22.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_23.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_24.dat' compressed successfully.
'C:\\nes\\Comp_0\\DW4_Bank_0_25.dat' compressed successfully.
Located directory 'G:\\\\Comp_1', Successfully opened.
'C:\\nes\\Comp_1\\DW4_Bank_1_26.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_27.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_28.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_29.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_30.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_31.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_32.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_33.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_34.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_35.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_36.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_37.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_38.dat' compressed successfully.
'C:\\nes\\Comp_1\\DW4_Bank_1_39.dat' compressed successfully.
Located directory 'G:\\\\Comp_2', Successfully opened.
'C:\\nes\\Comp_2\\DW4_Bank_2_40.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_41.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_42.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_43.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_44.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_45.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_46.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_47.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_48.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_49.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_50.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_51.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_52.dat' compressed successfully.
'C:\\nes\\Comp_2\\DW4_Bank_2_53.dat' compressed successfully.
Located directory 'G:\\\\Comp_3', Successfully opened.
'C:\\nes\\Comp_3\\DW4_Bank_3_54.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_55.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_56.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_57.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_58.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_59.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_60.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_61.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_62.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_63.dat' compressed successfully.
'C:\\nes\\Comp_3\\DW4_Bank_3_64.dat' compressed successfully.
Located directory 'G:\\\\Comp_4', Successfully opened.
'C:\\nes\\Comp_4\\DW4_Bank_4_65.dat' compressed successfully.
'C:\\nes\\Comp_4\\DW4_Bank_4_66.dat' compressed successfully.
'C:\\nes\\Comp_4\\DW4_Bank_4_67.dat' compressed successfully.
'C:\\nes\\Comp_4\\DW4_Bank_4_68.dat' compressed successfully.
'C:\\nes\\Comp_4\\DW4_Bank_4_69.dat' compressed successfully.
'C:\\nes\\Comp_4\\DW4_Bank_4_70.dat' compressed successfully.
'C:\\nes\\Comp_4\\DW4_Bank_4_71.dat' compressed successfully.
'C:\\nes\\Comp_4\\DW4_Bank_4_72.dat' compressed successfully.
'C:\\nes\\Comp_4\\DW4_Bank_4_73.dat' compressed successfully.
'C:\\nes\\Comp_4\\DW4_Bank_4_74.dat' compressed successfully.
Located directory 'G:\\\\Comp_5', Successfully opened.
'C:\\nes\\Comp_5\\DW4_Bank_5_75.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_76.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_77.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_78.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_79.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_80.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_81.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_82.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_83.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_84.dat' compressed successfully.
'C:\\nes\\Comp_5\\DW4_Bank_5_85.dat' compressed successfully.
Located directory 'G:\\\\Comp_6', Successfully opened.
Error: Sorry but you have run out of room to insert to!
       Try making some adjustments to your script.
//-------------------- Process failed --------------------\\\\

It should be noted that all of the above errors also happen if I try and reinsert the original, unedited script after dumping it freshly from a clean rom (the three duplicate pointer errors and the "out of room" error).
« Last Edit: July 27, 2011, 04:02:55 am by Reiska »
DQ Chao284
Guest
« Reply #6 on: August 02, 2011, 06:19:01 pm »

Well that could be due to some header that has a strict level of code in it, since the NES can only handle 1 MB PC sized rom, but also I have nenoted there are quite a bit of repeat data and character section stuff in the rom, if those are not used, then that could very much figure out if those areas and not even used in the rom, that could be the areas remodify the header and pointer locations of those "repeat" or "unused" areas of the rom.
KingMike
Guest
« Reply #7 on: August 02, 2011, 10:34:04 pm »

Dragon Warrior 4 and DQ4 are both 512KB.
If you're still playing with a 1MB ROM, you should know that it is a bad dump that only Nesticle supports, and that was probably because it was only discovered to be a bad dumper after Nesticle was discontinued. So, it wouldn't be a good idea to hack that one.
(I believe the maximum size supported by MMC1 is 512KB PRG.
Well, MMC1's original limit was 256KB, but the 512KB support is a mapper variant that allowed games to use one of the CHR-ROM bankswap bits (thus halving the CHR-ROM limit, but in a game that uses CHR-RAM, it doesn't matter) to instead enable either half of a 512KB ROM).
« Last Edit: August 02, 2011, 10:42:44 pm by KingMike »
Butz_san
Guest
« Reply #8 on: August 03, 2011, 01:04:30 am »

Actually, Bongo' did a new utility that it was supposed to allow me to translate the items and enemies' names, but I never really used and he never finished, I translate that game from English to Spanish thanks to Bongo' Smiley
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC