Commit graph

661 commits

Author SHA1 Message Date
Solomon Peachy
a2c10f6189 unicode: Support characters beyond the first unicode plane
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * font manipulation, caching, rendering, and generation
 * on-screen keyboard
 * FAT filesystem (parsing and generating utf16 LFNs)
 * WIN32 simulator platform code

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Appears to work on:

  * hosted linux, native, linux simulator in both 16/32-bit modes.

Needs testing on:

  * windows and macos simulator (16bit+32bit)

Change-Id: Iba111b27d2433019b6bff937cf1ebd2c4353a0e8
2025-09-12 09:24:30 -04:00
Solomon Peachy
84504c7471 Revert "internals: Support characters beyond the first unicode plane (WIP)"
This reverts commit d05c59f35b.
2025-08-20 16:09:49 -04:00
Solomon Peachy
d05c59f35b internals: Support characters beyond the first unicode plane (WIP)
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * on-screen keyboard
 * font manipulation, caching, rendering, and generation
 * VFAT code parses and generates utf16 dirents
 * WIN32 simulator reads and writes utf16 filenames

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Known bugs:

  * Native players in 32-bit unicode mode generate mangled filename
    entries if they include UTF16 surrogate codepoints.  Root cause
    is unclear, and may reside in core dircache code.

Needs testing on:

 * windows simulator (16bit+32bit)

Change-Id: I193a00fe2a11a4181ddc82df2d71be52bf00b6e6
2025-08-20 16:08:43 -04:00
Christian Soffke
f3d127f372 Minor confirm prompt adjustments
* Rename LANG_RESET_ASK to LANG_ARE_YOU_SURE,
  so that it matches the actual language string
  (translations remain valid), and can be repurposed
  for generic confirmation prompts, where the
  first line says "Are you sure?", and the second
  line reiterates the selected action

* Add "Reset Settings" as second line to the prompt
  shown before resetting settings, instead of just
  asking "Are you sure?"

* Make Shuffle prompt consistent between WPS and
  Playlist Viewer, and ask whether user is sure they
  want to Shuffle instead of warning them that the
  current playlist will be erased, which was a bit
  misleading

* Explicitly say "Cancelled" when user answers NO to
  erasing the current playlist or to overwriting a file.
  Improves consistency with other prompts that are
  displayed for potentially destructive actions, e.g.
  before items are deleted, renamed, saved, or reset.

* PictureFlow: Prompt before rebuilding/updating cache

Change-Id: Id8ae36db7187315eb1a374701307e6ab4dcdbd1d
2025-05-26 23:15:53 -04:00
Solomon Peachy
622ff574e7 splash: splashf() should be voiced if given an IDPTR
Most calls to splashf() use str(IDNUM), those can be safely
moved to ID2P(IDNUM) now.  Those will follow.

This change effectively makes splash() a simple wrapper around
splashf() so just make it into a #define instead..

Change-Id: I820e74e34cb4be3f523b25ce3f5dcc341bdba3e4
2025-05-17 16:13:58 -04:00
Solomon Peachy
c7eda36341 misc: Clean up a large pile of -Wexpansion-to-defined warnings
And re-enable the warning (applies with GCC 7+)

Change-Id: I406ce796ebd06bad53cab911e17a28265a79b420
2025-04-21 21:04:05 -04:00
Aidan MacDonald
639b587fc7 arm: add support for processors with hardware division
ARMv7-M has hardware division, so it doesn't require __div0
or any support functions for 32-bit division.

Change-Id: I840683a1a77d737f378899ca4bcf858216b81014
2025-04-18 09:22:48 -04:00
William Wilgus
10f8312db4 FS#13538 export and import battery level tables
when battery_bench is run
exports a file in the rockbox directory called 'battery_levels.default'

if the user wants their own levels they can rename the file battery_levels.cfg
and it will be loaded at boot

some minimal error checking is performed prior to using the values

added manual entry

Change-Id: Ia0126faced0c7229fcf8385a1bcb584b5a9dc378
2025-03-06 11:54:21 -05:00
William Wilgus
c3fd32bdf2 [Feature] playback logging from core
people don't like having to remember to run the TSR plugin so
lets meet them halfway

all tracks are added with timestamp, elapsed, length, trackname

added buffering for ATA devices

still needed:
-Done -- a plugin that parses for duplicates and reads the track info
to create the actual scrobbler log
(log can be truncated once dumped)
this should allow you to run the plugin at leisure

later I'd like to expand this logging to allow
track culling based on skipped songs..

