1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-29 04:22:16 -05:00

PascalScript worked like shit with StdCall, so for now I've made a macro to define the calling convention:

Define PS_StdCall to use StdCall.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@479 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2010-01-26 16:51:36 +00:00
parent ce03a57713
commit b2a6b0e15c
14 changed files with 205 additions and 189 deletions

View File

@ -20,42 +20,42 @@
Bitmap.inc for the Mufasa Macro Library
}
function CreateBitmapString(bmp : integer) : string; stdcall;
function CreateBitmapString(bmp : integer) : string; ps_decl;
begin;
result := CurrThread.Client.MBitmaps[bmp].ToString;
end;
function GetMufasaBitmap(bmp : integer): TMufasaBitmap; stdcall;
function GetMufasaBitmap(bmp : integer): TMufasaBitmap; ps_decl;
begin;
result := CurrThread.Client.MBitmaps[bmp];
end;
function CreateBitmap(w,h : integer):integer; stdcall;
function CreateBitmap(w,h : integer):integer; ps_decl;
begin
result := CurrThread.Client.MBitmaps.CreateBMP(w,h);
end;
procedure FreeBitmap(Number : integer); stdcall;
procedure FreeBitmap(Number : integer); ps_decl;
begin
CurrThread.Client.MBitmaps.FreeBMP(Number);
end;
procedure SaveBitmap(Bmp : integer; path : string); stdcall;
procedure SaveBitmap(Bmp : integer; path : string); ps_decl;
begin;
CurrThread.Client.MBitmaps[Bmp].SaveToFile(Path);
end;
function BitmapFromString(Width,height : integer; Data : string) : integer; stdcall;
function BitmapFromString(Width,height : integer; Data : string) : integer; ps_decl;
begin;
Result := CurrThread.Client.MBitmaps.CreateBMPFromString(Width,Height,Data);
end;
function LoadBitmap(Path : String) : integer; stdcall;
function LoadBitmap(Path : String) : integer; ps_decl;
begin;
Result := CurrThread.Client.MBitmaps.CreateBMPFromFile(Path);
end;
procedure SetBitmapSize(Bmp,NewW,NewH : integer); stdcall;
procedure SetBitmapSize(Bmp,NewW,NewH : integer); ps_decl;
begin;
if (NewW>=0) and (NewH >=0) then
CurrThread.Client.MBitmaps[Bmp].SetSize(NewW,NewH)
@ -63,7 +63,7 @@ begin;
raise exception.createfmt('Wrong Width or Height in SetBitmapSize: (%d,%d)',[NewW,NewH]);
end;
procedure StretchBitmapResize(Bmp,NewW,NewH : integer); stdcall;
procedure StretchBitmapResize(Bmp,NewW,NewH : integer); ps_decl;
begin;
if (NewW>=0) and (NewH >=0) then
CurrThread.Client.MBitmaps[Bmp].StretchResize(NewW,NewH)
@ -71,7 +71,7 @@ begin;
raise exception.createfmt('Wrong Width or Height in ScretchResize: (%d,%d)',[NewW,NewH]);
end;
procedure GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer); stdcall;
procedure GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer); ps_decl;
begin;
With CurrThread.Client.MBitmaps[bmp] do
begin;
@ -80,129 +80,129 @@ begin;
end;
end;
procedure SetBitmapName(Bmp : integer; name : string); stdcall;
procedure SetBitmapName(Bmp : integer; name : string); ps_decl;
begin;
CurrThread.Client.MBitmaps[Bmp].BmpName:= name;
end;
function CreateMirroredBitmap(Bmp : integer) : integer; stdcall;
function CreateMirroredBitmap(Bmp : integer) : integer; ps_decl;
begin;
Result := CurrThread.Client.MBitmaps.CreateMirroredBitmap(Bmp, MirrorWidth);
end;
function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer; stdcall;
function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer; ps_decl;
begin;
Result := CurrThread.Client.MBitmaps.CreateMirroredBitmap(Bmp,MirrorStyle);
end;
function FastGetPixel(bmp,x,y : integer) : LongWord; stdcall;
function FastGetPixel(bmp,x,y : integer) : LongWord; ps_decl;
begin;
Result := CurrThread.Client.MBitmaps[Bmp].FastGetPixel(x,y);
end;
function FastGetPixels(bmp : integer; TPA : TPointArray) : TIntegerArray; stdcall;
function FastGetPixels(bmp : integer; TPA : TPointArray) : TIntegerArray; ps_decl;
begin;
result := CurrThread.Client.MBitmaps[Bmp].FastGetPixels(TPA);
end;
procedure FastSetPixel(Bmp,x,y : integer; Color : TColor); stdcall;
procedure FastSetPixel(Bmp,x,y : integer; Color : TColor); ps_decl;
begin
CurrThread.Client.MBitmaps[bmp].FastSetPixel(x,y,color);
end;
procedure FastSetPixels(Bmp : integer; TPA : TPointArray; Colors : TIntegerArray); stdcall;
procedure FastSetPixels(Bmp : integer; TPA : TPointArray; Colors : TIntegerArray); ps_decl;
begin;
CurrThread.Client.MBitmaps[Bmp].FastSetPixels(TPA,Colors);
end;
procedure DrawTPABitmap(bitmap : integer; TPA : TPointArray; Color : integer); stdcall;
procedure DrawTPABitmap(bitmap : integer; TPA : TPointArray; Color : integer); ps_decl;
begin
CurrThread.Client.MBitmaps[Bitmap].DrawTPA(TPA,Color);
end;
procedure DrawATPABitmap(bitmap : integer; ATPA : T2DPointArray); stdcall;
procedure DrawATPABitmap(bitmap : integer; ATPA : T2DPointArray); ps_decl;
begin
CurrThread.Client.MBitmaps[bitmap].DrawATPA(ATPA);
end;
procedure DrawATPABitmapEx(bitmap : integer; ATPA : T2DPointArray; Colors : TIntegerArray); stdcall;
procedure DrawATPABitmapEx(bitmap : integer; ATPA : T2DPointArray; Colors : TIntegerArray); ps_decl;
begin
CurrThread.Client.MBitmaps[bitmap].DrawATPA(ATPA,Colors);
end;
procedure FastDrawClear(bmp : integer; Color : TColor); stdcall;
procedure FastDrawClear(bmp : integer; Color : TColor); ps_decl;
begin;
CurrThread.Client.MBitmaps[bmp].FastDrawClear(Color);
end;
procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer); stdcall;
procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer); ps_decl;
begin;
CurrThread.Client.MBitmaps[SourceBitmap].FastDrawTransparent(x,y,CurrThread.Client.MBitmaps[TargetBitmap]);
end;
procedure SetTransparentColor(Bmp : integer; Color : TColor); stdcall;
procedure SetTransparentColor(Bmp : integer; Color : TColor); ps_decl;
begin
CurrThread.Client.MBitmaps[Bmp].SetTransparentColor(Color);
end;
function GetTransparentColor(Bmp : integer) : TColor; stdcall;
function GetTransparentColor(Bmp : integer) : TColor; ps_decl;
begin;
Result := CurrThread.Client.MBitmaps[bmp].GetTransparentColor;
end;
procedure FastReplaceColor(bmp: Integer; OldColor, NewColor: TColor); stdcall;
procedure FastReplaceColor(bmp: Integer; OldColor, NewColor: TColor); ps_decl;
begin
CurrThread.Client.MBitmaps[Bmp].FastReplaceColor(OldColor,NewColor);
end;
procedure ps_CopyClientToBitmap(bmp, xs, ys, xe, ye: Integer); stdcall;
procedure ps_CopyClientToBitmap(bmp, xs, ys, xe, ye: Integer); ps_decl;
begin
CurrThread.Client.MBitmaps.GetBMP(bmp).CopyClientToBitmap(CurrThread.Client.IOManager, True, xs, ys, xe, ye);
end;
function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer; stdcall;
function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer; ps_decl;
begin;
result := CurrThread.Client.MBitmaps.CreateBMP(0,0);
CurrThread.Client.MBitmaps[result].CopyClientToBitmap(CurrThread.Client.IOManager,True,xs,ys,xe,ye);
end;
function FindBitmap(Bitmap: integer; out x, y: Integer): Boolean; stdcall;
function FindBitmap(Bitmap: integer; out x, y: Integer): Boolean; ps_decl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmap( MBitmaps[bitmap],x,y);
end;
function FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean; stdcall;
function FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean; ps_decl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapIn( MBitmaps[bitmap],x,y,xs,ys,xe,ye);
end;
function FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean; stdcall;
function FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean; ps_decl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapToleranceIn( MBitmaps[bitmap],x,y,xs,ys,xe,ye,tolerance);
end;
function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean; stdcall;
function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean; ps_decl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapSpiral(Mbitmaps[bitmap],x,y,xs,ys,xe,ye);
end;
function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean; stdcall;
function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean; ps_decl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapsSpiralTolerance(MBitmaps[bitmap],x,y,points,xs,ys,xe,ye,tolerance);
end;
function FindBitmapSpiralTolerance(bitmap: integer; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean; stdcall;
function FindBitmapSpiralTolerance(bitmap: integer; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean; ps_decl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapSpiralTolerance(MBitmaps[bitmap],x,y,xs,ys,xe,ye,tolerance);
end;
function RotateBitmap(bitmap: Integer; angle: Extended): Integer; stdcall;
function RotateBitmap(bitmap: Integer; angle: Extended): Integer; ps_decl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -211,7 +211,7 @@ begin;
end;
end;
function Desaturate(Bitmap : integer) : integer; stdcall;
function Desaturate(Bitmap : integer) : integer; ps_decl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -219,15 +219,15 @@ begin;
Bmp[Bitmap].Desaturate(Bmp[result]);
end;
end;
procedure InvertBitmap(Bitmap : integer); stdcall;
procedure InvertBitmap(Bitmap : integer); ps_decl;
begin;
CurrThread.Client.MBitmaps[Bitmap].Invert;
end;
function CopyBitmap(Bitmap : integer) : integer; stdcall;
function CopyBitmap(Bitmap : integer) : integer; ps_decl;
begin;
result := Currthread.Client.MBitmaps.CopyBMP(bitmap);
end;
function GreyScaleBitmap(Bitmap : integer) : integer; stdcall;
function GreyScaleBitmap(Bitmap : integer) : integer; ps_decl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -235,7 +235,7 @@ begin;
Bmp[Bitmap].GreyScale(Bmp[result]);
end;
end;
function BrightnessBitmap(Bitmap,br : integer) : integer; stdcall;
function BrightnessBitmap(Bitmap,br : integer) : integer; ps_decl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -243,7 +243,7 @@ begin;
Bmp[Bitmap].Brightness(Bmp[result],br);
end;
end;
function ContrastBitmap(bitmap : integer; co : extended) : integer; stdcall;
function ContrastBitmap(bitmap : integer; co : extended) : integer; ps_decl;
begin;
with CurrThread.Client.MBitmaps do
begin;
@ -252,7 +252,7 @@ begin;
end;
end;
function PosterizeBitmap(Bitmap : integer; po : integer) : integer; stdcall;
function PosterizeBitmap(Bitmap : integer; po : integer) : integer; ps_decl;
begin;
with CurrThread.Client.MBitmaps do
begin
@ -260,16 +260,16 @@ begin;
Bmp[bitmap].Posterize(Bmp[result],po);
end;
end;
function CreateMaskFromBitmap(Bitmap : integer) : TMask; stdcall;
function CreateMaskFromBitmap(Bitmap : integer) : TMask; ps_decl;
begin;
result := CurrThread.Client.MBitmaps[Bitmap].CreateTMask;
end;
function FindMaskTolerance(mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; stdcall;
function FindMaskTolerance(mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; ps_decl;
begin;
result := CurrThread.Client.MFinder.FindMaskTolerance(Mask,x,y,xs,ys,xe,ye,tolerance,contourtolerance);
end;
function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; stdcall;
function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; ps_decl;
begin;
psWriteln('Better be using FindMaskTolerance in combination with CreateMaskFromBitmap, more efficient.');
with CurrThread.Client do
@ -278,7 +278,7 @@ end;
function FindDeformedBitmapToleranceIn(bitmap: integer; out x,
y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer;
AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean; stdcall;
AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean; ps_decl;
begin;
result := CurrThread.Client.MFinder.FindDeformedBitmapToleranceIn(CurrThread.Client.MBitmaps[Bitmap],x,y,xs,ys,xe,ye,tolerance,range,AllowPartialAccuracy,accuracy);
end;

View File

@ -21,94 +21,94 @@
Colour.inc for the Mufasa Macro Library
}
function GetColor(x,y : integer) : TColor; stdcall;
function GetColor(x,y : integer) : TColor; ps_decl;
begin;
Result := CurrThread.Client.IOManager.GetColor(x,y);
end;
function GetColors(Coords : TPointArray) : TIntegerArray; stdcall;
function GetColors(Coords : TPointArray) : TIntegerArray; ps_decl;
begin
result := CurrThread.Client.MFinder.GetColors(coords);
end;
function findcolor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean; stdcall;
function findcolor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean; ps_decl;
begin
Result := CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2);
end;
function findcolortoleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; stdcall;
function findcolortoleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; ps_decl;
begin
Result := CurrThread.Client.MFinder.FindColorToleranceOptimised(x, y, color, x1, y1, x2, y2, tol);
end;
function findcolortolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; stdcall;
function findcolortolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; ps_decl;
begin
Result := CurrThread.Client.MFinder.FindColorTolerance(x, y, color, x1, y1, x2, y2, tol);
end;
function FindColors(out TPA: TPointArray; Color, x1, y1, x2, y2: Integer): Boolean; stdcall;
function FindColors(out TPA: TPointArray; Color, x1, y1, x2, y2: Integer): Boolean; ps_decl;
begin
Result := CurrThread.Client.MFinder.FindColors(TPA, color, x1, y1, x2, y2);
end;
procedure SetColorToleranceSpeed(cts: Integer); stdcall;
procedure SetColorToleranceSpeed(cts: Integer); ps_decl;
begin
CurrThread.Client.MFinder.SetToleranceSpeed(cts);
end;
function GetToleranceSpeed: Integer; stdcall;
function GetToleranceSpeed: Integer; ps_decl;
begin
CurrThread.Client.MFinder.GetToleranceSpeed;
end;
procedure SetToleranceSpeed2Modifiers(nHue, nSat: Extended); stdcall;
procedure SetToleranceSpeed2Modifiers(nHue, nSat: Extended); ps_decl;
begin
CurrThread.Client.MFinder.SetToleranceSpeed2Modifiers(nHue, nSat);
end;
procedure GetToleranceSpeed2Modifiers(out hMod, sMod: Extended); stdcall;
procedure GetToleranceSpeed2Modifiers(out hMod, sMod: Extended); ps_decl;
begin
CurrThread.Client.MFinder.GetToleranceSpeed2Modifiers(hMod, sMod);
end;
function SimilarColors(Col1,Col2,Tol : integer) : boolean; stdcall;
function SimilarColors(Col1,Col2,Tol : integer) : boolean; ps_decl;
begin;
Result := CurrThread.Client.MFinder.SimilarColors(Col1,Col2,Tol);
end;
function CountColor(Color, xs, ys, xe, ye: Integer): Integer; stdcall;
function CountColor(Color, xs, ys, xe, ye: Integer): Integer; ps_decl;
begin;
result := CurrThread.Client.MFinder.CountColor(color,xs,ys,xe,ye);
end;
function CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer; stdcall;
function CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer; ps_decl;
begin;
result := CurrThread.Client.MFinder.CountColorTolerance(color,xs,ys,xe,ye,tolerance);
end;
function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; stdcall;
function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; ps_decl;
begin;
result := CurrThread.Client.MFinder.FindColorsToleranceOptimised(points,color,xs,ys,xe,ye,tolerance);
end;
function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; stdcall;
function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; ps_decl;
begin;
result := CurrThread.Client.MFinder.FindColorsTolerance(points,color,xs,ys,xe,ye,tolerance);
end;
function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean; stdcall;
function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean; ps_decl;
begin;
result := CurrThread.Client.MFinder.FindColorSpiral(x,y,color,xs,ys,xe,ye);
end;
function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean; stdcall;
function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean; ps_decl;
begin;
result := CurrThread.Client.MFinder.FindColorsSpiralTolerance(x,y,Points,color,xs,ys,xe,ye,tolerance);
end;
function FindColoredArea(var x, y: Integer; color, xs, ys, xe, ye: Integer; MinArea: Integer): Boolean; stdcall;
function FindColoredArea(var x, y: Integer; color, xs, ys, xe, ye: Integer; MinArea: Integer): Boolean; ps_decl;
begin;
result := CurrThread.Client.MFinder.FindColoredArea(x,y,color,xs,ys,xe,ye,minarea);
end;
function FindColoredAreaTolerance(var x, y: Integer; Color, xs, ys, xe, ye, MinArea, tol: Integer): Boolean; stdcall;
function FindColoredAreaTolerance(var x, y: Integer; Color, xs, ys, xe, ye, MinArea, tol: Integer): Boolean; ps_decl;
begin;
result := CurrThread.Client.MFinder.FindColoredAreaTolerance(x,y,color,xs,ys,xe,ye,minarea,tol);
end;

View File

@ -21,7 +21,7 @@
DTM.inc for the Mufasa Macro Library
}
function ps_FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean; stdcall;
function ps_FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean; ps_decl;
var
temp: pDTM;
begin
@ -35,7 +35,7 @@ begin
end;
end;
function ps_FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean; stdcall;
function ps_FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean; ps_decl;
var
temp: pDTM;
begin
@ -50,7 +50,7 @@ end;
function ps_FindDTMRotated(DTM: Integer; out x, y: Integer; x1, y1, x2, y2:
Integer; sAngle, eAngle, aStep: Extended;
out aFound: Extended): Boolean; stdcall;
out aFound: Extended): Boolean; ps_decl;
var
temp: pDTM;
begin
@ -64,7 +64,7 @@ begin
end;
end;
function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean; stdcall;
function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean; ps_decl;
var
temp: pDTM;
begin
@ -75,7 +75,7 @@ begin
Result := False;
end;
{function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, stdcall;
{function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, ps_decl;
y1, x2, y2: Integer; sAngle, eAngle,
aStep: Extended; out aFound: T2DExtendedArray)
: Boolean;
@ -84,7 +84,7 @@ begin
sAngle, eAngle, aStep, aFound);
end; }
function ps_DTMFromString(DTMString: String): Integer; stdcall;
function ps_DTMFromString(DTMString: String): Integer; ps_decl;
var
dtm: pDTM;
begin
@ -95,22 +95,28 @@ begin
end;
end;
procedure ps_FreeDTM(DTM: Integer); stdcall;
procedure ps_FreeDTM(DTM: Integer); ps_decl;
begin
CurrThread.Client.MDTM.FreeDTM(DTM);
end;
function ps_GetDTM(index: Integer; out dtm: pDTM): Boolean; stdcall;
function ps_GetDTM(index: Integer; out dtm: pDTM): Boolean; ps_decl;
begin
Result := CurrThread.Client.MDTM.GetDTM(index, dtm);
end;
function ps_AddDTM(d: TDTM): Integer; stdcall;
function ps_AddDTM(d: TDTM): Integer; ps_decl;
begin
Result := CurrThread.Client.MDTM.AddDTM(d);
end;
function ps_AddpDTM(d: pDTM): Integer; stdcall;
function ps_AddpDTM(d: pDTM): Integer; ps_decl;
begin
Result := CurrThread.Client.MDTM.AddpDTM(d);
end;
Procedure ps_PrintpDTM(aDTM : pDTM);ps_decl;
begin
PrintpDTM(aDTM);
end;

