Commit graph

36284 commits

Author SHA1 Message Date
Aidan MacDonald
fe6aa21e9e Remove YUV blitting functions and LCD modes
None of this is needed now that mpegplayer is gone.

Change-Id: I360366db8513e4d988021e8d7b7d8eb09930efb8
2022-10-03 13:30:01 +01:00
Aidan MacDonald
b371ff1f47 mrobe500: Fix missing parentheses in #define
Change-Id: Ifbba50a951fb3212eabe430dfef6868a7ad5e391
2022-10-03 13:29:52 +01:00
Solomon Peachy
d25d24812e RFC: Get rid of mpegplayer plugin
It might have made sense once upon a time, but in today's world...

Change-Id: I5d638e6f7a2308c50ab12bd901338f02cf426aae
2022-10-02 11:57:20 -04:00
Aidan MacDonald
9ce5b2a2ed gui: Remove show/hide selection option in lists
The implementation of the "show_selection_marker" option in
lists isn't great. It's a cosmetic option used to hide the
selection, but it causes the list to do funny things to the
selected_item and doesn't play nice with voiced menus, since
these rely on the selection to determine what item is spoken.

There are only two user-facing lists that use the option, the
"Rockbox Info" screen and a menu in the superdom plugin. The
rest are debug screens, and cosmetics don't matter much there.

Given how little used the option is, and its issues, removing
it seems reasonable.

Change-Id: I2c70b3e4c74ff3cc6dbac46366a371d271dd2d58
2022-10-02 09:21:25 -04:00
Aidan MacDonald
c1d75a6bcb Fix yellow from 5b0506e9de
Change-Id: I6391a6f13e64fad5c54dd29d8d696a08d45362dc
2022-10-02 13:57:52 +01:00
Aidan MacDonald
5b0506e9de gui: Constify list title text
Use const char* pointers for list titles. Only one debug menu
actually modifies the title, and in that case it's legal to
cast away const because the title points to a known mutable
buffer on the stack.

Change-Id: Idb8ab307b9a6ec23a93d8420c5e19fafd9f59c30
2022-10-02 08:20:10 -04:00
Aidan MacDonald
420fb1163c skin engine: Fix bug with %Vs(color) tag
The %Vs(color) tag doesn't set the text style properly and causes
the background to not be cleared when rendering lines. For static
text this is rarely a problem, but for scrolling text it'll cause
the text to "smear" once it starts scrolling.

Fix this by setting STYLE_DEFAULT, so the background gets redrawn
when the line scrolls.

Bug report: https://forums.rockbox.org/index.php/topic,54320.0.html

Change-Id: I835c806005ea40fd6bac3692e52a9c325581a293
2022-10-01 12:58:00 +01:00
Aidan MacDonald
3bc6408bbe lcd: Fix incorrect use of LCD_STRIDEFORMAT for remote LCDs
The get_address_fn implementations for some remote LCDs were
checking LCD_STRIDEFORMAT unconditionally, but that macro is
only valid for the main LCD. The remote LCD code only supports
horizontal strides, so when compiling for a remote LCD, force
the use of horizontal stride addressing.

This fixes a buffer overflow and out of bounds write that occurs
with the M:Robe 500 remote LCD. (Tested with sim + ASan only.)

Change-Id: I99c6aa11d38f5105b096fc448948b9ec1b27dfe6
2022-09-30 10:49:39 +01:00
Aidan MacDonald
f373c97c90 Define LCD_STRIDEFORMAT unconditionally
Instead of putting "#ifdef LCD_STRIDEFORMAT" at every usage of the
macro it's simpler to have config.h define LCD_STRIDEFORMAT to the
default of horizontal stride when the target leaves it unspecified.