remove the TSR plugin as hard disk no longer need to use it

Change-Id: Ib0b74b4c868fecb3e4941a8f4b9de7bd8728fe3e
2025-01-13 00:45:09 -05:00
Christian Soffke
8f5128da16 Show Track Info: Support fs tags in Playlist Viewer, Properties, and PictureFlow
Playlist Viewer falls back to splashf if there is not
enough plugin buffer space left for running the
view_text plugin .

Change-Id: I418731018b03f396270b68e5e2d2e69635df1af0
2024-12-16 00:20:10 +01:00
Christian Soffke
1745b74576 Make simulator compile on MacOS
Tested on MacOS Sequoia (Apple Silicon) with the
latest Xcode command line tools, gcc 14
(Homebrew GCC 14.2.0_1) and sdl2 (Homebrew 2.30.9)

Make sure 'gcc' (and 'gcc-ar') is in your PATH
ahead of the Xcode-provided "gcc"(clang). E.g.
by setting up symlinks in /usr/local/bin that
point to gcc-14 and gcc-ar-14.

Notes:
- The appropriate bmp from uisimulator/bitmaps
  has to be manually copied to your build folder
  and renamed to UI256.bmp, if you want the sim
  background to be displayed

Change-Id: I559f33d2165065f913f30c016b85906af380fb81
2024-11-30 22:19:02 -05:00
William Wilgus
da9d67a0fe Button queue handling is split from main button driver
First half of
https://gerrit.rockbox.org/r/c/rockbox/+/570

Change-Id: Icc64dfd8194c18f69564ed5f8bf7dd70a4330eb9
2024-11-27 20:16:53 -05:00
William Wilgus
7288d9e5d2 Move cfg_vals from settings_list, expand settings_dumper
cfg_vals aren't needed for most settings

F_TABLE_SETTING, F_CHOICE_SETTING, F_BOOL_SETTING

can use cfg_vals but only a few custom settings use it otherwise
for these settings we define F_HAS_CFGVALS and use the setting union instead (as these all use UNUSED)

noticed that settings_dumper missed most cfg values so didn't show text setting values

saves ~300 bytes

Change-Id: Ie504c8cfe2a6cf471117c3afe5cf9a770a7f1784
2024-11-10 21:53:22 -05:00
Solomon Peachy
15e5237469 storage: 64-bit sector offsets
* Create new 'sector_t' type alias:
    * uint64_t for all targets with HAVE_LBA48 or HAVE_SDUC
    * unsigned long for the everything else
 * Alter all storage APIs to use sector_t instead of 'unsigned long'
 * Alter Volume/Partition/storage info structures to use sector_t
 * Disk cache converted to sector_t
 * ATA Core:
    * convert to using sector_t for sector addresses and drive sizes
    * Always fill out upper 16 bits of LBA48 addresses
    * IDENTIFY INFO is fixed at 512 bytes, not SECTOR_SIZE
 * USB mass storage:
    * convert to using sector_t for sector addesses and drive sizes
    * Implement READ_16/WRITE_16 for LBA48 addresses
 * Convert FAT code to use sector_t for all sector references
 * output_dyn_value() now accepts int64_t instead of 'int'
 * Corrected "rockbox info" to work for (MULTIVOLUME & !MULTIDRIVE)
 * Better reporting of disk and (logical+physical) sector sizes in debug info
 * Detect SDUC cards and report on storage debug_info screen

To-do: SDUC

 * Refactor SD core to remove duplicate code in every driver
   * Card probe and init state machine
 * Implement core SDUC support
   * SD2.0 needs to be 2.0+ (fixed for jz47xx and x1000)
   * Host and Card ID (ACMD41)
   * 32-bit addressing for all read/write/erase operations (CMD22)
 * ADD SDUC to target device drivers, defining HAVE_SDUC as appropriate

Change-Id: Ib0138781a0081664d11511037685503df1b93608
2024-08-12 14:23:44 -04:00
Solomon Peachy
86bff6214d properties: Use talk_fullpath() for voicing directory names
Change-Id: Ib40c881e7b3053e7e4ef5c5adbe5c3bfec27efed
2024-07-28 17:01:53 -04:00
Christian Soffke
23e5f77ab0 Remove mp3info function & remove list_do_action from plugin_api
Change-Id: Ia9a2d6889679832f23b19a989927277ba886cba4
2024-07-26 15:15:06 -04:00
William Wilgus
7e90760a48 [Feature] Playlis to cue plugin
generate valid cue files from a playlist