View File

@ -21,50 +21,50 @@
File.inc for the Mufasa Macro Library
}
function ps_CreateFile(Path: string): Integer; stdcall;
function ps_CreateFile(Path: string): Integer; ps_decl;
begin
Result := CurrThread.Client.MFiles.CreateFile(Path);
end;
function ps_OpenFile(Path: string; Shared: Boolean): Integer; stdcall;
function ps_OpenFile(Path: string; Shared: Boolean): Integer; ps_decl;
begin
Result := CurrThread.Client.MFiles.OpenFile(Path, Shared);
end;
function ps_RewriteFile(Path: string; Shared: Boolean): Integer; stdcall;
function ps_RewriteFile(Path: string; Shared: Boolean): Integer; ps_decl;
begin
Result := CurrThread.Client.MFiles.RewriteFile(Path, Shared);
end;
procedure ps_CloseFile(FileNum: Integer); stdcall;
procedure ps_CloseFile(FileNum: Integer); ps_decl;
begin
CurrThread.Client.MFiles.CloseFile(FileNum);
end;
function ps_EndOfFile(FileNum: Integer): Boolean; stdcall;
function ps_EndOfFile(FileNum: Integer): Boolean; ps_decl;
begin
Result := CurrThread.Client.MFiles.EndOfFile(FileNum);
end;
function ps_FileSize(FileNum: Integer): LongInt; stdcall;
function ps_FileSize(FileNum: Integer): LongInt; ps_decl;
begin
Result := CurrThread.Client.MFiles.FileSizeMuf(FileNum);
end;
function ps_ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean; stdcall;
function ps_ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean; ps_decl;
begin
Result := CurrThread.Client.MFiles.ReadFileString(FileNum, s, x);
end;
function ps_WriteFileString(FileNum: Integer; s: string): Boolean; stdcall;
function ps_WriteFileString(FileNum: Integer; s: string): Boolean; ps_decl;
begin
Result := CurrThread.Client.MFiles.WriteFileString(FileNum, s);
end;
function ps_SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer; stdcall;
function ps_SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer; ps_decl;
begin
Result := CurrThread.Client.MFiles.SetFileCharPointer(Filenum, cChars, Origin);
end;
function ps_FilePointerPos(FileNum: Integer): Integer; stdcall;
function ps_FilePointerPos(FileNum: Integer): Integer; ps_decl;
begin
Result := CurrThread.Client.MFiles.FilePointerPos(FileNum);
end;