Change-Id: Ib187012aad65ac678dbd837b1464a83bad722411
2022-09-30 10:42:49 +01:00
Solomon Peachy
9ed36ec22f FS#13361: Fix some compilation under MacOS (Michael Landherr)
Change-Id: Id7e0576e355a1d71493fb7b277fd92f38b7edab4
2022-09-27 10:00:03 -04:00
Aidan MacDonald
09cb3c7843 lcd: Remove HAVE_VIEWPORT_CLIP
This was only enabled for the mrobe500 and sansaconnect targets.
Most targets are therefore running without this "safety" measure,
and presumably we'd have noticed long ago if there was a problem.
So in all likelihood this is just a bunch of dead code that we
don't need to carry around.

Change-Id: I7d27701a38b1c2a985ee73fa6f277ad215d8d385
2022-09-27 14:13:15 +01:00
Solomon Peachy
24daa26598 FS13356: Update Polish Translation (Adam Rak)
Change-Id: I6ee55f2a6024411515670fc1249268b66aad09bd
2022-09-25 18:28:04 -04:00
Solomon Peachy
36ea69b27e FS#13365: Updated Italian translation (Alessio Lenzi)
Change-Id: Idbb6d58667a153d0381252da64383423d383471f
2022-09-25 16:15:30 -04:00
Aidan MacDonald
464889ecee Fix red in e75a3fb8
Change-Id: I2e98f68d03df757688b6c556b69d934c12f40a7c
2022-09-25 12:23:40 +01:00
Aidan MacDonald
e75a3fb8c7 usb: add debounce interval for USB status by event
This makes status by event debounce status changes over
a 200ms period, which is what polling was already using.

This is helpful on targets where events are excessively
noisy and generate a lot of transitions during insertion
and extraction.

Change-Id: I0eae2cca93aaa865e33c94a1318c27e91c7f7c4b
2022-09-25 06:49:11 -04:00
Aidan MacDonald
e4aec7d648 key remap: simplify and use movable allocations
Have action.c control the key remap buflib allocation so that it can
be made movable. With memory management offloaded, core_keymap.c only
needs to deal with loading keymap files. Simplify the code there and
use buflib pinning so the file can be loaded directly into the buffer.

Change-Id: Ia654cc05ce6b286f96c1031fa4f7d4b3859a2c1a
2022-09-25 11:05:59 +01:00
Aidan MacDonald
f47aa584a8 buflib: add pin/unpin operation
An allocation is pinned by calling buflib_pin() to up its pin count.
The pin count is like a reference count: when above 0, buflib won't
move the allocation and won't call its move callbacks. This makes it
safe to hold the pointer returned by buflib_get_data() across yields
or allocations.

Note that pinned allocations can still shrink because there are some
use cases where this would be valid, if buffer users coordinate with
the shrink callback.

Change-Id: I0d0c2a8ac7d891d3ad6b3d0eb80c5b5a1b4b9a9d
2022-09-19 15:09:51 -04:00
Aidan MacDonald
ecfec3e9bf buflib: add handle_to_block_end
Change-Id: I598cf32bc8cd08ab4bca3827645e0a38b284468f
2022-09-19 15:09:51 -04:00
Aidan MacDonald
88b21731fc buflib: enable all paranoia checks
Since allocation is infrequent in Rockbox enabling the extra
checks to catch memory corruption is probably worth the time
and code size cost.

Change-Id: If0d701421054328c57b69e4d0af30759d799d158
2022-09-19 15:09:51 -04:00
Aidan MacDonald
8f896b14d3 buflib: remove the 'name' member from union buflib_data
Using a length 1 char array to point to the name buffer triggers
a -Warray-bounds warning from GCC when fortified strcpy is used.

This type of construct isn't safe in general -- if the compiler
makes assumptions based on the array bound it can create subtle
bugs when accessing the array out of bounds.

Instead, add a function get_block_name() which returns a pointer
to the name field by casting. This suppresses the warning and it
should be a bit more portable.

Change-Id: I25d4f46f799022ad0ec23bef0218f7595cc741ea
2022-09-19 15:09:51 -04:00
Aidan MacDonald
6e9b1b344b buflib: remove buflib_print_allocs / buflib_print_blocks
These don't have any users and there is already another way to
print blocks (which is actually used by the debug menu).

