Renegade Projects Network Forums

Full Version: Patching extra functionality into <gamemd.exe>
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
new countries work, just don't confise them with sides.

only thing missing from countries is taunts for multiplayer games when you press f5-f12
ok, here is my first patch to contribute, its a patch to enable taunts for all countries
First number is the address in a disk file, second one is the old number at that spot (basing off the current patch) and third one is the new number to put there.
Its untested at the moment because I cant play online nor do I have new countries available to mess with.
00352BAC: B3 E4
00352C94: 90 E9
00352C95: 90 67
00352C96: 90 D3
00352C97: 90 44
00352C98: 90 00
004A4000: 90 51
004A4001: 90 0F
004A4002: 90 BE
004A4003: 90 C0
004A4004: 90 50
004A4005: 90 68
004A4006: 90 20
004A4007: 90 00
004A4008: 90 BA
004A4009: 90 00
004A400A: 90 E9
004A400B: 90 32
004A400C: 90 2C
004A400D: 90 BB
004A400E: 90 FF
004A4020: 90 74
004A4021: 90 61
004A4022: 90 75
004A4023: 90 6E
004A4024: 90 74
004A4025: 90 73
004A4026: 90 5C
004A4027: 90 74
004A4028: 90 61
004A4029: 90 75
004A402A: 90 25
004A402B: 90 30
004A402C: 90 32
004A402D: 90 69
004A402E: 90 25
004A402F: 90 30
004A4030: 90 32
004A4031: 90 69
004A4032: 90 2E
004A4033: 90 77
004A4034: 90 61
004A4035: 90 76
004A4036: 90 00

The existing countries keep the same taunt filenames, the new ones use taunts\tau##^^.wav (I have to keep the filename the same length as the old filename due to the size of the memory buffer used to hold the final filename)
## is the 2 digits of the country number
^^ is the 2 digits of the taunt number
This works for all countries including GDI, Nod, Neutral and Special

what it does is as follows
1.Changes the ja instruction at 00752BAA to jump to 00752C94 instead of 00752C63 (00752C94 is in the "empty space" just after the function)
2.Puts a jump at 00752C94 to jump to BA0000 (start of my new code)
3.Puts new code at 00BA0000 to do this:
push ecx ; push the country number
movsx eax, al ; grab the taunt number
push eax ; push the taunt number
push offset <string> ; push the string "taunts\tau%02i%02i.wav"
jmp 752C41 ; jump back to the origonal code

At 752C41 is then code that pushes the memory address to store the completed string into then calls sprintf to create the final filename which is then passed on to the sound playing code.

If you make the above changes on a copy of gamemd.exe with the most recent patch from PaD applied, it should work (back it up first obviouslySmile. Can someone with the setup to do so test this to see if it works?

This is the first patch from me for RA2 but I assure you it wont be the last Smile
Well I was planning to use another filename format, but that's a change that can be done in half a minute...
Good job Smile

EDIT:
I sent a test version for testing FourthPowerPlant= to Bobinabout who told me the AI still builds the soviet power plant...

I just tested it myself, with the result that I played against a perfectly working 4th side AI.
I dunno what Bobing did wrong, but at least I know my stuff works Big Grin

EVEN ANOTHER EDIT:
Heck, just viewing my code and found this:
Code:
xor edx,eax
It should be xor edx,edx; makes edx zero.
Shift eyes One of the stupidest mistakes you can make. I fixed it.
That means: ChronoBeams aren't green anymore Smile
Here is the stuff I am going to consider for my next patch: (some of it is stuff I can almost certainly do, some of it is stuff that might be harder but I will see what I can come up with). For most of these, the hard part is FINDING the needed code Smile
1.Make tank bunker allow locomotors other than ground (i.e. hover, subterrainian, amphibious)
2.Implementing the TiberiumToSpawn= setting from Firestorm into YR (i.e. specify what kind of tiberium to spawn for a given tiberium tree)
3.Make UseOwnName=true usable on vehicles
4.Make it so that either Thief=Yes is not needed to make VehicleThief=Yes work or anything Thief=Yes triggers is not triggered if VehicleThief=Yes is enabled.
5.Add Capturable= tag to vehicles (set to no to make the vehicle unstealable, default would be Yes)
6.Fix the IE HoverPad=yes (What triggers the IE? Which superweapon(s) and is it AI, players or both?)
7.Make HarvestersPerRefinery= usable (exactly what does it do anyway? What needs to be fixed?)
8.Make Sensors=Yes and Cloaked=Yes work on buildings
9.bring back "different voxels for amphibious units going over water" logic from TS (if possible)
10.Mouse cursor stuff (e.g. caryall logic sequences, heal action sequences, custom cursors for custom actions etc)
11.Un hard-code the refinery dock location
12.Make it possible to add more overlays to the game (This would include ways to tell the game what the new overlays are for. Also, are there any other things e.g. Trees, scorch marks etc that you cant add more of?)
13.Add new bridge types (i.e. make train bridges work etc). Perhaps only one bridge type for train bridges by making the existing train bridge overlays work as bridge overlays again)
14.Make the Ice logic work
and 15.Make it possible to add totally new terrain theaters to RA2 (complete with all the settings)