View File

@ -1,4 +1,4 @@
function ps_GetPage(S: String): String; stdcall;
function ps_GetPage(S: String): String; ps_decl;
begin
result := GetPage(S);
end;

View File

@ -21,27 +21,27 @@
Keyboard.inc for the Mufasa Macro Library
}
procedure KeyDown(key: Word); stdcall;
procedure KeyDown(key: Word); ps_decl;
begin
CurrThread.Client.IOManager.KeyDown(key);
end;
procedure KeyUp(key: Word); stdcall;
procedure KeyUp(key: Word); ps_decl;
begin
CurrThread.Client.IOManager.KeyUp(key);
end;
procedure SendKeys(s: string); stdcall;
procedure SendKeys(s: string); ps_decl;
begin
CurrThread.Client.IOManager.SendText(s);
end;
procedure PressKey(key: Word); stdcall;
procedure PressKey(key: Word); ps_decl;
begin
CurrThread.Client.IOManager.PressKey(key);
end;
function isKeyDown(key: Word): boolean; stdcall;
function isKeyDown(key: Word): boolean; ps_decl;
begin
Result := CurrThread.Client.IOManager.isKeyDown(key);
end;

View File

@ -21,17 +21,61 @@
Math.inc for the Mufasa Macro Library
}
function psSqr( e : extended) : extended; stdcall;
begin;
function ps_ceil(e : extended) : integer;ps_decl;
begin
result := ceil(e);
end;
function ps_pow(base,exponent : extended) : extended; ps_decl;
begin
result := power(base,exponent);
end;
function ps_Max(a,b : integer) : integer; ps_decl;
begin
result := max(a,b);
end;
function ps_Min(a, b: Integer): Integer; ps_decl;
begin
result := min(a,b);
end;
function ps_MinE(a, b : extended) : extended; ps_decl;
begin
result := min(a,b);
end;
function ps_MaxE(a,b : extended) : extended; ps_decl;
begin
result := max(a,b);
end;
function ps_Sqr(e : extended) : extended;ps_decl;
begin
result := sqr(e);
end;
function ps_RandomRange(const aFrom, aTo: Integer): Integer; stdcall;
function ps_Point(x,y : integer) : TPoint;ps_decl;
begin
result := classes.point(x,y);
end;
function ps_Distance(x1,y1,x2,y2 : integer) : integer;ps_decl;
begin
Result := Round(Sqrt(Sqr(x2-x1) + Sqr(y2-y1)));
end;
function ps_Hypot(X, Y: Extended): Extended;ps_decl;
begin
result := hypot(x,y);
end;
function ps_RandomRange(const aFrom, aTo: Integer): Integer; ps_decl;
begin
Result:=Random(Abs(aFrom-aTo))+Min(aTo,AFrom);
end;
function Factorial(number: longword): Int64; stdcall;
function Factorial(number: longword): Int64; ps_decl;
var
Loop : longword;
begin
@ -40,12 +84,12 @@ begin
result := result * loop;
end;
function BinCoe(a, b: LongInt): Extended; stdcall;
function BinCoe(a, b: LongInt): Extended; ps_decl;
begin
result := Factorial(a) / (factorial(b) * factorial(a-b));
end;
function FixD(Degrees : extended) : Extended; stdcall;
function FixD(Degrees : extended) : Extended; ps_decl;
begin;
Result := Degrees;
while Result < 0 do
@ -53,12 +97,3 @@ begin;
while Result > 360 do
Result := Result - 360;
end;
procedure psSwap(var A,B); stdcall;
var
TempPtr : Pointer;
begin;
TempPtr := pointer(A);
pointer(a) := pointer(b);
pointer(b) := TempPtr;
end;

