1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-02-16 07:10:10 -05:00

Small updates + added core for updater

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@353 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-12-31 18:17:49 +00:00
parent 77c45df43c
commit 568484d2e0
14 changed files with 4132 additions and 3837 deletions

View File

@ -11,7 +11,7 @@
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Icon Value="0"/> <Icon Value="0"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="0"/> <ActiveEditorIndexAtStart Value="6"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@ -30,15 +30,15 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local> </local>
</RunParams> </RunParams>
<Units Count="26"> <Units Count="34">
<Unit0> <Unit0>
<Filename Value="project1.lpr"/> <Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="project1"/> <UnitName Value="project1"/>
<CursorPos X="28" Y="103"/> <CursorPos X="25" Y="83"/>
<TopLine Value="84"/> <TopLine Value="60"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="105"/> <UsageCount Value="116"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@ -51,10 +51,10 @@
<Unit2> <Unit2>
<Filename Value="../../Units/MMLCore/client.pas"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<UnitName Value="Client"/> <UnitName Value="Client"/>
<CursorPos X="28" Y="50"/> <CursorPos X="20" Y="33"/>
<TopLine Value="30"/> <TopLine Value="1"/>
<EditorIndex Value="9"/> <EditorIndex Value="13"/>
<UsageCount Value="45"/> <UsageCount Value="49"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
@ -69,8 +69,8 @@
<UnitName Value="Window"/> <UnitName Value="Window"/>
<CursorPos X="55" Y="251"/> <CursorPos X="55" Y="251"/>
<TopLine Value="236"/> <TopLine Value="236"/>
<EditorIndex Value="12"/> <EditorIndex Value="17"/>
<UsageCount Value="44"/> <UsageCount Value="48"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
@ -78,8 +78,8 @@
<UnitName Value="colour_conv"/> <UnitName Value="colour_conv"/>
<CursorPos X="18" Y="346"/> <CursorPos X="18" Y="346"/>
<TopLine Value="307"/> <TopLine Value="307"/>
<EditorIndex Value="4"/> <EditorIndex Value="9"/>
<UsageCount Value="25"/> <UsageCount Value="29"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
@ -87,8 +87,8 @@
<UnitName Value="finder"/> <UnitName Value="finder"/>
<CursorPos X="1" Y="1728"/> <CursorPos X="1" Y="1728"/>
<TopLine Value="1701"/> <TopLine Value="1701"/>
<EditorIndex Value="3"/> <EditorIndex Value="8"/>
<UsageCount Value="48"/> <UsageCount Value="52"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
@ -96,8 +96,8 @@
<UnitName Value="Input"/> <UnitName Value="Input"/>
<CursorPos X="72" Y="47"/> <CursorPos X="72" Y="47"/>
<TopLine Value="36"/> <TopLine Value="36"/>
<EditorIndex Value="8"/> <EditorIndex Value="12"/>
<UsageCount Value="44"/> <UsageCount Value="48"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
@ -105,8 +105,8 @@
<UnitName Value="MufasaTypes"/> <UnitName Value="MufasaTypes"/>
<CursorPos X="98" Y="92"/> <CursorPos X="98" Y="92"/>
<TopLine Value="76"/> <TopLine Value="76"/>
<EditorIndex Value="13"/> <EditorIndex Value="18"/>
<UsageCount Value="46"/> <UsageCount Value="50"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
@ -114,8 +114,8 @@
<UnitName Value="ocr"/> <UnitName Value="ocr"/>
<CursorPos X="1" Y="133"/> <CursorPos X="1" Y="133"/>
<TopLine Value="108"/> <TopLine Value="108"/>
<EditorIndex Value="10"/> <EditorIndex Value="15"/>
<UsageCount Value="45"/> <UsageCount Value="49"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
@ -127,9 +127,11 @@
<Unit11> <Unit11>
<Filename Value="../../Units/MMLCore/files.pas"/> <Filename Value="../../Units/MMLCore/files.pas"/>
<UnitName Value="files"/> <UnitName Value="files"/>
<CursorPos X="5" Y="42"/> <CursorPos X="22" Y="36"/>
<TopLine Value="27"/> <TopLine Value="18"/>
<UsageCount Value="5"/> <EditorIndex Value="14"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<Filename Value="../../../../Documents/lazarus/lcl/graphics.pp"/> <Filename Value="../../../../Documents/lazarus/lcl/graphics.pp"/>
@ -141,10 +143,10 @@
<Unit13> <Unit13>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<UnitName Value="bitmaps"/> <UnitName Value="bitmaps"/>
<CursorPos X="1" Y="905"/> <CursorPos X="56" Y="477"/>
<TopLine Value="885"/> <TopLine Value="435"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<UsageCount Value="43"/> <UsageCount Value="47"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit13> </Unit13>
<Unit14> <Unit14>
@ -176,19 +178,19 @@
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/ocr.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/ocr.inc"/>
<CursorPos X="20" Y="5"/> <CursorPos X="20" Y="4"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="11"/> <EditorIndex Value="16"/>
<UsageCount Value="41"/> <UsageCount Value="45"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
<Filename Value="../../Units/MMLCore/dtm.pas"/> <Filename Value="../../Units/MMLCore/dtm.pas"/>
<UnitName Value="dtm"/> <UnitName Value="dtm"/>
<CursorPos X="92" Y="287"/> <CursorPos X="89" Y="33"/>
<TopLine Value="99"/> <TopLine Value="1"/>
<EditorIndex Value="6"/> <EditorIndex Value="2"/>
<UsageCount Value="41"/> <UsageCount Value="45"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit19> </Unit19>
<Unit20> <Unit20>
@ -196,17 +198,17 @@
<UnitName Value="dtmutil"/> <UnitName Value="dtmutil"/>
<CursorPos X="43" Y="218"/> <CursorPos X="43" Y="218"/>
<TopLine Value="49"/> <TopLine Value="49"/>
<EditorIndex Value="5"/> <EditorIndex Value="10"/>
<UsageCount Value="37"/> <UsageCount Value="41"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit20> </Unit20>
<Unit21> <Unit21>
<Filename Value="../../../../Documents/fpc/packages/fcl-base/src/custapp.pp"/> <Filename Value="../../../../Documents/fpc/packages/fcl-base/src/custapp.pp"/>
<UnitName Value="CustApp"/> <UnitName Value="CustApp"/>
<CursorPos X="43" Y="287"/> <CursorPos X="59" Y="274"/>
<TopLine Value="274"/> <TopLine Value="274"/>
<EditorIndex Value="2"/> <EditorIndex Value="7"/>
<UsageCount Value="17"/> <UsageCount Value="21"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit21> </Unit21>
<Unit22> <Unit22>
@ -214,8 +216,8 @@
<UnitName Value="ocrutil"/> <UnitName Value="ocrutil"/>
<CursorPos X="22" Y="470"/> <CursorPos X="22" Y="470"/>
<TopLine Value="445"/> <TopLine Value="445"/>
<EditorIndex Value="7"/> <EditorIndex Value="11"/>
<UsageCount Value="25"/> <UsageCount Value="29"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit22> </Unit22>
<Unit23> <Unit23>
@ -237,127 +239,190 @@
<TopLine Value="78"/> <TopLine Value="78"/>
<UsageCount Value="7"/> <UsageCount Value="7"/>
</Unit25> </Unit25>
<Unit26>
<Filename Value="../../../../Documents/lazarus/lcl/graphtype.pp"/>
<UnitName Value="GraphType"/>
<CursorPos X="72" Y="96"/>
<TopLine Value="72"/>
<UsageCount Value="12"/>
</Unit26>
<Unit27>
<Filename Value="../../Units/Synapse/httpsend.pas"/>
<UnitName Value="httpsend"/>
<CursorPos X="1" Y="758"/>
<TopLine Value="731"/>
<EditorIndex Value="3"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit27>
<Unit28>
<Filename Value="../../Units/MMLAddon/internets.pas"/>
<UnitName Value="internets"/>
<CursorPos X="9" Y="21"/>
<TopLine Value="1"/>
<EditorIndex Value="4"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit28>
<Unit29>
<Filename Value="../../../../Documents/fpc/rtl/objpas/classes/classesh.inc"/>
<CursorPos X="14" Y="712"/>
<TopLine Value="696"/>
<UsageCount Value="10"/>
</Unit29>
<Unit30>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<UnitName Value="updater"/>
<CursorPos X="43" Y="169"/>
<TopLine Value="146"/>
<EditorIndex Value="6"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit30>
<Unit31>
<Filename Value="../../Units/Synapse/blcksock.pas"/>
<UnitName Value="blcksock"/>
<CursorPos X="3" Y="133"/>
<TopLine Value="137"/>
<EditorIndex Value="5"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit31>
<Unit32>
<Filename Value="../../Units/Synapse/ssfpc.pas"/>
<UnitName Value="ssfpc"/>
<CursorPos X="3" Y="94"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit32>
<Unit33>
<Filename Value="../../Units/Synapse/sslinux.pas"/>
<UnitName Value="sslinux"/>
<CursorPos X="1" Y="62"/>
<TopLine Value="32"/>
<UsageCount Value="10"/>
</Unit33>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="100" Column="21" TopLine="90"/> <Caret Line="85" Column="54" TopLine="74"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="85" Column="33" TopLine="54"/> <Caret Line="83" Column="24" TopLine="65"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="118" Column="50" TopLine="89"/> <Caret Line="90" Column="34" TopLine="67"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="119" Column="28" TopLine="98"/> <Caret Line="93" Column="93" TopLine="68"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="107" Column="62" TopLine="72"/> <Caret Line="101" Column="13" TopLine="78"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/Synapse/blcksock.pas"/>
<Caret Line="143" Column="40" TopLine="120"/> <Caret Line="803" Column="33" TopLine="781"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="144" Column="18" TopLine="109"/> <Caret Line="106" Column="35" TopLine="78"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/Synapse/blcksock.pas"/>
<Caret Line="142" Column="35" TopLine="121"/> <Caret Line="176" Column="63" TopLine="162"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="141" Column="75" TopLine="121"/> <Caret Line="8" Column="39" TopLine="1"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="155" Column="39" TopLine="121"/> <Caret Line="109" Column="11" TopLine="98"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="158" Column="9" TopLine="134"/> <Caret Line="111" Column="15" TopLine="84"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="155" Column="42" TopLine="135"/> <Caret Line="75" Column="23" TopLine="62"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="160" Column="32" TopLine="141"/> <Caret Line="115" Column="13" TopLine="84"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="156" Column="101" TopLine="129"/> <Caret Line="70" Column="60" TopLine="45"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/Synapse/httpsend.pas"/>
<Caret Line="168" Column="36" TopLine="140"/> <Caret Line="228" Column="23" TopLine="204"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="96" Column="54" TopLine="75"/> <Caret Line="110" Column="15" TopLine="95"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="159" Column="38" TopLine="139"/> <Caret Line="117" Column="44" TopLine="92"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="199" Column="27" TopLine="170"/> <Caret Line="30" Column="30" TopLine="11"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="165" Column="13" TopLine="145"/> <Caret Line="126" Column="11" TopLine="95"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="project1.lpr"/> <Filename Value="project1.lpr"/>
<Caret Line="201" Column="33" TopLine="173"/> <Caret Line="12" Column="7" TopLine="5"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="59" Column="5" TopLine="37"/> <Caret Line="33" Column="20" TopLine="1"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="61" Column="18" TopLine="50"/> <Caret Line="123" Column="19" TopLine="111"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="74" Column="85" TopLine="48"/> <Caret Line="140" Column="18" TopLine="117"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="68" Column="10" TopLine="48"/> <Caret Line="35" Column="59" TopLine="17"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="62" Column="16" TopLine="48"/> <Caret Line="131" Column="13" TopLine="113"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="95" Column="39" TopLine="70"/> <Caret Line="130" Column="19" TopLine="113"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="68" Column="3" TopLine="34"/> <Caret Line="131" Column="13" TopLine="112"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="268" Column="10" TopLine="251"/> <Caret Line="120" Column="54" TopLine="102"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="129" Column="11" TopLine="89"/> <Caret Line="40" Column="33" TopLine="12"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="project1.lpr"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="168" Column="64" TopLine="151"/> <Caret Line="38" Column="41" TopLine="20"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
@ -365,7 +430,7 @@
<Version Value="8"/> <Version Value="8"/>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/> <IncludeFiles Value="$(ProjOutDir)/"/>
<OtherUnitFiles Value="$(ProjPath)/../../Units/MMLCore/;$(ProjPath)/../../Units/Misc/;$(ProjPath)/../../Units/MMLAddon/;$(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)/;$(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS)/;$(ProjPath)/../../Units/Linux/;$(LazarusDir)/components/mouseandkeyinput/"/> <OtherUnitFiles Value="$(ProjPath)/../../Units/MMLCore/;$(ProjPath)/../../Units/Misc/;$(ProjPath)/../../Units/MMLAddon/;$(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)/;$(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS)/;$(ProjPath)/../../Units/Linux/;$(ProjPath)/../../Units/Synapse/;$(LazarusDir)/components/mouseandkeyinput/"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <CodeGeneration>
<Optimizations> <Optimizations>

