ROM Hack Ghost Trick rom hack problem

Caxap91

Member
OP
Newcomer
Joined
Sep 5, 2009
Messages
12
Trophies
0
Website
Visit site
XP
47
Country
Serbia, Republic of
Help me!
I want to translate Ghost Trick to Russian, since I have enjoyed this game pretty much
yaynds.gif


I have the enthusiasm to translate the whole text, but I don't know anything about the romhacking.
Since (apparently) there is noone who wants to help me on russian forums, I decided to learn myself.

I was able to open the rom (not so hard though), but the text files have a pretty wierd format...
like this:

st05_game000_Expand.en.xml.lz

And I can not extract the text itself

What can you say? Any help is appreciated!
moogle.gif
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
I am working with the European version here but I doubt it will be much different if you are using the US or Japanese one.

The xml bit caught my eye- XML is a sort of computer language http://www.w3schools.com/xml/default.asp although even when extracting the files they do not appear to be proper XML with no real markup and a lot of binary data. There have however been modifications of such languages in the past (lua for puzzle quest) and there is an entire "equivalent" language for binary stuff called EBML (it is what MKV/matroska uses).

LZ is a common type of compression- it starts with 11 which indicates type 11 LZ compression. Common enough and handled by the likes of http://code.google.com/p/dsdecmp/ and crystaltile2 http://filetrip.net/f23649-CrystalTile2-2010-09-06.html .

Somewhat more curious is the stuff in the system directory which appears to have files in compressed and uncompressed form- the ones ending with LZ decompress to match the .bin ones exactly.

Each of the st?? directories has a root.xml file although st04 has two files with root in the name.
Although I did not check them all each group of files in the directories have another file without the implied language contents that is usually a bit to a lot bigger than the files it is grouped with.

mods files are just videos from what I recall ("act imagine" format like VX files)

The database files in the system directory all appear to start the same save for a value that changes 8 bytes in- in DS files this is often size related and in this I am guessing it is actually 4 bytes long rather than 2 making it an address which usually points to a location with "junk" in it but just after that (same distance every time) there is some text.

I shall have to look more at this rom.
 

Caxap91

Member
OP
Newcomer
Joined
Sep 5, 2009
Messages
12
Trophies
0
Website
Visit site
XP
47
Country
Serbia, Republic of
I tried to open several system files with CrystalTile 2, but I have a problem with coding system, I suppose, because the only thing I get is this:



I tried to change coding system, but it didn't work...
 

Sora de Eclaune

All our splendor...
Member
Joined
Feb 15, 2011
Messages
2,850
Trophies
1
Location
Home
Website
www.youtube.com
XP
1,192
Country
United States
Caxap91 said:
I tried to open several system files with CrystalTile 2, but I have a problem with coding system, I suppose, because the only thing I get is this:



I tried to change coding system, but it didn't work...
That's odd... CrystalTile2 is supposed to have a DS button, so you can go into the file system of the ROM and import/extract files as needed.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
@Sora de Eclaune that is only for DS roms- that looks like an individual file.

Assuming that is decompressed and I can not be certain from that screenshot- when you right clicked the file in crystaltile2 there should have been an option to extract which just dumps the file as is and uncompress or words to that effect which will decompress the file although if you want http://code.google.com/p/dsdecmp/ should be able to do it.

Anyhow yeah the text format, if there is any there, did not look like an encoding I have seen before but that is OK as games use custom encodings all the time (indeed such things are more or less the first lesson in translation hacking). Trying to puzzle it out will be a different game though- first I would look at the ram to see if it does end up as ASCII/unicode there (if it does it might be filtered or encrypted in files) but after that it is the stand methods (relative search- monkey moore and crystaltile2 have options, distribution- space is likely to be common, interpretation- again space is common and if it is XML it will have lots of < and > characters which should stand out, corruption, brute force, assembly, save fiddling* and so forth- do remember you have three regions to compare between). I did not do anything here when I pulled them apart other than scan the files by eye and decompress them so it might be easy and might be hard.

*Start the game and name the character before saving. Start another and another and compare notes- start of the game should be near identical aside from the differences in the save data although it can get a bit more complex than that if you want it and you start entering names and looking at the ram when you are doing it.
 

cualquiercosa327

Well-Known Member
Member
Joined
Mar 24, 2009
Messages
201
Trophies
1
XP
428
Country
Hello,i know this thread is old but i felt a lot of curiosity about this game:
i would love be able to see the animations ,help on other translations,maybe recreate the 3d rooms ..

