Hacking How do I decompress files with NitroSDK compression

ComicMaster148

Angry Blackman, and amaetur game collector
OP
Member
Joined
Aug 23, 2018
Messages
541
Trophies
0
Location
Hobbit Hole
XP
2,862
Country
United States
I'm looking into romhacking for the the game Hayarigami DS and I could use some help figuring how to I decompress files with NitroSDK compression. Some helped me out by providing some code that he said would decompress the file but I can't tell if this is python or some other programming. If anyone can help clarify this it would be very much appreciated.

# Author: Bartlomiej Duda
# Creation Date: 11.08.2021

comtype NitroSDK
get ZSIZE asize
set SIZE long 0

math SIZE = ZSIZE
math SIZE *= 20

get NAME basename
string NAME + "_new.decompressed"
clog NAME 0 ZSIZE SIZE
 

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,667
Trophies
5
Location
Space
XP
14,537
Country
Norway
I'm looking into romhacking for the the game Hayarigami DS and I could use some help figuring how to I decompress files with NitroSDK compression. Some helped me out by providing some code that he said would decompress the file but I can't tell if this is python or some other programming. If anyone can help clarify this it would be very much appreciated.
It's for QuickBMS https://aluigi.altervista.org/quickbms.htm
If you download the scripts from that page (https://aluigi.altervista.org/quickbms_scripts.php) there is a file called "hayarigami.bms" but that appears to be for a Wii game, it's not the same as yours. But the scripts look very similar to what you posted.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,795
Trophies
5
XP
28,504
Country
United Kingdom
Personally I like standalone efforts
http://www.romhacking.net/utilities/826/
https://github.com/barubary/dsdecmp
Crystlatile2 also has options for decompression but more on that later, not to mention I tend not to use them that often if I can help it, or at least I don't rely upon them. Most of the big ROM hacking all in one tools (tinke, CT2 and the like) will handle it as well.
romhacking.net appears to be down at time of posting so those are cue's compression tools and attached accordingly.


Generally compression is noted by various means.
Names in the ROM can be a clue. Usually ones ending in _, .lz , .z , .comp and other such things.
The first bytes in the file are also generally of interest
Older GBA style stuff and earlier DS stuff tends to start with 10h, sometimes called type 10 or BIOS LZ compression.
A newer type appeared in ROMs maybe 1500 and up (might be some earlier ones, might be some where 10 stuck around). where that was 11 instead. Another type of LZ and generally handled well. Will probably appear in them to the end of the library.
40 appeared quite late in the day. Golden Sun was the most noted for it.

Huffman rarely appeared but was an option.

The other is BLZ. This was commonly used for the ARM9 binary and its overlays (ARM7 was not usually compressed outside of download play ROMs)

A note on crystaltile2. It will try to detect compression (you can also have tools try to detect compressed things in GBA ROMs) and you can see it in the DS file system window (open DS ROM, click little DS icon on the right hand of the toolbar, in new window will be a 3d cylinder with LZ or something in it if it thinks it is compressed, you will also get options on right click to decompress and compress as well as the basic extract and import options). It frequently gets mistaken (10 is quite a valid thing to start a file with).

Another test some like to do is to compress things. Compressed files tend not to compress further.

You might also encounter files compressed inside other archives (DS devs frequently made their own archive/container formats), this can trouble some of the tools above as they tended to assume you are feeding them simple files. Amusingly enough then some of the older GBA style things (GBA ROMs you can't pull apart into files like DS ROMs) can actually do something here but I would just say do it properly and figure out at least the location in the file even if you don't understand the whole archive format.
 

Attachments

  • Nintendo_DS_Compressors_v1.4-CUE.rar
    52.9 KB · Views: 106

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: https://www.dealnews.com/Bio-Shock-Remastered-for-PC-GOG-DRM-Free-Free-w-Prime-Gaming-digital-dow... +1