View File

@ -10,7 +10,8 @@ uses
Forms,Interfaces, Forms,Interfaces,
LCLIntf, LCLIntf,
Client, Client,
bitmaps,{x ,}mufasatypes,dtm,dtmutil, ocrutil ,graphics ,colour_conv,math bitmaps,{x ,}mufasatypes,dtm,dtmutil, ocrutil ,graphics ,colour_conv,math,
updater
{ you can add units after this }; { you can add units after this };
@ -55,7 +56,7 @@ end;
procedure MufasaTests.DoRun; procedure MufasaTests.DoRun;
const {const
ocr_Limit_High = 191; ocr_Limit_High = 191;
ocr_Limit_Low = 65; ocr_Limit_Low = 65;
@ -66,18 +67,20 @@ const
ocr_Blue = 16776960; ocr_Blue = 16776960;
ocr_ItemC = 16744447; ocr_ItemC = 16744447;
ocr_Purple = 8388736; ocr_Purple = 8388736; }
var var
ErrorMsg: String; ErrorMsg: String;
Time: DWord; { Time: DWord;
C: TClient; C: TClient;
I, w, h,x,y: Integer; I, w, h,x,y: Integer;
dtm: pdtm; dtm: pdtm;
p:tpointarray; p:tpointarray;
bmp, bmprs: TMufasaBitmap; bmp, bmprs: TMufasaBitmap;
tbmp: TBitmap;
r,g,b:integer; r,g,b:integer;
t:Dword; t:Dword; }
up: TMMLFileDownloader;
begin begin
// quick check parameters // quick check parameters
@ -95,6 +98,14 @@ begin
Exit; Exit;
end; end;
up := TMMLFileDownloader.Create;
up.FileURL:='http://www.villavu.com/pics/desktop.png';
up.ReplacementFile:='test.png';
up.DownloadAndSave;
up.Replace;
up.Free;
{ clOlive = false point } { clOlive = false point }
{ clSilver = false shadow } { clSilver = false shadow }
@ -102,140 +113,36 @@ begin
{ add your program here } { add your program here }
{ tbmp:=TBitmap.Create;
tbmp.LoadFromFile('/home/merlijn/Programs/mufasa/pics/16.bmp');
bmprs := TMufasaBitmap.Create; bmprs := TMufasaBitmap.Create;
bmprs.LoadFromFile('/home/merlijn/Programs/mufasa/pics/16.bmp'); bmprs.SetSize(10,10);
C := TClient.Create;
C.MWindow.SetTarget(bmprs);
C.MWindow.GetDimensions(w, h);
writeln(inttostr(clpurple)); bmprs.LoadFromRawImage(tbmp.RawImage);
tbmp.Free;
bmp := TMufasaBitmap.Create; tbmp := bmprs.ToTBitmap;
bmp.CopyClientToBitmap(C.MWindow, True, 0, 0, 450, 50); }
{ for y := 0 to tbmp.Height -1 do
t:=gettickcount; for x := 0 to tbmp.width -1 do
for y := 0 to bmp.Height - 1 do
for x := 0 to bmp.Width - 1 do
begin begin
colortorgb(bmp.fastgetpixel(x,y),r,g,b); writeln(format('(%d, %d) = %d , %d', [x,y,tbmp.Canvas.pixels[x,y],bmprs.FastGetPixel(x,y)]));
// the abs(g-b) < 15 seems to help heaps when taking out crap points colortorgb(tbmp.Canvas.pixels[x,y],r,g,b);
if (r > ocr_Limit_High) and (g > ocr_Limit_High) and (b > ocr_Limit_High){ and (abs(g-b) < 15)} then writeln(format('%d,%d,%d', [r,g,b]));
begin colortorgb(bmprs.FastGetPixel(x,y),r,g,b);
bmp.fastsetpixel(x,y,ocr_White); writeln(format('%d,%d,%d', [r,g,b]));
continue; end; }
end; //bmprs.LoadFromFile('/home/merlijn/Programs/mufasa/pics/16.bmp');
if (r < ocr_Limit_Low) and (g > ocr_Limit_High) and (b > ocr_Limit_High) then {C := TClient.Create;
begin C.MWindow.SetTarget(bmprs); }
bmp.fastsetpixel(x,y,ocr_Blue);
continue;
end;
if (r < ocr_Limit_Low) and (g > ocr_Limit_High) and (b < ocr_Limit_Low) then
begin
bmp.fastsetpixel(x,y,ocr_Green);
continue;
end;
// false results with fire
if(r > ocr_Limit_High) and (g > 100) and (g < ocr_Limit_High) and (b > 40) and (b < 90) then
begin
bmp.fastsetpixel(x,y,ocr_ItemC);
continue;
end;
if(r > ocr_Limit_High) and (g > ocr_Limit_High) and (b < ocr_Limit_Low) then
begin
bmp.fastsetpixel(x,y,ocr_Yellow);
continue;
end;
// better use g < 40 than ocr_Limit_Low imo
if (r > ocr_Limit_High) and (g < ocr_Limit_Low) and (b < ocr_Limit_Low) then
begin
bmp.fastsetpixel(x,y,ocr_Red);
continue;
end;
if (r < ocr_Limit_Low) and (g < ocr_Limit_Low) and (b < ocr_Limit_Low) then
begin
bmp.FastSetPixel(x,y, ocr_Purple);
continue;
end;
bmp.fastsetpixel(x,y,0);
end;
// increase height by 1, so our algo works better. (shadow)
bmp.SetSize(Bmp.Width, Bmp.Height+1);
for x := 0 to bmp.width -1 do
bmp.fastsetpixel(x,bmp.height-1,0);
for y := 0 to bmp.Height - 2 do
for x := 0 to bmp.Width - 2 do
begin
if bmp.fastgetpixel(x,y) = clPurple then
continue;
if bmp.fastgetpixel(x,y) = clBlack then
continue;
if (bmp.fastgetpixel(x,y) <> bmp.fastgetpixel(x+1,y+1)) and (bmp.fastgetpixel(x+1,y+1) <> clpurple) then
bmp.fastsetpixel(x,y,{clAqua}0);
end;
{ Optional - remove false shadow }
for y := bmp.Height - 1 downto 1 do
for x := bmp.Width - 1 downto 1 do
begin
if bmp.fastgetpixel(x,y) <> clPurple then
continue;
if bmp.fastgetpixel(x,y) = bmp.fastgetpixel(x-1,y-1) then
begin
bmp.fastsetpixel(x,y,clSilver);
continue;
end;
if bmp.fastgetpixel(x-1,y-1) = 0 then
bmp.fastsetpixel(x,y,clLime);
end;
{ remove bad points }
for y := bmp.Height - 2 downto 1 do
for x := bmp.Width - 2 downto 1 do
begin
if bmp.fastgetpixel(x,y) = clPurple then
continue;
if bmp.fastgetpixel(x,y) = clBlack then
continue;
if (bmp.fastgetpixel(x,y) = bmp.fastgetpixel(x+1,y+1) ) then
continue;
if bmp.fastgetpixel(x+1,y+1) <> clPurple then
begin
bmp.fastsetpixel(x,y,clOlive);
continue;
end;
end;
{ Dangerous removes all pixels that had no pixels on x-1 or x+1}
{ for y := 0 to bmp.Height - 2 do
for x := 1 to bmp.Width - 2 do
begin
if bmp.fastgetpixel(x,y) = clBlack then continue;
if bmp.fastgetpixel(x,y) = clPurple then continue;
if bmp.fastgetpixel(x,y) = clOlive then continue;
if bmp.fastgetpixel(x,y) = clSilver then continue;
if bmp.fastgetpixel(x,y) = clLime then continue;
if (bmp.fastgetpixel(x,y) <> bmp.fastgetpixel(x+1,y) ) and
(bmp.fastgetpixel(x,y) <> bmp.fastgetpixel(x-1,y) ) then
bmp.fastsetpixel(x,y,clFuchsia);
end; }
writeln(inttostr(gettickcount-t));
{ bmp.SaveToFile('/tmp/output.bmp');
tbmp.SaveToFile('/tmp/output2.bmp');
bmp.SaveToFile('/tmp/output.bmp');
//bmp.OnDestroy:=nil; //bmp.OnDestroy:=nil;
bmp.Free; bmp.Free;
C.Free; tbmp.Free; }
// C.Free;
// stop program loop // stop program loop
Terminate; Terminate;

