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»
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted August 25, 2019 05:10 PM

So far - except Sagamosa Advanced Levels because unfinished, there are no mods released while still bugs in. All are clean.

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


Honorable
Supreme Hero
posted August 25, 2019 05:38 PM
Edited by Bersy at 17:40, 25 Aug 2019.

You can try Phoenix Mod and StarGate Atlantis by Salamandre.
____________
Heroes 3 Era and everything for it. Releases folder for releases.

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


Admirable
Omnipresent Hero
Wog refugee
posted August 25, 2019 06:00 PM

The code from Stargate is as old as Mathusalem (2009). Trainer mod is more advanced and also much easier for testing, I would say

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


Adventuring Hero
posted August 25, 2019 08:02 PM
Edited by gamemaster at 21:32, 25 Aug 2019.

@Salamandre
I tried Atlantis. It seem to work (at least what i can see in 2min test ), but...
Only problem is related to new MP3 receiver. There are lot errors all related to MP:S new syntax. Tested with original 2.8.8 dlls.
Also, dialogs with images are not skinned in atlantis theme like all other dialogs.
So i will use trainer an Phoenix for now. Because they don't make any error.

#12
What is limitation of era mod's filenames?
All filenames can be unicode but will be converted to ansistring internaly, so all files at the end are ansistrings?

#13
Is widestring important for vfs? As far as i can see it is used only for logging and some other non-game things (i did not make deep analysis).
Is it possible to remove widesstring completly? Any reason not to do that?

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


Honorable
Supreme Hero
posted August 26, 2019 07:04 PM
Edited by Bersy at 19:07, 26 Aug 2019.

#13
Most of game plugins and game code itself use ansi strings. VFS.dll uses Unicode only. Unicode mod names are supported only if they can be converted to ansi without loss on target machine. For portability mods should use ascii file names.

WideString is absolutely necessary for VFS.dll. The whole Windows native API uses UCS-16 strings (WideString in Delphi). Such API allows to  use unicode anywhere.
____________
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 26, 2019 08:48 PM

#13
Uhhh i tried to do quick dirty port of vfs to ansi . Yes, i fail, it is almost impossible .

Ok, era is clear from unicode/wide strings (beside json.pas). VFS must stay unicode, B2 also.

Now i will conclude first round of bug hunting. Port is at least 95% clear from bugs.
Now i should do field test . At least one regular game with lot mods. If that pass without errors port will be finished from my side. I am very optimistic because all quick test pass without problems.

Here is last dlls if someone want to test
https://nitroflare.com/view/A1EBCCC2F46D6F3/era-vfs-288.zip
All needed to do is replace original era.dll and vfs.dll. Play game and often save. If error occur, revert original dlls and see if error raise with original.

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


Honorable
Supreme Hero
posted August 27, 2019 08:53 AM

Better use some kind of dropmefiles.com as file service. It does not force people to wait and solve Google captcha :-)
____________
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 29, 2019 08:24 PM
Edited by gamemaster at 22:21, 30 Aug 2019.

Bersy said:
Better use some kind of dropmefiles.com as file service. It does not force people to wait and solve Google captcha :-)

Hehe ok. Next link will be there.

In mid time my first game go well. No strange things in game related to port.

But...

This is error report from 42nd script from Phoenix mode.
Problem is more in error message than in error.
Because script has no line feed #0A character each line is very long. And line does not fit to message.

Suggestion is to pre-process message.
- Add line brake after each command. This may be odd for well formated scripts,
- Or, Simple brake command to 50 (or any other number) character per line. That way well formated script will look good and odd one will populate box beter than now.

EDIT:

This can be achieved by adding

