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.

Transistor .pkg Compression (PC)

Featured Replies

  • Author
  • Localization

puggsoy, posted Fri Aug 28, 2015 2:04 pm (6952)


Can someone identify the type of compression used on these .pkg files?
  • Author
  • Localization

puggsoy, posted Sat Aug 29, 2015 3:34 am (6956)


Ah, this is the compression for XNB files. What I was referring to was the compression of the .pkg files themselves, which contain the XNBs. I can tell they're compressed because the filenames near the start are broken in seemingly random places (e.g. "bin\Win\Atlases\Tracker_T.extures00" in Tracker.pkg), and also because the metadata in the XNB files says the file is much larger than it actually is.
Each file starts with these bytes:

Code:
40 00 00 05 01 00


Which seems to suggest some sort of identifiable algorithm; I just can't find what it is.

That said, I do appreciate the link. I was looking for a publicly available implementation of XNB decompression :)
  • Author
  • Localization

Ekey, posted Sat Aug 29, 2015 6:04 pm (7001)


It's normal XNB file with custom header > cut him > example:

Image
  • Author
  • Localization

puggsoy, posted Sun Aug 30, 2015 3:36 am (7012)


I compiled the decompressor, that doesn't work. Here, you can try it yourself. I'm pretty sure the .pkg is compressed.

XNBDecompressor.zip

  • Author
  • Localization

puggsoy, posted Sun Sep 06, 2015 7:13 am (7234)


Bumping just in case someone can still figure this out?
  • Author
  • Localization

puggsoy, posted Wed Dec 02, 2015 9:24 pm (10262)


Bump, maybe it's possible now? Really want to extract these files.
  • Author
  • Localization

aluigi, posted Sun Dec 06, 2015 6:59 pm (10348)


Just a quick test I did to not leave the thread unanswered.
I have launched the comtype_scan2 scanner against Uppercut.pkg from offsets 0, 4 and 7, then I did a "grep" to search the keyword "Microsoft" and found results in the test 26 and 371.
26 is a false positive but 371 seems correct, it's the UNKNOWN6 algorithm.
Can you check it?
Code:
comtype unknown6
math OFFSET = 4
get ZSIZE asize
math ZSIZE - OFFSET
xmath SIZE "ZSIZE * 20"
get NAME basename
clog NAME OFFSET ZSIZE SIZE
  • Author
  • Localization

aluigi, posted Mon Jun 13, 2016 10:43 am (14359)


So, basically, it's an xmemdecompress used on chunks of the file, right?
  • Author
  • Localization

puggsoy, posted Wed Jan 18, 2017 11:13 pm (20294)


Oh wow thanks a lot Savage, I'd kind of given up on this and forgotten about it.

The guy you linked to has some updated code here, which seems to go into a bit more detail on how to decompress the files (I think without needing .dlls from Transistor itself, and/or as many built-in XNA/MonoGame stuff). It seems to have a release, I'll try that out later today, otherwise I can maybe port what he has over to a language I can work in.

Aluigi, it appears to be something called "LZF" compression on chunks, if you go to around line 380 of this file.
  • Author
  • Localization

aluigi, posted Thu Jan 19, 2017 6:47 pm (20303)


Ah like this:
Code:
comtype lzf
math CHUNK_SIZE = 0x800000
math COMPRESSION_FLAG = 0x40000000
math PACKAGE_VERSION_CODE = 5
endian big
get packageHeader long
get NAME basename
log NAME 0 0
append
get PKG_SIZE asize
for OFFSET = 4 != PKG_SIZE
    get ZIP byte
    if ZIP != 0
        get CHUNK_ZSIZE long
        savepos OFFSET
        clog NAME OFFSET CHUNK_ZSIZE CHUNK_SIZE
        math OFFSET CHUNK_ZSIZE
    else
        savepos OFFSET
        log NAME OFFSET CHUNK_SIZE
        math OFFSET CHUNK_SIZE
    endif
    goto OFFSET
next
append
  • Author
  • Localization

Savage, posted Mon Mar 27, 2017 7:19 pm (21796)


Aluigi, the script works like a charm, but the game doesn't work with the files unpacked, i already packed the files using this script, but the game crashes too

Code:
comtype lzf_compress
get SIZE asize
get NAME basename
get EXT extension
string NAME ".pkg"
string NAME EXT
clog NAME 0 SIZE SIZE
  • Author
  • Localization

aluigi, posted Wed Mar 29, 2017 3:10 pm (21835)


As far as I can see from my script it requires for sure more than that lzf_compress clog to work :)
There is clearly an header and chunks
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.