Commit Graph

38 Commits

Author SHA1 Message Date
Solomon Peachy 092c340a20 [1/4] Remove SH support and all archos targets
This removes all code specific to SH targets

Change-Id: I7980523785d2596e65c06430f4638eec74a06061
2020-07-24 21:20:13 +00:00
William Wilgus 01cccaf2d2 lua move strip_extension and create_numbered_filename out of main binary
rb.strip_extension and rb.create_numbered_filename
have been moved to include_lua/files.lua
to use simply add require('files') to your script

Change-Id: I95af7b312c8614cb10da4b71b22714b3e282e08a
2019-09-28 03:15:15 +02:00
William Wilgus 267d04d2bd Lua add metadata and settings reading helper module
Adds example scripts for reading track metadata + dumping albumart
and rockbox settings

settings are now stored as a table of strings rather than a table of tables
as it saves ~15 kb of ram without adding much complexity

Change-Id: I611c312b2a60ab96e595e4710b17aedbd6c0689b
2019-09-07 03:10:59 +02:00
William Wilgus b99d4d7fa9 lua optimize poly_draw add draw_number, poly_points modules
Change-Id: Id36e765f18234f5a4f3092d090c0adffa3da1612
2019-08-26 22:17:33 -05:00
William Wilgus f85df30e3e lua add rlimg.lua example script split large includes to separate files
Change-Id: I67cac5bc4ce5525ab30abf9443f6cc1a33190512
2019-08-04 16:57:02 +02:00
William Wilgus 90118f14cf lua add demo scripts, atexit handler, gui_scrollbar_draw
Change-Id: Ie8794e8a487f73952dae43e036787b6972fdbbee
2019-07-29 02:51:29 -05:00
William Wilgus 6e32e06498 lua add sound_current, consolidate sound_ functions
add defines for sound functions
 SOUND_VOLUME, SOUND_BALANCE, SOUND_CHANNELS, SOUND_STEREO_WIDTH ...
 defines depend on target
 require "sound_defines" to add them to rb.sound_settings[]

consolidates:
 sound_set, sound_current, sound_default, sound_min, sound_max,
 sound_unit, sound_pitch, sound_val2phys to a single function

 rb.sound("name", setting, [value])

 require "sound.lua" for old functionality

Change-Id: Ice695218aa433f4fcbb48fbd6b8a9bf29c994110
2019-07-25 10:17:40 -05:00
William Wilgus c9aeb4284e lua move constants out of binary image
Rockbox constants are auto generated by a perl script like the majority
 of the plugin functions.

Constants are contained in rb_defines.lua, if the file exists it is auto loaded
 by the lua state for backwards compatibility

Frees ~1k

Change-Id: I237700576c748f468249e501c839d89effca3f39
2019-07-18 08:42:00 -05:00
William Wilgus a71af1778d Fix lua helpers -- supress line markers in preproc source generation scripts
In newer builds line markers prevent lua helper scripts
from grabbing some inputs especially _bool

This patch adds the -P switch
  Inhibit generation of linemarkers in the output from the preprocessor.
  This might be useful when running the preprocessor on something that
  is not C code, and will be sent to a program which might be confused
  by the linemarkers.

Change-Id: I66c3b099729f6651300f9fcf4670533a20cc90c1
2018-12-24 21:37:06 +01:00
William Wilgus 28f91ff3dc Lua Fix settings_helper for the gigaBeastS
the gigabeatS has an embedded struct that needs to be parsed

Change-Id: I88c9101afaaa95182f37ade1410cccb4fb768e33
2018-12-17 09:41:15 -06:00
William Wilgus 9d66b5459e Lua add read/write access to global_status, global_settings, audio_current_track
moved items to rb.system
added read access to audio_current_track and audio_next_track

Change-Id: Ia055b8cb3848e540067818f596ffd1058da057fb
2018-12-16 13:33:18 -06:00
William Wilgus f6e10b8488 Lua optimize combine and rework similar functions
rb.strncasecmp
    strcasecmp just exclude count -> rb.strncasecmp(s1, s2)

rb.backlight_brightness_set
    backlight_set_brightness -- redundant
    rb.backlight_brightness_use_setting -> rb.backlight_brightness_set()

rb.buttonlight_brightness_set
    buttonlight_set_brightness -- redundant
    rb.buttonlight_brightness_use_setting -> rb.buttonlight_brightness_set()

rb.mixer_frequency
    rb.mixer_set_frequency -> mixer_frequency(freq)
    rb.mixer_get_frequency -> mixer_frequency

