Commit graph

628 commits

Author SHA1 Message Date
Vencislav Atanasov
1468649258 Convert non-ASCII characters to UTF-8 or C-string literals
Comments are converted to UTF-8.

Strings which are part of executable code are converted using C-string hex literals. A comment with the intended UTF-8 character is appended to such lines.

The "c"-looking character in mpa.c was actually a small cyrillic "s" (i.e. "с").

Change-Id: If3a889080ef60b8bf756ad9ada38baede93ce35b
2024-12-15 21:16:12 -05:00
Vencislav Atanasov
5d7c8a0df1 Convert non-ASCII characters to UTF-8
Comments and notes are converted to UTF-8. Already broken multibyte characters are fixed using common sense.

This patch contains no code changes.

Change-Id: Ia511ab84936cb2495ac17309493a9b98727a7902
2024-12-15 21:16:12 -05:00
Roman Artiukhin
de8d1437dc metadata: asf: Use system utf16decode conversion
Change-Id: I606bf5365c84cbee4badd1ac1cbaace1207834f4
2024-12-15 15:44:57 -05:00
Roman Artiukhin
1f548f74e6 unicode: add utf16decode with utf8 buffer size check
Make use of it in id3tags and cuesheet

Change-Id: I153c23f1f7312e9d5e1de9f03725f2d2ab0abc93
2024-12-15 15:44:57 -05:00
Christian Soffke
63d8aa0077 metadata: mp3: update out-of-date comments
(L1033 + L1170)

As of commit f3e5ced, tags will be parsed
unconditionally, regardless of whether
they've been filled already.

Change-Id: I7edd4b7131b33dba34f06ebe829ebdc00a138525
2024-12-15 09:27:06 -05:00
Roman Artiukhin
004304dc65 unicode: add iso_decode_ex with utf8 buffer size check
Make use of it in id3tags, playlist and cuesheet

Change-Id: Ibc8abc0faf16688bc9b826b7a712d1dfe9bf75b2
2024-12-15 09:26:26 -05:00
William Wilgus
f233b6e2f2 'libmad remove warnings
calculating inside a function makes it work
adding FORCE_INLINE makes warning reappear
anything else in bounds of the array asounds ok but has digital
distortion so pretty confident the code is right

Change-Id: Ibb2babe20b1d8a980f3e3fd19b4cddaaff9213a6
2024-12-14 01:21:56 -05:00
Christian Soffke
4cf65ec926 metadata: mp3: fix iTunSMPB info replacing comment
Data from the iTunes seamless playback data field
(support for which was introduced in f3e5ced)
prevents proper comments from being displayed.

Change-Id: Ifb00b1229e636a79a460ba6d706191fcf28b1502
2024-12-13 20:49:18 +01:00
Roman Artiukhin
a23002cd5e unicode: Unify check for UTF-16 BOM
Adds utf16_has_bom function

Change-Id: I67ea474c9cf6ca6e6684351c2f54131164b7903c
2024-12-13 17:38:05 +02:00
Roman Artiukhin
11fbbc7826 metadata: mp3: Reduce size of is_cuesheet function
Saves 80 bytes on Sansa E200V2 (176 -> 96)

Change-Id: I976e47f74641110ef37049101b9eb0db0afe512b
2024-12-13 17:09:29 +02:00
Roman Artiukhin
f7d5da6b2f metadata: mp3: Limit utf-8 buffer stack allocation to prevent stack overflow
Fixes FS#13518

Change-Id: I549ecb21c3dbaba580c13a6a155559585f0aa08e
2024-12-11 11:36:09 +02:00
Roman Artiukhin
18520c27a5 metadata: mp3: Avoid utf-8 buffer stack allocation for utf-8 tags
Change-Id: I9f35fc017efa6e8f36cd295adf662612cf9c6c16
2024-12-11 11:36:08 +02:00
Roman Artiukhin
c1ee278abf metadata: mp3: Avoid utf-8 buffer stack allocation when processing cuesheet
Change-Id: Ife49d5e3f2850e8621f927a4864d7863c103db77
2024-12-11 11:36:08 +02:00
William Wilgus
e9b14b3986 libmad synth.c silence warnings try #3
https://godbolt.org/z/3bM7fxPP3 shows some of the disasm around the troble area for compiling

