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.

Final Fantasy 1 (3DS)

Featured Replies

  • Author
  • Localization

einstein95, posted Tue Feb 23, 2016 10:01 am (11597)


Update of the PSP script, same custom compression. All tables are aligned to 0x80 bytes so I've added dummy dstring reads. Original script by aluigi: http://aluigi.altervista.org/bms/ff1psp.bms
Code:
# Final Fantasy 1 PSP
# script for QuickBMS http://quickbms.aluigi.org

get FILES long
get FULLSIZE long
getdstring DUMMY 0x78

for i = 0 < FILES
    getdstring NAME 24
    get PCK_OFFSET long
    get ZSIZE long
    get SIZE long
    savepos INFO_OFFSET

    if ZSIZE != SIZE
        log NAME PCK_OFFSET ZSIZE
    else
        goto PCK_OFFSET

        get XFILES long
        get FULLSIZE long
        getdstring DUMMY 0x78
        for j = 0 < XFILES
            getdstring NAME 24
            get OFFSET long
            get ZSIZE long
            get SIZE long
            getdstring DUMMY 0x5C
            math OFFSET = PCK_OFFSET
            log NAME OFFSET SIZE
        next j
    endif

    goto INFO_OFFSET
    getdstring DUMMY 0x5C
next i
  • Author
  • Localization

ChrisX930, posted Wed Feb 24, 2016 11:11 am (11618)


Thanks! That was something I was looking for!
Could you help me to decompress/recompress the wp16-compressed files inside of the .dpk file?
I want to start a translation for this game^^

I got a Link where someone made a compressor/decompressor for the PSP-Version of this game but the Downloads aren't available anymore.
http://romxhack.esforos.com/compresion- ... a-wp16-t44
  • Author
  • Localization

einstein95, posted Wed Feb 24, 2016 12:13 pm (11620)


Right, so it uses LZSS with 32-bit flags, then normal LZSS, 16 bits for uncompressed data, 16-bit compressed data. .: Does QuickBMS have this compression implemented?
  • Author
  • Localization

FireFly, posted Wed Feb 24, 2016 1:41 pm (11621)


Here's a little C program that decompresses a WP16-compressed file (given as the first argument) to stdout: http://xen.firefly.nu/up/wp16.c.html. It should work fine on *NIX, don't know how useful it is on Windows though.

So as einstein95 mentioned this compression is very similar to LZSS. First there's a char[4] magic ("Wp16") and 32-bit little-endian filesize. Then there's a 32-bit "flags" field indicating whether each next 16-bit word is to be copied verbatim or to be treated as a backref. The bits in the flags field are indexed byte by byte from least to most significant bit, which is why I store it as u8[4] rather than u32 (to make it easier to index properly). Then there are 32 16-bit words corresponding to the 32 bits of the flag field. If the corresponding flag bit is 1, the word is copied verbatim. If it is 0, it's a backref (read as little-endian) that looks like "dddddddd dddccccc" where d bits form the distance and c bits the count. This indicates to copy (c 2) words from the output history at distance d, i.e. c=3 d=5 would repeat the last 10 bytes.

That's all there is to it--hopefully someone could write a BMS script to decompress from that description.
  • Author
  • Localization

aluigi, posted Thu Feb 25, 2016 4:30 pm (11635)


Well done FireFly, I will add your function to the next version of quickbms.
  • Author
  • Localization

ChrisX930, posted Thu Feb 25, 2016 8:06 pm (11642)


aluigi wrote:
Well done FireFly, I will add your function to the next version of quickbms.

tell me when it's ready :D
Want to compress/decompress the files :D
  • Author
  • Localization

aluigi, posted Thu Feb 25, 2016 9:56 pm (11645)


Does someone have some sample files?

@ChrisX930
There is no recompression code available, while for decompression you can try the FireFly code (yeah stdout is bad but you can edit the code easily).
  • Author
  • Localization

ChrisX930, posted Thu Feb 25, 2016 10:38 pm (11646)


aluigi wrote:
Does someone have some sample files?

@ChrisX930
There is no recompression code available, while for decompression you can try the FireFly code (yeah stdout is bad but you can edit the code easily).


Hopefully there will be a recompression code sometime.
Uploaded a few PCK-Files (Extracted from dpk-file)
  • Author
  • Localization

aluigi, posted Fri Feb 26, 2016 11:19 pm (11659)


The code of FireFly seems to work correctly.
Are you sure that recompression is really necessary? Maybe the loading code decompresses them only if they contain the Wp16 magic.
If it's really necessary then an option can be a fake compressor, it's a solution used sometimes to avoid writing a full compressor: basically ignore the compression window and stores the data in readable form with the compressed size bigger than the non-compressed one.
  • Author
  • Localization

ChrisX930, posted Sat Feb 27, 2016 12:48 am (11663)


aluigi wrote:
The code of FireFly seems to work correctly.
Are you sure that recompression is really necessary? Maybe the loading code decompresses them only if they contain the Wp16 magic.
If it's really necessary then an option can be a fake compressor, it's a solution used sometimes to avoid writing a full compressor: basically ignore the compression window and stores the data in readable form with the compressed size bigger than the non-compressed one.

Not sure if we need to recompress them completely. We've to test it out.
  • Author
  • Localization

ChrisX930, posted Tue Mar 01, 2016 9:35 am (11710)


///push
  • Author
  • Localization

ChrisX930, posted Sat Mar 05, 2016 9:45 pm (11804)


//Push
really want to decompress and probably recompress this files :D
  • Author
  • Localization

aluigi, posted Sat Mar 05, 2016 10:36 pm (11805)


Why don't you use the source code provided by Firefly in the meantime?
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.