|
Thread: H4 dll researching | This thread is pages long: 1 2 · «PREV |
|
Pol
Known Hero
.^.
|
posted January 07, 2019 11:57 PM |
|
|
There should be more hidden on the russian df forum. Lost was being an Equi Leading Programmer for quite some time.
But after all that time it looks faster to "re-discover" it again.
|
|
RoseKavalier
Admirable
Supreme Hero
|
posted January 08, 2019 01:53 PM |
bonus applied by Galaad on 10 Jun 2019. |
|
NimoStar said: So you can understand what I am talking about:
The part about abilities in H4 is that the list is not a programmable set of instructions.
Its just like this
6A A0 6A B1 6A 07...
Those aren't instructions by themselves, its just a dataset for the part of the code which is the implementation.
We don't need to change the implementation, at least that wasn't the idea now (anyways the abilities implemented themselves are quite adequate), just that creatures are "Hardcoded" to have a certain number of abilities - for example, just 1 for the minotaur - and there is no space in the code to put more. Reading assembly code is not going to change that.
Therefore what equi team had done is: Take an "unused" chunk of space in h4 .exe code; replace the part on the Orc on the original list for an instruction to jump to that offset; and put after the altered part an instruction to jump back (tyhe formerly "blank" space has more hexes to write a longer list of abilities than the original). The only "programming" bits are the instruction which is a single hex, so seeing it in assembly instead of in hexadecimal is not going to make a difference in that.
Calculating the offsets is the hard part to make the jumps go to the exact hex needed.
I am not saying those tools aren't useful, just that they don't seem to do that, do they?
You can still skip the whole making calculations stuff. I suspect there is a better way to patch creature abilities because 6A A0 6A B1 6A 07... (if that's indeed an example) just sounds like pushing ability IDs on the stack which would later be converted for use in a faster and more convenient manner.
For example let's say the code you showed is at:
0x500000 6A
0x500001 A0
0x500002 6A
0x500003 B1
0x500004 6A
0x500005 07
0x500006 ...
Instead of going to 0x500000 and writing a JMP to 0x700000, copying all the instructions there and adding your own, then writing a jump back to 0x500006, with patcher_x86 and a dll you could make something like:
int __stdcall MinotaurAbilities(LoHook *h, HookContext *c)
{
c->Push(1); // give ability 1
c->Push(2); // give ability 2...
c->Push(3);
c->Push(4);
c->Push(5);
c->Push(6);
c->Push(7);
c->return_address = ...; // set the return address after original code
return NO_EXEC_DEFAULT; // skip the original overwritten code at 0x500000
}
...
_PI->WriteLoHook(0x500000, MinotaurAbilities); // setup the "code cave"
This code will 100% not work (just an example) but it is much less painless to add or remove from it, fix and correct, review later, and share. Plus, you don't need to do hex calculations to place the JMP, patcher_x86 takes care of it.
____________
My Let's Plays: Metataxer's Revenge - The Empire of The World 2
|
|
iliveinabox05
Honorable
Famous Hero
|
posted January 08, 2019 06:22 PM |
|
|
RoseKavalier great posts, definitely deserve a QP for each of them (too bad we don't have an active mod here). When I can actually get a little further on the Resource Editor I will definitely be back here to try out the dll stuff.
|
|
NimoStar
Responsible
Legendary Hero
Modding the Unmoddable
|
posted January 08, 2019 09:25 PM |
|
|
Seems like a feasible idea.
Right now my personal situation doesnt allow me to learn and implement this sort of programming/coding, but will definitely give it a try later on if things calm down on RL
____________
|
|
Karmakeld
Responsible
Supreme Hero
|
posted January 10, 2019 11:46 PM |
|
|
Just adding this as a reminder in case someone manages to advance with the dll insertion.. http://heroescommunity.com/viewthread.php3?TID=45476
____________
|
|
radmutant69
Promising
Known Hero
|
posted March 04, 2019 04:43 PM |
|
|
Well I still know nothing about the dll but making this jump thing in the exe is actually quiet easy...
|
|
Morglin
Adventuring Hero
|
posted March 04, 2019 06:40 PM |
|
Edited by Morglin at 22:22, 04 Mar 2019.
|
Wow! How you realized which code is for minotaur's abilities? Did you do breakpoints?
|
|
radmutant69
Promising
Known Hero
|
posted March 04, 2019 06:47 PM |
|
|
Morglin said: Wow! How you realized which code is for minotaur's abilities? Did you do breakpoints?
You can find creature offsets and ability codes in this thread's first post.
What is a breakpoint BTW?
|
|
Karmakeld
Responsible
Supreme Hero
|
posted March 04, 2019 10:12 PM |
|
|
Radmutant, great to see you giving it a try a succeeding..
____________
|
|
wuxiangjinxing
Hired Hero
|
posted March 11, 2019 03:07 AM |
|
|
Is it possible to remove the limit that one player can only have eight parties on world map? As you may already know, we can create much more parties using the map editor and the game can handle it without problem.
____________
|
|
Karmakeld
Responsible
Supreme Hero
|
posted March 11, 2019 05:55 PM |
|
|
wuxiangjinxing said: Is it possible to remove the limit that one player can only have eight parties on world map? As you may already know, we can create much more parties using the map editor and the game can handle it without problem.
It is. Equilibris team enabled this by a script - set MAX_ARMIES (i recall that being the variable name) to x. E.g set to 10 or 4. This way you can have more or less than the usual 8 armies. Not sure if this works in vanilla game or how they enabled it, but it can be done.
____________
|
|
wuxiangjinxing
Hired Hero
|
posted March 12, 2019 03:13 AM |
|
|
Karmakeld said:
wuxiangjinxing said: Is it possible to remove the limit that one player can only have eight parties on world map? As you may already know, we can create much more parties using the map editor and the game can handle it without problem.
It is. Equilibris team enabled this by a script - set MAX_ARMIES (i recall that being the variable name) to x. E.g set to 10 or 4. This way you can have more or less than the usual 8 armies. Not sure if this works in vanilla game or how they enabled it, but it can be done.
That sounds great! I found the ASCII "MAX_ARMIES" in h4mod.exe, but I cannot figure out how to modify this value. Can you show me how to do this work? Thanks.
____________
|
|
Karmakeld
Responsible
Supreme Hero
|
posted March 12, 2019 07:22 AM |
|
|
wuxiangjinxing said:
Karmakeld said:
wuxiangjinxing said: Is it possible to remove the limit that one player can only have eight parties on world map? As you may already know, we can create much more parties using the map editor and the game can handle it without problem.
It is. Equilibris team enabled this by a script - set MAX_ARMIES (i recall that being the variable name) to x. E.g set to 10 or 4. This way you can have more or less than the usual 8 armies. Not sure if this works in vanilla game or how they enabled it, but it can be done.
That sounds great! I found the ASCII "MAX_ARMIES" in h4mod.exe, but I cannot figure out how to modify this value. Can you show me how to do this work? Thanks.
I see no reason to modify it in the exe file. As I wrote it allows you to change the value in game by setting a numerical variable named MAX_ARMIES, which is what you're seeking. I can post a screenshot for you, if that's what you need.
If you wish to add the script to vanilla game I suggest you look at the "dll extension" tread. There's a post on how to create jumps to add new code. Then you will need to add that code to the original h4.exe file.
____________
|
|
wuxiangjinxing
Hired Hero
|
posted March 15, 2019 12:52 AM |
|
|
Is it possible to allow players to gain full XP from neutral enemies in Champion difficulty?
____________
|
|
|