View File

@ -25,16 +25,16 @@ const
ps_mouse_right = 0;
ps_mouse_left = 1;
ps_mouse_middle = 2;
procedure MoveMouse(x, y: integer); stdcall;
procedure MoveMouse(x, y: integer); ps_decl;
begin
CurrThread.Client.IOManager.SetMousePos(X, Y);
end;
procedure GetMousePos(out x, y: integer); stdcall;
procedure GetMousePos(out x, y: integer); ps_decl;
begin
CurrThread.Client.IOManager.GetMousePos(X, Y);
end;
function ConvIntClickType(Int : Integer) : TClickType;inline; stdcall;
function ConvIntClickType(Int : Integer) : TClickType;inline;
begin;
case int of
ps_mouse_right : result := mouse_Right;
@ -45,17 +45,17 @@ begin;
end;
end;
procedure HoldMouse(x, y: integer; clickType: integer); stdcall;
procedure HoldMouse(x, y: integer; clickType: integer); ps_decl;
begin
CurrThread.Client.IOManager.HoldMouse(x, y, ConvIntClickType(clickType));
end;
procedure ReleaseMouse(x, y: integer; clickType: integer); stdcall;
procedure ReleaseMouse(x, y: integer; clickType: integer); ps_decl;
begin
CurrThread.Client.IOManager.ReleaseMouse(x, y, ConvIntClickType(clickType));
end;
procedure ClickMouse(x, y: integer; clickType: integer); stdcall;
procedure ClickMouse(x, y: integer; clickType: integer); ps_decl;
begin
CurrThread.Client.IOManager.ClickMouse(x, y, ConvIntClickType(clickType));
end;

