| | ERA II - Source code - Help and discussion |  This thread is  pages long:  1 2 3 4 5 6 7 8 9 10 11 · «PREV / NEXT» | 
 | 
 
| gamemaster 
  
   
   Adventuring Hero
 
 | 
|  posted March 26, 2020 09:05 PM |  |  |  
 
| @Bersy I played game with few mods included for few ingame days and did not found other problems with "IfThen" beside that one i reported.
 Perhaps problem is not in "IfThen" but in way how it is used in this particular place.
 You have 2 arguments. Second parameter ask for field value ".count". In case that "Self" is nil second parameter raise exception. You can not get "count" of nil object.
 So "IfThen" is ok to use only if all stataments can be evaluated.
 
 Perhaps you can use "IfThen" but with some care.
 
 
 @majaczek
 Hi,
 Few questions:
 1. Do you have experience with delphi. Or this is first time?
 2. What version of source did you used? One from Bersy's git hub?
 3. You have any particular need for source code or just need another dlls (latest dll from ported version)?
 
 If you plan to detect problem in source that will not be easy because you need to track code trough h3era.exe also. I just want to say that there is no one place that you will see obvious cause of problem.
 
 Anyway if you willing to try i can assist anytime i am free
  . 
 Last few days i investigating your problem (i have not much time but i tried to locate problem. And i fail
  ). First crash dump lead to some corrupted memory. It finish with call to location that hold skill names instead of valid program code. It is clear that something gone wrong.
 Later you posted update mentioning that ?var and var can be root of problem. That should be investigated.
 
 Can you delete "Debug" folder in you heroes3 folder. Then load game and play until you get error. Save erm memory dump. Zip entire "Debug" folder and give link to it. Perhaps that give more clues.
 Another better solution will be to pack all you mods and game save file so i can try reproduce error.
 
 |  
 | 
 
| majaczek 
  
   
      Supreme Hero
 Work at Magic Dimmension
 
 | 
|  posted March 26, 2020 09:43 PM |  | Edited by majaczek at 22:14, 26 Mar 2020. |  
 
| gamemaster said:@Bersy
 I played game with few mods included for few ingame days and did not found other problems with "IfThen" beside that one i reported.
 Perhaps problem is not in "IfThen" but in way how it is used in this particular place.
 You have 2 arguments. Second parameter ask for field value ".count". In case that "Self" is nil second parameter raise exception. You can not get "count" of nil object.
 So "IfThen" is ok to use only if all stataments can be evaluated.
 
 Perhaps you can use "IfThen" but with some care.
 
 
 @majaczek
 Hi,
 Few questions:
 1. Do you have experience with delphi. Or this is first time?
 2. What version of source did you used? One from Bersy's git hub?
 3. You have any particular need for source code or just need another dlls (latest dll from ported version)?
 
 If you plan to detect problem in source that will not be easy because you need to track code trough h3era.exe also. I just want to say that there is no one place that you will see obvious cause of problem.
 
 Anyway if you willing to try i can assist anytime i am free
  . 
 Last few days i investigating your problem (i have not much time but i tried to locate problem. And i fail
  ). First crash dump lead to some corrupted memory. It finish with call to location that hold skill names instead of valid program code. It is clear that something gone wrong.
 Later you posted update mentioning that ?var and var can be root of problem. That should be investigated.
 
 Can you delete "Debug" folder in you heroes3 folder. Then load game and play until you get error. Save erm memory dump. Zip entire "Debug" folder and give link to it. Perhaps that give more clues.
 Another better solution will be to pack all you mods and game save file so i can try reproduce error.
 
 
 
 1. almost no experience with delphi
 2. yes, latest one from Bersy's github
  3. I need latest dll to check if it already helps with my problem
 ===============================================================
 first crashdump was indeed corrupted memory and it was my fault (my updated version of amethyst had some stupid typo, new version works ok now)
 the second problem is when code uses DL:A and first thing after A is variable (not a constant). I will send you my whole mod (I use one huge mod + of course wog)
 
 here is my repo with the current state of mod click here
 
 steps to reproduce: use any new big button in hero screen
 
 well i put the debug folder into package in this folder
 
 |  
 | 
 
| Bersy 
  
      
      Honorable
 Supreme Hero
 
 | 
|  posted March 26, 2020 10:13 PM |  |  |  
 
| gamemaster, I know. When compiler inlines IfThen, it's expanded into 
 If Condition Then Expr1 Else Expr 2 end;
 End Expr2 is not executed always.
 
 But if compiler refuses to inline function, it results in real
 IfThen(Cond, Expr1, Expr2) call, leading to bugs. I fixed such cases, thank you.
 ____________
 Heroes 3 Era and everything for it. Releases folder for releases.
 |  
 | 
 
