I've been wanting to be able to mod these games for a while, but hit a road block with the .lbx file format that all the data is enclosed in.
Well today I ran across a website where someone who did some hex editing was nice enough to layout his findings on the file format:
Being a programmer myself, I decided to write a quick tool capable of extracting files from .lbx archives and rebuilding an archive from those files as a first step to being able to mod both games (I believe they use a common file format, but ive only tried this on techname.lbx so far).
The tool works like outlined below (its command line driven, ie dos prompt). I'll use the convention of typing in CAPS what you type and lower case for program output:
Dos prompt:
LBXTOOL
Build .lbx from a directory or extract an lbx to a directory? (B/E) EXTRACT (e would be enough)
Enter Filename of the lbx archive: TECHNAME.LBX
Number of files to extract: 6
Offset: File #0 = 2048
Offset: File #1 = 10653
Offset: File #2 = 19918
Offset: File #3 = 30365
Offset: File #4 = 40364
Offset: File #5 = 49846
Offset: File #6 = 58451
Exiting Tool.
The results would be that the 6 files which were archived in technames.lbx would be outputted to File1.txt through File6.txt (they may not be text files, but .txt makes it easy to edit and see...unfortunately file names are not part of the archive)
In reverse:
LBXTOOL
Build .lbx from a directory or extract an lbx to a directory? (B/E) B
Enter LBX archive name to build: TEST.LBX
# of files to include: 6 (I entered the 6)
Size of file #1 = 8605
Size of file #2 = 9265
Size of file #3 = 10447
Size of file #4 = 9999
Size of file #5 = 9482
Size of file #6 = 8605
Archiving: file1.txt (8605 bytes)
Archiving: file2.txt (9265 bytes)
Archiving: file3.txt (10447 bytes)
Archiving: file4.txt (9999 bytes)
Archiving: file5.txt (9482 bytes)
Archiving: file6.txt (8605 bytes)
Exiting Tool.
The files have to be named file1.txt through file6.txt, they are all put in test.lbx (or whatever you asked to call it).
I've only tried this on technames.lbx. So far I've successfully extracted the 6 files in the archive (they seem to be all the tech names in the game, 1 file per language). Then rebuilt the archive as test.lbx which I copied over my original techname.lbx in the moo2 folder and successfully run the game. I have not tried to make any actual modifications yet
I'm including the source code with the lbx extractor/builder in case I made a mistake someone else can fix. I'm hoping there's enough other moo1/moo2 fans around here who have also wanted to mod the game to help find out which data files in which lbx archives control different things like research speed, etc. (I say that cause i'm hoping for a slowdown tech mod for moo2 ;P)
Note, One assumption I made which may not always be valid is the first file in the archive should always begin at position 2048 in the .lbx archive. I did this mostly because it was the case with techname.lbx and seemed reasonable enough.
Edit: Ooops, Initial version was opening the files in ascii instead of binary mode, Didn't notice my mistake till I tried to extract a large lbx file. No one had downloaded it yet though so no worries.
Well today I ran across a website where someone who did some hex editing was nice enough to layout his findings on the file format:
Being a programmer myself, I decided to write a quick tool capable of extracting files from .lbx archives and rebuilding an archive from those files as a first step to being able to mod both games (I believe they use a common file format, but ive only tried this on techname.lbx so far).
The tool works like outlined below (its command line driven, ie dos prompt). I'll use the convention of typing in CAPS what you type and lower case for program output:
Dos prompt:
LBXTOOL
Build .lbx from a directory or extract an lbx to a directory? (B/E) EXTRACT (e would be enough)
Enter Filename of the lbx archive: TECHNAME.LBX
Number of files to extract: 6
Offset: File #0 = 2048
Offset: File #1 = 10653
Offset: File #2 = 19918
Offset: File #3 = 30365
Offset: File #4 = 40364
Offset: File #5 = 49846
Offset: File #6 = 58451
Exiting Tool.
The results would be that the 6 files which were archived in technames.lbx would be outputted to File1.txt through File6.txt (they may not be text files, but .txt makes it easy to edit and see...unfortunately file names are not part of the archive)
In reverse:
LBXTOOL
Build .lbx from a directory or extract an lbx to a directory? (B/E) B
Enter LBX archive name to build: TEST.LBX
# of files to include: 6 (I entered the 6)
Size of file #1 = 8605
Size of file #2 = 9265
Size of file #3 = 10447
Size of file #4 = 9999
Size of file #5 = 9482
Size of file #6 = 8605
Archiving: file1.txt (8605 bytes)
Archiving: file2.txt (9265 bytes)
Archiving: file3.txt (10447 bytes)
Archiving: file4.txt (9999 bytes)
Archiving: file5.txt (9482 bytes)
Archiving: file6.txt (8605 bytes)
Exiting Tool.
The files have to be named file1.txt through file6.txt, they are all put in test.lbx (or whatever you asked to call it).
I've only tried this on technames.lbx. So far I've successfully extracted the 6 files in the archive (they seem to be all the tech names in the game, 1 file per language). Then rebuilt the archive as test.lbx which I copied over my original techname.lbx in the moo2 folder and successfully run the game. I have not tried to make any actual modifications yet
I'm including the source code with the lbx extractor/builder in case I made a mistake someone else can fix. I'm hoping there's enough other moo1/moo2 fans around here who have also wanted to mod the game to help find out which data files in which lbx archives control different things like research speed, etc. (I say that cause i'm hoping for a slowdown tech mod for moo2 ;P)
Note, One assumption I made which may not always be valid is the first file in the archive should always begin at position 2048 in the .lbx archive. I did this mostly because it was the case with techname.lbx and seemed reasonable enough.
Edit: Ooops, Initial version was opening the files in ascii instead of binary mode, Didn't notice my mistake till I tried to extract a large lbx file. No one had downloaded it yet though so no worries.
Comment