Commit graph

18531 commits

Author SHA1 Message Date
William Wilgus
ca7399821f FS#13953 - lua add get_files() to its own module
get_files(path, recurse, finddir, findfile, sort_by, cancel_fn, f_t, d_t)

get_files returns a sorted tables of directories and (another) of files

path is the starting path; recurse == false.. only that path will be searched

findfile & finddir are definable search functions
 if not defined all files/dirs are returned if false is passed.. none
  or you can provide your own function

sort_by can be by "name" "size" "date" or "none" to perform no sorting
 note: for "size" and "date" you may need to strip the attribute data to use
 the returned filename

cancel_fn if not defined or not a function no user cancel otherwise supply
    your own cancel function which returns true to cancel searching for files

f_t and d_t allow you to pass your own tables for re-use but isn't necessary

Change-Id: Ic4c2ad9c9b5abeeeeaf572880edbc8873d52066b
2026-07-09 12:45:05 -04:00
William Wilgus
40b9d09022 [bugfix] lua ipod mini gen 2 can't quit scripts while under load
I rewrote some of the problematic scripts to use an event loop which
fixed most of the issues but it turns out the underlying issue is
that when the device is under load the timeout that detects a repeat press
makes the key a repeat press and we miss the initial press completely
due to being under load and under the gun

Adds entries for PLA_EXIT and PLA_CANCEL with a Repeat press

Change-Id: I8247b0ebd37fc58608f6be126c49e56f8375e9cf
2026-07-05 22:19:14 -04:00
Christian Soffke
78ec149555 allow softlock in additional screens
not sure if there's a reason these weren't included
in g#3229

- simple lists
- playlist viewer
- browse_id3
- option select

Change-Id: I0e15aaeb563e68ea21bf5df667ce134d01a95195
2026-07-05 12:59:27 +02:00
Christian Soffke
85adf518ac shortcuts: go to WPS for ACTION_TREE_WPS
Change-Id: Ieab19f90d9cf13b19ce7fe108f3ecb734af1fde0
2026-07-05 06:58:44 -04:00
Christian Soffke
e6b4ec81ff simplelist: support ACTION_TREE_WPS
Also enables support for left/right scrolling

Change-Id: Ic5888b1f17cca429febdab031e158db88a632a4e
2026-07-05 06:58:21 -04:00
Solomon Peachy
f11c89aae2 usb: Fix usb mode not initialized/restored on the DX50/DX90
* Devices with ADB now have HAVE_USB_ADB
 * DX50/DX90 no longer set USB_NONE
   * stub out necessary functions
 * usb_set_mode() and global_settings.usb_mode are now:
   * called for all devices with (HAVE_USB_ADB | HAVE_USB_POWER)
   * wrapped with consistent #ifdefs

Fixes regression in ce88de54b8

Change-Id: Ib0c16082fe237e8159cd42847355186ea5c74589
2026-07-03 12:26:34 -04:00
Roman Artiukhin
ce88de54b8 hosted: Fix USB mode not properly initialized for some targets
All required code is already present in the left usb_set_mode call.
Affects iBasso DX50, iBasso DX90, HiBy R1 and HiBy R3 PRO II.

Fixes FS#13890

Change-Id: Ib554ca98a36ceeaa48c0aa699c3671a40d4fee47
2026-07-02 16:09:10 +03:00
William Wilgus
ddc31e8ddc Revert "[Bugfix] FS#13943 - Single mode tracks shorter than one second do not play"
This reverts commit f4e9ba7f17.

Reason for revert: Wasn't the issue??

Change-Id: Ib25ec4b7f90d2ddb0b8a414e18469a9bf5c88140
2026-07-02 01:56:46 -04:00
William Wilgus
f4e9ba7f17 [Bugfix] FS#13943 - Single mode tracks shorter than one second do not play
Change-Id: I8eceb8179231fc7d4c6b8d9c08844a67240c926f
2026-06-30 14:20:01 -04:00
William Wilgus
d87755c535 FS#13944 - FONT_UI loads the last loaded font not global_status.font_id
FONT_UI scans from MAXFONTS-1 to 0 to maximize the chances of getting a loaded
font but this may result in global_status.font_id being ignored even
if set through setuifont

this should take care of all the plugin woes dues to this
by setting the lcd font to the ui font before loading the plugin
and also making FONT_UI map to this font when font_get(FONT_UI) is called
if the desired font is not loaded then fallback to the previous behavior

