Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: Raccoon Sam on November 08, 2017, 04:27:24 am

Title: Sutte Hakkun stuff
Post by: Raccoon Sam on November 08, 2017, 04:27:24 am
I released a translation patch just now (https://jul.rustedlogic.net/thread.php?id=18356) and during the hacking process I ran into a hueg pointer array. More or less copypasta from the jul thread:

The array is $3EA0 bytes big ($10 bytes per entry so 1002 entries in total) and it's located at 0x30BFE. A similar array is present in other games in the Sutte Hakkun series (the several Satellaview versions). It is as follows:

pp pp pp pp dsize csize cflag uu uu uu uu uu uu
00 4C CC 00 00 40 C9 12 01 00 FF FF FF FF FF FF


Where
pp = pointer to data
dsize = decompressed size
csize = compressed size
cflag = is the data compressed?
uu = unused
(dsize and csize are the same if cflag is 0)

I checked out every pointer and the data they point to. Frankly, the ROM hacking implications here are absolutely amazing. You might already realise that this massive array is essentially a file lookup table and it encompasses the whole (rest of the) ROM; everything from 0x34A9E to 0x300000 (pretty much everything except the game code, some smaller stuff and the player graphics). A Table Of Contents, if you will.

After extracting the compressed and uncompressed files and having a look at them, I was even more impressed – everything is super neat. Things are in a very logical order, even the level format can be understood by a baby, tilemaps are clean, graphics pages value readability over minimising tile redundancy... and everything is its own file. Every stage, every physmap, every tilemap, every palette, every graphics page. Additionally, the ROM is huge so there's lots of free space at the end of the ROM anyway.
Alas, although I know Python, I don't think I know if well enough to author a real editor. I did make a level visualiser (binary to TMX) to help understand what's going on:
(https://i.imgur.com/d9koaVp.jpg)

Is anyone interested in hacking the game(s)? I've never seen anything like this (a single pointer array that lists 99% of the game content in a neat manner) in a ROM before.
Title: Re: Sutte Hakkun stuff
Post by: KingMike on November 08, 2017, 01:15:02 pm
SFC Record of Lodoss War is the only other cartridge game I've seen that (seemed to) use a file system.
(at least prior to the DS, which seems to be the first cart/card console with a distinct file system)
Title: Re: Sutte Hakkun stuff
Post by: Gideon Zhi on November 09, 2017, 02:04:27 pm
Cyber Knight 2 has a file system as well.
Title: Re: Sutte Hakkun stuff
Post by: GHANMI on November 11, 2017, 10:34:08 pm
First of all, thanks a ton for releasing this :D

The situation surrounding this game's release is extremely confusing tbh, even moreso than with SNES Picross.
So, you basically have:

1/ Sutte Hakkun Event version (Satellaview) - 11/1997 - 50+5 levels
ROM: Sutte Hakkun - Event Version (Japan) (BS)

2/ Sutte Hakkun (NP) - 8/1998 - expansion to #1, 110 levels
ROM: Sutte Hakkun (Japan)

3/ Sutte Hakkun BS Version 2 (Satellaview) - 10/1998 - remake of #1 w/ new content, 30+3 levels
ROM: Sutte Hakkun - BS Version 2 (Japan) (xxxx-06-03) (BS), Sutte Hakkun - BS Version 2 (Japan) (xxxx-10-08) (BS)

4/ Sutte Hakkun '98 Winter Event version (Satellaview) - 12/1998 - another remake of #1 w/ new content, 30+3 levels 
ROM: Sutte Hakkun - 98 Fuyu Event Version (Japan) (BS)

5/ Sutte Hakkun (ROM) - 6/1999 - identical to #2 (NP), different packaging
ROM: Sutte Hakkun (Japan)
Also on the Japanese Virtual Console.
The version currently translated.

That means some of the new content in versions 3 and 4 might have never carried over to this cartridge release, and it's not clear whether the cartridge version kept everything from the initial release.

About the modding potential, honestly if I were in your shoes I would look into whether a similar file structure exists in the alternate versions, whether they have any exclusive levels, and port them to the cartridge release, since honestly replaying the forced tutorials and first few levels for every version isn't something most would love to bother with.
Title: Re: Sutte Hakkun stuff
Post by: Raccoon Sam on November 12, 2017, 10:17:05 am
I'm not particularly proud of the code but here's the tool I used for my decompression: https://www.dropbox.com/s/kx9vgvkasm7vb9w/unpakkun_v2.py?dl=0

NOTICE:
• It's super verbose if you set the debugmode flag to True. Might help.
• It gives you everything out.
• The filenames are the entry headers (i.e. 775-25EBE8-427A-427A-0.bin, five parts; index, offset, outsize, insize, compressed)
• It can't recompress files.
• There's no prompts, so by default you must have an unheadered Sutte Hakkun ROM in the same folder  you run the script in and it must be named sh.smc

More in-depth explanation at jul (https://jul.rustedlogic.net/thread.php?id=18356)