Heap Overruns are a thing of the past!

Incredible discovery by CarLuver69

User avatar
dummiesboy
MM2X Super Active User
MM2X Super Active User
Posts: 2425
Joined: Thu Jul 24, 2008 2:00 am
Location: ´Murca

Heap Overruns are a thing of the past!

Postby dummiesboy » Wed May 11, 2016 7:56 pm

Last night, CarLuver69 discovered how to modify the EXE to increase the heap memory size, effectively eliminating heap overrun errors for good!

If you open your exe in a hex editor and go to offset 15DB, you should see a value of 02. This is your heap size, and 02 represents the default of 32MB. You can change this to any size you want within reason, and MM2 will go with it!

Sizes up to 1 GB have been confirmed stable, with 2 GB causing crashes.
32 MB = 02
64 MB = 04
128 MB = 08
256 MB = 10
512 MB = 20
1024 MB = 40

This is the result of 256 MB, which is more than enough for anything currently released for MM2. I'm able to run MC1 London with Riva's Traffic Pack set to full density, all while driving a high poly addon car!
Image

Aaro4130 further tested this by downloading the same traffic mod, setting it to full density, and running a race with the NFS Undercover mod!
Image

Finally, we had the idea to increase traffic density to ludicrous levels with Riva's mod, just to see how far it would go. Once again, rock steady! Although with an understandable impact to framerate...
Image

The sky is the limit now, guys! :D
Last edited by dummiesboy on Wed May 11, 2016 8:15 pm, edited 3 times in total.
Image

User avatar
sajmon14
MM2X VIP Member
MM2X VIP Member
Posts: 5319
Joined: Wed Feb 13, 2008 1:00 am
Location: Poland
Contact:

Postby sajmon14 » Wed May 11, 2016 8:04 pm

Is it a coincidence that the adress is 15 D B? :P :)

User avatar
Franch88
MM2X Admin
MM2X Admin
Posts: 15681
Joined: Thu May 31, 2007 2:00 am
Location: Italy
Likes received: 1 like
Contact:

Postby Franch88 » Wed May 11, 2016 8:10 pm

Oh wow, that's an awesome discover! :o This limit had to be absolutely hardcoded in the game EXE, and in fact it's so, great work to have found it! :D What those screenshots are showing is impressive. :) I'm going to try it. :D
This game never fails to astonish us. :P
Fiat 500 = Italian motorization. Franch88, MM2 eXtreme forum and website Administrator.
|Franch88's MM2 Releases|

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2400
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Wed May 11, 2016 8:33 pm

You missed the best picture ;)
Image
[img]http://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]http://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

User avatar
The_Most_Wanted
MM2X Active User
MM2X Active User
Posts: 960
Joined: Mon Oct 15, 2012 2:00 am
Location: Egypt

Postby The_Most_Wanted » Wed May 11, 2016 8:39 pm

Awesome work, the best thing ever made for MM2! :D
Image
Best Midtown Madness 2 car converter of the year
Best Midtown Madness 2 innovation of the year
Author of the best Midtown Madness 2 mod of the year

Image
Best Midtown Madness 2 breakout of the year
Author of the best Midtown Madness 2 car add-on of the year

Image

User avatar
dummiesboy
MM2X Super Active User
MM2X Super Active User
Posts: 2425
Joined: Thu Jul 24, 2008 2:00 am
Location: ´Murca

Postby dummiesboy » Wed May 11, 2016 8:44 pm

Is it a coincidence that the adress is 15 D B? :P :)
Hehe, I noticed that. Too bad I can't take credit for this one. :P
This game never fails to astonish us. :P
You're telling me. With all of these guys coming in to mod the EXE, we could be seeing some more improvements soon enough.
You missed the best picture ;)
Lol. Well at least you remembered.


Franch, do you think this topic is worth a sticky? That online play topic is outdated, it could be replaced.
Image

User avatar
FXANBSS
MM2X Active User
MM2X Active User
Posts: 685
Joined: Sun Mar 10, 2013 1:00 am
Location: Midtown Club, Discord
Likes received: 4 likes

Postby FXANBSS » Wed May 11, 2016 9:06 pm

Holy...

I just hope that a EXE will released, for now, i will do it myself.

BTW, that highway screenshot...
It has the traffic density over %100? Is that possible?


OK, LETS PUT ENTIRE WEBSITES OF MODS ON IT
Last edited by FXANBSS on Wed May 11, 2016 9:31 pm, edited 1 time in total.

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2400
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Wed May 11, 2016 9:26 pm

