Skip to content

Commit

Permalink
feat(Era): Update Era source code to 3.9.15. Commit: 3d401e8
Browse files Browse the repository at this point in the history
feat(B2): Update B2 source code to 3.9.15. Commit: 31f0076

Signed-off-by: VuceticBranislav <24853106+VuceticBranislav@users.noreply.github.com>
  • Loading branch information
VuceticBranislav committed Jul 25, 2024
1 parent 0aa1a1f commit dd5d13d
Show file tree
Hide file tree
Showing 34 changed files with 1,638 additions and 958 deletions.
18 changes: 11 additions & 7 deletions Era/AdvErm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ TAssocVar = class
(* Fast temp memory allocator for ERM inline strings storage during commands execution *)
TServiceMemAllocator = record
BufPos: integer;
Buf: array [0..10485760 - 1] of myChar;
Buf: array [0..3000000 - 1] of myChar;
BufBorder: integer;

procedure Init;
Expand Down Expand Up @@ -1845,11 +1845,15 @@ function ExtendedEraService (Cmd: myChar; NumParams: integer; Params: PServicePa
// K(str)/(ind)/[?](strchar) Get/set string character at position
3:
begin
result := CheckCmdParamsEx(Params, NumParams, [ACTION_SET, ACTION_SET or TYPE_INT, TYPE_STR]) and (Params[1].Value.v >= 0);
result := CheckCmdParamsEx(Params, NumParams, [ACTION_SET, ACTION_SET or TYPE_INT, TYPE_ANY]) and (Params[1].Value.v >= 0);

if result then begin
if Params[2].OperGet then begin
Params[2].RetPchar(myPChar(@Params[0].Value.pc[Params[1].Value.v]), 1);
if Params[2].IsStr then begin
Params[2].RetPchar(myPChar(@Params[0].Value.pc[Params[1].Value.v]), 1);
end else begin
Params[2].RetInt(ord(Params[0].Value.pc^));
end;
end else begin
Params[0].Value.pc[Params[1].Value.v] := myPChar(Params[2].Value.v)^;
end;
Expand Down Expand Up @@ -2873,7 +2877,7 @@ function Hook_ZvsHintWindow (OrigFunc: pointer; Self: Heroes.PWndManager; x, y,
result := PatchApi.Call(THISCALL_, OrigFunc, [Self, x, y, z]);
end;

function Hook_ZvsCheckObjHint (C: Core.PHookContext): longbool; stdcall;
function Hook_ZvsCheckObjHint (C: ApiJack.PHookContext): longbool; stdcall;
var
{U} HintSection: TObjDict;
{U} StrValue: TString;
Expand Down Expand Up @@ -3376,7 +3380,7 @@ procedure DumpErmMemory (const DumpFilePath: myAStr);
Legacy.FreeAndNil(Buf);
end; // .procedure DumpErmMemory

function Hook_DumpErmVars (Context: Core.PHookContext): LONGBOOL; stdcall;
function Hook_DumpErmVars (Context: ApiJack.PHookContext): LONGBOOL; stdcall;
begin
GameExt.GenerateDebugInfo;
Context.RetAddr := Core.Ret(0);
Expand Down Expand Up @@ -3551,7 +3555,7 @@ procedure RegisterCommands;
procedure OnBeforeWoG (Event: PEvent); stdcall;
begin
(* Custom ERM memory dump *)
Core.ApiHook(@Hook_DumpErmVars, Core.HOOKTYPE_BRIDGE, @Erm.ZvsDumpErmVars);
ApiJack.HookCode(@Erm.ZvsDumpErmVars, @Hook_DumpErmVars);

(* ERM direct call by hanlder instead of cmd linear scan implementation *)
// Allocate additional local variable for FindErm. CmdHandler: TErmCmdHandler; absolute (EBP - $6C8)
Expand Down Expand Up @@ -3590,7 +3594,7 @@ procedure OnBeforeWoG (Event: PEvent); stdcall;
procedure OnAfterWoG (Event: PEvent); stdcall;
begin
(* SN:H and new events for adventure map tile hints *)
Core.ApiHook(@Hook_ZvsCheckObjHint, Core.HOOKTYPE_BRIDGE, Ptr($74DE9D));
ApiJack.HookCode(Ptr($74DE9D), @Hook_ZvsCheckObjHint);
ApiJack.StdSplice(Ptr($74E007), @Hook_ZvsHintControl0, ApiJack.CONV_THISCALL, 4);
ApiJack.StdSplice(Ptr($74E179), @Hook_ZvsHintWindow, ApiJack.CONV_THISCALL, 4);

Expand Down
3 changes: 2 additions & 1 deletion Era/Era.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ uses
Scripts in 'Scripts.pas',
Lua in 'Lua\Lua.pas',
Json in 'Json.pas',
WogEvo in 'WogEvo.pas';
WogEvo in 'WogEvo.pas',
EventLib in 'EventLib.pas';

begin
FormatSettings.DecimalSeparator := '.';
Expand Down
5 changes: 3 additions & 2 deletions Era/Era.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ $(PostBuildEvent)]]></PostBuildEvent>
<DCCReference Include="Lua\Lua.pas"/>
<DCCReference Include="Json.pas"/>
<DCCReference Include="WogEvo.pas"/>
<DCCReference Include="EventLib.pas"/>
<None Include="VersionInfo.inc"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
Expand All @@ -182,8 +183,8 @@ $(PostBuildEvent)]]></PostBuildEvent>
<Source Name="MainSource">Era.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k290.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp290.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
Expand Down
Loading

0 comments on commit dd5d13d

Please sign in to comment.