View File

@ -1,9 +1,9 @@
function rs_GetUpText: String; stdcall;
function rs_GetUpText: String; ps_decl;
begin
Result := CurrThread.Client.MOCR.GetUpTextAtEx(7, 7, true);
end;
function BitmapFromText(text, font: String): integer; stdcall;
function BitmapFromText(text, font: String): integer; ps_decl;
var
bmp: TMufasaBitmap;
begin
@ -12,12 +12,12 @@ begin
Result := CurrThread.Client.MBitmaps.AddBMP(bmp);
end;
function MaskFromText(text, font: String): TMask; stdcall;
function MaskFromText(text, font: String): TMask; ps_decl;
begin
Result := CurrThread.Client.MOCR.TextToMask(text,font);
end;
function TPAFromText(text, font: String): TPointArray; stdcall;
function TPAFromText(text, font: String): TPointArray; ps_decl;
var
w,h : integer;
begin

View File

@ -21,7 +21,7 @@
Other.inc for the Mufasa Macro Library
}
procedure psWait(t: Integer); stdcall;
procedure psWait(t: Integer); ps_decl;
{$ifdef MSWINDOWS}
begin
Sleep(t);
@ -42,13 +42,13 @@ begin
end;
{$endif}
procedure ClearDebug; stdcall;
procedure ClearDebug; ps_decl;
begin
if Assigned(CurrThread.DebugMemo) then
CurrThread.Synchronize(@CurrThread.DebugMemo.Clear);
end;
procedure SaveScreenshot(FileName: string); stdcall;
procedure SaveScreenshot(FileName: string); ps_decl;
var
w,h : integer;
bmp: TMufasaBitmap;
@ -60,12 +60,7 @@ begin;
bmp.Free;
end;
function MinE(a, b: Extended): Extended; stdcall;
begin;
result := min(a,b);
end;
function IntToBox(x1,y1,x2,y2 : integer) : TBox; stdcall;
function IntToBox(x1,y1,x2,y2 : integer) : TBox; ps_decl;
begin;
result.x1 := x1;
result.y1 := y1;
@ -73,45 +68,40 @@ begin;
result.y2 := y2;
end;
function IntInBox(x, y: Integer; Box: TBox): Boolean; stdcall;
function IntInBox(x, y: Integer; Box: TBox): Boolean; ps_decl;
begin;
result := (((x >= Box.x1) and(x <= Box.x2)) and ((y >= box.y1) and (y <= box.y2)));
end;
function Distance(x1, y1, x2, y2: Integer): Integer; stdcall;
begin;
Result := Round(Sqrt(Sqr(x2-x1) + Sqr(y2-y1)));
end;
procedure DisplayDebugImgWindow(w,h : integer); stdcall;
procedure DisplayDebugImgWindow(w,h : integer); ps_decl;
begin;
CurrThread.DebugImg.DispSize^ := Classes.Point(w,h);
CurrThread.Synchronize( CurrThread.DebugImg.ShowForm);
end;
procedure DrawBitmapDebugImg(bmp : integer); stdcall;
procedure DrawBitmapDebugImg(bmp : integer); ps_decl;
begin;
CurrThread.DebugImg.ToDrawBitmap^ := CurrThread.Client.MBitmaps[bmp];
CurrThread.Synchronize(CurrThread.DebugImg.DrawBitmap);
end;
function GetDebugBitmap : integer; stdcall;
function GetDebugBitmap : integer; ps_decl;
begin;
result := CurrThread.Client.MBitmaps.CreateBMP(0,0);
CurrThread.DebugImg.GetDebugBitmap^ := CurrThread.Client.MBitmaps[result];
CurrThread.Synchronize(CurrThread.DebugImg.GetBitmap);
end;
procedure TerminateScript; stdcall;
procedure TerminateScript; ps_decl;
begin;
CurrThread.Terminate;
end;
function GetTimeRunning: LongWord; stdcall;
function GetTimeRunning: LongWord; ps_decl;
begin;
result := GetTickCount - CurrThread.StartTime;
end;
procedure ConvertTime(Time : integer; var h,m,s : integer); stdcall;
procedure ConvertTime(Time : integer; var h,m,s : integer); ps_decl;
var
x : integer;
begin;
@ -123,7 +113,7 @@ begin;
s := x div (1000);
end;
procedure HakunaMatata; stdcall;
procedure HakunaMatata; ps_decl;
begin;
OpenWebPage('http://www.youtube.com/v/ejEVczA8PLU&hl=en&fs=1&autoplay=1');
end;