uses remarks to store extra id3 info and display and playlist index

Change-Id: I00c9f6389445bb601dde6eb8f36157044024f8cb
2024-07-20 07:27:01 -04:00
Solomon Peachy
eb2146d683 plugins: add lang_is_rtl() to the plugin API.
So plugins can put stuff in the correct order, if they care.

Change-Id: Iac322bcb8cf78b37d3caef4c8d7b2a14923669f4
2024-06-18 12:50:52 -04:00
Christian Soffke
3d7d1d4d5b plugins: properties: show track info for whole playlist
Track Info can now be displayed for the set of
all tracks contained in a  playlist. This lets
you calculate a playlist's length, for example,
even if it is not currently playing.

This functionality can be accessed from the
existing "Properties" screen for a selected
playlist file. A line has been added at the
very bottom to show Track Info.

Change-Id: I311532b7cfa9e29d46c0cd5623ba4c06c1dd5b5f
2024-06-01 11:55:36 -04:00
William Wilgus
ee840709d3 [Feature] Open plugins now recognizes known filetypes and can run them
now you can run your lua files without having to add the viewer to
the shortcut or if you want a bmp file to be displayed when you start
the device that can be done as well

Change-Id: Ia56b566789623a2ca78d9e4583086db6e2cd689b
2024-05-06 17:27:25 -04:00
Christian Soffke
ba62798746 Playing Time plugin: Fix calculation for shuffled playlists
Playing Time produced incorrect results when
the playlist's first index wasn't 0.

Change-Id: I1c11b876e0e435c824c9ddc0863fd7ee76bda073
2023-10-31 17:58:17 +01:00
William Wilgus
2e184d129d [FixRed] db_commit
Non Tagcache targets

Change-Id: I0e6c1e8551859863105f97f393b308bca947c6d4
2023-10-05 22:59:05 -04:00
William Wilgus
1ed640da24 [Feature] db_commit plugin allows a more verbose commit
prints logf messages to the screen buffer and dumps the
output to .rockbox/db_commit_log.txt

logs warnings about tags that can't
be displayed by the current font

adds an option to the tagcache using the file
.rockbox/database_commit.ignore to prevent auto commit

Change-Id: Ib381b3b6d9dd19d76c95d0e87e605f7378e29674
2023-10-05 21:24:37 -04:00
William Wilgus
6634a60bf0 tagcache/tagtree remove static buffer from tagcache_get_next
callers can supply their own buffer

Change-Id: I8996ecfb88e30926296a0cb0563cf6c46977323e
2023-10-03 21:54:19 -04:00
Christian Soffke
cb3a6877fc RFC: Turn Playing Time function into plugin
Since this function already requires hitting the
disk, it may make sense to turn it into a plugin.

A minor advantage (apart from cleaning up onplay.c
and saving RAM) is that you can now access the menu
not just from the WPS context menu, but also from
the Shortcuts Menu or using the WPS plugin shortcut.

On the other hand,  TSR plugins would have to be
terminated when Playing Time is launched, as is
already the case for other plugins such as PictureFlow.

Change-Id: Iea85229486887463ffc52f05e33e2340437f69a4
2023-09-20 23:57:39 -04:00
Aidan MacDonald
9ba51e3552 playlist: Remove playlist_add()
It was only used in filetree.c. It's still implemented in Lua so
scripts using rb.playlist_add() won't break, but has been removed
from the Lua API "backend".

Change-Id: I5625a47f0692456008c6b10dee14755151d22f29
2023-07-02 12:14:33 -04:00
Christian Soffke
3ef49d9c5e PictureFlow: Make Shuffle options available
The "Playing Next..." menu couldn't display any
options for shuffling tracks of an album before

Change-Id: I54f4497394fb29877bf8bce0ef95a27c82eb2279
2023-05-27 19:17:52 -04:00
Christian Soffke
43b0fba75d Track Info: Show number of tracks being inspected
Applies to the database and PictureFlow

+ fix red 6ca57ec

Change-Id: If708851ebdfe075e9d6ea3f2e2dd790cc9deac94
2023-04-13 03:55:21 +02:00
Christian Soffke
6ca57ec389 Track Info: Display larger file size and length values
When displaying Track Info for multiple tracks,
the value for combined file sizes or length was
capped at 2 GiB / ~596h.
Limit has been raised by a factor of 1000.

Change-Id: I942c64e81864cba3f719c83a24912883fafeb70e
2023-04-13 02:31:32 +02:00
William Wilgus
a2e5d9563f [Feature] resume TSR plugins after interruption WIP
save tsr plugin path for later

