Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 4 - Lands of Axeoth > Thread: H4 dll researching
Thread: H4 dll researching This thread is 2 pages long: 1 2 · «PREV
Pol
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.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
RoseKavalier
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

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
iliveinabox05
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.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
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
____________
Never changing = never improving

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Karmakeld
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
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
radmutant69
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...






 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Morglin
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?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
radmutant69
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?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Karmakeld
Karmakeld


Responsible
Supreme Hero
posted March 04, 2019 10:12 PM

Radmutant, great to see you giving it a try a succeeding..
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
wuxiangjinxing
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.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Karmakeld
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.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
wuxiangjinxing
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.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Karmakeld
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.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
wuxiangjinxing
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?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 2 pages long: 1 2 · «PREV
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0394 seconds