mirror of
https://github.com/moparisthebest/Simba
synced 2025-02-16 15:20:09 -05:00
Added a way for plugins to expot functions non-stdcall (Might want to delete later, need it now because PS doesn't *fucking* work with StdCall).
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@521 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
3c571474a2
commit
e358ab9a2a
@ -43,7 +43,7 @@ uses
|
|||||||
ColorBox , about, framefunctionlist, ocr, updateform, simbasettings;
|
ColorBox , about, framefunctionlist, ocr, updateform, simbasettings;
|
||||||
|
|
||||||
const
|
const
|
||||||
SimbaVersion = 501;
|
SimbaVersion = 521;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -293,6 +293,7 @@ type
|
|||||||
procedure SpeedButtonSearchClick(Sender: TObject);
|
procedure SpeedButtonSearchClick(Sender: TObject);
|
||||||
procedure SplitterFunctionListCanResize(Sender: TObject; var NewSize: Integer;
|
procedure SplitterFunctionListCanResize(Sender: TObject; var NewSize: Integer;
|
||||||
var Accept: Boolean);
|
var Accept: Boolean);
|
||||||
|
procedure TB_ReloadPluginsClick(Sender: TObject);
|
||||||
procedure TrayPopupPopup(Sender: TObject);
|
procedure TrayPopupPopup(Sender: TObject);
|
||||||
procedure TT_UpdateClick(Sender: TObject);
|
procedure TT_UpdateClick(Sender: TObject);
|
||||||
procedure UpdateMenuButtonClick(Sender: TObject);
|
procedure UpdateMenuButtonClick(Sender: TObject);
|
||||||
@ -445,6 +446,11 @@ begin
|
|||||||
NewSize := ScriptPanel.Width div 2;
|
NewSize := ScriptPanel.Width div 2;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.TB_ReloadPluginsClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
// PluginsGlob.FreePlugins;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.TrayPopupPopup(Sender: TObject);
|
procedure TForm1.TrayPopupPopup(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MenuItemHide.enabled:= Form1.Visible;
|
MenuItemHide.enabled:= Form1.Visible;
|
||||||
|
@ -494,6 +494,16 @@ begin
|
|||||||
Continue:= ProcessDirective(DirectiveName, DirectiveParam);
|
Continue:= ProcessDirective(DirectiveName, DirectiveParam);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function Muf_Conv_to_PS_Conv( conv : integer) : TDelphiCallingConvention;
|
||||||
|
begin
|
||||||
|
case conv of
|
||||||
|
cv_StdCall : result := cdStdCall;
|
||||||
|
cv_Register: result := cdRegister;
|
||||||
|
else
|
||||||
|
raise exception.createfmt('Unknown Calling Convention[%d]',[conv]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPSThread.OnCompile(Sender: TPSScript);
|
procedure TPSThread.OnCompile(Sender: TPSScript);
|
||||||
var
|
var
|
||||||
i,ii : integer;
|
i,ii : integer;
|
||||||
@ -507,7 +517,8 @@ begin
|
|||||||
for i := high(PluginsToLoad) downto 0 do
|
for i := high(PluginsToLoad) downto 0 do
|
||||||
for ii := 0 to PluginsGlob.MPlugins[PluginsToLoad[i]].MethodLen - 1 do
|
for ii := 0 to PluginsGlob.MPlugins[PluginsToLoad[i]].MethodLen - 1 do
|
||||||
PSScript.AddFunctionEx(PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncPtr,
|
PSScript.AddFunctionEx(PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncPtr,
|
||||||
PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncStr, cdStdCall);
|
PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncStr,
|
||||||
|
Muf_Conv_to_PS_Conv(PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[ii].FuncConv));
|
||||||
|
|
||||||
for i := 0 to high(VirtualKeys) do
|
for i := 0 to high(VirtualKeys) do
|
||||||
PSScript.Comp.AddConstantN(Format('VK_%S',[VirtualKeys[i].Str]),'Byte').SetInt(VirtualKeys[i].Key);
|
PSScript.Comp.AddConstantN(Format('VK_%S',[VirtualKeys[i].Str]),'Byte').SetInt(VirtualKeys[i].Key);
|
||||||
|
@ -36,10 +36,14 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, dynlibs, libloader;
|
Classes, SysUtils, dynlibs, libloader;
|
||||||
|
|
||||||
|
const
|
||||||
|
cv_StdCall = 0; //StdCall
|
||||||
|
cv_Register = 1; //Register
|
||||||
type
|
type
|
||||||
TMPluginMethod = record
|
TMPluginMethod = record
|
||||||
FuncPtr : pointer;
|
FuncPtr : pointer;
|
||||||
FuncStr : string;
|
FuncStr : string;
|
||||||
|
FuncConv: integer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TMPlugin = record
|
TMPlugin = record
|
||||||
@ -74,6 +78,7 @@ function TMPlugins.InitPlugin(plugin: TLibHandle): boolean;
|
|||||||
var
|
var
|
||||||
pntrArrc : function : integer; stdcall;
|
pntrArrc : function : integer; stdcall;
|
||||||
GetFuncInfo : function (x: Integer; var ProcAddr: Pointer; var ProcDef: PChar) : Integer; stdcall;
|
GetFuncInfo : function (x: Integer; var ProcAddr: Pointer; var ProcDef: PChar) : Integer; stdcall;
|
||||||
|
GetFuncConv : function (x: integer) : integer; stdcall;
|
||||||
GetTypeCount : function : Integer; stdcall;
|
GetTypeCount : function : Integer; stdcall;
|
||||||
GetTypeInfo : function (x: Integer; var sType, sTypeDef: string): Integer; stdcall;
|
GetTypeInfo : function (x: Integer; var sType, sTypeDef: string): Integer; stdcall;
|
||||||
PD : PChar;
|
PD : PChar;
|
||||||
@ -81,9 +86,11 @@ var
|
|||||||
arrc, ii : integer;
|
arrc, ii : integer;
|
||||||
begin
|
begin
|
||||||
Pointer(pntrArrc) := GetProcAddress(plugin, PChar('GetFunctionCount'));
|
Pointer(pntrArrc) := GetProcAddress(plugin, PChar('GetFunctionCount'));
|
||||||
if @pntrArrc = nil then begin result:= false; exit; end;
|
if pntrArrc = nil then begin result:= false; exit; end;
|
||||||
Pointer(GetFuncInfo) := GetProcAddress(plugin, PChar('GetFunctionInfo'));
|
Pointer(GetFuncInfo) := GetProcAddress(plugin, PChar('GetFunctionInfo'));
|
||||||
if @GetFuncInfo = nil then begin result:= false; exit; end;
|
if GetFuncInfo = nil then begin result:= false; exit; end;
|
||||||
|
Pointer(GetFuncConv) := GetProcAddress(plugin,pchar('GetFunctionCallingConv'));
|
||||||
|
|
||||||
arrc := pntrArrc();
|
arrc := pntrArrc();
|
||||||
SetLength(Plugins,NumPlugins+1);
|
SetLength(Plugins,NumPlugins+1);
|
||||||
Plugins[NumPlugins].MethodLen := Arrc;
|
Plugins[NumPlugins].MethodLen := Arrc;
|
||||||
@ -95,8 +102,13 @@ begin
|
|||||||
Continue;
|
Continue;
|
||||||
Plugins[NumPlugins].Methods[ii].FuncPtr := pntr;
|
Plugins[NumPlugins].Methods[ii].FuncPtr := pntr;
|
||||||
Plugins[NumPlugins].Methods[ii].FuncStr := pd;
|
Plugins[NumPlugins].Methods[ii].FuncStr := pd;
|
||||||
|
if GetFuncConv <> nil then
|
||||||
|
Plugins[NumPlugins].Methods[ii].FuncConv := GetFuncConv(ii)
|
||||||
|
else
|
||||||
|
Plugins[NumPlugins].Methods[ii].FuncConv := cv_stdcall;
|
||||||
end;
|
end;
|
||||||
StrDispose(pd);
|
StrDispose(pd);
|
||||||
|
|
||||||
inc(NumPlugins);
|
inc(NumPlugins);
|
||||||
result:= true;
|
result:= true;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user