I dont know if they are some also interest on this.Anyway i am going to post here what i know.I hope it can help and they are some people interest on it.(For me it is one of the best ds games)

They are two version : the original nds and the IOS HD version.

the IOS version and ds seem very similar (most of files have on common as the xml which are no compress as ds with dsdcom;i have attached a binary version of this program.when i decompress the ds files they are the same ).

They also share the pac files "cpac_3d.bin" "cpac_2d.bin" which i think they have the same number of files inside (according "PAC File format specification" where "The file begins with a 4 byte long integer specifying the number of files in it." but it fail when i tried extract it as a pac file (it began fine but after two files it game error)


And add the huge file : "allMotionPack3.pac" which can be extracted without problem as a simple pac giving 115 files but i dont know how open it yet. I "suppouse" it could be the 3D models-animation they render for the ds version because they are several ios resolution and this way avoiding have it repeat lots of times,but maybe i am wrong.

The latest diferences are the format of sound : on ios are simple diferent mp3 and it has some h264 vids (the game trailer and two used on the game which is also included on ds version but on mods video format).
the nds mods can be seen with "mobiclip decoder" and they are some scenes of the game (i imagine they use on places where cpu is very bussy and help to load the data without framedrops)


they are a japan-korean translation of ds version .They are some info in this blogs:

http://perfectacle.blog.me/220525483533
and
http://bbs.ruliweb.com/game/217

but the tools are no available.Only i found "ghost-trick-font-converter.exe".I have sent they a mail asking info.

Also someone create a file extractor of DS cpac_2d.bin file but i have problem with python and i am unable to make it work :/

https://github.com/Zhorken/ghost-tripper

also the creator seem no sure of all the format :/

I forgot an important question : where are the nds animation stored? At the begining i thought it
could came on cpac_2d.bin,but seeing than IOS version has the same file and with the same number of files and include an extra huge file with the animations.
Also they are no on the arm9 binary because it is small.
anyone could answer this?
Thanks
 

Attachments

  • dsdecmp.rar
    19.8 KB · Views: 169
  • pac quickbmp extractor.txt
    157 bytes · Views: 310
Last edited by cualquiercosa327,

cualquiercosa327

Well-Known Member
Member
Joined
Mar 24, 2009
Messages
201
Trophies
1
XP
428
Country
About cpaq files i have found a script
http://aluigi.altervista.org/bms/resident_evil_cpac_nds.bms
which is extracting the file.
It seems work fine but it end with :

"Error incomplete input file 0 : d:\cpac_2d.bin
Can't read 113072 bytes from offset 0409400.
Anyway don't worry, it's possible that the BMS script has been written
to exit in this way if it's reached the end of the archive so check it or contact with the author or verify that all the files have been extrated"

coverage file 0 1535% 1256299236 81826816 . offset 04e09400

Last script line before the error or tht produced the error:

39 log "" OFFSET SIZE
"
i will go on try repair this
 
Last edited by cualquiercosa327,

cualquiercosa327

Well-Known Member
Member
Joined
Mar 24, 2009
Messages
201
Trophies
1
XP
428
Country
Last notes :i have used the same script with the 4 files cpac_2d.bin and cpac_3d.bin of both versions and i think interesting this:

cpac_2d.bin extracted are 1.16Gb and 55 files on BOTH.
cpac_3d.bin nds are 322 files 3.18 Mb (all files are .sdt format less one .dat) and IOS are 494 files 14.5Mb again most of them sdt.
I am no sure but i think they are a mistake .2d first bytes are 30hex on both and on 3d are 20hex and the extracted files are 55 on 2d version but on ios version they are different (i could have converted bad the hex number but almost it should be the same number on both.

Help?
 
Joined
Jan 19, 2021
Messages
10
Trophies
0
Website
fmlatghor.com
XP
51
Country
United States
Ok sorry for necrobumping, but want to respond to Cual....

I'm not sure actually either really. I have just gotten to where you are at since I just figured how to actually install quickbms on linux. I have gotten to where you are where I have extracted both files.

On the cpac_2d.bin for both Ghost Trick and Apollo Justice -- IIRC pacs/cpacs are the same format used in other Capcom NDS games...would be worth checking out if this is the same case -- the cpac_2d.bin on GT yields the same error as yours when being extracted as yours.

Not sure if this is really matters. I'm not very familiar with the cpac format and what it really is. What I'm even more unsure what to do even do with the files I've extracted (the *.dat and *.sdt files).

I'm yet to find solid proof that someone has successfully decoded/deobfuscated the assets for GT (not cheating it or using special tricks). There's some information on cpacs here: https://github.com/Missingmew/phoenixtools

I tried using the extraction tool for Apollo Justice (https://github.com/Missingmew/phoenixtools#apollo-cpac), but I got "skipping empty file..." "YEKP table isn't extractable..." and a segfault.

What I'm wondering is what do you actually do with the data files once you extract them for the game's graphical assets. I think some other tools that already exist might do the job, it's just putting the pieces together.

I must thank this thread and especially FAST6191 for all the help I've gotten and information I've received. I am still quite new to re and romhacking.
 
Joined
Jan 19, 2021
Messages
10
Trophies
0
Website
fmlatghor.com
XP
51
Country
United States
@fmlatghor my goal is create a viewer of the animations

Oh hey didn't even realised that there were new posts on this thread!

Although this may not be exactly what you're looking for, I'd suggest taking a look at this thread on RHDN just to see some progress that has been made: https://www.romhacking.net/forum/index.php?topic=32844.0

ArcanaXIX also posted the documentation to gt's entry https://www.romhacking.net/games/2439/

Here's CrazyMLC's project: https://github.com/CrazyMLC/ghost-treader - text encoding/decoding

...and here's mine, a unification of it all: https://github.com/fmlatghor/gt - an attempt to make the assets and the code modifiable.


I know these things aren't all quite what you want, but I figured that ArcanaXIX's documentation may be useful to you.

If you want to just get the animations, well you can probably use some VRAM techniques @FAST6191 might be able to tell you about....and also searching online.


Feel free to stop by the #gbatemp.net chan on irc.gbatemp.net or posting to the RHDN thread if you have anything useful to offer!

Glad people are still hacking gt, because 5/6 months a go it felt like it was only me...

--------------------- MERGED ---------------------------

Help me!
I want to translate Ghost Trick to Russian, since I have enjoyed this game pretty much
yaynds.gif


I have the enthusiasm to translate the whole text, but I don't know anything about the romhacking.
Since (apparently) there is noone who wants to help me on russian forums, I decided to learn myself.

I was able to open the rom (not so hard though), but the text files have a pretty wierd format...
like this:

st05_game000_Expand.en.xml.lz

And I can not extract the text itself

What can you say? Any help is appreciated!
moogle.gif

If OP ever sees this (unlikely), I'd like to mention with ghost-treader and gt (my project, not the game), translation is now quite feasible. I am helping translate the game to Dutch.
 

Jomeady

Member
Newcomer
Joined
Nov 22, 2021
Messages
5
Trophies
0
Age
22
XP
57
Country
Slovakia
I'm surprised I found a thread that was contributed to so recently. I've been wondering if the iOS version uses 3D models, or if it at least would be possible to get the higher res sprites so I downloaded the app and went to town. I noticed allMotionPack3.pac and tried to extract it. I tried using QuickBMS and the Ghost Trick script that was made for it, but that one errored out. It did manage to produce 1.dat, which seems to have some sort of structure.
HxD_yxRfQagJrr.png


I then tried to make my own parser based on the script, and tried saving each chunk as a separate file and got something that looked like this: (first 3 chunks of the first "file")
HxD_7HqrbyjnO7.png
HxD_4Vyf9SFVkv.png
HxD_UGpcxkDgms.png


There's an 11 close to the beginning of each of those files, so I tried removing the first 4 bytes and running it through DSDecomp, but it complained about the input containing more data then necessary. Nevertheless, I got an output that matched the first one (except that it was shorter because the script seemingly merges the chunks into one file) so I probably did something right.
Afterwards, I tried opening the pac file in CrystalTile2, and it almost worked, but it apparently can't handle such large files. I then tried just extracting each "file" from the archive, which meant that the resulting files had the chunk information. I opened that in CrystalTile2, which managed to recognize it (ignore the LZ one, that was just because that chunk started with 10):
CrystalTile2_AIkXyeGyxb.png

Extracting through it produced the same result as my own parser, so that wasn't too helpful. Although after writing that parser, I noticed what the error in the original script was. It seems that the first file offset is repeated twice, probably meaning that the first offset is meant to be for the end of the offset table. Notice the E4 47 repeating:
HxD_uajjmqa0Np.png

After I accounted for that in the original script, it worked all the way to file 1501 (out of 4600) where it errored out (something to do with file size and compression). I got files of varying sizes, but most of them seem to have the same overall structure:
explorer_XODdskzUAW.png
HxD_8KlId6GSBj.png
HxD_jImFoCrBiE.png
HxD_wValujE0qs.png
HxD_R8J884YJTC.png

That structure continues all the way down, until:
HxD_eNi8jJIAme.png
HxD_gZtK9wzRbT.png
HxD_Y7gv5i8GUz.png
HxD_WVfL5s8Zhg.png

While most of the files go around up to 2MB, there's one that's 16MB, and its structure also looks very different:
HxD_HgWOWlunB9.png
HxD_aKhMvEcG2J.png

My theory is that those files might just be images, or rather frames of the videos that play in the game. I'm still hoping for 3D models though!
For anyone interested, search for QuickBMS (Luigi Auriemma) and on that same page, you can find the Ghost Trick script. You'll then have to modify the script (it's a text file) by changing the lines:
Code:
if EXT == "pac"

    get FILES long
    for i = 0 < FILES
to:
Code:
if EXT == "pac"

    get FILES long
    get TEST long
    math FILES - 1
    for i = 0 < FILES
Oddly enough, the script seems to be using lz77wii, and I have absolutely no idea what that compression method is like.

Also if you want to use my absolute abomination of a code, here:
C#:
using System.IO;

namespace GhostTrickPAC
{
    class Program
    {
        static int FileCount;

        static int[] Offsets;

        // Drag and drop allMotionPack3.pac onto the exe, or for lazy debugging replace args[0] with the path to the file

        static void Main(string[] args)
        {
            using (BinaryReader reader = new BinaryReader(new FileStream(args[0], FileMode.Open)))
            {
                FileCount = reader.ReadInt32()-1;
                reader.ReadInt32();
                Offsets = new int[FileCount];
                for (int i = 0; i < FileCount; i++)
                {
                    Offsets[i] = reader.ReadInt32();
                }
                for (int i = 0; i < FileCount; i++)
                {
                    int NextOffset = (int)reader.BaseStream.Length;
                    int CurrentOffset = Offsets[i];
                    if (i + 1 < FileCount)
                    {
                        NextOffset = Offsets[i + 1];
                    }
                    reader.BaseStream.Seek(CurrentOffset, SeekOrigin.Begin);
                    
                    // Comment this to instead write each chunk as file

                    var ChunkSize = NextOffset - CurrentOffset;
                    var data = reader.ReadBytes(ChunkSize);
                    File.WriteAllBytes($"out2/{i}.dat", data);
                    
                    // to here, just use /* */

                    /* And uncomment this too
                    
                    var ChunkCount = reader.ReadInt32();
                    var ChunkOffsets = new int[ChunkCount];

                    for (int c = 0; c < ChunkCount; c++)
                    {
                        ChunkOffsets[c] = reader.ReadInt32();
                    }
                    for (int c = 0; c < ChunkCount; c++)
                    {
                        int NextChunk = NextOffset;
                        if (c + 1 < ChunkCount)
                        {
                            NextChunk = CurrentOffset + ChunkOffsets[c + 1];
                        }
                        var CurrentChunk = ChunkOffsets[c];
                        reader.BaseStream.Seek(CurrentChunk + CurrentOffset, SeekOrigin.Begin);
                        var ChunkSize = NextChunk - CurrentChunk;
                        var data = reader.ReadBytes(ChunkSize);
                        File.WriteAllBytes($"out/{i}_{c}.dat", data);
                    }
                    */
                }
            }
        }
    }
}
 
  • Like
Reactions: cualquiercosa327

cualquiercosa327

Well-Known Member
Member
Joined
Mar 24, 2009
Messages
201
Trophies
1
XP
428
Country
I'm surprised I found a thread that was contributed to so recently. I've been wondering if the iOS version uses 3D models, or if it at least would be possible to get the higher res sprites so I downloaded the app and went to town. I noticed allMotionPack3.pac and tried to extract it. I tried using QuickBMS and the Ghost Trick script that was made for it, but that one errored out. It did manage to produce 1.dat, which seems to have some sort of structure.
View attachment 286301

I then tried to make my own parser based on the script, and tried saving each chunk as a separate file and got something that looked like this: (first 3 chunks of the first "file")
View attachment 286302View attachment 286304View attachment 286305

There's an 11 close to the beginning of each of those files, so I tried removing the first 4 bytes and running it through DSDecomp, but it complained about the input containing more data then necessary. Nevertheless, I got an output that matched the first one (except that it was shorter because the script seemingly merges the chunks into one file) so I probably did something right.
Afterwards, I tried opening the pac file in CrystalTile2, and it almost worked, but it apparently can't handle such large files. I then tried just extracting each "file" from the archive, which meant that the resulting files had the chunk information. I opened that in CrystalTile2, which managed to recognize it (ignore the LZ one, that was just because that chunk started with 10):
View attachment 286306
Extracting through it produced the same result as my own parser, so that wasn't too helpful. Although after writing that parser, I noticed what the error in the original script was. It seems that the first file offset is repeated twice, probably meaning that the first offset is meant to be for the end of the offset table. Notice the E4 47 repeating:
View attachment 286307
After I accounted for that in the original script, it worked all the way to file 1501 (out of 4600) where it errored out (something to do with file size and compression). I got files of varying sizes, but most of them seem to have the same overall structure:
View attachment 286308View attachment 286309View attachment 286310View attachment 286311View attachment 286312
That structure continues all the way down, until:
View attachment 286313View attachment 286314View attachment 286315View attachment 286316
While most of the files go around up to 2MB, there's one that's 16MB, and its structure also looks very different:
View attachment 286318View attachment 286319
My theory is that those files might just be images, or rather frames of the videos that play in the game. I'm still hoping for 3D models though!
For anyone interested, search for QuickBMS (Luigi Auriemma) and on that same page, you can find the Ghost Trick script. You'll then have to modify the script (it's a text file) by changing the lines:
Code:
if EXT == "pac"

    get FILES long
    for i = 0 < FILES
to:
Code:
if EXT == "pac"

    get FILES long
    get TEST long
    math FILES - 1
    for i = 0 < FILES
Oddly enough, the script seems to be using lz77wii, and I have absolutely no idea what that compression method is like.

Also if you want to use my absolute abomination of a code, here:
C#:
using System.IO;

namespace GhostTrickPAC
{
    class Program
    {
        static int FileCount;

        static int[] Offsets;

        // Drag and drop allMotionPack3.pac onto the exe, or for lazy debugging replace args[0] with the path to the file

        static void Main(string[] args)
        {
            using (BinaryReader reader = new BinaryReader(new FileStream(args[0], FileMode.Open)))
            {
                FileCount = reader.ReadInt32()-1;
                reader.ReadInt32();
                Offsets = new int[FileCount];
                for (int i = 0; i < FileCount; i++)
                {
                    Offsets[i] = reader.ReadInt32();
                }
                for (int i = 0; i < FileCount; i++)
                {
                    int NextOffset = (int)reader.BaseStream.Length;
                    int CurrentOffset = Offsets[i];
                    if (i + 1 < FileCount)
                    {
                        NextOffset = Offsets[i + 1];
                    }
                    reader.BaseStream.Seek(CurrentOffset, SeekOrigin.Begin);
                   
                    // Comment this to instead write each chunk as file

                    var ChunkSize = NextOffset - CurrentOffset;
                    var data = reader.ReadBytes(ChunkSize);
                    File.WriteAllBytes($"out2/{i}.dat", data);
                   
                    // to here, just use /* */

                    /* And uncomment this too
                   
                    var ChunkCount = reader.ReadInt32();
                    var ChunkOffsets = new int[ChunkCount];

                    for (int c = 0; c < ChunkCount; c++)
                    {
                        ChunkOffsets[c] = reader.ReadInt32();
                    }
                    for (int c = 0; c < ChunkCount; c++)
                    {
                        int NextChunk = NextOffset;
                        if (c + 1 < ChunkCount)
                        {
                            NextChunk = CurrentOffset + ChunkOffsets[c + 1];
                        }
                        var CurrentChunk = ChunkOffsets[c];
                        reader.BaseStream.Seek(CurrentChunk + CurrentOffset, SeekOrigin.Begin);
                        var ChunkSize = NextChunk - CurrentChunk;
                        var data = reader.ReadBytes(ChunkSize);
                        File.WriteAllBytes($"out/{i}_{c}.dat", data);
                    }
                    */
                }
            }
        }
    }
}
Great work.
The maps are 3d but the models are prerender with 3d low-poly models (you can see on some development /promotional vids).

I wish Capcom released the IOS port to Switch : it is a wonderful game which deserve more people knows and play it
 
  • Like
Reactions: Jomeady

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Sicklyboy @ Sicklyboy: https://www.youtube.com/watch?v=zufnIPGYQx8