diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-03-24 18:53:27 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-03-24 18:53:27 +0000 |
commit | 44d215e69d768b32c26f62b711baaf41b36fe1ea (patch) | |
tree | 5c8f799747bbbb7c40e36e3e932838b80142bc43 /ServiceBasedPlugins/src/pluginsupport/UPlugin.pas | |
parent | 30dfc2ac6bf6f775c7caf2a5ea89648c0eb71f7f (diff) | |
download | usdx-44d215e69d768b32c26f62b711baaf41b36fe1ea.tar.gz usdx-44d215e69d768b32c26f62b711baaf41b36fe1ea.tar.xz usdx-44d215e69d768b32c26f62b711baaf41b36fe1ea.zip |
some changes to TPlugin
handshake finished
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1657 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'ServiceBasedPlugins/src/pluginsupport/UPlugin.pas')
-rw-r--r-- | ServiceBasedPlugins/src/pluginsupport/UPlugin.pas | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/ServiceBasedPlugins/src/pluginsupport/UPlugin.pas b/ServiceBasedPlugins/src/pluginsupport/UPlugin.pas index 19c23999..447627ca 100644 --- a/ServiceBasedPlugins/src/pluginsupport/UPlugin.pas +++ b/ServiceBasedPlugins/src/pluginsupport/UPlugin.pas @@ -45,19 +45,26 @@ type Filename: WideString;
ErrorReason: WideString;
+ Info: TUS_PluginInfo;
+
procedure OnChangeStatus(Status: TUS_PluginStatus); virtual;
public
constructor Create(Handle: TUS_Handle; Filename: WideString); virtual;
-
+
+ function GetLoader: LongInt; virtual;
+
function GetStatus: TUS_PluginStatus; virtual;
procedure SetStatus(Status: TUS_PluginStatus); virtual;
+ function GetInfo: TUS_PluginInfo; virtual;
+ function Identify(Info: TUS_PluginInfo): boolean; virtual;
+
function GetHandle: TUS_Handle; virtual;
function GetUniqueID: TUS_Handle; virtual;
function GetFilename: WideString; virtual;
- procedure Init; virtual;
- procedure DeInit; virtual;
+ procedure Init; virtual; {$IFDEF HasInline}inline;{$ENDIF}
+ procedure DeInit; virtual; {$IFDEF HasInline}inline;{$ENDIF}
procedure SetError(Reason: WideString); virtual;
function GetErrorReason: WideString; virtual;
@@ -75,6 +82,13 @@ begin Self.Status := psNone;
Self.UniqueID := CalculateUSHash(Filename); //< this should be done another way ;) just for testing purposes
+
+ Self.Info.Version := US_VERSION_UNDEFINED;
+end;
+
+function TPlugin.GetLoader: LongInt;
+begin
+ Result := US_LOADER_UNDEFINED;
end;
function TPlugin.GetStatus: TUS_PluginStatus;
@@ -88,6 +102,29 @@ begin OnChangeStatus(Status);
end;
+function TPlugin.GetInfo: TUS_PluginInfo;
+begin
+ Result := Info;
+end;
+
+function TPlugin.Identify(Info: TUS_PluginInfo): boolean;
+begin
+ Result := false;
+ If (Self.Info.Version = US_VERSION_UNDEFINED) then
+ begin //first identify
+
+ If (Length(Info.Name) > 0) AND (Length(Info.Author) > 0) AND (Length(Info.PluginDesc) > 0) AND (Info.Version <> US_VERSION_UNDEFINED) then
+ begin
+ Self.Info := Info;
+ Result := true;
+ end
+ else
+ SetError('Identify called with incomplete info struct');
+ end
+ else
+ Log.LogWarn('Identify is called twice', Self.Info.Name);
+end;
+
function TPlugin.GetHandle: TUS_Handle;
begin
Result := Handle;
@@ -103,13 +140,13 @@ begin Result := Filename;
end;
-procedure TPlugin.Init;
+procedure TPlugin.Init; {$IFDEF HasInline}inline;{$ENDIF}
begin
if (Status = psWaitingInit) then
SetStatus(psInited);
end;
-procedure TPlugin.DeInit;
+procedure TPlugin.DeInit; {$IFDEF HasInline}inline;{$ENDIF}
begin
if (Status = psInited) then
SetStatus(psDeInited);
|