Change-Id: I7b2897ae20dad1b11af39439a4d1856267b1222b
2024-12-10 11:16:40 -05:00
Solomon Peachy
95681c3959 Revert "libmad synth.c silence warnings try #2"
This reverts commit 5650007399.

Reason for revert:  Results in warnings on *all* device builds.

Change-Id: I635be6791c3ea9c7d7e89f9cf5dd2e4e4e042a80
2024-12-10 08:59:00 -05:00
William Wilgus
5650007399 libmad synth.c silence warnings try #2
https://godbolt.org/z/3bM7fxPP3 shows some of the disasm around the troble area for compiling

Change-Id: I135af6df5569fb4b6d18d79f7893b5c27f6f83ea
2024-12-10 02:17:55 -05:00
Solomon Peachy
e3323e3ba7 Revert "libmad synth.c silence warnings"
This reverts commit b14056e90f.

Reason for revert: Not mathematically equivalent, inconsistent with other code paths, and leads to audio artifacts on ARM targets.

Change-Id: I71646e6e8df2aa2c57decdb5360daff870670c87
2024-12-08 19:14:01 -05:00
William Wilgus
ca79fd039c skin_parser add empty parser callback remove guard conditionals
it appears callback is only set once in skin_parse() and then its never touched again
making repeatd checks pointless anyway

Change-Id: Iae4cb064b17f9c4e89a3ef772110ead17332cba2
2024-12-08 15:12:28 -05:00
William Wilgus
33cbefb310 skin_parser Reduce ram usage for conditionals on %ft() file text tags
the skin engine calls the tags for each conditional to check them since %ft
erases it's var if the file doesn't exist %?ft is likely only being called
to check existance of a file or line of a file

this patch allocates 2 bytes to satisify the conditional if the line exists

Change-Id: Ic74bf5fec9a5d9b6724692c49a0997bfa4cff48d
2024-12-08 03:52:38 -05:00
William Wilgus
ebd1021fe4 [Bugfix] Pt doesn't return length of the next track
fix yellow in mp3_encoder

Change-Id: I1658250141d3ea00b56da0258e111ca76aa56b53
2024-12-08 00:28:16 -05:00
William Wilgus
b14056e90f libmad synth.c silence warnings
synth.c is using a negative offset which gcc doesn't like

equlivalent code just uses pointer math instead

Change-Id: Ia1282c5608409cdff05cd4b90c4d4b695174482a
2024-12-08 00:06:59 -05:00
William Wilgus
44bfffd7c5 [Feature] skinengine subline timeout hide line for n seconds
builds on top of the file text patch to add hide timeouts to
subline text tags

this allows you to specify both a show time and hide time
for these elements

%t(show, hide)

also removes the 327 second limit for timeouts whne this form is used

Change-Id: If4598dcc24d0c7be4380e7595b7d91c7eba3a728
2024-12-07 23:02:22 -05:00
Solomon Peachy
e6851a55ed Revert "[Feature] Skin engine Themes grab text from a file %ft(file, line) WIP"
This reverts commit 62b5dfd81d.

This was accidentally merged, and wasn't up-to-date anyway.

Change-Id: I4fcceb8dc4f86762701daab72498202cabd8295a
2024-12-07 13:48:05 -05:00
William Wilgus
62b5dfd81d [Feature] Skin engine Themes grab text from a file %ft(file, line) WIP
allow the skin engine to read text files and return a particular line

you then can use ss on that string to allow display of strings from the file
(Playername comes to mind)

able to be used as conditional
%?ft(filename)<Found|Not Found>

if (selected) line of file is empty the tag is treated as #COMMENT

scroll timeouts now persist thru trackchange

bugfix:
%t(n)%?x<text|text>
would ignore the specified timeout defaulting to 2 seconds

playername.txt generated at boot if it doesn't exist contents: 'RockBox!'

Change-Id: I961910e01be052ef902f77e6d92fc3e367ffe9d0
2024-12-07 13:21:21 -05:00
Christian Soffke
87452d775e fix warnings on some systems / format specifier mismatch
Instead of %ld or %lx, use %jd or %jx
for off_t (after casting to intmax_t)