View File

@ -74,8 +74,7 @@ type
procedure DeleteSelected(Sender: TObject); procedure DeleteSelected(Sender: TObject);
procedure AddColObj(c: TColourPickerObject; autoName: Boolean); procedure AddColObj(c: TColourPickerObject; autoName: Boolean);
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure CHSaveClick(Sender: TObject); procedure CHSaveClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure OkButtonClick(Sender: TObject); procedure OkButtonClick(Sender: TObject);
@ -90,6 +89,9 @@ type
procedure SetNodeBitmap(N: TTreeNode); procedure SetNodeBitmap(N: TTreeNode);
procedure SaveToXML(s: String); procedure SaveToXML(s: String);
procedure XML2Tree(XMLDoc: TXMLDocument); procedure XML2Tree(XMLDoc: TXMLDocument);
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
public public
IndexSelected: Integer; IndexSelected: Integer;
{ public declarations } { public declarations }
@ -179,7 +181,6 @@ end;
procedure TColourHistoryForm.DeleteSelected(Sender: TObject); procedure TColourHistoryForm.DeleteSelected(Sender: TObject);
var var
i:integer;
e: TTreeNodesEnumerator; e: TTreeNodesEnumerator;
begin begin

View File

@ -1,122 +1,124 @@
{ {
This file is part of the Mufasa Macro Library (MML) This file is part of the Mufasa Macro Library (MML)
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
MML is free software: you can redistribute it and/or modify MML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
MML is distributed in the hope that it will be useful, MML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with MML. If not, see <http://www.gnu.org/licenses/>. along with MML. If not, see <http://www.gnu.org/licenses/>.
See the file COPYING, included in this distribution, See the file COPYING, included in this distribution,
for details about the copyright. for details about the copyright.
Image debug window for Mufasa Macro Library Image debug window for Mufasa Macro Library
} }
unit debugimage; unit debugimage;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, bitmaps; ExtCtrls, bitmaps;
type type
{ TDebugImgForm } { TDebugImgForm }
TDebugImgForm = class(TForm) TDebugImgForm = class(TForm)
DrawImage: TImage; DrawImage: TImage;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormHide(Sender: TObject); procedure FormHide(Sender: TObject);
procedure FormResize(Sender: TObject); procedure FormResize(Sender: TObject);
private private
{ private declarations } { private declarations }
public public
DispSize : TPoint; DispSize : TPoint;
ToDrawBmp: TMufasaBitmap;//The bitmap we should draw! ToDrawBmp: TMufasaBitmap;//The bitmap we should draw!
GetDbgBmp : TMufasaBitmap; GetDbgBmp : TMufasaBitmap;
procedure BlackDebugImage; procedure BlackDebugImage;
procedure DrawBitmap; procedure DrawBitmap;
procedure GetDebugImage; procedure GetDebugImage;
procedure ShowDebugImgForm; //Uses the global var for w/h procedure ShowDebugImgForm; //Uses the global var for w/h
{ public declarations } { public declarations }
end; end;
var var
DebugImgForm: TDebugImgForm; DebugImgForm: TDebugImgForm;
implementation implementation
uses uses
MufasaTypes, math,windowutil,graphtype, IntfGraphics,TestUnit,lclintf,colour_conv,InterfaceBase; MufasaTypes, math,windowutil,graphtype, IntfGraphics,TestUnit,lclintf,colour_conv,InterfaceBase;
{ TDebugImgForm } { TDebugImgForm }
procedure TDebugImgForm.FormCreate(Sender: TObject); procedure TDebugImgForm.FormCreate(Sender: TObject);
begin begin
BlackDebugImage; BlackDebugImage;
end; end;
procedure TDebugImgForm.FormHide(Sender: TObject); procedure TDebugImgForm.FormHide(Sender: TObject);
begin begin
Form1.MenuItemDebugImage.Checked := False; Form1.MenuItemDebugImage.Checked := False;
end; end;
procedure TDebugImgForm.FormResize(Sender: TObject); procedure TDebugImgForm.FormResize(Sender: TObject);
begin begin
DrawImage.Picture.Graphic.Width := DrawImage.Width; DrawImage.Picture.Graphic.Width := DrawImage.Width;
DrawImage.Picture.Graphic.Height := DrawImage.Height; DrawImage.Picture.Graphic.Height := DrawImage.Height;
BlackDebugImage; BlackDebugImage;
end; end;
procedure TDebugImgForm.BlackDebugImage; procedure TDebugImgForm.BlackDebugImage;
begin begin
DrawImage.Canvas.Brush.Color:= clBlack; DrawImage.Canvas.Brush.Color:= clBlack;
DrawImage.Canvas.Pen.Color:= clBlack; DrawImage.Canvas.Pen.Color:= clBlack;
DrawImage.Canvas.Rectangle(0,0,DrawImage.Width,DrawImage.Height); DrawImage.Canvas.Rectangle(0,0,DrawImage.Width,DrawImage.Height);
end; DrawImage.Repaint;
end;
procedure TDebugImgForm.DrawBitmap;
var procedure TDebugImgForm.DrawBitmap;
rawImage : TRawImage; var
Bitmap : Graphics.TBitmap; rawImage : TRawImage;
begin Bitmap : Graphics.TBitmap;
if ToDrawBmp = nil then begin
raise Exception.Create('ERROR in TDebugImgForm.DrawBitmap: ToDrawBmp = nil'); if ToDrawBmp = nil then
ArrDataToRawImage(ToDrawBmp.FData,Point(ToDrawBmp.width,ToDrawBmp.height),RawImage); raise Exception.Create('ERROR in TDebugImgForm.DrawBitmap: ToDrawBmp = nil');
Bitmap := Graphics.TBitmap.Create; ArrDataToRawImage(ToDrawBmp.FData,Point(ToDrawBmp.width,ToDrawBmp.height),RawImage);
Bitmap.LoadFromRawImage(Rawimage,false); Bitmap := Graphics.TBitmap.Create;
DrawImage.Canvas.Draw(0,0,Bitmap); Bitmap.LoadFromRawImage(Rawimage,false);
Bitmap.Free; DrawImage.Canvas.Draw(0,0,Bitmap);
end; DrawImage.Repaint;
Bitmap.Free;
procedure TDebugImgForm.GetDebugImage; end;
begin;
GetDbgBmp.LoadFromRawImage(DrawImage.Picture.Bitmap.RawImage); procedure TDebugImgForm.GetDebugImage;
end; begin;
GetDbgBmp.LoadFromRawImage(DrawImage.Picture.Bitmap.RawImage);
procedure TDebugImgForm.ShowDebugImgForm; end;
begin
Show; procedure TDebugImgForm.ShowDebugImgForm;
if (DispSize.x <> Width) or (DispSize.y <> height) then begin
begin; Show;
Width := DispSize.x; if (DispSize.x <> Width) or (DispSize.y <> height) then
Height := DispSize.y; begin;
end; Width := DispSize.x;
end; Height := DispSize.y;
end;
initialization end;
{$I debugimage.lrs}
initialization
end. {$I debugimage.lrs}
end.

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ uses
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, LResources, testunit, colourhistory, About, internets, debugimage, Forms, LResources, testunit, colourhistory, About, internets, debugimage,
framefunctionlist, simpleanalyzer; framefunctionlist, simpleanalyzer, updater;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF} {$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}