Firstly, I want answers to the questions I ask above.
And secondly I want people to tell me which of these I should devote my time to.
6. When AI uses Weather Storm/Nuke.
7. It tells AI how many harvesters to build per each refinery. Right now, only one of the AI players actually builds them, and the rest sit there day-dreaming.

IMO, #1 and #3 should be easiest, yet there is some more tank bunker stuff which should be fixed also. As for what other people want, http://www.modenc.renegadeprojects.com/ind....001pd_Votelist
1. Might be difficult. Robot Tank is hover, what happens if a Robot Tank shuts down whilst inside a Tank Bunker? This might be the reason why other locomotors were not permitted.

The other Tank Bunker problem is:
If you use a SellUnit superweapon on a Tank Bunkered unit, the Tank Bunker breaks. Then, selling or destroying the broken Bunker causes an IE. This makes the SellUnit superweapon unusable.

6. If an AI player uses a Nuclear Missile or Weather Storm, and a building with HoverPad=yes exists, an IE occurs. (human players aren't a problem and I don't think other super weapons are)
This is also the thing I want the most out of your considerations.
For the first tank bunker issue, dont permit anything with PoweredUnit=Yes on it to enter the bunker.
Problem solved.
The other tank bunker issue I have no idea how to fix.

What should I do in skirmish to get the AI to use Nuke or Weather Sorm? (i.e. to trigger the IE?)
Use HoverPad=yes on the Allied Repair Depot.
Set recharge time of Nuke down to, say, 1 minute.
You be Allied, AI be Soviet.
Build Repair Depot, wait for AI to build and use Nuke.
Can someone check if units with PoweredUnit=Yes and ground locomotor are allowed into the tank bunker or not?
5. Adding NonVehicle to a vehicle already prevents it being stolen by a human player (I've tested this and despite what others have said it works). You get a no entry cursor and although the thief will move to the unit when clicked on, it will never enter and steal it. I don't know if it stops the AI, since I haven't created AI triggers to make it try and steal an unstealable unit. NonVehicle does have other side effects though allegedly (I haven't tested these), it stops the Repair IFV being able to target the unit and repair it though the RepairDepot buildings still can. Also, NonVehicle is supposed to stop a Carryall picking up the unit, but it doesn't. Really we need seperate tags for stopping carryall and for stopping thiefs without stopping repair IFV.

12. I don't think anyone has tried to add additional craters and scorch marks to the game, but I know a few people have added additional terrain objects like trees without any problems.

Edit: BTW Marshall, what does the patch look for when working out if it can patch or not. I had problems running the 1.001 patch on a re-install of YR I did over an existing install since I re-installed windows and lost all the registry settings. To make sure I had the 1.001 versions of everything I have a backup RA2 folder which is an image of a pristine 1.001 install so I just copied that over everything, but the 1.04 patch won't run. Is there a reg key that gets set to tell the game its version 1.001?
Well...my corpses were craters and scorches...so I guess I did add them...
Blade Wrote:what does the patch look for when working out if it can patch or not. I had problems running the 1.001 patch on a re-install of YR I did over an existing install since I re-installed windows and lost all the registry settings. To make sure I had the 1.001 versions of everything I have a backup RA2 folder which is an image of a pristine 1.001 install so I just copied that over everything, but the 1.04 patch won't run. Is there a reg key that gets set to tell the game its version 1.001?