Change-Id: I4cd1831816820d2862b383ff8782e548b2fca294
2024-12-07 11:07:44 -05:00
Solomon Peachy
d114429d88 skin_debug: Fix missing PERCENT tag dump
Change-Id: Ie4041d5666c3a53439e23363d89b9bbf40241a42
2024-12-03 20:37:55 -05:00
Solomon Peachy
00d7a93987 themeeditor: Fix compilation
This thing is suffering from some serious bitrot, but at least
it compiles again.

Change-Id: Ie2c55697dddbca3a758ace5047d1c372ee478a07
2024-12-03 20:16:30 -05:00
William Wilgus
793c797447 [Fix Yellow] remove DEBUGF from skin_parser.c cleanup spaces
move const to the proper side

Change-Id: Ide7c1878281eaee28d06426eee43041ad61acbc4
2024-12-03 01:48:50 -05:00
William Wilgus
68d4fd0e5b skin_engine minor refactoring struct alignment No Functional Changes
Move some elements around to save 720 bytes in the skin engine with cabbie

saves some code manipulating the skin_helpers arrays in skin_engine
eliminate conditionals checking for pre/post process functions
using a dummy fn(), consolidate pre/post process into a single function
adding a bool preprocess to indicate stage

Change-Id: Id2df4706b73e9025c7300be135dc02e135e587fe
2024-12-03 01:21:28 -05: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
ff9da12763 skin engine small cleanup optimize find_tag() remove string copy
since we now have the length of tag names thru the param_pos var

we can simplify the find tag function to skip if the length doesn't match
this allows us to no longer make a string copy in order to terminate
the buffer

move some of the more frequently encountered tags to the top of the
lookup list

only SKIN_TOKEN_UNKNOWN position matters as its empty string is used
as the sentinel

Change-Id: Ib82d081a9ebedc228768845ae54a3d9466faaef1
2024-11-25 12:40:36 -05:00
William Wilgus
1fddea5e8e Revert "[BugFix] Enums are only 2 bytes on some Devices"
This reverts commit 4ec34f6986.

Reason for revert:
 -fshort-enums makes them smaller if the explicitrly enumerated values will fit in a smaller type

Change-Id: I834dfd2b2039eda91bc02c9cf95a0f9dfc5783f6
2024-11-24 11:38:16 -05:00
William Wilgus
4ec34f6986 [BugFix] Enums are only 2 bytes on some Devices
using enums to hold values larger than 0xFFFF could be problematic

WIP

Change-Id: I3a9be957265364b545f022fe26163f0869569e3e
2024-11-24 10:23:53 -05:00
Solomon Peachy
bdf1690cb2 build: Allow LTO to work globally, not just codecs/plugins
IMPORTANT: There is no guarantee this will compile cleanly much less
_work_ on any given target.  This is purely to enable future hackery.

Change-Id: Ib58f21b717719fd4325622b446a60779406ae035
2024-11-24 08:23:38 -05:00
William Wilgus
1bf19eaaff tag_table use unsigned short rather than enum
we have 190 tags

mips padded with extra 2 bytes * 2

saves ~768 bytes

Change-Id: I1d9bd8bf435bc1e3bc4564356c290c883c4724de
2024-11-23 21:44:04 -05:00
William Wilgus
213686b55c [Fix Yellow] skin_parser.c const correctness
Change-Id: Ibc3696d807649c649db68cbdfab19b20391eab71
2024-11-23 20:20:13 -05:00
William Wilgus
75a4937568 skin_tags save space in tag_table
skin_tags have name and sometimes valid parameters

storing a pointer results in a lot of wasted space
instead record size of name and write the parameter string just after

Change-Id: Ied32f9e820deec9092dc6b97a93e2660d7abc8b2
2024-11-23 19:41:29 -05:00
Vencislav Atanasov
f040c4c9ec Rename CPU_S5L870X to CPU_S5L87XX
This is a preparation to introduce support for the following SoC models: S5L8720 (iPod Nano 4G, iPod Touch 2G), S5L8730 (iPod Nano 5G), S5L8723 (iPod Nano 6G) and S5L8740 (iPod Nano 7G)