View File

@ -1,11 +1,11 @@
object Form1: TForm1 object Form1: TForm1
Left = 273 Left = 395
Height = 557 Height = 557
Top = 233 Top = 267
Width = 734 Width = 734
ActiveControl = ScriptPanel ActiveControl = ScriptPanel
Caption = 'THA FUKING MUFASA' Caption = 'THA FUKING MUFASA'
ClientHeight = 537 ClientHeight = 532
ClientWidth = 734 ClientWidth = 734
KeyPreview = True KeyPreview = True
Menu = MainMenu1 Menu = MainMenu1
@ -166,8 +166,8 @@ object Form1: TForm1
end end
object StatusBar: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Height = 23 Height = 21
Top = 514 Top = 511
Width = 734 Width = 734
Panels = < Panels = <
item item
@ -185,7 +185,7 @@ object Form1: TForm1
object PanelMemo: TPanel object PanelMemo: TPanel
Left = 0 Left = 0
Height = 154 Height = 154
Top = 360 Top = 357
Width = 734 Width = 734
Align = alBottom Align = alBottom
ClientHeight = 154 ClientHeight = 154
@ -205,19 +205,19 @@ object Form1: TForm1
Cursor = crVSplit Cursor = crVSplit
Left = 0 Left = 0
Height = 5 Height = 5
Top = 355 Top = 352
Width = 734 Width = 734
Align = alBottom Align = alBottom
ResizeAnchor = akBottom ResizeAnchor = akBottom
end end
object ScriptPanel: TPanel object ScriptPanel: TPanel
Left = 0 Left = 0
Height = 331 Height = 328
Top = 24 Top = 24
Width = 734 Width = 734
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 331 ClientHeight = 328
ClientWidth = 734 ClientWidth = 734
DockSite = True DockSite = True
TabOrder = 4 TabOrder = 4
@ -225,7 +225,7 @@ object Form1: TForm1
OnDockOver = ScriptPanelDockOver OnDockOver = ScriptPanelDockOver
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 150 Left = 150
Height = 296 Height = 293
Top = 0 Top = 0
Width = 584 Width = 584
Align = alClient Align = alClient
@ -244,7 +244,7 @@ object Form1: TForm1
object SearchPanel: TPanel object SearchPanel: TPanel
Left = 0 Left = 0
Height = 35 Height = 35
Top = 296 Top = 293
Width = 734 Width = 734
Align = alBottom Align = alBottom
BevelOuter = bvSpace BevelOuter = bvSpace
@ -340,7 +340,7 @@ object Form1: TForm1
end end
object LabeledEditSearch: TLabeledEdit object LabeledEditSearch: TLabeledEdit
Left = 104 Left = 104
Height = 21 Height = 27
Top = 6 Top = 6
Width = 174 Width = 174
EditLabel.AnchorSideLeft.Control = LabeledEditSearch EditLabel.AnchorSideLeft.Control = LabeledEditSearch
@ -348,10 +348,10 @@ object Form1: TForm1
EditLabel.AnchorSideTop.Side = asrCenter EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = LabeledEditSearch EditLabel.AnchorSideRight.Control = LabeledEditSearch
EditLabel.AnchorSideBottom.Control = LabeledEditSearch EditLabel.AnchorSideBottom.Control = LabeledEditSearch
EditLabel.Left = 73 EditLabel.Left = 67
EditLabel.Height = 14 EditLabel.Height = 18
EditLabel.Top = 9 EditLabel.Top = 10
EditLabel.Width = 28 EditLabel.Width = 34
EditLabel.Caption = 'Find: ' EditLabel.Caption = 'Find: '
EditLabel.ParentColor = False EditLabel.ParentColor = False
LabelPosition = lpLeft LabelPosition = lpLeft
@ -364,9 +364,9 @@ object Form1: TForm1
end end
object CheckBoxMatchCase: TCheckBox object CheckBoxMatchCase: TCheckBox
Left = 320 Left = 320
Height = 17 Height = 22
Top = 7 Top = 7
Width = 72 Width = 97
Caption = 'Match case' Caption = 'Match case'
OnClick = CheckBoxMatchCaseClick OnClick = CheckBoxMatchCaseClick
TabOrder = 1 TabOrder = 1
@ -374,29 +374,31 @@ object Form1: TForm1
end end
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 145 Left = 145
Height = 296 Height = 293
Top = 0 Top = 0
Width = 5 Width = 5
OnCanResize = Splitter1CanResize OnCanResize = Splitter1CanResize
Visible = False Visible = False
end end
inline frmFunctionList: TFunctionListFrame inline frmFunctionList: TFunctionListFrame
Height = 296 Height = 293
Width = 145 Width = 145
ClientHeight = 296 ClientHeight = 293
ClientWidth = 145 ClientWidth = 145
TabOrder = 3 TabOrder = 3
Visible = False Visible = False
inherited FunctionList: TTreeView inherited FunctionList: TTreeView
Height = 275 Height = 266
Width = 145 Width = 145
DefaultItemHeight = 19
OnChange = FunctionListChange OnChange = FunctionListChange
OnDeletion = nil OnDeletion = nil
OnEnter = FunctionListEnter OnEnter = FunctionListEnter
OnExit = FunctionListExit OnExit = FunctionListExit
end end
inherited editSearchList: TEdit inherited editSearchList: TEdit
Top = 275 Height = 27
Top = 266
Width = 145 Width = 145
OnExit = editSearchListExit OnExit = editSearchListExit
OnKeyPress = editSearchListKeyPress OnKeyPress = editSearchListKeyPress

