Commit graph

36591 commits

Author SHA1 Message Date
Aidan MacDonald
e492b51d83 buflib: Remove block start / end distinction
Removing the variable-length name in the middle of buflib metadata
makes it a lot easier to deal with.

Change-Id: I6eaf236c2285cae40fb6ff0fa5acf827972cdd8b
2023-01-13 10:32:57 +00:00
Aidan MacDonald
5a3ee83555 buflib: Remove CRC checks
The CRC is a fairly useless safety check because we already
have specific checks to validate the metadata, and CRCs are
only verified before calling the move callback. Removing the
check should not significantly reduce buflib's robustness.

Change-Id: Ica99bd92fc514819b4fd9f359b4272e581020f75
2023-01-13 10:32:57 +00:00
Aidan MacDonald
31f03d9433 buflib: Optimize away the BSIZE metadata field
Now that allocations are unnamed, BSIZE is a constant.

Change-Id: Iab52cbebe426ea0d12f428582347e20ed243367f
2023-01-13 10:32:56 +00: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
Aidan MacDonald
3301c5aa6d Remove buflib allocation names, part one
Remove the name handling code, but leave the allocation structure
otherwise untouched; it's as if all callers provided a NULL name.
The public API still accepts names but names are no longer stored
or returned.

Change-Id: I6c4defcdfd255774f02030949a0fd731477e6a54
2023-01-13 05:12:17 -05:00
Aidan MacDonald
879888b158 Avoid using buflib names for storing font paths
Naming your allocations is more of a debugging feature; it's a
bad idea to abuse this feature for storing some random string.
The font code does exactly that to remember the path used to
load a font, and it's the only code that uses buflib names in
this way.

Store the path inside the font allocation instead as a regular
char array. For simplicity it's MAX_PATH sized, so this'll use
a bit more memory than the buflib name method, maybe 1-2 KiB if
a few fonts are loaded.

Change-Id: Ie286a1a273d6477af9e5d3f76e0534b62f72e8f7
2023-01-13 04:54:05 -05:00
William Wilgus
ebebef5566 keyboard.c make editline respect current UI font
Change-Id: I4dc95d42544a10df8086cc58c4a305d45b56bb1b
2023-01-13 01:36:45 -05:00
William Wilgus
2d9cb673e5 add chunk_alloc to playlist.c #2
dc_thread_playlist was asking for invalid indices
since previously the name buffer would have been valid
it just got whatever junk data was left over

add dc_discard_playlist_pointers for HAVE_DIRCACHE targets
this allows the dc_playlist_thread to stop its current lookup loop

Change-Id: I6f25b97b8c4e314d27c5e1e6ff0925b5a3e93f26
2023-01-12 19:36:38 -05:00
William Wilgus
00c7817c9c [BugFix] playlist.c DIRCACHE stop scanning when changing indices
dc_playlist_thread may continue loading pointers even while
underlying indices are changing instead stop the loop by marking
pointers as clean and rebuild later

Change-Id: If154f673b4af8d6e9c364499d58f1321834a76a4
2023-01-12 19:36:38 -05:00
Aidan MacDonald
16a32c576c Fix red in 7e5fc4076a
Change-Id: I1704ea0de243bff05262556723daea5b3531558b
2023-01-12 11:56:47 +00:00
Aidan MacDonald
7e5fc4076a Add INIT_ATTR to i2c_init()
It's usually only called from init() in main.c, so this is safe.

There is one more call in system-dm320.c from system_init(), but
that's also "safe". I don't know if it's okay to call i2c_init()
twice, but presumably it works...

Change-Id: I9c1cd918d162d9955f7cf03209e836cbd5e30c57
2023-01-12 06:33:50 -05:00
Aidan MacDonald
39439f6909 Add INIT_ATTR to system_init()
On single-core targets, system_init() is only called from init()
in main.c, which is also INIT_ATTR, so this is safe.

Multi-core targets additionally call system_init() from cop_main(),
which isn't marked INIT_ATTR. I'm fairly certain that it would be
safe to add INIT_ATTR to cop_main() with a bit of refactoring, but
I don't have a way of testing it. So for now, leave INIT_ATTR off
for multi-core targets.