it is the same problem I got
the patch is looking for gamemd.exe 1.001
and i think yes for an registery data too

I reinstalled my windows too and then tried to install the patch and got an error
also there is some files (mods,maps) I didn't want to loose, so that what I did(and that what you need to do):
1. Renamed my game folder c:\games\ra2 to c:\games\ra2old
2. Installed a new red alert 2 into c:\games\ra2
3. Patched it to 1.001
4. moved the gamemd.exe from c:\games\ra2 to c:\games\ra2old (replaced the old file)
5. Deleted the c:\games\ra2 folder
6. renamed the c:\games\ra2old back to c:\games\ra2

7.patched it with the ROCK PATCH with no problems Smile
Blade;date=Apr 24 2005, 01:28 PM Wrote:5. Adding NonVehicle to a vehicle already prevents it being stolen by a human player (I've tested this and despite what others have said it works). You get a no entry cursor and although the thief will move to the unit when clicked on, it will never enter and steal it. I don't know if it stops the AI, since I haven't created AI triggers to make it try and steal an unstealable unit. NonVehicle does have other side effects though allegedly (I haven't tested these), it stops the Repair IFV being able to target the unit and repair it though the RepairDepot buildings still can. Also, NonVehicle is supposed to stop a Carryall picking up the unit, but it doesn't. Really we need seperate tags for stopping carryall and for stopping thiefs without stopping repair IFV.

there are hijackers in my mod, and units with nonvehicle set can't be healed by repair IFVs or any kind of repair tank...
jonwil Wrote:2.Implementing the TiberiumToSpawn= setting from Firestorm into YR (i.e. specify what kind of tiberium to spawn for a given tiberium tree)
Please do this in such a way that encourages the creation of NEW tiberium trees to make use of this feature, rather than changing the 3 existing ones. Changing the resource balance of the existing trees can affect already-existing maps, making the maps unfair.

Quote:4.Make it so that either Thief=Yes is not needed to make VehicleThief=Yes work or anything Thief=Yes triggers is not triggered if VehicleThief=Yes is enabled.
5.Add Capturable= tag to vehicles (set to no to make the vehicle unstealable, default would be Yes)
6.Fix the IE HoverPad=yes (What triggers the IE? Which superweapon(s) and is it AI, players or both?)
Specifically, something is also needed to explicitly disallow a vehicle from repairing on a repair depot. Not just prevent, but also make it so the AI understands that it can't be done. Right now, the AI can repair jumpjet vehicles at repair bays (though human players can't), and it also attempts to send jumpjets to be repaired at shipyards, where they hover forever. Perhaps there is a way to flag a unit to never use the [Repair] mission.

Ignoring the [Repair] mission can have another value, as a property of a teamtype. Then AI teams could be flagged to not break off from their script and go to repair, without having to resort to Aggressive=yes.

Quote:8.Make Sensors=Yes and Cloaked=Yes work on buildings
Sort of related... In RA2, a unit which could see a disguised unit would also reveal that disguise for all other units within attack range. For example, a Yuri Prime could detect a spy, and as a result a friendly sentry gun could start firing on the spy on its own. This does not work in YR.
So, a fix for DetectDisguise= is needed. Also, DetectDisguiseRange= does not work; units with DetectDisguise=yes will automatically attack disguised units within their weapon Range=, ignoring both DetectDisguiseRange= and Sight=. Must be careful to not break the existing relationship between Sight= and weapon Range=, where a unit can attack something even though it can't 'see' it.

Quote:9.bring back "different voxels for amphibious units going over water" logic from TS (if possible)
This was apparently a hack used for one specifically-named pair of voxels (in case you didn't know).

Quote:10.Mouse cursor stuff (e.g. caryall logic sequences, heal action sequences, custom cursors for custom actions etc)
Need a [Cursors] list. Then weapons can use CursorIndex=N, which refers to a cursor on the list. This would be the most versatile, IMO.
@Blade: yes, the version number of YR is stored in the registry and that gets read prior to checking for expandmd01.mix