Change-Id: I101d6f91910c17b08fca2b988a0a99c9e6899bee
2026-06-30 13:29:23 -04:00
William Wilgus
b99b2e98df [Bugfix] lua FS#13940 - FONT_UI using last selected font instead of the UI font
FONT_UI is a placeholder when it gets assigned it isn't resolved
immediately

when its time to resolve the font it is processed with font_get(int font)
first it sets it to the last slot
and then decrements till it gets a valid font

Change-Id: I3c203d58ed2d813d206f5b435e6b55ed196cf213
2026-06-29 01:06:34 -04:00
William Wilgus
d9b1819e0b FS#13942 - Lua strftime os.date("%C")
Change-Id: I5a4cb8d362a69d12c2d7e5013dcf179cc20d01b3
2026-06-28 14:32:33 -04:00
William Wilgus
24b0254d96 metadata.c small cleanup
add get_metadata_afmt function so we don't have to extra functions
remove unneeded bounds check on audio_format in rbcodec_format_is_atomic()
add bounds check on audio_format in get_metadata_afmt()

Change-Id: I76bd869100b000579c6546f0670ba4ba2c541f22
2026-06-28 14:24:02 -04:00
William Wilgus
3cd286d8f8 metadata add audio_fmt to get_metadata_ex
tagcache.c add_tagcache() and potentially
skin_tokens.c wps_playlist_percent_prepare()

make calls to probe_file_format() prior to calling get_metadata_ex
resulting in some small amout of duplicated work
especially in the case of add_tagcache this can add
up to a lot of duplicated work

breaks out audio_fmt so these can supply the afmt other callers just
supply probe_file_format(trackname) in the function call

Change-Id: I8084213b8ee7e04d76dce0986beb83d443ac804b
2026-06-27 14:14:01 -04:00
William Wilgus
3e08b86e4b FixRed a824085 skin: add %pX tag checkwps, ATA builds
ata_disk_isssd() return 0 for SIMULATOR

Change-Id: If281b5ce7a98f338dfd81635c8936dd90c41b9bb
2026-06-27 13:27:35 -04:00
Adam N. Burke
a824085057 skin: add %pX tag for time-based playlist progress
%pP reports playlist progress by position index, which treats every
track as equally long. For playlists with tracks of unequal length --
audiobooks with chapters anywhere from two minutes to an hour are the
motivating case -- position is a poor proxy for listening progress.

%pX reports the played percentage of the whole playlist by time: the
summed length of all preceding tracks plus the elapsed time in the
current one, relative to the playlist's total duration. It can be
used as a value, in a conditional, with %if(), or as a bar tag like
%pb.

If a playlist contains more than 500 tracks or the scan is taking too
long and the user aborts the tag will fallback to the behavior of %pP
except the progress through the current track will be included in the
returned percentage

--------------------------------------
Computing this needs every track's length, and reading metadata for
every track is too slow and disk-heavy for a tag that refreshes on the
WPS. Instead each track's length is estimated from its file size: the
skin engine scans the playlist in the background, a batch of files each
skin refresh, opening each file only to read its size (directory
metadata, no header parse). Size is turned into time by calibrating one
file of each type -- the first file of each extension is parsed once
with get_metadata to learn its bytes-per-second, and every later file
of that type reuses it. A single-format playlist, the usual audiobook
case, parses exactly one file and stat's the rest.

The result is an estimate -- bitrate varies within a type, especially
for VBR -- but it is cheap and accurate enough for a progress
indicator, and the playing track always contributes its exact elapsed
time. Per-track lengths are stored as two bytes of minutes each in a
movable buffer sized to the track count and allocated only while the
tag is in use; the cache is keyed on the track count and a crc of the
first, middle and last filenames, so a playlist swap or reshuffle is
caught. If the buffer cannot be allocated (a very large playlist on a
low-memory target) the tag falls back to position-based progress.

The buffer is allocated when playback starts (and when the now-playing
screen is opened with playback already active) rather than lazily on the
first WPS refresh, so the one-time allocation happens at a playback
boundary instead of during steady-state playback; it falls back to
allocating on first use if that point is missed.

Until the scan finishes the tag does not blank: it returns an instant
equal-weight estimate -- (completed tracks + fraction through the
current one) / track count -- which sharpens into the size-based value
as the scan fills in. So a theme can just use %pX and it is correct
from the first frame, and %?pX is true whenever a playlist is loaded.

