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
-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
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
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
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
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
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
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
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
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
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
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
* Properly account for ID3v1 tags
* Play time computation fixes
* Add speech feedback
Patch by Igor Poretsky
Change-Id: Ia6df8fb171882a88527cfa9d3b76b705f09becdd
This boosts performance to 13.0FPS on ipod6g for `timedemo demo1'. That's a
+34% increase from baseline.
Change-Id: I50bae7783ff2fce46e8257c251c6b639c069e7cb
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
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
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
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
- 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
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
Forgot a return statement in Sys_FileRead (which slipped by since I've made
the questionable decision to disable all warnings...)
Change-Id: Ia0f3da52b43765b8e0e9953893ac7957ec2f6c2e
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
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
- 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
paths.
If ROOTDIR=/rockbox and BUILDDIR=/rockbox/build-something, it is now possible to
successfully build both target binaries and simulators.
Change-Id: If12d1d5933c5a15feebf627a4f1636dc1e3a67fa
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
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
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
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
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
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
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
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
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
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
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
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
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
track elapsed is needed to use fast-forward and rewind effectively
track length might as well be added too..
Change-Id: I906c92eb5260164c6177d8c0a8ff879b1fad7898
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
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
Prevents system SDL from interfering with thread driver selection. Also
adds test code for alignment faults.
Change-Id: I8bc181922c4a9e764429897dbbaa1ffaabd01126
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
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
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
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
- 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
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
- 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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