View File

@ -1,26 +1 @@
function psFormat(const fmt : string;const args : array of const) : string; stdcall;
begin;
Result := Format(fmt,Args);
end;
function Capitalize(str : string) : string; stdcall;
var
i , l : integer;
cap : boolean;
begin;
result := str;
l := length(str);
cap := true;
for i := 1 to l do
if cap and (str[i] in ['a'..'z'] + ['A'..'Z']) then
begin;
result[i] := UpperCase(str[i])[1];
cap := false;
end else if not (str[i] in ['a'..'z'] + ['A'..'Z']) then
cap := true;
end;
function psBoolToStr(bool : boolean) : string; stdcall;
begin;
result := BoolToStr(bool,true);
end;
function psFormat(const fmt : string;const args : array of const) : string; ps_decl; begin; Result := Format(fmt,Args); end; function Capitalize(str : string) : string; ps_decl; var i , l : integer; cap : boolean; begin; result := str; l := length(str); cap := true; for i := 1 to l do if cap and (str[i] in ['a'..'z'] + ['A'..'Z']) then begin; result[i] := UpperCase(str[i])[1]; cap := false; end else if not (str[i] in ['a'..'z'] + ['A'..'Z']) then cap := true; end; function psBoolToStr(bool : boolean) : string; ps_decl; begin; result := BoolToStr(bool,true); end;

