Commit graph

68 commits

Author SHA1 Message Date
Franklin Wei
d1a92aafff sdl: increase default worker thread size.
This fixes a mysterious, long-standing crash that's been bothering me on
ipod6g for ages: a silent stack overflow in the sound mixing thread (which
is triggered upon loading a new sound, apparently) will thrash the memory
which is located directly before it in the address space.

In this case, it was the SDL_ButtonState variable which stores the mouse
button state that was being trashed. This was manifesting itself by making
the player always run forward, since MOUSE2 is mapped to +forward by
default.

Fix this by quadrupling the stack size of SDL-spawned threads (not the main
thread) from 1 KB to 4 KB.

Change-Id: I2d7901b7cee1e3ceb1ccdebb38d4ac5b7ea730e1
2021-06-28 02:51:48 +00:00
William Wilgus
3237ae4a4f LCD core move buf ptr and address look up function viewport struct
I'm currently running up against the limitations of the lcd_draw functions
I want these functions to be able to be used on any size buffer not
just buffers with a stride matching the underlying device

[DONE] allow the framebuffer to be decoupled from the device framebuffer
[DONE need examples] allow for some simple blit like transformations
[DONE] remove the device framebuffer from the plugin api
[DONE}ditto remote framebuffer
[DONE] remove _viewport_get_framebuffer you can call struct *vp = lcd_set_viewport(NULL) and vp->buffer->fb_ptr

while remote lcds may compile (and work in the sim) its not been tested on targets

[FIXED] backdrops need work to be screen agnostic

[FIXED] screen statusbar is not being combined into the main viewport correctly yet

[FIXED] screen elements are displayed incorrectly  after switch to void*

[FIXED] core didn't restore proper viewport on splash etc.

[NEEDS TESTING] remote lcd garbled data

[FIXED] osd lib garbled screen on bmp_part

[FIXED] grey_set_vp needs to return old viewport like lcd_set_viewport

[FIXED] Viewport update now handles viewports with differing buffers/strides by copying to the main buffer

[FIXED] splash on top of WPS leaves old framebuffer data (doesn't redraw)
[UPDATE] refined this a bit more to have clear_viewport set the clean bit and have skin_render do its own screen clear
scrolling viewports no longer trigger wps refresh
also fixed a bug where guisyncyesno was displaying and then disappearing

[ADDED!] New LCD macros that allow you to create properly size frame buffers in you desired size without wasting bytes
(LCD_ and LCD_REMOTE_)
LCD_STRIDE(w, h) same as STRIDE_MAIN
LCD_FBSTRIDE(w, h) returns target specific stride for a buffer W x H
LCD_NBELEMS(w, h) returns the number of fb_data sized elemenst needed for a buffer W x H
LCD_NATIVE_STRIDE(s) conversion between rockbox native vertical and lcd native stride (2bitH)
test_viewports.c has an example of usage

[FIXED!!] 2bit targets don't respect non-native strides
[FIXED] Few define snags

Change-Id: I0d04c3834e464eca84a5a715743a297a0cefd0af
2020-10-26 12:28:48 -04:00
Moshe Piekarski
12f3ed1699 make the plugin API frambuffer agnostic
Change-Id: I5abdc231093054c517ff53b9a456997e440e3f6e
2020-10-26 12:28:48 -04:00
Solomon Peachy
4231c2c83f codecs: Add support for the 'VTX' ZX Spectrum chiptunes format.
This codec requires floating point.

Original author:  Peter Sovietov
Ported to Rockbox:  Roman Skylarov
Further integration and bugfixes:  Solomon Peachy

Change-Id: I781ecd3592dfcdbbc694063334350342534f1d6c
2020-10-09 11:39:25 -04: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
Solomon Peachy
9be5bc4cf0 plugins: More HAVE_BACKLIGHT cleanup
Change-Id: I70cf700f5bc3d4375c025efa62ef40fd2bd70293
2020-07-24 19:20:15 -04: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
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
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
Franklin Wei
f8cd15e226 sdl: disable alignment trap
Apparently causing issues on some devices.

Change-Id: I6adb65513bf65c559a0fa8980e693f1e5324d4ad
2020-02-01 22:11:56 -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
Franklin Wei
c0cc9aa9e8 quake: clean up asm mixer
Fixes my ugly formatting.
2019-10-07 14:52:30 -04: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
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
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
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
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
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
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
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
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
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
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
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
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
Franklin Wei
7739ad6622 wolf3d: allow entering in-game jukebox by holding fire button
Change-Id: I8936178191e682b70c64ef6ae04d6636e5cf3521
2019-07-12 16:21:11 -04: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
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