Guardians of Middle-Earth

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Doctor Loboto
Posts: 376
Joined: Sun May 31, 2015 2:23 am

Guardians of Middle-Earth

Post by Doctor Loboto »

So apparently a new update has occurred in which the format changed on the archives. I need to get the models and textures out.

https://www.dropbox.com/s/52ijkaal3uqxtrq/Layer01.Arch04?dl=0
Doctor Loboto
Posts: 376
Joined: Sun May 31, 2015 2:23 am

Re: Guardians of Middle-Earth

Post by Doctor Loboto »

Sorry, I seem to have posted that link before the upload was complete. It should be up now.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Guardians of Middle-Earth

Post by aluigi »

What's the problem with that archive?
My fear.bms 0.6.1 seems to work correctly with it:
http://aluigi.org/bms/fear.bms
Doctor Loboto
Posts: 376
Joined: Sun May 31, 2015 2:23 am

Re: Guardians of Middle-Earth

Post by Doctor Loboto »

Oh, thanks! That seemed to work. However the bndl script seems to error on some of them, here's one such file.

https://www.dropbox.com/s/1fqs4gwxrw0itb0/champ_goblinking_hirez.bndl?dl=0
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Guardians of Middle-Earth

Post by aluigi »

I have no problems with that file.
I used shadow_of_mordor.bms 0.3.1 and quickbms 0.6.7a
Doctor Loboto
Posts: 376
Joined: Sun May 31, 2015 2:23 am

Re: Guardians of Middle-Earth

Post by Doctor Loboto »

Oh, awesome! Thank you very much for clearing this up for me.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Guardians of Middle-Earth

Post by AlphaTwentyThree »

Really sorry to necro-post!
The fear script produces a compression error when trying to extract files from the PS3 version of GoME: https://1fichier.com/?erqcyey395sa3wfbq4u0
Could this be updated?
Thanks!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Guardians of Middle-Earth

Post by aluigi »

I just checked it and in my opinion the script is "almost" correct.
The only problem is that the size of the file on disk is 3 bytes bigger than the real one and it causes the OFFSET < LIMIT check to fail (0x05caea7d vs 0x05caea80).
I just updated the script for checking the aligned OFFSET instead of OFFSET
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Guardians of Middle-Earth

Post by AlphaTwentyThree »

Ha, maybe even an oversight of the developers. Anyway, thanks a lot, Luigi! I'd have done it myself but you know how hard it is to read someone else's scripts. ;)
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Guardians of Middle-Earth

Post by AlphaTwentyThree »

So sorry, need to post again - PSN version works, XBLA still gives me that same decompression error: https://1fichier.com/?klws91vn98kxz7tqjtm9
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Guardians of Middle-Earth

Post by aluigi »

I only have a partial answer for that.
The first thing to change in ZIP_DUMP is keeping only the Clog instruction activated if 'SIGN == "HBEK"' because there are no chunks in the file you provided.
The other thing is the compression algorithm that I think it's xmemdecompress but it crashes.
I have no solution at the moment.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Guardians of Middle-Earth

Post by AlphaTwentyThree »

Alright, I will fiddle around with this when I have the time. Thanks.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Guardians of Middle-Earth

Post by AlphaTwentyThree »

Ok, it's actually XMEMLZX from offset 4. I dumped the compressed data and tested with a file I know the contents of.

However, if I adjust the script to your guideline (incl. adjusted OFFSET/ZSIZE) and try it on another file than the one uploaded, the script:
- truncates every file at 64KB
- correctly extracts files <64KB
- still gives a compression error at a certain point

This is the adjustment I made

Code: Select all

startfunction ZIP_DUMP
   comtype xmemlzx
   math OFFSET += 4
   math ZSIZE -= 4
   clog FNAME OFFSET ZSIZE SIZE
endfuncition


For the uploaded archive, the script actually crashes quickbms - never seen that happen actually.
Here's the archive I'm trying this on at the moment (sorry to post such a large file): https://1fichier.com/?orzszk3tvqs8tf0d6jx4

Any further help would be highly appreciated! :)
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Guardians of Middle-Earth

Post by AlphaTwentyThree »

Oh and here's a sample file, one time the dumped compressed one plus the truncated decompressed one.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Guardians of Middle-Earth

Post by AlphaTwentyThree »

any ideas, Luigi?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Guardians of Middle-Earth

Post by aluigi »

It's a chunked format identical/similar to the one implemented for LTAR/LTAX.

Decompressor example for the sample you provided:

Code: Select all

comtype xmemdecompress
endian big
math CHUNK_SIZE = 0x10000
get ZSIZE asize
get NAME basename
log NAME 0 0
append
for OFFSET = 0 != ZSIZE
    goto OFFSET
    get CHUNK_ZSIZE long
    savepos OFFSET
    clog NAME OFFSET CHUNK_ZSIZE CHUNK_SIZE
    math OFFSET + CHUNK_ZSIZE
    math OFFSET x 4
next
append
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Guardians of Middle-Earth

Post by aluigi »

This is the patch for the script to work with these archives:
Old:

Code: Select all

elif SIGN == "RATL"
    set SIGN string "LTAR"
New:

Code: Select all

elif SIGN == "RATL"
    comtype xmemdecompress
    set SIGN string "LTAX"


P.S.: yeah, both PSN and XBLA samples are the same RATL but they are handled in two different ways. I have no idea how to recognize what's the format for each one. The only difference is DUMMY2 which is 0xe for the former and 0xd for the latter (on some PC samples i'ts 0xb), I don't know if it's related. ZIP is 9 for both.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Guardians of Middle-Earth

Post by AlphaTwentyThree »

Alright, works now. :D
I've attached the script so people can quickly get it. ;)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Guardians of Middle-Earth

Post by aluigi »

I also updated the fear script checking that DUMMY2 field together with LTAR, hopefully that 0xd is used on xbox archives only.