Saboteur Luap for xbox360

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
mte90
Posts: 5
Joined: Thu Dec 24, 2020 8:40 pm

Saboteur Luap for xbox360

Post by mte90 »

Based on viewtopic.php?f=9&t=213&hilit=luap I tried to export the file from the LuaScripts.luap file but the package released for xbox360 is different.
If I use the script for pc works but on luap cannot find anything also if I think that the file package is similar as I can see that some things are very similar.

Experimenting showed that the FILES variable with the luap file from xbox360 it is a long number negative -1358954496 instead on the pc for the same file is 321 (the size is different).

https://filetransfer.io/data-package/Dfy0Gtrs#link

At that link there is a zip package with the pc version and the xbox360 to do a comparison and in the meantime I will keep investigating, but I am not sure about what are the difference, if files is negative the loop doesn't work, if I force the loop with a fixed number there is another error Can't read 12 bytes from offset 5f0e0000.

I tested comtype-scan.bms with no results, wondering if the file is signed so cannot scan like the pc version.
mte90
Posts: 5
Joined: Thu Dec 24, 2020 8:40 pm

Re: Saboteur Luap for xbox360

Post by mte90 »

So on my investigation also about how quickbms works, get FILES long takes the first 4 bytes that is

Code: Select all

4101 = 321
in this way does the loop but on the xbox version those 4 bytes are

Code: Select all

0000
, so probably the file number is in another byte.
mte90
Posts: 5
Joined: Thu Dec 24, 2020 8:40 pm

Re: Saboteur Luap for xbox360

Post by mte90 »

Other investigation showed that the end of the files it's the same so I am testing in a different way, with ignoring the first bytes of the file:

Code: Select all

get TEMP threebyte
get FILES byte
print "%FILES%"

for i = 0 < FILES
    getdstring HASH 8
    get DUMMY threebyte
    get OFFSET long # is 3679 should be around 6740
    math OFFSET s 2
    get SIZE threebyte # 00 00 D8 04 instead of 00 00 04 D8
    math SIZE s 2
    get DUMMY2 byte
    get XSIZE threebyte
    math XSIZE s 2
    print "%OFFSET% %OFFSET|h%"
    print "%SIZE% %SIZE|h%"
    print "%XSIZE% %XSIZE|h%"

    savepos TMP
    goto OFFSET
    getdstring DUMMY 12
    get NAMESZ long
    getdstring NAME NAMESZ
    string NAME | ":"
    goto TMP

    log NAME OFFSET SIZE
next i


Searching for .lua in the pc version there are 332 reference and in the xbox360 instead 186, as we know that the pc version is 321 probably the xbox version is around 186 and as this snippet the files are 175. I think that I am near also because seems that the first file is the same by name in both so size should be similar is just to define the dummy bytes to me.

I just need a bit of help on understanding how to swap the bytes, as I can see the values are mirrored compared to the pc version.
mte90
Posts: 5
Joined: Thu Dec 24, 2020 8:40 pm

Re: Saboteur Luap for xbox360

Post by mte90 »

I am almost, break with the last file but I am right to the end.

Code: Select all

get FILES long
reverselong FILES
print "%FILES%"

for i = 0 < FILES
    getdstring HASH 8
    get OFFSET long
    reverselong OFFSET
    get SIZE long
    reverselong SIZE
    get XSIZE long
    reverselong XSIZE
    get DUMMY byte
    print "%OFFSET% %OFFSET|h%"

    savepos TMP
    goto OFFSET
    get NAMESZ short
    getdstring DUMMY 12
    print "%NAMESZ% %NAMESZ|h%"
    getdstring NAME NAMESZ
    print "%NAME% %NAME|h%"
    string NAME | ":"
    goto TMP

    log NAME OFFSET SIZE
next i
mte90
Posts: 5
Joined: Thu Dec 24, 2020 8:40 pm

Re: Saboteur Luap for xbox360

Post by mte90 »

To avoid any troubles I put a fixed value to look for the filename to avoid issues.

Code: Select all

get FILES long
reverselong FILES

for i = 0 < FILES
    getdstring HASH 8
    get OFFSET long
    reverselong OFFSET
    get SIZE long
    reverselong SIZE
    get XSIZE long
    reverselong XSIZE
    get DUMMY byte

    savepos TMP
    goto OFFSET
    set NAMESZ 120 # fixed value because the data is not consistent
    getdstring DUMMY 17
    getdstring NAME NAMESZ
    string NAME | ":"
    goto TMP

    log NAME OFFSET SIZE
next i


This extractor works :-D
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Saboteur Luap for xbox360

Post by aluigi »

If the problem is just the endianess you can use the following command in the original script:

Code: Select all

endian big

Or even better, after "get FILES long" using "endian guess FILES" which will do it automatically ;)