SRL Archive - Revisions / Releases

Simba 0.99-rc6 (Final...)


Wizzup?

2012-06-01 12:52:34

Good day everyone,

Simba 0.99-rc6. Simba 0.99-rc5 with some plugin fixes and some other bug fixes. (All the SMART stuff should work now)

If no issues arise this will be 0.99. If I get statically linking with libffi to work (so you won't need a dll I'll call for some additional testing and make that Simba 0.99)

Statically linked libffi in Simba: http://nala.villavu.com/downloads/master/2660cd951f0ebdebc969fadfa052e2d1ff482854/ (Does not require libffi.dll!)

Download Installer: http://nala.villavu.com/downloads/master/85c4aeb59aee1f4e3686e8436c906763c703ef4b/SimbaInstaller.i386-win32.exe

All downloads: http://nala.villavu.com/downloads/master/85c4aeb59aee1f4e3686e8436c906763c703ef4b/

Go forth and test. :)

To use Lape plugin support you need to download http://wizzup.org/libffi-6.dll to the Simba folder and rename it to libffi.dll. Next version will be probably have a statically linked version.

Changes since 0.98:

  • Installer ships with PDF and HTML documentation. (See the folder Documentation/ in your Simba folder)
  • New Settings Form. (Tools -> Settings)
  • Plugin backend rework; support for multiple ABIs.
  • Experimental support for plugins in lape.
  • Latest and greatest Lape. You can now run most SRL scripts on Linux and Windows. You just need to use the EIOS-capable smart. Any SMART type should work, if you include libffi as well. (Linux doesn't need to, it is installed by default)
  • Simba is portable by default. If a system wide install is required by some users, this can be arranged.
  • The non-portable version of Simba now respects user directories on both Windows and Unix (with XDG support).
  • More hash/cipher functions.
  • SQLite support. (If the sqlite3 library is available)
  • Major settings backend rework.
  • Added Version to Simba's UserAgent.
  • Support for JPG/PNG in TMufasaBitmap.SaveToFile (and in SaveBitmap)
  • Formatter extension to nicely format your scripts.
  • Examples/ directory.
  • SendKeys now also has keymodwait
  • onScriptOpen and onScriptStart hooks for extensions.
  • Crash logger. When something goes wrong, Simba will attempt to write a log to a file. You can then choose to keep running Simba or terminate it. (I feel this is the most experimental feature)
  • Initial support for loading a bitmap from clipboard in the bitmap convertor.

Bugs (from bugtracker) fixed:

  • [0000404]: Ctrl + Space Function List,, Make it Resizeable
  • [0000409]: Warning @ no memory manager set
  • [0000406]: BitmapExists()
  • [0000408]: DTM is inconsistent (Simba 990+)
  • [0000400]: Ini files aren't secure
  • [0000127]: SQLite for Simba?
  • [0000403]: Path Constants
  • [0000402]: ScriptFile
  • [0000382]: Suggestion: Add X button to function list to quickly clear searches.
  • [0000380]: FindColoredAreaTolerance
  • [0000379]: Error
  • [0000378]: glitchy
  • [0000375]: MSI: couldn't find MSI
  • [0000373]: CPU management
  • [0000370]: Control + Space broken.
  • [0000360]: Script formatter?
  • [0000314]: Settings.xml should be written more often
  • [0000293]: Add a Report Window to Simba
  • [0000292]: Simba needs a portable installer
  • [0000266]: Missing functions ( I dont know if syntax is changed from scar.)
  • [0000263]: Change font in settings
  • [0000255]: Trouble with INI functions
  • [0000247]: out of ranges
  • [0000224]: Change the way file specific conditionals are defined.
  • [0000221]: Change the way non-string settings are loaded
  • [0000040]: The Setting Form is Ugly
  • [0000369]: TFontStyle, fsUnderline = fsStrikeout, vice versa.
  • [0000363]: Ctrl+A in Debug Box = Ctrl+A on Script Typing Spot
  • [0000280]: TMDTM.AddPoint now returns the points index.
  • [0000283]: Length(s); and GetArrayLength(var arr);
  • [0000251]: Custom XML files
  • [0000294]: %HOMEDRIVE%\Simba\
  • [0000305]: Rearranged the Class registration (PascalScript) to fix a few problems.
  • [0000366] Sum64IntArr
  • [0000338]: Can only load bitmap from file (no copy/paste)
  • [0000415]: Mouse support on Linux fixed.

Git shortlog:


Bart de Boer (1):
Fix FilterPointsPie.

Benjamin Land (5):
Modified EIOS implementation to be fully functional for both PS, lape, and anything else. These modifications are fully backwards compatible and don't affect anything currently in use, so are safe to merge.
Added middle button functionality to EIOS and also fixed the not-clicking bug.
Dgby714 fubar'd the plugin loader; here's the fix.
Backbone of ffi bridge for lape. Missing two important things: 1) does not parse actual function arguments 2) does not clean up the allocated memory
Revert "Backbone of ffi bridge for lape. Missing two important things: 1) does"

Benjamin Lee (2):
Clear Search button
Clear Search button - Aligned button

Daniel (1):
Added Examples to Simba

Jack Shannon (2):
Populated settings form, added loading and saving
Access violation fix.

