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 3.5 - WoG and Beyond > Thread: ERA II - Source code - Help and discussion
Thread: ERA II - Source code - Help and discussion This thread is 11 pages long: 1 2 3 4 5 6 7 8 9 10 11 · «PREV / NEXT»
gamemaster
gamemaster


Adventuring Hero
posted June 01, 2020 10:39 PM
Edited by gamemaster at 22:53, 01 Jun 2020.

Yes. Some kind of mod for testing will be good for bug hunting.


Edit:
Two minor things:
Erm.pas(5303): Variable 'SavedTriggerLocalObjects' might not have been initialized
Erm.pas(5297): Variable 'PrevTriggerCmdIndPtr' might not have been initialized


This two warnings are from compiler. Maybe we can nil those variables at the beginning be safe and satisfy compiler.

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


Honorable
Supreme Hero
posted June 02, 2020 01:12 AM

I rechecked them both a few times, totally safe, but ok. Done.
____________
Heroes 3 Era and everything for it. Releases folder for releases.

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


Honorable
Supreme Hero
posted June 04, 2020 12:00 AM

Glad to see you on WoG forum, by the way.
____________
Heroes 3 Era and everything for it. Releases folder for releases.

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


Adventuring Hero
posted June 28, 2020 01:52 PM

I am now on discord too

I can see that GameExt.RegisterHandler is deprecated.
What is alternative that can be used for external plugin (Yona)?
Should RegisterHandler be avoided in future projects?

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


Honorable
Supreme Hero
posted June 28, 2020 10:34 PM

It's ok to use it for plugins. See Extern.pas:

procedure RegisterHandler (Handler: TEventHandler; EventName: pchar); stdcall;
begin
 EventMan.GetInstance.On(EventName, Handler);
end;

Singleton object instance is used as Event Dispatcher behind the scene now. It's just note for ERA code writers to use EventMan.GetInstance.On.
____________
Heroes 3 Era and everything for it. Releases folder for releases.

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


Adventuring Hero
posted July 10, 2020 03:59 PM

Bersy

If i want to see era log console i need to set "Debug.LogDestination" in heroes3.ini to something other then "file"?

Also, to see yona console i must have enabled era log console in first place or yona can do it without era log?

I menage to get yona only with era log enabled. I am just curios to know is that right way.


Another question about "Aimed shot" of marksmen. How it work? When marksmen can use it? How to activate it.
For now i don't know how it work and i am not sure is that "porting" problem or i missuses that skill

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


Honorable
Supreme Hero
posted July 10, 2020 07:46 PM

Hi, gamemaster!
Try Debug.LogDestination=Console
In fact, everything, other than "File" works as console.

if GetOptValue('Debug.LogDestination', 'File') = 'File' then begin
 InstallLogger(EraLog.TFileLogger.Create(GameExt.DEBUG_DIR + '' + LOG_FILE_NAME));
end else begin    
 InstallLogger(EraLog.TConsoleLogger.Create('Era Log'));
end;

Latest Yona: https://dropmefiles.com/LVRoa
Yona console can be turned on separately via:

ModsYonaYonasettings.ini
[]
; Main
Debug = 1

Aimed shot mode is switched on/off via ESC (at least with old HD mod cursor must change). You select hex to aim at and press LMB. Next turn attack at this hex will be 200% more effective.
____________
Heroes 3 Era and everything for it. Releases folder for releases.

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


Adventuring Hero
posted July 10, 2020 08:32 PM
Edited by gamemaster at 20:37, 10 Jul 2020.

Thanks!
Quote:
Yona console can be turned on separately via:
Mods/Yona/Yonasettings.ini
[]
; Main
Debug = 1

I tried that before, and with provided yona. And always same result. Yona console don't work without era console.
Don't know is that related to win10 or something.
"GetConsoleWindow" always return 0 in yona if era console is not started before. If it is started before yona overtake that console.
I tried with "ported" and original dll's.

Can you confirm that your configuration work same way.
Era console can be turned on. Yona will overtake it, but yona alone wont work.

Anyway, it is not of big importance. I was just curios.


Quote:
Aimed shot mode is switched on/off via ESC (at least with old HD mod cursor must change). You select hex to aim at and press LMB. Next turn attack at this hex will be 200% more effective.

I will never figure that out


PS: Don't forget to pack new source and missing pas files with yona distribution

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


Honorable
Supreme Hero
posted July 10, 2020 11:21 PM

Seems like you are right, I do not call AllocConsole in Yona anymore, reusing the one from Era.
____________
Heroes 3 Era and everything for it. Releases folder for releases.

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


Adventuring Hero
posted August 23, 2020 10:56 PM

Hi Bersy

Is there any way to get variables from patcher_x86 trough PatchApi.pas?

Something like this from c version of patcher
_P->VarValue<_dword_>("HD.Version.Dword");

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


Honorable
Supreme Hero
posted August 25, 2020 02:15 PM

I think we should find c++ patcher sdk first to change PatchApi.pas.
____________
Heroes 3 Era and everything for it. Releases folder for releases.

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


Adventuring Hero
posted August 25, 2020 06:58 PM

Bersy said:
I think we should find c++ patcher sdk first to change PatchApi.pas.


xexe i was hoping that you will not answer that

For now i had 4.3.1 hpp file. There i found missing functionality in PatchApi.pas.
Actually it is not of most importance. I will try to use patcher_x86.hpp version 4.3.1 i had, until found 4.5.4 (latest) that is dll version provided with era.

Any idea who may have latest version? Perhaps baratorch?
Who made initial port of PatchApi.pas?

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