rb.backlight_onoff
    rb.backlight_on  -> rb.backlight_onoff(true)
    rb.backlight_off -> rb.backlight_onoff(false)

rb.touchscreen_mode
    rb.touchscreen_set_mode -> rb.touchscreen_mode(mode)
    rb.touchscreen_get_mode -> rb.touchscreen_mode()

rb.schedule_cpu_boost
    rb.trigger_cpu_boost -> rb.schedule_cpu_boost(true)
    rb.cancel_cpu_boost -> rb.schedule_cpu_boost(false)

Includes rbcompat.lua for backwards compatibility
if your script is broken by this change you simply add
`require("rbcompat")` to the top for the old functionality

Change-Id: Ibffd79a0d9be6d7d6a65cc4af5c0a1c6a0f3f94d
2018-11-02 18:00:06 +01:00
William Wilgus 74fe5203d0 lua consolidate pcm_ functions
The way to call the pcm functions has changed
rb.pcm("option", var)
rb.pcm_set_frequency(freq) = becomes rb.pcm("pcmsetfrequency", freq)

added pcm.lua to the includes for conversion to old functions
if your script is broken by this change you simply add
`require("pcm")` to the top for the old functionality

added rb.pcm("calculatepeaks")

Change-Id: I092057b0c0b5575e567862661f122da1ca2680e8
2018-10-30 14:16:01 -04:00
William Wilgus e4c5f5d412 lua consolidate playlist_ functions
The way to call the playlist functions has changed
rb.playlist("option", var)
rb.playlist_add(filename) = becomes rb.playlist("add", filename)

added playlist.lua to the includes for conversion to old functions
if your script is broken by this change you simply add `require("playlist")`
to the top for the old functionality

added rb.playlist_tracks(dir, filename) to playlist.lua
this will allow you to add all tracks in a playlist.m3u8
to a lua table

Change-Id: I87fcc56be365d8495d214f069331b6ddbfbef1db
2018-10-25 05:59:42 -04:00
William Wilgus b670fcd50d lua add audio_play consolidate audio_ functions
audio_play was removed from the rocklib I assume due to inconsistent
behavior I've readded it with a check for audio paused which instead
uses rewind/ff and then resumes audio

the way to call the audio functions has changed as well
rb.audio("option", var)
so rb.audio_play(0, 0) becomes rb.audio("play", 0, 0)
audio_audio_flush_and_reload_tracks becomes
rb.audio("flushandreloadtracks")

all functions except audio("getfilepos") return the previous (or still current)
status

added audio.lua to the includes for conversion to old functions
if your script is broken by this change you simply add `require("audio")`
to the top for the old functionality

Change-Id: I364adf0c85d9c12b98cde29c26fbe5ee05b9d331
2018-10-24 12:37:29 -04:00
William Wilgus 1b68aea444 Try #4 for lua make
Last commit was just a test to see if it work this one cleans it up
a bit and should be a bit faster

Change-Id: Ifdff5c5b78bcc6889506de607193246beccdde6b
2018-07-24 08:31:19 +02:00
William Wilgus 1482a31134 Try # 3 for lua make file
Change-Id: I888612f3339ffcde28602a4e739b08f630de9c28
2018-07-24 07:31:40 +02:00
William Wilgus aefdd2061d Lua Fix image saving for 32 bit targets -- update make file
Hopefully this will fix the build faliures for a few targets

Change-Id: I68f6c85513ef589e5f6a50a8efc7bfae9fd62acd
2018-07-24 07:09:01 +02:00
William Wilgus af35d19916 Rocklua -- Extend / Fix rliImage
Some devices(1-bit / 2-bit displays) have packed bit formats that
 need to be unpacked in order to work on them at a pixel level.

This caused a few issues on 1 & 2-bit devices:
 Greatly Oversized data arrays for bitmaps
 Improper handling of native image data
 Framebuffer data was near unusable without jumping through hoops

Conversion between native addressing and per pixel addressing
 incurs extra overhead but it is much faster to do it
 on the 'C' side rather than in lua.

Not to mention the advantage of a unified interface for the end programer

-------------------------------------------------------------------
Adds a sane way to access each pixel of image data
Adds:
--------------------------------------------------------------------
img:clear([color],[x1],[y1],[x2],[y2])
 (set whole image or a portion to a particular value)
--------------------------------------------------------------------
img:invert([x1],[y1],[x2],[y2])
 (inverts whole image or a portion)
--------------------------------------------------------------------
img:marshal([x1],[y1],[x2],[y2],[funct])
 (calls funct for each point defined by rect of x1,y1 x2,y2
  returns value and allows setting value of each point return
  nil to terminate early)
