Sign in to follow this  
WillKirkby

Developer Mode Patcher

Recommended Posts

WillKirkby

I present for your modding pleasure, LR2DeveloperPatcher!
This allows you to run the game with your gamedata extracted, and removes the requirement for a compiled archive.

This performs the binary patch documented by JMMB
It has a built-in gamedata extractor.
This also supports Drome Racers.
 
REQUIRES .NET FRAMEWORK 4.
Version 1.1.5082.38337 (LATEST): LINK

Past builds:
Version 1.0.5082.30975: LINK
 
Changelog
 
(2013-11-30) v1.1.5082.38337
> Added backup feature. The un-patched executable will be moved to (name)-original.exe
> Fixed memory deallocation bug.

(2013-11-30) v1.0.5082.30975
> Initial version.

  • Like 10

Share this post


Link to post
Share on other sites
Shadowblaze

YAAAAAAAAAAAY this is great!

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

Nice! A sincle tool to make LR2 and LDR MOD ready! I've linked to it in both of my topics. Just 2 suggestions:

 

1. Making a backup copy of the original EXE might be a good idea, in case people want to revert back, they won't need to reinstall or get it off of their game CD. If the backup file also has the .exe extension, they could play with MODs and play the untouched game side-by-side.

2. The application doesn't appear to free the memory it uses during extraction. Not an issue for me, be people with limited resources might have it crash if they extract both games without restarting the patcher.

 

Also, I'm just curious and don't care one way or the other, but did you implement the GAMEDATA extraction in C# or bundle UNGTC into the patcher?

Share this post


Link to post
Share on other sites
WillKirkby

1. Making a backup copy of the original EXE might be a good idea, in case people want to revert back, they won't need to reinstall or get it off of their game CD. If the backup file also has the .exe extension, they could play with MODs and play the untouched game side-by-side.

Good call, I'll put this in the next version.

2. The application doesn't appear to free the memory it uses during extraction. Not an issue for me, be people with limited resources might have it crash if they extract both games without restarting the patcher.

Yeah, C# memory management with byte[]s is a bit of a mess. I'll look into it :)

Also, I'm just curious and don't care one way or the other, but did you implement the GAMEDATA extraction in C# or bundle UNGTC into the patcher?

I took the UNGTC source and ported it into C# :) In the process, I found a tiny bug in your code:

https://github.com/JrMasterModelBuilder/UNGTC/blob/master/ungtc.cpp#L410

Line 410, the later bytes of command might not all be there. That is to say, you might be near the end of gamedata_gtc and reading the later bytes for command might be going past the end of the data. I encountered this since C# has bounds checking on array accesses.

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

 

Also, I'm just curious and don't care one way or the other, but did you implement the GAMEDATA extraction in C# or bundle UNGTC into the patcher?

I took the UNGTC source and ported it into C# :) In the process, I found a tiny bug in your code:

https://github.com/JrMasterModelBuilder/UNGTC/blob/master/ungtc.cpp#L410

Line 410, the later bytes of command might not all be there. That is to say, you might be near the end of gamedata_gtc and reading the later bytes for command might be going past the end of the data. I encountered this since C# has bounds checking on array accesses.

 

 

Nice! Hmm, I guess that's possibly true, but I believe that would violate the GTC file format specifications. I think that could only happen with a corrupt GTC file. If that's not the case, let me know!

Share this post


Link to post
Share on other sites
WillKirkby

Nice! Hmm, I guess that's possibly true, but I believe that would violate the GTC file format specifications. I think that could only happen with a corrupt GTC file. If that's not the case, let me know!

It's not the case! I ran into it on my retail LR2 GTC :) It's possible the devs violated the specs as well, you know what programmers are like ;)

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

 

Nice! Hmm, I guess that's possibly true, but I believe that would violate the GTC file format specifications. I think that could only happen with a corrupt GTC file. If that's not the case, let me know!

It's not the case! I ran into it on my retail LR2 GTC :) It's possible the devs violated the specs as well, you know what programmers are like ;)

 

Maybe I'm confused, what exectly is it doing wrong? Is/would it be reading past the end of the file or the end of each individual block?

Share this post


Link to post
Share on other sites
WillKirkby

Maybe I'm confused, what exectly is it doing wrong? Is/would it be reading past the end of the file or the end of each individual block?

End of the file. You're storing the GTC file in memory, in gamedata_gtc.data, which is a char*. In my C# implementation, I used a byte[]. When you populate 'command' on line 410, you read 4 bytes from gamedata_gtc.data, starting at gamedata_gtc.posi. My C# implementation does the same. However, it gets to a state where gamedata_gtc.posi+3 (line 413) is outside the length of the array. Since C++ doesn't have bounds checking, it simply reads from the address it has, taking whatever value was in memory. C# does have bounds checking and throws a nasty Exception unless you manually handle it.

Share this post


Link to post
Share on other sites
JrMasterModelBuilder

I think I see what your saying, though I'm not sure why that would happen since it only reads while(gamedata_gtc.posi < end_of_block). Wouldn't that mean there is trailing data within the data blocks? Also, you said it's reading past the end of the file, so it happens only on the last block?

 