File diff suppressed because it is too large Load Diff

View File

@ -1,195 +1,198 @@
{ {
This file is part of the Mufasa Macro Library (MML) This file is part of the Mufasa Macro Library (MML)
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
MML is free software: you can redistribute it and/or modify MML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
MML is distributed in the hope that it will be useful, MML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with MML. If not, see <http://www.gnu.org/licenses/>. along with MML. If not, see <http://www.gnu.org/licenses/>.
See the file COPYING, included in this distribution, See the file COPYING, included in this distribution,
for details about the copyright. for details about the copyright.
psexportedmethods.inc for the Mufasa Macro Library psexportedmethods.inc for the Mufasa Macro Library
} }
AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;'); AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;');
AddFunction(@psWriteln,'procedure writeln(s : string);'); AddFunction(@psWriteln,'procedure writeln(s : string);');
{ DTM } { DTM }
SetCurrSection('DTM'); SetCurrSection('DTM');
AddFunction(@PrintpDTM, 'Procedure PrintpDTM(tDTM : pDTM);'); AddFunction(@PrintpDTM, 'Procedure PrintpDTM(tDTM : pDTM);');
AddFunction(@ps_GetDTM ,'function GetDTM(index: Integer; out dtm: pDTM): Boolean;'); AddFunction(@ps_GetDTM ,'function GetDTM(index: Integer; out dtm: pDTM): Boolean;');
AddFunction(@pDTMToTDTM, 'Function pDTMToTDTM(Const DTM: pDTM): TDTM;'); AddFunction(@pDTMToTDTM, 'Function pDTMToTDTM(Const DTM: pDTM): TDTM;');
AddFunction(@tDTMTopDTM, 'Function tDTMTopDTM(Const DTM: TDTM): pDTM;'); AddFunction(@tDTMTopDTM, 'Function tDTMTopDTM(Const DTM: TDTM): pDTM;');
AddFunction(@ps_DTMFromString, 'function DTMFromString(DTMString: String): Integer;'); AddFunction(@ps_DTMFromString, 'function DTMFromString(DTMString: String): Integer;');
AddFunction(@ps_FreeDTM, 'procedure FreeDTM(DTM: Integer);'); AddFunction(@ps_FreeDTM, 'procedure FreeDTM(DTM: Integer);');
AddFunction(@ps_FindDTM, 'function FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean;'); AddFunction(@ps_FindDTM, 'function FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean;');
AddFunction(@ps_FindDTMs, 'function FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean;'); AddFunction(@ps_FindDTMs, 'function FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean;');
AddFunction(@ps_FindDTMRotated, 'function FindDTMRotated(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;'); AddFunction(@ps_FindDTMRotated, 'function FindDTMRotated(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;');
AddFunction(@ps_FindDTMsRotated, 'function FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray) : Boolean;'); AddFunction(@ps_FindDTMsRotated, 'function FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray) : Boolean;');
AddFunction(@ps_addDTM, 'function AddDTM(d: TDTM): Integer;'); AddFunction(@ps_addDTM, 'function AddDTM(d: TDTM): Integer;');
AddFunction(@ps_addpDTM, 'function AddpDTM(d: pDTM): Integer;'); AddFunction(@ps_addpDTM, 'function AddpDTM(d: pDTM): Integer;');
{maths} {maths}
SetCurrSection('Math'); SetCurrSection('Math');
AddFunction(@ceil,'function ceil(e : extended) : integer'); AddFunction(@ceil,'function ceil(e : extended) : integer');
AddFunction(@power,'function pow(base,exponent : extended) : extended'); AddFunction(@power,'function pow(base,exponent : extended) : extended');
AddFunction(@max,'function Max(a, b: Integer): Integer;'); AddFunction(@max,'function Max(a, b: Integer): Integer;');
AddFunction(@min,'function Min(a, b: Integer): Integer;'); AddFunction(@min,'function Min(a, b: Integer): Integer;');
AddFunction(@minE,'function MinE(a, b: extended): Extended;'); AddFunction(@minE,'function MinE(a, b: extended): Extended;');
AddFunction(@IntToBox,'function IntToBox(x1,y1,x2,y2 : integer) : TBox;'); AddFunction(@IntToBox,'function IntToBox(x1,y1,x2,y2 : integer) : TBox;');
AddFunction(@pssqr,'function Sqr(e : extended) : extended;'); AddFunction(@pssqr,'function Sqr(e : extended) : extended;');
AddFunction(@classes.point,'function Point(x,y:integer) : TPoint;'); AddFunction(@classes.point,'function Point(x,y:integer) : TPoint;');
AddFunction(@Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;'); AddFunction(@Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;');
AddFunction(@hypot,'function Hypot(X, Y: Extended): Extended;'); AddFunction(@hypot,'function Hypot(X, Y: Extended): Extended;');
AddFunction(@ps_RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;'); AddFunction(@ps_RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;');
{window} {window}
SetCurrSection('Window'); SetCurrSection('Window');
AddFunction(@Freeze, 'function freeze:boolean;'); AddFunction(@Freeze, 'function freeze:boolean;');
AddFunction(@Unfreeze, 'function unfreeze: boolean;'); AddFunction(@Unfreeze, 'function unfreeze: boolean;');
AddFunction(@GetClientDimensions, 'procedure GetClientDimensions(out w, h:integer);'); AddFunction(@GetClientDimensions, 'procedure GetClientDimensions(out w, h:integer);');
AddFunction(@SetTargetBitmap,'procedure SetTargetBitmap(Bitmap : integer);'); AddFunction(@SetTargetBitmap,'procedure SetTargetBitmap(Bitmap : integer);');
AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient'); AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient');
AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; Size: TPoint);'); AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; Size: TPoint);');
AddFunction(@ActivateClient, 'procedure activateclient;'); AddFunction(@ActivateClient, 'procedure activateclient;');
{files} {files}
SetCurrSection('Files'); SetCurrSection('Files');
AddFunction(@ps_CreateFile, 'function CreateFile(Path: string): Integer;'); AddFunction(@ps_CreateFile, 'function CreateFile(Path: string): Integer;');
AddFunction(@ps_OpenFile, 'function OpenFile(Path: string; Shared: Boolean): Integer;'); AddFunction(@ps_OpenFile, 'function OpenFile(Path: string; Shared: Boolean): Integer;');
AddFunction(@ps_RewriteFile, 'function RewriteFile(Path: string; Shared: Boolean): Integer;'); AddFunction(@ps_RewriteFile, 'function RewriteFile(Path: string; Shared: Boolean): Integer;');
AddFunction(@ps_CloseFile, 'procedure CloseFile(FileNum: Integer);'); AddFunction(@ps_CloseFile, 'procedure CloseFile(FileNum: Integer);');
AddFunction(@ps_EndOfFile, 'function EndOfFile(FileNum: Integer): Boolean;'); AddFunction(@ps_EndOfFile, 'function EndOfFile(FileNum: Integer): Boolean;');
AddFunction(@ps_FileSize, 'function FileSize(FileNum: Integer): LongInt;'); AddFunction(@ps_FileSize, 'function FileSize(FileNum: Integer): LongInt;');
AddFunction(@ps_ReadFileString, 'function ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean;'); AddFunction(@ps_ReadFileString, 'function ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean;');
AddFunction(@ps_WriteFileString, 'function WriteFileString(FileNum: Integer; s: string): Boolean;'); AddFunction(@ps_WriteFileString, 'function WriteFileString(FileNum: Integer; s: string): Boolean;');
AddFunction(@ps_SetFileCharPointer, 'Function SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer;'); AddFunction(@ps_SetFileCharPointer, 'Function SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer;');
AddFunction(@ps_FilePointerPos, 'function FilePointerPos(FileNum: Integer): Integer;'); AddFunction(@ps_FilePointerPos, 'function FilePointerPos(FileNum: Integer): Integer;');
{other} {other}
SetCurrSection('Other'); SetCurrSection('Other');
AddFunction(@SaveScreenshot,'procedure SaveScreenshot(FileName: string);'); AddFunction(@SaveScreenshot,'procedure SaveScreenshot(FileName: string);');
AddFunction(@psWait, 'procedure wait(t: integer);'); AddFunction(@psWait, 'procedure wait(t: integer);');
AddFunction(@psWait, 'procedure Sleep(t: integer);'); AddFunction(@psWait, 'procedure Sleep(t: integer);');
AddFunction(@GetTickCount, 'function GetSystemTime: LongWord;'); AddFunction(@GetTickCount, 'function GetSystemTime: LongWord;');
AddFunction(@GetTickCount, 'function GetTickCount: LongWord;'); AddFunction(@GetTickCount, 'function GetTickCount: LongWord;');
AddFunction(@GetTimeRunning,'function GetTimeRunning: LongWord;'); AddFunction(@GetTimeRunning,'function GetTimeRunning: LongWord;');
AddFunction(@CreateForm,'function CreateForm : TForm;'); AddFunction(@CreateForm,'function CreateForm : TForm;');
AddFunction(@CreateButton,'function CreateButton(Owner : TComponent) : TButton'); AddFunction(@CreateButton,'function CreateButton(Owner : TComponent) : TButton');
AddFunction(@ConvertTime,'procedure ConvertTime(Time : integer; var h,m,s : integer);'); AddFunction(@ConvertTime,'procedure ConvertTime(Time : integer; var h,m,s : integer);');
AddFunction(@HakunaMatata,'procedure HakunaMatata;'); AddFunction(@HakunaMatata,'procedure HakunaMatata;');
AddFunction(@TerminateScript,'procedure TerminateScript;'); AddFunction(@TerminateScript,'procedure TerminateScript;');
AddFunction(@DisplayDebugImgWindow,'procedure DisplayDebugImgWindow(w,h : integer);'); AddFunction(@DisplayDebugImgWindow,'procedure DisplayDebugImgWindow(w,h : integer);');
AddFunction(@DrawBitmapDebugImg,'procedure DrawBitmapDebugImg(bmp : integer);'); AddFunction(@DrawBitmapDebugImg,'procedure DrawBitmapDebugImg(bmp : integer);');
AddFunction(@GetDebugBitmap,'function GetDebugBitmap : integer;'); AddFunction(@GetDebugBitmap,'function GetDebugBitmap : integer;');
AddFunction(@Random,'function Random(Int : integer): integer;'); AddFunction(@Random,'function Random(Int : integer): integer;');
{string} {string}
AddFunction(@Capitalize,'function Capitalize(str : string) : string;'); AddFunction(@Capitalize,'function Capitalize(str : string) : string;');
{web}
AddFunction(@OpenWebPage,'procedure OpenWebPage(url : string);'); {web}
AddFunction(@OpenWebPage,'procedure OpenWebPage(url : string);');
{Color + Color Finders} AddFunction(@ps_GetPage,'function GetPage(url : string): string;');
SetCurrSection('Color');
AddFunction(@GetColor,'function GetColor(x, y: Integer): Integer;');
AddFunction(@FindColor, 'function findcolor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean;'); {Color + Color Finders}
AddFunction(@findcolortoleranceOptimised, 'function findcolortoleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;'); SetCurrSection('Color');
AddFunction(@FindColorTolerance, 'function findcolortolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;'); AddFunction(@GetColor,'function GetColor(x, y: Integer): Integer;');
AddFunction(@FindColors, 'function findcolors(out TPA: TPointArray; color, x1, y1, x2, y2: integer): boolean;'); AddFunction(@FindColor, 'function findcolor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean;');
AddFunction(@SimilarColors,'function SimilarColors(Col1,Col2,Tolerance : integer) : boolean'); AddFunction(@findcolortoleranceOptimised, 'function findcolortoleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;');
AddFunction(@CountColor,'function CountColor(Color, xs, ys, xe, ye: Integer): Integer;'); AddFunction(@FindColorTolerance, 'function findcolortolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;');
AddFunction(@CountColorTolerance,'function CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer;'); AddFunction(@FindColors, 'function findcolors(out TPA: TPointArray; color, x1, y1, x2, y2: integer): boolean;');
AddFunction(@FindColorsToleranceOptimised,'function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;'); AddFunction(@SimilarColors,'function SimilarColors(Col1,Col2,Tolerance : integer) : boolean');
AddFunction(@FindColorsTolerance,'function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;'); AddFunction(@CountColor,'function CountColor(Color, xs, ys, xe, ye: Integer): Integer;');
AddFunction(@FindColorSpiral,'function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;'); AddFunction(@CountColorTolerance,'function CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer;');
AddFunction(@FindColorsSpiralTolerance,'function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;'); AddFunction(@FindColorsToleranceOptimised,'function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;');
AddFunction(@SetColorToleranceSpeed, 'procedure SetColorToleranceSpeed(cts: integer);'); AddFunction(@FindColorsTolerance,'function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;');
AddFunction(@FindColoredArea, 'function FindColoredArea(var x, y : Integer; color, xs, ys, xe, ye, MinArea : Integer): Boolean'); AddFunction(@FindColorSpiral,'function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;');
AddFunction(@FindColoredAreaTolerance, 'function FindColoredAreaTolerance(var x, y : Integer; color, xs, ys, xe, ye, MinArea, Tolerance : Integer): Boolean'); AddFunction(@FindColorsSpiralTolerance,'function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;');
AddFunction(@ColorToHSL, 'procedure ColorToHSL(c: integer; out r,g,b: extended);'); AddFunction(@SetColorToleranceSpeed, 'procedure SetColorToleranceSpeed(cts: integer);');
AddFunction(@FindColoredArea, 'function FindColoredArea(var x, y : Integer; color, xs, ys, xe, ye, MinArea : Integer): Boolean');
{Mouse etc.} AddFunction(@FindColoredAreaTolerance, 'function FindColoredAreaTolerance(var x, y : Integer; color, xs, ys, xe, ye, MinArea, Tolerance : Integer): Boolean');
SetCurrSection('Mouse'); AddFunction(@ColorToHSL, 'procedure ColorToHSL(c: integer; out r,g,b: extended);');
AddFunction(@MoveMouse, 'procedure MoveMouse(x, y: integer);');
AddFunction(@GetMousePos, 'procedure GetMousePos(out x, y: integer);'); {Mouse etc.}
AddFunction(@HoldMouse, 'procedure HoldMouse(x, y: integer; clickType: integer);'); SetCurrSection('Mouse');
AddFunction(@ReleaseMouse, 'procedure ReleaseMouse(x, y: integer; clickType: integer);'); AddFunction(@MoveMouse, 'procedure MoveMouse(x, y: integer);');
AddFunction(@ClickMouse, 'procedure ClickMouse(x, y: integer; clickType: integer);'); AddFunction(@GetMousePos, 'procedure GetMousePos(out x, y: integer);');
AddFunction(@HoldMouse, 'procedure HoldMouse(x, y: integer; clickType: integer);');
AddFunction(@ReleaseMouse, 'procedure ReleaseMouse(x, y: integer; clickType: integer);');
{Keyboard} AddFunction(@ClickMouse, 'procedure ClickMouse(x, y: integer; clickType: integer);');
SetCurrSection('Keyboard');
AddFunction(@KeyDown, 'procedure KeyDown(key: Word);');
AddFunction(@KeyUp, 'procedure KeyUp(key: Word);'); {Keyboard}
AddFunction(@PressKey, 'procedure PressKey(key: Word);'); SetCurrSection('Keyboard');
AddFunction(@SendKeys, 'procedure SendKeys(s: string);'); AddFunction(@KeyDown, 'procedure KeyDown(key: Word);');
AddFunction(@isKeyDown, 'function isKeyDown(key: Word): Boolean;'); AddFunction(@KeyUp, 'procedure KeyUp(key: Word);');
AddFunction(@GetKeyCode, 'function GetKeyCode(Key : char) : byte'); AddFunction(@PressKey, 'procedure PressKey(key: Word);');
AddFunction(@SendKeys, 'procedure SendKeys(s: string);');
{ OCR} AddFunction(@isKeyDown, 'function isKeyDown(key: Word): Boolean;');
SetCurrSection('OCR'); AddFunction(@GetKeyCode, 'function GetKeyCode(Key : char) : byte');
AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;');
{ OCR}
SetCurrSection('OCR');
{Bitmaps} AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;');
SetCurrSection('Bitmaps');
AddFunction(@GetMufasaBitmap,'function GetMufasaBitmap(bmp : integer) : TMufasaBitmap;');
AddFunction(@CreateBitmap,'function CreateBitmap(w,h :integer) : integer;'); {Bitmaps}
AddFunction(@FreeBitmap,'procedure FreeBitmap(Bmp : integer);'); SetCurrSection('Bitmaps');
AddFunction(@SaveBitmap,'procedure SaveBitmap(Bmp : integer; path : string);'); AddFunction(@GetMufasaBitmap,'function GetMufasaBitmap(bmp : integer) : TMufasaBitmap;');
AddFunction(@BitmapFromString,'function BitmapFromString(Width,Height : integer; Data : string): integer;'); AddFunction(@CreateBitmap,'function CreateBitmap(w,h :integer) : integer;');
AddFunction(@LoadBitmap,'function LoadBitmap(Path : string) : integer;'); AddFunction(@FreeBitmap,'procedure FreeBitmap(Bmp : integer);');
AddFunction(@SetBitmapSize,'procedure SetBitmapSize(Bmp,NewW,NewH : integer);'); AddFunction(@SaveBitmap,'procedure SaveBitmap(Bmp : integer; path : string);');
AddFunction(@GetBitmapSize,'procedure GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer);'); AddFunction(@BitmapFromString,'function BitmapFromString(Width,Height : integer; Data : string): integer;');
AddFunction(@StretchBitmapResize,'procedure StretchBitmapResize(Bmp,NewW,NewH : integer);'); AddFunction(@LoadBitmap,'function LoadBitmap(Path : string) : integer;');
AddFunction(@CreateMirroredBitmap,'function CreateMirroredBitmap(Bmp : integer) : integer;'); AddFunction(@SetBitmapSize,'procedure SetBitmapSize(Bmp,NewW,NewH : integer);');
AddFunction(@CreateMirroredBitmapEx,'function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer;'); AddFunction(@GetBitmapSize,'procedure GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer);');
AddFunction(@FastSetPixel,'procedure FastSetPixel(bmp,x,y : integer; Color : TColor);'); AddFunction(@StretchBitmapResize,'procedure StretchBitmapResize(Bmp,NewW,NewH : integer);');
AddFunction(@FastSetPixels,'procedure FastSetPixels(bmp : integer; TPA : TPointArray; Colors : TIntegerArray);'); AddFunction(@CreateMirroredBitmap,'function CreateMirroredBitmap(Bmp : integer) : integer;');
AddFunction(@FastGetPixel,'function FastGetPixel(bmp, x,y : integer) : TColor;'); AddFunction(@CreateMirroredBitmapEx,'function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer;');
AddFunction(@FastGetPixels,'function FastGetPixels(Bmp : integer; TPA : TPointArray) : TIntegerArray;'); AddFunction(@FastSetPixel,'procedure FastSetPixel(bmp,x,y : integer; Color : TColor);');
AddFunction(@FastDrawClear,'procedure FastDrawClear(bmp : integer; Color : TColor)'); AddFunction(@FastSetPixels,'procedure FastSetPixels(bmp : integer; TPA : TPointArray; Colors : TIntegerArray);');
AddFunction(@FastDrawTransparent,'procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer);'); AddFunction(@FastGetPixel,'function FastGetPixel(bmp, x,y : integer) : TColor;');
AddFunction(@SetTransparentColor,'procedure SetTransparentColor(bmp : integer; Color : TColor);'); AddFunction(@FastGetPixels,'function FastGetPixels(Bmp : integer; TPA : TPointArray) : TIntegerArray;');
AddFunction(@GetTransparentColor,'function GetTransparentColor(bmp: integer) : TColor;'); AddFunction(@FastDrawClear,'procedure FastDrawClear(bmp : integer; Color : TColor)');
AddFunction(@FastReplaceColor,'procedure FastReplaceColor(Bmp : integer; OldColor,NewColor : TColor);'); AddFunction(@FastDrawTransparent,'procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer);');
AddFunction(@ps_CopyClientToBitmap, 'procedure CopyClientToBitmap(bmp, xs, ys, xe, ye: Integer);'); AddFunction(@SetTransparentColor,'procedure SetTransparentColor(bmp : integer; Color : TColor);');
AddFunction(@BitmapFromClient,'function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer;'); AddFunction(@GetTransparentColor,'function GetTransparentColor(bmp: integer) : TColor;');
AddFunction(@SetBitmapName, 'procedure SetBitmapName(Bmp : integer; name : string);'); AddFunction(@FastReplaceColor,'procedure FastReplaceColor(Bmp : integer; OldColor,NewColor : TColor);');
AddFunction(@FindBitmap,'function FindBitmap(bitmap: integer; out x, y: Integer): Boolean;'); AddFunction(@ps_CopyClientToBitmap, 'procedure CopyClientToBitmap(bmp, xs, ys, xe, ye: Integer);');
AddFunction(@FindBitmapIn,'function FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean;'); AddFunction(@BitmapFromClient,'function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer;');
AddFunction(@FindBitmapToleranceIn,'function FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean;'); AddFunction(@SetBitmapName, 'procedure SetBitmapName(Bmp : integer; name : string);');
AddFunction(@FindBitmapSpiral,'function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;'); AddFunction(@FindBitmap,'function FindBitmap(bitmap: integer; out x, y: Integer): Boolean;');
AddFunction(@FindBitmapsSpiralTolerance,'function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean;'); AddFunction(@FindBitmapIn,'function FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean;');
AddFunction(@FindBitmapSpiralTolerance,'function FindBitmapSpiralTolerance(bitmap: integer; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean;'); AddFunction(@FindBitmapToleranceIn,'function FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean;');
AddFunction(@RotateBitmap,'function RotateBitmap(bitmap: Integer; angle: Extended): Integer;'); AddFunction(@FindBitmapSpiral,'function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;');
AddFunction(@Desaturate,'function DesaturateBitmap(Bitmap : integer) : integer;'); AddFunction(@FindBitmapsSpiralTolerance,'function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean;');
AddFunction(@InvertBitmap,'procedure InvertBitmap(Bitmap : integer);'); AddFunction(@FindBitmapSpiralTolerance,'function FindBitmapSpiralTolerance(bitmap: integer; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean;');
AddFunction(@CopyBitmap,'function CopyBitmap(Bitmap: integer) : integer)'); AddFunction(@RotateBitmap,'function RotateBitmap(bitmap: Integer; angle: Extended): Integer;');
AddFunction(@GreyScaleBitmap,'function GreyScaleBitmap(bitmap : integer) : integer'); AddFunction(@Desaturate,'function DesaturateBitmap(Bitmap : integer) : integer;');
AddFunction(@BrightnessBitmap,'function BrightnessBitmap(Bitmap,br : integer) : integer;'); AddFunction(@InvertBitmap,'procedure InvertBitmap(Bitmap : integer);');
AddFunction(@ContrastBitmap,'function ContrastBitmap(bitmap : integer; co : extended) : integer;'); AddFunction(@CopyBitmap,'function CopyBitmap(Bitmap: integer) : integer)');
AddFunction(@PosterizeBitmap,'function PosterizeBitmap(Bitmap : integer; po : integer) : integer;'); AddFunction(@GreyScaleBitmap,'function GreyScaleBitmap(bitmap : integer) : integer');
AddFunction(@CreateBitmapMask,'function CreateBitmapMask(Bitmap : integer) : TMask;'); AddFunction(@BrightnessBitmap,'function BrightnessBitmap(Bitmap,br : integer) : integer;');
AddFunction(@FindMaskTolerance,'function FindMaskTolerance(mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;'); AddFunction(@ContrastBitmap,'function ContrastBitmap(bitmap : integer; co : extended) : integer;');
AddFunction(@FindBitmapMaskTolerance,'function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;'); AddFunction(@PosterizeBitmap,'function PosterizeBitmap(Bitmap : integer; po : integer) : integer;');
AddFunction(@FindDeformedBitmapToleranceIn,'function FindDeformedBitmapToleranceIn(bitmap: integer; out x,y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean;'); AddFunction(@CreateBitmapMask,'function CreateBitmapMask(Bitmap : integer) : TMask;');
AddFunction(@DrawTPABitmap,'procedure DrawTPABitmap(bitmap : integer; TPA : TPointArray; Color : integer);'); AddFunction(@FindMaskTolerance,'function FindMaskTolerance(mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;');
AddFunction(@DrawATPABitmap,'procedure DrawATPABitmap(bitmap : integer; ATPA : T2DPointArray);'); AddFunction(@FindBitmapMaskTolerance,'function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;');
AddFunction(@DrawATPABitmapEx,'procedure DrawATPABitmapEx(bitmap : integer; ATPA : T2DPointArray; Colors : TIntegerArray);'); AddFunction(@FindDeformedBitmapToleranceIn,'function FindDeformedBitmapToleranceIn(bitmap: integer; out x,y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean;');
AddFunction(@DrawTPABitmap,'procedure DrawTPABitmap(bitmap : integer; TPA : TPointArray; Color : integer);');
{tpa} AddFunction(@DrawATPABitmap,'procedure DrawATPABitmap(bitmap : integer; ATPA : T2DPointArray);');
SetCurrSection('TPA'); AddFunction(@DrawATPABitmapEx,'procedure DrawATPABitmapEx(bitmap : integer; ATPA : T2DPointArray; Colors : TIntegerArray);');
AddFunction(@SplitTPAEx,'function SplitTPAEx(arr: TPointArray; w, h: Integer): T2DPointArray;');
{tpa}
SetCurrSection('TPA');
AddFunction(@SplitTPAEx,'function SplitTPAEx(arr: TPointArray; w, h: Integer): T2DPointArray;');

