+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Shakugan no Shana DS. Trouble locating the script
Pages: [1]
Author Topic: Shakugan no Shana DS. Trouble locating the script  (Read 460 times)
Bobbias
Guest
« on: September 26, 2007, 09:45:13 am »

I'm new to rom hacking, though I've been reading up about it for a long time (And was at one time trying to learn SNES assembly), and I've finally found a project that I'm serious about, but there's one snag. I can't locate the damned script in this game. I was hoping that since it was a DS rom, and DS roms have that nifty file system, I'd be able to locate the script easily enough, but nope, the developers just had to make everything in this game so damn obscure.

The bulk of the game is .vx video files, which I can easily ignore, but the rest of the files make hacking this thing very difficult, they're a bunch of LSZ77 compressed .bin files. I've located which one has the font, but unfortunately, I have no clue where the script is, and the bin filenames aren't of any help either, since they're all 2 letter names, :/

Anyone think they could help me out here?
KaioShin
Guest
« Reply #1 on: September 26, 2007, 10:18:39 am »

How do you know that the other files are LZ77 compressed? I'd think that just like the GBA companies practically always used the Bios' build in compression function. There are tools which can uncompress that data (data - not files). Have you tried those already?
Bobbias
Guest
« Reply #2 on: September 26, 2007, 10:26:46 am »

I've been posting in a couple places for this, and someone working on the Tehaxan boards told me that they were lz77 compressed, and told me that the LC12.bin , lt12.bin & lt16.BAK are the font tile files.

I've tried decompressing the other bins with GBADecmpDemo.exe file by file after extracting, but no luck there. How else should I go about trying to decompress them, since as far as I can tell, they're compressed somehow.

So far, I don't know much at all about the file header, I'm taking a wild guess and thinking NCB means Nintendo Compressed Binary, though that may be wishful thinking. Anyway, this is the very first part of pr.bin after it was passed through GBADecmp as a separate file:
CODE
Code:
4E 43 42 00 68 20 00 00 00 00 00 00 00 00 00 00
60 00 00 00 68 03 00 00 C8 03 00 00 70 00 00 00
FF FF FF FF FF FF FF FF 38 04 00 00 30 1C 00 00
Then there are 3 lines of FF

The next section starts:
Code:
52 45 43 4E FF FE 00 01 67 03 00 00 10 00 03 00
4B 4B 45 43 34 03 00 00 18 00 01 00 18 00 00 00
Then there's mostly nothing until the next section...
« Last Edit: September 26, 2007, 12:48:33 pm by Bobbias »
KC
Guest
« Reply #3 on: September 28, 2007, 04:47:50 pm »

Most of the .bin files seem to be archives, with multiple compressed files inside them. The locations inside the files are stored in the main code file. For example, the offsets for pt.bin are at 0x36466 in the rom. 8 bytes for every sub file, 4 bytes the offset and 4 bytes something else, probably the size.
Bobbias
Guest
« Reply #4 on: September 28, 2007, 06:02:00 pm »

Thanks a lot, that will really help me with figuring out what's what, once I complete my decompresser program, I'll check out what's going on in the separate files. I take it the pointers are pointing to the compressed locations?

Also, the number after the NCB magic number is the length of the archive, that much I know. But most headers seem to be pretty much empty aside from the magic number and the file length.

I checked out the bit of output I got from GBADecmpDemo from sc.bin and it looks pretty interesting after the header:
Code:
10 00 00 00 51 02 00 00 60 09 00 00 04 00 00 00
D4 00 00 00 10 01 00 00 32 01 00 00 74 01 00 00
A4 01 00 00 E0 01 00 00 04 02 00 00 56 02 00 00
94 02 00 00 1E 03 00 00 52 03 00 00 84 03 00 00
E2 03 00 00 18 04 00 00 4A 04 00 00 74 04 00 00
A2 04 00 00 DC 04 00 00 FC 04 00 00 32 05 00 00

This continues more or less, some parts being slightly out of place and such right down to about A0

then there's a HUGE gap between that and the next part, which is pretty dense with all sorts of values, but FF and 00 showing up on occasion, sometimes a couple times in a row.
I'm really not sure what to make of this.

Also, it could be improperly decompressed, so I'm not going to do anything according to this quite yet, I'm gonna wait till I can confirm that the original filoe was built the same way, but it looks to me like possibly a pointer table and text... (though I'm rather inexperienced). I'm just looking for speculation on whether you think it is or not.

UPDATE:
I found an implementation of LZ77 in C code that I'm going to use. I'm not sure how accurate it is to the algorithm used in GBA/DS, but I guess if I need to I can get a rom to test it on where we know what the result should be.. (anyone know a rom with some LZ77 compressed graphics I could use?)
I'm gonna rewrite it in C# (because that's what I have installed for programming right now, since I haven't written a proper line of code in 2 or 3 years now) and see what I can get with it.

I'm also working on a tool for script dumping. It'll be a generic tool geared towards reading a table file and displaying the text contents described by that table, so you can use it to locate the script by looking at it, then all you'll have to do is tell it the offset to start at, and end at, and it'll dump it into a file for you.

Of course, this is just a rough idea, and is subject to change. I may have all my tools separate or in one program, depending on how I feel about it.

Looks like I'm finally making some headway in this damned game.  :crazy:
« Last Edit: September 29, 2007, 01:40:32 am by Bobbias »
Pages: [1]  


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