ROM Hack Help with file compression

BlueSword

Member
OP
Newcomer
Joined
May 10, 2009
Messages
17
Trophies
0
XP
38
Country
Mexico
Hey guys,

I decided to make a translation of it because it's not fair that the non-english speakers can't fully enjoy the game, also I want to learn more about hack translations, and I think this is the best place to do it

I already know the basics, but i just found that the script files are compressed in one single file, "script.pac" and since i am an ignorant and all the documentation about file compresion I've found are just a pile of random docs impossible to understand for a beginner like me my question is

Where do I start to figure out what kind of compression is and how to decompress/compress these files?

Really, I need help with this, I hope anyone here can help me

Thanks
biggrin.gif
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
First 4 bytes = # of files. Starting at 0x08, each file entry is 8 bytes (first 4 bytes = offset, last 4 bytes = length). Each entry is shifted right 4 bits (i.e. 46060000 02000000 means there is a 0x20 byte file at 0x6460), and accordingly, files are padded to the next 0x10. Each individual file is LZ77-compressed.
 

BlueSword

Member
OP
Newcomer
Joined
May 10, 2009
Messages
17
Trophies
0
XP
38
Country
Mexico
Thanks for reply
smile.gif


I don't know if I'm doing it right, but this is what i have done so far



So there are 8A 0C 01 00 = 2,316,042,496 files in "script.pac", right?



Now, the first file entry is this, right?

screen001t.png



Then, how do you know 46060000 02000000 means that there is a 0x20 byte file at 0x6460 and no in 0x6064?



Now, I look for the byte at 0x6460, and I copy the string of 0x20 byte

screen002w.png


Then I create a new file and I paste the string, then I save the file with the name "0000000001", Im using Hex Workshop 6

screen003x.png


Finaly I decompress the file with BatchLZ77.exe and what get is this

screen004c.png



... Im sure im doing it wrong, Can you please explain me

how to extract and decompress the first file (or tell me where im wrong)?

and where starts the second file entry? ( I suppose its defined in 48060000 4E000000, but im not sure)

Thanks
smile.gif
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
Actually on second look it's only the first 2 bytes, so there are 0xC8A (3210) files.

Code:
Entry 1ÂÂEntry 2ÂÂÂÂOffsetÂÂ Length
46060000 02000000ÂÂ 0x6460ÂÂ 0x0020
48060000 4E000000ÂÂ 0x6480ÂÂ 0x04E0
96060000 00000000ÂÂ 0x6960ÂÂ 0x0000
(...a bunch more empty files...)
96060000 1E000000ÂÂ 0x6960ÂÂ 0x01E0
B4060000 0A000000ÂÂ 0x6B40ÂÂ 0x00A0
BE060000 1B010000ÂÂ 0x6BE0ÂÂ 0x11B0
D9070000 59000000ÂÂ 0x7D90ÂÂ 0x0590
32080000 59000000ÂÂ 0x8320ÂÂ 0x0590
8B080000 59000000ÂÂ 0x88B0ÂÂ 0x0590
E4080000 63000000ÂÂ 0x8E40ÂÂ 0x0630
47090000 55000000ÂÂ 0x9470ÂÂ 0x0550
9C090000 83000000ÂÂ 0x99C0ÂÂ 0x0830
1F0A0000 96000000ÂÂ 0xA1F0ÂÂ 0x0960
etc.

And that output looks right. Try it with a bigger file and you should see text.
 

BlueSword

Member
OP
Newcomer
Joined
May 10, 2009
Messages
17
Trophies
0
XP
38
Country
Mexico
Well, I have already extracted these files

Entry 1 Entry 2 Offset Length
46060000 02000000 0x6460 0x0020
48060000 4E000000 0x6480 0x04E0
96060000 1E000000 0x6960 0x01E0
B4060000 0A000000 0x6B40 0x00A0
BE060000 1B010000 0x6BE0 0x11B0

And named them File0001, File0002, ..., File0005 and I decompress them using BatchLZ77.exe, but I didn't found any text, I used Relative Search but still nothing

I extracted a bigger file but it doesn't work either

What Im doing wrong?
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
The text is encoded as 2-byte Shift-JIS, not 1-byte ASCII. Use CrystalTile2 instead of Hex Workshop and set TBL->Code Page to Japanese (Shift-JIS).
 

BlueSword

Member
OP
Newcomer
Joined
May 10, 2009
Messages
17
Trophies
0
XP
38
Country
Mexico
Ok, i have done this

