library CourseRHA; { Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses System.SysUtils, System.Classes, System.JSON, Windows, uHCDateTime in '..\..\shared\pascal\uHCDateTime.pas', uHCDefines in '..\..\shared\pascal\uHCDefines.pas', uHCGlobals in '..\..\shared\pascal\uHCGlobals.pas', uHCTypeDefs in '..\..\shared\pascal\uHCTypeDefs.pas' {/,} , uCourseRHA in 'uCourseRHA.pas' {frmCourseRHA}; {$R *.res} const DLLVERN = 1; DLLVERINTN = 16; var gFrmCourseRHA: TfrmCourseRHA; dt_scen_start: PHCDateTimeRec; PBusyDLL: Pointer; { *** 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 := 'DLL to allow a player to set a group''s heading, altitude, speed, and distance to travel, by Tony Eischens'; end; { *** Free DLL *** } procedure DLLFree(); export; cdecl; begin // Do any cleanup here, this is the end gFrmCourseRHA.Free; end; { *** Init DLL *** } procedure DLLInit(hwndHC: HWND; pathHC: PAnsiChar; verHC: PAnsiChar; verSaveGame: LongWord; funcRefs: PHCDLL_FUNC_REF; PGEClosing: Pointer; PDLLBusy: Pointer; verInterface: LongWord); export; cdecl; begin PBusyDLL := PDLLBusy; gFrmCourseRHA := TfrmCourseRHA.Create(nil); gFrmCourseRHA.Show; end; procedure ScenLoad(strHarpPath: PAnsiChar; intScenNum: SmallInt; strScenFPath: PAnsiChar; intBSNum: ShortInt; strBSFName: PAnsiChar; intSide: byte; intGameTimeIn: Long; intGameTimeLeftIn: Long; dt_scen_start_in: PHCDateTimeRec); export; cdecl; begin byte(PBusyDLL^) := CTRUE; // ALE 20130816 don't process other events in GE dt_scen_start := dt_scen_start_in; byte(PBusyDLL^) := CFALSE; end; procedure GameTime(GameTime: Long; GameTimeLeft: Long); export; cdecl; begin byte(PBusyDLL^) := CTRUE; // ALE 20130816 don't process other events in GE // Do something here // ALE 20160811 we should refresh the group list here byte(PBusyDLL^) := CFALSE; // ALE 20130816 don't process other events in GE end; procedure StartGroup(pStartGroup: PHCGroup); export; cdecl; var lHCGroup: PHCGroup; begin byte(PBusyDLL^) := CTRUE; // ALE 20130816 don't process other events in GE // ALE 20160721 We should refresh the Group list here if (gFrmCourseRHA <> nil) then begin gFrmCourseRHA.lbxGroupList.Items.Clear; lHCGroup := pStartGroup; while (lHCGroup <> nil) do begin gFrmCourseRHA.lbxGroupList.AddItem(lHCGroup.id); lHCGroup := PHCGroup(lHCGroup.toSouth); end; end; byte(PBusyDLL^) := CFALSE; // ALE 20130816 don't process other events in GE end; exports DLLVer, DLLVerInt, DLLDesc, DLLFree, DLLInit, ScenLoad, GameTime, StartGroup; end.