Script invalid for reimporting because it uses Memory files?

Doubts, help and support about QuickBMS and other game research tools
yeziirl
Posts: 8
Joined: Fri Nov 18, 2016 11:21 am

Script invalid for reimporting because it uses Memory files?

Post by yeziirl »

Then how do I reimport the file back?
I read that MEMORY files that use append are not supported but how then I reimport it? I'm not good at programming
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Script invalid for reimporting because it uses Memory files?

Post by aluigi »

Some versions ago I worked on the reimporting of memory files and in my (simple) tests it worked but in practice it looks like there are problems.
memory files are used with content that can't be dumped in one operation but requires multiple operations like chunked files or multiple level of encryptions.
In some scripts (like asura.bms) a memory or temporary file is used for the compressed archives for automatically decompressing and extracting them in a transparent way for the user.

In short there is no solution to the problem.
Anyway what's the script you are using?
yeziirl
Posts: 8
Joined: Fri Nov 18, 2016 11:21 am

Re: Script invalid for reimporting because it uses Memory files?

Post by yeziirl »

aluigi wrote:Some versions ago I worked on the reimporting of memory files and in my (simple) tests it worked but in practice it looks like there are problems.
memory files are used with content that can't be dumped in one operation but requires multiple operations like chunked files or multiple level of encryptions.
In some scripts (like asura.bms) a memory or temporary file is used for the compressed archives for automatically decompressing and extracting them in a transparent way for the user.

In short there is no solution to the problem.
Anyway what's the script you are using?


http://aluigi.altervista.org/bms/arcsys.bms
This one, thank you so much for reply!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Script invalid for reimporting because it uses Memory files?

Post by aluigi »

That script is like asura.bms so there are some chances of using it in reimport mode but it's necessary to split it in 2 parts and removing all the references to MEMORY_FILE, currently I can't help you so you have to wait.
yeziirl
Posts: 8
Joined: Fri Nov 18, 2016 11:21 am

Re: Script invalid for reimporting because it uses Memory files?

Post by yeziirl »

aluigi wrote:That script is like asura.bms so there are some chances of using it in reimport mode but it's necessary to split it in 2 parts and removing all the references to MEMORY_FILE, currently I can't help you so you have to wait.


Sure, I will wait. Thank you so much for trying to help!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Script invalid for reimporting because it uses Memory files?

Post by aluigi »

I'm checking the script just now.
The script is able to handle 3 different formats that are basically just the same archive that can be splitted in compressed chunks (segs), compressed (dfas) and not compressed (pfd).

The problem is the first one, the chunks-based format.
I don't know if the game runs with a dfas or pfd archive if it expects a segs one, probably not.

That's the first part of the script, the second part is not a problem.
Anyway if you want to test:

STEP1.bms:

Code: Select all

get BASE_NAME basename
string BASE_NAME += /
comtype deflate
endian big
getdstring SIGN 4
math WORKAROUND = 0
if SIGN == "segs"
    get DUMMY short
    get CHUNKS short
    get FULL_SIZE long
    get FULL_ZSIZE long
    savepos BASE_OFF
    xmath BASE_OFF "BASE_OFF + (CHUNKS * 8)"
    #putvarchr "step1.dat" 0 FULL_SIZE
    log "step1.dat" 0 0
    append
    for i = 0 < CHUNKS
        get ZSIZE short
        get SIZE short
        get OFFSET long
        math OFFSET -= 1
        if i == 0
        if OFFSET == 0
            math WORKAROUND = 1
        endif
        endif
        if WORKAROUND != 0
            math OFFSET + BASE_OFF
        endif
        if SIZE == 0
            math SIZE = 0x00010000
        endif
        clog "step1.dat" OFFSET ZSIZE SIZE
    next i
    append
elif SIGN == "DFAS"
    endian little
    comtype zlib
    idstring "FPAC"
    get SIZE long
    get ZSIZE long
    savepos OFFSET
    clog "step1.dat" OFFSET ZSIZE SIZE
else
    # pfd
    get SIZE asize
    log "step1.dat" 0 SIZE
endif

STEP2.bms:

Code: Select all

goto 0 
get FULL_SIZE asize
endian big
getdstring TYPE 4
if TYPE == ""   # pfd
    get DUMMY long
    get DUMMY long
    get FILES long
    savepos BASE_OFF
    for BASE_OFF = BASE_OFF < FULL_SIZE
        get HEADDATA_SIZE long
        get SIZE long
        get OFFSET long
        get DUMMY long
        get DUMMY long
        get NAME string
        math OFFSET += BASE_OFF
        set FNAME string BASE_NAME
        string FNAME += NAME
        log FNAME OFFSET SIZE
        math BASE_OFF += HEADDATA_SIZE
        goto BASE_OFF
    next
elif TYPE == "FPAC"
    endian little
    get BASE_OFF long
    get TOT_SIZE long
    if TOT_SIZE != FULL_SIZE
      endian big
      ReverseLong BASE_OFF
      ReverseLong TOT_SIZE
    endif
    get FILES long
    get DUMMY long
    get NAMELEN long
    get DUMMY long
    get DUMMY long
    for i = 0 < FILES
       getdstring NAME NAMELEN
       get FILEID long
       get OFFSET long
       get SIZE long
       Padding 16  0
       math OFFSET += BASE_OFF
       set FNAME string BASE_NAME
       string FNAME += NAME
       log FNAME OFFSET SIZE
    next i
else
    get NAME basename
    get EXT extension
    string NAME += "_unpacked."
    string NAME += EXT
    set FNAME string BASE_NAME
    string FNAME += NAME
    log FNAME 0 FULL_SIZE
endif

As you can see it's just like the original script but it's splitted in 2 parts and all the references to the output memory_file have been replaced with "step1.dat", while the input memory_file have been just removed
solidsnake122492
Posts: 1
Joined: Tue Feb 11, 2020 1:50 am

Re: Script invalid for reimporting because it uses Memory files?

Post by solidsnake122492 »

hi I tried the script with the new code, but it still doesn't work to re-import the files, you won't have a solution?
Thank you!!!