mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-26 03:02:15 -05:00
Ben, either get rid of those run parameters in your compiler options or stop commiting project1.lpi please ^_^.
Added a copydata parameter to TRawTarget.create. (This now fixes a memory leak in Unfreeze). Also please get rid of those two extra spaces in front of everything, so anti-pascal-syntax ^^. Also fixed the bug in IsTargetValid. git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@452 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
3d4131af95
commit
2b8721e6b0
@ -65,7 +65,7 @@ interface
|
||||
| Currently this uses the pointer as-is, but it might be needed to make a local copy... }
|
||||
TRawTarget = class(TTarget)
|
||||
public
|
||||
constructor Create(rgb: prgb32; w,h: integer);
|
||||
constructor Create(rgb: prgb32; w,h: integer; CopyData : boolean);
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure GetTargetDimensions(var w, h: integer); override;
|
||||
@ -73,6 +73,7 @@ interface
|
||||
|
||||
private
|
||||
rgb: prgb32;
|
||||
freedata : boolean;
|
||||
w,h: integer;
|
||||
end;
|
||||
|
||||
@ -246,8 +247,8 @@ implementation
|
||||
|
||||
//***implementation*** TIOManager
|
||||
|
||||
constructor TIOManager_Abstract.Create(plugin_dir: string);
|
||||
begin
|
||||
constructor TIOManager_Abstract.Create(plugin_dir: string);
|
||||
begin
|
||||
inherited Create;
|
||||
eios_controller.AddAndLoadPath(plugin_dir);
|
||||
keymouse:= nil;
|
||||
@ -255,45 +256,49 @@ implementation
|
||||
frozen:= nil;
|
||||
NativeInit;
|
||||
SetDesktop;
|
||||
end;
|
||||
{
|
||||
self.create;
|
||||
eios_controller.AddAndLoadPath(plugin_dir);
|
||||
}
|
||||
end;
|
||||
|
||||
constructor TIOManager_Abstract.Create;
|
||||
begin
|
||||
constructor TIOManager_Abstract.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
keymouse:= nil;
|
||||
image:= nil;
|
||||
frozen:= nil;
|
||||
NativeInit;
|
||||
SetDesktop;
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TIOManager_Abstract.Destroy;
|
||||
begin
|
||||
destructor TIOManager_Abstract.Destroy;
|
||||
begin
|
||||
if bothsame then keymouse.Destroy() else
|
||||
begin
|
||||
keymouse.Free();
|
||||
image.Free();
|
||||
end;
|
||||
if frozen <> nil then frozen.Destroy();
|
||||
end;
|
||||
if IsFrozen then frozen.Destroy();
|
||||
end;
|
||||
|
||||
procedure TIOManager_Abstract.SetImageTarget(target: TTarget);
|
||||
begin
|
||||
if frozen <> nil then
|
||||
procedure TIOManager_Abstract.SetImageTarget(target: TTarget);
|
||||
begin
|
||||
if IsFrozen then
|
||||
raise Exception.Create('You cannot set a target when Frozen');
|
||||
if not(bothsame) then image.Free();
|
||||
image:= target;
|
||||
bothsame:= false;
|
||||
end;
|
||||
procedure TIOManager_Abstract.SetKeyMouseTarget(target: TTarget);
|
||||
begin
|
||||
end;
|
||||
procedure TIOManager_Abstract.SetKeyMouseTarget(target: TTarget);
|
||||
begin
|
||||
if not(bothsame) then keymouse.Free();
|
||||
keymouse:= target;
|
||||
bothsame:= false;
|
||||
end;
|
||||
procedure TIOManager_Abstract.SetBothTargets(target: TTarget);
|
||||
begin
|
||||
if frozen <> nil then
|
||||
end;
|
||||
procedure TIOManager_Abstract.SetBothTargets(target: TTarget);
|
||||
begin
|
||||
if IsFrozen then
|
||||
raise Exception.Create('You cannot set a target when Frozen');
|
||||
if bothsame then image.Destroy() else
|
||||
begin
|
||||
@ -303,111 +308,107 @@ implementation
|
||||
image:= target;
|
||||
keymouse:= target;
|
||||
bothsame:= true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIOManager_Abstract.SetFrozen(makefrozen: boolean);
|
||||
var
|
||||
procedure TIOManager_Abstract.SetFrozen(makefrozen: boolean);
|
||||
var
|
||||
w,h: integer;
|
||||
buffer: TRetData;
|
||||
begin
|
||||
if (makefrozen) and (frozen <> nil) then
|
||||
begin
|
||||
if (makefrozen) and (IsFrozen) then
|
||||
raise Exception.Create('The window is already frozen.');
|
||||
//BenLand100 edit: I say we leave this exception out. POLS
|
||||
//if not(isfrozen) and (frozen = nil) then
|
||||
// raise Exception.Create('The window is not frozen.');
|
||||
if not(makefrozen) then
|
||||
begin
|
||||
image.Free();
|
||||
image:= frozen;
|
||||
frozen:= nil;
|
||||
end else if frozen = nil then
|
||||
if makefrozen then //No need for the Frozen = nil check, already done above with the exception.
|
||||
begin
|
||||
frozen:= image;
|
||||
frozen.GetTargetDimensions(w,h);
|
||||
buffer:= frozen.ReturnData(0,0,w,h);
|
||||
GetMem(freezebuffer, w * h * sizeof(TRGB32));
|
||||
Move(buffer.Ptr[0], freezebuffer[0], w*h*sizeof(TRGB32));
|
||||
image:= TRawTarget.Create(buffer.Ptr,w,h,true);
|
||||
frozen.FreeReturnData;
|
||||
image:= TRawTarget.Create(freezebuffer,w,h);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TIOManager_Abstract.IsFrozen: boolean;
|
||||
end else
|
||||
begin
|
||||
image.Free();
|
||||
image:= frozen;
|
||||
frozen:= nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TIOManager_Abstract.IsFrozen: boolean;
|
||||
begin
|
||||
result:= frozen <> nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TIOManager_Abstract.GetColor(x,y : integer) : TColor; begin result:= image.GetColor(x,y); end;
|
||||
function TIOManager_Abstract.ReturnData(xs,ys,width,height: integer): TRetData; begin result:= image.ReturnData(xs,ys,width,height); end;
|
||||
procedure TIOManager_Abstract.FreeReturnData; begin image.freeReturnData(); end;
|
||||
function TIOManager_Abstract.GetColor(x,y : integer) : TColor; begin result:= image.GetColor(x,y); end;
|
||||
function TIOManager_Abstract.ReturnData(xs,ys,width,height: integer): TRetData; begin result:= image.ReturnData(xs,ys,width,height); end;
|
||||
procedure TIOManager_Abstract.FreeReturnData; begin image.freeReturnData(); end;
|
||||
|
||||
function TIOManager_Abstract.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; begin SetImageTarget(TRawTarget.Create(ArrPtr,Size.X,Size.Y)); end;
|
||||
function TIOManager_Abstract.SetTarget(bmp : TMufasaBitmap) : integer; begin SetImageTarget(TRawTarget.Create(bmp.FData,bmp.width,bmp.height)); end;
|
||||
function TIOManager_Abstract.SetTarget(name: string; initargs: pointer): integer;
|
||||
var
|
||||
function TIOManager_Abstract.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; begin SetImageTarget(TRawTarget.Create(ArrPtr,Size.X,Size.Y,false)); end;
|
||||
function TIOManager_Abstract.SetTarget(bmp : TMufasaBitmap) : integer; begin SetImageTarget(TRawTarget.Create(bmp.FData,bmp.width,bmp.height,false)); end;
|
||||
function TIOManager_Abstract.SetTarget(name: string; initargs: pointer): integer;
|
||||
var
|
||||
client: TEIOS_Client;
|
||||
begin
|
||||
begin
|
||||
if not eios_controller.ClientExists(name) then raise Exception.Create('EIOS Client by specified name does not exist');
|
||||
client:= eios_controller.GetClient(name);
|
||||
SetBothTargets(TEIOS_Target.Create(client, initargs));
|
||||
end;
|
||||
end;
|
||||
|
||||
function TIOManager_Abstract.TargetValid: Boolean;
|
||||
begin
|
||||
function TIOManager_Abstract.TargetValid: Boolean;
|
||||
begin
|
||||
result:= false;
|
||||
if (keymouse <> nil) and (image <> nil) then
|
||||
begin
|
||||
result := (keymouse.TargetValid and image.TargetValid);
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
procedure TIOManager_Abstract.GetDimensions(var W, H: Integer); begin image.GetTargetDimensions(w,h) end;
|
||||
procedure TIOManager_Abstract.ActivateClient; begin {lolwat} end;
|
||||
|
||||
procedure TIOManager_Abstract.GetDimensions(var W, H: Integer); begin image.GetTargetDimensions(w,h) end;
|
||||
procedure TIOManager_Abstract.ActivateClient; begin {lolwat} end;
|
||||
|
||||
procedure TIOManager_Abstract.GetMousePos(var X, Y: Integer); begin keymouse.GetMousePosition(x,y) end;
|
||||
procedure TIOManager_Abstract.SetMousePos(X, Y: Integer); begin keymouse.MoveMouse(x,y); end;
|
||||
procedure TIOManager_Abstract.HoldMouse(x,y : integer; button: TClickType); begin keymouse.ReleaseMouse(x,y,button); end;
|
||||
procedure TIOManager_Abstract.ReleaseMouse(x,y : integer; button: TClickType); begin keymouse.ReleaseMouse(x,y,button); end;
|
||||
procedure TIOManager_Abstract.ClickMouse(X, Y: Integer; button: TClickType);
|
||||
begin
|
||||
procedure TIOManager_Abstract.GetMousePos(var X, Y: Integer); begin keymouse.GetMousePosition(x,y) end;
|
||||
procedure TIOManager_Abstract.SetMousePos(X, Y: Integer); begin keymouse.MoveMouse(x,y); end;
|
||||
procedure TIOManager_Abstract.HoldMouse(x,y : integer; button: TClickType); begin keymouse.ReleaseMouse(x,y,button); end;
|
||||
procedure TIOManager_Abstract.ReleaseMouse(x,y : integer; button: TClickType); begin keymouse.ReleaseMouse(x,y,button); end;
|
||||
procedure TIOManager_Abstract.ClickMouse(X, Y: Integer; button: TClickType);
|
||||
begin
|
||||
HoldMouse(x,y,button);
|
||||
//BenLand100 note: probably should wait here
|
||||
ReleaseMouse(x,y,button);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIOManager_Abstract.KeyUp(key: Word); begin keymouse.ReleaseKey(key) end;
|
||||
procedure TIOManager_Abstract.KeyDown(key: Word); begin keymouse.HoldKey(key) end;
|
||||
procedure TIOManager_Abstract.PressKey(key: Word); begin keyup(key); keydown(key); end;
|
||||
procedure TIOManager_Abstract.SendText(text: string); begin keymouse.SendString(text); end;
|
||||
function TIOManager_Abstract.isKeyDown(key: Word): Boolean; begin result:= keymouse.IsKeyHeld(key); end;
|
||||
procedure TIOManager_Abstract.KeyUp(key: Word); begin keymouse.ReleaseKey(key) end;
|
||||
procedure TIOManager_Abstract.KeyDown(key: Word); begin keymouse.HoldKey(key) end;
|
||||
procedure TIOManager_Abstract.PressKey(key: Word); begin keyup(key); keydown(key); end;
|
||||
procedure TIOManager_Abstract.SendText(text: string); begin keymouse.SendString(text); end;
|
||||
function TIOManager_Abstract.isKeyDown(key: Word): Boolean; begin result:= keymouse.IsKeyHeld(key); end;
|
||||
|
||||
//***implementation*** TTarget
|
||||
|
||||
procedure TTarget.GetTargetDimensions(var w, h: integer); begin raise Exception.Create('GetTargetDimensions not avaliable for this target'); end;
|
||||
function TTarget.GetColor(x,y : integer) : TColor;
|
||||
begin
|
||||
procedure TTarget.GetTargetDimensions(var w, h: integer); begin raise Exception.Create('GetTargetDimensions not avaliable for this target'); end;
|
||||
function TTarget.GetColor(x,y : integer) : TColor;
|
||||
begin
|
||||
with ReturnData(x,y,1,1) do
|
||||
Result := RGBToColor(Ptr[0].r,Ptr[0].g,Ptr[0].b);
|
||||
FreeReturnData;
|
||||
end;
|
||||
function TTarget.ReturnData(xs, ys, width, height: Integer): TRetData; begin raise Exception.Create('ReturnData not avaliable for this target'); end;
|
||||
procedure TTarget.FreeReturnData; begin {do nothing by default} end;
|
||||
procedure TTarget.ActivateClient; begin raise Exception.Create('ActivateClient not avaliable for this target'); end;
|
||||
function TTarget.TargetValid: boolean; begin result:= true; end;
|
||||
end;
|
||||
function TTarget.ReturnData(xs, ys, width, height: Integer): TRetData; begin raise Exception.Create('ReturnData not avaliable for this target'); end;
|
||||
procedure TTarget.FreeReturnData; begin {do nothing by default} end;
|
||||
procedure TTarget.ActivateClient; begin raise Exception.Create('ActivateClient not avaliable for this target'); end;
|
||||
function TTarget.TargetValid: boolean; begin result:= true; end;
|
||||
|
||||
procedure TTarget.GetMousePosition(var x,y: integer); begin raise Exception.Create('GetMousePosition not avaliable for this target'); end;
|
||||
procedure TTarget.MoveMouse(x,y: integer); begin raise Exception.Create('MoveMouse not avaliable for this target'); end;
|
||||
procedure TTarget.HoldMouse(x,y: integer; button: TClickType); begin raise Exception.Create('HoldMouse not avaliable for this target'); end;
|
||||
procedure TTarget.ReleaseMouse(x,y: integer; button: TClickType); begin raise Exception.Create('ReleaseMouse not avaliable for this target'); end;
|
||||
procedure TTarget.GetMousePosition(var x,y: integer); begin raise Exception.Create('GetMousePosition not avaliable for this target'); end;
|
||||
procedure TTarget.MoveMouse(x,y: integer); begin raise Exception.Create('MoveMouse not avaliable for this target'); end;
|
||||
procedure TTarget.HoldMouse(x,y: integer; button: TClickType); begin raise Exception.Create('HoldMouse not avaliable for this target'); end;
|
||||
procedure TTarget.ReleaseMouse(x,y: integer; button: TClickType); begin raise Exception.Create('ReleaseMouse not avaliable for this target'); end;
|
||||
|
||||
procedure TTarget.SendString(str: string); begin raise Exception.Create('SendString not avaliable for this target'); end;
|
||||
procedure TTarget.HoldKey(key: integer); begin raise Exception.Create('HoldKey not avaliable for this target'); end;
|
||||
procedure TTarget.ReleaseKey(key: integer); begin raise Exception.Create('ReleaseKey not avaliable for this target'); end;
|
||||
function TTarget.IsKeyHeld(key: integer): boolean; begin raise Exception.Create('IsKeyHeld not avaliable for this target'); end;
|
||||
procedure TTarget.SendString(str: string); begin raise Exception.Create('SendString not avaliable for this target'); end;
|
||||
procedure TTarget.HoldKey(key: integer); begin raise Exception.Create('HoldKey not avaliable for this target'); end;
|
||||
procedure TTarget.ReleaseKey(key: integer); begin raise Exception.Create('ReleaseKey not avaliable for this target'); end;
|
||||
function TTarget.IsKeyHeld(key: integer): boolean; begin raise Exception.Create('IsKeyHeld not avaliable for this target'); end;
|
||||
|
||||
//***implementation*** TEIOS_Target
|
||||
|
||||
constructor TEIOS_Target.Create(client: TEIOS_Client; initval: pointer); begin
|
||||
constructor TEIOS_Target.Create(client: TEIOS_Client; initval: pointer); begin
|
||||
inherited Create;
|
||||
self.client:= client;
|
||||
if Pointer(client.RequestTarget) <> nil then
|
||||
@ -417,22 +418,22 @@ implementation
|
||||
else
|
||||
self.buffer:= nil;
|
||||
GetTargetDimensions(self.width,self.height);
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TEIOS_Target.Destroy; begin
|
||||
destructor TEIOS_Target.Destroy; begin
|
||||
client.ReleaseTarget(self.target);
|
||||
inherited Destroy;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEIOS_Target.GetTargetDimensions(var w, h: integer);
|
||||
begin
|
||||
procedure TEIOS_Target.GetTargetDimensions(var w, h: integer);
|
||||
begin
|
||||
if Pointer(client.GetTargetDimensions) <> nil then
|
||||
client.GetTargetDimensions(target,w,h)
|
||||
else
|
||||
inherited GetTargetDimensions(w,h);
|
||||
end;
|
||||
function TEIOS_Target.ReturnData(xs, ys, width, height: Integer): TRetData;
|
||||
begin
|
||||
end;
|
||||
function TEIOS_Target.ReturnData(xs, ys, width, height: Integer): TRetData;
|
||||
begin
|
||||
if Pointer(client.UpdateImageBufferBounds) <> nil then
|
||||
client.UpdateImageBufferBounds(target,xs,ys,xs+width,ys+height)
|
||||
else if Pointer(client.UpdateImageBuffer) <> nil then
|
||||
@ -444,24 +445,24 @@ implementation
|
||||
result.RowLen:= self.width;
|
||||
result.IncPtrWith:= result.RowLen - width;
|
||||
Inc(result.Ptr, ys * result.RowLen + xs);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEIOS_Target.GetMousePosition(var x,y: integer);
|
||||
begin
|
||||
procedure TEIOS_Target.GetMousePosition(var x,y: integer);
|
||||
begin
|
||||
if Pointer(client.GetMousePosition) <> nil then
|
||||
client.GetMousePosition(target,x,y)
|
||||
else
|
||||
inherited GetMousePosition(x,y);
|
||||
end;
|
||||
procedure TEIOS_Target.MoveMouse(x,y: integer);
|
||||
begin
|
||||
end;
|
||||
procedure TEIOS_Target.MoveMouse(x,y: integer);
|
||||
begin
|
||||
if Pointer(client.MoveMouse) <> nil then
|
||||
client.MoveMouse(target,x,y)
|
||||
else
|
||||
inherited MoveMouse(x,y);
|
||||
end;
|
||||
procedure TEIOS_Target.HoldMouse(x,y: integer; button: TClickType);
|
||||
begin
|
||||
end;
|
||||
procedure TEIOS_Target.HoldMouse(x,y: integer; button: TClickType);
|
||||
begin
|
||||
if Pointer(client.HoldMouse) <> nil then
|
||||
begin
|
||||
case button of
|
||||
@ -471,9 +472,9 @@ implementation
|
||||
end;
|
||||
end else
|
||||
inherited HoldMouse(x,y,button);
|
||||
end;
|
||||
procedure TEIOS_Target.ReleaseMouse(x,y: integer; button: TClickType);
|
||||
begin
|
||||
end;
|
||||
procedure TEIOS_Target.ReleaseMouse(x,y: integer; button: TClickType);
|
||||
begin
|
||||
if Pointer(client.ReleaseMouse) <> nil then
|
||||
begin
|
||||
case button of
|
||||
@ -483,88 +484,95 @@ implementation
|
||||
end;
|
||||
end else
|
||||
inherited ReleaseMouse(x,y,button);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEIOS_Target.SendString(str: string);
|
||||
begin
|
||||
procedure TEIOS_Target.SendString(str: string);
|
||||
begin
|
||||
if Pointer(client.SendString) <> nil then
|
||||
client.SendString(target,PChar(str))
|
||||
else
|
||||
inherited SendString(str);
|
||||
end;
|
||||
procedure TEIOS_Target.HoldKey(key: integer);
|
||||
begin
|
||||
end;
|
||||
procedure TEIOS_Target.HoldKey(key: integer);
|
||||
begin
|
||||
if Pointer(client.HoldKey) <> nil then
|
||||
client.HoldKey(target,key)
|
||||
else
|
||||
inherited HoldKey(key);
|
||||
end;
|
||||
procedure TEIOS_Target.ReleaseKey(key: integer);
|
||||
begin
|
||||
end;
|
||||
procedure TEIOS_Target.ReleaseKey(key: integer);
|
||||
begin
|
||||
if Pointer(client.ReleaseKey) <> nil then
|
||||
client.ReleaseKey(target,key)
|
||||
else
|
||||
inherited ReleaseKey(key);
|
||||
end;
|
||||
function TEIOS_Target.IsKeyHeld(key: integer): boolean;
|
||||
begin
|
||||
end;
|
||||
function TEIOS_Target.IsKeyHeld(key: integer): boolean;
|
||||
begin
|
||||
if Pointer(client.IsKeyHeld) <> nil then
|
||||
result:= client.IsKeyHeld(target,key)
|
||||
else
|
||||
result:= inherited IsKeyHeld(key);
|
||||
end;
|
||||
end;
|
||||
|
||||
//***implementation*** TRawTarget
|
||||
|
||||
constructor TRawTarget.Create(rgb: prgb32; w,h: integer);
|
||||
begin
|
||||
constructor TRawTarget.Create(rgb: prgb32; w,h: integer; CopyData : boolean);
|
||||
begin
|
||||
inherited Create;
|
||||
self.rgb:= rgb;
|
||||
self.w:= w;
|
||||
self.h:= h;
|
||||
end;
|
||||
|
||||
destructor TRawTarget.Destroy;
|
||||
self.freedata:= copydata;
|
||||
if CopyData then
|
||||
begin
|
||||
{do nothing}
|
||||
GetMem(self.rgb,w*h*sizeof(TRGB32));
|
||||
Move(rgb[0],self.rgb[0],w*h*sizeof(TRGB32));
|
||||
end else
|
||||
self.rgb:= rgb;
|
||||
end;
|
||||
|
||||
destructor TRawTarget.Destroy;
|
||||
begin
|
||||
if freedata then
|
||||
Freemem(self.rgb,w*h*sizeof(TRGB32));
|
||||
inherited Destroy;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRawTarget.GetTargetDimensions(var w, h: integer);
|
||||
begin
|
||||
procedure TRawTarget.GetTargetDimensions(var w, h: integer);
|
||||
begin
|
||||
w:= self.w;
|
||||
h:= self.h;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRawTarget.ReturnData(xs, ys, width, height: Integer): TRetData;
|
||||
begin
|
||||
function TRawTarget.ReturnData(xs, ys, width, height: Integer): TRetData;
|
||||
begin
|
||||
result.Ptr := rgb;
|
||||
result.RowLen:= self.w;
|
||||
result.IncPtrWith:= result.RowLen - width;
|
||||
Inc(result.Ptr, ys * result.RowLen + xs);
|
||||
end;
|
||||
end;
|
||||
|
||||
//***implementation*** TEIOS_Controller
|
||||
|
||||
constructor TEIOS_Controller.Create();
|
||||
begin
|
||||
constructor TEIOS_Controller.Create();
|
||||
begin
|
||||
inherited Create;
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TEIOS_Controller.Destroy;
|
||||
var
|
||||
destructor TEIOS_Controller.Destroy;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
begin
|
||||
SetLength(plugs,0);
|
||||
inherited Destroy;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TEIOS_Controller.InitPlugin(plugin: TLibHandle): boolean;
|
||||
var
|
||||
function TEIOS_Controller.InitPlugin(plugin: TLibHandle): boolean;
|
||||
var
|
||||
GetName: procedure(name: pchar); stdcall;
|
||||
buffer: pchar;
|
||||
idx: integer;
|
||||
begin
|
||||
begin
|
||||
Pointer(GetName) := GetProcAddress(plugin, PChar('EIOS_GetName'));
|
||||
if Pointer(GetName) = nil then begin result:= false; exit; end;
|
||||
idx:= Length(plugs);
|
||||
@ -596,12 +604,12 @@ implementation
|
||||
end;
|
||||
{done linking in methods}
|
||||
result:= true;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TEIOS_Controller.FindClient(name: string): integer;
|
||||
var
|
||||
function TEIOS_Controller.FindClient(name: string): integer;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
begin
|
||||
for i:= 0 to length(plugs) - 1 do
|
||||
if plugs[i].name = name then
|
||||
begin
|
||||
@ -609,24 +617,24 @@ implementation
|
||||
exit;
|
||||
end;
|
||||
result:= -1;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TEIOS_Controller.ClientExists(name: string): boolean;
|
||||
begin
|
||||
function TEIOS_Controller.ClientExists(name: string): boolean;
|
||||
begin
|
||||
result:= FindClient(name) >= 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TEIOS_Controller.GetClient(name: string): TEIOS_Client;
|
||||
var
|
||||
function TEIOS_Controller.GetClient(name: string): TEIOS_Client;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
begin
|
||||
i:= FindClient(name);
|
||||
if i >= 0 then
|
||||
result:= plugs[i].client
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
initialization
|
||||
eios_controller:= TEIOS_Controller.Create;
|
||||
finalization
|
||||
finalization
|
||||
eios_controller.Free;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user