John Peel (49):
Simba: Use proper directories.
Settings file now defaults to DocPath incase of permission problems.
MMLAddon: crypto.inc Cleanup
MMLAddon: crypto.inc cleanup 2, Free Digest
Added DCP Ciphers, Moved DCP Hashes. Added RC2 thru RC6 to Simba.
Simba: Ctrl+A fix for memo.
Forgot a file in ctrl+A fix.
Extenstion: srl.sex update, fixed plugin updater
Simba: Use XDG_* for DocPath.
Added moved units (DCP) to Makefile.
Simba: Use DS instead of static '/'. Also added a missed semicolon.
Simba: Removed dcpbase64 from a file that didn't need it.
Simba: DocPath fix. (Windows, use GetUserDir instead of $HOME)
PascalScript: Made the first parameter of GetArrayLength a const.
PascalScript: Fixed TFontStyle enum. (Rearranged)
MML: FindFile fix.
MML: Fixed Header, Picky about consts...
Simba: Moved data files, added Portable Define.
Simba: Default to relative paths in Portable.
Cleanup and added USE_CPASCAL define. Also fixed freeing Lape.
Simba: Small changes to the form.
Lape: Added a temp fix for our lack of a proper write procedure.
Simba: Fixes to Clipboard Loading
Extenstion: Script Formatter
Simba: TPathSetting - Fixes paths when CurrentDir != AppPath
Simba: Includes.Path -> TPathSetting, Forgot...
MML: IS_INCLUDE fix.
MML: Fix RequireFile debug line.
MML: FindFile now results a Boolean.
Simba: Set TPSScript.MainFileName, Fixes FindFile.
Simba: Function List now will obey defines.
Simba: ErrorLog path fix
Simba: Dg is a dumbass, Wrong function...
Fixes Lape paths, also instead of passing paths from Simba, Read paths from Settings.
Dynamicly load SQLite, try downloading library if missing.
Forgot to remove a few unneeded variables.
No downloading the library. WriteLn where the user can get it.
Simba: Make ScriptPath Absolute, Fix USE_EXT define.
Extenstions: Fix ScriptFile =)
Plugins: Write a warning when plugins don't set a mempry manager.
Simba: Changed the plugin memmgr notification to a Debugln.
Simba: TPathSetting fix Added a check if its a file before appending the path delimeter. Added a TPathSetting.GetDefValue, as TStringSetting conflicted by using FValue instead of Value. - This also fixes our Extention bug
Simba: Renamed TPathSetting, Created a new TPathSetting. - Renamed TPathSetting to TFileSetting and removed the file check. - Added a TPathSetting that inherits TFileSetting and includes the path delimeter.
Mailmap File
MML: TMDTM.AddPoint now returns the points index. Fix for bug 0000280
Added Sum64IntArr Suggested in bug 0000366.
MML: Using Xlib instead of Xtest for Mouse functions. Fixes Bug 0000415.
MML: Changed a few TXEvent to TXButtonEvent, Removed xtest unit.
MML: Rearranged the Class registration (PascalScript) to fix a few problems. Fixes Bug 0000305

Kyle Wollaston (21):
Added SQLite3 methods.
Changed paths in Install/windows/Setup.iss from absolute to relative as well as adding sqlite3.dll (tested, works fine).
Changed sqlite_open to not throw an exception.
Fixed auto-freeing of SQLite database handles.
Added column names in callback to first row of result.
Added USE_SQLITE define for optional support of the SQLite library.
Added additional SQLite constants.
Overloaded the (Lape) sqlite_query and sqlite_open exported methods.
Added SQLite documentation.
Fixed build error.
Minor SQLite doc changes.
Added sqlite_queryResult and updated documentation to reflect this addition.
Forgot to update the example for sqlite_queryResult in the documentation.
Added BitmapExists function. http://bugs.villavu.com/view.php?id=406
Added DTMExists.
Call file open/write hooks for INI functions, doesn't work atm (?)
Added GetProcessID function.
Added GetProcesses and SetTarget functions to Lape.
Fix multiple requests for THTTPClient.
Forgot to clear document in GetHTTPPage.
Made autocomplete form resizable..

