From aa901783a0dc07f0dc08628d3ca091a9164b0629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Vehvil=C3=A4inen?= Date: Mon, 30 Dec 2002 22:14:47 +0000 Subject: *** empty log message *** svn path=/trunk/Framestein/; revision=312 --- Source/pluginunit.pas | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'Source/pluginunit.pas') diff --git a/Source/pluginunit.pas b/Source/pluginunit.pas index ddee99c..f331ed8 100644 --- a/Source/pluginunit.pas +++ b/Source/pluginunit.pas @@ -32,18 +32,21 @@ type const ret: PChar ); cdecl; + TInfoProc = procedure(const str: PChar); cdecl; + TPointerList = TList; TLibraryList = TList; TPlugins = class(TComponent) private - Names: TStringList; EffectProcs: TPointerList; CopyProcs: TPointerList; + InfoProcs: TPointerList; Libs: TLibraryList; procedure LoadHandleFile(const SearchRec: TSearchRec; const FullPath: String); public + Names: TStringList; constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Load; @@ -56,6 +59,7 @@ type function CallCopy(const d1: TDirectDrawSurface; const d2: TDirectDrawSurface; const procIndex: Integer; const args: String): Boolean; + function Info(const procIndex: Integer): String; end; implementation @@ -70,6 +74,7 @@ type const EffectProcName = 'perform_effect'; CopyProcName = 'perform_copy'; + InfoProcName = 'info'; { TPlugins } @@ -79,6 +84,7 @@ begin Names := TStringList.Create; EffectProcs := TPointerList.Create; CopyProcs := TPointerList.Create; + InfoProcs := TPointerList.Create; Libs := TLibraryList.Create; end; @@ -114,6 +120,7 @@ var b: array[0..255] of Char; EffectProc: TEffectProc; CopyProc: TCopyProc; + InfoProc: TInfoProc; s: String; i: Integer; begin @@ -123,12 +130,14 @@ begin if h<>0 then begin @EffectProc := GetProcAddress(h, EffectProcName); @CopyProc := GetProcAddress(h, CopyProcName); + @InfoProc := GetProcAddress(h, InfoProcName); s := ExtractFileName(FullPath); i := Pos('.DLL', UpperCase(s)); if i>0 then Delete(s, i, 255); Names.Add(s); EffectProcs.Add(@EffectProc); CopyProcs.Add(@CopyProc); + InfoProcs.Add(@InfoProc); Libs.Add(@h); end; end; @@ -217,5 +226,23 @@ begin Result := True; end; +function TPlugins.Info(const procIndex: Integer): String; +var + Proc: TInfoProc; + buf: array[0..255] of Char; + p: PChar; +begin + if (procIndex=-1) or (procIndex>=InfoProcs.Count) then Exit; + @Proc := InfoProcs[procIndex]; + if @Proc=nil then begin + Result := ''; + Exit; + end; + buf[0]:=#0; + p := @buf; + Proc(p); + Result := StrPas(p); +end; + end. -- cgit v1.2.1