View File

@ -21,74 +21,74 @@
window.inc for the Mufasa Macro Library
}
procedure SetDesktopAsClient; stdcall;
procedure SetDesktopAsClient; ps_decl;
begin;
CurrThread.Client.IOManager.SetDesktop;
end;
function SetTargetArray(P: Integer; w, h: integer): integer; stdcall;
function SetTargetArray(P: Integer; w, h: integer): integer; ps_decl;
begin
result:= CurrThread.Client.IOManager.SetTarget(PRGB32(P), classes.point(w,h));
end;
function SetTargetBitmap(bitmap: Integer): integer; stdcall;
function SetTargetBitmap(bitmap: Integer): integer; ps_decl;
begin;
result:= CurrThread.Client.IOManager.SetTarget(CurrThread.Client.MBitmaps[Bitmap]);
end;
function SetEIOSTarget(name: string; args: Variant): integer; stdcall;
function SetEIOSTarget(name: string; args: Variant): integer; ps_decl;
begin
result:= CurrThread.Client.IOManager.SetTarget(name, @args);
end;
procedure SetImageTarget(idx: integer); stdcall;
procedure SetImageTarget(idx: integer); ps_decl;
begin
CurrThread.Client.IOManager.SetImageTarget(idx);
end;
procedure SetKeyMouseTarget(idx: integer); stdcall;
procedure SetKeyMouseTarget(idx: integer); ps_decl;
begin
CurrThread.Client.IOManager.SetKeyMouseTarget(idx);
end;
function GetImageTarget: integer; stdcall;
function GetImageTarget: integer; ps_decl;
begin
CurrThread.Client.IOManager.GetImageTarget(result);
end;
function GetKeyMouseTarget: integer; stdcall;
function GetKeyMouseTarget: integer; ps_decl;
begin
CurrThread.Client.IOManager.GetKeyMouseTarget(result);
end;
procedure FreeTarget(idx: integer); stdcall;
procedure FreeTarget(idx: integer); ps_decl;
begin
CurrThread.Client.IOManager.FreeTarget(idx);
end;
procedure GetClientDimensions(out w, h: integer); stdcall;
procedure GetClientDimensions(out w, h: integer); ps_decl;
begin
CurrThread.Client.IOManager.GetDimensions(w, h);
end;
function Freeze: boolean; stdcall;
function Freeze: boolean; ps_decl;
begin
CurrThread.Client.IOManager.SetFrozen(true);
result := true; //dunno what the result is supposed to mean
end;
function Unfreeze: boolean; stdcall;
function Unfreeze: boolean; ps_decl;
begin
CurrThread.Client.IOManager.SetFrozen(false);
result := true; //dunno what the result is supposed to mean
end;
procedure ActivateClient; stdcall;
procedure ActivateClient; ps_decl;
begin
CurrThread.Client.IOManager.ActivateClient;
end;
function IsTargetValid: boolean; stdcall;
function IsTargetValid: boolean; ps_decl;
begin
result:= CurrThread.Client.IOManager.TargetValid;
end;

