Commit graph

15611 commits

Author SHA1 Message Date
Michael Sevakis
c8564f1ca8 Get voice event out of playback.c
Purpose: A step in removing all voice references from playback code
and prelude to other changes.

Change-Id: Ic3ad7f7a33b979693e18a3456ced37eb1d2281a4
2017-12-12 20:28:56 -05:00
Michael Sevakis
838ff9c67d Add a 32 byte read buffer to read_line.
Do as with fdprintf and avoid filesystem calls for every single
byte. If it overreads, just put the excess back with lseek, which
does no I/O itself.

Change-Id: Ifd5d21b5dca7183346e44d365d3f7d45e8cc6438
2017-12-12 15:57:51 -05:00
Michael Sevakis
cd3ea086ec Buffering: Remove statically-sized path buffer from handle struct
Paths are stored after the structure at their actual length plus
any aligment padding. In principle, any type of auxilliary data
could go there.

Change-Id: Ic5487dc4089781b5cc52414d1691ba6d9dc1893c
2017-12-10 14:51:43 -05:00
Michael Sevakis
6ee3b6feee buffering.c: Fix oopses with caching handle pointer
The location of the handle cannot be kept across calls to
shrink_handle() since it may move the structure. The error was
there in one place at the inception, corrected, then reintroduced.

Make shrink_handle() return the new location and use it, which
makes the side effects of the function clearer.

Change-Id: Icae6a0ad6f7bb0d6645b044cccfa4aef88db42ad
2017-12-09 23:45:53 -05:00
Michael Sevakis
8be40746b8 Remove recursion from shrink_buffer()
There's no need for it any longer since the list is now doubly-
linked. As a bonus, stack limits pose no barrier to the length of
the list.

Change-Id: I41c567f946b640ef1e3c2d93da2f5aef9a763c66
2017-12-09 21:57:01 -05:00
Michael Sevakis
65515f32b6 Fix yellow on hosted targets from c1a01be
Change-Id: I4c63efc6570368df76b6c4bbfb5b673dd081145b
2017-12-09 17:34:33 -05:00
Michael Sevakis
c1a01beded Playback: Move internal track list onto buffer
Does away the statically-allocated track list which frees quite
a fair amount of in-RAM size.

There's no compile-time hard track limit.

Recommended TODO (but not right away): Have data small enough use
the handle structure as its buffer data area. Almost the entire
handle structure is unused for simple allocations without any
associated filesystem path.

Change-Id: I74a4561e5a837e049811ac421722ec00dadc0d50
2017-12-09 17:05:59 -05:00
Michael Sevakis
e86ea6bdb9 Get test_codec synced with changes in 6c868dd
Change-Id: I47c5ae09ff620b46e42463654e1a073b59fb2191
2017-12-08 21:32:54 -05:00
Michael Sevakis
6c868dd48f Remove explicit 'enum codec_command_action' in codec API
Just use long so the compiler potentially doesn't complain about
use of other values not in the enum. It's also the type used
around the system for event ids.

Increase min codec API version.

No functional changes.

Change-Id: If4419b42912f5e4ef673adcdeb69313e503f94cc
2017-12-07 14:41:59 -05:00
Michael Sevakis
83e8e35a58 Ensure ci is properly updated if seeking before track load completes
If in the middle of a manual skip, playback would try to seek, and
therefore start, the codec before the audio handle was available.
This wasn't really a problem since the codec would just bail out
and be retried later. But, it is a problem for a change I was working
on with seeking where the codec could get caught in a full-speed
loop trying to seek itself (stoppable, not lockup).

The main side effect of this change that you may notice, if using an
HDD with dircache turned on and the disk is not spinning, is that you
can keep holding down prev/next if dir skipping and the WPS will
start FF/RW mode. By the time the new track shows up, you will have
seeked into it some amount.

Well, the PBE is getting the info ASAP anyway and as far as it's
concerned, the next track is under way. On that end of things, it's
correct. Perhaps WPS should lock out its own seek mode at certain
times.