--------------------------------------------------------------------
img:points([x1],[y1],[x2],[y2],[dx],[dy])
 (returns iterator function that steps delta-x and delta-y pixels each call
  returns value of pixel each call but doesn't allow setting to a new value
  compare to lua pairs method)
--------------------------------------------------------------------
img:copy(src,[x1],[y1],[x2],[y2],[w],[h],[clip][operation][clr/funct])
 (copies all or part of an image -- straight copy or special ops
  optionally calls funct for each point defined by rect of
  x1, y1, w, h and  x2, y2, w, h for dest and src images
  returns value of dst and src and allows setting value of
  each point return nil to terminate early)
--------------------------------------------------------------------
img:line(x1, y1, x2, y2, color)
--------------------------------------------------------------------
img:ellipse(x1, y1, x2, y2, color, [fillcolor]
--------------------------------------------------------------------
Fixed handling of 2-bit vertical integrated screens

Added direct element access for saving / restoring native image etc.

Added more data to tostring() handler and a way to access individual items

Added equals method to see if two variables reference the same image address
(doesn't check if two separate images contain the same 'picture')

Optimized get and set routines

Fixed out of bound x coord access shifting to next line

Added lua include files to expose new functionality

Finished image saving routine

Static allocation of set_viewport struct faster + saves ram over dynamic

Cleaned up code

Fixed pixel get/set for 1/2 bit devices

Fixed handling for 24-bit devices (32?)

-------------------------------------------------------------------------
Example lua script to follow on forums
-------------------------------------------------------------------------

Change-Id: I8a9ff0ff72aacf4b1662767ccb2b312fc355239c
2018-07-23 05:13:32 +02:00
William Wilgus ef210b5fe4 Revert "Rocklua -- Extend / Fix rliImage"
This reverts commit 2daec3d3c3.

Change-Id: I53ea1f491e3c6d6fb759f426f203f927bd26b1e9
2018-07-22 18:43:04 +02:00
William Wilgus 2daec3d3c3 Rocklua -- Extend / Fix rliImage
Some devices(1-bit / 2-bit displays) have packed bit formats that
 need to be unpacked in order to work on them at a pixel level.

This caused a few issues on 1 & 2-bit devices:
 Greatly Oversized data arrays for bitmaps
 Improper handling of native image data
 Framebuffer data was near unusable without jumping through hoops

Conversion between native addressing and per pixel addressing
 incurs extra overhead but it is much faster to do it
 on the 'C' side rather than in lua.

Not to mention the advantage of a unified interface for the end programer

-------------------------------------------------------------------
Adds a sane way to access each pixel of image data
Adds:
--------------------------------------------------------------------
img:clear([color],[x1],[y1],[x2],[y2])
 (set whole image or a portion to a particular value)
--------------------------------------------------------------------
img:invert([x1],[y1],[x2],[y2])
 (inverts whole image or a portion)
--------------------------------------------------------------------
img:marshal([x1],[y1],[x2],[y2],[funct])
 (calls funct for each point defined by rect of x1,y1 x2,y2
  returns value and allows setting value of each point return
  nil to terminate early)
--------------------------------------------------------------------
img:points([x1],[y1],[x2],[y2],[dx],[dy])
 (returns iterator function that steps delta-x and delta-y pixels each call
  returns value of pixel each call but doesn't allow setting to a new value
  compare to lua pairs method)
--------------------------------------------------------------------
img:copy(src,[x1],[y1],[x2],[y2],[w],[h],[clip][operation][clr/funct])
 (copies all or part of an image -- straight copy or special ops
  optionally calls funct for each point defined by rect of
  x1, y1, w, h and  x2, y2, w, h for dest and src images
  returns value of dst and src and allows setting value of
  each point return nil to terminate early)
--------------------------------------------------------------------
img:line(x1, y1, x2, y2, color)
--------------------------------------------------------------------
img:ellipse(x1, y1, x2, y2, color, [fillcolor]
--------------------------------------------------------------------
Fixed handling of 2-bit vertical integrated screens

Added direct element access for saving / restoring native image etc.

Added more data to tostring() handler and a way to access individual items

Added equals method to see if two variables reference the same image address
(doesn't check if two separate images contain the same 'picture')

Optimized get and set routines

Fixed out of bound x coord access shifting to next line

Added lua include files to expose new functionality

Finished image saving routine

Static allocation of set_viewport struct faster + saves ram over dynamic

Cleaned up code

Fixed pixel get/set for 1/2 bit devices
-------------------------------------------------------------------------
Example lua script to follow on forums
-------------------------------------------------------------------------

Change-Id: I7b9c1fd699442fb683760f781021091786c18509
2018-07-22 18:05:02 +02:00
Frank Gevaerts 8d50cdca37 lua: don't include rockbox-specific libc headers for the button helper tool.
This fixes the "implicit declaration of function 'printf'" warning

Change-Id: I97d247bcab26ddba4d22e0fd19af45fdb47b8cce
2016-03-18 15:52:22 +01:00
Marcin Bukat a2a2e14e0d lua: Switch memory allocator from dl to tlsf
Instead of providing yet another memory allocator implementation
use tlsf and simply link tlsf library.

Another small improvement is to *grow* memory pool by grabbing
audiobuffer instead of just switching to use audiobuf exclusively.
Tested with simple lua 'memory eater' script.

This patch extends tlsf lib slightly. You can provide
void *get_new_area(size_t * size) function which will override
weak dummy implementation provided in lib itself. This allows to
automaticaly initialize memory pool as well as grow memory
pool if needed (for example grab audiobuffer when pluginbuffer
is exhaused).

Change-Id: I841af6b6b5bbbf546c14cbf139a7723fbb982f1b
2013-08-26 09:42:47 +02:00
Thomas Martitz 4b56ee048a Refactor and unify objcopy calls in the build system. Also now properly handles DEBUG builds on hosted targets to keep debug symbols if necessary.
Change-Id: I884031b79c6d49479e4d95752f35ced68872dd5d
2012-04-04 21:48:19 +02:00
Thomas Martitz c406f94592 Lua: Add pluginlib_actions wrapper for lua scripts.
Scripts can now make use of PLA_* actions to be more target independant.

Change-Id: I1b9f69e07f41b2187ecc1bad25a2c20eaaef92b4
2012-01-27 09:15:05 +01:00
Thomas Martitz 57613ea5fa Rename/change SIMVER to APP_TYPE in the Makefiles.
SIMVER was really only used to detect a simulator build. With APP_TYPE you can
now differentiate between simulator, application, checkwps and database builds.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27372 a1c6a512-1295-4272-9138-f99709370657
2010-07-10 13:49:49 +00:00
Maurus Cuelenaere 952d9bc038 Lua: make actions.lua, buttons.lua and rocklib_aux.c depend on it generators
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26911 a1c6a512-1295-4272-9138-f99709370657
2010-06-18 12:28:30 +00:00
Thomas Martitz 8855b0c613 Use PLUGINFLAGS in lua.make, instead of only CFLAGS.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23121 a1c6a512-1295-4272-9138-f99709370657
2009-10-11 21:30:37 +00:00
Frank Gevaerts e99dd1898e Make sure to use $(CFLAGS) to get all defines when preprocessing actions.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23119 a1c6a512-1295-4272-9138-f99709370657
2009-10-11 20:55:47 +00:00
Maurus Cuelenaere 427bf0b893 Also make rocklib_aux.c depend on $(LUA_OBJ)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21663 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 17:59:45 +00:00
Maurus Cuelenaere ce5e6cefb8 Fix sim_* errors when compiling Lua
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21660 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 15:52:08 +00:00
Maurus Cuelenaere 9db43dac62 Fix actions.lua & buttons.lua make errors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21659 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 15:45:26 +00:00
Maurus Cuelenaere d755a5ac58 Lua: add script which wraps not-yet ported C functions to Lua
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21657 a1c6a512-1295-4272-9138-f99709370657
2009-07-05 15:33:08 +00:00
Maurus Cuelenaere af980d8bcb Lua: expose BUTTON_* defines
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21500 a1c6a512-1295-4272-9138-f99709370657
2009-06-24 21:46:17 +00:00
Maurus Cuelenaere acbbf93615 Lua: make sure action.h gets C preprocessed before processing it
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21123 a1c6a512-1295-4272-9138-f99709370657
2009-05-28 22:02:53 +00:00
Maurus Cuelenaere 522aa2e6c9 Fix the 'cannot create /.../apps/plugins/lua/actions.lua: Directory nonexistent' error
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21027 a1c6a512-1295-4272-9138-f99709370657
2009-05-22 10:27:01 +00:00
Maurus Cuelenaere bcfba08055 Lua: add actions.lua to the zip file
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21023 a1c6a512-1295-4272-9138-f99709370657
2009-05-21 21:58:18 +00:00
Maurus Cuelenaere cf87597226 Commit FS#9174: Lua scripting language by Dan Everton
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21020 a1c6a512-1295-4272-9138-f99709370657
2009-05-21 19:01:41 +00:00