for I := 0 to length(result) div 50 do
begin
   insert(#$0A, result, (I+1)*50);
end;

at the end of IF statament in GrabErmCmdContext.
It is even better with 100 characters limit.


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


Honorable
Supreme Hero
posted August 30, 2019 08:01 PM

We cannot simply divide string into 50 chars chunks. Because it can be a string of 2-char lines like '1'#10'2'#10, etc. Most of ERM scripts are not packed, so I thought it's not a big deal.

Try:
result := SysUtils.WrapText(StrLib.ExtractFromPchar(StartPos, EndPos - StartPos), #10, [#0..#255], 100);
____________
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 September 07, 2019 03:25 PM
Edited by gamemaster at 15:28, 07 Sep 2019.

Hi, Bersy
Bersy said:
We cannot simply divide string into 50 chars chunks. Because it can be a string of 2-char lines like '1'#10'2'#10, etc. Most of ERM scripts are not packed, so I thought it's not a big deal.

Hmm, in that case extra line brake wont be added.

Bersy said:

Try:
result := SysUtils.WrapText(StrLib.ExtractFromPchar(StartPos, EndPos - StartPos), #10, [#0..#255], 100);


I tried code you suggested. It did not divide string after 100 characters. I am not sure is ansistring reason or full character set [#0-#255].
Anyway, like you stated it is not important for most scripts. If i didn't trip at that location accidentally we probably newer know about problem

#14
I found in source "LoadGlobalRedirectionConfig" in lodman.pas that load redirections from json file. But i did not find any mod that use json beside mod manager descriptions.
Can you provide at least one example of json file with redirections. I need that to test is that work as we expected. Actually only json.pas is still mix of asnistring and unicode in era.
Is this json redirection still in experimental phase ?

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


Honorable
Supreme Hero
posted September 08, 2019 12:49 PM

#word-wrapping
Thanks, I'll recheck the function.

#14
Json files are used in multiple places.
Check Quick Savings and Secondary Skills Scrolling mods.

Example of json with redirections:
{
 "zpic1005.pcx": "zpic1000.pcx"
}

Redirects main screen to loading screen.
____________
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 September 08, 2019 02:21 PM
Edited by gamemaster at 14:24, 08 Sep 2019.

#14
Thanks. I menage to make redirection and it work.

#15
Just wondering one thing about era...
If in-game we always use ansistrings, as limitation of old code, is it reasonable to make Json ansistring instead of unicode, as it is now.
Reason why i ask that is to make era 100% ansistring. Anyway, all unicode strings from json will be converted to ansistring. Most of characters will be lost in process (any char that has not direct ascii conversion code. Probably all cyrillic characters).
So, options are:
1) Change json to ansistring and remove internal conversions, but risk problems if input file is unicode. That may lead to interpretate unicode as ansistring which will make mess.
2) Keep it unicode so we will make internal conversion. In that case there will be no "loading" problems but conversion problem still exists (unsupported chars will be replaced with '?'). Another problem is lot Ansistring>String>Ansistring conversions when retrieve values from file.

All this is longer version of short question "Should i port json to ansistring too?".

#16
Is unicode in json important for file in "Lang" folder? Or situation is same as above?

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


Honorable
Supreme Hero
posted September 08, 2019 06:38 PM

Json files are written in UTF-8 encoding. It's a must. It's Unicode, though it can be stored even in AnsiString (each character in UTF-8 occupies 1-4 bytes). Unicode string may be necessary to pass to other system API (File system, Network, saving to another Json). Is there any reason to change Json.pas at all? WideString is unsupported in higher Delphi versions?
____________
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 September 08, 2019 10:54 PM
Edited by gamemaster at 22:58, 08 Sep 2019.

Bersy said:
Json files are written in UTF-8 encoding. It's a must. It's Unicode, though it can be stored even in AnsiString (each character in UTF-8 occupies 1-4 bytes). Unicode string may be necessary to pass to other system API (File system, Network, saving to another Json). Is there any reason to change Json.pas at all? WideString is unsupported in higher Delphi versions?

Json is only part of era still in unicode. And H3 use only ansistring. Anything that come out of json must be ansi (strings for game, file path used in game, file names of resources in game...)
So idea was to make json we need, ansistring json.
There is no other reason for my questions. Delphi support it as is. No problem with widestrings.

#17
If json stay as unicode file. Is there any reason why not to use delphi's library instead of custom one? I guess that D2009 did not support json so custom library is needed. Am i correct?
Should i try replace json with delphi's one? Or we need it for some future plans (easier to add new features to sustom json library, if needed ...)



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


Honorable
Supreme Hero
posted September 09, 2019 09:41 AM

I use json module AS IS without any corrections. You're right, there was no appropriate built-in module earlier.
____________
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 September 16, 2019 03:47 PM
Edited by gamemaster at 16:28, 16 Sep 2019.

Hi,

To test build i played few games. One default era with few mods that i win, and two with phoenix mode where computer humiliated me .
In all cases there was no errors introduced by port.

#14, #15, #16, #17
I made two options with json files. One version that use custom json with only ansistring support and one that use native delphi json library provided after 2009 version.
Both version work without problems and has some limitations.

At the end i removed existing json and replace it with second option - native delphi json without any modifications.

As stated before, it is unicode version and will have internal transformation from unicode to ansistring where needed (e.g. game will use ansistring for resources that can be redirected trough json file).
As far as content of json is ansistring there will be no problems. Bottom line is that behavior of this solution will be same as one already exist in older era builds.

----
@Bersy

I tried to make one dll plugin. Few interesting things occurred.

#18
First one is that era sdk is not quite updated to latest era build. It is not critical because few peoples actually code plugins. Anyway i will list findings here.
If im not wrong:
- Imported functions from era.dll are not updated. There are some functions that don't exist anymore in era.dll and some that exist but are not imported (recently added functions),
- TEvent.Name is defined as string in eventman.pas and pchar in era sdk,
- Recent added triggers (>77014) are not added to list,
- TRIGGER_FU1 and TRIGGER_FU30000 should be updated according to erm.pas.

If you dont have time to update it, wait for my plugin. There i will update sdk so you can review what is need to be update by my opinion.
Also it will contain (i hope ) color fix that RoseKavalier provided for windowed dialog in #6.

#19
This lead us to another problem. I can't debug my dll . In fact test dll is loaded normally and it work in game. But delphi can not locate it. And brake-point can not be triggered.
I guess that problem is redirection of file location that era use internally. Delphi search for dll "heroes3/eraplugins" and not in mod folder where it actually is.

Did you have this problem? Any solution for that?
Is there any fast way to disable redirection, for test purposes?

Solution that work for now is to use "heroes3/eraplugins" folder for dll. After debugging move it back to mod folder.

#20
Port is now in phase where i can share it. Era is thoroughly checked. Vfs and B2 is ported but not checked in so many details as era did. But gameplay test suggest that all is ok.
At this point i made minimal changes to code. No additional formatting are made, nor any optimization i could introduce. This is point where it is easiest to compare old code and ported one.

My idea is not to share it until discuses with you about options.
What to do?
- If you are interested in this port i can share it so that may be candidate for future official builds, if you find no problems,
- Wait for next era update, update port to new version, then share it with you,
- Keep it as my internal build (i will share on demand with anyone interested in it...). In this case i will continue port, code formatting, reorganizing, and other makeups that will make harder to compare ported version with original. Harder to update it with code from future era releases. At some point if i add some new features it may lead to incompatibility between those two era versions.

Reason why i suggest to use this port as official as is to prevent multiple versions of era to emerges. It is best to keep only one official era version. Also in that case i can contribute to code development instead of pushing 2 era versions.

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


Honorable
Supreme Hero
posted September 16, 2019 07:45 PM

Hi! Nice news!

#18
1) All current plugin makers use C++.
2) Many API are really private (for internal usage only, subject for changing and deleting). Thus we should be really careful exporting something.
3) I don't mind the update.