| gamemaster 
  
   
   Adventuring Hero
 
 | 
|  posted March 26, 2020 10:32 PM |  |  |  
 
| @majaczek 1. uhh let then first try 3.
  2. Bersy's version use old delphi 2009. That is why i ported it to new version. Also you need to setup few things before start to compile it. So you had 0% chance to compile it. lets try 3. first
  3. Here is link to 2 dlls you need to replace. It is latest build from 2 week ago. Make backup of 2 dlls and replace them with provided. You will notice that new dlls are much bigger. That is ok. Also you will note version "3.0". Don't pay attention to that
  . 
 https://dropmefiles.com/XzUSX
 
 try first those 2 dlls. Perhaps then you can try older versions to find closest problematic version? Lower version we found smaller changes will be and smaller area for investigation.
 
 @Bersy
 No problemo
  
 |  
 | 
 
| majaczek 
  
   
      Supreme Hero
 Work at Magic Dimmension
 
 | 
|  posted March 26, 2020 10:53 PM |  | Edited by majaczek at 22:59, 26 Mar 2020. |  
 
| Quote:
 {
 Module: 	era.dll
 Adress:      [ era.dll+0x15DCED ]
 Code:        EXCEPTION_INT_DIVIDE_BY_ZERO
 Flags:       0x00000000
 Information: -
 }
 
 
 with your dlls
  (in my test case)
 |  
 | 
 
| gamemaster 
  
   
   Adventuring Hero
 
 | 
|  posted March 26, 2020 11:14 PM |  |  |  
 
| hmm odd. i'll try it later tomorrow.
 |  
 | 
 
| Bersy 
  
      
      Honorable
 Supreme Hero
 
 | 
|  posted March 27, 2020 01:51 PM |  |  |  
 
 | 
 
| gamemaster 
  
   
   Adventuring Hero
 
 | 
|  posted March 27, 2020 07:14 PM |  |  |  
 
| @majaczek I just downloaded your git
  and i should clone it. So that mistake took me some time
  . 
 Here is dll with fix for "divide by zero".
 That is fix to just make you able to run heroes 3.
 
 Can you check is that problem solved. Then we will go further...
 
 https://dropmefiles.com/xeDjL
 Work in safe directory or make backup before override (but you already know that
  ). 
 @Bersy
 Yes D2007 is enough for you git. But majaczek used 10.3.3 if i am correct.
 
 How are you guys in this corona time? Work from home? Or some isolation in far mountain cottage ?
   |  
 | 
 
| majaczek 
  
   
      Supreme Hero
 Work at Magic Dimmension
 
 | 
|  posted March 27, 2020 07:41 PM |  |  |  
 
| @gamemaster it fixees the DL:A issue perfectly
  
 but now it's incompatible with HD-mod I think
   |  
 | 
 
| gamemaster 
  
   
   Adventuring Hero
 
 | 
|  posted March 27, 2020 08:00 PM |  |  |  
 
| @majaczek try again
 https://dropmefiles.com/MllXN
 I forgot to remove one harcoded HD patch that make it incompatible.
 
 Keep in mind that no one test this ported version until now.
 It will be good to use it some time just for test. So potential errors can be detected.
 It should be 99.99% same as original Bersy version. I try to keep it up to date with Bersy current version. For now use it for test. For official relise of your mod wait Bersy's version with fix.
 
 
 @Bersy
 
 Problem is located in Era.pas in function "PutVal"
 
  Division by 0 occurred so i just added check to prevent error.
 If that can happens then we need to make it safe. If Value can not be 0 then we need further investigation. I don't know code in depth so i just give proposals.
 |  
 | 
 
| majaczek 
  
   
      Supreme Hero
 Work at Magic Dimmension
 
 | 
|  posted March 27, 2020 09:05 PM |  | Edited by majaczek at 21:09, 27 Mar 2020. |  
 