Change-Id: I8fe4358f975880ca317d46bda01d7d9db529d3e3
2023-01-12 06:05:55 -05:00
Aidan MacDonald
541960a110 rbcodec/dsp: restore configure loop in dsp_init() (FS#13386)
It seems removing this causes a crash on the Clip+ when playing
any file. Appears to be a timing-related issue as replacing the
loop with an mdelay() also fixes it. Needs further investigation
to identify the real cause of the problem, see FS#13386.

Change-Id: Ia93a2887a79b376de50563d6bb3bbc79cee11a1c
2023-01-12 04:56:06 -05:00
William Wilgus
746fd7f2db Revert "add chunk_alloc to playlist.c"
This reverts commit 89c021fbfa.

Reason for revert: crash when playing on disk playlist then playing a directory as an in-ram playlist

Change-Id: Ia5cf5da9f46f8c10c5c0f3707e7978c05664b8a4
2023-01-11 01:14:22 -05:00
William Wilgus
89c021fbfa add chunk_alloc to playlist.c
Change-Id: Ia2e02a61f0b269dc0508717a56a2ca1a334d2378
2023-01-10 23:59:19 -05:00
William Wilgus
7faf6be35f chunk_alloc
chunk_alloc allows arrays (or any data) to be allocated in smaller chunks

you have to save the indices..
 variable data will have variable indices you need to
 store these as [chunk_alloc] doesn't keep track
 if you have a fixed size for each
 alloc you can do indice / sizeof(data)
 or index * sizeof(data) to convert

Lots of debug stuff still in and it needs optimization

User provides chunk_size and max_chunks
max_chunks * struct chunk will be allocated at start
with (1) chunk_size allocation initially

alloc_chunk() with size = 0 shrinks the last allocation to the size of the data used

add OOM checks on buflib_alloc -- oops

move bytes available to the header -- less memory per chunk & better alignment
keep track of the current in use chunk index -- should speed things up a bit

Now allows:
realloc chunk header
larger allocations than chunk size

reallocs smaller than existing will shrink the current array
rather than alloc a new and copy data

Comments welcome :)

Change-Id: I8ed170eef73da95da19430a80b32e5debf0c8276
2023-01-10 23:59:19 -05: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
d5e38062ea Fix hotkey strings
missed in 7d13c0c

Change-Id: I7299b6a646dc143943b2c8d1d89ecdc4a16667c7
2023-01-10 17:05:53 +01:00
William Wilgus
3694314058 [BugFix] voicefont.c buffer overflow
voicefont.c expected a max of 999 voice IDs we are at 1013 or so
bad stuff happened TM new limit is 2048 and added an error message
(no file will be created if limit exceeded)

Change-Id: Ifda6dc5c45883551f8ae8f0d4efc9f7acdb7c90f
2023-01-08 15:43:05 -05:00
William Wilgus
282a54b23c [Feature] filetree fallback to loading a playlist from disk
give user option to load playlist from disk when
namebuffer is too small -- max_playlist size still
limits the total entries but filename length
 won't stop them from playing the directory

Change-Id: I1787689417661ea670a211f575f2c52e84465869
2023-01-08 09:52:23 -05:00
Aidan MacDonald
593103cd8b lcd: Fix 4bpp optimized 16-bit alpha blit
Fixes a bug introduced by commit 5d0c382a59 that caused graphical
corruption on anti-aliased fonts.

Change-Id: I6052ca758382bd9a1154d2e2208dee633dd17715
2023-01-08 10:50:39 +00:00
Christian Soffke
528b6a9a15 manual: Update screenshots
Change-Id: I264210ee0a759fc3a7e89578f7d9d32d58dfd609
2023-01-07 19:48:26 +01:00
Christian Soffke
7d13c0c4eb Rename "Playing Next..." menu items & hide Queue/Shuffle
"Play Next" instead of "Insert Next"
"Add" instead of "Insert"
"Play Last" instead of "Insert Last"
"Add Shuffled" instead of "Insert Shuffled"
"Play Last Shuffled" instead of "Insert Last Shuffled"

-"Queue" items hidden by default
- Shuffled options hidden by default
(Both can be enabled in options)

Resulting default menu:

Playing Next...
	Play Next
	Add
	Play Last
	Play

Change-Id: Ib0c07a8077ab4b10c2dbc7af33516adcd0d4b83a
2023-01-07 16:32:22 +01:00
Christian Soffke
ed95892a1f Rename “Current Playlist” and “Playlist Catalogue” context menus
Use action-oriented and more descriptive titles

"Add to Playlist..." instead of "Playlist Catalogue"
- "Add to Existing Playlist" instead of "Add to Playlist"
- "Add to New Playlist" (unchanged)

- "Playing Next..." instead of "Current Playlist"

In WPS context menu:

- "Current Playlist" instead of "Playlist"

Change-Id: I5cce9e317676537988682f46ac6b920598af3b9e
2023-01-07 14:53:36 +01:00
Christian Soffke
21ca64d7cd File Browser: Add “Set As..." context menu
Moves options for configuring:

- Playlist Directory
- Recording Directory
- Start Directory

into a single menu.

