Swordsman Online .pck

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Drawing
Posts: 112
Joined: Fri Aug 05, 2016 6:17 pm

Swordsman Online .pck

Post by Drawing »

Is it possible to unpack files over 4gb ?

I got a script for a game, it works with every packages but not with one of them of 4.7gb.
Last edited by Drawing on Wed Sep 26, 2018 11:02 am, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Unpack over 4gb

Post by aluigi »

Have you tried using quickbms_4gb_files.exe?
What's the game and the script you used?
Drawing
Posts: 112
Joined: Fri Aug 05, 2016 6:17 pm

Re: Unpack over 4gb

Post by Drawing »

Yes I used quickbms 4gb .
The game is swordsman online already tried the script you provided here https://zenhax.com/viewtopic.php?t=817
but nothing happen , just quickbms stucked.

I tried also the script you provided in this topic ( different from the previous one) https://zenhax.com/viewtopic.php?t=99

It unpack other .pck files from the same game but not models.pck
with this one I got this error

Error: memory allocation problem

I got 30gb of free space.

Keep attention all files and folders names in the .pck are in chinese
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Unpack over 4gb

Post by aluigi »

So the script is http://aluigi.org/bms/angelica_file_package.bms (version 0.3) which has a partial support for 64bit fields since INFO_OFF is compatible but all the OFFSETs are 32bit.
I need a sample file, download http://aluigi.org/bms/filecutter.bms, open with notepad and replace the 2 of MEGABYTES with 10, then launch the script on your archive and upload (on a mediafire, sendspace or mega) the 2 generated files.
Drawing
Posts: 112
Joined: Fri Aug 05, 2016 6:17 pm

Re: Unpack over 4gb

Post by Drawing »

the game has 3 different packages : .pck ; .pkx ( extension of .pck, tipical of every angelica engine game) and .pkg ( first time i see this in Angelica package)
Anyway I uploaded 10 mb of each one

http://www.mediafire.com/file/nfip81x396ax2g0/swordsman.rar/file
Drawing
Posts: 112
Joined: Fri Aug 05, 2016 6:17 pm

Re: Unpack over 4gb

Post by Drawing »

Maybe this topic should be moved in "game archive"
Drawing
Posts: 112
Joined: Fri Aug 05, 2016 6:17 pm

Re: Swordsman Online .pck

Post by Drawing »

Hi aluigi,
any news about the script?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Swordsman Online .pck

Post by aluigi »

PCK: it's just a sequence of compressed files without any information, there is just a small header of 12 bytes at the beginning.
You can extract the files with offzip -a

PCKG: ok it's Angelica

PCKX: I guess it's all obfuscated because I don't see anything with a sense
Raylee
Posts: 12
Joined: Tue Mar 31, 2020 10:09 pm

Re: Swordsman Online .pck

Post by Raylee »

Were you able to find a solution regarding unpacking Swordsman Online?
With your script aluigi, it is possible to unpack for example "building.pck".
The result is: You receive files with .chf & .pxd file extensions.

But it is not possible to unpack the folder "models.pck & ,models.pkx".

This is the console output from angelica_file_package.bms
models.pck output
https://i.gyazo.com/d0dfe6e43b508a0e020 ... 7e9978.png
models.pkx output
https://i.gyazo.com/8926bc4d2a0e8645765 ... a2a6e3.png

This is the console output from swordsman.bms
models.pck output
https://i.gyazo.com/02bc69efc2d7e8e6d8b ... eb59bb.png
models.pkx output
https://i.gyazo.com/1a4acf9bae776c541ad ... 34dd54.png

I tried this two .bms scrips:

First one:

Code: Select all

# Angelica File Package (script 0.3.1)
# script for QuickBMS http://quickbms.aluigi.org

goto -16
math INFO_ZSIZE = 0
get TEST1 long
get TEST2 long  # no, the "\x42\xc1\x5d\xa7" magic is not constant, it can be anything or just zero
get FILES long
get FLAG1 short
get FLAG2 short

# FLAG 3.2 is used for both compressed and non compressed info! so let's guess it
if TEST1 != 0 && TEST2 != 0
    math INFO_ZSIZE = TEST2
elif TEST2 u< 0x1000000  # ???
    math INFO_ZSIZE = TEST2
endif

findloc TAIL_OFFSET string "Angelica File Package" 0 "" 0
if TAIL_OFFSET == ""
    print "Error: no magic 2 string found"
    cleanexit
endif

math NEW_VERSION = 0
if FLAG2 <= 1
    math TAIL_OFFSET - 4
    goto TAIL_OFFSET
    get INFO_OFF long
