library AnnexEdit; {$mode delphi}{$H+} {$R *.res} uses Classes { you can add units after this } , Mainform, uHCDefines , uHCGCI, uHCGlobals, uHCTypeDefs, uHCEventHelpers, uHCDateTime , uHCAnnexDefs, uHCAnnexHelpers, uLazGUIGlobals, uHCUtils , Windows, Forms, ShellAPI, SysUtils ,Types ,Dialogs, Interfaces, Controls, FileInfo; const DLLVERN = 1; DLLVERINTN = 39; // 37 var frmMain: TfrmMain; intGameTime: Long; FileVersionInfo: TFileVersionInfo; strFileVers, strGEVers: String; {*** Return DLL internal version, i.e. revision 5 of my DLL ***} function DLLVer():word;export;cdecl; begin result := DLLVERN; end; {*** Return DLL interface version, i.e. revision 1 of my HCE interface spec ***} function DLLVerInt():word;export;cdecl; begin result := DLLVERINTN; end; {*** Return DLL description, 255 characters max ***} function DLLDesc():PAnsiChar;export;cdecl; begin result := 'use with HC to provide assistance for sight impared by Don Thomas'; end; {*** Free DLL ***} procedure DLLFree();export;cdecl; begin // Do any cleanup here, this is the end frmMain.WindowState:= wsMinimized; // 240906 frmMain.Free; end; {*** Init DLL ***} procedure DLLInit(hwndHC: HWND; pathHC: PAnsiChar; verHC: PAnsiChar; verSaveGame: LongWord; funcRefs: PHCDLL_FUNC_REF; PGEClosing: Pointer; PDLLBusy: Pointer; verInterface: LongWord; srandSeed: longword; harpoon_uuid_session: PAnsiChar; hclicense_dt_expire: Int64; hclicense_licensee: PAnsiChar; usblicense_desc: PAnsiChar; RESRSRStructureVersion: ulong; AnnexVersion: ushort //; GameComponent: uchar; pLosTable: PHCLosTable );export;cdecl; var funcTmp: PHCDLL_FUNC_REF; begin // here we initialize globals and such for the life of the DLL Application.Initialize; // ALE 20120410 Freezes HC Application.Run; uLazGUIGlobals.PGEClosing:=PGEClosing; uLazGUIGlobals.PDLLBusy:=PDLLBusy; uLazGUIGlobals.hwndHC:=hwndHC; // 20230405 version update uLazGUIGlobals.intVerInterface:=verInterface; uLazGUIGlobals.intVerSaveGame:=verSaveGame; FileVersionInfo:= TFileVersionInfo.Create(nil); FileVersionInfo.ReadFileInfo; frmMain := TfrmMain.Create(nil); frmMain.ParentWindow := hwndHC; // 230407 reside in harpwindow strFileVers:= FileVersionInfo.VersionStrings.Values['FileVersion']; FileVersionInfo.Free; if Length(strFileVers) = 0 then strFileVers := '1.0.1'; frmMain.Caption := 'AnnexEdit V ' + strFileVers + ', ExportDLL Interface v ' + IntToStr(DLLVERINTN) + 'for GE v 2025.023+'; // ALE 20130908 List the function pointers sent over by the GE // then capture one of them for example usage funcTmp := funcRefs; while (funcTmp <> nil) do begin if (funcTmp^.funcName = 'NewPtr') then frmMain.NewPtr := funcTmp^.funcPtr else if (funcTmp^.funcName = 'QueueHarpoonEvent') then frmMain.HCQueueHarpoonEvent := THCQueueHarpoonEvent(funcTmp^.funcPtr) else if (funcTmp^.funcName = 'dllCheckLatLonDepth') then frmMain.HCdllCheckLatLonDepth := THCdllCheckLatLonDepth(funcTmp^.funcPtr) else if (funcTmp^.funcName = 'annex_id_to_disk_id') then frmMain.HCannex_id_to_disk_id := THCannex_id_to_disk_id(funcTmp^.funcPtr) else if (funcTmp^.funcName = 'disk_id_to_annex_id') then frmMain.HCdisk_id_to_annex_id := THCdisk_id_to_annex_id(funcTmp^.funcPtr) else if (funcTmp^.funcName = 'free_Unit') then frmMain.HCfree_Unit := THCfree_Unit(funcTmp^.funcPtr) else if (funcTmp^.funcName = 'free_Group') then frmMain.HCfree_Group := THCfree_Group(funcTmp^.funcPtr) else if (funcTmp^.funcName = 'ChangeActGroupPtr') then frmMain.HCChangeActGroupPtr := THCChangeActGroupPtr(funcTmp^.funcPtr) else if (funcTmp^.funcName = 'ChangeActUnitPtr') then frmMain.HCChangeActUnitPtr := THCChangeActUnitPtr(funcTmp^.funcPtr) ; funcTmp := funcTmp^.next; end; frmMain.Show; frmMain.WindowState:= wsNormal; // 230407 240503 250301 frmMain.BringToFront; strGEVers:= verHC; end; procedure ScenLoad(strHarpPath: PAnsiChar; intScenNum: SmallInt; strScenFPath: PAnsiChar; intBSNum: ShortInt; strBSFName: PAnsiChar; intSide: byte; intGameTimeIn: Long; intGameTimeLeftIn: Long; // 20230405 dt_scen_start_in: PHCDateTimeRec; AnnexDataIn: PHCAnnexes_disk; DatabaseVersionDBIn: PHCDATABASE_VERSION; ScenDataIn: PHCSCENARIO_DATA; ScenSaveDataIn: PHCSCENARIO_SAVE_DATA; GlobalsIn: PHCGlobals);export;cdecl; var intIdx: NativeUInt; pLoadout: PHCAnnexY1_disk; pShip: PHCAnnexA1_disk; pSub: PHCAnnexA2_disk; pAir: PHCAnnexB1_disk; pBase: PHCAnnexP1_disk; pGun: PHCAnnexC1_disk; pMissile: PHCAnnexD1_disk; pBomb: PHCAnnexG1_disk; pECM: PHCAnnexG2_disk; pNuke: PHCAnnexI1_disk; pRadar: PHCAnnexJ1_disk; pSonar: PHCAnnexM1_disk; pMount: PHCAnnexZ1_disk; pMulti: PHCAnnexZ2_disk; strScenNum, strBatSetName: string; TimeNowTimeRec: THCDateTimeRec; begin frmMain.intPSide:= intSide; intGameTime := intGameTimeIn; // ALE 20150712 Now that we receive the game time here, store it intGameTimeLeft := intGameTimeLeftIn; // ALE 20150712 Now that we receive the game time left here, store it end; procedure ProcessAnnexAmends; // this is guts of library edit for individual - also processUnit var pSub: PHCAnnexA2_disk; pSurf: PHCAnnexA1_disk; pMissile: PHCAnnexD1_disk; pMnt: PHCAnnexZ1_disk; pASW: PHCAnnexE1_disk; // :PHCPlatformDescription; begin // 250205 edit sub annex for drone semi submerged using Intrepido 15 columbia // HCDB2 pSub:= HCAnnexHelper.HCGetAnnexA2(4107); pSub^.RCS:= 1; pSub^.BaseSourceLevel:= 42; pSub^.DetectSize:= 1; pSub^.SensId[0]:= 47154; // 250206 pSub^.SensId[1]:= 43103; pSub^.OrigDp:= 1; pSub^.Displacement:= 1; pSub^.Length:= 5; pSub^.PictureIndex:=0; pSub^.CreepSpeed:= 15; pSub^.MaxSurfSpeed:= 40; pSub^.MaxSubSpeed:= 50; pSub^.MaxDepth:= Snorkel; pSub^.MntId[0]:= 60722; // suicide charge pSub^.MntId[1]:= INVALID_ID; // 250810 pSub^.ClassName:= 'SemiSubDroneSwarm'; pSub^.Country:= 15; // intl // end sub pSurf:= HCAnnexHelper.HCGetAnnexA1(3901); // 250206 Algeria type 20GC PG pSurf^.RCS:= 5; pSurf^.DetectSize:= 1; pSurf^.OrigDp:= 3; pSurf^.SearchHeight:= ScopeAlt; pSurf^.BaseSourceLevel:= 50; pSurf^.SensId[0]:= 43103; pSurf^.ClassName:= 'SurfDroneSwarm'; pSurf^.MntId[0]:= 60722; pSurf^.MaxSpeed:= 50; pSurf:= HCAnnexHelper.HCGetAnnexA1(2656); // drugrunner has MG pSurf^.ClassName:= 'CB-90'; // 250220 pSurf^.Country:= 15; // intl pSurf^.MntId[1]:= 59642; // 80mm mortar pSurf^.MaxSpeed:= 40; // pMnt:= HCAnnexHelper.HCGetAnnexZ1(60722); // suicide mnt pMnt^.NumRoundsMnt:=5; pMnt^.NumTargets:= 1; pMissile:= HCAnnexHelper.HCGetAnnexD1(19011); pMissile^.Dp:= 120; pMissile^.SurfPh:= 65; pMissile^.SurfRange:= 10; pMissile^.Speed:= 50; pASW:= HCAnnexHelper.HCGetAnnexE1(22535); // amend RBU 1200(RBU-12) pASW^.ClassName:= 'AntiSnortDrone Gun'; pASW^.MaxRange:= 30; pASW^.MinRange:= 1; pASW^.Ph:= 25; end; procedure DBLoaded(AnnexDataIn: PHCAnnexes_disk; AnnexDataMemIn: PHCAnnexes_mem) export; cdecl; begin if (AnnexDataMemIn = nil) then begin AnnexData := AnnexDataIn; HCAnnexHelper := THCAnnexHelper.Create(AnnexDataIn, frmMain.HCannex_id_to_disk_id, uLazGUIGlobals.intVerInterface, uLazGUIGlobals.intVerSaveGame); ProcessAnnexAmends; // needs a hcdb2 test end else begin AnnexData_mem := AnnexDataMemIn; HCAnnexMemHelper := THCAnnexMemHelper.Create(AnnexDataMemIn, frmMain.HCannex_id_to_disk_id); end; end; procedure StartGroup(StartGroup: PHCGroup);export;cdecl; var PHCGThis: PHCGroup; begin frmMain.PStartGroup:=StartGroup; end; exports DLLVer, DLLVerInt, DLLDesc, DLLFree, DLLInit, ScenLoad, StartGroup, DBLoaded ; end.