LOTR : Conquest - Script reimport error

Doubts, help and support about QuickBMS and other game research tools
Aaranel13
Posts: 1
Joined: Thu Sep 03, 2020 10:41 pm

LOTR : Conquest - Script reimport error

Post by Aaranel13 »

Hello !
I'm sorry if my english is not correct. ^^
Before I explain my problem, I wanted to thank for all the work that has been done on QuickBMS, this is great tool which is very useful.

To sum up, I've used the script available for this game (it's actually great to see at least a script available for this game, since the format of the files are quite horrible to read), I've modified some files that were extracted from the .PAK files of the game and I wanted to reimport them. Unfortunately, it didn't worked.
I wasn't aware that there was an issue with scripts using MEMORY_FILEs. I felt dumb for not checking what the reimport mode could do or not. I was about to give up but then I wanted to know if it was possible to, maybe, modify the script and avoid using MEMORY_FILEs.
Just wanted to know if it's possible, then I could try to learn how .bms scripts work and change this script.

The link of the script :
https://aluigi.altervista.org/bms/lotr_conquest.bms
The link of an example of a .PAK file :
http://www.mediafire.com/file/pc84lwlv0 ... a.PAK/file

Thank you in advance to anyone who may be able to help me.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: LOTR : Conquest - Script reimport error

Post by aluigi »

It's not impossible but it's very difficult that it's going to work because there are two big chunks of compressed data that contains all the files, then there is a second part that dumps additional stuff.

So it's not possible to avoid the memory file, it's possible to split the script in two parts where you can use the first part to reimport the files in the two chunks and the second part for compressing these two chunks.

Use this script for both extraction and reimporting:

Code: Select all

get EXT extension
if EXT == "pak"

    get DUMMY long
    get SOME_TABLE_OFFSET long
    get DUMMY long  # 0x13
    get DUMMY long  # 0x1
    get STRINGS_OFF long
    get DUMMY long
    get DUMMY long

    for i = 0 < 2   # only two?
        get OFFSET long
        get SIZE long
        get ZSIZE long
        get INFO_OFF long
        string NAME p "part%d_0x%08x" i INFO_OFF
        clog NAME OFFSET ZSIZE SIZE
    next i

else

    get INFO_OFF basename
    string INFO_OFF ! "_"
    goto INFO_OFF
    get ZERO long
    get FILES long
    getdstring ZERO 8
    for j = 0 < FILES
        get DUMMY long
        get OFFSET long
        get SIZE long
        math OFFSET += INFO_OFF
        log "" OFFSET SIZE
    next j

endif


Extraction (it will ask you to create these 3 folders):

Code: Select all

quickbms script.bms Moria.PAK Moria
quickbms script.bms Moria\part0_0x00528300 Moria\part0
quickbms script.bms Moria\part1_0x00000000 Moria\part1


Reimporting:

Code: Select all

quickbms -r -r -w script.bms Moria\part0_0x00528300 Moria\part0
quickbms -r -r -w script.bms Moria\part1_0x00000000 Moria\part1
quickbms -r -r -w script.bms Moria.PAK Moria


Hope it helps.