What concerns color fix, it's hard to make plugin, working with any HD version, but you can try.

#19
Oh, do you really debug your dll in Delphi? I always used OllyDebugger + import delphi map file + converted map to *.dbgmap for crash reports.

The solution is yours, you real path for external application.

#20
Please, publish your version on GitHub. It's a great work

I cannot promise, that your code will become main base in the nearest future, because of too many sources of hidden bugs, including new compiler bugs (I faced a few, developping VFS unit, like invalid fields alignment on stack). Just not so much time to support multiple users on multiple OS. But I plan to move most of modding process to Lua, thus Era's code base will not change dramatically and I will probably be able to finally use your port in the future. It would be really nice.

The work on 2.9 is still on (more ERM optimizations, Recruitment dialog support, a few backwards-incompatible changes), I'm sure, it will not be hard to adapt it.
____________
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 December 28, 2019 04:21 PM
Edited by gamemaster at 16:27, 28 Dec 2019.

Hi,

Nice to see new version. Now i have something to port .

#21
One question about functions "ErmCurrHero" in Era.pas.

As compiler note, there is some cases when function result is undefined.
Is that intended behavior? I did not make in-deep research to see if it is allright that is why i ask.
Perhaps it can be changed from function to procedure or make it always return some result to prevent unexpected behavior?

