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.

Dragon Quest V (PS2) LZ Compression

Featured Replies

  • Author
  • Localization

Krisan Thyme, posted Thu May 06, 2021 5:50 am (63810)


I'm currently looking into DQV for the PS2.
I wrote a quick file extraction tool for DATA.DAT, but I soon noticed the game uses some form of LZ compression on its files.. I was wondering if anyone here could identify which variation of LZ it is? Compression isn't really my forte to begin with, so I'd appreciate any help I could get. Ideally I'd like to be able to decompress and recompress the files, as I might be making modifications to them in an upcoming project I'm working on.

Some sample files can be found here: https://mega.nz/file/AdBWiB7Y#2EO6m_n-p ... wwhtvFtPzk

The files themselves have a "A3DATA Ver0.2s" magic to them, which I can't find anything on either. I know this game was translated in the past so there's been some success by someone in deciphering the format, but it's been years and I haven't had any success digging up who was involved with that or how to contact them. Hope someone can at least point me in the right direction, thanks regardless.
  • Author
  • Localization

Ekey, posted Thu May 06, 2021 10:51 am (63813)


Header size is 24 bytes

Code:
struct Header
{
   uint8_t   m_Magic[16]; //A3DATA Ver0.2s \x00\x00
   int32_t   dwDecompressedSize;
   int32_t   dwCompressedSize;
};


Data compressed by LZSS. Here is simpile decompressor :)

Code:
# Dragon Quest V (PS2) (LZ) format
# script for QuickBMS http://quickbms.aluigi.org

get NAME filename
string NAME -= ".lz"

idstring "A3DATA Ver0.2s\x00\x00"
get SIZE long
get ZSIZE long
savepos OFFSET

comtype lzss
clog NAME OFFSET ZSIZE SIZE
  • Author
  • Localization

Krisan Thyme, posted Thu May 06, 2021 11:11 am (63814)


Ekey wrote:
Header size is 24 bytes

Data compressed by LZSS. Here is simpile decompressor :)

Thank you! That's a ton of help!
I'll probably still need to figure out how to compress it back later (I'm a big dummy with compression schemes, even easy ones sometimes) but this is a huge amount of help as is.
  • Author
  • Localization

aluigi, posted Thu May 06, 2021 11:21 am (63816)


You can use this script for recompressing the file:
Code:
comtype lzss_compress
get SIZE asize
log MEMORY_FILE 0 0
putdstring "A3DATA Ver0.2s" 14 MEMORY_FILE
put 0 short MEMORY_FILE
put SIZE long MEMORY_FILE
put 0 long MEMORY_FILE
savepos TMP MEMORY_FILE
append
clog MEMORY_FILE 0 SIZE SIZE
append
get ZSIZE asize MEMORY_FILE
math ZSIZE - TMP
math TMP - 4
goto TMP MEMORY_FILE
put ZSIZE long MEMORY_FILE
get SIZE asize MEMORY_FILE
get NAME filename
string NAME ".lz"
log NAME 0 SIZE MEMORY_FILE
  • Author
  • Localization

Krisan Thyme, posted Thu May 06, 2021 11:28 am (63818)


aluigi wrote:
You can use this script for recompressing the file

Well I must confess, I never expected such a speedy response and solution, and from the main man aluigi himself to boot! Thank you!
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.