Commit graph

136 commits

Author SHA1 Message Date
Solomon Peachy
5829701fba skin_debug: Also dump the parameters to viewports
Change-Id: Ic9ae330fa6202df67f201911a09ebb7f8c165c8a
2025-03-07 09:46:54 -05:00
William Wilgus
b94b0d3bf4 Skin engine, optimize hot paths
callgrind identified check_viewport and scan_int as pretty hot code paths on startup
and playback

check_viewport uses strlen to check the string has at least 4 characters
we can just check if str[3] != '\0' without walking potentially much further
and no function call..

scan_int was building a buffer for atoi to parse when we can just do it in the loop
directly

Change-Id: Ie028980333cbed4c066d8ea547a89cf4fad76808
2025-02-08 00:49:28 -05:00
William Wilgus
7c678f5e7a [Feature] %ft file text tags add prefix search
%ft(filename,search_text)
finds a line beginning with search_text strips search_text and returns
the remainder of the line

Change-Id: I06fe029b89aa60e4dbf34c039d180c75213519a4
2024-12-22 01:11:10 -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
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
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
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
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
Evan Kenny
96f42a5646 skin engine: Add tags to display Quickscreen Items
A set of new tags for themes that allow them to display a quickscreen item's name or value like what is displayed on the default quickscreen.

There are 8 tags in total, 2 for each direction or "item".
One type of tag displays the setting name, while the other displays the setting's value.

All tags output an "ERR" string if no valid setting is found for that item.

Quickscreen Item name tags: %QT, %QR, %QB and %QL.
Quickscreen Item value tags: %Qt, %Qr, %Qb and %Ql.

Change-Id: Ia08ba5940e38065e051a0aefa2cff142c9e58684
2024-07-13 19:07:06 -04:00
Solomon Peachy
5dd9238004 Fix yellow in sim builds
Change-Id: Ibed5ca7a821a31128940d602ade75497c13631f5
2024-05-24 11:34:43 -04:00
Solomon Peachy
8825b33052 skin_debug: Don't segfault when dump a viewport with no children
Change-Id: I5dfcc53a735dab1552211cdf522f4d18d93e6ec8
2024-05-24 11:17:41 -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
6b8c94a6e3 Fix some non-portable alignment values
UBSan reports an avalanche of unaligned pointer bugs stemming from
hardcoded 4-byte alignments used in certain places. Use sizeof(long)
instead to align to the machine word size.

Change-Id: I28e505212462c5268afa24e95df3a103ac3e2213
2022-05-02 15:38:48 +01:00
William Wilgus
848633f921 lib/skin_parser check that malloc succeeded
Change-Id: I32db233a53b0f693f815cf96bcbe6711c366e5b3
2021-08-05 10:38:18 +00:00
Dominik Riebeling
5f5e44f593 skin_parser: Modernize Makefile.
- Avoid use of uname, instead ask the compiler about the binaries it
  creates.
- Move platform specific commands used into functions.
- Replace use of echo with make functions.

Change-Id: I365f656e02ddb90ee91ae60fec1230b4aaaf224f
2020-09-04 19:13:54 +02:00
Solomon Peachy
8cb555460f [3/4] Completely remove HWCODEC support
'swcodec' is now always set (and recording_swcodec for recording-capable
units) in feature.txt so the manual and language strings don't need to
all be fixed up.

Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
2020-07-24 21:20:13 +00:00
Solomon Peachy
b450707955 skins: Fix buffer overflow in skin_error_format_message()
Change-Id: I54849866c163f2ec7ab9c9f76cfe1b267a4bee56
2020-05-04 20:41:12 +02:00
Thomas Jarosch
2a3e1628a5 Limit more variables to file scope
Change-Id: I30219d626316776eb73b4205d63376fa3dbc6361
2015-01-11 21:40:51 +01:00
Amaury Pouly
dc127f213c Clarify usb_powered() and fix some code.
Either by mistake or because its meaning changed, usb_powered() doesn't mean
what the name suggest, so clarify its meaning by renaming it to usb_powered_only.
So use of usb_powered() are replaced by usb_inserted() when it makes more sense.

Change-Id: I112887e2d8560e84587bee5f55c826dde8c806d8
Reviewed-on: http://gerrit.rockbox.org/1097
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2015-01-08 16:45:32 +01:00
Thomas Jarosch
f91434cc7b Fix yellow
Change-Id: I8685198c208b5324b09b5ad59f7379502e9ed977
2015-01-05 19:09:33 +01:00
Thomas Jarosch
fdd4aef340 Make thirty functions static to reduce binary size
If any of those functions should be (unused) API functions,
they can easily be turned back once really needed.

Detected using a new cppcheck check that
uses the internal symbol database to catch
functions that are only used in the current file.

Change-Id: Ic2b1e5b8020b76397f11cefc4e205f3b7ac1f184
2015-01-05 18:44:36 +01:00
Chiwen Chang
9fb65294fb add supports for x,y value in percentage to several tags.
including
BAR_PARAMS, %xl, %dr, %T,%St, %xl and %Cl

Change-Id: I0811ebfff5f83085481dcbf08f97b7223f677bfe
Reviewed-on: http://gerrit.rockbox.org/900
Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
2014-07-21 04:54:53 +02:00
Jonathan Gordon
2febee5265 more error handling for checkwps
Change-Id: I03055d045c0a8e0e63e17b290cc71c54a8dc3634
2013-02-27 21:15:57 +11:00
Jonathan Gordon
d76dca165b checkwps: show a helpful error if the parser callback errors out
Change-Id: Ie3e35292ba8d74f0ff3d1bb3483a5e83aae0e6b6
2013-02-26 21:18:16 +11:00
Dominik Riebeling
e98e64b988 Fix Theme Editor build.
The skin_parser now needs __PCTOOL__ set to build libskin_parser.a properly for
use with the Theme Editor.

Change-Id: I48a518fa296cc8ec5d0e3022baaedd796afe7c5f
2013-02-08 22:38:57 +01:00
Jonathan Gordon
685cf59008 9 segment bitmap drawing:
Use %x9(id) to draw an image in the whole current viewport using the
9 segment drawer (which draws the corners as normal and *tiles*
the middle segments to the needed width/height).

Future work is to make it scale instead of tile

Change-Id: Ic3ed1cad93f96091694801eb442e0da5a2401203
2012-12-09 17:11:19 +11:00
Jonathan Gordon
9dd2eb49be skin_engine: Support percentages for viewport positioning
%V(0,50%,75%,50%,-) - make a viewport at x=0, y=half the lcd height,
75% lcd width and the remaining height (the other half) of the lcd.

Change-Id: If26ccb65e8dc52c9225f3fd6d7b222d770add0f0
Reviewed-on: http://gerrit.rockbox.org/184
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Tested-by: Thomas Martitz <kugel@rockbox.org>
Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
2012-07-29 04:24:38 +02:00
Jonathan Gordon
65f9df3083 skin_engine: Allow the %St() (setting) skin tag be used as a bar
%St(<setting name>) or %St(<bar tags>, setting, <setting name>)

Change-Id: I71396d683634d4d1ad2357018c4029ecb4229677
2012-07-05 23:30:06 +10:00
Jonathan Gordon
4c94b98422 skin_engine: Fix a obscure parser bug
Tag params where a [] group is followed (but not immediatly) by
a * will not parse correctly. e.g [si]iii|s* will attempt to find
an 'i' after the second s instead of looping s's

Change-Id: I3982f726b6539818f8332334b263b673259f98ef
2012-07-05 22:41:10 +10:00
Jonathan Gordon
2d3c43dffe skin_engine: rework the parser to be closer to the langauge grammar.
The parser was unconditionally scanning things which it thought
were conditional/enum lists (or tag arg lists) when they couldn't
possibly be (i.e < inside a param which should be valid).

This change fixes it (i.e %?and(%if(%pv, <, -50), %if(%mp, >i, 1))
is perfectly valid now.

This *may* break your exsiting skins if you were using %if with < or >

Change-Id: Ia24dbdf0b11fc7d8a735c1111d648c3bebd68ac6
2012-04-22 00:24:16 +10:00
Thomas Martitz
728db21502 Revert "skin_engine: rework the parser to be closer to the langauge grammar."
This reverts commit ec8b21eef8b2fe1bd02f335dbc0dfbf05c2deff2 which was pushed by accident.

Change-Id: I1aaedf6876d0448a100dc582b79f1293d021bac1
Reviewed-on: http://gerrit.rockbox.org/216
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
2012-04-17 17:07:43 +02:00
Jonathan Gordon
e43b856ed0 skin_engine: rework the parser to be closer to the langauge grammar.
The parser was unconditionally scanning things which it thought
were conditional/enum lists (or tag arg lists) when they couldn't
possibly be (i.e < inside a param which should be valid).

This change fixes it (i.e %?and(%if(%pv, <, -50), %if(%mp, > 1))
is perfectly valid now.

This *may* break your exsiting skins if you were using %if with < or >

Change-Id: Ibcb42bc6bb78908f79de024b61276b91b1ce02a0
Reviewed-on: http://gerrit.rockbox.org/214
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
2012-04-17 17:05:20 +02:00
Thomas Martitz
f269aa0060 build system: unify/simplify library handling a bit.
libs in $ROOT/lib now add to $(CORE_LIBS) and $(EXTRA_LIBS) and are
automatically linked by the core and codecs/plugins respectively.

Change-Id: Iff482c792a8c8142718f6a16a450c6e2f1497c9a
2012-03-26 22:27:40 +02:00
Jonathan Gordon
5edae54e0d skin_engine: Reenable skin debugging in the sim (use --debugwps)
Change-Id: I2881edda45cd3ea69f5284d93bc93c47bb63b3f2
2012-03-15 23:26:07 +11:00
Jonathan Gordon
014a08cabb skin_engine: New tag to draw a rectangle (optionally with a gradient)
%dr(x, y, width, height, [colour1[, colour2]]):
x,y - viewport relative pixel coordinates to start the rectangle.
width, height - obvious. can be '-' to fill the viewport
if both colours are left out the viewports foreground colour will be used
if one colour is specified it will fill the rectangle that colour.
if both colours are specified it will gradient fill the rectangle.

Change-Id: Iad451e99ded663bc7c5d182443659db7d909b388
2012-03-15 22:52:53 +11:00
Frank Gevaerts
b9bf6cdb2c Call skinlist_set_cfg() unconditionally, i.e. also if do_refresh==false
This call is cheap (except if the list config changes, but then it should
be called anyway), and do_refresh isn't always set appropriately, e.g.
when the screen has just changed, which could cause the list config to be
null at bad times, which caused the standard list to be shown instead of
the desired skinned list.

Change-Id: I47dd2552d6d1062456ede4529c4891e80a8159ea
Reviewed-on: http://gerrit.rockbox.org/113
Reviewed-by: Frank Gevaerts <frank@gevaerts.be>
2012-02-29 14:11:33 +01:00
Jonathan Gordon
1c1e1c070c skin_engine: ease the restrictions on %x/%xl
%x and %xl only require the id and filename now.
If you leave off the x,y it will default to 0,0.
If you want to use the default x,y you can still put in the
num_subimages param on the end (e.g %xl(a, file, 3) )

Change-Id: I8eff793dfdd037e302ace8deec9dc16dcea264a7
2012-02-29 00:14:06 +11:00
Jonathan Gordon
34031cba5b skin_engine: Clean up %x() handling - beware theme issues
Internally remove some hacks around how %x() is handled.
%x() inside the default viewport will no longer work if
other viewports are used, so if you are using viewports and
%x() make sure it is in a viewport!

Change-Id: I8ecab805d55fc0f8476ff0516cba38e23400aa20
2012-02-28 23:51:01 +11:00
Jonathan Gordon
2c71aa9feb lcd/skin_engine: Add the ability to draw onto the backdrop layer
The framebuffer the lcd driver uses can now be changed on the fly
which means that regular lcd_* drawing functions can draw onto the
"backdrop" buffer. The skin engine can use this to create layered
effects.

Add the tag %VB to a viewport to draw that viewport onto the
backdrop layer. If you want to draw an image onto the backdrop
framebuffer use %x(backdrop filename) instead of %X() inside
a viewport with %VB.

Change-Id: I741498e2af6d4f2d78932cabe8942317893e7cfc
2012-02-28 23:03:04 +11:00
Frank Gevaerts
b5cd5ce8a1 Add %LR and %LC to get at the current row and columm in skinned lists.
This allows list items to be rendered differently depending on their
on-screen position, allowing things like gradients or nonlinear alignment

Change-Id: I1d9c080f97e83707f0e80f57abc762cb2b94f6ed
2012-02-25 16:43:27 +01:00
Jonathan Gordon
31a05953e1 FS#12586 - Modify %ss to be able to use numbers for conditionals
i.e %?ss(1,1,%cM)<|one|two|three|...|> or %xd(numbers, %ss(1,1%cM)

Change-Id: I74ecb3f253f3be1fd270f75c0ef79addd364a7de
2012-02-26 00:50:14 +11:00