else
    math TAIL_OFFSET - 12
    goto TAIL_OFFSET
    if FLAG1 <= 2 || INFO_ZSIZE != 0
        get FLAG long
        get INFO_OFF long
        if INFO_OFF == 0 || INFO_OFF u>= 0xfffffff0
            math FLAG ^ 0xa8937462
            if INFO_OFF == 0
                math INFO_OFF = FLAG
            else
                callfunction QUICKBMS_4GB_CHECK 1   # useless since the file is for sure bigger than 4gb
                math INFO_OFF ^ 0xffffffff
                math INFO_OFF u<< 32
                math INFO_OFF | FLAG
            endif
            math NEW_VERSION = 1
        else
            math INFO_OFF ^ 0x62A4F9E1
        endif
    else
        get INFO_OFF long
        math INFO_OFF ^ 0x33C3EDDB

        get INFO_OFF64 long
        math INFO_OFF64 ^ 0x49ab7f1d
        if INFO_OFF64 != 0
            math INFO_OFF64 u<< 32
            math INFO_OFF + INFO_OFF64
        endif
    endif
    get ZERO long
endif

idstring "Angelica File Package"

if NEW_VERSION != 0
    goto INFO_OFF
    for i = 0 < FILES
        get ENTRY_ZSIZE long
        math ENTRY_ZSIZE ^ 0xa8937462
        get DUMMY long  # ^ 0xf1a436??
        savepos OFFSET
        goto ENTRY_ZSIZE 0 SEEK_CUR

        math ENTRY_SIZE = 0x200 # doesn't matter, usually it's 0x114 or 0x120
        clog MEMORY_FILE OFFSET ENTRY_ZSIZE ENTRY_SIZE

        getdstring NAME 264 MEMORY_FILE
        get OFFSET longlong MEMORY_FILE
        get SIZE long MEMORY_FILE
        get ZSIZE long MEMORY_FILE

        if ZSIZE == SIZE
            log NAME OFFSET SIZE
        else
            clog NAME OFFSET ZSIZE SIZE
        endif
    next i
    cleanexit
endif

comtype zlib_noerror
if INFO_ZSIZE == 0
    xmath TMP "TAIL_OFFSET - INFO_OFF"
    log MEMORY_FILE10 INFO_OFF TMP
else
    clog MEMORY_FILE INFO_OFF INFO_ZSIZE INFO_ZSIZE
endif
for i = 0 < FILES
    if FLAG2 <= 1
        get NAMESZ long MEMORY_FILE10
        getdstring NAME NAMESZ MEMORY_FILE10
        get OFFSET long MEMORY_FILE10
        get SIZE long MEMORY_FILE10
        get ZSIZE long MEMORY_FILE10
    else
        if INFO_ZSIZE == 0
            get HEAD long MEMORY_FILE10
            math HEAD ^ 0x62A4F9E1
            get FOOT long MEMORY_FILE10
            math FOOT ^ 0x3520C3D5

            savepos TMP MEMORY_FILE10
            get ZERO long MEMORY_FILE10
            if ZERO != 0
                goto TMP MEMORY_FILE10
            else
                math HEAD - 4
            endif

            savepos INFO_OFF MEMORY_FILE10
            clog MEMORY_FILE INFO_OFF HEAD 0x118 MEMORY_FILE10
            math INFO_OFF + HEAD
            goto INFO_OFF MEMORY_FILE10
        endif

        getdstring NAME 260 MEMORY_FILE
        get OFFSET long  MEMORY_FILE
        get XSIZE long MEMORY_FILE
        get SIZE long MEMORY_FILE
        get ZSIZE long MEMORY_FILE
        if ZSIZE == 0   # some archives are different?!
            math ZSIZE = SIZE
            math SIZE = XSIZE
        endif
    endif

    if ZSIZE == SIZE
        log NAME OFFSET SIZE
    else
        clog NAME OFFSET ZSIZE SIZE
    endif
next i

startfunction QUICKBMS_4GB_CHECK
    math TMP64 = 0x10000000
    math TMP64 * 16
    if TMP64 == 0
        print "you must use quickbms_4gb_files.exe with big archives"
        cleanexit
    endif
endfunction


Second one:

Code: Select all