Change-Id: Ic6a4f874c6499c42bc046e8af3e4aaddc9e68276
2022-09-19 15:09:51 -04:00
Aidan MacDonald
3090cf0da4 buflib: update BUFLIB_ALLOC_OVERHEAD
Allocation overhead should be 5 units, not 6.

Change-Id: I30aa0925aa49eb25d232f7de2bf8b8ce1509d862
2022-09-19 15:09:51 -04:00
Aidan MacDonald
59edcc57a2 buflib: omit CRC field if CRC paranoia is not enabled
If we don't check or generate CRCs then the CRC field can be left
out of the header, which reduces buflib overhead slightly.

Change-Id: I08b4cf77a701d8f6da453e019a0373d858a79ae4
2022-09-19 15:09:51 -04:00
Aidan MacDonald
dcc4e54b77 buflib: refactor CRC checks as paranoia
Move CRC checking and updating behind a paranoia bit, like the
other checks, so it can be enabled and disabled.

Change-Id: Icff66c842cbd5af2d99aa91e6c40447a64e6d4b2
2022-09-19 15:09:51 -04:00
Aidan MacDonald
f82f3044a7 buflib: add paranoia checks for handles
Handle checks ensure that the data in the handle table points
within buflib memory and checks handle entry pointers in block
headers before dereferencing them.

Change-Id: Ic16f1b81c1a0ea63c0e7f48d87938293b75c2419
2022-09-19 15:09:51 -04:00
Aidan MacDonald
73b9b227eb buflib: add block length paranoia checks for loops
Tighten up checking by adding length checks to loops which
ensure the iteration stays within bounds. Check is disabled
by default and can be enabled using a BUFLIB_PARANOIA bit.

Change-Id: I35e911e0878797d5ebf732be548ca659f6910fe0
2022-09-19 15:09:51 -04:00
Aidan MacDonald
b12427741a buflib: clean up and refactor to improve maintainability
Buflib is written with a lot of hardcoded offsets to header fields,
arbitrary pointer arithmetic, and similar but not quite duplicated
code, making maintenance a nightmare.

Most of the pointer arithmetic involving header fields is replaced
by indexing from two well-defined pointers, the block start and end
pointers. The start pointer points to the first header field, and
he end pointer is one past the end of the header.

Hardcoded field indices are replaced by two enums. Forward indices
(fidx_XXX) are used to access fields from a block start pointer and
negated backward indices (-bidx_XXX) are used to index from a block
end pointer. There is no overlap between the indices because of the
variable length name field in the middle of the header. The length
of the fixed fields in the block header is now a #define'd constant
rather than being open coded.

There is now a function to acquire the block end pointer from the
user data pointer (ie. the pointer stored in the handle table). The
old code was not consistent in this; some functions would handle a
non-aligned user pointer, which may occur as a result of shrinking,
while other uses just assumed the user pointer was aligned.

Block CRC calculations have also been factored out to a function
that accepts block start and end pointers.

Change-Id: I6a7e8a8c58aec6c6eaf0e5021400032d8e5f841e
2022-09-19 15:09:51 -04:00
Aidan MacDonald
fdde6bb5a7 buflib: optimize getting start of block from end of block
The block header has a variable length due to the embedded name.
The name length is stored at the back of the header after the
name, in order to allow finding the start of the header if only
the user data pointer is known (eg. from the handle table).

The name length is actually not interesting in itself; storing
the total length of the block header instead is marginally more
efficient, saving one addition in handle_to_block().

Instead the extra arithmetic must be done by buflib_get_name(),
which is a much less common operation than handle_to_block().

Change-Id: Ia339a1d2f556a11a49deae0871203e70548bd234
2022-09-19 15:09:51 -04:00
Aidan MacDonald
ef476ba298 buflib: correct a confusingly indented comment
Change-Id: I9ef13d697c4abb81883d4a47273e69fcc2dafe37
2022-09-19 15:09:51 -04:00
Aidan MacDonald
c8365b2bdd buflib: fix bug in handle_table_shrink
The way it iterated over the handle table is unsafe if *every*
handle is free, leading to an out of bounds access.