resume tsr plugin when user stops the interrupting plugin

expand return of tsr_exit function to allow
continue, suspend, terminate

tsr plugins check parameter at start to determine if
the plugin is being resumed

Change-Id: I6fc70de664c7771e7dbc9a1af7a831e7b50b1d15
2023-03-25 10:02:43 -04:00
Aidan MacDonald
a64cad847e playlist: Simplify playlist modified detection
Any modifications to the playlist (insert, delete, shuffle, etc)
will cause the modified flag to be set. The flag is cleared when
the playlist is saved. Code that generates playlists can manually
clear the modified flag if appropriate; there is now a proper API
for this so the tagcache and pictureflow don't need to resort to
hacks.

Change-Id: I8d3c723265a41db07a13de3f1d2abb0444528d57
2023-03-23 13:01:23 -04:00
Aidan MacDonald
d40a598970 plugins: Simplify plugin/codec API versioning
Replace the minimum version bound with a check on the size of
the API struct. The version only needs to be incremented for
ABI breaking changes. Additions to the API won't need to touch
the version number, resulting in fewer merge conflicts.

Change-Id: I916a04a7bf5890dcf5d615ce30087643165f8e1f
2023-03-21 16:23:54 -04:00
Aidan MacDonald
5b27e2255a Add perceptual volume adjustment
The perceived loudness change of a change in volume depends
on the listening volume: at high volumes a 1 dB increment is
noticeable, but at low volumes a larger increment is needed
to get a comparable change in loudness.

Perceptual volume adjustment accounts for this fact, and
divides the hardware volume range into a number of steps.
Each step changes the dB volume by a variable amount, with
most of the steps concentrated at higher volumes. This
makes it possible to sweep over the entire hardware volume
range quickly, without losing the ability to finely adjust
the volume at normal listening levels.

Use "Volume Adjustment Mode" in the system settings menu
to select perceptual volume mode. The number of steps used
is controlled by "Number of Volume Steps". (Number of steps
has no effect in direct adjustment mode.)

It's still possible to set a specific dB volume level from
the sound settings menu when perceptual volume is enabled,
and perceptual volume does not affect the volume displayed
by themes.

Change-Id: I6f91fd3f7c5e2d323a914e47b5653033e92b4b3b
2023-01-22 21:19:57 +00:00
Christian Soffke
32f365bf3c database: make parent tables work with plugin
Enables the use of PictureFlow and the Properties plugin
with parent tables of ALLSUBENTRIES, such as an album
or album artist, instead of individual tracks.

Change-Id: I18c4779ed116a48c732ae32b9629e7e0d93ce7c8
2023-01-19 15:56:35 -05:00
Aidan MacDonald
f995c26de9 buflib: Add CONFIG_BUFLIB_BACKEND for selecting a buflib backend
Defaults to the normal "mempool" backend, which is currently the
only implementation.

Change-Id: I56d034a6e0f5edc90c39526d1551945eec6ca336
2023-01-15 10:04:13 +00:00
Aidan MacDonald
680261fbb7 buflib: Prep for multiple backend support, rename to buflib_mempool
Rename the current buflib implementation to buflib_mempool.

Change-Id: Iefdf74be1f7d8fcd19e6ce2289c3d1459b54d013
2023-01-15 10:04:13 +00:00
Christian Soffke
e61a5c957c PictureFlow: Add ability to insert into playlists
Songs or albums can now be added to new or
existing playlists directly from PictureFlow.

Change-Id: I6ea27e393fee0d5688385f9e91cf835be1756a7a
2023-01-14 19:44:11 +01:00
Christian Soffke
1e4ee1917c Fix red in 7f265ee
Change-Id: Ib2496af0ed6176ea537e1f61804c1ba514374fb6
2023-01-14 19:40:29 +01:00
Aidan MacDonald
1e9ad3ca0d Remove buflib allocation names, part two
Remove allocation names from the buflib API and fix up all callers.

Change-Id: I3df922e258d5f0d711d70e72b56b4ed634fb0f5a
2023-01-13 10:32:54 +00:00
Christian Soffke
a513cee822 PictureFlow: Add 'Track Info' for tracks or whole albums
Context menu gains new option to view
metadata for individual tracks or albums.

Will display an album's length and total file size.
Other fields are displayed only if they are identical
across all tracks (except for the album year, which
is determined by the highest value encountered).

