Commit graph

4861 commits

Author SHA1 Message Date
Solomon Peachy
cb9b5d3b50 Add 192 and 176KHz to mikmod and test_sampr plugins
Change-Id: I34e835ae0ae39da1ce50153eee86c14747705c4e
2020-09-30 22:52:56 -04:00
Solomon Peachy
c2c59457e1 lua: fix ipod builds broken by 127862c
Change-Id: Ibef7de6b4e87568206ede66c399093b66b827b69
2020-10-01 01:24:35 +00:00
Solomon Peachy
127862c947 lua: Include $TARGET when preprocessing the headers for the button helper
Change-Id: I3ab98b52991949adb1db2f13ea99ed24d827e575
2020-09-30 20:13:05 -04:00
William Wilgus
1c0648c603 lua rockevents reduce context switching for action and buttons
check if any buttons are waiting in the queue before triggering
the event thread for action & button events

makes button events quicker and also spend less time interrupting lua
both wins

Change-Id: I38346c084afdd99e4608f40b52053ee39730fb40
2020-09-30 16:33:38 +00:00
William Wilgus
018e0051bc lua playback example
cool little lua based audio player
creates dynamic playlist of 10 mp3s found on device if no music loaded

I had to limit the depth of search to 3 levels due to the recursive
nature of the current dirbrowser functions this could be rectified with a
bit more code

fixed a bug in print.lua that kept scrolling text even after screen clear

Change-Id: Ifd285332df41a409ecaeb1ea447ad15537b5d04c
2020-09-27 15:57:34 +00:00
William Wilgus
0f23cadbca lua -- add sort by name, size, date to filebrowse include
I had previously added the fuctionality to luadir but I didn't update
the examples

also breaks out the file_browser function to be a bit more accessible

Change-Id: I14067256b9d76a757f732840cbee1cf84d775b1b
2020-09-25 23:07:30 -04:00
Solomon Peachy
5d40d97585 voice: rename mp3_play_* functions to voice_play_*
Remove mp3_is_playing() entirely, in favor of pcm_is_playing()
Remove mp3_play_pause() entirely, as it's a dummy/no-op call
Remoce some archos-specific comments

Change-Id: I4e9ff323490a93add00809efd19e0d4e3f198b2d
2020-09-20 14:52:30 +00:00
William Wilgus
c62493e98a Xduoo X3 Add tree scrolling FS#13240, Emulate Multibutton presses
Fixes deficiencies with the button system on the X3

  The x3 has an interesting button layout.
  Multiple key presses are NOT supported unless
  [BUTTON_POWER] is one of the combined keys

  As you can imagine this causes problems as the power button takes
  precedence in the button system and initiates a shutdown if the
  key is held too long
  instead of BUTTON_POWER use BUTTON_PWRALT in combination with other keys
  IF using as a prerequsite button then BUTTON_POWER should be used

  Multiple buttons are emulated by button_read_device but there are a few
  caveats to be aware of:

  Button Order Matters!
   different keys have different priorities, higher priority keys 'overide'
   the lower priority keys
  VOLUP[7] VOLDN[6] PREV[5] NEXT[4] PLAY[3] OPTION[2] HOME[1]

  There will be no true release or repeat events, the user can let off the
   button pressed initially and it will still continue to appear to be
   pressed as long as the second key is held

Tree scrolling is PLAY+NEXT or PLAY+PREV

Change-Id: I88dfee1c70a6a99659e8227f5becacc50cc43910
2020-09-13 16:23:24 +00:00
Solomon Peachy
099bde885d mikmod: Fix emulated fseek()
Was causing XM loader to fail

Change-Id: I1dd1d87dd0d8587fae5f9db04a730fc42b625a11
2020-08-25 20:10:10 -04:00
Solomon Peachy
7972f8e448 xduoox3: Fix minesweeper plugin keymap.
(Broke in a654cecf8)

Change-Id: I5b07e27aed12019e2b0a5078bf06812da2ddd598
2020-08-25 15:54:25 -04:00
Solomon Peachy
9e64e31d56 xduoox3: More screenshots and button maps for plugins
Change-Id: Ic494102f191da5e32faa61b0f4bcefadee198200
2020-08-25 15:25:50 -04:00
William Wilgus
8ee035b6c8 Open_plugin add ability to import opx shortcuts, bug fix
shortcuts can be exported as .opx; now they can import as well

if parameter is a valid file..
 plugins with parameters are now hashed on the parameter path

fix bug with empty parameters not overwriting last valid parameter

Change-Id: I149519811f07cb4ba22b7113449e2f89f77f1eee
2020-08-19 02:06:16 -04:00
William Wilgus
889bcc0f76 WIP open_plugins.rock viewer
OP allows you to use Open With.. to call plugins with parameters
called directly it  acts as a shortcut list for plugins

  open_plugins.rock interfaces with the open_plugin core

  When opened directly it acts as a viewer for the plugin.dat file
  this allows you to edit the paths and parameters for
  core shortcuts as well as your added plugins

  If a plugin is supplied to the viewer it is added to the dat file

  If instead the plugin has previously been added then it is run
  with the parameters you previously supplied

-----------------------------------------------------------------------------
Added export to .opx files
this allows shortcuts to plugins with parameters to be called from
 the file browser

Change-Id: Ib8b05a60b049fb1d5881031ca09a07e3307d375a
2020-08-17 22:17:15 -04:00
William Wilgus
3550283442 Add open_plugin to core
open_plugin allows arbitrary plugins to be called
in hotkey and start screen

replaces PictureFlow Integration
shortcuts menu plays plugins now too

rather than store paths and parameters in the settings
that reside in memory instead entries in a file are searched by hash.
after all, the plugin has to be loaded from disk anyways

----------------------------------------------------------------------------
shortcut_viewer.rock--  can now call plugins rather than taking you to them
in the browser
-----------------------------------------------------------------------------
Added a new option to menus:
 F_CB_ON_SELECT_ONLY
 instead of option callback every time a item is accessed
 F_CB_ON_SELECT_ONLY fires callback only when item is selected
-----------------------------------------------------------------------------
Added manual entries
-----------------------------------------------------------------------------

Change-Id: I078b57b1d2b4dd633c89212c1082fcbc1b516e6a
2020-08-17 10:15:14 -04:00
William Wilgus
d553bb1149 root_menu move tag cache init check to pictureflow plugin
let pictureflow decide if the tag cache is ready instead of core

Change-Id: I2ab9b375d773dbbc28ea41fbf7bb6fb361ace8fd
2020-08-16 10:35:57 -04:00
William Wilgus
84bfd68fb5 Battery_bench & announce_status stack fix
had stack growing the wrong way

Change-Id: I51bf14526f5239e77e15dc0ffd76ad3ed8bdcbc8
2020-08-15 09:57:10 -04:00
Solomon Peachy
b4e70422a3 mikmod: Upgrade mikmod core from v3.2.0 to v3.3.11
* Get rid of the non-functional GT2 loader
 * Add the UMX loader
 * Add HQ mixer routines (and make it configurable)
 * Allow samplerate to be configured at run/playtime
 * Support >64KHz mixing/playback
 * Correctly restore non-boost status

(The diff to upstream is much smaller now too!)

Change-Id: Iaa4ac901ba9cd4123bb225656976e78271353a72
2020-08-11 03:29:12 +00:00
Solomon Peachy
0d4752e3f6 plugins: Make 'struct configdata' argument to the configfile helper const
So plugins can use const structures, possibly saving a little bit of RAM.

Change-Id: I15b0ef20e7554caf5f6d1c12f6ab109ddf3c0dbd
2020-08-09 10:27:32 -04:00
Solomon Peachy
be2c8734cb plugins: properly build duke3d/quake/wolf3d on MIPS and HOSTED targets
Change-Id: Ib8a9aa50c91dfc5d896c6f7491f3b30fca27479f
2020-08-08 23:22:56 +00:00
Franklin Wei
a74517ac65 duke3d: allow playing with unofficial data files
I'd overlooked this code path earlier. In the case of an unknown GRP, the
game would poll SDL for keyboard input, which it never received. Remove
that, and just warn the user instead.

Change-Id: Ibbabc0f8d43cb1276ed2fcfc3c6138517582e936
2020-08-02 23:54:23 -04:00
William Wilgus
da0dbc5d58 Battery_Bench use plugin buffer for thread stack, stop scrolling
Increase stack by using the remaining plugin buffer

Stops the scrolling message after user input

Change-Id: I3497467143411e262b4de983e3daab3fbc5d08ce
2020-08-02 11:48:23 -04:00
William Wilgus
7f27d2dd52 kbd_helper fix yellow
Change-Id: Ib54b36760678e88d3857ba70b0f4d1e1661bb0ad
2020-07-27 23:24:49 -04:00
William Wilgus
9e2eceeb33 kyb_helper small 'bug' fix
Change-Id: Ia91a662262497c1a93ce8f26902aab5921ee7185
2020-07-28 02:37:13 +00:00
Solomon Peachy
e1681345cc fix the red in be04c4b
Change-Id: I569561e5199c71a814b7f8118d63063f13958831
2020-07-28 01:18:14 +00:00
William Wilgus
be04c4be0a Voice TSR Plugin Demo
allows user to run plugin in background that voices
status messages

grouping is now working it counts ; as the end of a group

sleep timer remaining is not voiced if sleep timer is not active

TODO
manual entries

Change-Id: I39e8500df6440c07d2a3347513c749d5e155d1cc
2020-07-27 20:47:03 -04:00
Franklin Wei
796eba4c81 md5sum: clean up whitespace
Change-Id: I56781a8db29ac53df582dcc2faf6e5713ddcf186
2020-07-26 15:41:54 -04:00
Franklin Wei
2eb7ce475a Refactor 73b02a4.
Moves basename to a separate function, and documents some of the pointer
arithmetic it's doing.

Change-Id: I6f65ad99f163c2b223929f2ce7805b8935df71c0
2020-07-26 15:41:32 -04:00
Moshe Piekarski
73b02a4a2c Make md5sum more verbose
Solves FS#9539

Change-Id: I5278fa0fbb8347314ef6fb41e707b3832f1dd8cd
2020-07-26 15:15:38 -04:00
Solomon Peachy
a84176122c Fix two variable-set-but-not-used warnings
(found using -Os with gcc494 on the nano2g)

Change-Id: If0deee3e3cde50e6bf5aff595bebc0f134dcc393
2020-07-24 23:26:15 -04:00
Solomon Peachy
469866b6c9 mpegplayer: Fix aliasing rules violation on multi-core targets
As the PP series has no sense of cache coherency between its multiple
cores, we need to ensure the vo_data structure does not share cachelines
with anything else.

This was previously done by defining a uint8_t array and trying to
access it via typecasting hell, triggering a large pile of aliasing
violation warnings on newer toolchains and/or higher optimization
levels.

Instead of violating the C spec in an undefined-behaviour-sort-of-way,
create a union of the right size and alignment, and make one of its members
the structure we care about.  Voila, everyone is happy.