The whole family consists of SoCs which are similar, running ARMv6 and Thumb2 instructions, but some peripherals are located at a different address.

No functional change is to be expected so far.

Change-Id: If1f7669c49cf110ccc52c5234cc42ffd6f2b4e80
2024-11-20 10:58:32 -05:00
Vencislav Atanasov
5c6d463cc3 Simplify libgme define
Change-Id: I3e66f57b3640246bde9fc1c5d75b094553f8598c
2024-11-20 12:31:09 +02:00
Roman Artiukhin
da478aaa32 metadata: mp3: Simplify comment tag processing
Avoid unnecessary string comparison.

Change-Id: Ib1c5622f7b7760c43c4763930dc4ef6b409dbc05
2024-11-07 07:53:41 -05:00
Roman Artiukhin
2156d9874f metadata: mp3: Improve support for long tags
Increase buffer size by 368 bytes by using id3v1buf.
Limit tag size only if metadata fails to fit without limitation.

Change-Id: I82d551ac75c2e8fcb9ff0ef318445e0e6a1f8148
2024-11-07 07:53:08 -05:00
Roman Artiukhin
063b917f69 Codecs: wma: fix parsing album art
We can't assume that album art file starts right after album art type (apparently it can contain also additional info like filename).

Related to FS#12576 (album art is now shown)

Change-Id: I68c7a1dc536ff13a47fb73ea84539b2f7a44265b
2024-10-23 09:10:18 +03:00
Roman Artiukhin
f3d6196016 Codecs: wma: don't fail in case parsing errors in album art
Fixes FS#12576 (album art is not shown but file is now playable)

Change-Id: Idc8e1dcf7b5760b4fd37c43913a534ed4eae512a
2024-10-19 10:41:23 +03:00
Solomon Peachy
2f109a7c2a flac: 7th channel decode buffer may not fit into IRAM.
(Fixes failure to compile on nano2g)

Change-Id: Ibe40a18ee74a3ac3ca2ec9dfac478d1fda5d34ee
2024-10-14 13:43:54 -04:00
Solomon Peachy
29f28ad8e6 flac: Implement proper support for 7 channel FLACs
* Allocate buffer for additional channel
 * Proper downmixing

Change-Id: I4190358a93bb328585952affcd42db05b05c19a5
2024-10-14 12:28:07 -04:00
Solomon Peachy
3aef933348 flac: Bump maximum channel count to 7 (FS#13306)
This is actually the root fix for the crash; the fix in
772eff8ca6 didn't restrict it to 2 channels, just sanity
checked the file vs MAX_CHANNELS.

Change-Id: If5a0a9b946a179ad47d6e7955f7c025de3aaaa0e
2024-10-14 11:05:28 -04:00
Solomon Peachy
772eff8ca6 flac: Explicitly reject FLAC files with more than two channels (FS#13306)
It's not clear that we've ever intended to support >2ch files, based on
'#define MAX_CHANNELS 2' and other logic that only seems to care about
mono vs not.

Change-Id: I15e92fb29cceef32e63fc3a821f6e96bbde930b6
2024-10-14 09:00:26 -04:00
Solomon Peachy
d4d74fda00 codecs: abs() --> llabs() in speex and libgme
We were calling abs() on 64-bit (ie long long) variables.

Change-Id: I8326910a4ce733e9e2251aa5f9047e336c8be6df
2024-10-12 12:01:36 -04:00
Roman Artiukhin
ef6da7503a Codecs: mp4: Support object type 29 (AAC LC + SBR + PS).
Backport libfaad commit d35cf8f24d

Change-Id: I0d637d2be36f5e4bb10d7d09adc442b470e81bf7
2024-09-25 14:01:57 +03:00
Solomon Peachy
c3f51b5fe9 opus: Re-add a ICONST_ATTR lost in 4c6bb798d6bebc80f07e863236adbaf8d156a9c
Change-Id: If1395d5b1d71c1bc0bb9104ff26d2addbfd1040f
2024-09-24 10:27:17 -04:00