EDIT: origamiguy and I have determined that some compressed blocks (at least the last one), have 3 or fewer garbage bytes after them (not enough to mean anything, possible only to align the data blocks to some prefered offset, or maybe just no good reason what-so-ever). The memory being read by C++, while technically wrong, is actually safe to access and does not impact execution.

Share this post


Link to post
Share on other sites
WillKirkby

v1.1.5082.38337 uploaded - adds backup feature and fixes the memory deallocation bug.

  • Like 1

Share this post


Link to post
Share on other sites
Shadowblaze

Good. I haven't tried it out yet, as my computer is broken, but as soon as I fix it I will try it.

Share this post


Link to post
Share on other sites
le717

Does your C# port work the same way as UNGTC in terms of which archive format (LR2 or DR) you are using and extract to the same location?

 

Great work as usual, Will!

Share this post


Link to post
Share on other sites
Xir

Pros:

-Don't need to recompile

-Don't have to restart the game, just reload the room (like leave and come back).

 

Cons:

-Waiting for recompiling process

-Slower loading times

Share this post


Link to post
Share on other sites
MrElephant

Where can we find models and cars that we created.  Cant seem to find the folders for them.  Second is it possible to put our characters that we make over existing characters?

 

 

Edit: so this is where the textures of our characters are stored?

C:Program Files (x86)LEGO MediaLEGO Racers 2game dataCHARACTERSHEADSTEXTURESPLAYER ONE ANGRY1 FACE.MIP 

for example?

 

So I can just rename it and put it over sparky and he will look like the character that I first created?  

 

And if I may ask where are the helmets/other headgear stored so I can edit other players I challenge if it is possible

 

Second Edit:  Okay so player one did not actually turn out to be who I expected him to be.  He is the buck tooth guy with green pants.  He is the first player you can choose in arcade mode other than your characters, so where is the players that you create data stored? This is what he looks like

2e1f5v7.jpg

Share this post


Link to post
Share on other sites
alan

They are all stored in the savegame file, not anywhere in the root files of the game. I'm not sure where (and I'm way too lazy to look for it) but there is a topic about how to save the own character's car (and figure) into the pre-built garage.

 

Edit: so this is where the textures of our characters are stored? C:Program Files (x86)LEGO MediaLEGO Racers 2game dataCHARACTERSHEADSTEXTURESPLAYER ONE ANGRY1 FACE.MIP  for example?
 

No, the textures - in general all the game files - never change at all, so why should the game save its own textures in another placeholder mip file? It is much easier to save the players' figure configurations in a savegame (that's the savegame's purpose) by referring to the existing texture files.

  • Like 1

Share this post


Link to post
Share on other sites
le717

Don't think this is a bug, but I felt it deserved to be noted.

For my LR2 exe, patching the game without extracting the GTC renders the exe unusable. All it does is open, display a black screen for a second, then close. I don't think this is a bug because according to (my understanding of) JMMB's original post, you had to extract the GTC for the trick to even work.

 

If you want to check my exe to make sure it is not some variant, let me know.

Share this post


Link to post
Share on other sites
Snivyguy80

Ok, so I've extracted the game data, and made my changes to the the car builder. But when I go to the game at that time, the game crashes. I'm assuming Theres another step i'm not aware of or I need a different program altogether for what I'm trying to do.

Share this post


Link to post
Share on other sites
Xir

What exactly did you do to the car builder? The game can be a bit sensitive on file names if you added any new brick/chassis in.

Share this post


Link to post
Share on other sites
Snivyguy80

Basically, I did what was shown in this topic. http://www.rockraidersunited.com/topic/5166-all-brickschassis-all-the-time/ I'm not sure if I can do this with the DMP or If I'll need the UNGTC instead. But since I can't get the UNGTC to work on my pc, I hope there's a way for the DMP to make it work. 

Share this post


Link to post
Share on other sites
Xir

DMP should work, so long as it actually said that the .exe was patched successfully. There really isn't much differences between the two aside from DMP letting you play with extracted files.

Anyhow, does this video help at all? http://www.rockraidersunited.com/topic/5166-all-brickschassis-all-the-time/?do=findComment&comment=96842
The video was created before DMP existed, so UnGTC was used*

Share this post


Link to post
Share on other sites
Snivyguy80

Sweet lord, I just figured out what was wrong. I didn't open UNGTC first, while the 3  files were out of the game folder, meaning it couldn't extract them. God, the littlest things can make big differences eh? Anyway I should be able to get this working now. Thanks. =) 

Edited by Snivyguy80

Share this post


Link to post
Share on other sites
Xir

XP, yeah it's always the little things that catch us.

Share this post


Link to post
Share on other sites
johnnynilsson99

hm tried this mod pacher then when i start drome racers it goes back to the desktop without a reason. strange 

Share this post


Link to post
Share on other sites
Xir

What does your Drome Racers folder looks like, what files are in it? Does a Game Data folder exist and does it contain many many folders in it?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this