Commit graph

34213 commits

Author SHA1 Message Date
William Wilgus
6392e05476 Plugin API
Reorganize Plugin functions in prep for API bump

Stub in sound_current

add sleep_timer

Change-Id: I74b3a433c86bd6cec43a7c45ae0d2db95c97bb60
2019-07-20 04:50:57 -05: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
b0e9bb1b91 Limit float formatting to only targets building Quake
The Quake plugin is the only code that actually relies on float
formatting. Because Quake only runs on targets with huge memory
anyway, limiting their formatting to just those targets will minimize
the increased memory use in the core.

Change-Id: Icdbe26ec6ede564861cc01ac4add76a12b00ecd5
2019-07-19 23:20:56 -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
Michael Sevakis
b70fecf21d Add proper float formatting to vuprintf
Wanted to see how gnarly it is to do.

Big number handling could be done with better algorithms
since it can get a bit slow with large integers or tiny
fractions with many lead zeros when only a few digits are
needed.

Anyway, it supports %e, %E, %f, %F, %g and %G. No %a or long
double support seems warranted at the moment.

Assumes IEEE 754 double format but it's laid out to be able to
replace a function to handle others if needed.

Tested in a driver program that has a duplicate vuprintf and
the content was pasted in once it looked sound enough to put
up a patch.

Change-Id: I6dae8624d3208e644c88e36e6a17d8fc9144f988
2019-07-19 22:07:41 -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
Frank Gevaerts
b0de98ad3b Put -lfirmware in CORE_LIBS, to fix -thumb builds
For unknown reasons, -thumb builds need -lfirmware after -lrbcodec (but
still before -lunwarminder)i. Other builds are still happy if we do that.
Including it via CORE_LIBS instead of explicitly achieves that.

Change-Id: Id69e4a0c042f90f71cfd9a72202ce4d8ef6a4181
2019-07-19 15:16:37 +02: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
Franklin Wei
4e44c9c58c sdl: credit the authors
Long overdue, but better late than never.

Change-Id: I3403641b68ba6ef0d6e748b482431f05921b81f9
2019-07-15 15:56:46 -04:00
eevan78
03e6b17a28 Updated Serbian translation
Change-Id: I93477548ddd92a5390ac2a828b4262e3bb516f4b
2019-07-15 14:09:25 +02: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
3e27705eb9 tagtree.c->loadroot() guard against overflow
forum user chris_s noted an possible unhandled cache overflow

Change-Id: Ia79399d6581ef6b635578896519fda8126c731d7
2019-07-10 09:38:36 +02:00
William Wilgus
5264a6eac1 Fix Truncation warning cpufreq-linux.c->cpufreq_available_governors
limit cpu identifer to 0xFFFF

Change-Id: I6fb170aa7ce32b7b5c0366bbd689878bb5069be8
2019-07-10 07:09:00 +02:00
William Wilgus
cf6584a483 Fix possible truncation playlist_catalog.c->catalog_add_to_a_playlist
Change-Id: Ib142b07916ccca044674e5cabec379316c07e9d9
2019-07-10 06:52:43 +02:00
William Wilgus
3ec002e121 Fix truncation warning color_picker.c->draw_screen
Change-Id: I72f16163684aba6c9c3fcf4ade6f2906d80b3899
2019-07-10 06:31:22 +02:00
William Wilgus
a980c0b3e5 Fix possible truncation statusbar.c->gui_statusbar_icon_battery
limit percent range to 0 - 100%

Change-Id: I46477cdfe954fb1ea3e6158949c920769447762e
2019-07-10 06:09:46 +02:00
William Wilgus
fc7a45853b Fix possible truncation albumart.c
Change-Id: Ie0e576f26c0507cc12fbdc12093d6fe924377e1d
2019-07-09 22:58:06 -05: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
439a0d1d91 rbendian.h: fall back to generic swap macros
Change-Id: If85086c0fd6b22d50759b16d2545e1798832d12c
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
Sebastian Leonhardt
3e504c3dcd Fix reversal of "always/never" in "LCD setting > Sleep (After Backlight Off)"
The bug was introduced in a06d9c8.
The patch also fixes some (more or less) related obsolete comments.

Change-Id: I5e491d64574c37cdbc46b146d7cfc555d86b9a11
2019-06-27 14:19:05 +02:00
Franklin Wei
7b118eccac configure: add --32-bit option to build a 32-bit simulator/application
I use this to test duke3d in the sim, because it does some nasty pointer
arithmetic with 32-bit ints.

Should be useful for other things as well.

Change-Id: I807c81b32c61538de9edc3fca77fde193dc4e617
2019-06-17 23:11:25 -04: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
Franklin Wei
94e6a7dade duke3d: improve manual
Adds screenshots for all supported targets. Also adds a bit of information
to point users to the data files.

Change-Id: I5e0f1bcdb73690a14616a3e486228c73b1617ffc
2019-06-16 14:26:13 -04:00
Solomon Peachy
1e076a7be8 jz7460: Disable IRQ-driven DMA transfers.
This greatly increases the stability of SD card write operations.

(I suspect the underlying problem is not IRQ operation itself, instead
 being exacerbated by it..)

Change-Id: Ia00f0656abd4b3cb0b1b5fc9db7c1b6a02847956
2019-06-02 13:09:19 +02:00
Marcin Bukat
e85a3ba518 Agptek rocker: do not update display when not active
Change-Id: I963a9098b82a09aed8050123932a128f2d08dee0
2019-05-31 15:17:33 +02: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
Amaury Pouly
4ed5727654 nwztools: fix Makefile
Seems like newer versions of mingw will sponteanously add a .exe suffix to
the output path if it doesn't have one, for example mingw-gcc -o scsitool bla
will actually create scsitool.exe and of course this breaks my release script.
Fix this by explicitely adding the .exe to avoid any problem

Change-Id: Ic8019b968b532b2ca612ba0c03977a96c22cee01
2019-04-22 23:45:33 +02:00
Amaury Pouly
063ff294a2 nwztools: add DMP-Z1 to the database
This is one of those fancy gold-plated devices. Of course it breaks my scripts
that were nicely expecting every device to start with NW.

Change-Id: I161320f620f65f4f92c2650d192b26a9831eeb9d
2019-04-22 23:45:33 +02:00