This is a contrived example, but the bug can be triggered by
making several allocations, freeing them out of order so that
the handle table remains uncompacted, and then triggering a
compaction using buflib_alloc_maximum().

Change-Id: I879e2f0b223e6ca596769610ac46f4edf1107f5c
2022-09-19 15:09:51 -04:00
Aidan MacDonald
4d3bf1c446 buflib: add comment in handle_alloc, remove a dead store
It isn't obvious why the "handle->val = -1" at the end of handle_alloc
is needed so add an explanatory comment. But "handle->val = 1" prior to
calling handle_free is simply a dead store.

Change-Id: I9ab4e96e87e940cfd1a2ed56f089287821669c73
2022-09-19 15:09:51 -04:00
Aidan MacDonald
840f6b79c7 buflib: update first_free_handle in handle_alloc
Since we're scanning the handle table for the first free slot,
we know none of the scanned slots are free. Use that knowledge
to update first_free_handle and avoid rescanning filled slots
again when the next handle is allocated.

Change-Id: I457372f66c231168cfffa7e905d1e9fb80002f5f
2022-09-19 15:09:51 -04:00
Aidan MacDonald
f622bcfe4f buflib: fix buflib_context_relocate alignment check
Use the standard IS_ALIGNED macro and check alignment against
sizeof(buflib_data), as it can be greater than 4 bytes if we're
on a 64-bit platform (eg. simulator).

Change-Id: I15110937d1f2978e733d169050de9531fe218214
2022-09-19 15:09:51 -04:00
Aidan MacDonald
bcaa9465e9 buflib: optimize find_block_before
Exiting the loop implies next_block == block, so remove that check.
The check ret < block is false only if block is the first block, which
can be checked before the loop, saving a few cycles in that case.

Change-Id: Id493b5259a23a35a70b09dfe4bc4eacaf420760c
2022-09-19 15:09:51 -04:00
James D. Smith
6beebd75e7 Cabbie v2: 240x320: Increase font size to 18. Remove linespace and increase the size of the album art slightly to better utilize the screen area.
Change-Id: Id20097006c9f82e1bb8a758c4edd94dc278c669f
2022-09-18 11:09:38 -06:00
James D. Smith
38a0f1a96f Cabbie v2: Place album above title and track on the WPS. The idea is to have the album immediately beneath any album art.
Change-Id: I8c5fe85207bb3ecfde131710170ef7a5f801f312
2022-09-18 09:26:23 -04:00
Aidan MacDonald
972c8c0ab6 Suppress bogus GCC 12 -Waddress warnings for SKINOFFSETTOPTR
This appears to be a bug in GCC 12 due to more aggressive -Waddress
warnings. According to the GCC documentation, the warning should be
suppressed because the "problem" code is coming from a macro, but it
doesn't happen for cases like "if(!SKINOFFSETTOPTR(...))" where the
macro is negated.

Assigning the result of SKINOFFSETTOPTR() to a temporary and checking
that suppresses the warning.

Change-Id: Ia37a1e06a454d29032bb8128a2f059b149ea2b83
2022-09-18 13:53:27 +01:00
Aidan MacDonald
bab8a41532 x1000: add support for GD5F1GQ4xExx NAND flash
This is another chip used in newer Surfans F20 units. Like the
Winbond chip, it's a 1-gigabit chip with on-die ECC. Notably it
has an expanded 128-byte OOB area that is only accessible when
on-die ECC is disabled.

Change-Id: I2203918a15c914097f5a6bbe4afa2d3a60dc67f7
2022-09-17 10:14:26 -04:00
Aidan MacDonald
e64b0e81ad x1000: add support for the W25N01GVxx NAND flash
This chip is apparently used in some Surfans F20 units, and has
the same geometry as the ATO25D1GA. It has an on-die ECC engine.