View File

@ -1,13 +1,27 @@
unit internets; unit internets;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
interface interface
uses uses
Classes, SysUtils; Classes, SysUtils;
implementation function GetPage(URL: String): String;
end. implementation
uses
httpsend;
function GetPage(URL: String): String;
var
s: TStringList;
begin
s:=TStringList.Create;
HttpGetText(URL, s);
result := String(s.GetText);
s.Free;
end;
end.

View File

@ -112,6 +112,7 @@ uses
uPSR_extctrls, //Runtime-libs uPSR_extctrls, //Runtime-libs
Graphics, //For Graphics types Graphics, //For Graphics types
math, //Maths! math, //Maths!
internets, // internets
strutils, strutils,
input, input,
tpa, //Tpa stuff tpa, //Tpa stuff
@ -225,6 +226,7 @@ end;
{$I PSInc/Wrappers/keyboard.inc} {$I PSInc/Wrappers/keyboard.inc}
{$I PSInc/Wrappers/dtm.inc} {$I PSInc/Wrappers/dtm.inc}
{$I PSInc/Wrappers/ocr.inc} {$I PSInc/Wrappers/ocr.inc}
{$I PSInc/Wrappers/internets.inc}
procedure TMMLPSThread.OnProcessDirective(Sender: TPSPreProcessor; procedure TMMLPSThread.OnProcessDirective(Sender: TPSPreProcessor;
Parser: TPSPascalPreProcessorParser; const Active: Boolean; Parser: TPSPascalPreProcessorParser; const Active: Boolean;

182
Units/MMLAddon/updater.pas Normal file
View File

@ -0,0 +1,182 @@
unit updater;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, httpsend,blcksock;
type
{ TMMLUpdateThread = class(TThread)
procedure Execute; override;
constructor Create(CreateSuspended: Boolean);
destructor Destroy; override;
end; }
TMemory = pointer;
TMMLFileDownloader = class(TObject)
private
FFileURL: String;
FReplacementFile: String;
FTotal: Integer;
HTTPSend: THTTPSend;
FFileSize: Integer;
FDownloaded: Boolean;
FOnChange: TProcedure;
public
constructor Create;
destructor Destroy; override;
function DownloadAndSave: Boolean;
function Replace: Boolean;
property FileURL: String read FFileURL write FFileURL;
property ReplacementFile: String read FReplacementFile write FReplacementFile;
property Downloaded: Boolean read FDownloaded;
property OnChange: TProcedure read FOnChange write FOnChange;
function GetPercentage: Integer;
private
procedure TryToGetFileSize;
procedure OnMonitor(Sender: TObject; Writing: Boolean;
const Buffer: TMemory; Len: Integer);
procedure OnStatus(Sender: TObject; Reason: THookSocketReason;
const Value: String);
end;
implementation
procedure TMMLFileDownloader.TryToGetFileSize;
var
i,p:integer;
begin
if assigned(HTTPSend.Headers) then
for i := 0 to HTTPSend.headers.count - 1 do
begin
p := Pos('Content-Length: ', HTTPSend.headers.strings[i]);
if p <> 0 then
FFileSize := StrToInt(Copy(HTTPSend.headers.strings[i],
p+length('Content-Length: '),length( HTTPSend.headers.strings[i]) - p) );
end;
end;
procedure TMMLFileDownloader.OnStatus(Sender: TObject; Reason: THookSocketReason;
const Value: String);
begin
if FFileSize = 0 then
TryToGetFileSize;
if Assigned(FOnChange) then
FOnChange();
end;
procedure TMMLFileDownloader.OnMonitor(Sender: TObject; Writing: Boolean;
const Buffer: TMemory; Len: Integer);
var
i,p:integer;
begin
if writing then exit;
Inc(FTotal, len);
if FFileSize = 0 then
TryToGetFileSize;
if Assigned(FOnChange) then
FOnChange();
// writeln('Percent done: ' + IntToStr(GetPercentage));
end;
function TMMLFileDownloader.GetPercentage: Integer;
begin
if FFileSize <> 0 then
Exit( Round( (FTotal / FFileSize) * 100.0) )
else
Exit(-1);
end;
function TMMLFileDownloader.DownloadAndSave: Boolean;
var
response: TStream;
i:integer;
f: TFileStream;
begin
HTTPSend := THTTPSend.Create;
HTTPSend.Sock.OnMonitor:=@Self.OnMonitor;
HTTPSend.Sock.OnStatus:=@Self.OnStatus;
if FReplacementFile = '' then
raise Exception.Create('ReplacementFile not set');
if FileURL = '' then
raise Exception.Create('FileURL not set');
Response := TFileStream.Create(FReplacementFile + '_', fmCreate);
try
Result := HTTPSend.HTTPMethod('GET', FileURL);
if Result then
begin
Response.Seek(0, soFromBeginning);
Response.CopyFrom(HTTPSend.Document, 0);
end;
FDownloaded := True;
finally
HTTPSend.Free;
Response.Free;
end;
end;
function TMMLFileDownloader.Replace: Boolean;
begin
if not Downloaded then
raise Exception.Create('Nothing downloaded');
if FReplacementFile = '' then
raise Exception.Create('ReplacementFile not set');
if not FileExists(FReplacementFile) then
raise Exception.Create('ReplacementFile not found');
if not FileExists(FReplacementFile+ '_') then
raise Exception.Create('ReplacementFile + _ not found');
RenameFile(FReplacementFile, FReplacementFile+'_old_');
RenameFile(FReplacementFile+'_', FReplacementFile);
DeleteFile(FReplacementFile+'_old_');
end;
constructor TMMLFileDownloader.Create;
begin
inherited Create;
FTotal := 0;
FFileSize := 0;
FDownloaded := False;
FReplacementFile:='';
FFileURL := '';
end;
destructor TMMLFileDownloader.Destroy;
begin
inherited;
end;
end.

View File

@ -1797,7 +1797,7 @@ var
// Bitwise // Bitwise
// TODO: Change to record. One that indicates if there is a match at bit i // TODO: Change to record. One that indicates if there is a match at bit i
// and one that indicates it has already been matched at bit i... // and one that indicates it has already been tested at bit i...
b: Array of Array of Integer; b: Array of Array of Integer;
// bounds // bounds

View File

@ -330,7 +330,7 @@ begin
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
Self.XWindowImage := XGetImage(Self.XDisplay, Self.curWindow, xs, ys, width, height, AllPlanes, ZPixmap); Self.XWindowImage := XGetImage(Self.XDisplay, Self.curWindow, xs, ys, width, height, AllPlanes, ZPixmap);
if QWord(Self.XWindowImage) = 0 then if Self.XWindowImage = nil then
begin begin
Writeln('ReturnData: XGetImage Error. Dumping data now:'); Writeln('ReturnData: XGetImage Error. Dumping data now:');
Writeln('xs, ys, width, height: ' + inttostr(xs) + ', ' + inttostr(ys) + Writeln('xs, ys, width, height: ' + inttostr(xs) + ', ' + inttostr(ys) +
@ -377,7 +377,7 @@ begin
if not Self.XImageFreed then if not Self.XImageFreed then
begin begin
Self.XImageFreed:=True; Self.XImageFreed:=True;
if(QWord(Self.XWindowImage) <> 0) then // 0, nil? if(Self.XWindowImage <> nil) then
begin begin
XDestroyImage(Self.XWindowImage); XDestroyImage(Self.XWindowImage);
end; end;