1.- Open CrystalTile2
2.- Select TBL>Code Page>Japanese (Shift-JIS)
3.- File>Open>File0002.decompressed
4.- I can only see some weird japanese symbols, so i try to do relative search with every word from the text of the beginning of the game
5.- Tools>relative search...>In the "variab" textbox i write, for example "world"
6.- I have to be honest, im stock here, I don't know what a heck is going on, there are so many options in this dialog box i dont know if i found something or not

Darn, just when i feel i was making a progress im stuck again, can please tell me how to see the text?

Thanks for your patient, you will be the first person in the credits of the translation, i hope you can help me
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
There are 3,210 different files. Why are you expecting that specific text to show up in the first one? I'd just start translating whatever text you find, but if you have to do it in order, you can try extracting all the files and using a file search utility like AstroGrep. You don't need to use relative search since you already know the encoding; just make sure to search using the 2-byte characters ('?????' rather than 'world').
 

BlueSword

Member
OP
Newcomer
Joined
May 10, 2009
Messages
17
Trophies
0
XP
38
Country
Mexico
Good news, I found the first text of the game!
smile.gif


The file is in 000BC230 with a length of 0BA0

I decompress the extracted file (Text 0001) with BatchLZ77.exe and I get a second file (Text 0001.decompressed)

I open this new file with CrystalTyle2, and select TBL>Code Page>Japanese (Shift-JIS) and bingo!

screentext0001.png


At this point i don't make any changes to the file, I close the file and CrystalTyle2

Now, I try BatchlZ77.exe to recompress the file "Text 0001.decompressed" to get a new third file (Text 0001.decompressed.compressed)

At this point both files ("Text 0001" and "Text 0001.decompressed.compressed") should have exactly the same content and size, right? Since I just decompressed and recompressed the file "Text 0001" without making any changes, but no

screentext0002.png


It took me around 3 hours to find the first text, and now i don't know what im doing wrong

Here are the files

Any help please?
smile.gif
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
BlueSword said:
At this point both files ("Text 0001" and "Text 0001.decompressed.compressed") should have exactly the same content and size, right?
No, different compression algorithms. It doesn't make any difference as far as the game cares, but you will want to write a program to recalculate the pointers when you edit a file.
 

BlueSword

Member
OP
Newcomer
Joined
May 10, 2009
Messages
17
Trophies
0
XP
38
Country
Mexico
Oh, ok, but I don't get it at all
tongue.gif


Can you please recommend me some documentation about it to try to write that kind of program?

Thanks in advance
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • K3Nv2 @ K3Nv2:
    10 tabs open on chrome and no slow downs suck it low ram plebs lol
  • Veho @ Veho:
    Firefox users be like "look at what they have to do to mimic a fraction of our power."
  • K3Nv2 @ K3Nv2:
    they be like which lite firefox exe pls
  • Veho @ Veho:
    Wut.
  • Maximumbeans @ Maximumbeans:
    GM all
  • K3Nv2 @ K3Nv2:
    butt
  • SylverReZ @ SylverReZ:
    douche
  • Veho @ Veho:
    Touché.
  • SylverReZ @ SylverReZ:
    Push it :creep:
  • Veho @ Veho:
    Talk about propaganda.
  • Veho @ Veho:
    Illinois is working to ban toxic food additives that have been banned for decades in other countries; additives that can be replaced and all those countries still have Skittles and Mountain Dew. Title of the piece: GUBMINT WANTS TO TAKE AWAY YOUR CANDY
  • Veho @ Veho:
    Gee, I wonder if the author is biased?
  • SylverReZ @ SylverReZ:
    @Veho, Sounds and smells like bullshit. They don't give you cancer, and California should know that. I don't get why they stick labels that say "may or may not cause reproductive harm or cancer".
  • Veho @ Veho:
    Arsenic doesn't give you cancer either.
    +1
  • Veho @ Veho:
    California has already banned those additives BTW.
    +1
  • Veho @ Veho:
    Psi has been banned in the state of California.
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I am the cancer!!! lol
  • Psionic Roshambo @ Psionic Roshambo:
    Yayyy got arcade games on the Pi working lol
  • Veho @ Veho:
    Cool.
  • Psionic Roshambo @ Psionic Roshambo:
    Now to spend 6 months deleting all the garbage lol
  • Psionic Roshambo @ Psionic Roshambo:
    Mame should be two sets one for preservation of everything and one set for people who just want to play and enjoy the old old ganes
    Psionic Roshambo @ Psionic Roshambo: Mame should be two sets one for preservation of everything and one set for people who just want...