Commit graph

4358 commits

Author SHA1 Message Date
Solomon Peachy
35930ddb8d Keymap improvements for the xDuoo X3
- Synchronized with actual state of Vortex version in general.
- Playback resume has been moved to the Power button.
- Option button acts identically in most contexts: main menu on short
  press and quickscreen on long press.
- Defined A-B repeat mode control buttons.
- Level change action in chessbox has been moved to the volume down button.

(Patch by Igor Poretsky)

Change-Id: I48046ff123d2bccdc0d0c4ed8b088e2053aefa5e
2019-01-02 04:57:32 +01: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
Solomon Peachy
75fe78c802 Handle SYS_POWEROFF event in recorder and chessbox plugins
Credit to Igor Poretsky

Change-Id: I151d3511b9cee269190d87df7fa7dd355aaafc9b
2018-12-23 18:01:54 -05:00
Franklin Wei
b3356e3aff puzzles: resync with upstream
This brings the code to upstream commit 3ece3d6 (I've made my own Rockbox-
specific changes on top of that).

Changes include using C99 `bool' throughout, and minor logic fixes for some
puzzles.

Change-Id: Ie823e73ae49a8ee1de411d6d406df2ba835af541
2018-12-21 22:13:33 -05: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
78b2d13567 Pdbox hide cast-function-type fix overlapping memcpy
dsoundfile.c used memcpy for overlapping memory regions switched to memmove
Suppress the 160+ warnings for cast-function-type
This plugin would require major work to fix these warnings

Change-Id: I309d914839c1e70126a05b387863fd21613497a9
2018-12-08 06:23:19 -06:00
William Wilgus
3d72119dd4 mpegplayer fix warnings
this should fix 'warning: cast between incompatible function types'

Change-Id: I7d192b8953fd14511431cb50254900f566eb0574
2018-11-26 01:51:09 -05:00
William Wilgus
9ed486bdc7 lua add LCD_DEFAULT_FG, fix 2-bit screen fg/bg inversion
Change-Id: Ibe2bc6602ff27524a3b96d9523780acbfbf03c76
2018-11-24 16:40:23 -05:00
William Wilgus
e36edaee55 Lua fix crash on arm devices
This is a seemingly random bug that only affects (as far as I can tell)
arm devices it isn't actually random as code changes cause it to
appear/disappear based on alignment

Change-Id: I4cbc4370677959319f8589fe454e854c45623468
2018-11-17 09:04:05 -05:00
William Wilgus
03718bdb76 Lua fix reader bug in lzio
When loading a file, Lua may call the reader function again after it
returned end of input

https://www.lua.org/bugs.html#5.1.5-2

Change-Id: Ic2f4d727705a0b8f48ce792f6a9f7af25a503037
2018-11-15 11:20:54 +01:00
William Wilgus
b69faf0bcc lua update to 5.1.5
Modify Rocklua towards upstream 5.1.5

Clean up some of the Rocklua implementation

Change-Id: Iac722e827899cf84f5ca004ef7ae7ddce5f7fbbe
2018-11-11 19:42:30 -05:00
William Wilgus
b5fb9781a6 Lua fix pixel-painter score save
pixel-painter was depending on the old readline code that
returned nil for empty lines however empty lines should
have returned an empty string

Change-Id: Ic06ce920a7ab38e1fb8f7197d637e74ed9e35653
2018-11-05 07:18:08 +01:00
William Wilgus
85079483c5 Lua Boomshine Update with circles + levels
added a few more levels and increased difficulty based on level

Rliimage allows us to use circles in boomshine
Optimized some of the code to exceed the speed of the original

Change-Id: I68eb74f8b68fcdc8a9d022cd172374744425f15d
2018-11-05 00:30:46 -05:00
William Wilgus
d9f9def505 Lua fix failure to read lines longer than LUAL_BUFFERSIZE
Readline didn't handle lines longer than LUAL_BUFFERSIZE it now
reads these in chunks.

Change-Id: Iffe12447e5441ff6b479ce3de1d36df64c276183
2018-11-02 23:18:30 -04: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
bb025e3962 lua fix rlimage FB_SCALARPACK()
FB_SCALARPACK(lua_tointeger()) was calling lua_tointeger 3x on color targets

Change-Id: I7b3d73bba5dbc0aa4388b123de11410572fe67c5
2018-11-02 00:42:57 -04:00
William Wilgus
9b385f37ef Lua fix dir string constants and pcm_play_pause & pcm_set_frequency
String constants were already expanded in the first macro
pcm functions were looking for stack position #1 when they needed stack pos #2

Change-Id: I7b4fb90953ab2395b77cbd550fdd257fafca6aae
2018-11-01 18:18:46 -04:00
William Wilgus
be7a58c331 Lua Fix utf8encode, remove utf16 functions
The auto generated utf8/16 encode/decode functions did not work.
Upon implementing them correctly I found that lua handles the utf-8
form properly but I could not get utf-16 to work without crashing
maybe someone can come along later and implement utf-16 safe string
functions but for now utf-16 is removed.

Change-Id: I97a044e200dc27f683a45487cd93fce667c670c4
2018-11-01 16:34:02 +01:00
William Wilgus
bbfe477811 Lua Add underscores in audio, pcm, playlist functions
Lessen confusion for end users looking for the underlying function names in
plugin.h

Change-Id: I6662dc7bd9f22d83af372b3d3c5af53d9a1eac9a
2018-10-31 09:23:00 -04: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
2e1ca20097 Lua restore audio_set_recording_gain, audio_set_output,input
Did not mean to wipe out these function when I consolidated audio

Made the regex for audio_ and playlist_ exact matches instead of fuzzy

Change-Id: I7537d1b494afb114c8b6333ea177b1e482f6b672
2018-10-30 12:05:15 -04:00
William Wilgus
6d8d2422ea Lua update strftime.c from dietlibc source
Adds %F -- %Y-%m-%d
Fixes possible buffer overflow when writing final \0
Frees a bit of code on NON-RTC targets

Change-Id: I1c2600a68ee88c6c99f411ae6646861578683f90
2018-10-30 02:39:11 -04:00
William Wilgus
eab73b3dee Lua replace fscanf
Rocklua was using the full fscanf implementation
to simply read %ld for the file:read("*n") function
wasting 1k on unneeded/unused functionality

Instead, I've implemented a filetol function to duplicate it
without the extra overhead using strtol which as an added bonus
ERANGE errors now resolve to LONG_MIN and LONGMAX instead of
integer overflow

filetol()
   reads long int from an open file, skips preceding
   whitespaces returns -1 if error, 1 on success.
   *num set to LONG_MAX or LONG_MIN on overflow.
   If number of digits is > than LUAI_MAXNUMBER2STR
   filepointer will continue till the next non digit
   but buffer will stop being filled with characters.
   Preceding zero is ignored.

Change-Id: Ia42d0f73c63a894625bca4581e9b7e1cc7387fd2
2018-10-29 23:22:35 -04:00
William Wilgus
cc0a4c632a Lua remove strncat.c & strcspn.c
Change-Id: I08256f31e733d2674054e8e589d539d1396a0ee6
2018-10-30 04:17:06 +01:00
William Wilgus
df8233e4ab Lua expand multiple screen support
Some of the lcd functions had support for multiple screens but this wasn't
very safe since the screen number wasn't bounded within the screens[] array
This adds support for all the lcd functions along with checking that screen#
is bounded properly, adds around 600 bytes to devices with a remote screen
devices without a remote screen lock to SCREEN_MAIN

Change-Id: I618bbc7b3919c7b0ff375fb2d71949d7cab43c87
2018-10-30 04:16:23 +01:00
William Wilgus
80352c2c2d Lua rliimage optimize rli_marshal, rli_copy, lcd_xxx_bitmap
rli_marshal and rli_copy allow the use of a custom lua function
instead of the built-ins, this custom function can signal to stop
before the whole image is iterated.

Originally it was checking for a return of 0
which was additional overhead for the built-in functions
(which never stop early) as well.
Now custom_transform sets the x & y deltas to 0 to indicate early
exit removing an extra 'if' per cycle and return from all of the
rli_transform functions

The lcd_xxx_bitmap functions all require x, y, w, h, screen these calls
have been consolidated into a single function get_bmp_bounds()

Change-Id: I88de3149c58d1bfb40e9d1a91341fb86cbd63b51
2018-10-30 04:16:23 +01:00
William Wilgus
73f2bd9c46 Lua remove gmtime.c use rb_plugin version instead
Change-Id: Ia6d47a13ec8ae407661a78c56513ac0c164216da
2018-10-28 07:15:29 -04:00
William Wilgus
5449500a67 Lua Rlimage metatable
Put rliimage functions into the rb.image metatable instead of the rb. table

Change-Id: Iecdc564c2ea9739656e2025b51bb5d5c62e3dbc1
2018-10-25 07:10:46 -04:00
William Wilgus
55533c4d36 Lua Fix kbd_input
While luaL_addstring() works perfectly fine for the
final buffer once Lual_pushresult() is called
kbd_input doesn't display a previous input properly
since the buffer hasn't been finalized yet

Change-Id: Ic50acaa8b7b17077dec8750dd2b6382624e8a549
2018-10-25 06:30:58 -04:00
William Wilgus
b5786ded64 Lua cleanup kbd_input, gui_syncyesno_run, do_menu
Removes unneeded functions from kbd_input
Consolidates message filling function for gui_syncyesno_run & do_menu

Change-Id: If3c3cea3cbf37a8dc52983c0db174de6d54b35f8
2018-10-25 12:06:10 +02: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
20b98f6fd0 Lua fix create_numbered_filename
I didn't realize that some devices used the *num variable
this fixes that oversight

Change-Id: I2ecd6f475bebdd6ce745b360be3762a069bfc2b1
2018-10-24 11:16:25 -04:00
William Wilgus
df4cb9bafc Lua fix strip_extension and create_numbered_filename
Both of these functions modified the string in the lua stack

per lua manual:
'When a C function receives a string argument from Lua,
there are only two rules that it must observe: Not to pop the string
from the stack while accessing it and never to modify the string'

strip_extension will still work with old parameters
and is thus backwards compatible
strip_extension("filename")

create_numbered_filename has changed slightly and IS NOT backwards compatible

create_numbered_filename(path, prefix, suffix, [number])
(number defaults to -1)

Change-Id: I34cf7e2f6f691f33d5ac2b2e995855a171fb99b3
2018-10-24 06:05:53 +02:00
William Wilgus
948984309a lua move rocklib_img to its own separate loadable module
allows rocklib_img to be excluded if needed

stops rocklib_aux from generating redundant prototypes for
lcd_mono_bitmap[_part]

Change-Id: Ie208ad71ab5f9a7deb026dc01a5b0a0631a0d29c
2018-10-22 14:00:58 -04:00
William Wilgus
07fed9053a lua optimize current_path function
frees up around 500 bytes by using the builtin string functionality

Change-Id: Icd4ec921d3fec339b8a4b7f80c9c63d51d4c101c
2018-10-15 18:24:10 +02:00
William Wilgus
0b7a8d5afd Lua remove unusable/unneeded functions from rocklib_aux
rocklib_aux is auto generated from plugin.h
there are a few functions that get added automatically that
are unusable without their companion functions or duplicate
functionality already supplied by lua

Duplicated functionality:
rb->rand, rb->srand
-- see math.rand math.srand

rb->remove, rb->rename
-- see os.remove, os.rename

Unusable:
rb->open_utf8
-- this should be added to the lua file open routines (if at all)

rb->codec_run_proc, rb->codec_close
-- without rb->codec_load_file these are pointless

rb->timer_set_period, timer_unregister
-- even with timer_register implemented lua is not
-- reentrant and crashes the state when timer fires

Shouldn't be used!:
rb->strlcpy, rb->strlcat, rb->strcpy, rb->strcat
-- lua reuses strings by hashed values you break this contract if
-- you change strings behind its back plus lua provides a way to
-- do these functions safely within the strings api

Change-Id: I2f65704a90930378cbbceb254e52f61e8074471e
2018-10-12 17:31:25 -04:00
Solomon Peachy
d2cef81bba mips: fix some compile warnings.
Change-Id: Ia5e83702313c1c184480290d3b0e6a66f01b7277
2018-10-09 22:35:37 -04:00
William Wilgus
046cc497ad Fix red rocklib_img 32-24 bit targets
int is an incompatible type for targets that have 32bit fb_data
need to use FB_SCALARPACK for them

Change-Id: Ib3b5ff19c54d8d1bb76af33d0538a17a71301514
2018-10-08 19:59:50 -04:00
William Wilgus
c0682e0944 Clean up rocklib_img
optimize both size and speed
fix invert for color screens

Change-Id: I7edecae32dcb3daf5b3ed984a0e5b3d463269e60
2018-10-09 01:02:25 +02:00
William Wilgus
e4b843335b lua rocklib cleanup
removes tslf allocations from do_menu and gui_syncyesno_run in favor of
lua_newuserdata

removes some luaL_opt functions in favor of equivalent lua_to functions

moves some definitions to the rocklib.h file

Change-Id: Iaacc3249b8f1af2c220ce59dead0050c66cb3b04
2018-10-08 23:15:16 +02:00
William Wilgus
dc6f23ec36 lua optimize integer and string consts in rocklib
use a table approach for registering integer / string constants

Change-Id: Idbccae9c2203de1c694f6dd5a7014a7fccedae9b
2018-09-14 01:13:22 +02:00
William Wilgus
733c20d5d3 lua move RLIMAGE to own file
Change-Id: Icd10e4c348deec7729d4a6e2bf1152e1dfc70243
2018-09-14 01:00:35 +02:00
Sebastian Leonhardt
91500e1296 pacbox: fix screen and buttons for Creative Zen
* rotate screen counterclockwise
* rotate directional buttons

Change-Id: Icbdf26fe1e14638eb8b0746a9eea99e0236ac6b1
2018-08-05 15:19:07 +02:00
Cástor Muñoz
7442742208 iPod Classic: disable IRAM1
On Classic, IRAM1 (second 128Kb of a total of 256KB available IRAM) is
slower than DRAM. Codecs that actually are using regions of IRAM1 runs
faster when DRAM is used, so IRAM1 is disabled and only IRAM0 remains
enabled: 48KB for core and 80KB for codecs/plugins.

The next test_codec results shows how decode time is decreased:

file           boosted     unboosted
*.ra           ~1.5%       ~0.5%
*.mpc          ~21%        ~4.5%
*.ogg          ~0.5%       ~0%
nero_he*.m4a   ~8%         ~1%
nero*.m4a      ~25%        ~7%
wmapro*.wma    ~4.5%       ~0%
wma*.wma       ~25%        ~7%

In addition there is a small power save when IRAM1 HW is disabled.

Change-Id: I102adee11458e82037f23076d5d5956e23235de8
2018-07-30 18:50:27 -04:00
Solomon Peachy
0662793ca0 Add cleaned-up xDuoo X3 support
Cleaned up, rebased, and forward-ported from the xvortex fork.

(original credit to vsoftster@gmail.com)

Change-Id: Ibcc023a0271ea81e901450a88317708c2683236d
Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
2018-07-28 10:56:31 -04:00
William Wilgus
400603abdf Lua -- Fix device hang when scroll function active on clear_screen
I previously noticed that manually clearing the framebuffer while scroll
function was active caused lua to crash

I could reproduce in sim and on device but I thought using the plugin
supplied rb->lcd_clear_screen was immune to this issue

Unfortunately some devices exhibit this behavior with the plugin function
as well

This patch adds rb->lcd_scroll_stop() before lcd_clear_screen at lua start-up
and to the supplied include file lcd.lua

Change-Id: I9800145e5c834ea27df5db5f1bca50b0d40faa49
2018-07-27 15:09:55 +02: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