Merlijn Wajer (139):
Simba/SimpleSettings: Initial work.
Simba/SimpleSettings: Add .lrs file.
Simba version -> 0.99.
OCRBench updates.
Some changes to OCR.
Went through the UpText code, added comments.
Comment BenLand100's code.
New Upchars!
Fix casing in updater URL.
Add Simba/<Version> to User Agent.
Bump installer version to 0.99.
Fix FindDeformedBitmapToleranceIn.
Fix CTS 2 bug.
CTS 2 Optimisation.
Update copyright.
Another CTS 2 fix.
Merge font comments.
Update lape head.
Add LAZARUS_PATH to Makefile args.
Fix CTS 2, CTS 3 and RGB<->XYZ.
Remove debug.
Update LAPE head.
New 'y' Upchar by TRiLeZ.
PORTABLE -> NOTPORTABLE.
Make updateform compliant with settings rework.
Bug 346: RO mode doesn't work on unsaved scripts.
Initial crash logger & Simba.exe info update.
Bitmapform: Add load from clipboard.
Small fixes to clipboard loading.
Added a minimal TODO.
Support JPG/PNG in TMufasaBitmap.SaveToFile.
Remove double defines.
Makefile: Remove (deprecated) rutis code.
Make: Comment some of the plugin copy procedures.
Make: Enable Script folder creation.
Credits for formatter extension.
Merge new settings work.
Fixed a few settings bugs.
Fix alternative config support.
Update lape HEAD.
Additional settings changes. - May not compile.
Fixed compilation.
Implement onChange event.
Exemplary onChange.
Small todo.
Remove useless line.
Settings fix.
Simple settings form.
Settings fix.
Simba Settings: Ensure the form is visible.
Add minimal list of settings.
Changes to new Simba Settings form.
Add Interpreter support for settings form.
Move settings form back to a normal position.
Updater is now the default tab.
Fix saving for functionlist/tray.
Clean up simbaunit.pas a bit.
Doc version bump + small fix.
Support for onDefault, more clean up to settings.
Move default settings to newsimbasettings.
Rename settings options.
Initial attempt at onScriptOpen hook.
Finish onScriptOpen and fix onScriptStart hook.
Additional doc changes for hooks.
Fix breakage due to new hooks.
Minor documentation changes.
Decrease verbosity for simbaunit.
Ready OCRBench for autobuild.
Try to fix OCRBench compilation on Windows.
Documentation underline fix.
Update copyright.
Merge OCR-Fixes branch.
Make OCR record packed.
Documentation for Uptext filter setter functions.
Finish the last bits of the initial settings form.
Change the CTS 3 algorithm slightly.
Add Path setting.
Linux: Allow mouse movement outside the client.
Fix GetColors on Linux.
GetColors fix for all platforms. ;-)
Remove deprecated MSI.sex.
SendKeys now also has keymodwait.
Update SendKeys documentation.
Few documentation fixes.
First try at adding documentation to the installer.
Update Linux TODO.
Update Setup.iss.
Update installer.
More installer changes.
More installer changes...
Makefile to also build PDF.
Split debug symbols to seperate file.
Let's test this.
There we go.
Fix case sensitivity issue.
Remove binary file from git.
Revert Setup.iss path changes.
Fix DTM invalid issue. Very interesting issue...
Update lape head.
BAZINGA. Fixed.
A few comments to dcpbase64.
libMML compilation fixes.
Update lape head!
Update lape head
Initial FPC libffi unit.
Closure API in ffi.pas.
Cleanups to ffi.pas
ffi.pas now has a license.
Change `Gonna' to ``Going to''.
ffi.pas changes and deprecation.
Update lape head.
Updater URL for system wide install.
Added OnAttach and OnDetach for plugins.
Start with plugins documentation.
Some more work on plugins documentation.
Documentation updates.
New plugin code. ABI 0, 1 and 2 are supported.
Add cdCdecl for default to mmlpsthread.
Update lape head.
Lape functions -> cdecl.
Update lape head.
Lape: Add plugin loading with libffi.
Lape: Free TList Wrappers as well.
Theoretically prevent double plugin bug.
Update Makefile for lpffi.
Fix Makefile.
Update plugin example.
Fix several hangs/bugs on exit.
Actually break instead of just print.
More fixes for when exiting=true.
Comment on a bug that should be fixed.
Add a directory seperator to all default paths.
Automatically focus search when 'X' is clicked.
Merge lape fixes for ffi.
Raise exception for lape plugins with no libffi.
Define Lape_CDECL.
Make lape-write functions lape_extdecl.
-dDynamicFFI.
FilterPointsPie fix by Bart de Boer.

Niels A.D. (12):
DTM Editor: Mouse hovering shows color now more clear (black letters with yellow glow).
Update lape.
Changed fontloading, so it works in Lape too. More exports for Lape.
One more exported function to Lape. Also minor changes to the dtm editor.
Lape update + import bugfix so Lape can compile again.
Fixed export.
GetColors fix. Lape update.
Lape update and file finding fix.
Lape update and fixed defines.
Added stop functionality for Lape scripts.
Catch code completion exceptions.
Lape ExposeGlobals (for CallProc).

Trenton Smith (3):
TPAFromEllipse/TPAFromCircle/SortATPAFromMidPoint
Color Conversions added for CIELab
FillEllipse, SortTPAByX/Y, FindTPARows, FindTPAColumns



Dgby714

2012-06-01 12:54:23

=) Love the fixed names in shortlog

Brandon

2012-06-01 13:28:55

Yay!! :d

Yago

2012-06-01 18:52:30

I tried this version and somehow my SPS magically works. And oddly in rc-5 I was having trouble running normal scripts and finding colors… This version is working great for me so far.

Edit: At least SPS was working for a short while.

masterBB

2012-06-01 18:57:32

If I just add or fix one thing every simba release, I will stay the first on the log. People might think I actually do something ;)

illuminatiswag

2012-06-01 23:32:07

From: masterBB
If I just add or fix one thing every simba release, I will stay the first on the log. People might think I actually do something ;)


LOL Nice one :D and also on topic thank you wizzup for a nice release once again will try ASAP

Jakkle

2012-06-04 22:36:33

Nice, will try this out straight away :)

Gala

2012-06-05 04:56:48

Downloading, will let you know how it goes.

YoHoJo

2012-06-05 22:10:21

Error logs for everyone!

Program exception! 
Stacktrace:

Exception class: EListError
Message: List index (173) out of bounds
$0043C95F
Simba Version: 990

Program exception! 
Stacktrace:

Exception class: EInvalidOperation
Message: [TCustomForm.SetFocus] SimbaForm:TSimbaForm Can not focus
$00441465
$00440FF0
Simba Version: 990

Program exception! 
Stacktrace:

Exception class: EListError
Message: List index (173) out of bounds
$0043C95F
Simba Version: 990

Program exception! 
Stacktrace:

Exception class: EListError
Message: List index (173) out of bounds
$0043C95F
Simba Version: 990

Program exception! 
Stacktrace:

Exception class: EAccessViolation
Message: Access violation
$77A1E41B
$77A1E023
$77A4ABE9
$77A4AB82
$77A31261
$75B52312
$759EAFF6
$759EAFAC
$759EADBE
$759EAC92
$759EABB4
Simba Version: 990
Program exception! 
Stacktrace:

Exception class: EAccessViolation
Message: Access violation
$77A1E41B
$77A1E023
$77A4ABE9
$77A4AB82
$77A31261
$75B52312
$759EAFF6
$759EAFAC
$759EADBE
$759EAC92
$759EABB4
Simba Version: 990
Program exception! 
Stacktrace:

Exception class: EInvalidOperation
Message: [TCustomForm.SetFocus] SimbaForm:TSimbaForm Can not focus
$00441465
$00440FF0
Simba Version: 990

Yago

2012-06-06 21:11:23

I guess i'll post some:

Program exception! 
Stacktrace:

Exception class: EFOpenError
Message: Unable to open file "C:\Simba\Scripts\TheCuttingEdge-Current.simba"
$00439CD6
$0061AA05
$0061B489
$0042FD8E
$0042FB9C
$0042AE25
$005062C8
$00443402
$004F601D
$00526011
$005246A0
$004F53A0
$004F5E05
$0040C3CA
$004F42E8
$004EA602
$004EB889
Simba Version: 990

Happens when I tried to save/open a script.

Get this message upon startup:


putonajonny

2012-06-13 10:53:44

Mine opens, but on trying to enable SRL I get this:
Error in Simba extension (SRL/SPS/MSI/Plugins Updater): Out of Proc Range
:(

Jakkle

2012-06-13 22:46:37

I got a couple of error messages.
Got this one fist.
Program exception! 
Stacktrace:

Exception class: EAccessViolation
Message: Access violation
$0041D8BB
$0041D9AD
$00565021
$00564E8D
$755BC4E7
$755D5855
$755D59F3
$755D5BE3
$755BC4E7
$755BC5E7
$755B5294
$755D4F6C
$755D535A
$755CEA2B
$74DE9DCC
$74DE9F24
$74DCA1F7
Simba Version: 990
Then this one as soon I started simba again.
Program exception! 
Stacktrace:

Exception class: EListError
Message: List index (173) out of bounds
$0043C95F
Simba Version: 990

SlyAssassin

2012-06-13 22:52:21

The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

hoshimoshi

2012-06-14 13:41:13

How do you check if you have the latest? Besides clicking the "update" If I read the log it says several things o.o.

"simba 0.98 has been released, simba .84 is the latest, simba .99 has been release try it out!"

It's confusing because I would think .99 is the latest? none the less I have simba set up already maybe I am up to date.

Also I went on Benlands post and d.l the new 7.1 smart but my smart still reads 6.9. I'm assuming I extracted everything correctly into the plugin folder because My smart doesn't have a console anymore.

Gu3st...

2012-06-14 13:49:36

From: hoshimoshi
How do you check if you have the latest? Besides clicking the "update" If I read the log it says several things o.o.

"simba 0.98 has been released, simba .84 is the latest, simba .99 has been release try it out!"

It's confusing because I would think .99 is the latest? none the less I have simba set up already maybe I am up to date.

Also I went on Benlands post and d.l the new 7.1 smart but my smart still reads 6.9. I'm assuming I extracted everything correctly into the plugin folder because My smart doesn't have a console anymore.
Help -> About

If it says "Revision 990" then you're at 0.99

Brandon

2012-06-14 13:53:46

From: hoshimoshi
How do you check if you have the latest? Besides clicking the "update" If I read the log it says several things o.o.

"simba 0.98 has been released, simba .84 is the latest, simba .99 has been release try it out!"

It's confusing because I would think .99 is the latest? none the less I have simba set up already maybe I am up to date.

Also I went on Benlands post and d.l the new 7.1 smart but my smart still reads 6.9. I'm assuming I extracted everything correctly into the plugin folder because My smart doesn't have a console anymore.


Rename delete libsmart.dll and leave the libsmart32.dll in there.

Wizzup?

2012-06-16 16:40:14

Latest Simba supports TMufasaBitmap from a memory pointer. You can use this to draw to the SMART debug.

http://nala.villavu.com/downloads/master/090e6a20914b4bcfd532d37886ab93bc9797f564/

Lape showing writing directly to memory allocated in the script: https://gist.github.com/2942259


PascalScript, using a bitmap to write to the data of another bitmap, replace bmp2.fdata with the smart pointer: https://gist.github.com/2941581

http://docs.villavu.com/simba/scriptref/bitmaps.html#setpersistentmemorybitmap

—–

Yago, the EFOpenError looks weird. How exactly can I reproduce this?
Jakkle, the EListError is very old and I think it's a FPC issue.
putonajonny, all the extensions compile fine for me?

E:

YoHoJo, do you know _when_ you got the can not focus errors?

Yago

2012-06-16 16:50:19

From: Wizzup?
Latest Simba supports TMufasaBitmap from a memory pointer. You can use this to draw to the SMART debug.

http://nala.villavu.com/downloads/master/090e6a20914b4bcfd532d37886ab93bc9797f564/

Lape showing writing directly to memory allocated in the script: https://gist.github.com/2942259


PascalScript, using a bitmap to write to the data of another bitmap, replace bmp2.fdata with the smart pointer: https://gist.github.com/2941581

http://docs.villavu.com/simba/scriptref/bitmaps.html#setpersistentmemorybitmap

—–

Yago, the EFOpenError looks weird. How exactly can I reproduce this?
Jakkle, the EListError is very old and I think it's a FPC issue.
putonajonny, all the extensions compile fine for me?


I only experienced it once, so it was probably Windows being messed up. However, when I double click on a script to open SIMBA instead of using the SIMBA shortcut, I get weird errors. Im running 984 now though because there was a point where I couldn't run any scripts.

Wizzup?

2012-06-16 17:00:29

From: Yago
I only experienced it once, so it was probably Windows being messed up. However, when I double click on a script to open SIMBA instead of using the SIMBA shortcut, I get weird errors. Im running 984 now though because there was a point where I couldn't run any scripts.


Hm… I think Dgby714 had taken care of all those errors. I'll have to install windows and try it.

E: Did you do a clean reinstall or install over the current Simba?

Yago

2012-06-16 17:46:12

From: Wizzup?
Hm… I think Dgby714 had taken care of all those errors. I'll have to install windows and try it.

E: Did you do a clean reinstall or install over the current Simba?


Reinstall. And I can't double-click open a script in 984 either.

Wizzup?

2012-06-16 18:50:46

From: Yago
Reinstall. And I can't double-click open a script in 984 either.


Double-click open a script… What is the exact error? What you posted?

Yago

2012-06-18 11:30:49

Its not an error, but it doesnt let my scripts compile…


The image is from 984…

Forgive me for the large image

And at times, it doesn't load my extensions..,

Edit: I also tried running the non-linkedversion on Ubuntu, and SIMBA would open, but grey screen. I would only get the Sqlite not available message, Warning keybind failed message, and Extensions count is 0 message… then a grey window opens and SIMBA is not responsive.

Brandon

2012-06-18 12:33:24

Only problem I have is bitmaps from pointers:


Procedure SetupDebug;
begin
GlobalBMP:= TMufasaBitmap.Create;
GlobalBMP.SetPersistentMemory(SmartDebugArray, 765, 503);
AddOnTerminate('FreeDebug'); //Resets memory and free's the TM.
end;

Procedure DrawBox(Area: TBox);
begin
GlobalBMP.DrawTPA(TPAFromBox(Area), 16777215);
end;

Which is supposed to draw a white box but instead it will close smart, terminate your script and then simba will crash sometimes.

Now if I use FastSetPixels, it works just fine. Difference is that for FastSetPixels, I have to use a for-loop to create an array of colours equal to the size of the TPA. Not sure if this was meant to be.

Also something like: DrawBitmap(SomeBMP, GlobalBMP.ToTBitmap.Canvas, W, H); will not work.


EDIT: Sorry about the first example it's bad. If I put 0, 0 as the start co-ords it will crash so badly. Thus the minimum point for drawing on Smart MUST!! be 0, 1 and the Max MUST! be W - 1, H - 1. Anything else will crash it.

I'll go try the bitmaps again and let you know how it works.

EDIT2: I cannot figure out how to draw a bitmap on Smart other than turning it into an array of colours/Integers and then drawing each colour on.

Take a look please.. I got as far as porting Smart_DrawBoxes which I first drew a filled box then a smaller inside it for clearing (probably in-efficient). For bitmaps and draw line I cannot figure it out without doing it manually as TCanvas doesn't work. Also I wasn't sure if I should SetPersistent and Reset in every function as if it's global, that would create shared pointers if a scripter decides to use FData as well. It shouldn't be a problem though (I think).

This is what I have so far:


{*
Paint Smart
===========

The Paint Smart include contains functions that will paint graphics on to the
SMART screen. Used to make scripts look nicer and sometimes to display
progress reports. Also used as a useful debugging tool.

*}

var
SMART_Canvas: TMufasaBitmap;
SMART_DebugSetup: Boolean;

{*
Authors: Coh3n, Brandon.

Declares everything needed for setting up SmartDebug.
There is no need to call this in scripts.
*}
procedure SMART_SetupDebug;
begin
SmartSetDebug(True);
SMART_Canvas := TMufasaBitmap.Create;
SMART_Canvas.SetPersistentMemory(SmartDebugArray, 765, 503);
SMART_DebugSetup := true;
AddOnTerminate('SMART_FreeDebug');
end;

{*
Author: Brandon.

Used to determine an out of bounds Y value.
If a Y value is 0 or less, it is out of bounds and will crash smart.
This function validates and corrects such behaviour.
*}
Procedure InvalidArea(var Y: Integer);
begin
if (Y < 1) then
Y:= 1;
end;

{*
Author: Brandon.

Creates an array of specific colours for use with FastSetPixels.
*}
Function ColorsFromTPA(TPA: TPointArray; Color: Integer): TIntegerArray;
var
I, L: Integer;
begin
SetLength(Result, Length(TPA));
L:= High(TPA);
For I:= 0 To L Do
Result[I]:= Color;
end;

{*
Authors: Coh3n, Brandon.

Clears an Area of the canvas Specified by the box.
*}
procedure SMART_ClearCanvasArea(Area: TBox);
{$IFDEF SMART}
begin
if (not SMART_DebugSetup) then
SMART_SetupDebug;

InvalidArea(Area.Y1);
InvalidArea(Area.Y2);

SMART_Canvas.Rectangle(Area, 0);

{$ELSE}
begin
{$ENDIF}
end;

{*
Author: Coh3n, Brandon.

Clears the entire Smart Canvas.
*}
procedure SMART_ClearCanvas;
var
w, h: integer;
begin
GetClientDimensions(w, h);
SMART_ClearCanvasArea(IntToBox(0, 1, W - 1, H - 1));
end;

{*
Author: Mormanman.
Clears the MainScreen of Smart.
*}
procedure SMART_ClearMS;
begin
SMART_ClearCanvasArea(MSBox);
end;

{*
Authors: Sir R. Magician, Brandon.

Draws a TPA with a specified Colour onto Smart's Canvas.
Clears the Canvas first if Clear is set to true.
*}
procedure SMART_DrawDotsEx(Clear: boolean; Pixels: TPointArray; Color: TColor);
{$IFDEF SMART}
var
I, L : integer;
begin
if (not SMART_DebugSetup) then
SMART_SetupDebug;

if Clear then SMART_ClearCanvas;

L:= High(Pixels);
For I:= 0 To L Do
InvalidArea(Pixels[I].Y);

SMART_Canvas.DrawTPA(Pixels, Color);

{$ELSE}
begin
{$ENDIF}
end;

{*
Authors: Sir R. Magician, mormanman, Brandon.

Draws a 2-Dimensional Array of Pixels on Smart.
Clears the Canvas first if Set to True.
*}
procedure SMART_DrawDotsMulti(Clear: boolean; pixels : T2DPointArray);
{$IFDEF SMART}
var
i, h, color : integer;
begin
if (not SMART_DebugSetup) then
SMART_SetupDebug;

if Clear then SMART_ClearCanvas;

for h := 0 to High(pixels) do
begin

color := h div 10 + h mod 10;
case color of
0 : color := clWhite;
1 : color := clYellow;
2 : color := clBlue;
3 : color := clLime;
4 : color := 26367;//orange
5 : color := clPurple;
6 : color := clAqua;
7 : color := clFuchsia;
8 : color := clGreen;
9 : color := clRed;
end;

SMART_DrawDotsEx(False, pixels[i], color);
end;
{$ELSE}
begin
{$ENDIF}
end;

{*
Author: mormonman.

Draws the box of each TPA in the ATPA and write the index number in the top
left corner and a cross at the point found by MiddleTPA.
*}
procedure SMART_DebugATPA(Clear: Boolean; ATPA: T2DPointArray);
{$IFDEF SMART}
begin
SMART_DrawDotsMulti(Clear, ATPA);
{$ELSE}
begin
{$ENDIF}
end;

{*
Author: mormonman

Draws the TPA bounds and puts a cross at the point created by MiddleTPA.
*}
procedure SMART_DebugTPA(Clear: Boolean; TPA: TPointArray);
begin
SMART_DebugATPA(Clear, [TPA]);
end;

{*
Author: Sir R. Magician

Clears the SMART canvas, then draws a red TPA (Dots).
*}
procedure SMART_DrawDots(Dots: TPointArray);
begin
SMART_DrawDotsEx(True, Dots, clRed);
end;

{*
Author: Coh3n

Draws a single colored dot (Color) at the set point (Point) on the SMART canvas.
Will clear the SMART canvas if set to do so (Clear).
*}
procedure SMART_DrawDot(Clear: Boolean; Point: TPoint; Color: TColor);
begin
SMART_DrawDotsEx(Clear, [Point], Color);
end;

{*
Authors: mormonman, Brandon.

Draws an array of boxes onto the SMART canvas. Set Color to -1 for it to use
different colors (like in SMART_DrawDotsMulti).
Fill will fill each box with a color.
*}
procedure SMART_DrawBoxes(Clear, Fill: Boolean; TBA: TBoxArray; Color: Integer);
{$IFDEF SMART}
var
i, colour, temp: Integer;
begin
if (not SMART_DebugSetup) then
SMART_SetupDebug;

if Clear then SMART_ClearCanvas;

if (Length(TBA) < 1) then Exit;
for i := 0 to High(TBA) do
begin
if (Color > 0) then
begin
Temp := color;
end else
begin
colour := i div 5 + i mod 5;
case colour of
0 : Temp := clWhite;
1 : Temp := clYellow;
2 : Temp := clBlue;
3 : Temp := clLime;
4 : Temp := clGreen;
end;
end;

InvalidArea(TBA[I].Y1);
InvalidArea(TBA[I].Y2);

SMART_Canvas.Rectangle(TBA[I], Temp);

If (Not Fill) then
SMART_Canvas.Rectangle(IntToBox(TBA[I].X1 + 1, TBA[I].Y1 + 1, TBA[I].X2 - 1, TBA[I].Y2 - 1), 0);
end;

{$ELSE}
begin
{$ENDIF}
end;

{*
Author: mormonman, Brandon.

Draws a single colored (color) box (Box) on the SMART canvas. Will clear the
canvas if set to do so (Clear).
Fill will fill in the box with the specified Color.
*}
procedure SMART_DrawBoxEx(Clear, Fill: boolean; Box: TBox; color: TColor);
begin
SMART_DrawBoxes(Clear, Fill, [Box], color);
end;

{*
Author: mormonman

Clears the SMART canvas, then draws a single red box, specified by 'Box'.
*}
procedure SMART_DrawBox(Box: TBox);
begin
SMART_DrawBoxEx(True, False, Box, clRed);
end;

{*
Author: Coh3n

Draws a box on the RS mainscreen, even if the coordinates are outside client
boundaries.
Fill will Fill in the box with the specified Color.
*}
procedure SMART_DrawBoxMS(Clear, Fill: Boolean; Box: TBox; Color: TColor);
begin
if (Box.X1 < MSX1) then Box.X1 := MSX1;
if (Box.Y1 < MSY1) then Box.Y1 := MSY1;
if (Box.X2 > MSX2) then Box.X2 := MSX2;
if (Box.Y2 > MSY2) then Box.Y2 := MSY2;
SMART_DrawBoxEx(Clear, Fill, Box, Color);
end;

{*
Author: mormonman

Draws a line a set color (Color) from point 1 (TP1) to point 2 (TP2). Will
clear the SMART canvas if set to do so (Clear).
*}
procedure SMART_DrawLine(Clear: Boolean; TP1, TP2: TPoint; Color: TColor);
begin
{$IFDEF SMART}
if (not SMART_DebugSetup) then
SMART_SetupDebug;

SMART_Canvas.ToTBitmap.Canvas.Pen.Color := Color;

if (Clear) then
SMART_ClearCanvas;

SMART_Canvas.ToTBitmap.Canvas.moveto(TP1.x,TP1.y);
SMART_Canvas.ToTBitmap.Canvas.LineTo(TP2.x,TP2.y);
{$ENDIF}
end;

{*
Author: mormonman

Draws an ellipse on the SMART canvas defined by 'Center', 'XRadius', and
'YRadius'. If 'Fill' is true it will fill the ellipse, otherwise it draws just
the border. Will clear the SMART canvas if set to do so (Clear).
*}
procedure SMART_DrawEllipse(Clear: Boolean; Center: TPoint; XRadius, YRadius: Integer; Fill: Boolean; Color: TColor);
{$IFDEF SMART}
var
TPA: TPointArray;
begin
if Fill then
begin
SMART_Canvas.ToTBitmap.Canvas.Brush.COLOR := Color;
if Clear then
SMART_ClearCanvas;
SMART_Canvas.ToTBitmap.Canvas.Ellipse(Center.x - XRadius, Center.y - YRadius,
Center.x + XRadius, Center.y + YRadius);
end else
begin
TPA := TPAFromEllipse(Center.x, Center.y, XRadius, YRadius);

if (Length(TPA) >= 1) then
SMART_DrawDotsEx(Clear, TPA, Color);
end;
{$ELSE}
begin
{$ENDIF}
end;

{*
Author: mormonman

Draws a circle on the SMART canvas defined by 'Center' and 'Radius'. If 'Fill'
is true it will fill the circle, otherwise it draws just the border. Will
clear the SMART canvas if set to do so (Clear).
*}
procedure SMART_DrawCircle(Clear: Boolean; Center: TPoint; Radius: Integer; Fill: Boolean; Color: TColor);
begin
SMART_DrawEllipse(Clear, Center, Radius, Radius, Fill, Color);
end;

{*
Author: mormonman

Draws an array of polygons on the SMART canvas in the set color. Will clear the
SMART canvas if set to do so (Clear).
*}
procedure SMART_DrawPolygons(Clear: Boolean; Polygons: T2DPointArray; color: TColor);
{$IFDEF SMART}
var
i, h, Hi: Integer;
begin
if (Clear) then
SMART_ClearCanvas;

if (Length(Polygons) < 1) then
Exit;

for h := 0 to High(Polygons) do
begin
Hi := High(Polygons[h]);
if (Hi < 2) then Exit;

for i := 0 to Hi - 1 do
SMART_DrawLine(False, Polygons[h][i], Polygons[h][i+1], color);

SMART_DrawLine(False, Polygons[h][Hi], Polygons[h][0], color);
end;
{$ELSE}
begin
{$ENDIF}
end;

{*
Authors: Flight & Coh3n

Draws text on the SMART canvas. Used mainly for progress reports. Parameters
are as follows:
* Clear: Clear the SMART canvas before drawing
* Shadow: if set to true, will add a shadow to the text
* TSA: the string array of what to be printed; each element is a different line
* Placement: the point to start the text drawing
* Font: the font to use (see Simba/Fonts/)
* Colour: the color of the font
*}
procedure SMART_DrawTextMulti(Clear, Shadow: Boolean; TSA: TStringArray; Placement: TPoint; Font: string; Colour: TColor);
var
i, h, TPH: Integer;
TTP, SArr: TPointArray;
begin
if (not SMART_DebugSetup) then
SMART_SetupDebug;

if (Clear) then
SMART_ClearCanvas;

TPH := High(TSA);

for i := 0 to TPH do
begin
TTP := LoadTextTPA(TSA[i], Font, h);
OffsetTPA(TTP, Point(Placement.x, Placement.y+(i*h)));
SMART_DrawDotsEx(False, TTP, Colour);
if Shadow then
begin
SArr := CopyTPA(TTP);
OffsetTPA(SArr, Point(1, 1));
SArr := ClearTPAFromTPA(SArr, TTP);
SMART_DrawDotsEx(False, SArr, 65536);
end;
end;
end;

{*
Author: Coh3n

Draws shadowed line of text on the SMART canvas. Parameters are as follows:
* Clear: Clear the SMART canvas before drawing
* x, y: the coords of where to place the text
* font: the font to use (see Simba/Fonts/)
* Text: the text to draw to the SMART canvas
* Colour: the color of the font
*}
procedure SMART_DrawTextEx(Clear: Boolean; x, y: Integer; font, Text: string; Color: TColor);
begin
SMART_DrawTextMulti(Clear, true, [Text], Point(x, y), font, Color);
end;

{*
Author: Coh3n

Same as SMART_DrawTextEx, except clears the canvas before drawing.
*}
procedure SMART_DrawText(x, y: Integer; font, Text: string; Color: TColor);
begin
SMART_DrawTextEx(False, x, y, font, Text, Color);
end;

{*
Author: Coh3n

Draws a bitmap (Bitmap) on the SMART canvas at given coordinates (Placement).
Will clear the canvas beforehand if specified to do so (Clear).
*}
procedure SMART_DrawBitmap(Clear: Boolean; Bitmap: Integer; Placement: TPoint);
var
Width, Height, I, J: Integer;
Colors: T2DIntegerArray;
begin
if (not SMART_DebugSetup) then
SMART_SetupDebug;

if (Clear) then
SMART_ClearCanvas;

GetBitmapSize(Bitmap, Width, Height);
Colors:= GetBitmapAreaColors(Bitmap, 0, 0, Width - 1, Height - 1);

For I:= 0 To Height - 1 Do
For J:= 0 To Width - 1 Do
Smart_DrawDot(False, Point(Placement.X + J, Placement.Y + I), Colors[J][I]);


//DrawBitmap(Bitmap, SMART_Canvas.ToTBitmap.Canvas, Placement.X, Placement.Y);
end;

{*
Authors: Coh3n, Brandon.

Frees the SMART_Canvas bitmap.
*}
procedure SMART_FreeDebug;
begin
try
if (SMART_DebugSetup) then
begin
SMART_Canvas.ResetPersistentMemory;
SMART_Canvas.Free;
end;
except
Writeln('Failed to free SMART_Canvas bitmap: '+ExceptionToString(ExceptionType, ExceptionParam));
end;
end;

LordJashin

2012-06-27 16:45:23

O awesome: [0000404]: Ctrl + Space Function List,, Make it Resizeable
The bug i submitted was at the top =D

One bug I noticed is that. The Icons or maybe just the one on the Taskbar do no have transparency. So it looks like this:


Wizzup?

2012-06-29 14:42:37

From: LordJashin
O awesome: [0000404]: Ctrl + Space Function List,, Make it Resizeable
The bug i submitted was at the top =D

One bug I noticed is that. The Icons or maybe just the one on the Taskbar do no have transparency. So it looks like this:



Only on WINE probably?

Ggzz: I can make a function to draw one bitmap onto another, if that is what you wish? Please file a github bug for it. :)

Wizzup?

2012-06-29 14:44:23

I'm going to add automatic updating (you can opt-out) to 0.99, as well as RenameFile to extensions so the SRL updaters will properly update the plugins as well.

masterBB

2012-06-29 15:17:03

From: Wizzup?
Ggzz: I can make a function to draw one bitmap onto another, if that is what you wish? Please file a github bug for it. :)


We already got that. Would be a waste of your time, FastDrawTransparant(x,y,bitmapsource,bitmaptarget:integer);

LordJashin

2012-06-29 16:25:37

From: Wizzup?
Only on WINE probably?

Ggzz: I can make a function to draw one bitmap onto another, if that is what you wish? Please file a github bug for it. :)


Nah for some reason just that computer I was using. Weird, its fine on this one using RC6. Maybe that icon was from Simba 98 or something.

EDIT: Also reload plugins button is broke, DX in rc6

Wizzup?

2012-06-30 08:49:20

From: LordJashin
Nah for some reason just that computer I was using. Weird, its fine on this one using RC6. Maybe that icon was from Simba 98 or something.

EDIT: Also reload plugins button is broke, DX in rc6


That button has been disabled for some time as far as I know. :)

Wizzup?

2012-06-30 11:52:01

Fixed https://github.com/MerlijnWajer/Simba/issues/118
Fixed https://github.com/MerlijnWajer/Simba/issues/121
Fixed bug #425

Simba now automatically updates when there is a newer version. (You can turn this behaviour off; but default is on)
The SRL updater extension is also fixed to try much harder to properly update plugins but you'll need the very latest Simba. The updated srl.sex is in the installer here: http://nala.villavu.com/downloads/master/b7a3e9d38bac11483a1180f068ce9f728a01019c/

Optionally you can just get the latest srl.sex from github.

Things are shaping up pretty good for 0.99. I think there's not much left to fix.
Oh, and you can now also force Simba updates. (even if the remote version is less than your local version)

BenLand100

2012-06-30 12:02:37

Why don't you release it already
E: Also, I lol'd irl when it auto-corrected my all caps WHAT THE FUCK MAN