Tested on a Sansa Clip Zip and in the simulator. On a 216-track,
~745 MB single-format audiobook playlist the length scan dropped from
~4150 ms (get_metadata on every track) to ~174 ms (one parse plus 215
file-size stats), roughly 24x lighter.

Change-Id: I6e572e78a10444bd513ddc77e30da04aa5153ef2
2026-06-27 12:29:31 -04:00
elishay
0e3355de50 keyboard: fix RTL (Hebrew/Arabic) on-screen keyboard
Commit d1be73c ("keyboard.c Use viewports, move text box pos")
moved the picker and edit line into dedicated viewports. Under an
RTL UI language these viewports get VP_FLAG_ALIGN_RIGHT, so
lcd_putsxy mirrors every call; with the per-character cell drawing
this reversed the picker grid and the edit line (Hebrew shown
reversed, Latin filenames backwards, wrong caret).

- Clear the alignment flag on the keyboard own viewports so the
  picker grid and cell layout are no longer mirrored.
- Draw the edit line as a single string so the bidi engine reorders
  mixed Hebrew/Latin correctly, and use the full line width.
- Compute the caret from the bidi (LTR-base) visual layout so it
  lands at the insertion point, including mixed Hebrew+Latin text.
- Pick the edit-line direction and invert the left/right cursor
  keys based on the text first strong character.

Change-Id: I79f1c444bc9121fd5018ad5f6f4148afe2c1a3e1
2026-06-27 07:45:12 -04:00
Solomon Peachy
9a85d01a32 FS#13933 - Updated Romanian and Moldavian translations (Mihai Alexandru Vasiliu)
Change-Id: Ia2aad85d518f4037b39565036940622aac52812b
2026-06-23 17:31:04 -04:00
Solomon Peachy
cf10fa5243 FS#13929 - Updated Latvian translation (Renalds Belaks)
Change-Id: Id5fd597b16be8e93823d89129256fcb0dfd3e36b
2026-06-21 17:22:29 -04:00
Solomon Peachy
13bcd68346 FS#13928 - Updated Simplified Chinese Translations (Wang Ji)
Change-Id: Ibf63047e9ade0397a29599d127ff77c51a167113
2026-06-21 11:43:49 -04:00
William Wilgus
ad64336e69 [Bugfix] Autoscan when radio off hangs player, record static
Clipzip, ClipPlus other devices may be similar
Autoscan from the main menu and the device hangs at scanning 88.1

try to record with no station set and it just records static

Change-Id: I59fe17dde80736e4fae8445c0aea7fcf5e476317
2026-06-20 11:43:02 -04:00
William Wilgus
81962808a2 use core_alloc for Radio Presets
saves around 1.2k off the top &
allocates a movable alloc when FM radio used

Change-Id: I0ea8c646f919fc8e62de2b02c1c089620e7ef020
2026-06-20 11:23:55 -04:00
William Wilgus
7a32c8b5e3 [Bugfix] lua splash_scroller line formatting
I accidentally added an extra character wittthe last patch by changing
< to <= in the process of testing this I realized spaces were sometimes
being included at the beginning of the line and also that sometime
sentences were being cut short even though they fit on the screen

Change-Id: Iee0ed64e18defad2acb3c107d334ea2a49bd5b6f
2026-06-18 22:21:16 -04:00
William Wilgus
ca2edad012 [Bugfix] FS#13926 -lua Crash when displaying error splash
fix lua strpbrk function skipping the first accept chr

lua splash_scroller fix NULL pointer in brk due to lastbreak
not being reset on a new line

Change-Id: Ica0c9ee5f9194f5be54ab90ad16309adead1c207
2026-06-17 13:55:43 -04:00
William Wilgus
d737cbb931 Sansa As3525 OS stacks debug menu change scroll buttons
the other items that scroll use the menu button and reset on STD_OK

OS stacks use STD_OK to scroll and any other button to reset

Change-Id: I1fa1caa322fe761c6f92d2d08cc418e78843863b
2026-06-17 10:26:22 -04:00
Le Khanh Binh
d00a53a1f0 iap: Fix dead remote at boot & ghost clicks on held buttons
Fix FS#13832
If the remote is already plugged in when Rockbox boots, it stays dead
until you replug it. These remotes only send their identify packet
once at power-up, so we never see it and then throw away all button
events because lingo 0x02 was never negotiated. The OF doesn't care,
so accept ContextButtonStatus from unidentified devices too. Stray
bytes received before iap_setup() also made iap_getc() return false,
which the serial driver takes as "sync found" and locks autobaud onto
the wrong bitrate.