comtype unzip_dynamic
goto -8
get FILES long
goto -276
get INFO_OFF long
math INFO_OFF ^= 0x33C3EDDB
goto INFO_OFF
for i = 0 < FILES
    get HEAD long
    math HEAD ^= 0x62A4F9E1
    get FOOT long
    math FOOT ^= 0x3520C3D5
    savepos INFO_OFF
    clog MEMORY_FILE INFO_OFF HEAD 0x118
    math INFO_OFF += HEAD
    goto INFO_OFF

    getdstring NAME 260 MEMORY_FILE
    get OFFSET longlong  MEMORY_FILE
    get SIZE long MEMORY_FILE
    get ZSIZE long MEMORY_FILE
    if ZSIZE == SIZE
        log NAME OFFSET SIZE
    else
        clog NAME OFFSET ZSIZE SIZE
    endif
next i


I am glad for any help.


Best regards
Raylee
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Swordsman Online .pck

Post by aluigi »

I don't think there will be updates but try to upload a couple of sample files for analysis.
Raylee
Posts: 12
Joined: Tue Mar 31, 2020 10:09 pm

Re: Swordsman Online .pck

Post by Raylee »

Hey aluigi,

thank you for your answer.

I used filecutter.bms to extract some parts of models.pck & models.pkx.
https://mega.nz/folder/41Y3ga5b#VKiDr5i4e_7q3KRUhCAJig

If you find a solution to unpack it I am going to pay for the unpacker!
I am glad for any support!

Best regards
Raylee
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Swordsman Online .pck

Post by aluigi »

Mah... have you read my last post?
viewtopic.php?p=38985#p38985

That's exactly the same situation so what's the sense of reviving this old topic if what I wrote is still valid?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Swordsman Online .pck

Post by aluigi »

I was giving another look at the PKX file.
The only thing I can notice is that INFO64_OFF returns 1 instead of 0 so you can try to edit the Angelica script and replacing 0x49ab7f1d with 0x49ab7f1c.
Not sure if the result will change since the archive is really big and doing analysis in this way takes time.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Swordsman Online .pck

Post by aluigi »

Ok, the solution was very easy.
You must concatenate PCK and PKX in one unique file and then using my Angelica script on it.
I also updated the script since there was a 64bit field read as 32 so you must use the new version.
Raylee
Posts: 12
Joined: Tue Mar 31, 2020 10:09 pm

Re: Swordsman Online .pck

Post by Raylee »

aluigi wrote:Ok, the solution was very easy.
You must concatenate PCK and PKX in one unique file and then using my Angelica script on it.


Hey aluigi,

thank you for your great support.
Could you please explain to me exactly what you mean by this?
"You must concatenate PCK and PKX in one unique file"

What does this mean?
What exactly do I have to do here?
Could you please describe it to me in more detail?

Right now the Swordsman Online "package" folder looks like that:
https://i.gyazo.com/b14de8183ec18a3b819 ... 2461e6.png

I'm so glad you're taking your time with this. Thank you so much.


Best regards
Raylee
reh
Posts: 48
Joined: Sun Apr 21, 2019 2:09 am

Re: Swordsman Online .pck

Post by reh »

Open the notepad and paste:
Copy /B models.pck +models.pkx newpmodels.pck

Save the file in the same folder as the .pck and .pkx files and change the .txt file extension to .bat then you execute it.
Raylee
Posts: 12
Joined: Tue Mar 31, 2020 10:09 pm

Re: Swordsman Online .pck

Post by Raylee »

Thank you.

I received the merged file:
https://i.gyazo.com/b5a720a6029249e9276 ... 7de364.png

But after running aluigi's script I receive still an error:
https://i.gyazo.com/34f7b834046b630107f ... 52882d.png

Any ideas?

I am glad if we could found a solution.

Thank you for everything guys!!!


P.S:
Here you can find a cut from merged_models.pck:
https://mega.nz/folder/54xxHCbI#X78DgSeNAdHsTF8QyMw0cA

(If it helps somehow)

Best regards
Raylee
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Swordsman Online .pck

Post by aluigi »

My fault in a checking instruction in the script.
Script now fixed
Raylee
Posts: 12
Joined: Tue Mar 31, 2020 10:09 pm

Re: Swordsman Online .pck

Post by Raylee »

Hey aluigi,

Thank you very much for your awesome support!

Your script works now <3

How much do I owe you?
Do you have a Paypal Address?


Thank you for everything!!

Best regards
Raylee
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Swordsman Online .pck

Post by aluigi »

Ah ah ah, don't worry that's already good for me since we now have a solution for the topic.

Indeed I didn't know that PCK and PKX were connected (that's why my old post of 2018 didn't answer properly) so I'm very happy that we now have a so simple solution thanks to your interest in the topic.