Change-Id: Ibc14cfaf2cb3d91b8d1cfbee05c6261db4975355
2023-01-10 18:50:12 +01:00
Christian Soffke
b444ecfca2 plugins: Properties: Add 'Last Modified' for audio files
In commit f3358eb, the Properties plugin started using the
Track Info screen for audio files, which didn't show when
the file was last modified. This adds it back.

Change-Id: I3ce519da234a4bcadab1d64b67de0298cada8f6e
2023-01-06 19:00:24 +01:00
Aidan MacDonald
34a092a997 rbcodec dsp: Replace enum dsp_ids arguments with unsigned int
Because casting to and from "enum dsp_id" just adds noise,
change everything to unsigned int.

Change-Id: I52a7ae55f406e673d5b811b29657fcdc4b62ab10
2022-12-22 18:00:37 -05:00
William Wilgus
1930ca8d66 remove rockboxlogo after boot INIT_ATTR
nets about 5k on clipzip  (less on mono, more on others)
to move rockboxlogo to .initdata section

Remove show_logo completely and move to main.c
remove plugin stub
give credits plugin its own copy
credit fallback is now show_info()

Change-Id: Id9ed787e605ed29e7ab1e7a74d3821cd0f840ed4
2022-12-19 18:59:59 -05:00
Aidan MacDonald
6c52fa139c Remove browse_context_init()
Prefer to use designated initializers to avoid having to specify
unneeded parameters. Non-initialized members are zero-initialized
by the compiler.

Change-Id: Ia6a03c45cb3ef0b30f458d7d0ae1604a350c737c
2022-12-17 13:36:38 +00:00
Aidan MacDonald
701e262d3d settings: Remove setting ID return from find_setting()
Now that all users have replaced setting IDs with direct pointers,
find_setting() and friends don't need to return an ID value.

Change-Id: I8c5c31bb68d3bca5350d43538335265a55fd5517
2022-12-17 13:36:38 +00:00
Christian Soffke
498988d34a PictureFlow: Minor fixes & changed defaults
- Fix FPS counter overlapping
the artist string when
"Show album title" was set to
"Show album and artist at the top"

- Fix disappearance of center album
if certain Settings menus had been
accessed while list of tracks was
showing and you then returned to the
list of albums

- Fix disappearing album artwork after
cache had been created until you started
scrolling

- Enable context menu even if WPS
integration is disabled

- Make splash screen appear only
on first launch and for database
updates, when it is actually on screen
for long enough

- Eliminate 'Loading' splash if tagcache
is in RAM

- Show both album and artist by default on
displays whose height > 100px

Change-Id: Ie70c0d9093789294d288a4f88338ee4a588bf4a5
2022-10-22 09:33:50 +02:00
Solomon Peachy
418169aff8 Revert "Remove YUV blitting functions and LCD modes"
This reverts commit fe6aa21e9e.

Change-Id: I8bb1e5d6c52ed1478002d2140ef494ec5d62b8e3
2022-10-13 11:08:06 -04:00
Aidan MacDonald
1c5a0497cf gui: Remove list "limit_scroll" member
Get rid of the "limit_scroll" member from lists and make it a
local variable of gui_synclist_do_button().

Bump plugin API version since struct gui_synclist was changed.

Change-Id: Ie3244a85e5a1022a2f6e238a506fdbba67724962
2022-10-05 11:23:01 -04:00
Aidan MacDonald
d5a081cbd1 gui: Remove "enum list_wrap" from list action functions
Removing the "list_wrap" argument is actually pretty easy.
In practice, almost all lists are using LIST_WRAP_UNLESS_HELD
behavior so we can make that the default. A couple of lists
disable wraparound with LIST_WRAP_OFF; this is now achieved
by setting the list "wraparound" flag to false when setting
up the list. LIST_WRAP_ON was unused and is of questionable
value, so it has been removed entirely.

This makes list wraparound behavior a property of the list,
controlled solely by the "wraparound" flag. The result is a
simpler list API and implementation, without changing the
behavior of any lists.

Change-Id: Ib55d17519e6d92fc95ae17b84ab0aaf4233bcb5a
2022-10-05 11:22:55 -04:00
Aidan MacDonald
ff378deb69 gui: Remove gui_synclist_limit_scroll()
Since gui_synclist_do_button() overrides the setting at runtime
there is no reason to have a public API call to set it. Really
it should be a local variable, but it will be simpler to do that
after refactoring how list wraparound behavior is handled.

Change-Id: Id09d42197814102693752a9f64db8325118ca796
2022-10-05 11:22:34 -04:00