Jump to content
JrMasterModelBuilder

LEGO.jam File Extractor

Recommended Posts

JrMasterModelBuilder

With some help from the file format information jamesster found on Xentax I have made a JAM extractor. For the amount of information it has to process, it's rather fast, but it will hang there for a bit as it processes all the files (so have patience). Without further ado, here it is:

JAM Extractor
 

Latest Downloads:

 

Other Links:

 
Extract your download to find the main "JAMExtractor" executable (all files are required, do not separate them or it will not work).

 
Usage
You can run it by the command line or, on Windows, simply drag-and-drop the LEGO.JAM file onto the main executable and wait for it to finish creating a folder next to the original file. To recompile, simply drop a folder onto the main executable and it will create a JAM file. >If you have the 1999 version of the game, it is unnecessary to rebuild a JAM archive. It is possible to have the program also print the files being processed as the program runs if you add an "--verbose" to the arguments.
 
>Still need a GUI? Check out this topic.
 
 
Important Notes
The LJAM file format does not allow file or folder names to contain more than 12 characters. As of version 1.0.2, the program will skip over file and folder whose names are longer than 12 characters. Thus, any files and folders you create within the JAM archive's folders that have names longer than 12 characters will automatically be excluded when creating a new JAM archive. Older versions would only use the first 12 characters of the name as the file name and would include them.

 

Alternately, you can use the source code from the GitHub repository with a Python interpreter. As of version 1.0.2, JAM Extractor is compatible with Python 2.7 and newer, older versions are compatible with 3.0 and newer.

Share this post


Link to post
Share on other sites
jamesster

... How the heck did I not see this until now.

Anyways, trying it out now... :D

Well, like you said, it does the same thing as GameExtractor. Didn't Cyrem once say what exactly was wrong with how the xentax thingy said to extract the files? Also, we've gotta figure out how to modify stuff like the collision and 3D models... I wanna make custom tracks and open up those removed shortcuts eventually.

Ah, here it is:

Share this post


Link to post
Share on other sites
Cyrem

I haven't tried this yet, but regarding missing files....

If you start looking through the header, you'll see filenames which it do not extract with game extractor(particularly the strings file which I modified to do the screenshot in my gallery). Strider told me quite some time ago that:

The specs are at Xentax except it is slightly wrong in that 'else if (numFiles == 0)' should not be there - they are not exclusive. That is what caused that other tool to miss some files.

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

I see what you mean. There are some more files listed. The only thing is, how are they referenced. From my understanding, it only knows it's dealing with folders when "numFiles == 0". If numFiles does equal 0, and there are files there, how does it know where they begin?

Some info I don't yet understand, there appear to be some files listed after the end of the COMMON folder list. Just before that, there's the following:

....ENGLISH..... ;..DANISH......Å’;..DUTCH.......ø;..FINNISH.....d<..FRENCH......Ã<..GERMAN......<=..ITALIAN.....¨=..NORWEGI......>..SPANISH.....€>..SWEDISH.....ì>..
0A 00 00 00 45 4E 47 4C 49 53 48 00 00 00 00 00 20 3B 00 00 44 41 4E 49 53 48 00 00 00 00 00 00 8C 3B 00 00 44 55 54 43 48 00 00 00 00 00 00 00 F8 3B 00 00 46 49 4E 4E 49 53 48 00 00 00 00 00 64 3C 00 00 46 52 45 4E 43 48 00 00 00 00 00 00 D0 3C 00 00 47 45 52 4D 41 4E 00 00 00 00 00 00 3C 3D 00 00 49 54 41 4C 49 41 4E 00 00 00 00 00 A8 3D 00 00 4E 4F 52 57 45 47 49 00 00 00 00 00 14 3E 00 00 53 50 41 4E 49 53 48 00 00 00 00 00 80 3E 00 00 53 57 45 44 49 53 48 00 00 00 00 00 EC 3E 00 00

The first byte: 0A is 10 in decimal, which is also how many language strings there are. And thier length appears to be consistent with folders.

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

New version available! I believe it now extracts all files. Curiousely, it seems all the files together are larger than the original archive.

Share this post


Link to post
Share on other sites
jamesster

The new version extracted around 5,000 files, the old version did around 3,000. Thing is, what folders are these 2,000 new files n?i Never mind that.

So, now we need to figure out how to open and modify these extracted files and rebuild them... It's times like this when I wish I didn't stink at programming anything more advanced then a LEGO Mindstorms robot. :|

Share this post


Link to post
Share on other sites
McStudz

It's times like this when I wish I didn't stink at programming anything more advanced then a LEGO Mindstorms robot. :|

