From e270d3193a2a5b958e6416ce340246e790f7bd86 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 27 Oct 2007 09:10:29 +0000 Subject: Finished pluginloader, plugininterface Some fixes and error management (needs improvement) in Core and Service/Hook classes. "Clean Plugin Unloading on Error" finished Some debuging messages on startup. to Fix this remove old Plugins from Pluginfolder git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@535 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UServices.pas | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Game/Code/Classes/UServices.pas') diff --git a/Game/Code/Classes/UServices.pas b/Game/Code/Classes/UServices.pas index fce81bd8..0028576b 100644 --- a/Game/Code/Classes/UServices.pas +++ b/Game/Code/Classes/UServices.pas @@ -22,7 +22,7 @@ type Hash: Integer; //4 Bit Hash of the Services Name Name: TServiceName; //Name of this Service - Owner: Integer; //If > 0 [DLLMan Pluginindex + 1]; 0 - undefined, On Error Full shutdown, If < 0 [ModuleIndex - 1] + Owner: Integer; //If < 0 [-(DLLMan Pluginindex + 1)]; 0 - undefined, On Error Full shutdown, If < 0 [ModuleIndex - 1] Next: PServiceInfo; //Pointer to the Next Service in teh list @@ -63,6 +63,7 @@ var ServiceManager: TServiceManager; implementation +uses UCore; //------------ // Create - Creates Class and Set Standard Values @@ -125,6 +126,9 @@ begin Cur.Name := String(ServiceName); Cur.Hash := NametoHash(Cur.Name); + //Add Owner to Service + Cur.Owner := Core.CurExecuted; + //Add Service to the List If (FirstService = nil) then FirstService := Cur; @@ -208,18 +212,26 @@ Function TServiceManager.CallService(const ServiceName: PChar; const wParam, lPa var SExists: Integer; Service: PServiceInfo; + CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute begin Result := SERVICE_NOT_FOUND; SExists := ServiceExists(ServiceName); If (SExists <> 0) then begin + //Backup CurExecuted + CurExecutedBackup := Core.CurExecuted; + Service := ptr(SExists); + If (Service.isClass) then //Use Proc of Class Result := Service.ProcOfClass(wParam, lParam) Else //Use normal Proc Result := Service.Proc(wParam, lParam); + + //Restore CurExecuted + Core.CurExecuted := CurExecutedBackup; end; {$IFDEF DEBUG} -- cgit v1.2.3