Change-Id: Ifc7409a886df399cec189d1bae2adba3872e857a
2017-12-07 11:33:29 -05:00
Michael Sevakis
bef75a94f8 Playback: C99-ize FOREACH_ALBUMART; make loop counter local
Change-Id: Ie6d571ef217246e22b465ef39097ad9d9d1a6436
2017-12-04 12:59:15 -05:00
Franklin Wei
d728b9775b puzzles: fix off-by-one in blitter clipping
Nobody to blame except myself for this one...

Change-Id: I8446b564c3c060411c46675e9baac1c72437c39a
2017-11-24 20:31:45 -05:00
Franklin Wei
f51544a0e5 puzzles: polish mouse mode
Reduces lag when dragging. Also throws some comments in.

Change-Id: Ibd0d95e94200ae6de8258ce8d2e001c931161385
2017-11-24 20:31:45 -05:00
Franklin Wei
ab6e40b977 puzzles: fix copy-paste typo
Change-Id: I09d065574a02a541c43c1a78d92e50a80b5e2ae0
2017-11-24 20:31:45 -05:00
Michael Sevakis
abef236081 Do playback restarts the proper way
It isn't necessary to explicitly stop and restart playback to
force it to update something that must cause rebuffering.

Change-Id: I6ff5394fcafc7374af67ef9fbf9022bb4a79b773
2017-11-24 08:55:49 -05:00
Franklin Wei
75d2e1f35c puzzles: add missing file
Change-Id: I72444b57abb7b7327891b17a22fbe2cafdf724a6
2017-11-21 19:54:14 -05:00
Franklin Wei
c1dc957195 puzzles: clean junk files
These are really not needed.

Change-Id: I8aa8d648c363c657ca104fc9876b3c63558c5608
2017-11-21 19:29:46 -05:00
Franklin Wei
e8e85c5762 puzzles: resync with upstream; add Loopy and Palisade, mouse mode
This brings a various small changes to the drawing and input code,
as well as a brand new "mouse mode", where input goes to a virtual
mouse cursor. Only Loopy has this mouse mode enabled by default,
while other games have it hidden away under the debug menu. Some
changes by me to Palisade were required to make it playable; those
are included here as well. Right now, sgt-net is pushing the c200v2's
upper limit on size and may have to be dropped in a future commit.

Change-Id: I495d2a2125462c2985aec1ffbc54bbe3fe5133bd
2017-11-21 19:29:45 -05:00
Michael Sevakis
12bc24adbf aced667 forgot about those pesky __PCTOOL__ things.
It was so close to aced666.

Change-Id: I2b952a0704bb2d006db5e3ea4a929db3118cf390
2017-11-21 06:08:23 -05:00
Michael Sevakis
aced667f48 Undo hacks to meant to get around string formatting limitations
The new vuprintf makes unnecessary workarounds due to formatting
limitations. I checked grep output for whatever appeared to fit
but it's possible I missed some instances because they weren't
so obvious.

Also, this means sound settings can dynamically work with any
number of decimals rather than the current assumption of one or
two. Add an ipow() function to help and take advantage of dynamic
field width and precision. Consolidate string formatting of sound
settings.

Change-Id: I46caf534859dfd1916cd440cd25e5206b192fcd8
2017-11-21 05:01:14 -05:00
William Wilgus
52af55eee8 Action Rewrite - Fix red
Change-Id: Iaa3e452994295b381297c1b6c9f61407e8ba0296
2017-11-18 17:06:40 +01:00
William Wilgus
b10c0e5b90 Action.c FIX / Rework / Clean-up Action System
FIX - softlock not allowing power button to shutdown device when active
FIX - autolock not working unless Selective backlight enabled

Rework - get_action_worker split into more managable chunks

Rework - moved all static variables to a single struct action_last
         to be passed through all internal functions

Rework - current action state moved to struct action_current
         to be initialized at each get_action /get_action_custom call

