This thread is intended for the efforts to interface with wizards.exe from an external program.
Thoughts?
Thoughts?
--I like ILSe
As a French person I feel like it's my duty to explain strikes to you. - AdrienIer |
Mindy - Assembly interface
|
This thread is intended for the efforts to interface with wizards.exe from an external program.
Thoughts?
--I like ILSe
Relevant information gathered:
I'm updating this post with the confirmed information about Unit_strategy_exe(). Code: +0x43 is the target battleunit id (0-18)
--I like ILSe
Jtm Wrote:I've made a demo external ai for combatting. You must run MoM under DOSBox. Demo is user controlled. With 'attack <user_id>' command, you can direct the ai units and attack anyone, even ai's own units. Jtm Wrote:By the way, I've updated the external ai demo so that it allows changing the strategy. I suggest trying strategies 104 and 105 lol. Demo also allows manual targeting of any coordinate but the functionality does not work well if at all. Also, unfortunately the 106 does not look like the moving strategy. I guess we still need to figure out what all the numbers do. It appears indeed that the x and y coordinates do not seem to do anything as far as strategy is concerned. It seems that the target battleUnitID (at +0x43) determines where a unit goes. That would make it a bit harder to make a unit attack the wall. It may well be that the current code does not allow for it.
--I like ILSe
Jtm, can you add an extra option <Enter> to accept the current action?
And also show the information what the current target xpos,ypos is (since tweaker does not show that)? You may also want to show what the currently targeted unit is.
--I like ILSe
I've tweaked the assembly code that interfaces with MoM.
It now implements the interface Kyrub suggested. kyrub Wrote:Personnally, I think you (or we) should remake the combat AI setup to: The various data is made accessible through the stack. To achieve it, I've saved the BP register in DS:9294, which I've labeled "baseptr". To raise or retract the hook the code can be changed directly at the "loc_HOOK" point. To make MoM wait or release it DS:9296 is used, which I've labeled "bait". The "parm1" and "parm2" parameters still need to be hooked though. For those interested, this is the assembly code I wrote. It's supposed to be written at offset 0x889E4 in WIZARDS.EXE. Code: .8086 ;Target processor.
--I like ILSe
As i wrote, this is work version of int3f interface. The actually code starts from 9c .before it there is a way to attach resident to int3f. It hook any call 380:25 in mom and return ax=10 instead.
This cause mana range penalty=1 in any battle. How its work?start dosbox, start momint ,start wizards,any version after vanilla. You see range=1 in any battle. Close dosbox after use.if you'll use lhup,this resident will eat significant less memory. If you want,i can prepare version to change wizards the way you want. The main advantage this work with any mod,fast and upgrade easily. Later i'll change this example into any chaneller gets 1/2 mana penalty,like in 1.2 patch. Asfex Wrote:As i wrote, this is work version of int3f interface. The actually code starts from 9c .before it there is a way to attach resident to int3f. It hook any call 380:25 in mom and return ax=10 instead. I've tried to analyze it, but as yet I don't understand the code. Apparently is starts with a dos call to free memory??? What do you mean by a call 380:25? Quote:If you want,i can prepare version to change wizards the way you want. Please do. I am intrigued by the possible advantages your method may bring.
--I like ILSe
call 380:25 is what you see in the wizards.exe. its "cd 25 00 80 03". this is translated to stub*:25 and then jump to the ovl70h:1d2dh. same as ovl 112:1d2d . its mana_range_penalty prosedure, as it named in the ida database. 112=70h = 380h/8.
about program: first, it frees dos environment ,then hook int 1C (timer user interrupt), then exit and stay resident. then int 1c spy for int 3f in order to find mom there. if it found, it patch mom's int3f ,and this (1ch) interupt do not need more. the last part of code (starts from 9c) is the int3f hook. it spy for the needed call (380:25) when it occur, and translate it into codesegment where this overlay has been loaded already. (at this point it was loaded just, ds is the segment of relocation table; es is the segment of the jumptable). then see the jumptable and found the adress to jump (1d2d). its a start of subroutine "mana_range_penalty". it moves to the begin of this the sequence "mov ax,10;retn". any time this overlay has been loaded in memory,this int3f occur. if it not has not loaded,then it remain unchanged,therefore the changes preserve (mov ax,0a; retn). Also i plan implement 'int 87 y x',which will call ovlx:y . Edit:add example for 'edit 889e4',for Ilse mindy,4 post above. Alas,this does not work with later insecticide,becouse it patch the same place in the mom. Technicaly,it activates at the army_autocombat instead of unit_strategy,the last sub havenot own active entry point.
Very interesting!
I just spend some time on it to try and understand what you are writing. It looks like something that has a lot of potential.
However, I'm afraid that it is as yet beyond me. I'm getting lost in the complexities of the mechanism. Btw, as an alternative to a terminate-and-stay-resident program, isn't it an option to change the INT 3F routine in MoM directly?
--I like ILSe
I like Serena Wrote:Btw, as an alternative to a terminate-and-stay-resident program, isn't it an option to change the INT 3F routine in MoM directly?For what? Can you guarant no int 3f happens,while you are modifying this interrupt? For creating semaphore the commands like 'lock ;btt *;jz 'is the shortest way. |