| works in HD too  
 edit: when fighting with monster got this error:
 
 Quote:
 Exception
 {
 Module: 	h3era HD.exe
 Adress:      [ 0x0043E1F9 ]
 Code:        EXCEPTION_ACCESS_VIOLATION
 Flags:       0x00000000
 Information: read of address: 0x00000030
 }
 
 Context { EAX: 0x00000000, ECX: 0x00000000, EDX: 0x00000200, EBX: 0x12B35A0C, ESP: 0x02D342B8, EBP: 0x02D34728, ESI: 0x00000000, EDI: 0x00000003 }
 
 Call stack
 {
 ? called from before	[ 0x12B28680 ]
 }
 
 Call stack V2
 {
 0043E1F9 (h3era HD: 00400000): (?): (?)
 004957E9 (h3era HD: 00400000): (?): (?)
 004689B1 (h3era HD: 00400000): (?): (?)
 007157EC (h3era HD: 00400000): (?): (?)
 007601F1 (h3era HD: 00400000): (?): (?)
 007493CC (h3era HD: 00400000): (?): (?)
 050CECEB (era: 04F70000): (?): ExtractErm
 0074CE60 (h3era HD: 00400000): (?): (?)
 050D037F (era: 04F70000): (?): ExtractErm
 050D03AC (era: 04F70000): (?): ExtractErm
 007493CC (h3era HD: 00400000): (?): (?)
 050CECEB (era: 04F70000): (?): ExtractErm
 0074D1E5 (h3era HD: 00400000): (?): (?)
 0645AD98 (?): (?): (?)
 0075E203 (h3era HD: 00400000): (?): (?)
 00463BFB (h3era HD: 00400000): (?): (?)
 004627BA (h3era HD: 00400000): (?): (?)
 004B08C0 (h3era HD: 00400000): (?): (?)
 004B0A4A (h3era HD: 00400000): (?): (?)
 05083100 (era: 04F70000): (?): ClearAllIniCache
 050831F3 (era: 04F70000): (?): ClearAllIniCache
 050B7FBE (era: 04F70000): (?): GetGameState
 004ADFE8 (h3era HD: 00400000): (?): (?)
 0075AEB7 (h3era HD: 00400000): (?): (?)
 004AC5EF (h3era HD: 00400000): (?): (?)
 004A690C (h3era HD: 00400000): (?): (?)
 004A6B05 (h3era HD: 00400000): (?): (?)
 004A760D (h3era HD: 00400000): (?): (?)
 004A7693 (h3era HD: 00400000): (?): (?)
 00757884 (h3era HD: 00400000): (?): (?)
 004813CF (h3era HD: 00400000): (?): (?)
 0047FB1E (h3era HD: 00400000): (?): (?)
 00480FC2 (h3era HD: 00400000): (?): (?)
 00407E43 (h3era HD: 00400000): (?): (?)
 0040AA36 (h3era HD: 00400000): (?): (?)
 0074E348 (h3era HD: 00400000): (?): (?)
 00409930 (h3era HD: 00400000): (?): (?)
 075D18A3 (?): (?): (?)
 00715A4C (h3era HD: 00400000): (?): (?)
 0074EE99 (h3era HD: 00400000): (?): (?)
 0074EF4B (h3era HD: 00400000): (?): (?)
 004089B0 (h3era HD: 00400000): (?): (?)
 075D1683 (?): (?): (?)
 075D1610 (?): (?): (?)
 12CB0B37 (?): (?): (?)
 05083100 (era: 04F70000): (?): ClearAllIniCache
 050831F3 (era: 04F70000): (?): ClearAllIniCache
 050B79E5 (era: 04F70000): (?): GetGameState
 02DF1271 (?): (?): (?)
 0FFF095B (?): (?): (?)
 0FFF08E5 (?): (?): (?)
 1000D6A9 (_hd3_: 10000000): (?): HdCommon_Set
 02DF0067 (?): (?): (?)
 75E66359 (KERNEL32: 75E50000): (?): BaseThreadInitThunk
 77C67B74 (ntdll: 77C00000): (?): RtlGetAppContainerNamedObjectPath
 77C67B44 (ntdll: 77C00000): (?): RtlGetAppContainerNamedObjectPath
 }
 
 
 but dialogs work
 
 edit: the crash is not repeateable
   |  
 | 
 
| gamemaster 
  
   
   Adventuring Hero
 
 | 
|  posted March 27, 2020 10:46 PM |  |  |  
 
| What version of era did you used before 2.9.12? When all worked well. 
 I also get some battle mess in game. Script (109 Knightmare - New Resistance SS - Exorcism) tried to load erm_hooker.era That should be avoided if i am right
 
 Quote:2.9.4
 [!] battery.dll by MoP (included in Typhon too) is not supported anymore.
 [!] erm_hooker.era MUST BE deleted from all mods, unless you know, what you are doing. It's a part of Era package now.
 
 
 I updated Wog and Wog_scripts and after that all work well. But test was short.
 |  
 | 
 
| majaczek 
  
   
      Supreme Hero
 Work at Magic Dimmension
 
 | 
