Unlimited objects in Battlecraft 1942

Ask questions, discuss ideas, get answers

Unlimited objects in Battlecraft 1942

Postby Skull Kid » Fri Jan 24, 2020 3:21 pm

It seems I've been able to patch the Battlecraft 1942 executable (bc42.exe) with OllyDBG (a x86 disassembler) to load an unlimited amount of objects. So far, no error message, including the "more than 1024 objects, rest is truncated." or anything as such.

I don't know if there are any who will benefit from this, but I could post the patched bc42.exe here, if anybody's interested.
Regards,

Skull Kid
User avatar
Skull Kid
 
Posts: 143
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Unlimited objects in Battlecraft 1942

Postby Diamondback » Fri Jan 24, 2020 7:28 pm

Please do post it. I am however worried about the performance issues of going over the limit when you test the map.
See my Strasbourg map project here.
Diamondback
 
Posts: 517
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada

Re: Unlimited objects in Battlecraft 1942

Postby Skull Kid » Fri Jan 24, 2020 7:44 pm

I found a problem though... when trying to select an object instead of "(None)", Battlecraft 1942 crashes... still want the executable? You will have to find a way to spawn new objects if you really need to I'm sorry to say. I will look into it. I used the x86 debugger OllyDBG to accomplish this.
Attachments
bc42_unlimited.zip
(760.22 KiB) Downloaded 192 times
Regards,

Skull Kid
User avatar
Skull Kid
 
Posts: 143
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Unlimited objects in Battlecraft 1942

Postby duffman » Mon Feb 03, 2020 10:15 am

very Interesting...

I have had to do some nifty workarounds to be able to add x4 times as much contents on
a map. Mostly by splitting the StaticObjects.con into 4 different areas NE,SE,SW,NW etc (different files for BF1942 to load).

The limitation in BC1942 doesnt exist in BF1942 it will x4 that contents easy..

What did you find when debugging? hard-coded limit (value) set somewhere?

If it is a hard-coded value then there most likely is a second part to it, as in it will go like this:

(programmer sets: max_number_of_objects=1024)

allocate memory for "pointers" to 1024 objects <--- FIND THIS ONE AND INCREASE
if max_number_of_objects IS EQUAL 1024 then dont load more else we might crash <-- YOU FOUND THIS ONE

back in the day of 32bit a "pointer" its x4 bytes address to tell where the object is stored in memory.. a look-up list..
so the allocate memory for this table of "pointers" is actually x4 ... aka something like 4096 (0x1000)
there would be probably be a malloc (memory allocate call with that value somewhere that correspond to 1024
(but would look like x4 aka 4096) you found.. as in the allocated memory size only fits 1024...
but those limitations are not a problem today..)
learnmore info on malloc: https://www.cs.uaf.edu/2010/fall/cs301/ ... alloc.html

Not sure how much knowledge you have in asm and c/c++ and the debugger.. so wrote generically as easy as I could (hopefully it was helpful!).
If I had more time in my day I would loved to get my hands dirty right here..

Since you are debugging hard... the one biggest annoying thing about BC1942 (except the one above) is the damn
"loading/splash dialog" ... the first thing that pops up "battlecraft develop by bla bla" that sits there and waits for you to click it...
then finally loads the rest... find the "call" to that one and replace it with NOP's (No OPeration) or if you can make it go away instantly it would
soo make my day better... anyway I a big wish from me...

Well done on finding and patching that limit in the first place!!


Duffman
duffman
 
Posts: 40
Joined: Tue Apr 15, 2014 8:02 am

Re: Unlimited objects in Battlecraft 1942

Postby Skull Kid » Mon Feb 03, 2020 1:03 pm

Hey, thanks Duffman :) Yes, I have mostly followed guides on YouTube. But I am now using x64DBG as OllyDBG doesn't work with 64-bit applications, and x64DBG is a little more convenient to use in my opinion.

I still cannot get all objects to load in Battlecraft 1942 though... in Forgotten Hope Secret Weapon, I load Alpenfestung-1945 for example, and I still get errors. the limit must be in the .lst file in Battlecraft 1942 as well, somewhere...

EDIT: Done! Here's the Battlecraft 1942 executable, without an object limit, or splash screen. Patched with x64DBG :)

EDIT2: Here's what I found in x64DBG, when I set to find the object limit.

First instruction
Second instruction
Attachments
bc42_nosplash_unlimited_objects.zip
(760.27 KiB) Downloaded 214 times
Regards,

Skull Kid
User avatar
Skull Kid
 
Posts: 143
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Unlimited objects in Battlecraft 1942

Postby Crash42modder » Mon Feb 03, 2020 1:21 pm

Interesting!
Crash42modder
 
Posts: 16
Joined: Mon Feb 03, 2020 7:15 am

Re: Unlimited objects in Battlecraft 1942

Postby Diamondback » Mon Feb 03, 2020 10:05 pm

Good work Skull Kid!
See my Strasbourg map project here.
Diamondback
 
Posts: 517
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada

Re: Unlimited objects in Battlecraft 1942

Postby Skull Kid » Tue Feb 04, 2020 7:28 am

Thanks Diamondback!

I will try to see what causes Battlecraft 1942 not to load all objects from the .lst file. Currently, there must be one more limit...
Regards,

Skull Kid
User avatar
Skull Kid
 
Posts: 143
Joined: Fri Aug 03, 2012 8:44 pm
Location: Sweden

Re: Unlimited objects in Battlecraft 1942

Postby Grabbi » Thu Feb 06, 2020 8:39 pm

wish we had this already 10 years ago !


Great job!


Best regards


Grabbi
Image
User avatar
Grabbi
 
Posts: 42
Joined: Wed Aug 03, 2011 3:37 pm
Location: Germany

Re: Unlimited objects in Battlecraft 1942

Postby Crash42modder » Fri Feb 07, 2020 4:49 am

Nice. I'll test it later tonight.
Crash42modder
 
Posts: 16
Joined: Mon Feb 03, 2020 7:15 am

Next

Return to 1942 Modding Discussion

Who is online

Users browsing this forum: No registered users and 43 guests

cron