Rework - action lookup in button maps changed slightly to prefer fully formed actions
         rather than  blindly returning action with BUTTON_NONE as pre_button
         this should allow actions defined in keymaps positional independence

Rework / Clean-up - moved conditionals on internal functions to inside the functions
                  -Allows much cleaner code & empty functions should be optimized
                   out by compiler

Rework / Clean-up - softlock and backlight exemptions code

Clean-up - remove a lot of (now) unused defines

Clean-up - organize / move all exported functions to their own section in the file

Comments added to all internal functions to better explain their purpose

Change-Id: I0ac02d1a2b45826843611513fea3c20a819d2fed
2017-11-18 16:08:07 +01:00
Amaury Pouly
ff08c5287d nwz: improve keymap
- enable various features in radio screen (like mode switch)
- improve keyboard (short play to select, long play to finish, power to abort)
- enable volume keys in radio screen if available

Change-Id: I01e71291cfd783763ffd55d4fa60610b6900c726
2017-11-14 16:49:36 +01:00
Amaury Pouly
1015e1f5ca fix red
Change-Id: If18080a1525591f803e2cb6dd0f28b4f1e286bdb
2017-11-06 21:53:38 +01:00
Amaury Pouly
0fe7b8becf nwzlinux: add support for radio
None of the Sony up to A15 seem to support RDS (they use either Si4702 or Si4708),
thus I did not add any code to support RDS.

Change-Id: I64838993b9705b36b94665f8470c7a89c772c961
2017-11-06 21:37:06 +01:00
Franklin Wei
d9a55ac816 puzzles: fix blitting when zoomed
Both blitter_save() and blitter_load() functioned incorrectly when
zoomed in -- blitter_save() would copy from the wrong location, and
blitter_load() would ignore the y-coordinate of the destination.

Change-Id: I7c85debf5953575f72c4a81e3dbcf514202c3aed
2017-11-04 12:09:16 -04:00
Franklin Wei
7f1dd6f593 puzzles: clarify code and documentation
This adds no functionality, but instead cleans up the source and adds
some more substantial documentation.

Change-Id: I77328c171a61db7729bdf928ba094cfbed4ec0dd
2017-11-04 11:14:18 -04:00
Franklin Wei
9f62373735 puzzles: fix title drawing
This fixes two separate bugs: The first was that the drawmode was not
reliably set when drawing the title, occasionally leading to a black
rectangle where the title should be; the second that the title bar's
space wasn't being cleared before drawing, leading to artifacts when
the length of the title string changed.

Change-Id: I3859125b14d568e1098b095ab134645a504b2d45
2017-11-04 11:14:17 -04:00
Franklin Wei
65e7617ab6 puzzles: add an interaction mode to the "Zoom In" feature
This makes it possible to play the game while zoomed in. Read the
manual entry if you want to know more.

Change-Id: Iff8bab12f92ebd2798047c25d1fde7740aa543ce
2017-10-30 21:25:33 -04:00
Franklin Wei
1f3e70aafc puzzles: sync with upstream
This includes the fix for Map's incorrect cursor positioning when
zoomed in.

Change-Id: I7d7d1f3031bbe1390e89340039996f99efaa8ef5
2017-10-29 17:39:29 -04:00
William Wilgus
efb71ed0ce Add boot data to MOST AS3525 Devices
Adds boot data to as3525 devices Sansa C200v2 E200v2 Clip Clipv2 Clip+ ClipZip
fuze, fuzev2 m200v4

Adds boot_data to features.txt

default arm crt0.s now had boot data if HAVE_BOOTDATA is defined

Change-Id: I614a556696540511a69fc12a4520b01c268bf8a9
2017-10-29 17:52:40 +01:00
William Wilgus
41869a6534 Add boot data support to rockbox.
Bootdata is a special location in the Firmware marked by a magic header
The bootloader is able to copy information to the firmware by locating
this struct and passing data to the firmware when it is loaded but
before it is actually executed

Data is verified by a crc of the bootdata


Change-Id: Ib3d78cc0c3a9d47d6fe73be4747a11b7ad6f0a9e
2017-10-29 17:50:59 +01:00
Franklin Wei
47ebf623cb puzzles: improve zoom rendering
This adds colored font rendering, as well as a workaround for font
loading while zoomed. Additionally, the frontend has been modified to
match the new upstream API.

Change-Id: I8c3fe57e6854f176485bf792cf4778cd54a21674
2017-10-29 12:49:39 -04:00
Franklin Wei
9ba899f850 puzzles: fix clipping and 24-bit handling
Should fix the build.

Change-Id: I68f06702570389c2c9d0d76acc064c324cac457b
2017-10-27 20:17:28 -04:00
Franklin Wei
8b8e25f195 puzzles: add "Zoom In" option to improve usability
This adds a "Zoom In" option to the pause menu of each puzzle, which
displays the puzzle at triple size (subject to change). This should
help with tiny screens, modulo memory concerns associated with
allocating the temporary framebuffer to which drawing operations are
redirected. Coincidentally, there's an upstream bug with Map that
causes the cursor's positioning to be incorrectly displayed when
zoomed.

Change-Id: Ic8b7c2942acf558e295f4271dd7dc458cd336895
2017-10-27 19:10:53 -04:00
Franklin Wei
3ad9caeb2a puzzles: make Untangle's input code return UI_UPDATE instead of ""
This was changed upstream and slipped by when I was merging the
changes.

Change-Id: I3a53cd2db5a5cd2ffef52719a048b8ff4c80d1aa
2017-10-24 19:36:19 -04:00
Franklin Wei
a644489ccf puzzles: adapt frontend to upstream changes
Change-Id: Idd911ac4ac6c2efa3c6b064be6058979d7a15447
2017-10-23 17:41:11 -04:00
Franklin Wei
ef1306764e puzzles: resync with upstream
There have been some improvements with regard to small screen sizes,
which will be nice to have.

Change-Id: I30c740514156258d2818fde325c1a751500f7611
2017-10-23 17:19:29 -04:00
Amaury Pouly
7a8c9daf7e test_mem: increase dram buffer if possible, cap number of iterations
Change-Id: Ie034433184d0dfcd50e3b783b2b6d0b6a44d001f
2017-10-22 15:36:13 +02:00
Michael Sevakis
81f5a225f7 Fix plugin core_alloc_maximum functionality
One mustn't assume a plugin will only call plugin_get_audio_buffer one
time or that the buffer_size pointer is always non-NULL. At least one
plugin, pacbox, will call it each time it (re)starts audio, with a NULL
param (which is intentional because it only wants to kill audio
playback), and leak away all the RAM because the handle gets clobbered
by further calls and the memory can't be released.

Change-Id: Ic5b94dbc0277c42964ea85b4e9d0302a7c6f1fe4
2017-10-14 06:07:09 -04:00
Michael Sevakis
ff62528d05 Make playlist CRC the correct path when saving resume info
Playlist was CRC-ing the path from the id3, which may have been
modified to remove "bogus dirs". This would cause a CRC mismatch
in the resume information.

Now, just use the current playlist's current index and call
playlist_get_filename_crc32() to get the original path when
updating resume info.

While technically correct, if this causes any issue(s) it's just
a one-line change and painless to revert.

Change-Id: Ie595ef6c40349c342bd7acac8c542829f9cd5d76
2017-10-07 14:38:46 -04:00
Amaury Pouly
4382f8773e cleanup linux cpuinfo code
sonynwz: quirk for cpufreq broken driver

There was some redundancy between frequency_linux(cpu, true) and
current_scaling_frequency(), also I see no reason to compile the cpuinfo stuff
unconditionally and the scaling info only on DX since it was already printed
some partial scaling info anyway. Thus compile all the code unconditionally
and simplify the logic in the debug menu. Also avoid putting buffers of size
PATH_MAX on stack since it can be quite big and we only requires 64 bytes
for those paths.

On Sony NWZ, the cpu driver reports frequency in MHz instead of kHz thus we need
to make the cpuinfo code aware of that bug.