The ghost clicks come from the repeatbtn handshake. A held button
resends its down event every 30-100ms and each one re-armed
iap_repeatbtn, which stalls handling of the following packet. So
during a long press packets pile up, the event queue overflows, and
the leftovers replay as keypresses after you let go. Skipping fires
on button release which is why next/prev showed it the worst. Now
repeatbtn is only re-armed when the button state actually changes,
and iap_handlepkt() drains whatever complete packets are in the RX
buffer rather than relying on one queued event per packet.

While at it, fix two more things found along the way: the button
state is now written in one go (the temporary BUTTON_NONE could be
picked up by the button tick mid-update), and iap_rxlen is
decremented when a frame is received so the overflow check actually
does something.

Tested on ipodmini2g with an A1018 remote.

Change-Id: Ie18512e47d642fe6957fc010eaf79b6d2af4c070
2026-06-16 21:36:02 +07:00
William Wilgus
58ce77fbe2 [BugFix] tagtree voiced Letter menus with talkmenu off
Change-Id: I671f795061a63bcf5db3c94728e98dd7506329a7
2026-06-14 16:50:54 -04:00
William Wilgus
4d773a3329 onplay wps context menu plugin item rework namebuf
only load the namebuf once unless user changes the plugin
also displays the plugin name when user selects the whole context menu

Change-Id: I32b53729a3dcc2bf2c42393876407df7f3d38d8c
2026-06-11 09:52:09 -04:00
William Wilgus
0a1858b9d1 [BugFix] prevent infinite loop to return to wps from plugins
if there is nothing to resume then it will return to the plugin endlessly
hanging the device

Change-Id: I7d6a0c7ec5a9e049cf62f88542bedaa1081556ac
2026-06-10 01:26:51 -04:00
William Wilgus
a81d3fa10e [Bugfix] open_plugins.rock add 'add' item regardless & voice improvements
also fixes a bug where synclist viewport could be empty if the list isn't
initialized

voices path and parameters now

adds the item [Add] as the last item in the list

Change-Id: I1aad62baf3c19a67d04fa1fb3db8a7573e0a467f
2026-06-09 00:39:31 -04:00
William Wilgus
e5c7f0c41c open_plugins.rock add title to main menu, add scroll stop on close
Have a report of a hanging scrolling item, ensure the lists are stopped
on exit with gui_synclist_scroll_stop()

Change-Id: If670806f710118c79377bf8c5de6c1a5168e37fc
2026-06-08 12:03:05 -04:00
William Wilgus
9b0516e4e1 [BugFix] openplugins.rock 0 is a valid file descriptor
Change-Id: Id7d9c2c4b9d13433c8aa2260b20f5d74e4b3add8
2026-06-07 11:19:08 -04:00
Christian Soffke
1add6b0dd5 shortcuts: eliminate unnecessary nesting
Reduces GNU Complexity scores for:

* shortcut_menu_speak_item: 66 -> 10
* do_shortcut_menu: 39 -> 20
* readline_cb: 29 -> 16

Change-Id: Ic648a7eb1e51d4a116bc8af61f1ed1c617cee024
2026-06-06 19:18:17 -04:00
Christian Soffke
86decaab9e root_menu: Start Screen: don't try to resume finished playlist
Go to root menu when Start Screen has been set to "Resume Playback"
but playlist is finished

https://forums.rockbox.org/index.php?topic=55770

Change-Id: I6939fa313dd5fd6485628e22a2d860763492d5cf
2026-06-06 11:34:18 -04:00
Christian Soffke
292e8a17a2 keymap: erosq: fix keylock button handling
Only react to Power button release if previous
button code was Power button press, so that
screen doesn't lock when device may have just
been turned on

Change-Id: I1ba228103efedeeceaaa00c49b1b1da66b63bb75
2026-06-06 17:23:58 +02:00
Christian Soffke
f123dbc04a misc: shutdown: fix backdrop glitches
Clearing the display makes the backdrop come to the foreground.
which can look odd or glitchy, particularly for themes that do
custom drawing on the backdrop buffer (2c71aa9). It also causes
issues if the shutdown has to be canceled.

Instead, enable theme, then clear the UI vp.