Change-Id: I4d37a2455620ce43cec0a9bcbb32c776d1a8eba1
2022-09-17 10:14:26 -04:00
Aidan MacDonald
17443de221 x1000: refactor NAND chip identification
Decouple chip IDs from chips, and allow the chip ID table to list
which read ID method should be used. Use a safe controller setup
during identification instead of using the first chip's parameters.

Change-Id: Ia725959c31b2838f4a3a30e5bb7fa6652ef377ed
2022-09-17 10:14:26 -04:00
Frank Gevaerts
189dee08ea rockboxdev.sh: Mention older NWZ for the arm toolchain.
The description for arm-linux mentions "Linux-based Sony NWZ", which
is misleading for people who aren't very familiar with the various
targets and history. People setting up toolchains for the first time
for their "traditional" NWZ will overlook the "linux" part (or not
understand what it means) and build the wrong compiler.

Mentioning "older Sony NWZ" may of course not immediately tell those
people which one to pick, but at least they'll know they need to look
things up.

Change-Id: I5743a6427842db7334cff5479291e2137c35ae0c
2022-09-17 09:01:43 -04:00
Christian Soffke
3f3b738e06 Partial fix for FS#12702: playlist catalogue silently fails to save files
Change-Id: I13130f6b257b38e7a0d8ae22accd182330ff4e9f
2022-08-21 09:36:04 -04:00
Benjamin Brown
a6e9ecb086 Updated keymaps for Sansa Connect
* added scroll wheel to doom
   * added scroll wheel to brickmania
   * changed spacerocks to use scroll wheel instead of buttons

Change-Id: I9d6ff0b4c5deea147178f5cd9f96ae435e7b5cd8
2022-08-19 00:31:00 -04:00
Christian Soffke
c1c0318c8d Playlist Viewer: Fix unintentional fallthrough
Change-Id: Iead5635e0e7f20dc556f26f735fd47597c9169b6
2022-08-19 00:29:17 -04:00
Christian Soffke
5e757b4d6e Playlists: Fix losing cached control data when resuming
Shuffle and Unshuffle commands are not flushed to
disk when control data is updated. The same applies
to Delete and Reset commands, unless HAVE_DIRCACHE
is undefined (see update_control() function in playlist.c)

playlist_resume() discards cached control data.

This resulted in a bug where (e.g.) removed tracks
from the current playlist would reappear if you stopped
and resumed playing immediately afterwards (instead of
restarting in between).

Change-Id: I273f61e823a1d99426a18079b81aa07915620f30
2022-08-19 00:28:35 -04:00
Christian Soffke
8f6d0efd71 tagtree: Delay showing search progress when ramcache is enabled
The disk doesn't need to spin up when the
database is in RAM. Results are usually returned
without any noticeable delay, so the splash  only
creates distraction.

Change-Id: I04e5b7d2e00f045143dd86e0561091be3d8f9724
2022-08-19 00:27:34 -04:00
Christian Soffke
cf37676fb1 pictureflow: fix FS#13360 softlock cannot be disabled
Change-Id: Id34cc737f9d43a5cbaf5519a6f05ca31efbee8f2
2022-08-16 13:19:11 +02:00
Christian Soffke
7a3d829543 pictureflow: fix stack overflow
I noticed a stack overflow on the Fiio M3K when launching
PictureFlow from the Playlist Viewer after opening a playlist
from the file browser using the context menu's "View" option.

Change-Id: Id87fb59e36518bd7ceb61f886d5759fc3206aadf
2022-08-16 13:18:43 +02:00
Solomon Peachy
d4917888e3 Fix yellow introduced in cef9fa22ef
(Wrap new function in HAVE_HOTKEY)

Change-Id: Idf5f96bd1e097fc580a6b1ba5be4b93a78de9deb
2022-08-05 14:05:33 -04:00
Christian Soffke
cef9fa22ef playlist viewer: enable hotkey
'File Browser' hotkeys can now be used while
browsing a playlist.

The manual has been updated to reflect this and
to say that the File Browser hotkey works in
the context of the database as well (existing
behavior)

Change-Id: I51b23e82e0fb00772efdb8784db966d454fb2560
2022-08-05 11:39:35 -04:00