Commit graph

33838 commits

Author SHA1 Message Date
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
Solomon Peachy
20b91a83d3 codecs: Fix elapsed time calculation for large files
In particular, this solves seeking glitches seen in ~6 hr mp3 files.

(Patch taken from Igor Poretsky's tree)

Change-Id: Id65b6726146b6d2d1a223e90b88e401d1b2d597a
2018-10-29 19:50:34 +01:00
Amaury Pouly
0120ecd651 sonynwz: add nvp map for NW-A50 series
Change-Id: I49f3399552721e515cc01021c2e0aa28c781ec28
2018-10-29 15:10:24 +01:00
Amaury Pouly
8a4cb5e619 sonynwz: add NW-A55 to database
Change-Id: I59861119c59490f586b3c6ed32a1c41df8b3d365
2018-10-29 13:29:39 +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
7a132a257a Fix playback.c audio_track_count() warning
changes return to unsigned int to match underlying aliased function

Change-Id: I7015c7ad929344441249aa7c4f2af361142fcaf4
2018-10-18 09:57:20 -04:00
William Wilgus
7c2295ea46 Diacritic.c add newline to EOF
Change-Id: Ide8934fa267bfb745fc397cdb7450f3ac0453174
2018-10-18 08:03:20 -04:00
William Wilgus
b977b77fb7 Optimize is_diacritic
is_diacritic is used for pretty much all of the text display sizing
Timing here matters, so important it uses a
priority buffer in order to cut down on searching the database.

This patch is verified functionally equlivalent but
saves 80 bytes and is ~20% faster for the clip+ I tested it on

Several things were done:

Optimizing the copy loop for the priority buffer

Globbing some operations together

but the main one has to do with the database structure its self
--
Rather than a bit packed struct it combines the lower 8 bytes into
one value [info] and uses flags to access the values instead

Change-Id: I475073419b647639ef1eeaa3b9213e4e1067c0db
2018-10-18 13:29:32 +02:00
William Wilgus
dd40c46d50 Fix menu warnings
change offending bool return to int

warning: cast between incompatible function types from
'_Bool (*)(void)' to 'int (*)(void)' [-Wcast-function-type]

forgot to remove -- typedef int (*menu_function)(void);

Change-Id: Ie4c8d3ddb0fb7843c4ec584203350d658d6bee3e
2018-10-18 00:06:31 +02:00
Solomon Peachy
e6b23a8f04 onda: fix compiler warning in boot loader
Change-Id: Ic92d8e183503b68604d69bad27991f66d89c8744
2018-10-15 14:26:27 -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
Solomon Peachy
53d72a8be1 fix builds broken by the selective stack bump for opus seeking.
Change-Id: I9eb3b4d2bc88293b09679c27fbceaaa7788ba553
2018-10-09 15:00:48 -04:00
Solomon Peachy
71abdf5d82 mips: jz4740: JZ4740 does not have a MSC clock source select.
Change-Id: Ic2af37d92bcb8b6b35684f113eb8e392fc2eb609
2018-10-09 11:37:43 -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
Solomon Peachy
ebaddc671e build: Log the zipfile creation
Change-Id: I7d5b923cfe6bc133a1b2ac39b39bbe07e327d9cd
2018-09-28 11:53:15 -04:00
Solomon Peachy
3e209f34e4 misc: Fix some assorted compiler warnings
Change-Id: Ibc4aac79e6fce92ad4414ed50122c2d4d6295f89
2018-09-28 11:53:15 -04:00
Martin Nowak
e18425197e fix FS#13060 - Seeking in long opus files leads to crash on Sansa Clip+
- increase decoder thread stack size just enough (2KiB) to
  avoid stack overflows when seeking in opus files
- only do so on devices with at least 8MiB of RAM

Change-Id: I7e7182ae866338b4aad6ed7e32391ddd667121bd
2018-09-28 17:47:28 +02:00
Solomon Peachy
a454b7f9ef jz4760: Lots of stability fixes to the USB driver.
It actually works for transferring data now!

Igor Poretsky gets full credit for this patch.

Change-Id: I247c70fdf45e590b4699b9b8668bbdab7bc3ef03
2018-09-20 21:11:40 -04:00
Solomon Peachy
a26c1c1459 xduoo_x3: Disable keypress IRQ since we poll for keypresses.
Change-Id: Ieab5f864751cf798b62c4e89e670acf7ade756ab
2018-09-20 19:38:58 -04:00
Solomon Peachy
640ada0389 jz4760: Enhancements and fixes to SD driver.
* Fully Interrupt-driven, with proper task yielding
 * Much more robust error handling
 * Eliminate duplicate code
 * Pile of bugfixes

 (Much of this adapted from Igor Poretsky's tree)

Change-Id: I46006412323cba2088b70094635d62a241be1d7e
2018-09-20 19:38:25 -04:00
Solomon Peachy
8edf4052c7 jz7460: Silence codec when changing playback frequency/mode
Silences some annoying clicks.

Change-Id: I3d32d4b33c0ccc61877e10f5af97fe05084d66e5
2018-09-20 18:59:19 -04:00
Solomon Peachy
1020897794 jz7640: SD driver improvements:
* Better multidrive support
 * Common slot1/slot2 handling code

Change-Id: Id0aed90cbba4246fdc71b42e03f016f8060d258a
2018-09-20 18:59:19 -04:00
Solomon Peachy
679a0bd193 jz74x0: MSC clock needs to be divided from PLL clock.
Change-Id: I0cf2f0d55e0859f896afef289e833935d7c5a599
2018-09-20 18:59:19 -04:00
Solomon Peachy
72820d8b2d jz4760: Greatly enhance debug code and silence some compilation warnings.
Change-Id: I1746d67c818ad099edea83e6242ffd5c79be0000
2018-09-20 18:59:19 -04:00
Solomon Peachy
08ab3aea4f Get rid of the last remnants of HAVE_FUNCTIONAL_MODE
Change-Id: I4f9339019884aceedc8c9d0ab779a2e32ace0288
Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
2018-09-20 22:03:03 +02:00
Solomon Peachy
3671f923eb Xduoo_X3: Update target configuration
Change-Id: Ibc6b204357524550a0d6fa917e7d074ec2e52773
2018-09-20 22:02:28 +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
Solomon Peachy
be801c61bb mips: Update the MIPS threading code
Taken from Amaury Pouly's Fiio X1 patches in gerrit.

   Xduoo X3 no longer panics on startup

Change-Id: I4c2dee832306755b9e496084cb47fb61f804af20
2018-09-07 09:55:12 +02:00
Marcin Bukat
734be0d6aa MIPS: fix memset()
swr/swl instructions used for word aligning were wrong. This
made memset() terribly broken. I can't imagine how it went
uncaught for soooo long. Spotted by Solomon Peachy.

I run unit tests for alignments 0,1,2,3
size 1, 2, 3, 4, 5, 63, 64, 65, 127, 128, 129;
and fill pattern 0x00 and other (since 0 is special case in this
implementation).

Change-Id: I513a10734335fe97734c10ab5a6c3e3fb3f4687a
2018-09-07 09:43:05 +02:00
Solomon Peachy
b1ee789f97 libmad: Back out a change that disabled optimization for libmad.
(Caused non-realtime playback on mips..)

Change-Id: I878229e16e31d49156f1ae71ab9c7bb627e4c17b
2018-09-02 11:55:39 -04: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
Sebastian Leonhardt
5dfcadc45b manual: nitpicking on '-' character and other minor details
Change-Id: Id204276387d55ba2276530ed1cb6ee827e28062a
2018-08-05 12:57:05 +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
Cástor Muñoz
8f38f85fbd Workaround for usb_storage_init_connection() panic
For s5l8701, s5l8702 and as3525v2 targets.

The crash occurs when USB is inserted or extracted while the playlist
is being loaded or updated (it could take a few seconds for huge
playlists), at this point all buflib memory is allocated and not freed
before usb_starage_init_connection() is executed.

This workaround mitigates this panic by using static memory for USB
buffers, so this memory cannot be used for other tasks, in addition
the problem still persist when playlist load is 'paused' by USB
insertion and then updated after USB extraction.

Change-Id: Iff1db5a949361fd543e0b494924d1f2906c84b5e
2018-07-30 17:54:51 -04:00
Franklin Wei
210881ca35 Remove leftover merge conflict marker
Change-Id: Ie34657fe652d3613429d3fa233faac9608a8b826
2018-07-29 12:23:28 -04:00