Honorable
Supreme Hero
posted August 26, 2020 12:33 PM

baratorch made, but he didn't respond any email I sent to him. Will try again.
____________
Heroes 3 Era and everything for it. Releases folder for releases.

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


Hired Hero
posted September 30, 2020 09:02 AM

Excuse me, but where is the source code of ERA?

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


Adventuring Hero
posted September 30, 2020 05:27 PM

here is official version for delphi 2007
https://github.com/ethernidee/era

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


Hired Hero
posted October 01, 2020 12:52 PM
Edited by myocytebd at 14:48, 01 Oct 2020.

I downloaded current community edition, there are a lot of errors in b2/Strlib.pas due to string neq char comparison. Is it incompatible with later Delphi IDE? (After replacing string with AnsiString, build stops with internal error ...)

Another question is, where is vfs available?

It was unfortunate that the project uses Delphi, which is dead(or dying) for long.
(As I was googling around today, I found almost nothing for Delphi;
while FPC/GPC had reasonable results).

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


Adventuring Hero
posted October 01, 2020 06:41 PM

Hi,

Original source is for old delphi version D2009. It will not compile in new version mostly because old delphi use ansistring and new use unicode. That make all kind of string hell.

You can find b2 and vfs at Bersy git-hub. Same place you find era source. It is not in same package with era but separate.
If i remember correct you will need to set patches in era project to b2 and vfs, or place them to correct locations.

Anyway, it is lot of trouble if you just want to see it compile.
You can examine source without compiling if some part of code interest you.
Is there any reason why you look for code or just curiosity?

If you want to make plugins you can use some C++ alternatives
https://github.com/RoseKavalier/H3Plugins

Regarding delphi...
Don't worry, delphi dyeing 30 years and will need another 30 to die . I personally use delphi for all my home projects. It is simple fast and much easier then C. It is handy.


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


Hired Hero
posted October 01, 2020 09:26 PM

Thanks for the help
gamemaster said:
Hi,

Original source is for old delphi version D2009. It will not compile in new version mostly because old delphi use ansistring and new use unicode. That make all kind of string hell.

Yes, I'm sort of shocked how Delphi guys reckless breaks API and ABI by unicode string. I tried to change them and soon give up on trickier usecases I cannot decide.
It seems that FPC has a Delphi compatible mode, and I will give it a shot.

gamemaster said:

You can find b2 and vfs at Bersy git-hub. Same place you find era source.

I was blind and failed to find vfs.

gamemaster said:

Anyway, it is lot of trouble if you just want to see it compile.
You can examine source without compiling if some part of code interest you.
Is there any reason why you look for code or just curiosity?

For code, addresses, curiosity and consideration to replace ERM language. Last time I debugged HOMM3 long ago when ERA was not yet.

I thought that it is much easier to find code and data address from hooks. Since there are many mem patches by ERA and plugins, IDA static analysis does not work well and asm debugging is not very comfortable on newer Windows (CE/olly2 are not that good).
In addition, I thought that ERA is a clean rewrite and it would be easy to bind to alt languages.

But then I found that ERA further hook onto WoG binary and replaces parts of it. So it is double cryptic to me

gamemaster said:

If you want to make plugins you can use some C++ alternatives
https://github.com/RoseKavalier/H3Plugins

Thanks, I will take a look.

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


Adventuring Hero
posted October 02, 2020 12:16 AM
Edited by gamemaster at 00:19, 02 Oct 2020.

myocytebd said:

I thought that it is much easier to find code and data address from hooks. Since there are many mem patches by ERA and plugins, IDA static analysis does not work well and asm debugging is not very comfortable on newer Windows (CE/olly2 are not that good).
In addition, I thought that ERA is a clean rewrite and it would be easy to bind to alt languages.

But then I found that ERA further hook onto WoG binary and replaces parts of it. So it is double cryptic to me


It will not be easy to follow all that patches. Some are patch to heroes3, some are patches to other patches, some are relocated memories so actual address is not important. There are all kind of voodoo magic in era. On top of that there are lot mods that overpatch era. And in combination with HD mode you will lost track who patch what .
If it was easy to replace erm Bersy would do that long time ago .

If you need only addresses that are patched there is list in "x86 patches.txt" in heroes3/Debug/Era folder and it contains most patches applied.

Also you can examine era code for HookCode and WriteDataPatch functions that do patch job. Actually any 8 digit hexadecimal is 99% chance involved in some kind of patching .

Do you have experience with delphi code? What is your experience in coding/reversing in general?

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


Hired Hero
posted October 02, 2020 09:35 AM
Edited by myocytebd at 21:18, 02 Oct 2020.

gamemaster said:
If it was easy to replace erm Bersy would do that long time ago .

Except for (bug) compatiblity, it would be easy if wog ERM was implemented as clean as in era

gamemaster said:
Do you have experience with delphi code?

Zero with delphi or pascal.
But I knew that pascal is not that different from C.

gamemaster said:
What is your experience in coding/reversing in general?

Good at native and assembly. Moderate at graphics, VM/compiler and reversing.
I mostly coded on Linux and thus are not quite familiar with building/source-based-debugging on win32.

BTW what do you think of VCMI?
At a glance, it seems that VCMI reserves placeholder for ERM.

I tried latest Lazarus but FPC crashed at linking
I thought it is due to -L.obj in zlib, so I tried to convert them. But FPC still crashes with converted .o or even if I commented those -L.obj.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 11 pages long: 1 2 3 4 5 6 7 8 9 10 11 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0613 seconds