#22
One minor thing in Reinbow.pas
NamedColors[myAStr('g')]:=Ptr(Color32To16($FFFE794));

Any reason why hex number has 7 digits instead of 6 like all other colors? Is there any reason why it is not $FFE794 ?


Regarding problem #6 Link
I managed to make dialog colored as it should be.

Core.Hook(@Hook_GetCharColor, Core.HOOKTYPE_BRIDGE, 8, Ptr($4B4F74));

Patch to $4B4F74 is unreachable because whole original function ($4B4F00) is detured by HD mode. I patch HD mode to make it work.
Problem is in fact that location is different for different HD versions.
Is there any developer of HD mode here in forum? Perhaps he can shade some light to best solution for future versions of HD mod and era mod.

Keep going with good work and improving ERA mod.

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


Honorable
Supreme Hero
posted December 29, 2019 12:10 AM

gamemaster, glad to see you again!
Could you open github/gitlub/bitbucket/etc repository with your version of code?

#21
>> One question about functions "ErmCurrHero" in Era.pas.

I've written it in a non-standard way and it's a bit buggy in 2.9.2 or 2.9.3. Updated.

function ErmCurrHero (NewInd: integer = Low(integer)): {n} Heroes.PHero; overload;
begin
 if NewInd <> Low(integer) then begin
   ppointer($27F9970)^ := Heroes.ZvsGetHero(NewInd);
 end;

 result := ppointer($27F9970)^;
end;

If hero index is passed, it's used as setter. Otherwise as getter.

#22
One minor thing in Reinbow.pas
NamedColors[myAStr('g')]:=Ptr(Color32To16($FFFE794));

Seems like misspelling. I will delete the odd first character. Thanks.

#6
I patch HD mode to make it work.

I saw RoseCavalier solution. It's a black magic to use heuristics for each version or search for binary chunks.

baratorch(at)yandex.ru Alexander Barinov is HD mod creator. We can ask him to export function we need to patch. What will be the proposals?
____________
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 December 30, 2019 09:29 PM

Regarding git hub. I will make it just need some time to 2X check few code parts.
If you want i can zip it an send to you.
At this point it compile and at first look work as your version.

#21
Keep in mind that there is another overloaded version of "ErmCurrHero" in Era.pas with same problem as first one you fixed.

#22
Keep in mind that few color constant are added to "Heroes.pas"
HEROES_GOLD_COLOR = '0FFFE794';
I am not sure if it is used, but also has one "F" more that it is needed.

#6
Yeah, it is voodoo magic . One way is to do it like RoseCavalier did.
Another is to ask baratorch for assistance (make some compatibility with era) when we figure out exactly what is needed to do.
Is there any chance to get map files for HD mod debugging?
That, at least, will make debugging faster.
For now i will continue with examination.

 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.1167 seconds