Change-Id: Iad78f8132225437cd4aa10e6e5f6ae58ba996c19
2020-07-25 02:57:35 +00:00
Solomon Peachy
e49c1af570 plugins: HAVE_BACKLIGHT in the test plugins
Change-Id: I97d17805ac7d37f10da6a29684102db97448e653
2020-07-24 19:42:32 -04:00
Solomon Peachy
9be5bc4cf0 plugins: More HAVE_BACKLIGHT cleanup
Change-Id: I70cf700f5bc3d4375c025efa62ef40fd2bd70293
2020-07-24 19:20:15 -04:00
Solomon Peachy
a3398a2143 plugins: Fix the builds for targets lacking HAVE_BACKLIGHT
Change-Id: Ifdb1501834b7ea63ca6f731bbd6414305d7e0001
2020-07-24 18:17:19 -04:00
Solomon Peachy
658026e626 [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.
Note:  I left behind lcd_bitmap in features.txt, because removing it
would require considerable work in the manual and the translations.

Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24 21:20:13 +00: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
0c4f89370d [2/4] get rid of HAVE_LCD_CHARCELLS
HAVE_LCD_BITMAP is now redundant.

lcd_bitmap is always-on in features.txt so manual and lang strings
don't have to change

Change-Id: I08eeb20de48099ffc2dc23782711af368c2ec794
2020-07-24 21:20:13 +00:00
Solomon Peachy
092c340a20 [1/4] Remove SH support and all archos targets
This removes all code specific to SH targets

Change-Id: I7980523785d2596e65c06430f4638eec74a06061
2020-07-24 21:20:13 +00:00
William Wilgus
cb94b3ae2e keyboard add ability to specify temporary custom layouts
rb core allows you to load custom keyboard layouts

this patch adds the ability to load a keyboard layout in a buffer
the custom layout is temporary and does not overwrite the current layout

use like so:

    unsigned short kbd[64];
    unsigned short *kbd_p = kbd;
    if (!kbd_create_layout("ABCD1234\n", kbd, sizeof(kbd)))
        kbd_p = NULL;

    rb->kbd_input(buf,sizeof(buf), kbd_p);

Change-Id: I7be2bd4a1b4797a147fa70228a9749dc56ac052a
2020-07-22 06:48:28 -04:00
William Wilgus
c39f95465b do_menu pass internal synclist reference to callback
keep running into the rigid nature of do_menu
it isn't too bad when you don't need voice but once
you do the fun awaits

do_menu likes to talk on menu enter which is in a loop when you use do_menu
I would like to move the processing to the callback
TOO BAD you only get an action and the menu_item_ex struct
you sent it when calling the function

Change-Id: Iaefd0cc133435d675b7dd27a558c504d6ccb327a
2020-07-19 22:10:26 +00:00
Franklin Wei
7d005335ba puzzles: always reset input state before pause menu
We were improperly conditioning the state reset with `do_pausemenu'. We
should reset the input state no matter what.

Change-Id: Iaafc59b95e9f1f053b57a34f0f28f7c672c0e327
2020-07-14 23:04:46 -04:00
Franklin Wei
987c6575b3 puzzles: more verbose debug output in font loading
No functional changes.

Change-Id: I7baa7bf37b3bdd57064c654a72d0e4e0d5600245
2020-07-14 23:04:46 -04:00
William Wilgus
45915101d5 Pictureflow Bugfixes & Usability fixes
First I discovered a bug in the code to display the currently playing
album from the WPS
--on a NULL id3->albumartist field PF would crash
  now checks for a match in id3->albumartist and then id3->artist
  if neither exists then the search uses <untagged>
  ditto for album

The album index feature (recently added) did not check for enough
room in the buffer on restore
--save and restore code cleaned up a bit
  moved all buffers to their own struct

tracks with no title now show filename rather than <UNTAGGED>

Reworked album search function
 album search was going quadriatic resulting in some outrageous
 index build times [40mins+ for 4000 albums]
 building now done in stages and duplicates removed at end
 *MUCH FASTER*

Album art
 empty album art is no longer stored in the art cache

 PF will now allow you to cancel building album art without
 forcing a rebuild next run,
 it will continue searching for album art in the background
 album art is now updated in the background on each start as well

tracklist now rolls over at the end

artist_index is now discarded after album_index is created

Cleaned up some of the myriad of global variables

Added quit prompt for index building

Added sanity checking for album_index loaded from disk

Change-Id: I8494cb7abcb1ae8645c223fc3c11dc0ee749883a
2020-07-14 03:57:56 +00:00
Franklin Wei
4dcd1a9ed8 puzzles: load cached fonts unconditionally
This works around an odd issue in Mines involving the zoom feature. The
chain of events leading to it is rather convoluted:

1. No save game is found, so no fonts are loaded from disk.
2. A new game is started.
3. The user selects the "Zoom" option.
4. The allocation of the zoom framebuffer causes the malloc code to grab
   the audiobuffer. This causes all further font_load() calls to FAIL, due
   to buflib allocations no longer working.
5. The user goes back to the normal view and uncovers a square.
6. Font loading fails, causing the drawing code to fall back to the system
   font.
7. An unrelated bug (not yet tracked down) causes font_get(FONT_UI) to
   return a different font.
8. font_getstringsize() returns the right size of the "wrong" font, leading
   to centering issues upon rb_draw_text().

The real solution to this would be to fix font_get(), but this fix should
prevent the issue from happening if Mines has been run and saved at least
once before.

Change-Id: Ib9ad51376eeb3ca1113a1f3786124b612db88cd7
2020-07-07 21:25:27 +00:00
Franklin Wei
5094aaa4d4 puzzles: Follow cursor in zoom mode and general code cleanup.
Frontends now have a way to retrieve the backend cursor position with some
changes I've submitted upstream. With this information, we can now follow
the cursor around in "interaction mode" while zoomed in, eliminating (most)
need for mode switching.

Also does some cleanup of the frontend code.

Change-Id: I1ba118f67564a3baed95435f5619b73cfa3ae87a
2020-07-06 23:00:13 -04:00
Sebastian Leonhardt
443ad25e75 plugin windows_lnk: fix missing return-on-error
(found by peachy & clang's static analyzer)

Change-Id: Idcc9b3bd0c3c1164892002b8f814d74b4a6b2a2d
2020-07-07 02:36:33 +00:00
Franklin Wei
5b8198d147 2048: use larger bitmaps on 96x96 screens (e.g. Clip Zip)
Apparently the smallest bitmaps are hard to see.

Change-Id: I0265ce4da15677f9c4c64457b1a1f849a0f3a7f8
2020-07-06 17:39:47 +00:00
Franklin Wei
051eb3ea31 puzzles: enhancements to mouse mode, zoom feature
- zoom now remembers position between activations (but not when exiting the
  plugin)
- key repeat enabled when panning
- moving mouse out of frame while zoomed will pan
- mouse can be moved diagonally

Change-Id: I39380ef7f36238700b6baa54cac036832933df67
2020-07-02 19:07:16 +00:00
Solomon Peachy
c1485455ea imageviewer: Fix potential null pointer dereference
(caught by clang-analyzer)

Change-Id: Ie24b7cd75c5e9814007674925f33b1a321f1d06d
2020-06-30 21:12:12 +00:00
Solomon Peachy
08d8b6472c fractals: Clean up ARM asm
No functional change, just using modern syntax.

Change-Id: I211bbcebd11da168c81dff4c409112d7a535b6ed
2020-06-30 16:30:35 +00:00
Franklin Wei
2e0a5969b6 puzzles: clean up and document some voodoo
Change-Id: I13d987cc148f053778474e99c719cc8439ec53c0
2020-06-27 20:28:50 -04:00
Franklin Wei
7da8137bdb puzzles: fix crash when loading a corrupt save
I misread the documentation here, thinking that the pointer would be set to
*point to* a null byte, not to a null pointer itself. [1]

[1]: https://www.chiark.greenend.org.uk/~sgtatham/puzzles/devel/midend.html#identify-game

Change-Id: I9b76bba9b1611dfd8e05d076a69f7554b5b74c53
2020-06-27 20:28:46 -04:00
Franklin Wei
c02a9c5ab3 puzzles: refuse to draw non-ASCII characters
We had some issues in Keen with the arithmetic operators not being rendered
properly. This is still a kludge (we should intelligently search the font)
but is still less ugly than the garbage it was drawing before.

Change-Id: I5b957c7371b659ea6d64847145f9913b2a892e48
2020-06-27 20:23:13 -04:00
Franklin Wei
4b108896cc puzzles: replace menu title kludge with more elegant solution
This hack has survived for far too long.

Change-Id: Idca0b647bd6e77f2afcd9a538513a6b9aa970fc7
2020-06-27 19:13:19 -04:00
Franklin Wei
5831801d16 puzzles: disable software poweroff in all puzzles
We have a couple games like Untangle and mouse-mode games in which the
software poweroff is very annoying.

Change-Id: I554b89aecf8c7cc20c6c7f305be1b8807dc9283b
2020-06-27 13:27:40 -04:00
Franklin Wei
a65a341a00 button: allow disabling software poweroff
On some devices, the button driver allows a "software poweroff" by long-
pressing a certain key. This behavior is inconvnient when that button needs
to be held down for other purposes, such as moving the cursor in rockpaint
or sgt-untangle.

This patch allows selectively disabling the software poweroff (enabled by
default) from both core and plugin code.

Change-Id: I7580752888ae5c7c7c5eb1be5966e3d67f17d4b4
2020-06-27 13:27:40 -04:00
Franklin Wei
f49442d7b7 puzzles: allow secondary select in Rectangles and Map
Change-Id: Ia32d41cd872140481e73b7565904fc196b7c5b01
2020-06-27 00:57:18 +00:00
William Wilgus
d9e084b530 Pictureflow Whitespace Cleanup
Change-Id: I7cda111a8d7a24cae31e3eeca1454480e27ebaaa
2020-06-26 07:08:32 -04:00
William Wilgus
aa4ec918e4 Pictureflow Fixes UniqBuf
rework of the unique name buffer

shares 1/4 of the total buffer

Change-Id: I17e46292ac880a082cb3f035e3c21abc318d8a31
2020-06-26 00:00:33 -04:00
William Wilgus
7c291250ef Revert "Pictureflow Fixes: Sansa C200"
This reverts commit b7f2cc5d6d.

Change-Id: I51ec9f5fade10ce0173ed45739af6baaa5c7f746
2020-06-26 03:43:26 +00:00
William Wilgus
6f0fd91343 Pictureflow Fixes: Sansa C200
Sansa C200 fix

Change-Id: I548b7142dde9ea4da5455686bed650aa40c9c90a
2020-06-25 22:35:24 +00:00
Franklin Wei
f6448cb440 puzzles: fix numerical chooser while zoomed in
We need to blit the zoom framebuffer to the screen in our chooser loop.

Change-Id: Id2ba1a79b61f14cc34ca9804486f69a2b32484ff
2020-06-25 18:00:52 -04:00
Franklin Wei
e666a7aea8 puzzles: fix text centering when zooming in
For some reason lcd_getstringsize was occasionally reverting to the system
font, rather than the loaded font. This was leading to improper font sizes
being reported.

Change-Id: Ie5fc31de9a6a7af739beb22efc3ec1383206eaea
2020-06-25 17:42:02 -04:00
Franklin Wei
5a45e96f4d puzzles: update README
Change-Id: Ifea2580989f87bb1c4b357b847121bb5f66f4dfe
2020-06-25 16:53:22 -04:00
Franklin Wei
729d6b0cb7 puzzles: update copyright date
Change-Id: I57c0554cb0d2951631d28e249eacb34c4b36ef21
2020-06-25 16:46:03 -04:00
Franklin Wei
d75131569c puzzles: clean up error messages
Expands buffer size, and prints to LOGF.

Change-Id: I6dbcf60152d69c928270023c550976b802269d95
2020-06-25 16:46:03 -04:00
Franklin Wei
b67d9e9217 puzzles: fix crashes and odd behavior on load
I can't believe this has gone unnoticed for so long... We need to update
the game size upon loading games. Who knew?

Change-Id: I929f8139457853440ae687bd937af989fa7c6f93
2020-06-25 16:46:03 -04:00
Franklin Wei
48b0ef1cf2 puzzles: resync with upstream
This brings the upstream version to 9aa7b7c (with some of my changes as
well).

Change-Id: I5bf8a3e0b8672d82cb1bf34afc07adbe12a3ac53
2020-06-25 18:45:58 +00:00
Franklin Wei
dd3a8e0898 puzzles: remove dependency on gamedesc.txt
This should allow syncing with fully clean upstream source trees.

Change-Id: Ie476a4d2ef72a411150cacc2bd45265170670e1d
2020-06-25 18:45:26 +00:00
William Wilgus
3074ade465 Pictureflow Fixes -- Fixes
The name buffer is using too much ram for some targets
will revisit later...

removed extraneous call to set_scrol_lline

Change-Id: I56d658149bcb0c50857d25924e37bcb46a612c75
2020-06-25 12:02:16 -04:00
Adrián Tinoco
e8a3ade0ea PictureFlow fixes:
- Extra data structure to store artist info.
      - Create_album_index modified to perform a different query.
      - Added load and save functions to store the data index in HDD.
      - Album collisions fixed.
      - New config options to perform rescans.
      - Extra fields added to lang files: english and spanish.

	Update CREDITS

Change-Id: I31814b38d8b4e7fa4b65f5e6e51aa5f00d271ece
2020-06-25 14:56:07 +00:00
William Wilgus
ce61be4d59 lua boomshine update to use rockevents library
using rockev for button presses

misc code refactoring, comments

drawing code is now split from game logic

cpu boost for targets that support it

removed quite a few if then statements by using dynamic functions
for ball draw, step, hit_check

shows two ways to do OO functions (closure and reference)

Change-Id: I63e795bbe90b033eabadc1f519cf3b635cf5e1a7
2020-06-25 13:50:57 +00:00
William Wilgus
df1b3c1d2c lua RockEv timing fixes
just a few tweaks to the RockEv backend to allow tighter event timing

originally there was a timeout where events would be consolidated
prior to running the event thread, this slowed the faster events
but it turns out this isn't really a big waster of time
The callback from C => lua is a far bigger bottleneck

Change-Id: Iffacbe49c4b83155099b1304590450f746576fa4
2020-06-23 11:17:17 +00:00
William Wilgus
e4ee5980c6 lua add _fullpath and argument parsing
WIP for passing arguments to lua scripts

args are recognized by adding ?arg to the end of the script path
The easiest way to do this currently is to use the function rb.restart_lua

local sfile = rawget(_G, "_fullpath") or ""
local sArgs = rawget(_G, "_arguments")

if not sArgs then
    rb.restart_lua(sfile .. "?my arguments")
else
    rb.splash(1000, sfile .. "?" .. sArgs)
end

I'd eventually like to figure out a sensible way to do this from a
shortcut / quick list

Change-Id: I2b60fe3b8f1d04b57361fe532510bd6afee59fbf
2020-06-01 13:23:38 -05:00
Sebastian Leonhardt
2eb15354b7 fix plugin test_boost not properly unboosting
Change-Id: Ib33bb58fc7006c03caa692c377860bfdf463298e
2020-05-24 13:43:30 +02:00
Solomon Peachy
0cee5ba91b mikmod: Use -Wno-stringop-truncation with GCC >=8
This will silence a false warning/error when -D_FORTIFY_SOURCE is used

Change-Id: Ic75dbaaa1f419d63163c797d127e6d1928781fd2
2020-05-18 01:15:42 +02:00
Solomon Peachy
d73bfd1a42 pdbox/doom: Use -Wno-stringop-truncation with GCC >=8
This should shut up a lot of the sim build failures

Change-Id: Ieaa387585cb8ca0f8b2faff24c08aad9451b28ce
2020-05-18 00:47:04 +02:00
Thomas Jarosch
87f54b9745 Alpine CD changer emulation: Fix logic error in detecting non-playing status
cppcheck reported:
apps/plugins/alpine_cdc.c:721]: (warning) Logical disjunction always evaluates to true: EXPR != 4 || EXPR != 3.

Change-Id: Ib811defeac18832227aebe96f0524670c2afa76a
2020-04-17 04:33:17 +02:00
Solomon Peachy
dc3537e1c0 Silence a build warning in the superdom plugin.
Potential uninitialized variable, found by android NDK10 toolchain

Change-Id: Ia67f69997d9eab8fe4828111ed52576b0a1c423f
2020-04-13 17:26:22 -04:00
Solomon Peachy
46e2528992 av300: Continue cleaning out keymaps.
(A lot of work was done on this thing, for a target that hasn't been compileable
 at least since we moved to git..)

Change-Id: Ibface9392f3251b5be4bf1e0c4d12639c4f1662d
2020-04-13 22:59:29 +02:00
Solomon Peachy
e28d1fe916 SDL: Silence a large number of compile warnings (WIP)
There are some real bugs in here, but we're drowning in warnings.

Change-Id: I7c2c0eafc8426327521bdd8a3ac2d3742ac16864
2020-04-11 19:29:47 +02:00
Marcin Bukat
180cef835b xDuoo X3II and X20 port
Provided by Roman Stolyarov
Integration, Refactoring, and Upstreaming by Solomon Peachy

X3II confirmed working by forum tester, X20 is nearly identical.

This includes bootloader, main firmware, and the flash image patcher.

Eventual Todo:

 * Further refactor AGPTek Rocker & xduoo hiby bootloaders
 * Further refactor AGPTek Rocker & xduoo hosted platform code

Change-Id: I34a674051d368efcc75d1d18c725971fe46c3eee
2020-04-06 18:15:41 +02:00
Moshe Piekarski
ced3a20aac Remove unused score tracker from Pacbox AI
Change-Id: I0a72f397f8d22b6543380e963383f6f7649a777b
2020-04-06 02:52:32 +02:00
Franklin Wei
6087c1caa5 Fix red introduced in 191ffe2.
Some leftover code from upstream was triggered by the __linux__ macro on
hosted targets.

Change-Id: Ib338e99d3b0d491d983dd92b8d554eed0c547c76
2020-04-05 00:44:30 -04:00
Solomon Peachy
0bf0d47072 Enable SDL for native MIPS and hosted targets.
Change-Id: I36f16530bf6dc108e44e1fd1ff5a550aa8139641
2020-04-05 01:34:24 +02:00
Solomon Peachy
c8111eb5b7 archos: Shut up a compiler warning by marking an inline function as static
Change-Id: I6222b87159235a28f2b69b512f95eafb8dd60564
2020-04-01 03:18:41 +02:00
Franklin Wei
f8cd15e226 sdl: disable alignment trap
Apparently causing issues on some devices.

Change-Id: I6adb65513bf65c559a0fa8980e693f1e5324d4ad
2020-02-01 22:11:56 -05:00
William Wilgus
f45db552f3 lua rockev rewrite
After a few issues with the timer code in the hosted players

I realized a few shortcomings in the original rockev code...
This rewrite gives thread_exit an explicit flag instead of 0
custom events now have a set-able timeout
previous lua hooks are restored
flags are stored in uint8_t

Change-Id: I9ca45246ac9233a2faa581e26a8cc5e5fb512e88
2019-11-15 14:28:03 +01:00
Franklin Wei
05dd4390c6 solitaire: reword menu to "Quit without Saving" and "Quit"
Patch submitted by Michael Carr.

Change-Id: I3a1555fe4b6182211203dc8770137e868c76e245
2019-11-03 21:44:48 -05:00
Moshe Piekarski
85a437780e Pacbox AI Improvements
-Make pacbox AI score agnostic.
 -Fix corner case of Game Over/reset with AI on.
 -AI can now start on level where pattern starts facing right.

Change-Id: Ibc5416a53ebc07506c31434051b6d47b276cf668
2019-11-03 21:31:19 -05:00
Franklin Wei
19c154fe8f wolf3d: change version to shareware
This makes wolf3d work with the shareware files available on the wiki. This
will make things work out-of-the-box with Rockbox Utility.

Change-Id: I9118ecf8715c688565982fc4feb29a8641d68b6a
2019-10-30 00:07:09 -04:00
William Wilgus
7f1e6b4638 lua rockev cleanup
with the addition of suspending all events on thread start and exit
we don't really need to block on THREAD_QUIT in so many places

Removed suspend clearing on event unregister and updated comments

Change-Id: Id9c6a460def558c5331ee292035691a9f82b2c43
2019-10-07 22:07:22 -05:00
William Wilgus
19084181a1 lua rockev fix possible race on thread exit
report of call after free on event thread on Agptek Rocker
I'm guessing its a race condition between the thread and the timer
but can't say for sure without some more testing

Change-Id: If11bd718b3cfa81ea13fff378df56d12afa17a7f
2019-10-08 01:09:52 +02:00
Franklin Wei
c0cc9aa9e8 quake: clean up asm mixer
Fixes my ugly formatting.
2019-10-07 14:52:30 -04:00
William Wilgus
01cccaf2d2 lua move strip_extension and create_numbered_filename out of main binary
rb.strip_extension and rb.create_numbered_filename
have been moved to include_lua/files.lua
to use simply add require('files') to your script

Change-Id: I95af7b312c8614cb10da4b71b22714b3e282e08a
2019-09-28 03:15:15 +02:00
William Wilgus
4fb783582f lua rocklib_aux.pl support for enums
everything that would have been added has already been added or
needs more supporting functions so they've been excluded for the time being

Change-Id: I4ae4753c543287934702a3bd2eeccce5b032235d
2019-09-27 11:11:34 -05:00
William Wilgus
bad739c0d8 Fix red lua remove and consolidate some rb plugin functions
I'll revisit adding enums once I research it a bit more

Change-Id: If10c445cf770e5b90defc543f08d8de0817b2f3d
2019-09-27 00:17:33 -05:00
William Wilgus
de06a06351 lua remove and consolidate some rb plugin functions
removes some usless / duplicated functions
removes atoi - lua tonumber() does this for you
removes strlen - lua string.len does this for you
removes system_memory_guard - if a device that actually implements
              system_memory_guard needs it we can add it back conditionally

consolidates talk_number and talk_spell (on backend)
consolidates talk_shutup and talk_force_shutup talk_shutup(bForce)

Change-Id: Id132642f087975a7c132e99a668a41c977942b81
2019-09-26 23:45:38 -05:00
William Wilgus
d0883d747a lua give luadir the ability to return table of attributes
for fname, isdir, attrib in luadir.dir(scrpath, true) do

passing true for the second argument returns table of
file/dir attributes in attrib

Change-Id: I7c999e2fc5dac95b8ccbe169f2119c31b63f6a41
2019-09-18 21:20:42 -05:00
William Wilgus
13245ebf76 lua add menu callback
forum user fprockboxer asked for a way to detect long presses within the
do_menu routine this adds that functionality

result = rb.do_menu("Title",t_items, start, menu_callback)

function menu_callback(action)
    ...
    return action
end

Change-Id: I110c590095a743a57d0a7d45b24309899a4629cf
2019-09-14 04:48:04 -05:00
William Wilgus
f9225da811 Fix red Lua extend error splash timeout and stop cutting off info
Change-Id: Icd6fe0fa1088ab59b8214f7c860f262ce67fe205
2019-09-06 21:13:16 -05:00
William Wilgus
bbd4a6cb91 Lua extend error splash timeout and stop cutting off info
Change-Id: Ia1a9e39b9f203002cbbea85ef965e66c334b83fc
2019-09-06 20:19:42 -05:00
William Wilgus
267d04d2bd Lua add metadata and settings reading helper module
Adds example scripts for reading track metadata + dumping albumart
and rockbox settings

settings are now stored as a table of strings rather than a table of tables
as it saves ~15 kb of ram without adding much complexity

Change-Id: I611c312b2a60ab96e595e4710b17aedbd6c0689b
2019-09-07 03:10:59 +02:00
William Wilgus
c251d1879f lua fix mem_read_write, strtol
back when I wrote this I was running the sim on a 32 bit machine
I didn't catch the hardcoded LONG_MAX reference or the fact that
lua_tointeger maxes ot at 32 bits

on 64 bit machines strtol caused all kinds of issues especially since
it returned the real LONG_MIN/MAX values

Change-Id: I3571ebbd9df333f7cbf4077562412c27429bfadc
2019-08-28 00:56:08 -05:00
William Wilgus
b99d4d7fa9 lua optimize poly_draw add draw_number, poly_points modules
Change-Id: Id36e765f18234f5a4f3092d090c0adffa3da1612
2019-08-26 22:17:33 -05:00
Vencislav Atanasov
9f551b09f6
sdl: Fix path substitution in log messages, fix game names in comments
Change-Id: I7854d55153d656e84e791759f8ed664e41bff7e5
2019-08-22 22:00:43 +03:00
William Wilgus
ecfb4590ad lua fix polydraw missing functions
Change-Id: I9e2537e4839e2b4f9beddbc887610213ed954a87
2019-08-20 01:58:16 -05:00
Solomon Peachy
22c6326974 Improvements for vbrfix plugin:
* Properly account for ID3v1 tags
 * Play time computation fixes
 * Add speech feedback

Patch by Igor Poretsky

Change-Id: Ia6df8fb171882a88527cfa9d3b76b705f09becdd
2019-08-13 17:07:07 +02:00
William Wilgus
3d06d35bf6 lua rock events crash on error in main state
on errors thread stack overflows
yielding before thread_exit() is a bad idea apparently

Change-Id: Iac45d4321fac496738384fdbbeb480356ef2a1bb
2019-08-12 07:28:24 +02:00
Sebastian Leonhardt
3b75f98700 Windows shortcuts: remove warnings
Change-Id: I987cbf14da2f320ddbe3190b48ba5f8006d2ea3f
2019-08-11 22:57:08 +02:00
Sebastian Leonhardt
5c701b0280 Add support for Windows shortcuts (*.lnk files)
Supports only relative links across the same volume.

Change-Id: I4f61bb9d5f2385d5b15d2b9d9a3f814a7ac85b54
2019-08-11 22:26:49 +02:00
Franklin Wei
49dd38c184 quake: further optimize D_DrawSpans8
Found on http://forums.insideqc.com/viewtopic.php?f=3&t=3327

Adds 1.1FPS (+8%) on ipod6g.

Change-Id: I608588ff99d70ff5ce28d2c649afa4b10038cc03
2019-08-09 23:05:46 -04:00
Franklin Wei
4397194110 quake: enable PQ_OPT5 (a fixed-point DrawSpans8)
This boosts performance to 13.0FPS on ipod6g for `timedemo demo1'. That's a
+34% increase from baseline.

Change-Id: I50bae7783ff2fce46e8257c251c6b639c069e7cb
2019-08-09 21:27:55 -04:00
Franklin Wei
f5bb7fddec quake: merge the remaining Pocket Quake PQ_OPT changes
I didn't do _OPT3 because it's disabled in the PQ source.

This gives as +0.2FPS boost over the last commit.

Change-Id: I9c3c8fb7bd23262beb810da6e9469d6b6c4b2a81
2019-08-09 21:27:55 -04:00
Franklin Wei
ee70dad305 quake: merge some fixed-point optimizations from PocketQuake
The PocketQuake project, available below, has some nice fixed-point code:

https://web.archive.org/web/20150412233306/http://quake.pocketmatrix.com/PocketQuake0062_src.zip

I'd like to see most of them merged into our Quake port. This commit
gives +0.9FPS on ipod6g. (A big change given that it was running at
only 9.7FPS to begin with!)

Change-Id: I91931bdd5c22f14fb28616de938a03b4e7d7b076
2019-08-09 21:27:42 -04:00
Solomon Peachy
7737327bfe Fix mikmod plugin build on armv4 targets (broke in 5b23c9e)
Change-Id: I1c79fbe44c13396388c533c4664b4ce1db150ac9
2019-08-08 23:04:11 +02:00
Solomon Peachy
5b23c9eb0a Introduce HW_SAMPR_MIN_GE_22 macro
Gives us the lowest HW sample rate that's >= 22KHz.

Needed because some targets that don't support 22K support 11K or 8K, so
HW_SAMPR_MIN will give us much lower quality than is acceptable.

Take advantage of this new macro in the SDL, MIDI, and MIKMOD plugins,
and implement a crude "fast enough" test to enable higher sample rates
on more capable targets.

Change-Id: I6ad38026fb3410c62da028e78512e027729bb851
2019-08-08 22:37:30 +02:00
Solomon Peachy
a430e275dd Fix lua compile error on most targets, introduced in 8d77ec8
Change-Id: I217f78a9e348a18552563c6c3b235c9aed956f54
2019-08-08 15:09:04 +02:00
William Wilgus
8d77ec88a5 lua LCD fix
forgot to set new size after realloc

forgot to set sizelineinfo to 0 after free

Change-Id: Iaf7533aafaba1e2abf9599c9e1d0b75d913a8c36
2019-08-08 07:36:04 -05:00
William Wilgus
d61ea6c5ee lua LCD (Lua Compact Debug) patch
LCD developed 9/2015 by Terry Ellison

 We've already discarded the ldebug module from lua
 it only makes sense to discard the debug info as well
 adds 1.5 K to the binary
 saves 8 Kb on the base state
 once scripts start getting called i've seen 10-50Kb savings but it all depends on
 what exactly you are running

Change-Id: Ibb74f344df1c4c96380ec6c98b010a810e9ae9cc
2019-08-08 07:11:30 +02:00
Franklin Wei
1dabca6c26 sdl: document some pointer voodoo
This was lifted straight from pictureflow...

Change-Id: Ie09184390e6fcea007e7daea001f075de307f878
2019-08-08 00:10:34 -04:00
Solomon Peachy
b1f2c795a6 Speech feedback in the pictureflow plugin
Patch by Igor Poretsky

Change-Id: I99d789e43d1093c69b4d76f58704303d3c1b3c80
2019-08-07 09:50:27 -04:00
Solomon Peachy
2ebb8da275 Mikmod plugin improvements
- Improved sound quality (use 44.1KHz)
 - Conventional mixer is now used
 - Playback is performed in a separate thread
 - Speech feedback in menus

Patch by Igor Poretsky

Change-Id: I13baa224cefd67aefe6d62b988971bfbd421757d
2019-08-07 09:48:15 -04:00
William Wilgus
951a614852 lua fix lua_close on os.exit(0)
Change-Id: Ib225ecf9ea64c95e438c4114b23239c118ab19a2
2019-08-05 21:25:01 -05:00
William Wilgus
1b41e6ec43 lua fix crashes EGC failure to lock stack in concat
Change-Id: I980637b1d8aa91d7ac0ed71fd0e7d21bda7876c4
2019-08-05 21:20:30 -05:00
Solomon Peachy
ed724fecb1 Midiplay plugin ehancements
- Improved robustness
 - Improved sound quality
 - Use mixer and DSP

Patch by Igor Poretsky

Change-Id: I6fa617158cbaa53ae842295cdbdbe3a478e49ded
2019-08-05 20:48:40 +02:00
Solomon Peachy
701bf06b26 Voice enable properties plugin
Patch by Igor Poretsky
Updated by Solomon Peachy

Change-Id: Ia2adf4a65723b08d6c438f836e3e811cba3dced0
2019-08-05 04:10:25 +02:00
Solomon Peachy
2a737d3e6f Fix stack overflow issues in properties plugin
Patch by Igor Poretsky
Updated by Solomon Peachy

Change-Id: I6b90845712ff92ce7b08b41e5ec92eb33faeff50
2019-08-05 03:25:17 +02:00
Solomon Peachy
40da2f7ba7 Speech enabled main menu config plugin
Patch by Igor Poretsky

Change-Id: Idffba2b1f1d225fc9278dcfab6a728fca5afe81d
2019-08-05 02:33:37 +02:00
Franklin Wei
08fd69c347 sdl: fall back to minimum supported sample rate if 22 kHz is not supported
Fixes too-fast audio playback on devices that don't support 22 kHz.

Change-Id: I78d4934bfd40f69c0d7bc9e8021df3f4edf0a9fb
2019-08-04 22:57:58 +02:00
Solomon Peachy
4ad76652ef Speech feedback in mpegplayer menus
Patch by Igor Poretsky

Change-Id: Idc6920e17be6537557f2b1cf00f7e559e30b45e8
2019-08-04 22:47:00 +02:00
Franklin Wei
7234de58ae sdl: don't set alignment trap if < ARMv5
This should fix crashes on ARM7TDMI as reported by foolsh.

Change-Id: I9aaf6196837d284a67a9e2b0edc72ecd644fd59f
2019-08-04 20:59:30 +02:00
William Wilgus
d1f349bf77 lua optimize print include, fix draw_poly
Change-Id: Ibb530cfa63681727be518173404952e897c9d297
2019-08-04 17:54:03 +02:00
William Wilgus
f85df30e3e lua add rlimg.lua example script split large includes to separate files
Change-Id: I67cac5bc4ce5525ab30abf9443f6cc1a33190512
2019-08-04 16:57:02 +02:00
Franklin Wei
827c881583 quake: update readme
Change-Id: Ic9ec250ad9c58dad33b703f0874c0307962fd199
2019-08-03 12:30:40 -04:00
Franklin Wei
7ba2ef566e sdl: use mutex in printf()
This prevents lines of output being overwritten by different threads.

Change-Id: I24cee52238b53c8a4b2536e082bb4bcd103d8d60
2019-08-03 05:05:35 +02:00
Franklin Wei
fee68fc612 quake: synchronize Mod_LoadModel and S_LoadSound
This is not a very pretty fix, but code that doesn't crash is better than
code that crashes... "If it runs, it's done."

Change-Id: Ia1d0c537e5e5e60fb80cf7d7de2332e1c712806f
2019-08-03 05:05:05 +02:00
William Wilgus
9d2af8777f lua update tagnav.lua with reload menu and bug fixes
Change-Id: I0e7364a3432bf867cb368c131bf83643115f9d0b
2019-08-02 05:16:43 +02:00
Vencislav Atanasov
722ddcf6ba sdl: Fixes for the SDL apps, so they support building simulator on Windows
Change-Id: I277d391482a80e5bf9dd8049cd3b78c5cae7205e
2019-07-31 19:34:18 +02:00
Franklin Wei
94109a9506 quake: fix file loading errors
Forgot a return statement in Sys_FileRead (which slipped by since I've made
the questionable decision to disable all warnings...)

Change-Id: Ia0f3da52b43765b8e0e9953893ac7957ec2f6c2e
2019-07-30 03:44:43 +02:00
Franklin Wei
5e0bd5bfc0 quake: add notification upon strange error
For some reason a NULL pointer creeps in, on the simulator only, it seems.
This makes sure that if it happens on target we'll know about it.

Change-Id: I7a5bc9dd3ef71f28d58d0d456d23007dc0d49ce3
2019-07-30 03:44:25 +02:00
Franklin Wei
caee6c578d quake: fix race condition
COM_LoadStackFile was not thread-safe since it relied on a global variable
to pass the loadbuf parameter to COM_LoadFile. This was causing mysterious
crashes when model loading and audio mixing were happening simultaneously.

Change-Id: I505c5ef0ed49d0c4aa4b11cfed05647c75b5b40d
2019-07-30 03:44:09 +02:00
Franklin Wei
0b23348610 sdl: forward-declare fscanf_wrapper
Silences a few warnings (if you enable them).

Change-Id: Id9a9f4c688742c13ee3eb0777c40b4d4edcda224
2019-07-30 03:43:57 +02:00
Franklin Wei
c31700f922 quake: properly synchronize zone.c
Preventative measures. Somehow SDLQuake managed without these...

Change-Id: Icef15f3f653fa115ad8fb1ccc3f9682e453701c3
2019-07-30 03:42:36 +02:00
William Wilgus
138a4f9d3d lua rocklib_img optimize functions with multiple checkint calls
Uses int arrays and calls luaL_checkint in a loop

Change-Id: Ib73dab886f018c787bd995f64d990981d194069f
2019-07-29 05:54:27 -05:00
William Wilgus
90118f14cf lua add demo scripts, atexit handler, gui_scrollbar_draw
Change-Id: Ie8794e8a487f73952dae43e036787b6972fdbbee
2019-07-29 02:51:29 -05:00
Franklin Wei
8bafa1bc9b pacbox: fix red and enable AI on all targets
Change-Id: I4275e4ec374f3b5a6839890e4a2aa0f577f56522
2019-07-28 21:03:38 -04:00
Moshe Piekarski
b3295f0ed6 Pacbox AI
Pacman can make moves by itself

Change-Id: I7a39fed1e2bf5dbfb07e4d801d080a6e097730e9
2019-07-28 20:25:16 -04:00
Vencislav Atanasov
183e45e8d0
sdl: Remove platform-specific code
Also nuke the Makefiles of Duke Nukem 3D (pun intended).

Change-Id: If2707cf079bfb9299347f9c5f980780134b6ecda
2019-07-29 01:59:40 +03:00
Franklin Wei
e19857e712 duke3d: remove unused files
A bunch of cruft left over when I copied the files...

Change-Id: I29d12dae9e507af477fc06ff348c02aee68606a8
2019-07-29 00:50:23 +02:00
Franklin Wei
8379b230f6 lua: wrap thread_set_priority with #ifdef HAVE_PRIORITY_SCHEDULING
Should fix a compile-time error on simulator.

Change-Id: I5962479579350ebffe6dcce4f65a629b108ff936
2019-07-29 00:50:11 +02:00
Solomon Peachy
5572904887 chessbox: Fixes and enhancements
- Unfinished game is now saved along with current position.
- All savings are automatically done on shutdown.
- Implemented facility to view played games.
- Fixed bug that prevented program from the very first move.

Patch by Igor Poretsky

Change-Id: I997b97752e4362ed953309bea985d071f9db229b
2019-07-28 18:39:41 -04:00
Vencislav Atanasov
7f9fc20afa Use full_path_subst on more places, to avoid replacing the wrong occurrences in
paths.

If ROOTDIR=/rockbox and BUILDDIR=/rockbox/build-something, it is now possible to
successfully build both target binaries and simulators.

Change-Id: If12d1d5933c5a15feebf627a4f1636dc1e3a67fa
2019-07-28 21:00:57 +02:00
Franklin Wei
d8330c9c18 sdl: gut OS/2, win32 code from SDL.c
This should help with compiling win32 simulators.

Change-Id: Icfbf78f7d0a8b0ddebffa8daac3adf55ac21f139
2019-07-28 14:27:49 -04:00
Franklin Wei
090bdedc62 quake: add README with some notes
Change-Id: I702e81f8715b505d4ed6d0eca861e3ddb680038d
2019-07-28 14:06:45 -04:00
Franklin Wei
711ddfdaad sdl: gut non-Rockbox platform detection code
This should prevent false positives when simulators for other systems (e.g.
win32).

Change-Id: Ib14a277fbfeb1b0ae141ebc4591d80a2cc0f526d
2019-07-28 13:59:32 -04:00
William Wilgus
45bd14b392 Lua Add Emergency Garbage Collector
Derivative of work by RobertGabrielJakabosky
 http://lua-users.org/wiki/EmergencyGarbageCollector

I've only implemented the not enough memory part and
 expanded this idea to adding a mechanism to signal
 the OOM condition of the plugin buffer which allows us to only
 grab the playback buffer after garbage collection fails
 (SO THE MUSIC KEEPS PLAYING AS LONG AS POSSIBLE)

Change-Id: I684fb98b540ffc01f7ba324ab5b761ceb59b9f9b
2019-07-28 15:17:48 +02:00
William Wilgus
ddf612c84b lua remove unneeded plugin functions
Change-Id: I04bc38d03b7f0ca65a815685eb6ab0f5ff825c45
2019-07-28 07:29:10 -05:00
Franklin Wei
fd20114eb2 robotfindskitten: clear message line before cinema scene
Just writes a bunch of spaces to clear the space before playing our
animation.

Change-Id: I9422190b691039252de70a5c7eec6286c686f031
2019-07-28 01:30:29 +02:00
Franklin Wei
feacbcd639 quake: cache files in memory to eliminate skips
This caches large files (arbitrarily defined as >1MB) in memory, which
reduces the delay when a new model or sound is needed.

Change-Id: I0f96449555a32f05d771fe900c10eaf21ecbb4f6
2019-07-27 16:07:39 -04:00
Franklin Wei
cdfb7d44f2 sdl: fix video regression introduced by 5d05b9d
The quake commit tried to optimize lcd updates but inadvertently broke
wolf3d (which always uses a 320x200 screen size). This fixes that and also
lets direct mode truly exit early to hopefully save some cycles.

Change-Id: I41d96cd584257fe25e791c7f615812849f348e4f
2019-07-25 14:27:17 -04:00
William Wilgus
6e32e06498 lua add sound_current, consolidate sound_ functions
add defines for sound functions
 SOUND_VOLUME, SOUND_BALANCE, SOUND_CHANNELS, SOUND_STEREO_WIDTH ...
 defines depend on target
 require "sound_defines" to add them to rb.sound_settings[]

consolidates:
 sound_set, sound_current, sound_default, sound_min, sound_max,
 sound_unit, sound_pitch, sound_val2phys to a single function

 rb.sound("name", setting, [value])

 require "sound.lua" for old functionality

Change-Id: Ice695218aa433f4fcbb48fbd6b8a9bf29c994110
2019-07-25 10:17:40 -05:00
Franklin Wei
7e4902bf6b quake: fix errorneous endian-correcting reads
ef9ee89 introduced Read{Big,Little}{Short,Long,Float} functions to safely
read a value in memory. These incorrectly take char*, which causes them to
output erroneous 0xff bytes when given bytes with bit 7 set.

Change-Id: I9531172301aecfdacae405d2f782f662608ce6df
2019-07-24 21:02:11 -04:00
Franklin Wei
ef9ee8935f quake: fix unaligned accesses in model.c
Allows playing registered episodes.

Change-Id: I20e1ca2000776a19767a9c3caef790d4f62ca188
2019-07-21 15:13:35 -04:00
Franklin Wei
2ca47176f9 quake: pack structs which could potentially be unaligned
The d*_t structs are from "d"isk, which means they could be
unaligned. Packing them saves me from having to rewrite every single
access to them.

Change-Id: I6d5a9525fff368bf29bdb85cf1672fce02ce3396
2019-07-21 15:13:35 -04:00
Franklin Wei
f83de422fa quake: enable building Quake2
Change-Id: I67f8f7c6e7e337806751057d1c9ebdae16c54119
2019-07-21 15:13:35 -04:00
Solomon Peachy
5a84239e43 Add speech feedback to imageviewer plugin
Patch by Igor Poretsky

Change-Id: Ifcca7342d07f0d7fb90d282468f7e6576c13d36b
2019-07-20 17:20:19 -04:00
Solomon Peachy
78892b5eb0 FS#7705: Voice enable battery bench plugin
Original patch by Daniel Dalton
Updated by Igor Poretsky

Change-Id: I40d3bb89dbaf3582e1d7af8e8964205507cd2a8d
2019-07-20 20:42:02 +02:00
Solomon Peachy
4edaf3fb98 FS#7912: Voice enable the chessbox plugin
Original patch by Mario Lang
Heavily updated by Igor Poretsky

Change-Id: Iaa0c32a79a464860ff294096825ae788f35cf312
2019-07-20 20:14:18 +02:00
Solomon Peachy
3cb272c97a build: Fix puzzles build due to missing dependency
As rbcompat.h is -include'd on the command line, the mkdep script doesn't
pick it up.  Explicitly add the dependency to lang_enum.h to the makefile.

Also add lang_enum.h to the 'make clean' target!

Change-Id: I33c8ed0cd5c1d44dce02ac9285469c0e4feac00e
2019-07-20 10:06:12 -04:00
Solomon Peachy
55eb1c54eb FS#7704 - Talk support for plugins
Original patch by Mario Lang
Heavily updated by Igor Poretsky
Further updated by myself

  This patch breaks binary API compatibility by placing the new
  functions where they make the most logical sense. IMO this is
  the better approach to take given the scope of the changes needed
  for talk support.

  Since binary API is changing, the patch also moves some other
  functions around to more logical locations.

  As well as voice support in plugins, this patch voice-enables several
  simple plugins.  There will be follow-up patches for many plugins that
  build on this one.

Change-Id: I18070c06e77e8a3c016c2eb6b6c5dbe6633b9b54
2019-07-20 08:48:35 +02:00
Franklin Wei
9c17734394 Silence warning in stdio_compat.h
Change-Id: I5aecaf6fcf42fbaf2deb933e590dcda6d01ac212
2019-07-19 23:51:07 -04:00
Franklin Wei
5d05b9d3e9 Quake!
This ports id Software's Quake to run on the SDL plugin runtime. The
source code originated from id under the GPLv2 license. I used
https://github.com/ahefner/sdlquake as the base of my port.

Performance is, unsurprisingly, not on par with what you're probably
used to on PC. I average about 10FPS on ipod6g, but it's still
playable.

Sound works well enough, but in-game music is not supported. I've
written ARM assembly routines for the inner sound loop. Make sure you
turn the "brightness" all the way down, or colors will look funky.

To run, extract Quake's data files to /.rockbox/quake. Have fun!

Change-Id: I4285036e967d7f0722802d43cf2096c808ca5799
2019-07-19 22:37:40 -04:00
William Wilgus
3e2b50ed3b lua events from rockbox
This library allows events to be subscribed / recieved within a lua script
most events in rb are synchronous so flags are set and later checked by a
secondary thread to make them (semi?) asynchronous.

There are a few caveats to be aware of:

FIRST, The main lua state is halted till the lua callback(s) are finished
 Yielding will not return control to your script from within a callback
 Also, subsequent callbacks may be delayed by the code in your lua callback
SECOND, You must store the value returned from the event_register function
 you might get away with it for a bit but gc will destroy your callback
 eventually if you do not store the event
THIRD, You only get one cb per event type
 ["action", "button", "custom", "playback", "timer"]
 (Re-registration of an event overwrites the previous one)

Usage:
 possible events =["action", "button", "custom", "playback", "timer"]

 local evX = rockev.register("event", cb_function, [timeout / flags])
  cb_function([id] [, data]) ... end

 rockev.suspend(["event"/nil][true/false]) passing nil affects all events
  stops event from executing, any but the last event before
  re-enabling will be lost, passing false, unregistering or re-registering
  an event will clear the suspend

 rockev.trigger("event", [true/false], [id])
  sets an event to triggered,
  NOTE!, CUSTOM_EVENT must be unset manually
  id is only passed to callback by custom and playback events

 rockev.unregister(evX)
  Use unregister(evX) to remove an event
  Unregistering is not necessary before script end, it will be
  cleaned up on script exit

Change-Id: Iea12a5cc0c0295b955dcc1cdf2eec835ca7e354d
2019-07-19 20:48:34 -05:00
William Wilgus
8bd992c503 lua disable bytecode dump & undump functions
Adds a flag to remove the ability to dump and load lua bytecode

saves 6+kb

Change-Id: I080323df7f03f752e0a10928e22a7ce3190a9633
2019-07-18 14:56:00 -05:00
William Wilgus
d5908f520e Fix Red lua move constants out of binary image
didn't consider sims might have reserved enums

Change-Id: Ic404972f0836bc81ba149f4ecdd3ec61bd8bd4b3
2019-07-18 10:53:34 -05:00
William Wilgus
c9aeb4284e lua move constants out of binary image
Rockbox constants are auto generated by a perl script like the majority
 of the plugin functions.

Constants are contained in rb_defines.lua, if the file exists it is auto loaded
 by the lua state for backwards compatibility

Frees ~1k

Change-Id: I237700576c748f468249e501c839d89effca3f39
2019-07-18 08:42:00 -05:00
William Wilgus
47639fb9ac lua alphabetically sort perl generated rocklib_aux functions
Change-Id: I6566c19a0fee630a5e250c1244159d5b488b57ff
2019-07-17 10:22:21 -05:00
William Wilgus
fc25562842 lua close state on os.exit
Change-Id: I376fad0f92f1155698740e1b8599a3385998575c
2019-07-13 07:46:32 -05:00
Franklin Wei
7739ad6622 wolf3d: allow entering in-game jukebox by holding fire button
Change-Id: I8936178191e682b70c64ef6ae04d6636e5cf3521
2019-07-12 16:21:11 -04:00
William Wilgus
ee58f2601c lua reduce heap allocated buffer sizes, organize luaconf.h
Change-Id: Ib9e568ea73a01474facd57cc155e62fa3dc093f7
2019-07-11 11:59:43 -05:00
William Wilgus
a332924f68 lua late bound cfunction tables
We have quite a bit of ram tied up in lua with our c libraries
I was searching for a way to free up some of this when I came
across read only tables in e-lua but that involved a lot of patching
through the source

Instead I came up with this..
it frees about 15k ram without much slowdown in code execution
since after a function gets called it is automatically added to the table

If you have a performance issue you can call the bind method
to bind a specific function or the whole table in one shot

for instance rb table
rb("lcd_clear") -- binds/returns function rb.lcd_clear()
rb(nil) -- binds every function in rb table + removes latebind metatable ..

-- added pairs and ipairs code from lua 5.2
-- cleaned up code + made more seamless
  existing fields are now saved rather than overwritten when table is bound

Change-Id: I1c20e76b736c032dedc727d2e58928641e40191d
2019-07-11 00:09:54 -05:00
William Wilgus
c6fcb1cf45 lua inbinary strings
Allows saving of ram by reusing strings already stored in the binary
and storing a pointer instead of malloc and copy to get them inside
the lua state

Saves about 1.5K overall

Derivative of work by bogdanm
RAM optimizations: pseudo RO strings, functions in Flash
d54659b572

Change-Id: I21d6dcfa32523877efd9f70fb0f88f2a02872649
2019-07-11 00:31:41 +02:00
Franklin Wei
42240f6990 wolf3d: increase default viewport size
Makes things a little bigger by default (but not maximized).

Change-Id: I9e4ae725e22458f1e5140a560ff242159ef582d7
2019-07-10 17:03:26 -04:00
Franklin Wei
89aea2d5fe wolf3d: write configs to /.rockbox/wolf3d instead of /.wolf4sdl
Let's keep things neat.

Change-Id: I995b2c4949d3adbbd7ea4ef361f0712aa222612e
2019-07-10 17:03:26 -04:00
William Wilgus
c0dbfc8130 lua add track length & elapsed to rb.audio()
track elapsed is needed to use fast-forward and rewind effectively
track length might as well be added too..

Change-Id: I906c92eb5260164c6177d8c0a8ff879b1fad7898
2019-07-10 05:07:25 +02:00
Franklin Wei
152e415b0d wolf3d: fix FM OPL alignment bug in a cleaner way
wl_def.h has a #pragma pack(1), which causes issues when we take the
address of an unaligned struct field. This fixes the issue by
disabling packing in fmopl_gpl.c.

Change-Id: I526880fa73226e8028855896f7efc3a66571b3ec
2019-07-09 17:34:09 -04:00
Franklin Wei
b1f16371b0 sdl: fix build
-T flag is program-specific.

Change-Id: I730a9c19be43e79c7ff4e6d4fb5b8f498f08515e
2019-07-09 13:07:43 -04:00
Franklin Wei
a1353a3eff wolf3d: add missing SOURCES.wolf
I'm dumb...

Change-Id: I5e8ebcf3d7e739c1cd50509b15fe585819ba7fb9
2019-07-09 12:30:56 -04:00
Franklin Wei
3f59fc8b77 Wolfenstein 3-D!
This is a port of Wolf4SDL, which is derived from the original id
software source release. The port runs on top of the SDL plugin
runtime and is loaded as an overlay.

Licensing of the game code is not an issue, as discussed below
(essentially, the Debian project treats Wolf4SDL as GPLv2, with an
email from John Carmack backing it up):

  http://forums.rockbox.org/index.php?topic=52872

Included is a copy of MAME's Yamaha OPL sound chip emulator
(fmopl_gpl.c).  This file was not part of the original Wolf4SDL source
(which includes a non-GPL'd version), but was rather rebased from from
a later MAME source which had been relicensed to GPLv2.

Change-Id: I64c2ba035e0be7e2f49252f40640641416613439
2019-07-09 11:20:55 -04:00
Franklin Wei
c2411f785c sdl: silence audio driver debug output
Change-Id: I7aae3419f56f9cf952d9383f2a6cf9e9950e9a6d
2019-07-09 11:20:55 -04:00
Franklin Wei
71922db6cf sdl: a couple minor fixes
Prevents system SDL from interfering with thread driver selection. Also
adds test code for alignment faults.

Change-Id: I8bc181922c4a9e764429897dbbaa1ffaabd01126
2019-07-09 11:20:55 -04:00
William Wilgus
c7f26de2bf lua remove error messages for pre-compiled chunks
We don't have the functionality in the viewer to run pre-compiled chunks
plus if anyone ever wants to add it its easy enough to remove the define
frees 3K

Change-Id: I8d2086e04b51e3ce147ab8741a7d354cb9bf1ade
2019-07-09 01:03:58 +02:00
William Wilgus
213cdfc109 Boomshine Fix rb.touchscreen_set_mode()
Change-Id: I5bc835f1e006ed923cf0b7a3fcf91d4e357913ed
2019-06-17 16:03:57 -05:00
Franklin Wei
edd93414a1 sdl: add pointer to wiki for docs
Change-Id: I6e87658351f32d3c40d9ca2b635ae2f654fdd3aa
2019-06-16 14:51:34 -04:00
Franklin Wei
b04f267ec3 sdl: prevent simulator build from using pthreads
The simulator build will pull in the host SDL headers, which we can't
filter out easily. A simple workaround is to simply remove the pthread
include from our SDL.

Change-Id: I09de0f2e85b891aa88958e21426ab450af516e76
2019-06-16 14:28:56 -04:00
Marcin Bukat
2de2636d6b Fix IRAM overflow introduced in 7a8c9daf7e
There is no easy way to determine iram available for
test_mem plugin and PLUGIN_BUFFER_SIZE is definitely wrong.

Restore previous IRAM buffer sizing

Change-Id: Ia563efd46497438c111efc8d7d2bf65904ca9847
2019-05-31 10:42:40 +02:00
Franklin Wei
38cceb9563 Work around DX90 compile error
Change-Id: I80751a41d0711c52558ba198c22d1f012998302c
2019-05-15 20:39:23 -04:00
Franklin Wei
75fe15a06c puzzles: refactor rockbox frontend
Cleaned up a bit of copy-pasted code and added some useful comments.

Change-Id: I9a6f37acbeeda58b3ea8c65ee96230372400f323
2019-05-15 18:18:17 -04:00
Franklin Wei
f940276fd9 puzzles: resync with upstream
This brings the puzzles source to upstream commit e2135d5. (I've made my own
changes on top of that.)

This brings in a couple bugfixes and a new solver for Dominosa.

Change-Id: I11d46b43171787832330a5e2e0d2f353f36f727d
2019-05-15 18:16:27 -04:00
Sebastian Leonhardt
60c9df0b12 blackjack: various fixes
- fix double down wins/looses too much money
- fix splitting doubles lost/won amount of first split
- fix insurance pays out too litle
- fix splitting allows to overdraw account
- fix insurance allows to overdraw account

Change-Id: Ib58954d6b960fb2a78f5b4d29496974b7c58fb65
2019-02-01 19:58:46 +01:00
William Wilgus
cdd4708326 lua rewrite boomshine
rewrite the logic of boomshine to make it more difficult
 especially small screens

rewrite of the game engine to make memory usage more consistent
 throught the level and decrease overall memory usage
 this also removes most of the stuttering in play

Add test of device speed this should improve very slow devices
 but the threshold might still need tweaked

Change-Id: I49f5269c69405f6b6060ab18f52c96e3f69ebb14
2019-01-24 05:39:38 +01:00
Solomon Peachy
9c86ac2983 Fix compile wanings in pacbox and invadrox introduced in d4942cc
Change-Id: I5d599d4b25207dcf03ed3f4be76d10907d36a99b
2019-01-02 10:06:11 -05:00
Solomon Peachy
d4942cc74c Add Xuelin iHIFI 770/770C/800 support
Taken from the xvortex fork (Roman Stolyarov)
Ported, rebased, and cleaned up by myself.

Change-Id: I7b2bca2d29502f2e4544e42f3d122786dd4b7978
2019-01-02 08:10:01 -05:00
Solomon Peachy
35930ddb8d Keymap improvements for the xDuoo X3
- Synchronized with actual state of Vortex version in general.
- Playback resume has been moved to the Power button.
- Option button acts identically in most contexts: main menu on short
  press and quickscreen on long press.
- Defined A-B repeat mode control buttons.
- Level change action in chessbox has been moved to the volume down button.

(Patch by Igor Poretsky)

Change-Id: I48046ff123d2bccdc0d0c4ed8b088e2053aefa5e
2019-01-02 04:57:32 +01:00
William Wilgus
a71af1778d Fix lua helpers -- supress line markers in preproc source generation scripts
In newer builds line markers prevent lua helper scripts
from grabbing some inputs especially _bool

This patch adds the -P switch
  Inhibit generation of linemarkers in the output from the preprocessor.
  This might be useful when running the preprocessor on something that
  is not C code, and will be sent to a program which might be confused
  by the linemarkers.

Change-Id: I66c3b099729f6651300f9fcf4670533a20cc90c1
2018-12-24 21:37:06 +01:00
Solomon Peachy
75fe78c802 Handle SYS_POWEROFF event in recorder and chessbox plugins
Credit to Igor Poretsky

Change-Id: I151d3511b9cee269190d87df7fa7dd355aaafc9b
2018-12-23 18:01:54 -05:00
Franklin Wei
b3356e3aff puzzles: resync with upstream
This brings the code to upstream commit 3ece3d6 (I've made my own Rockbox-
specific changes on top of that).

Changes include using C99 `bool' throughout, and minor logic fixes for some
puzzles.

Change-Id: Ie823e73ae49a8ee1de411d6d406df2ba835af541
2018-12-21 22:13:33 -05:00
William Wilgus
28f91ff3dc Lua Fix settings_helper for the gigaBeastS
the gigabeatS has an embedded struct that needs to be parsed

Change-Id: I88c9101afaaa95182f37ade1410cccb4fb768e33
2018-12-17 09:41:15 -06:00
William Wilgus
9d66b5459e Lua add read/write access to global_status, global_settings, audio_current_track
moved items to rb.system
added read access to audio_current_track and audio_next_track

Change-Id: Ia055b8cb3848e540067818f596ffd1058da057fb
2018-12-16 13:33:18 -06:00
William Wilgus
78b2d13567 Pdbox hide cast-function-type fix overlapping memcpy
dsoundfile.c used memcpy for overlapping memory regions switched to memmove
Suppress the 160+ warnings for cast-function-type
This plugin would require major work to fix these warnings

Change-Id: I309d914839c1e70126a05b387863fd21613497a9
2018-12-08 06:23:19 -06:00
William Wilgus
3d72119dd4 mpegplayer fix warnings
this should fix 'warning: cast between incompatible function types'

Change-Id: I7d192b8953fd14511431cb50254900f566eb0574
2018-11-26 01:51:09 -05:00
William Wilgus
9ed486bdc7 lua add LCD_DEFAULT_FG, fix 2-bit screen fg/bg inversion
Change-Id: Ibe2bc6602ff27524a3b96d9523780acbfbf03c76
2018-11-24 16:40:23 -05:00
William Wilgus
e36edaee55 Lua fix crash on arm devices
This is a seemingly random bug that only affects (as far as I can tell)
arm devices it isn't actually random as code changes cause it to
appear/disappear based on alignment

Change-Id: I4cbc4370677959319f8589fe454e854c45623468
2018-11-17 09:04:05 -05:00
William Wilgus
03718bdb76 Lua fix reader bug in lzio
When loading a file, Lua may call the reader function again after it
returned end of input

https://www.lua.org/bugs.html#5.1.5-2

Change-Id: Ic2f4d727705a0b8f48ce792f6a9f7af25a503037
2018-11-15 11:20:54 +01:00
William Wilgus
b69faf0bcc lua update to 5.1.5
Modify Rocklua towards upstream 5.1.5

Clean up some of the Rocklua implementation

Change-Id: Iac722e827899cf84f5ca004ef7ae7ddce5f7fbbe
2018-11-11 19:42:30 -05:00
William Wilgus
b5fb9781a6 Lua fix pixel-painter score save
pixel-painter was depending on the old readline code that
returned nil for empty lines however empty lines should
have returned an empty string

Change-Id: Ic06ce920a7ab38e1fb8f7197d637e74ed9e35653
2018-11-05 07:18:08 +01:00
William Wilgus
85079483c5 Lua Boomshine Update with circles + levels
added a few more levels and increased difficulty based on level

Rliimage allows us to use circles in boomshine
Optimized some of the code to exceed the speed of the original

Change-Id: I68eb74f8b68fcdc8a9d022cd172374744425f15d
2018-11-05 00:30:46 -05:00
William Wilgus
d9f9def505 Lua fix failure to read lines longer than LUAL_BUFFERSIZE
Readline didn't handle lines longer than LUAL_BUFFERSIZE it now
reads these in chunks.

Change-Id: Iffe12447e5441ff6b479ce3de1d36df64c276183
2018-11-02 23:18:30 -04:00
William Wilgus
f6e10b8488 Lua optimize combine and rework similar functions
rb.strncasecmp
    strcasecmp just exclude count -> rb.strncasecmp(s1, s2)

rb.backlight_brightness_set
    backlight_set_brightness -- redundant
    rb.backlight_brightness_use_setting -> rb.backlight_brightness_set()

rb.buttonlight_brightness_set
    buttonlight_set_brightness -- redundant
    rb.buttonlight_brightness_use_setting -> rb.buttonlight_brightness_set()

rb.mixer_frequency
    rb.mixer_set_frequency -> mixer_frequency(freq)
    rb.mixer_get_frequency -> mixer_frequency

rb.backlight_onoff
    rb.backlight_on  -> rb.backlight_onoff(true)
    rb.backlight_off -> rb.backlight_onoff(false)

rb.touchscreen_mode
    rb.touchscreen_set_mode -> rb.touchscreen_mode(mode)
    rb.touchscreen_get_mode -> rb.touchscreen_mode()

rb.schedule_cpu_boost
    rb.trigger_cpu_boost -> rb.schedule_cpu_boost(true)
    rb.cancel_cpu_boost -> rb.schedule_cpu_boost(false)

Includes rbcompat.lua for backwards compatibility
if your script is broken by this change you simply add
`require("rbcompat")` to the top for the old functionality

Change-Id: Ibffd79a0d9be6d7d6a65cc4af5c0a1c6a0f3f94d
2018-11-02 18:00:06 +01:00
William Wilgus
bb025e3962 lua fix rlimage FB_SCALARPACK()
FB_SCALARPACK(lua_tointeger()) was calling lua_tointeger 3x on color targets

Change-Id: I7b3d73bba5dbc0aa4388b123de11410572fe67c5
2018-11-02 00:42:57 -04:00
William Wilgus
9b385f37ef Lua fix dir string constants and pcm_play_pause & pcm_set_frequency
String constants were already expanded in the first macro
pcm functions were looking for stack position #1 when they needed stack pos #2

Change-Id: I7b4fb90953ab2395b77cbd550fdd257fafca6aae
2018-11-01 18:18:46 -04:00
William Wilgus
be7a58c331 Lua Fix utf8encode, remove utf16 functions
The auto generated utf8/16 encode/decode functions did not work.
Upon implementing them correctly I found that lua handles the utf-8
form properly but I could not get utf-16 to work without crashing
maybe someone can come along later and implement utf-16 safe string
functions but for now utf-16 is removed.

Change-Id: I97a044e200dc27f683a45487cd93fce667c670c4
2018-11-01 16:34:02 +01:00
William Wilgus
bbfe477811 Lua Add underscores in audio, pcm, playlist functions
Lessen confusion for end users looking for the underlying function names in
plugin.h

Change-Id: I6662dc7bd9f22d83af372b3d3c5af53d9a1eac9a
2018-10-31 09:23:00 -04:00
William Wilgus
74fe5203d0 lua consolidate pcm_ functions
The way to call the pcm functions has changed
rb.pcm("option", var)
rb.pcm_set_frequency(freq) = becomes rb.pcm("pcmsetfrequency", freq)

added pcm.lua to the includes for conversion to old functions
if your script is broken by this change you simply add
`require("pcm")` to the top for the old functionality

added rb.pcm("calculatepeaks")

Change-Id: I092057b0c0b5575e567862661f122da1ca2680e8
2018-10-30 14:16:01 -04:00
William Wilgus
2e1ca20097 Lua restore audio_set_recording_gain, audio_set_output,input
Did not mean to wipe out these function when I consolidated audio

Made the regex for audio_ and playlist_ exact matches instead of fuzzy

Change-Id: I7537d1b494afb114c8b6333ea177b1e482f6b672
2018-10-30 12:05:15 -04:00
William Wilgus
6d8d2422ea Lua update strftime.c from dietlibc source
Adds %F -- %Y-%m-%d
Fixes possible buffer overflow when writing final \0
Frees a bit of code on NON-RTC targets

Change-Id: I1c2600a68ee88c6c99f411ae6646861578683f90
2018-10-30 02:39:11 -04:00
William Wilgus
eab73b3dee Lua replace fscanf
Rocklua was using the full fscanf implementation
to simply read %ld for the file:read("*n") function
wasting 1k on unneeded/unused functionality

Instead, I've implemented a filetol function to duplicate it
without the extra overhead using strtol which as an added bonus
ERANGE errors now resolve to LONG_MIN and LONGMAX instead of
integer overflow

filetol()
   reads long int from an open file, skips preceding
   whitespaces returns -1 if error, 1 on success.
   *num set to LONG_MAX or LONG_MIN on overflow.
   If number of digits is > than LUAI_MAXNUMBER2STR
   filepointer will continue till the next non digit
   but buffer will stop being filled with characters.
   Preceding zero is ignored.

Change-Id: Ia42d0f73c63a894625bca4581e9b7e1cc7387fd2
2018-10-29 23:22:35 -04:00
William Wilgus
cc0a4c632a Lua remove strncat.c & strcspn.c
Change-Id: I08256f31e733d2674054e8e589d539d1396a0ee6
2018-10-30 04:17:06 +01:00
William Wilgus
df8233e4ab Lua expand multiple screen support
Some of the lcd functions had support for multiple screens but this wasn't
very safe since the screen number wasn't bounded within the screens[] array
This adds support for all the lcd functions along with checking that screen#
is bounded properly, adds around 600 bytes to devices with a remote screen
devices without a remote screen lock to SCREEN_MAIN

Change-Id: I618bbc7b3919c7b0ff375fb2d71949d7cab43c87
2018-10-30 04:16:23 +01:00
William Wilgus
80352c2c2d Lua rliimage optimize rli_marshal, rli_copy, lcd_xxx_bitmap
rli_marshal and rli_copy allow the use of a custom lua function
instead of the built-ins, this custom function can signal to stop
before the whole image is iterated.

Originally it was checking for a return of 0
which was additional overhead for the built-in functions
(which never stop early) as well.
Now custom_transform sets the x & y deltas to 0 to indicate early
exit removing an extra 'if' per cycle and return from all of the
rli_transform functions

The lcd_xxx_bitmap functions all require x, y, w, h, screen these calls
have been consolidated into a single function get_bmp_bounds()

Change-Id: I88de3149c58d1bfb40e9d1a91341fb86cbd63b51
2018-10-30 04:16:23 +01:00
William Wilgus
73f2bd9c46 Lua remove gmtime.c use rb_plugin version instead
Change-Id: Ia6d47a13ec8ae407661a78c56513ac0c164216da
2018-10-28 07:15:29 -04:00
William Wilgus
5449500a67 Lua Rlimage metatable
Put rliimage functions into the rb.image metatable instead of the rb. table

Change-Id: Iecdc564c2ea9739656e2025b51bb5d5c62e3dbc1
2018-10-25 07:10:46 -04:00
William Wilgus
55533c4d36 Lua Fix kbd_input
While luaL_addstring() works perfectly fine for the
final buffer once Lual_pushresult() is called
kbd_input doesn't display a previous input properly
since the buffer hasn't been finalized yet

Change-Id: Ic50acaa8b7b17077dec8750dd2b6382624e8a549
2018-10-25 06:30:58 -04:00
William Wilgus
b5786ded64 Lua cleanup kbd_input, gui_syncyesno_run, do_menu
Removes unneeded functions from kbd_input
Consolidates message filling function for gui_syncyesno_run & do_menu

Change-Id: If3c3cea3cbf37a8dc52983c0db174de6d54b35f8
2018-10-25 12:06:10 +02:00
William Wilgus
e4c5f5d412 lua consolidate playlist_ functions
The way to call the playlist functions has changed
rb.playlist("option", var)
rb.playlist_add(filename) = becomes rb.playlist("add", filename)

added playlist.lua to the includes for conversion to old functions
if your script is broken by this change you simply add `require("playlist")`
to the top for the old functionality

added rb.playlist_tracks(dir, filename) to playlist.lua
this will allow you to add all tracks in a playlist.m3u8
to a lua table

Change-Id: I87fcc56be365d8495d214f069331b6ddbfbef1db
2018-10-25 05:59:42 -04:00
William Wilgus
b670fcd50d lua add audio_play consolidate audio_ functions
audio_play was removed from the rocklib I assume due to inconsistent
behavior I've readded it with a check for audio paused which instead
uses rewind/ff and then resumes audio

the way to call the audio functions has changed as well
rb.audio("option", var)
so rb.audio_play(0, 0) becomes rb.audio("play", 0, 0)
audio_audio_flush_and_reload_tracks becomes
rb.audio("flushandreloadtracks")

all functions except audio("getfilepos") return the previous (or still current)
status

added audio.lua to the includes for conversion to old functions
if your script is broken by this change you simply add `require("audio")`
to the top for the old functionality

Change-Id: I364adf0c85d9c12b98cde29c26fbe5ee05b9d331
2018-10-24 12:37:29 -04:00
William Wilgus
20b98f6fd0 Lua fix create_numbered_filename
I didn't realize that some devices used the *num variable
this fixes that oversight

Change-Id: I2ecd6f475bebdd6ce745b360be3762a069bfc2b1
2018-10-24 11:16:25 -04:00
William Wilgus
df4cb9bafc Lua fix strip_extension and create_numbered_filename
Both of these functions modified the string in the lua stack

per lua manual:
'When a C function receives a string argument from Lua,
there are only two rules that it must observe: Not to pop the string
from the stack while accessing it and never to modify the string'

strip_extension will still work with old parameters
and is thus backwards compatible
strip_extension("filename")

create_numbered_filename has changed slightly and IS NOT backwards compatible

create_numbered_filename(path, prefix, suffix, [number])
(number defaults to -1)

Change-Id: I34cf7e2f6f691f33d5ac2b2e995855a171fb99b3
2018-10-24 06:05:53 +02:00
William Wilgus
948984309a lua move rocklib_img to its own separate loadable module
allows rocklib_img to be excluded if needed

stops rocklib_aux from generating redundant prototypes for
lcd_mono_bitmap[_part]

Change-Id: Ie208ad71ab5f9a7deb026dc01a5b0a0631a0d29c
2018-10-22 14:00:58 -04:00
William Wilgus
07fed9053a lua optimize current_path function
frees up around 500 bytes by using the builtin string functionality

Change-Id: Icd4ec921d3fec339b8a4b7f80c9c63d51d4c101c
2018-10-15 18:24:10 +02:00
William Wilgus
0b7a8d5afd Lua remove unusable/unneeded functions from rocklib_aux
rocklib_aux is auto generated from plugin.h
there are a few functions that get added automatically that
are unusable without their companion functions or duplicate
functionality already supplied by lua

Duplicated functionality:
rb->rand, rb->srand
-- see math.rand math.srand

rb->remove, rb->rename
-- see os.remove, os.rename

Unusable:
rb->open_utf8
-- this should be added to the lua file open routines (if at all)

rb->codec_run_proc, rb->codec_close
-- without rb->codec_load_file these are pointless

rb->timer_set_period, timer_unregister
-- even with timer_register implemented lua is not
-- reentrant and crashes the state when timer fires

Shouldn't be used!:
rb->strlcpy, rb->strlcat, rb->strcpy, rb->strcat
-- lua reuses strings by hashed values you break this contract if
-- you change strings behind its back plus lua provides a way to
-- do these functions safely within the strings api

Change-Id: I2f65704a90930378cbbceb254e52f61e8074471e
2018-10-12 17:31:25 -04:00
Solomon Peachy
d2cef81bba mips: fix some compile warnings.
Change-Id: Ia5e83702313c1c184480290d3b0e6a66f01b7277
2018-10-09 22:35:37 -04:00
William Wilgus
046cc497ad Fix red rocklib_img 32-24 bit targets
int is an incompatible type for targets that have 32bit fb_data
need to use FB_SCALARPACK for them

Change-Id: Ib3b5ff19c54d8d1bb76af33d0538a17a71301514
2018-10-08 19:59:50 -04:00
William Wilgus
c0682e0944 Clean up rocklib_img
optimize both size and speed
fix invert for color screens

Change-Id: I7edecae32dcb3daf5b3ed984a0e5b3d463269e60
2018-10-09 01:02:25 +02:00
William Wilgus
e4b843335b lua rocklib cleanup
removes tslf allocations from do_menu and gui_syncyesno_run in favor of
lua_newuserdata

removes some luaL_opt functions in favor of equivalent lua_to functions

moves some definitions to the rocklib.h file

Change-Id: Iaacc3249b8f1af2c220ce59dead0050c66cb3b04
2018-10-08 23:15:16 +02:00
William Wilgus
dc6f23ec36 lua optimize integer and string consts in rocklib
use a table approach for registering integer / string constants

Change-Id: Idbccae9c2203de1c694f6dd5a7014a7fccedae9b
2018-09-14 01:13:22 +02:00
William Wilgus
733c20d5d3 lua move RLIMAGE to own file
Change-Id: Icd10e4c348deec7729d4a6e2bf1152e1dfc70243
2018-09-14 01:00:35 +02:00
Sebastian Leonhardt
91500e1296 pacbox: fix screen and buttons for Creative Zen
* rotate screen counterclockwise
* rotate directional buttons

Change-Id: Icbdf26fe1e14638eb8b0746a9eea99e0236ac6b1
2018-08-05 15:19:07 +02:00
Cástor Muñoz
7442742208 iPod Classic: disable IRAM1
On Classic, IRAM1 (second 128Kb of a total of 256KB available IRAM) is
slower than DRAM. Codecs that actually are using regions of IRAM1 runs
faster when DRAM is used, so IRAM1 is disabled and only IRAM0 remains
enabled: 48KB for core and 80KB for codecs/plugins.

The next test_codec results shows how decode time is decreased:

file           boosted     unboosted
*.ra           ~1.5%       ~0.5%
*.mpc          ~21%        ~4.5%
*.ogg          ~0.5%       ~0%
nero_he*.m4a   ~8%         ~1%
nero*.m4a      ~25%        ~7%
wmapro*.wma    ~4.5%       ~0%
wma*.wma       ~25%        ~7%

In addition there is a small power save when IRAM1 HW is disabled.

Change-Id: I102adee11458e82037f23076d5d5956e23235de8
2018-07-30 18:50:27 -04:00
Solomon Peachy
0662793ca0 Add cleaned-up xDuoo X3 support
Cleaned up, rebased, and forward-ported from the xvortex fork.

(original credit to vsoftster@gmail.com)

Change-Id: Ibcc023a0271ea81e901450a88317708c2683236d
Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
2018-07-28 10:56:31 -04:00
William Wilgus
400603abdf Lua -- Fix device hang when scroll function active on clear_screen
I previously noticed that manually clearing the framebuffer while scroll
function was active caused lua to crash

I could reproduce in sim and on device but I thought using the plugin
supplied rb->lcd_clear_screen was immune to this issue

Unfortunately some devices exhibit this behavior with the plugin function
as well

This patch adds rb->lcd_scroll_stop() before lcd_clear_screen at lua start-up
and to the supplied include file lcd.lua

Change-Id: I9800145e5c834ea27df5db5f1bca50b0d40faa49
2018-07-27 15:09:55 +02:00
William Wilgus
1b68aea444 Try #4 for lua make
Last commit was just a test to see if it work this one cleans it up
a bit and should be a bit faster

Change-Id: Ifdff5c5b78bcc6889506de607193246beccdde6b
2018-07-24 08:31:19 +02:00
William Wilgus
1482a31134 Try # 3 for lua make file
Change-Id: I888612f3339ffcde28602a4e739b08f630de9c28
2018-07-24 07:31:40 +02:00
William Wilgus
aefdd2061d Lua Fix image saving for 32 bit targets -- update make file
Hopefully this will fix the build faliures for a few targets

Change-Id: I68f6c85513ef589e5f6a50a8efc7bfae9fd62acd
2018-07-24 07:09:01 +02:00
William Wilgus
af35d19916 Rocklua -- Extend / Fix rliImage
Some devices(1-bit / 2-bit displays) have packed bit formats that
 need to be unpacked in order to work on them at a pixel level.

This caused a few issues on 1 & 2-bit devices:
 Greatly Oversized data arrays for bitmaps
 Improper handling of native image data
 Framebuffer data was near unusable without jumping through hoops

Conversion between native addressing and per pixel addressing
 incurs extra overhead but it is much faster to do it
 on the 'C' side rather than in lua.

Not to mention the advantage of a unified interface for the end programer

-------------------------------------------------------------------
Adds a sane way to access each pixel of image data
Adds:
--------------------------------------------------------------------
img:clear([color],[x1],[y1],[x2],[y2])
 (set whole image or a portion to a particular value)
--------------------------------------------------------------------
img:invert([x1],[y1],[x2],[y2])
 (inverts whole image or a portion)
--------------------------------------------------------------------
img:marshal([x1],[y1],[x2],[y2],[funct])
 (calls funct for each point defined by rect of x1,y1 x2,y2
  returns value and allows setting value of each point return
  nil to terminate early)
--------------------------------------------------------------------
img:points([x1],[y1],[x2],[y2],[dx],[dy])
 (returns iterator function that steps delta-x and delta-y pixels each call
  returns value of pixel each call but doesn't allow setting to a new value
  compare to lua pairs method)
--------------------------------------------------------------------
img:copy(src,[x1],[y1],[x2],[y2],[w],[h],[clip][operation][clr/funct])
 (copies all or part of an image -- straight copy or special ops
  optionally calls funct for each point defined by rect of
  x1, y1, w, h and  x2, y2, w, h for dest and src images
  returns value of dst and src and allows setting value of
  each point return nil to terminate early)
--------------------------------------------------------------------
img:line(x1, y1, x2, y2, color)
--------------------------------------------------------------------
img:ellipse(x1, y1, x2, y2, color, [fillcolor]
--------------------------------------------------------------------
Fixed handling of 2-bit vertical integrated screens

Added direct element access for saving / restoring native image etc.

Added more data to tostring() handler and a way to access individual items

Added equals method to see if two variables reference the same image address
(doesn't check if two separate images contain the same 'picture')

Optimized get and set routines

Fixed out of bound x coord access shifting to next line

Added lua include files to expose new functionality

Finished image saving routine

Static allocation of set_viewport struct faster + saves ram over dynamic

Cleaned up code

Fixed pixel get/set for 1/2 bit devices

Fixed handling for 24-bit devices (32?)

-------------------------------------------------------------------------
Example lua script to follow on forums
-------------------------------------------------------------------------

Change-Id: I8a9ff0ff72aacf4b1662767ccb2b312fc355239c
2018-07-23 05:13:32 +02:00
William Wilgus
ef210b5fe4 Revert "Rocklua -- Extend / Fix rliImage"
This reverts commit 2daec3d3c3.

Change-Id: I53ea1f491e3c6d6fb759f426f203f927bd26b1e9
2018-07-22 18:43:04 +02:00
William Wilgus
2daec3d3c3 Rocklua -- Extend / Fix rliImage
Some devices(1-bit / 2-bit displays) have packed bit formats that
 need to be unpacked in order to work on them at a pixel level.

This caused a few issues on 1 & 2-bit devices:
 Greatly Oversized data arrays for bitmaps
 Improper handling of native image data
 Framebuffer data was near unusable without jumping through hoops

Conversion between native addressing and per pixel addressing
 incurs extra overhead but it is much faster to do it
 on the 'C' side rather than in lua.

Not to mention the advantage of a unified interface for the end programer

-------------------------------------------------------------------
Adds a sane way to access each pixel of image data
Adds:
--------------------------------------------------------------------
img:clear([color],[x1],[y1],[x2],[y2])
 (set whole image or a portion to a particular value)
--------------------------------------------------------------------
img:invert([x1],[y1],[x2],[y2])
 (inverts whole image or a portion)
--------------------------------------------------------------------
img:marshal([x1],[y1],[x2],[y2],[funct])
 (calls funct for each point defined by rect of x1,y1 x2,y2
  returns value and allows setting value of each point return
  nil to terminate early)
--------------------------------------------------------------------
img:points([x1],[y1],[x2],[y2],[dx],[dy])
 (returns iterator function that steps delta-x and delta-y pixels each call
  returns value of pixel each call but doesn't allow setting to a new value
  compare to lua pairs method)
--------------------------------------------------------------------
img:copy(src,[x1],[y1],[x2],[y2],[w],[h],[clip][operation][clr/funct])
 (copies all or part of an image -- straight copy or special ops
  optionally calls funct for each point defined by rect of
  x1, y1, w, h and  x2, y2, w, h for dest and src images
  returns value of dst and src and allows setting value of
  each point return nil to terminate early)
--------------------------------------------------------------------
img:line(x1, y1, x2, y2, color)
--------------------------------------------------------------------
img:ellipse(x1, y1, x2, y2, color, [fillcolor]
--------------------------------------------------------------------
Fixed handling of 2-bit vertical integrated screens

Added direct element access for saving / restoring native image etc.

Added more data to tostring() handler and a way to access individual items

Added equals method to see if two variables reference the same image address
(doesn't check if two separate images contain the same 'picture')

Optimized get and set routines

Fixed out of bound x coord access shifting to next line

Added lua include files to expose new functionality

Finished image saving routine

Static allocation of set_viewport struct faster + saves ram over dynamic

Cleaned up code

Fixed pixel get/set for 1/2 bit devices
-------------------------------------------------------------------------
Example lua script to follow on forums
-------------------------------------------------------------------------

Change-Id: I7b9c1fd699442fb683760f781021091786c18509
2018-07-22 18:05:02 +02:00
Moshe Piekarski
ab1b67f37b Textviewer night mode
Add a night mode to textviewer.

Change-Id: I6ddcd9c3c87473cbbffaeacf63a21ef11c0e5f44
2018-07-04 06:25:45 +02:00
Franklin Wei
d64ff86fb6 puzzles: resync with upstream
This brings the source to upstream commit 506b073 (though I have made some
extra commits on top of that). Notably this includes a fix for a double-free
bug that I myself introduced upstream.

Change-Id: I02671586bbc34d63e05398ee971271fed42538cf
2018-06-20 19:13:03 -04:00
Marcin Bukat
708a54d3de Fix yellow for LCD_DEPTH == 32
Change-Id: I59e9ec8720555c17e882a3a8c7ed0ba281b8d7c7
2018-06-20 21:57:34 +02:00
Marcin Bukat
755b824596 Agptek Rocker: Fix mpegplayer keymap
Change-Id: Iba438b49b66dc3bb3fbfc24b74ced9eaab993886
2018-06-14 09:09:24 +02:00
Franklin Wei
f727b0787a puzzles: minor nitpicks to fbb6a2f
Just some whitespace changes to maintain stylistic consistency.

Change-Id: I50b5d52db2795cfcb4155bdffbfb80c1c3773112
2018-06-12 12:11:06 -04:00
Franklin Wei
c2d5ac1762 puzzles: fix typo introduced by fbb6a2f
When zoomed in, the original commit made a mono bitmap (a.k.a. text) always
have the red component set to 255. This would cause drawn text to always be
red. Fixed.

Change-Id: Iec06256a3a783948c60c70557de042b375224448
2018-06-12 12:09:44 -04:00
Marcin Bukat
1af78b99d9 Agptek Rocker: fix rockboy pallete
Contributed by Aapo Tahkola.

Change-Id: Ibee14d4f307b2198c5c47f9593734bd5d31d379b
2018-06-12 10:31:15 +02:00
Marcin Bukat
fbb6a2ff6d Agptek Rocker: Build plugins
Patch provided by Aapo Tahkola.

Change-Id: I37a42a950d78d6b8aa3927ec7aeb30030f7be7a5
2018-06-12 10:31:15 +02:00
William Wilgus
9a9c7f2b7c Fix lua failure to catch divide by zero and NaN exceptions
I can only assume in the course of the original conversion to fixed point
math in RbLua the fact that division by zero and NaN handling was to be
caught as a graceful exception by the floating point handler was overlooked.

As a result lua doesn't handle these exceptions and instead results in a
panic on the device.

This patch fixes this handling in the lexer for compile time Inf and Nan
results and in the luavm for runtime division by zero (Inf)

I missed the runtime exception of n%0 added checks for that as well..

Change-Id: I7746c087ea93678e5875f15ec6fe3f29f26bdb31
2018-06-05 18:47:57 +02:00
William Wilgus
641e033e33 Revert "rocklib -- Fix Red"
This reverts commit 37a20dffb6.

Change-Id: Ibf3a56f2b84e0e4af4c2ed890bc22b3555ab24ae
2018-05-31 14:31:24 +02:00
William Wilgus
4508ee9dbb Revert "Rocklua -- Clean-up source"
This reverts commit 0565f67118.
Removing Typedef from rliimage

Change-Id: Ib14241785c73de8ba6dc18ac76bec35eaed4661d
2018-05-31 14:15:28 +02:00
William Wilgus
37a20dffb6 rocklib -- Fix Red
Change-Id: I83b967a266837ebdf887e0f2c2d169a69af9e287
2018-05-28 17:52:32 +02:00
William Wilgus
0565f67118 Rocklua -- Clean-up source
Change-Id: I11dad15320f209655fd72c2365fe29afd65057d3
2018-05-28 17:07:19 +02:00
William Wilgus
07a0f206fe Lua liolib
Add Whitespace to EOF

Change-Id: Iac253e7905c59518040d39bb5033e35f0deea948
2018-05-28 02:36:23 +02:00
William Wilgus
0d41e13cf4 Fix lua lseek command / io lib
lua would not return or set arbitrary file positions
file:seek("set", 0) worked file:seek("cur") worked
but setting an offset or file:seek("end") failed

I tracked this down to a bug checking the return of rb->lseek

on error lseek returns a negative number and returns the file
position otherwise, the function was checking for if(N) instead of
if(N < 0)

Fixed - limited size of lseek to size of signed LuaNumber

Fixed - io:lines() stopped after first line containing only a newline
        instead of returning a blank line and continuing till EOF
        this fixes file:read("*l") as well

Fixed - ssize_t for read() with error checking

Change-Id: Ie859b288fb8f6814f1b3ae30992ecf78f2669de7
2018-05-27 17:55:10 +02:00
Franklin Wei
992a12670e puzzles: update frontend for new upstream, misc. changes
The upstream code changed a little bit with regard to the request_keys()
API. Also, we save some bytes (especially on the c200v2) by compiling with
-ffunction-sections and -fdata-sections, which allows Net to fit once again.

Change-Id: I3ab30127169c73e4cd8996f0c12e1223ee18d79f
2018-04-24 19:06:30 -04:00
Franklin Wei
b29611fe2c puzzles: update help text, make generation and testing cleaner
This includes an upstream change to the Galaxies help text. `genhelp.sh'
no longer leaves temporary files sitting around, and the self-test feature
of lz4tiny.c works again.

Change-Id: I787f4cb3c258baade31638d6be18f95b7aa0705e
2018-04-24 19:06:30 -04:00
Franklin Wei
8f23493e08 puzzles: resync with upstream
This brings the upstream version to b3da238 (though some of my own
changes are included on top of that).

Change-Id: Ida73e8cd86765413147ce891af3cc2b7aeda2b2a
2018-04-24 19:06:30 -04:00
Franklin Wei
ef0fb52113 puzzles: silence some warnings
Change-Id: Id6fd9d8dd3021f5e2cb93565d7e419aaf07f9af0
2018-04-24 19:06:30 -04:00
Franklin Wei
22823e2f78 puzzles: save some bytes
This should cut just enough size off the binary to let Net still compile
for the c200v2. This is probably close to the last time I'll be able to do
this; I'm already resorting to dirty hacks like writing super terse error
messages.

Change-Id: I43344b9a601696d7ca56fc02af4a611fd9d1a150
2018-04-17 22:13:31 -04:00
Franklin Wei
e84fc26fb8 puzzles: clean up for rockbox
Disabled vprintf() call in Filling, and reordered vertices in Unequal.

Change-Id: Ia3d8cd46ae3a7909b7dc2a8de762aa3173634d1e
2018-04-17 18:46:05 -04:00
Franklin Wei
6dc9d1d730 puzzles: enable all the remaining games
They all work now :). I merged in part of Chris Boyle's Android port of
Puzzles to give the front end a way to know what keys the back end needs.
This also re-syncs to the latest upstream sources.

Change-Id: Ie0409bbb32f617ae5abf4f81be3b45d1552db9bb
2018-04-17 18:20:12 -04:00
Sebastian Leonhardt
7a12e796a6 Oscilloscope plugin: bundle #define NEED_LASTBUTTON to a single place
This fixes a warning that was introduced with enabling plugins for
the Zen XFi-2.

Change-Id: I8fe9a4be301f2c4643d04ae42d2189e62c191592
2018-04-03 14:58:34 +02:00
Sebastian Leonhardt
0486e5b93e Zen XFi2: Enable Plugins
Keymaps aren't tested, there may be room for improvement.


Change-Id: I6b8fe697899b241ea6e96f4fe446d88671ad7818
2018-04-03 11:34:01 +02:00
Sebastian Leonhardt
fb3f7651fd pacbox for small screens, up to 75x96
Change-Id: I6e9adf2f6923f4d0078a54e9857fc8eacef259a6
2018-04-03 00:21:40 +02:00
Sebastian Leonhardt
96335a7eb2 pacbox: clean-up screen size code
removes the code duplication for lcd scaling in
pacbox.h/pacbox_lcd.h

Change-Id: Ib0aeacc9934351c5e32cd4b7576cdc840e6ff7da
2018-04-02 20:29:01 +02:00
Franklin Wei
9006e75cde puzzles: fix typo
Change-Id: I6b8c18472749248508d4e5b1595b8903e687f67c
2018-03-18 13:07:39 -04:00
Franklin Wei
77641d59a7 puzzles: add formatting to help viewer
The help text is now processed to generate a style array to pass to the
display_text library in addition to the text itself. The help text is still
compressed using LZ4, and still fits on the c200v2.

Change-Id: I7a3a664f90f67a1a018956c72d2b62d92b8ffd17
2018-03-17 22:54:21 -04:00
Franklin Wei
6039eb05ba sdl: remove non-rockbox drivers
We never use any of these other drivers, so having them around just takes
up space.

Change-Id: Iced812162df1fef3fd55522b7e700acb6c3bcd41
2018-03-12 20:52:01 -04:00
Franklin Wei
ef373c03b9 sdl: clean up audio driver
This prevents a (highly improbable) race condition when exiting, and uses
pcm_set_frequency() instead of mixer_set_frequency(), since that seems like
the Right Thing to Do (TM).

Change-Id: Icb6a4597843215f08b3835490ac63f67c9a04736
2018-01-15 19:47:49 -05:00
Franklin Wei
beaeb28a29 duke3d: bump audio sample rate to 22.1KHz
Recent optimizations to sound mixing should allow this, up from 16KHz.

Change-Id: I0ba5742c934118a3a6505b8dc58578b0cfe8ea77
2018-01-15 19:45:57 -05:00
Franklin Wei
cf07bb328d duke3d: further optimize audio mixing
Rather than holding intermediate results as fixed-point, this converts them
directly to normal integers (in the range of the PCM sample) while mixing,
instead of waiting till the end to perform a separate shifting step. Also,
this precalculates some constants in the reverb code.

Change-Id: Ie04e444d145bc28ce67eef9ae0ead6d328acf28a
2018-01-15 19:45:28 -05:00
Franklin Wei
69ff35ac49 sdl: correct misleading comments
Change-Id: Ieb33d3fec1e0d834c5e294b79f280959497acb6a
2018-01-14 19:32:13 -05:00
Michael Sevakis
769d73d734 Use sleep(0) instead of yield() in SDL_WaitAudio
This allows CPU load to drop below 100%, which is good for anything
that scales frequency and voltage based on CPU load. Also conserves
some energy by letting the core go idle if there aren't any available
buffers.

Change-Id: I9385ac9e030f97010b12eb825875a900463ab0ac
2018-01-14 19:32:13 -05:00
Franklin Wei
ccd612345c sdl: fix freeze on startup on PP targets
Using the coprocessor was a good idea in theory, but didn't actually work.
This moves all SDL threads to the main core, which isn't ideal, but at
least works. Additionally, this also adds some good-practice stuff such as
setting the default sample rate on exit.

Change-Id: If1636b33d439000ec7c4e50f46e8d002708d3121
2018-01-11 19:45:31 -05:00
Franklin Wei
896c828152 duke3d: unregister timer on exit
This was leading to a crash upon audio playback after running the game.

Change-Id: I1e9961da443c21e3eff38bcf9877ffa75a922715
2018-01-05 18:05:10 -05:00
Franklin Wei
9f6ce046cb duke3d: rewrite sound mixing to use fixed-point
Gives significant performance improvement on ipod6g.

Change-Id: I1e8462bec197acb10e770c796240b5001df52440
2017-12-26 23:42:42 -05:00
Franklin Wei
78db1d9502 duke3d: use hardware FPU if available
Change-Id: Idd9fad7bc0604a553c282a0f8c663ad44030ecac
2017-12-26 23:40:16 -05:00
Franklin Wei
54d8e67530 duke3d: restrict targets to ARM only
Change-Id: I484d6de2d5d4a495ed54e8ee2a80459785b5f5e8
2017-12-24 18:01:28 -05:00
Franklin Wei
8d3e3056f7 fix red once more
Change-Id: I6290cc6cca468c197656236d3dd31c3f72c53842
2017-12-24 17:43:30 -05:00
Franklin Wei
2b49724c3a attempt to fix sysfont.h errors
Change-Id: Icc67dc777d3a2269ececbf4fbe34d78d7bd34087
2017-12-24 13:29:09 -05:00
Franklin Wei
581a82e854 Undef potentially conflicting macros in stdio_compat.h
Change-Id: If4af3e3cc16a947127e6253d0b81b684b5abb0c9
2017-12-24 13:00:26 -05:00
Franklin Wei
7ea37bb806 fix red
Change-Id: Ib28cfd9037901c7b8bc9b2960ad2c1c9a1e25a69
2017-12-24 12:58:33 -05:00
Franklin Wei
6416d96fbc fix red
Change-Id: I20f1bd6f0208f6108d68fb59206b09dd9da4f1af
2017-12-23 21:28:20 -05:00
Franklin Wei
a855d62025 Port of Duke Nukem 3D
This ports Fabien Sanglard's Chocolate Duke to run on a version of SDL
for Rockbox.

Change-Id: I8f2c4c78af19de10c1633ed7bb7a997b43256dd9
2017-12-23 21:01:26 -05:00
Marcin Bukat
a8423321b8 stdio compat layer for plugins
This is attempt to simplify porting programs to rockbox (as plugins).
Currently this compat layer implements:
fopen(), fclose(), fflush(), fread(), fwrite(), fseek(), fseeko(),
ftell(), ftello(), fgetc(), ungetc(), fputc(), fgets(), clearerr(),
ferror(), feof(), fprintf()

In order to use it you need to include in ported sources
"lib/stdio_compat.h"

Change-Id: I5add615dd19c5af9c767ccbfb1bd5a4e466741cb
2017-12-23 20:54:56 -05:00
Franklin Wei
d14e3f45a8 Fix last commit
Change-Id: Ie3b3fad702e8c03d33b4a264139b6de74736e058
2017-12-16 16:41:20 -05:00
Franklin Wei
430534b1fc Change button mappings in plugins/lib/keymaps.h
Some of the previous mappings didn't make much sense.

Change-Id: If373e7d5f28b572523856763c999eb7c5180aced
2017-12-16 16:23:25 -05:00
Michael Sevakis
e86ea6bdb9 Get test_codec synced with changes in 6c868dd
Change-Id: I47c5ae09ff620b46e42463654e1a073b59fb2191
2017-12-08 21:32:54 -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
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
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
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
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
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
Franklin Wei
25a29e71d8 Silence warnings in mp3_encoder
`const' only needs to be used once (a const pointer to const data is
`const type * const').

Change-Id: I47a0d69755cb7753ac64b82b930d14b4a19b7527
2017-09-01 22:03:06 -04:00
Franklin Wei
5a724bb6dc Fix typo in goban
Pointer wasn't dereferenced as it should be.

Change-Id: I4b4993fef2290c22ab8f36ba8aafe7dcafcbfa2e
2017-09-01 22:00:59 -04:00
Franklin Wei
3a39f24b8c puzzles: remove unused overlay loader
Just cluttering the plugins directory as there is no COMBINED support
anymore.

Change-Id: I05591d457055e67cd1a01e007bec7ce77dcecb4a
2017-09-01 20:33:20 -04:00
Franklin Wei
1cd96b4931 Keybox: display the entry name along with the password
The dereference of entry->name was originally omitted, which meant
that only the password would ever be displayed.

Change-Id: If368a2d3dd9ddf0a253d28b9db5b98d639cfb30b
2017-08-27 15:43:11 -04:00
Amaury Pouly
b31ae4554a fix yellow, commit f2f1889 left a variable unused
Change-Id: I128bf509cb68860cc2c12b42d032621a5bc71008
2017-08-27 19:25:56 +02:00
Franklin Wei
3c514f8e20 puzzles: misc. changes and sync with upstream
This brings puzzles up-to-date with Simon's tree, along with the
rockbox-specific changes I made. Note that I also got rid of some
of the ugly floating-point code in rbwrappers.c and replaced it
with wrappers for our fixed-point library.

Change-Id: Ibfb79acb15517116a26de1c3ea89e025146b9e2e
2017-08-23 14:22:09 -04:00
Franklin Wei
4dd300d9f0 puzzles: remove old combined build code
We don't really need it anymore.

Change-Id: I7c8149faa6b80807ca718b73483bdb2e41830cbd
2017-08-23 14:22:09 -04:00
Franklin Wei
ec1a74a37c puzzles: faster, smaller sqrt()
Change-Id: I18e170ee49bff131fe76fa4bb1b9e0f120818b82
2017-08-23 14:22:09 -04:00
Sebastian Leonhardt
f2f1889b10 Sokoban: enable restarting level via "Select Level"
This patch disables the (deliberate) feature of "Select Level",
that selecting the current level wouldn't restart but rather
resume. (i.e. now selecting any level will always start this
from scratch).

There definitely should be a way to restart the current level
via menu. Currently the only possibility to do this is via
button presses, but (a) these are hard to remember combos, and
(b) they are not defined on all targets.
This patch is meant as a lightwight alternative to g#1356
(adding a "restart level" option to the menu).

Change-Id: I18ee5aff5c922f95c28d1edf2ba71dd2e50687d2
2017-08-23 01:15:50 +02:00
Sebastian Leonhardt
28ae700444 FS#11922: Lua game - Pixel Painter
* Changed keymaps to PLA and added to SOURCES and CATEGORIES file
* improved keymaps: implement wrap-around and key repeat
* change keymap according to screen orientation
* fix font size calculation
* use blocking button query in main loop
* replace tabs with spaces
* added manual entry
* added original author to CREDITS

Change-Id: Id67ae99cbb7a737c7f4608e278b77a389ac2ffa6
2017-08-23 00:25:11 +02:00
Franklin Wei
7944969ff7 puzzles: fix build
Change-Id: Ifb6d7938968a48a1492483b33c84050abcfb75e0
2017-08-16 15:01:38 -04:00
Franklin Wei
71850e8e69 puzzles: various useless tweaks
Change-Id: Ibf9769f99d61581b184d0ffa4ef0614eb976f0e8
2017-08-16 11:40:42 -04:00
Franklin Wei
d0c4ef4b78 puzzles: enable long-press in Map
This allows for stippling regions.

Change-Id: If8f271b66f6f350c843d6669918ea39712acd818
2017-08-16 11:40:42 -04:00
Franklin Wei
ef9c2f4457 puzzles: fix polygon drawing in Inertia
Yet another hack to accommodate our polygon algorithm...

Change-Id: Ic5d304be23d30c380b19771ab68cf01c416261b4
2017-08-16 11:40:42 -04:00
Franklin Wei
f31a400bac puzzles: add more parameter validation checks
Fixes some annoying crashes.

Change-Id: If3c293bd90e301c3e697d1e5fcb1b0aa2ea320fb
2017-08-16 11:40:42 -04:00
Franklin Wei
c78ff7f615 puzzles: fix floating-point formatting
This is pretty ad-hoc, but the only other ways are to rewrite
sprintf (which would use too much memory on the c200v2), or
implement support for floats in rockbox's formatter, neither of
which are acceptable.

Change-Id: I70d59fd3e90a16e2db9ae0a84cd8c14807f50b46
2017-08-16 11:40:42 -04:00
Franklin Wei
bf25f3e6e7 puzzles: compress extensive help text
This is only really needed to save a few bytes on the c200v2, but
since it adds negligible overhead, so it's implemented for all
targets.

A stripped down version of the LZ4 reference implementation is found
in lz4tiny.c.

Change-Id: Ib914ba71c84e04da282328662c752e533912e197
2017-08-16 11:40:37 -04:00
Franklin Wei
ca228d3d87 puzzles: cut size for c200v2
- font caching is disabled
- font table is dynamically allocated
- side effect: tlsf isn't reset between runs anymore, memory leaks will have a bigger impact

Change-Id: I0b25c22665d956895e8007883d522256010d04ab
2017-08-09 21:51:23 -04:00
Franklin Wei
51984098ef puzzles: enable Mines
It should work now that arm memset() has been fixed for negative
values. This is the last puzzle that was disabled due to a crash.
2017-07-27 19:09:50 -04:00
Franklin Wei
076cf0aa9b puzzles: new input scheme for Mines and Magnets
Both these puzzles now have long press mapped to spacebar.
2017-07-27 19:09:50 -04:00