summaryrefslogtreecommitdiffstats
path: root/apps/plugins/lua
AgeCommit message (Collapse)AuthorFilesLines
2022-04-16apps: Add ability to do a clean rebootAidan MacDonald1-0/+1
Allow a clean shutdown to end in either power off or reboot. Add a new event SYS_REBOOT to signal it and sys_reboot() to trigger the event. SYS_REBOOT signals a reboot request and should be listened for alongside SYS_POWEROFF events. Change-Id: I99ba7fb5feed2bb5a0a40a274e8466ad74fe3a43
2022-02-23Add custom action mapping to coreWilliam Wilgus1-0/+2
results of an idea I discussed in IRC changed the way the lookup in the remap file works.. entries consist of 3 int [action, button, prebtn] context look up table is at the beginning action_code contains the (context | CONTEXT_REMAPPED) button_code contains the index of the first remapped action for the matched context [0] CORE_CONTEXT_REMAP(ctx1) offset1=(3), count=(1) [1] CORE_CONTEXT_REMAP(ctx2, offset2=(5), count=(1) [2] sentinel, 0, 0 [3] act0, btn, 0 [4] sentinel 0, 0 [5] act1, btn, 0 [6] sentinel, 0, 0 Note: last entry of each group is always the sentinel [CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE] contexts must match exactly -- re-mapped contexts run before the built in w/ fall through contexts ie. you can't remap std_context and expect it to match std_context actions from the WPS context. -- Done -- Code for reading core remap entries -- Done -- import of core remap entires from disk -- Done -- plugin to set new key mapping (the hard part) The plugin is started and FULLY functional you can add actions and contexts you can change context, action, button, prebtn delete keymap files load keymapfiles save user keymaps test keymaps before applying them loading keymaps to core still requires restart ----------------------------------------------------------------------------------------------- Change-Id: Ib8b88c5ae91af4d540e1829de5db32669cd68203
2021-12-05plugin.h & lua add playlist_insert_playlistWilliam Wilgus1-2/+9
having issues running lua and loading a playlist Change-Id: I72d32d77e6567ceed7e8e5fd492eebf0ee44561a
2021-10-21lua add ability to pass PLUGIN_ ret vals with os.exit() + add definesWilliam Wilgus2-3/+10
Change-Id: I45998245271fbd8fee4534f8497b014025e4dcc7
2021-08-13lua Fix a few potential bugsWilliam Wilgus3-3/+10
Change-Id: I0293371c58f1ca2d148b3b1e1f780cf76f312ef9
2021-08-13code cleanup encase ;; in brackets {;;}William Wilgus1-1/+1
Change-Id: I253e19695709b4184ceb4a0748300f7c68437c1c
2021-08-13lua strftime fix out of scope bufferWilliam Wilgus1-1/+3
sbuf goes out of scope of the case statement Change-Id: Ice0553b496bfbfa5bc243dddf5bad90f3baaba51
2021-08-10lua rockaux.c filetol fix invalid conditionalWilliam Wilgus1-1/+1
Change-Id: Id31d3d8b571540394373a61ed213380c95a0eee2
2021-08-03lua fix potential null warningWilliam Wilgus1-2/+4
I'm not sure this would happen but I suspect its possible to get malformed data back from lineinfo as this is how the error system tracks code flow and this is a hacked add-on to allow RLE (run length encoding) of said code flow data Change-Id: I4b914c632935f8b1a9fa960212c58e810b2db738
2021-07-08build: Rename SHARED_LDFLAG to SHARED_LDFLAGSSolomon Peachy1-1/+1
Change-Id: Icb81c72fbcfcdad624112a386ba38a40a830d18f
2021-05-19lua add a way to filter settings on readWilliam Wilgus2-8/+17
rather than dumping all the settings allow a filter function to choose desired settings in menucoresettings you can see an how to do exact text matches or wilcard matches you can even use luas version of regex Change-Id: I4c7f7592498ea194e06e9a556b77ffd57f5d4223
2021-05-19lua latebound function updateWilliam Wilgus4-29/+51
return the nextfunction and nil instead of pairs it allows a faster return to lua rather than calling the lua function pcall(fnpairs) from c and returning the result back into lua to kick off the search yeah, no clue why I didn't realize that before.. testing in x86 and ARM.. its more RAM efficient to do the initial creation of the stack in lua code for the __pairs functon its not faster but being that its a one time hit per iter creation the reduced churn alone should be worth it along with a reduced peak RAM usage fix bug where a failed module can not be reloaded optimize filetol fix potential bug in splash scroller when no break character is found Change-Id: I42c922e07039a19138b97c0d0e80cf3cf2426471
2021-05-06lua -- temp loaderWilliam Wilgus6-96/+205
fix a few bugs, improve memory usage Change-Id: I6ceefd033000a6178eab0dd513679b5d72cec81c
2021-05-03lua fix yellow and add temploaderWilliam Wilgus4-58/+102
temp loader allows some lua requires to be loaded and later garbage collected unfortunately the module needs to be formatted in such a way to pass back a call table in order to keep the functions within from being garbage collected too early BE AWARE this bypasses the module loader which would allow code reuse so if you aren't careful this memory saving tool could spell disaster for free RAM if you load the same code multiple times Change-Id: I0b6f81e481b8c779edbd620c8403794f8353926f
2021-05-04lua add ability to use custom kbd layoutsWilliam Wilgus3-2/+93
bring custom keyboard layouts to lua conversion to the proper format requires create_kbd_layout.lua just pass a lua string with your desired layout Change-Id: I14a392410846311a4f3cf8dda0e88d39834d0418
2021-04-30lua submenus add a way to dynamically add itemsWilliam Wilgus2-42/+103
updated example script and renamed some functions as well fixed bug in printtable cursor position if greater than maxlines for the screen would reset to item 1 now we move the list start and select it (and try to center it on the screen) fixed a few bugs in the add_menu code Change-Id: I01dead0481ef2e925af8b4cc6c14e36c2859dbba
2021-04-28lua add submenu module + cleanupWilliam Wilgus7-120/+385
allows menus + submenus + context menus all with simple tables menu_t which is a table of strings func_t which are the corresponding functions to go with those strings see lua_scripts/submenu_demo.lua Change-Id: I907b74b4abef0ecbe49f181d0ced6e6d20e94de5
2021-04-24lua print_button scriptWilliam Wilgus2-21/+25
also allow splash_scroller to be used as static text display Change-Id: Idc8c9e60ada920e2d1abd5301b59bd235e21a1c2
2021-04-20lua print table put_line a do_menu alternativeWilliam Wilgus6-71/+557
add stylized lines to lua the exported do_menu has a severe limitation of 64 items it also requires double the memory put_line is the way rockbox builds menus update printtable user config from core -- done code cleanup fixed for 1-bit screens changed button behavior fixed for 2-bit screens Change-Id: I4de55e42685aa1d2f53a33bc8e980827864e810b
2021-04-08lua print_table add ability to draw a line separatorWilliam Wilgus2-4/+16
allows you to draw a line between items Change-Id: I7e6e2f56738e12ff06d06a24f0f9d0769932a7b1
2020-11-12pcm: Further cleanup of unused bits of the PCM ACPI:Solomon Peachy2-15/+2
* pcm_get_bytes_remaining() * pcm_calculate_peaks() * pcm_get_peak_buffer() Nothing in-tree uses these at all (except for the lua plugin wrapper) Change-Id: I971b7beed6760250c8b1ce58f401a601e1e2d585
2020-10-31pcm: Get rid of pcm_play_pause() and associated APIsSolomon Peachy2-13/+4
Nothing in the core has used it for some time. It's exported to the plugin API but the last plugins to use it were switched to the mixer API back in 2011. This allows us to get rid of pcm_play_dma_pause() from all audio drivers Change-Id: Ic3fa02592316f84963e41d792d1cabb436d1ff6b
2020-10-26Whitespace cleanup on fb_viewport RewriteWilliam Wilgus1-2/+2
Change-Id: I24aac41c8abecf7b78a44d7f59e842b791be4563
2020-10-26LCD core move buf ptr and address look up function viewport structWilliam Wilgus1-1/+7
I'm currently running up against the limitations of the lcd_draw functions I want these functions to be able to be used on any size buffer not just buffers with a stride matching the underlying device [DONE] allow the framebuffer to be decoupled from the device framebuffer [DONE need examples] allow for some simple blit like transformations [DONE] remove the device framebuffer from the plugin api [DONE}ditto remote framebuffer [DONE] remove _viewport_get_framebuffer you can call struct *vp = lcd_set_viewport(NULL) and vp->buffer->fb_ptr while remote lcds may compile (and work in the sim) its not been tested on targets [FIXED] backdrops need work to be screen agnostic [FIXED] screen statusbar is not being combined into the main viewport correctly yet [FIXED] screen elements are displayed incorrectly after switch to void* [FIXED] core didn't restore proper viewport on splash etc. [NEEDS TESTING] remote lcd garbled data [FIXED] osd lib garbled screen on bmp_part [FIXED] grey_set_vp needs to return old viewport like lcd_set_viewport [FIXED] Viewport update now handles viewports with differing buffers/strides by copying to the main buffer [FIXED] splash on top of WPS leaves old framebuffer data (doesn't redraw) [UPDATE] refined this a bit more to have clear_viewport set the clean bit and have skin_render do its own screen clear scrolling viewports no longer trigger wps refresh also fixed a bug where guisyncyesno was displaying and then disappearing [ADDED!] New LCD macros that allow you to create properly size frame buffers in you desired size without wasting bytes (LCD_ and LCD_REMOTE_) LCD_STRIDE(w, h) same as STRIDE_MAIN LCD_FBSTRIDE(w, h) returns target specific stride for a buffer W x H LCD_NBELEMS(w, h) returns the number of fb_data sized elemenst needed for a buffer W x H LCD_NATIVE_STRIDE(s) conversion between rockbox native vertical and lcd native stride (2bitH) test_viewports.c has an example of usage [FIXED!!] 2bit targets don't respect non-native strides [FIXED] Few define snags Change-Id: I0d04c3834e464eca84a5a715743a297a0cefd0af
2020-10-26make the plugin API frambuffer agnosticMoshe Piekarski1-1/+1
Change-Id: I5abdc231093054c517ff53b9a456997e440e3f6e
2020-10-23Hosted targets Fix timer cycle calculation overflowWilliam Wilgus1-1/+4
at 1 GHZ the intermediate calculation for cycles overflows 32 bits this makes timer fail even with sensible values solution divide both sides by 100 Change-Id: I18a4054c2d06fb72531d5496bba562f71b03984f
2020-10-05lua add better memory statsWilliam Wilgus2-3/+68
lua gives you a memory used number that only reflects the current allocations if fact it doesn't even give you a way to get the amount of ram free rb.mem_stats() seeks to fill this gap by marking the memory allocated for lua with a sentinel value which can later be checked to get a high water mark of the ram used by lua and a pretty good idea of how much ram is available Also includes an example script usage: used, allocd, free = rb.mem_stats() Change-Id: Ia282869f989848324d7d88c7df4827fdbce4fb4e
2020-10-04lua misc tweaks and cleanupWilliam Wilgus5-23/+24
checks button_status in rockev strpbrk_n custom implementation allows setting max search len in source string add some branch prediction where appropriate fix formatting in splash_scroller script Change-Id: Id5d8e9d83f4b3e361ccb67b403af8f9a8a31b8f0
2020-10-03lua Add scrollable stack traceback WIPWilliam Wilgus4-3/+140
lua currently splashes a stack traceback on error for deep tracebacks and especially on devices with smaller screens this leaves out a lot of vital information in the past I have resorted to splitting the traceback string or even saving the return to a file This patch provides a scrollable buffer with rudimentary text reflow to allow you to read the whole traceback string Upon traceback if you press nothing the screen will display for 5 seconds If you press OK or CANCEL it will quit immediately PREV/NEXT scrolls the list on button press timeout is disabled lua now provides rb.splash_scroller(timeout, str) example script provided too Change-Id: Idbc8ce0c514196f0fae48c43aeaea8b60d6da1a5
2020-10-01lua: fix ipod builds broken by 127862cSolomon Peachy1-1/+1
Change-Id: Ibef7de6b4e87568206ede66c399093b66b827b69
2020-09-30lua: Include $TARGET when preprocessing the headers for the button helperSolomon Peachy1-2/+1
Change-Id: I3ab98b52991949adb1db2f13ea99ed24d827e575
2020-09-30lua rockevents reduce context switching for action and buttonsWilliam Wilgus1-13/+24
check if any buttons are waiting in the queue before triggering the event thread for action & button events makes button events quicker and also spend less time interrupting lua both wins Change-Id: I38346c084afdd99e4608f40b52053ee39730fb40
2020-09-27lua playback exampleWilliam Wilgus1-0/+1
cool little lua based audio player creates dynamic playlist of 10 mp3s found on device if no music loaded I had to limit the depth of search to 3 levels due to the recursive nature of the current dirbrowser functions this could be rectified with a bit more code fixed a bug in print.lua that kept scrolling text even after screen clear Change-Id: Ifd285332df41a409ecaeb1ea447ad15537b5d04c
2020-07-24plugins: Fix the builds for targets lacking HAVE_BACKLIGHTSolomon Peachy1-9/+13
Change-Id: Ifdb1501834b7ea63ca6f731bbd6414305d7e0001
2020-07-24[4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.Solomon Peachy2-9/+0
Note: I left behind lcd_bitmap in features.txt, because removing it would require considerable work in the manual and the translations. Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24[3/4] Completely remove HWCODEC supportSolomon Peachy1-5/+1
'swcodec' is now always set (and recording_swcodec for recording-capable units) in feature.txt so the manual and language strings don't need to all be fixed up. Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
2020-07-24[1/4] Remove SH support and all archos targetsSolomon Peachy3-17/+3
This removes all code specific to SH targets Change-Id: I7980523785d2596e65c06430f4638eec74a06061
2020-07-22keyboard add ability to specify temporary custom layoutsWilliam Wilgus1-1/+1
rb core allows you to load custom keyboard layouts this patch adds the ability to load a keyboard layout in a buffer the custom layout is temporary and does not overwrite the current layout use like so: unsigned short kbd[64]; unsigned short *kbd_p = kbd; if (!kbd_create_layout("ABCD1234\n", kbd, sizeof(kbd))) kbd_p = NULL; rb->kbd_input(buf,sizeof(buf), kbd_p); Change-Id: I7be2bd4a1b4797a147fa70228a9749dc56ac052a
2020-07-19do_menu pass internal synclist reference to callbackWilliam Wilgus1-3/+6
keep running into the rigid nature of do_menu it isn't too bad when you don't need voice but once you do the fun awaits do_menu likes to talk on menu enter which is in a loop when you use do_menu I would like to move the processing to the callback TOO BAD you only get an action and the menu_item_ex struct you sent it when calling the function Change-Id: Iaefd0cc133435d675b7dd27a558c504d6ccb327a
2020-06-23lua RockEv timing fixesWilliam Wilgus1-6/+3
just a few tweaks to the RockEv backend to allow tighter event timing originally there was a timeout where events would be consolidated prior to running the event thread, this slowed the faster events but it turns out this isn't really a big waster of time The callback from C => lua is a far bigger bottleneck Change-Id: Iffacbe49c4b83155099b1304590450f746576fa4
2020-06-01lua add _fullpath and argument parsingWilliam Wilgus1-7/+47
WIP for passing arguments to lua scripts args are recognized by adding ?arg to the end of the script path The easiest way to do this currently is to use the function rb.restart_lua local sfile = rawget(_G, "_fullpath") or "" local sArgs = rawget(_G, "_arguments") if not sArgs then rb.restart_lua(sfile .. "?my arguments") else rb.splash(1000, sfile .. "?" .. sArgs) end I'd eventually like to figure out a sensible way to do this from a shortcut / quick list Change-Id: I2b60fe3b8f1d04b57361fe532510bd6afee59fbf
2019-11-15lua rockev rewriteWilliam Wilgus1-281/+305
After a few issues with the timer code in the hosted players I realized a few shortcomings in the original rockev code... This rewrite gives thread_exit an explicit flag instead of 0 custom events now have a set-able timeout previous lua hooks are restored flags are stored in uint8_t Change-Id: I9ca45246ac9233a2faa581e26a8cc5e5fb512e88
2019-10-07lua rockev cleanupWilliam Wilgus1-14/+13
with the addition of suspending all events on thread start and exit we don't really need to block on THREAD_QUIT in so many places Removed suspend clearing on event unregister and updated comments Change-Id: Id9c6a460def558c5331ee292035691a9f82b2c43
2019-10-08lua rockev fix possible race on thread exitWilliam Wilgus1-25/+45
report of call after free on event thread on Agptek Rocker I'm guessing its a race condition between the thread and the timer but can't say for sure without some more testing Change-Id: If11bd718b3cfa81ea13fff378df56d12afa17a7f
2019-09-28lua move strip_extension and create_numbered_filename out of main binaryWilliam Wilgus4-1/+64
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-27lua rocklib_aux.pl support for enumsWilliam Wilgus1-1/+21
everything that would have been added has already been added or needs more supporting functions so they've been excluded for the time being Change-Id: I4ae4753c543287934702a3bd2eeccce5b032235d
2019-09-27Fix red lua remove and consolidate some rb plugin functionsWilliam Wilgus1-8/+1
I'll revisit adding enums once I research it a bit more Change-Id: If10c445cf770e5b90defc543f08d8de0817b2f3d
2019-09-26lua remove and consolidate some rb plugin functionsWilliam Wilgus2-6/+73
removes some usless / duplicated functions removes atoi - lua tonumber() does this for you removes strlen - lua string.len does this for you removes system_memory_guard - if a device that actually implements system_memory_guard needs it we can add it back conditionally consolidates talk_number and talk_spell (on backend) consolidates talk_shutup and talk_force_shutup talk_shutup(bForce) Change-Id: Id132642f087975a7c132e99a668a41c977942b81
2019-09-18lua give luadir the ability to return table of attributesWilliam Wilgus1-14/+27
for fname, isdir, attrib in luadir.dir(scrpath, true) do passing true for the second argument returns table of file/dir attributes in attrib Change-Id: I7c999e2fc5dac95b8ccbe169f2119c31b63f6a41
2019-09-14lua add menu callbackWilliam Wilgus1-0/+49
forum user fprockboxer asked for a way to detect long presses within the do_menu routine this adds that functionality result = rb.do_menu("Title",t_items, start, menu_callback) function menu_callback(action) ... return action end Change-Id: I110c590095a743a57d0a7d45b24309899a4629cf