|  posted March 28, 2020 12:49 AM |  |  |  
 
| nope it doesn't need to be avoided, just now it's packaged in WoG "mod" |  
 | 
 
| Bersy 
  
      
      Honorable
 Supreme Hero
 
 | 
|  posted March 28, 2020 03:07 AM |  |  |  
 
 | 
 
| gamemaster 
  
   
   Adventuring Hero
 
 | 
|  posted March 28, 2020 11:24 PM |  |  |  
 
| @Bersy 
 What are parameters of !!DL:A command?
 Command has 3 or 4 parameter. 4th parameter is always 1?
 
 I ask this because it is related to majaczek problem.
 He used 3 parameters. i guess that 4th is by default 0.
 for example:  !!DL28:Ay16/4/y99;
 Somewhere i found that last parameter is some magic 1.
 
 
 @majaczek
 Can you try to fix your all scripts with !!DL:A to have 4 parameters. Last should be 1.
 Then try original Bersy's dll instead of dll i provided.
 |  
 | 
 
| majaczek 
  
   
      Supreme Hero
 Work at Magic Dimmension
 
 | 
|  posted March 29, 2020 08:58 AM |  | Edited by majaczek at 09:32, 29 Mar 2020. |  
 
| @gamemaster it seems to work
  
 EDIT:
 
 Quote:ZVSE
 !?PI;
 !!SN:L^era.dll^/?y66 Ay66/^PluginExists^/?y77 Ey77/1/^Skirmish^; !!VRy99:Sv1; [majaczek]
 !!FU&v1<>0:E;
 !!VRz1:S^Choose Skirmish Name^;
 
 !!VRz9:S^Skirmish^;
 !!IF:D99/0/1/0/0/0/0/0/0/0/0/0/0/0/0/0;
 !!IF:F99/////0; !!IF:E1/99; !!VRz999:Sz1;
 
 
 
 
 this script doesn't work on DLL you provided
 (it skips dialog and z999 is empty)
 
 but it works on original 2.9.12
 |  
 | 
 
| gamemaster 
  
   
   Adventuring Hero
 
 | 
|  posted March 29, 2020 12:00 PM |  |  |  
 
| Hmm if i am not wrong: 1. Load era.dll adress to y66
 2. Load "PluginExists" to y77
 3. Run "PluginExists" with one parameter "Skirmish"
 4. Exit if v1<>0
 
 Is v1 result from calling function in step 3? 0-false, 1-true?
 
 In that case step 3 should return false and exit function because there is no "skirmish.era" module that is loaded.
 I can only find "skirmish.era.off" in your folder.
 
 Did i understood well your code?
 |  
 | 
 
| majaczek 
  
   
      Supreme Hero
 Work at Magic Dimmension
 
 | 
|  posted March 29, 2020 12:06 PM |  | Edited by majaczek at 12:12, 29 Mar 2020. |  
 
| gamemaster said:Hmm if i am not wrong:
 1. Load era.dll adress to y66
 2. Load "PluginExists" to y77
 3. Run "PluginExists" with one parameter "Skirmish"
 4. Exit if v1<>0
 
 Is v1 result from calling function in step 3? 0-false, 1-true?
 
 In that case step 3 should return false and exit function because there is no "skirmish.era" module that is loaded.
 I can only find "skirmish.era.off" in your folder.
 
 Did i understood well your code?
 
 
 Yes you Understand a bit
 if skirmish is not loaded just ask normal wog question for z999
 
 If you "enable" skirmish.era the skirmish.era would ask by sophisticated behaviour also for z999, so it shouldn't ask in script again. If it's disabled this is only way to ask for z999.
 however skirmish.era didn't work without HD-mod so it is disabled by default.
 |  
 | 
 
| gamemaster 
  
   
   Adventuring Hero
 
 | 
|  posted March 29, 2020 12:11 PM |  |  |  
 
| What is right status of "skirmish"? It should be considered as available or unavailable?
 because of".off" at the end of file name
 |  
 | 
 
| majaczek 
  
   
      Supreme Hero
 Work at Magic Dimmension
 
 | 
|  posted March 29, 2020 12:14 PM |  | Edited by majaczek at 12:17, 29 Mar 2020. |  
 
| gamemaster said:What is right status of "skirmish"?
 It should be considered as available or unavailable?
 because of".off" at the end of file name
 
 
 the ".off" meaning is plugin disabled (like it was in plugin manager tool)
 you can enable it by renaming to skirmish.era or by enabling in plugin manager.
 |  
 | 
|  |