Change-Id: Ia96d1e766a9b86ec133522f7cd259e8b88f64216
2026-06-05 20:20:06 -04:00
William Wilgus
2b96380641 [Feature] FS#13884 #2 allow merging imported native keymaps
allows you to import a file and merge native keymaps

pops a yes no prompt to erase existing

duplicates will be overwritten

Change-Id: I167c6fac65775754b2a9874185d14f65638db9d7
2026-06-05 12:08:53 -04:00
William Wilgus
7517674513 FS#13920 text_editor.c plugin do not terminate last line with \n
you can still add a \n by inserting a blank line

Change-Id: Ic3e69fce83ccc9c050857a03877545a7452ce8a2
2026-06-05 02:17:38 -04:00
Christian Soffke
74905f4796 skin_engine: settings_apply_skins: remove get_skin_filename
Has no effect anymore since commit d66592b

Change-Id: Ibefc834378518c7e73e9e9b2489b6c072499bbe8
2026-06-05 00:04:17 +02:00
Christian Soffke
0836ebbd45 shortcuts: fix 'File' shortcuts may fail when dir filter set
Only apply dir filter to 'Browse' shortcuts, so that,
when trying to run a file from Shortcuts that is hidden
due to current dir filter settings, you don't get a 'Failed
reading Unknown' message (LANG_READ_FAILED/LANG_UNKNOWN)
because the tree entry can't be found in ft_enter.

Change-Id: I4eaad2ec415c9bac352a409922848e4407dac993
2026-06-04 21:32:54 +02:00
William Wilgus
ad05e23b72 [Feature] FS#13884 allow merging imported text keymaps
allows you to import a file and merge text keymaps

pops a yes no prompt to erase existing

duplicates will be overwritten

Change-Id: I0f4425e765f0a2ff6b73b830bcaea1b3f31e83cb
2026-06-04 12:10:03 -04:00
William Wilgus
e80e1448f1 [bugfix] Remember position in plugin browser menu
make the struct static so we can keep using the same
browse context between invocations

Change-Id: Ia154a78935755e1decb6abe50291d49e4404fb95
2026-06-04 02:33:44 -04:00
Solomon Peachy
3152beee32 chore: Don't embed $Revision$ tags in auto-generated files
I was going to convert them to a git hash instead, but that would
break builds from tarballs.

Change-Id: I76213b8b65df2c6cfb73cba299a4975a22725f36
2026-06-03 08:31:05 -04:00
Christian Soffke
a39e4f2a06 skin_engine: get rid of skin_unload_all
The skin is not unloaded using skin_unload_all in
settings_apply_skins anymore since commit 0ca4b38.

usb_screen was last remaining user until commit a969e1f.

Change-Id: I65a41ed220165587a04e699a7f210c575c00a4eb
2026-06-02 19:49:13 +02:00
Vencislav Atanasov
4469b95ef2 Update the Bulgarian translation
Change-Id: I285c5d71054b8c245ad40bd7c7a6d76e9b45fd01
2026-06-02 01:07:00 +03:00
Solomon Peachy
d54b9e6f8d chore: Get rid of *all* vestigal CVS '$Id:$' tags
Change-Id: I35c13a9768c582e4851aa252dd3ea5c89f760c8c
2026-06-01 16:01:18 -04:00
William Wilgus
3b2555bd4d onplay wps context menus small cleanup
no functional changes just cleaning up some code / logic

Change-Id: Ic03918a70997cfb170a29175361e2df9a9d242d1
2026-06-01 10:47:07 -04:00
Roman Artiukhin
c052d11673 skin: touchscreen: fix rewind in long files
Fix a possible overflow in the elapsed time calculation.

Change-Id: I211777d8144f76889003239b9a49e4fc56184c8f
2026-06-01 04:26:06 -04:00
William Wilgus
a7754eee71 [Bugfix] FS#13912 - splash_scroller with cyrillic crashes
I think they mean corrupted not crashes as I couldn't repro that

splash_scroller stepped by individual chars and split multibyte
sequences leaving corrupted chars

now it uses the new font_measurestring() to get the max_w and chops
it at break chars instead

this required a bit of a logic change to the function but should be
as good with less complications

Change-Id: I692db8b4737f41aec08dbc122fb844028498326d
2026-05-31 19:05:51 -04:00
Solomon Peachy
1c84362f3e FS#13915 - Updated Italian Translation (Alessio Lenzi)
Change-Id: Icc52476aa680361ee912468d9e47d67ac8324bad
2026-05-31 13:03:49 -04:00