Page 1 of 4

Heap Overruns are a thing of the past!

Posted: Wed May 11, 2016 7:56 pm
by dummiesboy
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

Posted: Wed May 11, 2016 8:04 pm
by sajmon14
Is it a coincidence that the adress is 15 D B? :P :)

Posted: Wed May 11, 2016 8:10 pm
by Franch88
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

Posted: Wed May 11, 2016 8:33 pm
by aaro4130
You missed the best picture ;)
Image

Posted: Wed May 11, 2016 8:39 pm
by The_Most_Wanted
Awesome work, the best thing ever made for MM2! :D

Posted: Wed May 11, 2016 8:44 pm
by dummiesboy
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.

Posted: Wed May 11, 2016 9:06 pm
by FXANBSS
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

Posted: Wed May 11, 2016 9:26 pm
by aaro4130
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

Posted: Wed May 11, 2016 9:28 pm
by dummiesboy
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...

Posted: Wed May 11, 2016 10:42 pm
by Franch88
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.

Posted: Wed May 11, 2016 11:16 pm
by dummiesboy
The byte you need to change is a few to the right, at 15DB. ;)

Posted: Wed May 11, 2016 11:22 pm
by Jeremiahjobling
That is cool

Posted: Thu May 12, 2016 12:22 am
by Franch88
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

Posted: Thu May 12, 2016 12:34 am
by BUGATTIMAN253MPH
Image
Would '04' be the one or does it definitely have to be 02?

Posted: Thu May 12, 2016 12:39 am
by Franch88
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: