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
%ft(filename,search_text)
finds a line beginning with search_text strips search_text and returns
the remainder of the line
Change-Id: I06fe029b89aa60e4dbf34c039d180c75213519a4
it appears callback is only set once in skin_parse() and then its never touched again
making repeatd checks pointless anyway
Change-Id: Iae4cb064b17f9c4e89a3ef772110ead17332cba2
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
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
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
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
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
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
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
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
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
- 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
'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
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>
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
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>
The skin_parser now needs __PCTOOL__ set to build libskin_parser.a properly for
use with the Theme Editor.
Change-Id: I48a518fa296cc8ec5d0e3022baaedd796afe7c5f
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
%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>
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
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
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>
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>
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
%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
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>
%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
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
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
This allows list items to be rendered differently depending on their
on-screen position, allowing things like gradients or nonlinear alignment
Change-Id: I1d9c080f97e83707f0e80f57abc762cb2b94f6ed