Reimport .unity3d package

Doubts, help and support about QuickBMS and other game research tools
iji
Posts: 5
Joined: Sun Aug 19, 2018 2:01 am

Reimport .unity3d package

Post by iji »

Hello, I used quickbms with this script http://aluigi.altervista.org/papers/bms ... player.bms to extract a unity webplayer file, everything worked flawlessly, however I can't reimport modified files to the package (tried a lot of stuff, like -r -r)

Can anyone help me out? Thanks a lot
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Reimport .unity3d package

Post by aluigi »

The script can't be used for reimporting because it uses a memory file, basically it makes 2 jobs in one script: decompressing the archive and extracting the files from the decompressed archive.
Splitting the script in 2 parts may work but the uncompressed archive will not be loaded by the game because it has no headers so then you should "reimport" it too back in the original unity3d file... it's prone to problems.
iji
Posts: 5
Joined: Sun Aug 19, 2018 2:01 am

Re: Reimport .unity3d package

Post by iji »

Can replacing the old file with a new smaller file and recompressing the archive work?

Just so I can understand, is compressing the archive again a problem?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Reimport .unity3d package

Post by aluigi »

The answer to both the question is that it "may" be a problem and may not work.

I have splitted the script for you:

Script 1:

Code: Select all

endian big
comtype lzma86head
idstring "UnityWeb"
get DUMMY long
get VER1 byte
get VER2 string
get VER3 string
get SIZE long
get DUMMY short # not supported at the moment
get OFFSET short

get DUMMY long
get ENTRIES long
for i = 0 < ENTRIES # last entry remain saved
    get ZSIZE long
    get SIZE long
next i
get LAST_OFFSET long
get DUMMY byte

get NAME filename
string NAME += "_unpacked"
clog NAME OFFSET ZSIZE SIZE

Script 2:

Code: Select all

get PATH filename
get FILES long
for i = 0 < FILES
    get NAME string
    get OFFSET long
    get SIZE long
    set FNAME string PATH
    string FNAME += /
    string FNAME += NAME
    log FNAME OFFSET SIZE
next i


Extraction: script 1 + script 2
Reimporting: script 2 + script 1

It may be chaotic due to the presence of 2 scripts and 2 files but try it and if you are lucky it will work but the risk the game will refuse the edited archive is very high.
Let me know your results, that's the max I can do.
iji
Posts: 5
Joined: Sun Aug 19, 2018 2:01 am

Re: Reimport .unity3d package

Post by iji »

Thanks for the answer, however i'm getting "incomplete input file" error because of "clog NAME OFFSET SIZE SIZE" what does that line do?
I'm supposed to concatenate the two scripts right? Or can I input two scripts in quickbms?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Reimport .unity3d package

Post by aluigi »

My fault, I forgot a 'Z' in the ZSIZE of the first script
iji
Posts: 5
Joined: Sun Aug 19, 2018 2:01 am

Re: Reimport .unity3d package

Post by iji »

Thanks a lot I appreciate the help, however the script now throws this error:

Code: Select all

Error: incomplete input file 0: file.unity3d
       Can't read 515880 bytes from offset 004021d0.
       Anyway don't worry, it's possible that the BMS script has been written
       to exit in this way if it's reached the end of the archive so check it
       or contact its author or verify that all the files have been extracted.
       Please check the following coverage information to know if it's ok.

  coverage file 0   187%   7881394    4202960    . offset 004021d0

Last script line before the error or that produced the error:
  34  log FNAME OFFSET SIZE


I tried tweaking the script myself without success
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Reimport .unity3d package

Post by aluigi »

You must use script 2 on the file generated by script 1, obviously :D
iji
Posts: 5
Joined: Sun Aug 19, 2018 2:01 am

Re: Reimport .unity3d package

Post by iji »

I think there is a problem with the second script, the first one generate an unpacked file but the second give one 0 byte file and this error :

Code: Select all

10   log FNAME OFFSET SIZE


Sorry for the annoyance :D
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Reimport .unity3d package

Post by aluigi »

Honestly I don't see any error.
It's just the original script splitted in 2 parts, if the original script worked then these 2 one work too.
Sorry.