LEGO Star Wars: The Video Game - PS2

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

LEGO Star Wars: The Video Game - PS2

Post by AlphaTwentyThree »

I've been trying to write a script for the main archive of this game for over an hour now and I give up. I just cannot figure out how to code the folder structure into my script. The implementation in Watto GameExtractor is wrong as it doesn't consider base folders.
First of all, here's the last 1mb of the archive: http://www90.zippyshare.com/v/YuPHEr6C/file.html
Now, here's part of my script:

Code: Select all

goto 0x24ad957c
get FILES long
for i = 0 < FILES
   get OFFSET long
   get SIZE long
   get ZSIZE long
   get CIDENT long # compression identifier
   putArray 0 i OFFSET
   putArray 1 i SIZE
   putArray 2 i ZSIZE
next i
get ENTRIES long
get UNK long
savepos NAMEBIAS
xmath NAMEBIAS "ENTRIES * 8 + NAMEBIAS"
set k -1
set FOLDER "."
for i = 0 < ENTRIES
   get NAMEPOS long
   get UNK byte
   get LAST byte
   get IDENT short
   savepos MYOFF
   math NAMEPOS += NAMEBIAS
   goto NAMEPOS
   get NAME string
   # here comes the name creation
next i

The confusion starts with the fields IDENT and LAST that determine when a name is a folder or a sub-folder. What I understand so far is:
- IDENT == 0 -> NAME = folder name
- IDENT != 0 -> NAME = file name
- LAST == 1 -> NAME is last file in current folder, go one folder level up ("cd ..")
- LAST == 0, IDENT != 0 -> NAME is last file in folder, next NAME is a sub-folder
- LAST == 0, IDENT == 0 -> NAME is folder, next NAME is another sub-folder
- LAST == 1, IDENT == 0 -> ???
I'm not entirely sure if that is how the identifiers work because I'm not even able to program these instructions into a script. Can somebody help me out here? I'd be very thankful!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: LEGO Star Wars: The Video Game - PS2

Post by aluigi »

Can you provide also the beginning of the archive?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: LEGO Star Wars: The Video Game - PS2

Post by aluigi »

Have you already tried this script?
http://aluigi.org/bms/finding_nemo.bms

Also ttgames.bms and crash_bandicoot_ttgames.bms are very similar if not even compatible.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: LEGO Star Wars: The Video Game - PS2

Post by AlphaTwentyThree »

Ha! The Crash Bandicoot script works! :) Thanks for linking! :D
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: LEGO Star Wars: The Video Game - PS2

Post by aluigi »

Really? Cool! :D