Necessary prerequisite for giving the
"Playlist Catalogue" context menu item a title that's a
little more action-oriented ("Add to Playlist…”).

Change-Id: I4ee08fc67d5350c38ae1a57cb345c4ed1082d0b5
2023-01-07 14:53:36 +01:00
Aidan MacDonald
5bb062391f playlist.c fix old out of bounds read
In case next_index == -1, this would read before the start of
the playlist->indices buffer.

Change-Id: I0a32a31c7c97c755a1217b8bea90a650f9e36a93
2023-01-06 14:19:28 -05:00
Aidan MacDonald
5d0c382a59 lcd: Rewrite 16bit alpha bitmap blit
Avoids a harmless out of bounds reads in ASAN that occurs with
malloc buflib. Code size and performance is similar.

Change-Id: I1c674d046b069e64ad8cb6941356f7c568a81e88
2023-01-06 13:54:09 -05: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
Christian Soffke
5750eb3181 browse_id3: Only push activity when called from WPS
The Properties plugin and playlist viewer have each
started using the existing Track Info screen.

In both cases, it may not be necessary to push a new
activity. Which eliminates the need to perform an
additional skin refresh.

I've also noticed at least one theme in the wild that
assumes ACTIVITY_ID3SCREEN will only ever display
info for the currently playing track (as it did
previously) and adjusts the skin specifically for
that purpose.

Change-Id: Ic436d0d4e075a865225839a524387ff2b9058428
2023-01-06 12:50:18 -05:00
Christian Soffke
8366b8511d Fix red in 9bd5249
Change-Id: I4aa18b4afd68e35b1af5fe40dc02cc406ee31978
2023-01-06 06:38:57 +01:00
Christian Soffke
9bd5249445 plugins: Credits: Fix logo sizes
Commit 1930ca8 repurposed the 'Logo' plugin's
logos, whose dimensions are different from those
used by show_logo, which was previously called
to display the logo.

Change-Id: I4d0c5f597dadfdadae244d895518bbcfefebb581
2023-01-05 23:45:41 -05:00
William Wilgus
9367ef1ed6 [BugFix] Fix some Shif related UB -- ASAN
these are the low hanging fruit identified by ASAN

cast the byte values before shift

Change-Id: Ifc5645354a10c15ccd09d1343e1705857a51e011
2023-01-04 22:00:25 -05:00
William Wilgus
ea33e66021 [BugFix] Buffering.c NULL src for memcpy is UB -- ASAN
No clue if our implementation would suffer the same fate
but the C standard states:
Where an argument declared as size_t n specifies
the length of the array for a function, n can have
the value zero […] pointer arguments on such a call
shall still have valid values, as described in 7.1.4.

Change-Id: Iee0dd9c948c6ad4b0d96309053127ab11111f04c
2023-01-04 20:20:08 -05:00
Aidan MacDonald
a23ae63a31 Increase maximum files in directory limit
Increase the default limit to 5000 files for targets with at
least 8 MiB of RAM (the vast majority). The upper limit of the
setting is now 40,000 or 100,000 if you have at least 8 MiB or
16 MiB of RAM, respectively.

Update the manual to mention that this setting can also impact
the database browser. "Using the Database" already mentions it,
but it's useful to say so in the setting's description.

Change-Id: I6f204eec6cf2ccaea2af81d2fa287f92476eed4a
2023-01-02 20:55:48 +00:00
Aidan MacDonald
9d6f9441ae manuals: Update warning on max entries in file browser / playlist
These settings have a warning that increasing them will shorten the
audio buffer. This is not very useful, because users might not know
what "shortening the music buffer" implies.

Since the size of the audio buffer is probably irrelevant for flash
based storage, display the warning only for HDD-based targets, and
explain what the drawbacks may be if the settings are set too high.

Change-Id: Ie9eb4907c67e20695bfa083e1c2a29385e66afcf
2023-01-02 20:55:02 +00:00
Aidan MacDonald
e8e781b006 lua: rocklib_events fix
Do not spawn threads on COP as PP lacks cache coherency between cores,
making it unsafe to access cacheable memory that might be accessed by
the other core.

Change-Id: Idf910e9cc9dad3f0bf5bdb63800ed4abaa97558a
2023-01-02 13:38:08 -05:00
William Wilgus
84fe501f53 Add locked actions to all soft lock targets
fiio m3k native is currently the only player with
defined buttons different from the standard
mapping.

This allows the user to use the keyremap plugin
to specify differing keymaps for their device in the locked state

Change-Id: Ie0b447bba0d5978e8d23fed423df30c794afc6f9
2023-01-02 13:19:43 -05:00
William Wilgus
a00bd421ac clean up button.c optimize !filter_first_keypress
do a bit of cleanup in button_tick move filter_first_keypress to a function pointer

Change-Id: Iefb05c1a182c1e15cfb5bca8e2ef31a710d15eba
2023-01-02 11:04:47 -05:00
William Wilgus
6cbf2160e5 tlsf fix corruption checks
Turns out (~PTR_MASK) != (0xFFFFFFFF - PTR_MASK) in 64 bit land

tmp_b = (bhdr_t*) ( (intptr_t)b->prev_hdr & BLOCK_SIZE );

using ~STATE_MASK or even #define BLOCK_SIZE (~PTR_MASK) resolves the issue

switching  BLOCK_SIZE TO  ~STATE_MASK appears to fix it

Also define BLOCK_SIZE (~PTR_MASK)

Fix a few signed / unsigned errors

Change-Id: Ica59db0faa2df408831c23312243ae19259dba6b
2023-01-02 10:09:46 -05:00
William Wilgus
3def8fee8c [FixRed] ClipV2 has a hold button -- news to me
HAVE_LOCKED_ACTIIONS requires !defined(HAVE_HOLD_BUTTON)

Change-Id: I1e98c282f17d11f08ea80cd5963b331a3ae19387
2022-12-31 17:12:36 -05:00
William Wilgus
6ebec601f9 [Feature/Bugfix] keyremap add Context flags
Add context flags to keyremap
CONTEXT_LOCKED
CONTEXT_REMOTE
CONTEXT_REMOTE_LOCKED

--CONTEXT_PLUGIN-- Removed -- Plugins need a custom action list
supplied and a method of supplying them

Change-Id: I5201d275ad0ab6130c2d05d5afb0c450f5c1746c
2022-12-31 16:12:18 -05:00
William Wilgus
0330aa8eb2 [BugFix] printcell_helper selection out of bounds
on load printcell.selcol is -1 whioch is out of bounds as an index into an array

Change-Id: I1e823712d268537d5d444458993ec2aa2cd253ff
2022-12-31 16:12:18 -05:00
Solomon Peachy
485e96d6be tlsf: Update to upstream 2.4.6 release
Seems to resolve FS#13383 and FS#13384

Change-Id: I43b2f166b78e61c16723a944729aa117260320fc
2022-12-31 15:21:55 -05:00
William Wilgus
85410589d1 Revert "keyremap allow remaps to work when player is locked"
This reverts commit ea7b80dab0.

Reason for revert: Adding Context flags to the keyremap plugin

Change-Id: I056ca2c0ee27e6cc7946166cf52461efda0ee1fb
2022-12-31 11:01:46 -05:00
Aidan MacDonald
484a79fcc0 x1000: Add INIT_ATTR to various target specific functions
Add INIT_ATTR to some low-hanging fruit in the X1000 code:
GPIO init, GPIO initial state tables, clock init, and DMA init.

Change-Id: Ia02b20945da1bbed103e2e01eaf60553eb5f72d4
2022-12-31 08:10:41 -05:00
Aidan MacDonald
a980d5f869 x1000: Enable support for INIT_ATTR
Enable INIT_ATTR support in config.h. Load init code to the
codec buffer, following the convention used by other targets
that support INIT_ATTR.

Change-Id: I8935fbaa100f0013bb328d71c4a49ec2ffafd003
2022-12-31 08:10:41 -05:00
William Wilgus
ea7b80dab0 keyremap allow remaps to work when player is locked
keyremap doesn't have a notion of locked contexts
add CONTEXT_LOCKED after keyremap so users don't have to specify
multiple context flags to get Advanced keylock working with keyremaps

Change-Id: I17b3f5b2ac9bf23277543fb04d66d6d90d16557f
2022-12-31 07:21:53 -05:00
William Wilgus
855540e1f5 [BugFix] keyremap browse missing root, entry count off by 1
browse_context was missing its root causing a NULL deref

Export User Keys was looking for at least 4 entries when it only needed 3

Change-Id: If92ecccb36bd54e1b850ac2a969fe262b5d7fd14
2022-12-31 07:04:18 -05:00
Christian Soffke
1773e56447 tagtree: Discard item history when selection changes in both directions
A changed selection only caused the item
history for deeper levels to be discarded
in tagtree_enter, when you were descending,
but not in tagtree_exit when you were ascending
the menu hierarchy again.

Change-Id: Ia40fa47980a05c2569e8af04e928b06130aa1f33
2022-12-30 21:57:55 -05:00
roman.artiukhin
178560f495 Treat cue file as folder for next/prev folder action
Do not get stuck if it's the only cue file in folder

Change-Id: Ibb1a406ff030f945e4234fbd1ece747d1e5a0c44
2022-12-30 19:56:44 -05:00