Change-Id: I61af45ab5f179ecc909b4841b9137a915a60193a
2017-10-06 18:31:35 +02:00
Michael Sevakis
b2a373eb64 Replace fp_sqrt function with one that only uses shift, or and sub.
Simply extends the current isqrt() to be able to do fractional bits
and improves the initial estimate using clz(). iqrt() itself is
no more and is equivalent to fp_sqrt(x, 0). The original also had
a small bug where the guess comparision should have been >=, not >.

Uses no large integer math or division and is very accurate
(simply returns a truncated fraction).

Change-Id: I2ae26e6505df1770dc01e56220f7385369f90ae9
2017-10-01 20:29:38 -04:00
Franklin Wei
23e7d0ef19 xworld: support diagonal buttons on Zen X-Fi
Change-Id: Ia738ecd2a39c0c0772d6f939d549dd5d0eda055e
2017-09-30 20:50:33 -04:00
Franklin Wei
bb55fceb70 Remove old keymaps from xworld and puzzles
They've been replaced by the one in apps/plugins/lib/

Change-Id: Icb54ec4caae1149dfddad8c754087686792a8bc2
2017-09-30 20:49:18 -04:00
Franklin Wei
752f7b1698 Harmonize plugin keymaps
Aims to provide a lib/keymaps.h for plugins needing simple button
functionality beyond that provided by PLA. Currently used by puzzles
and xworld.

Change-Id: Icb3493aaf176d401762de834dd48fc76a3824c5a
2017-09-30 20:13:49 -04:00
Franklin Wei
b9386109e8 puzzles: resync with upstream
This brings puzzles to upstream commit 84d3fd2.

Change-Id: I808a197f868032d771fc101a15666c5ec4b9f94b
2017-09-30 20:06:50 -04:00
Amaury Pouly
13364c5525 Fix make race conditions reharding lang.h
The bug is due to a stupid make misfeature. The article [1] contains much more
information but in a nutshell, the following code:

a b: c
	bla

is equivalent to:

a: c
	bla
b: c
	bla

This is bad because in parallel runs (make -j typically), "bla" can be run
TWICE and even worse, twice in PARALLEL. Obviously the result will be
completely unexpected. This is a real bummer because on the other hand,
the following code:

%.c %.h: %:in
	bla

actually expresses the fact that bla produces two files. For some reasons,
pattern rules work differently from implicit rules.

This commit attempts to fix the problem with lang.h by rewriting (simplified):

lang.c lang.h: lang.in
	genlang

as

lang.h: lang.in
	genlang
lang.c: lang.h

This works (it correctly expresses the dependency chain and ensures genlang runs
once) but as one drawback: if one manually removes lang.c, then genlang will not
re-run since the second rule does nothing. This is minor drawback since no one
ever removes lang.c manually and "clean" removes lang.h which triggers a rebuild.

[1]: https://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html

Change-Id: Ic0bf7c7c203dc599b00fde457946d2316c70474e
2017-09-24 23:32:47 +02:00
Amaury Pouly
acc3ef3b6f Print "GEN lang.h" when generated language header.
Hopefully this will help narrow down the problem with LANG_* error message,
I have the feeling that lang.h is not generated in time but it's very hard to
reproduce.

Change-Id: I02b6c98ed9c7e7168fad10dcf1142e307fbc6093
2017-09-22 21:06:30 +02:00
Johannes Rauh
638eaeb884 Fix keymap for YP-R0 regarding broken keylock, add more key maps
Keylock is now toggled by the key combo User&Power for WPS and FMS.
Pitchscreen has been added as long press of User.

While in bookmark screen, short press of Power deletes bookmark.
While in (most) menus or tree, first press of MENU takes you back to the
main menu, second press to WPS (aka button_context_tree).

Removed ACTION_WPSAB_SINGLE as long press of USER is now Pitchscreen.

Change-Id: I6aee7f8655b1073ed8d74dabe73895a7c0e54bfe
2017-09-20 21:22:24 +02:00