View File

@ -26,7 +26,7 @@ AddFunction(nil,'procedure Writeln(x);'); //We use special function for this
{ DTM }
SetCurrSection('DTM');
AddFunction(@PrintpDTM, 'Procedure PrintpDTM(tDTM : pDTM);');
AddFunction(@ps_PrintpDTM, 'Procedure PrintpDTM(tDTM : pDTM);');
AddFunction(@ps_GetDTM ,'function GetDTM(index: Integer; out dtm: pDTM): Boolean;');
AddFunction(@pDTMToTDTM, 'Function pDTMToTDTM(DTM: pDTM): TDTM;');
AddFunction(@tDTMTopDTM, 'Function tDTMTopDTM(DTM: TDTM): pDTM;');
@ -39,20 +39,21 @@ AddFunction(@ps_FindDTMsRotated, 'function FindDTMsRotated(DTM: Integer; out Poi
AddFunction(@ps_addDTM, 'function AddDTM(d: TDTM): Integer;');
AddFunction(@ps_addpDTM, 'function AddpDTM(d: pDTM): Integer;');
{maths}
SetCurrSection('Math');
AddFunction(nil,'function Round(e:extended) : integer');
AddFunction(@ceil,'function ceil(e : extended) : integer');
AddFunction(@power,'function pow(base,exponent : extended) : extended');
AddFunction(@max,'function Max(a, b: Integer): Integer;');
AddFunction(@min,'function Min(a, b: Integer): Integer;');
AddFunction(@minE,'function MinE(a, b: extended): Extended;');
AddFunction(@ps_ceil,'function ceil(e : extended) : integer');
AddFunction(@ps_pow,'function pow(base,exponent : extended) : extended');
AddFunction(@ps_max,'function Max(a, b: Integer): Integer;');
AddFunction(@ps_min,'function Min(a, b: Integer): Integer;');
AddFunction(@ps_minE,'function MinE(a, b: extended): Extended;');
AddFunction(@IntToBox,'function IntToBox(x1,y1,x2,y2 : integer) : TBox;');
AddFunction(@IntInBox,'function IntInBox(x, y: Integer; Box: TBox): Boolean;');
AddFunction(@pssqr,'function Sqr(e : extended) : extended;');
AddFunction(@classes.point,'function Point(x,y:integer) : TPoint;');
AddFunction(@Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;');
AddFunction(@hypot,'function Hypot(X, Y: Extended): Extended;');
AddFunction(@ps_sqr,'function Sqr(e : extended) : extended;');
AddFunction(@ps_point,'function Point(x,y:integer) : TPoint;');
AddFunction(@ps_Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;');
AddFunction(@ps_hypot,'function Hypot(X, Y: Extended): Extended;');
AddFunction(@ps_RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;');
AddFunction(@BinCoe,'function BinCoe(a, b: LongInt): Extended;');
AddFunction(@FixD,'function FixD(Degrees : extended) : Extended;');

View File

@ -24,6 +24,8 @@
unit mmlpsthread;
{$Define PS_USESSUPPORT}
//{$define PS_StdCall}
{$mode objfpc}{$H+}
interface
@ -158,6 +160,12 @@ uses
forms,//Forms
lclintf; // for GetTickCount and others.
{$MACRO ON}
{$ifdef PS_StdCall}
{$define ps_decl := stdcall}
{$else}
{$define ps_decl := REGISTER}
{$endif}
{Some General PS Functions here}
procedure psWriteln(str : string);
@ -331,7 +339,7 @@ begin
FontPath:= FontP;
end;
function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;
function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;ps_decl;
begin
CurrThread.SyncInfo^.MethodName:= ProcName;
CurrThread.SyncInfo^.V:= V;
@ -471,7 +479,8 @@ begin
//Export all the methods
for i := 0 to high(ExportedMethods) do
if ExportedMethods[i].FuncPtr <> nil then
PSScript.AddFunctionEx(ExportedMethods[i].FuncPtr,ExportedMethods[i].FuncDecl,cdStdCall);
PSScript.AddFunctionEx(ExportedMethods[i].FuncPtr,ExportedMethods[i].FuncDecl,
{$ifdef PS_StdCall}cdStdCall{$else}cdRegister {$endif});
end;
function TPSThread.RequireFile(Sender: TObject;