Pffft. You should be me: FOUR CLASSES of learning how to mess around operate the Mindstorms NXT 2.0 set, and I STILL can't seem to program it to do awesome things!

Still, i'm looking forward to getting back home (AFTER my grounding's over at home) and screwing around with the .jam extractor thingy.

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

The new version extracted around 5,000 files, the old version did around 3,000. Thing is, what folders are these 2,000 new files n?i Never mind that.

So, now we need to figure out how to open and modify these extracted files and rebuild them... It's times like this when I wish I didn't stink at programming anything more advanced then a LEGO Mindstorms robot. :|

I'm going to try to write a rearchiver.

Don't know much about Mindstorms I'm affraid. (The used 1.5 RCX I got on the cheap doesn't seem to want to let me download the firmware [plus that aweful Shockwave CD tutorial walktrough thing is so frustratingly "user friendly" to the point where you just want to smash it].)

But for learning coding, all I can say is start easy and keep at it. I sucked bad once. There's really only 3 major coding language types that they're all derived from (ones really a mark-up language). ECMACcript (my personal favorite), Basic style (don't much care for it but it's alright), and HTML type languages (the mark-up language which is just formatting and data storage, you can't really make software with it). They all have the same basic logic and reaction idea with variables, if statements, loops, arrays, and functions. The only real difference being how you write it and the APIs.

EDIT: Been looking at the new extracted folders and it looks like a lot of the .MIB files have folders associated with them.

Share this post


Link to post
Share on other sites
Cyrem

Congrats, you did it. This gets those SRF files and stuff.

You can now use my SRF Builder to turn the string files into readable txt files and back again.

BTW: Why not upload it into the Lego Racers category?

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

Congrats, you did it. This gets those SRF files and stuff.

You can now use my SRF Builder to turn the string files into readable txt files and back again.

BTW: Why not upload it into the Lego Racers category?

Thanks!

You SRF Builder works great! I'll see if I can get a rearchiver working so we can get the SRFs back in the game.

Good idea! Added.

UPDATE

New version available. See topic post. This version has the same functionality of 1.1 with a simplified extraction process no 2 button process) and some further optimization (so I hope it's faster). It also has the ability to create JAM files that meet the file format specifications as I currently understand them. Unfortunately, I extracted and re-built the archive for LEGO Racers and found that while my tool is completely compatible with the JAM files it creates, LEGO Racers is not (I get a "fatal error" about an "emitter.wdb" file). I'm still investigating why this is, but no doubt it's related to the fact that after rearchiving the JAM file, the LEGO.JAM file became approximately 11 times bigger. I believe that there may be duplicate files in multiple folders that are optimized out or something. If anyone can knows or can figure out anything about this, that would be great!

A note to users, the JAM file format does not allow file names (including file extension) and folder names to exceed 12 characters in length and also does not permit spaces to appear in the file name.

Share this post


Link to post
Share on other sites
jamesster

I'm still investigating why this is, but no doubt it's related to the fact that after rearchiving the JAM file, the LEGO.JAM file became approximately 11 times bigger.

sensei_wu_fail.png

lol, sorry, couldn't resist. :P Good progress though, looks like we're well on our way to LR1 mods! :D

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

I'm still investigating why this is, but no doubt it's related to the fact that after rearchiving the JAM file, the LEGO.JAM file became approximately 11 times bigger.

sensei_wu_fail.png

lol, sorry, couldn't resist. :P Good progress though, looks like we're well on our way to LR1 mods! :D

:)

I got it this time!

I change the bitmap in the top left from Johnny Thunder to Gypsy Moth without a hex editor:

changeofimages.png

Not very ambitious I know, but. . .

The new version is available in the topic post. The issue with the last version and the reason the file size exploded was that because of the way the writeBytes AIR function works, zero byte files would write all the bytes from the offset to the end of the file resulting in very large files where there should be blank ones. That issue is now fixed and LEGO Racers will now use the JAM files it creates! My tool actually creates a slightly smaller file size than the original JAM as there are no extra bytes at all in the JAM files it creates.

Share this post


Link to post
Share on other sites
jamesster

WOOT! :lol: This is great!

My first mod. :P

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

WOOT! :lol: This is great!

My first mod. :P

Cool!

I've been playing around with changing the SRF files:

jmmbwashere.png

Not sure what happened to the quit menu, but. . .

Now if only I could figure out those bitmaps.

Share this post


Link to post
Share on other sites
AppliArt

Hey,

For the past years I've been trying to get any information about the .JAM file format, and now I see someone finally did it. Great news!

Well, I tried the extractor, and it works rather good! Too bad the image files are not usable at the moment, aswell as the .pcm files, but I'm working on those! I'll report my findings here.

And if someone finds a way to open the image files, I'd be glad to do a retexture of the game! :)

Greetings,

Jimi

Share this post


Link to post
Share on other sites
aLPHA

Did I miss something guys? How are the images not usable? Alien format?

Share this post


Link to post
Share on other sites
AppliArt

Did I miss something guys? How are the images not usable? Alien format?

They are BMP files and I simply can't open them, in either Windows's inbuilt photoviewer, aswell as in Irfanview. Oh well, I'll try it on my other pc. :P

Share this post


Link to post
Share on other sites
AppliArt

So it gives an error when you try to open it?

Yeah, but JrMaster already aknowlegded the problem, so I'm not the only person who has problems opening them.

Edit: Great news folks! I found a way to open and listen to the .pcm files which are all over the place in the extracted LEGO.JAM files.

I identified them as ADPCM (just like the .tun files) but I needed to play a bit with the sampling rates in order to get them right.

So, what you need to do is grab your favourite audio editor (audicity is used here as example). Open the .pcm file as Raw Data(import > raw data).

Then, for the options in the Raw Data window :

Encoding 	VOX ADPCM

Byte Order	No endian

Channels	1 channel (mono)

Start		0 byte	

Amount		100%

Sample Rate	12000Hz	

Now you'll have the right sound! Click play to listen. :)

Here'san example. This is the sound when you use powerslide.

Share this post


Link to post
Share on other sites
aLPHA

Well done! Are they just sounds, or are the music files in there too?

Share this post


Link to post
Share on other sites
AppliArt

Well done! Are they just sounds, or are the music files in there too?

The music files can be found in the Lego Racers root folder, not in the .JAM file.

EDIT: Found an interesting sound clip in the RACEC2R0 folder (which stands for Races 3, Track 0) => Knightmare-athon.

The sound clip where i'm talking about is BOULDOOR.pcm, which could stand for "Boulder door", which is maybe the sound which would have played when you shot at the boulder door shortcut in the Lego Racers beta track Knightmare-athon. Who knows? :)

Share this post


Link to post
Share on other sites
aLPHA

Did anybody find the model files for the models? If this is incredibly modable like LRR, then we might have to change this to Rock Raiders 'n Racers United xD

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

Hey,

For the past years I've been trying to get any information about the .JAM file format, and now I see someone finally did it. Great news!

Well, I tried the extractor, and it works rather good! Too bad the image files are not usable at the moment, aswell as the .pcm files, but I'm working on those! I'll report my findings here.

And if someone finds a way to open the image files, I'd be glad to do a retexture of the game! :)

Greetings,

Jimi

So it gives an error when you try to open it?

Yeah, but JrMaster already aknowlegded the problem, so I'm not the only person who has problems opening them.

Edit: Great news folks! I found a way to open and listen to the .pcm files which are all over the place in the extracted LEGO.JAM files.

I identified them as ADPCM (just like the .tun files) but I needed to play a bit with the sampling rates in order to get them right.

So, what you need to do is grab your favourite audio editor (audicity is used here as example). Open the .pcm file as Raw Data(import > raw data).

Then, for the options in the Raw Data window :

Encoding 	VOX ADPCM

Byte Order	No endian

Channels	1 channel (mono)

Start		0 byte	

Amount		100%

Sample Rate	12000Hz	

Now you'll have the right sound! Click play to listen. :)

Here'san example. This is the sound when you use powerslide.

Right now my best guess is the bitmaps are headerless 8-bit or 16-bit bitmaps (I'm leaning towards 8-bit). At present, I have no idea what to do to figure them out.

Great work with the audio files! I'll have to give it a try when I get time.

Here's a list of the track folders:

RACEC0R0 = Royal Knights Raceway

RACEC0R1 = Imperial Grand Prix

RACEC0R2 = Desert Adventure Dragway

RACEC0R3 = Magma Moon Meltdown

RACEC1R0 = Dark Forest Dash

RACEC1R1 = Tribal Island Trial

RACEC1R2 = Amazon Adventure Alley

RACEC1R3 = Ice Planet Pathway

RACEC2R0 = Knightmare-Athon

RACEC2R1 = Pirate Skull Pass

RACEC2R2 = Adventure Temple Trial

RACEC2R3 = Alien Rally Astroid

RACEC3R0 = Rocket Racer Run

TEST = Test Track

Each folder contains several main files of the same name as the folder (experimentation shows that the game looks for them based on the main folder name plus their extensions).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.