Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.
Zero Tolerance for Disrespect

LZSS wrong implementation in QuickBMS?

Featured Replies

  • Author
  • Localization

RetroHelix, posted Sun Jun 21, 2015 5:13 pm (5834)


Hi,

I tried to decompress a LZSS (LZ10) compressed file with QuickBMS and got the wrong output. Maybe I'm doing something wrong. Here is the script I used. The bytes 1 till 5 should be the size of the decompressed file (2997632 dec) and I use the the ASIZE - 5 as the compressed filesize.
Code:
comtype NitroSDK #or LZSS
goto 0x01
get SIZE long
set ZSIZE long 0
math ZSIZE = ASIZE - 5
clog test 5 ZSIZE SIZE


Here is the compressed and the decompressed file: https://mega.co.nz/#!DBI2zRiZ!y8RZWlYzK ... 5Exc1neMxI
I tried three tools and they get the output right: http://www.romhacking.net/utilities/826/, DSDecmp and Nintenlords Compressor. Only QuickBMS does not decompress it right.

Maybe I'm doing something wrong. Could you take a look please?
  • Author
  • Localization

aluigi, posted Mon Jun 22, 2015 10:24 pm (5846)


Code:
comtype NitroSDK
get ZSIZE asize
goto 1
get SIZE long
clog test 0 ZSIZE SIZE

The Nitro SDK doesn't seem to have ways to reallocate the output buffer to that "goto 1; get SIZE long" is necessary.
  • Author
  • Localization

RetroHelix, posted Wed Jun 24, 2015 4:59 pm (5895)


I don't get it all but it works this way. Thank you.
  • Author
  • Localization

aluigi, posted Wed Jun 24, 2015 7:52 pm (5899)


Basically NitroSDK reads the first byte and then choose the relative compression algorithm so you have to decompresse the whole file from offset 0, but the uncompressed size is located at offset 1 and NitroSDK doesn't increase the output buffer if it's not big enough, so you have first to read this value to specify the correct output size.
Maybe in the next version of quickbms I can force the tool to read that 32bit automatically instead of doing the operation manually in the script.
  • Author
  • Localization

aluigi, posted Thu Jun 25, 2015 9:31 pm (5922)


Ah, note that the nintendo compressions are handled also by other comtypes, for example lz77wii in which the allocation of the output is automatic.
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.