aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-10-03 12:43:01 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-10-03 12:43:01 +0000
commitfdb75fa47dd72522b705e94be5a201c4e1a731cb (patch)
treeef1c31e621aea90f749283e8e82c7a89075887e2 /Game/Code/Classes
parent2e7eca65cf05d8090ef58381d576d5218edd9654 (diff)
downloadusdx-fdb75fa47dd72522b705e94be5a201c4e1a731cb.tar.gz
usdx-fdb75fa47dd72522b705e94be5a201c4e1a731cb.tar.xz
usdx-fdb75fa47dd72522b705e94be5a201c4e1a731cb.zip
New plugin SDK added
Some more debug information for windows builds (Does this work in lazarus?) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@466 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/ULog.pas16
-rw-r--r--Game/Code/Classes/UPluginInterface.pas179
2 files changed, 191 insertions, 4 deletions
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas
index 7c93c6e9..7e464b57 100644
--- a/Game/Code/Classes/ULog.pas
+++ b/Game/Code/Classes/ULog.pas
@@ -188,6 +188,11 @@ begin
FileErrorO := false;
end;
end;
+ {$DEFINE DEBUG} //How can i check if this is set in *.dpr file o0
+ //If Debug => Write to Console Output
+ {$IFDEF DEBUG}
+ WriteLn('Error: ' + Text);
+ {$ENDIF}
end;
procedure TLog.LogVoice(SoundNr: integer);
@@ -219,10 +224,13 @@ end;
procedure TLog.LogStatus(Log1, Log2: string);
begin
//Just for Debugging
- //Comment for Release
- //LogAnalyze (Log2 + ': ' + Log1);
-
- LogError(Log2 + ': ' + Log1);
+ //Comment for Release
+ //LogError(Log2 + ': ' + Log1);
+
+ //If Debug => Write to Console Output
+ {$IFDEF DEBUG}
+ WriteLn(Log2 + ': ' + Log1);
+ {$ENDIF}
end;
procedure TLog.LogError(Log1, Log2: string);
diff --git a/Game/Code/Classes/UPluginInterface.pas b/Game/Code/Classes/UPluginInterface.pas
new file mode 100644
index 00000000..6d17d51d
--- /dev/null
+++ b/Game/Code/Classes/UPluginInterface.pas
@@ -0,0 +1,179 @@
+unit uPluginInterface;
+{*********************
+ uPluginInterface
+ Unit fills a TPluginInterface Structur with Method Pointers
+ Unit Contains all Functions called directly by Plugins
+*********************}
+
+interface
+uses uPluginDefs;
+
+//---------------
+// Procedure that Sets the PluginInterface Record
+//---------------
+ Procedure Init_PluginInterface;
+
+//---------------
+// Methods for Plugin
+//---------------
+ {******** Hook specific Methods ********}
+ {Function Creates a new Hookable Event and Returns the Handle
+ or 0 on Failure. (Name already exists)}
+ Function CreateHookableEvent (EventName: PChar): THandle; stdcall;
+
+ {Function Destroys an Event and Unhooks all Hooks to this Event.
+ 0 on success, not 0 on Failure}
+ Function DestroyHookableEvent (hEvent: THandle): integer; stdcall;
+
+ {Function start calling the Hook Chain
+ 0 if Chain is called until the End, -1 if Event Handle is not valid
+ otherwise Return Value of the Hook that breaks the Chain}
+ Function NotivyEventHooks (hEvent: THandle; wParam, lParam: dWord): integer; stdcall;
+
+ {Function Hooks an Event by Name.
+ Returns Hook Handle on Success, otherwise 0}
+ Function HookEvent (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall;
+
+ {Function Removes the Hook from the Chain
+ Returns 0 on Success}
+ Function UnHookEvent (hHook: THandle): Integer; stdcall;
+
+ {Function Returns Non Zero if a Event with the given Name Exists,
+ otherwise 0}
+ Function EventExists (EventName: PChar): Integer; stdcall;
+
+ {******** Service specific Methods ********}
+ {Function Creates a new Service and Returns the Services Handle
+ or 0 on Failure. (Name already exists)}
+ Function CreateService (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall;
+
+ {Function Destroys a Service.
+ 0 on success, not 0 on Failure}
+ Function DestroyService (hService: THandle): integer; stdcall;
+
+ {Function Calls a Services Proc
+ Returns Services Return Value or SERVICE_NOT_FOUND on Failure}
+ Function CallService (ServiceName: PChar; wParam, lParam: dWord): integer; stdcall;
+
+ {Function Returns Non Zero if a Service with the given Name Exists,
+ otherwise 0}
+ Function ServiceExists (ServiceName: PChar): Integer; stdcall;
+
+var
+ PluginInterface: TUS_PluginInterface;
+
+implementation
+
+//---------------
+// Procedure that Sets the PluginInterface Record
+//---------------
+Procedure Init_PluginInterface;
+begin
+ PluginInterface.CreateHookableEvent := CreateHookableEvent;
+ PluginInterface.DestroyHookableEvent := DestroyHookableEvent;
+ PluginInterface.NotivyEventHooks := NotivyEventHooks;
+ PluginInterface.HookEvent := HookEvent;
+ PluginInterface.UnHookEvent := UnHookEvent;
+ PluginInterface.EventExists := EventExists;
+
+ PluginInterface.CreateService := CreateService;
+ PluginInterface.DestroyService := DestroyService;
+ PluginInterface.CallService := CallService;
+ PluginInterface.ServiceExists := ServiceExists;
+end;
+
+
+{******** Hook specific Methods ********}
+//---------------
+// Function Creates a new Hookable Event and Returns the Handle
+// or 0 on Failure. (Name already exists)
+//---------------
+Function CreateHookableEvent (EventName: PChar): THandle; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Destroys an Event and Unhooks all Hooks to this Event.
+// 0 on success, not 0 on Failure
+//---------------
+Function DestroyHookableEvent (hEvent: THandle): integer; stdcall;
+begin
+
+end;
+
+//---------------
+// Function start calling the Hook Chain
+// 0 if Chain is called until the End, -1 if Event Handle is not valid
+// otherwise Return Value of the Hook that breaks the Chain
+//---------------
+Function NotivyEventHooks (hEvent: THandle; wParam, lParam: dWord): integer; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Hooks an Event by Name.
+// Returns Hook Handle on Success, otherwise 0
+//---------------
+Function HookEvent (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Removes the Hook from the Chain
+// Returns 0 on Success
+//---------------
+Function UnHookEvent (hHook: THandle): Integer; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Returns Non Zero if a Event with the given Name Exists,
+// otherwise 0
+//---------------
+Function EventExists (EventName: PChar): Integer; stdcall;
+begin
+
+end;
+
+ {******** Service specific Methods ********}
+//---------------
+// Function Creates a new Service and Returns the Services Handle
+// or 0 on Failure. (Name already exists)
+//---------------
+Function CreateService (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Destroys a Service.
+// 0 on success, not 0 on Failure
+//---------------
+Function DestroyService (hService: THandle): integer; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Calls a Services Proc
+// Returns Services Return Value or SERVICE_NOT_FOUND on Failure
+//---------------
+Function CallService (ServiceName: PChar; wParam, lParam: dWord): integer; stdcall;
+begin
+
+end;
+
+//---------------
+// Function Returns Non Zero if a Service with the given Name Exists,
+// otherwise 0
+//---------------
+Function ServiceExists (ServiceName: PChar): Integer; stdcall;
+begin
+
+end;
+
+end.