I believe there is an issue in FindFlag2. It changes the target temporarily - does some work and then frees the temporary target _before_ restoring the old target. This is not allowed as Simba will temporarily be without a target.
I'm not sure why this wasn't a problem before, but it caused exceptions on Linux with Lape.
Below a changed version where the temporary target is stored in 't', the old target is restored and then 't' is freed.
Please try this before committing as I've only tested it a bit. Although I'm pretty sure it's a safe change.
Simba Code:
function FindFlag2(var X, Y: Integer): Boolean;
var
KMTarget, ITarget, I, Hi, Map, W, H, t: Integer;
TPA: TPointArray;
begin
Result := False;
Map := BitmapFromString(MMX2 - MMX1, MMY2 - MMY1, '');
CopyClientToBitmap(Map, MMX1, MMY1, MMX2, MMY2);
KMTarget := GetKeyMouseTarget;
ITarget := GetImageTarget;
SetTargetBitmap(Map);
GetBitmapSize(Map, W, H);
FindColors(TPA, 65536, 0, 0, W - 1, H -1);
FilterPointsDist(TPA, 0, 75.5, W div 2, H div 2);
Hi := Length(TPA);
for I := 0 to Hi - 1 do
if ((FastGetPixel(Map, TPA[I].X - 1, TPA[I].Y - 1) - FastGetPixel(Map, TPA[I].X, TPA[I].Y - 1)) = 6381921) then
begin
Result := True;
X := TPA[I].X + MMX1;
Y := TPA[I].Y + MMY1;
Break;
end;
t := GetImageTarget;
SetKeyMouseTarget(KMTarget);
SetImageTarget(ITarget);
FreeTarget(t);
FreeBitmap(Map);
end;
PS: It could also just use Freeze, couldn't it?
E: Also, GetColor() operates on the bitmap as well. So you could use that instead of FastGetPixel.