Holy...

I just hope that a EXE will released.

BTW, that highway screenshot...
It has the traffic density over %100? Is that possible?


OK, LETS PUT ENTIRE WEBSITES OF MODS ON IT
Actually it technically is 1.0. The game by default , will multiply your traffic density by 0.2. I just set the multiplier to 1 for fun :D
[img]http://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]http://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

User avatar
dummiesboy
MM2X Super Active User
MM2X Super Active User
Posts: 2425
Joined: Thu Jul 24, 2008 2:00 am
Location: ´Murca

Postby dummiesboy » Wed May 11, 2016 9:28 pm

I just hope that a EXE will released.
An EXE wouldn't be ideal since there are alot of versions out there. A patcher though, that could work...
Image

User avatar
Franch88
MM2X Admin
MM2X Admin
Posts: 15681
Joined: Thu May 31, 2007 2:00 am
Location: Italy
Likes received: 1 like
Contact:

Postby Franch88 » Wed May 11, 2016 10:42 pm

Yeah, impressive screenshot, Aaro. :D

However, I can't seem to find that offset value. I've looked for the one named 00015DB0 and there's no "02" value in the row. I'm using HxD tool.
Franch, do you think this topic is worth a sticky? That online play topic is outdated, it could be replaced.
I've done more setting it as announcement. :wink:
I just hope that a EXE will released.
An EXE wouldn't be ideal since there are alot of versions out there. A patcher though, that could work...
The idea of a patcher is perfect because of this reason, and to make this discover easily applicable.
Fiat 500 = Italian motorization. Franch88, MM2 eXtreme forum and website Administrator.
|Franch88's MM2 Releases|

User avatar
dummiesboy
MM2X Super Active User
MM2X Super Active User
Posts: 2425
Joined: Thu Jul 24, 2008 2:00 am
Location: ´Murca

Postby dummiesboy » Wed May 11, 2016 11:16 pm

The byte you need to change is a few to the right, at 15DB. ;)
Image

Jeremiahjobling
MM2X Occasional User
MM2X Occasional User
Posts: 286
Joined: Fri Dec 30, 2011 1:00 am
Location: London
Likes received: 1 like

Postby Jeremiahjobling » Wed May 11, 2016 11:22 pm

That is cool

User avatar
Franch88
MM2X Admin
MM2X Admin
Posts: 15681
Joined: Thu May 31, 2007 2:00 am
Location: Italy
Likes received: 1 like
Contact:

Postby Franch88 » Thu May 12, 2016 12:22 am

Ok, I've found the way: I had to look at the offset row 000015D0 and at the column 0B (it's the way HxD tool displays them, apparently). :)

With a value of 10, the game is able to load at the first loading more than 30 high polygons add-on cars (I've added various made by HQTM-Team). Higher values doesn't seem to give a change about the first game loading, as it always crashes with more add-on vehicles added (at least 40).
No problems with loading the MC London with Riva's Traffic Mod V4, the maximum amount of traffic and pedestrians densities, and playing an high polygons vehicle (more than 60000).
Spectacular! :D
Fiat 500 = Italian motorization. Franch88, MM2 eXtreme forum and website Administrator.
|Franch88's MM2 Releases|

User avatar
BUGATTIMAN253MPH
MM2X Very Active User
MM2X Very Active User
Posts: 1295
Joined: Wed Mar 09, 2011 1:00 am
Location: Ireland
Contact:

Postby BUGATTIMAN253MPH » Thu May 12, 2016 12:34 am

Image
Would '04' be the one or does it definitely have to be 02?
Image
Best Midtown Madness 2 car converter of the year
Best Midtown Madness 2 car converter of the year
Author of the best Midtown Madness 2 car add-on of the year
Best active member Midtown Madness 1 screenshot-er

Image
Best active member avatar
Best Midtown Madness 2 breakout of the year
Funniest active member

User avatar
Franch88
MM2X Admin
MM2X Admin
Posts: 15681
Joined: Thu May 31, 2007 2:00 am
Location: Italy
Likes received: 1 like
Contact:

Postby Franch88 » Thu May 12, 2016 12:39 am

You're doing my same error, BUGATTIMAN253MPH. :wink:
As I've said in the above post, look at the row called 000015D0, and not 00015DB0; then, looking at the very top row next to "Offset (h)", see the crossing value at the column called 0B. You'll find the value 02 to change. :wink:
Fiat 500 = Italian motorization. Franch88, MM2 eXtreme forum and website Administrator.
|Franch88's MM2 Releases|