diff options
| author | Franklin Wei <git@fwei.tk> | 2018-02-11 15:34:30 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2019-07-19 22:37:40 -0400 |
| commit | 5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4 (patch) | |
| tree | 84406e21639529a185556a33e5de7f43cffc277b /apps/plugins/sdl/src | |
| parent | b70fecf21ddc21877ec1ae7888d9c18a979e37ad (diff) | |
| download | rockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.zip rockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.tar.gz rockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.tar.bz2 rockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.tar.xz | |
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
Diffstat (limited to 'apps/plugins/sdl/src')
5 files changed, 23 insertions, 4 deletions
diff --git a/apps/plugins/sdl/src/audio/SDL_audio.c b/apps/plugins/sdl/src/audio/SDL_audio.c index 9c0feed..f2a2e59 100644 --- a/apps/plugins/sdl/src/audio/SDL_audio.c +++ b/apps/plugins/sdl/src/audio/SDL_audio.c @@ -204,6 +204,7 @@ int SDLCALL SDL_RunAudio(void *audiop) /* Convert the audio if necessary */ if ( audio->convert.needed ) { + LOGF("RB AUDIO: converting audio. Will be slow!"); SDL_ConvertAudio(&audio->convert); stream = audio->GetAudioBuf(audio); if ( stream == NULL ) { diff --git a/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c b/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c index 7833430..cb72687 100644 --- a/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c +++ b/apps/plugins/sdl/src/audio/rockbox/SDL_rockboxaudio.c @@ -225,12 +225,29 @@ static void ROCKBOXAUD_CloseAudio(_THIS) rb->pcm_set_frequency(HW_SAMPR_DEFAULT); } +static bool freq_ok(unsigned int freq) +{ + for(int i = 0; i < SAMPR_NUM_FREQ; i++) + { + if(rb->hw_freq_sampr[i] == freq) + return true; + } + return false; +} + static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) { /* change to our format */ spec->format = AUDIO_S16SYS; spec->channels = 2; - spec->freq = RB_SAMPR; + + if(!freq_ok(spec->freq)) + { + rb->splashf(HZ, "Warning: Unsupported audio rate. Defaulting to %d Hz", RB_SAMPR); + + // switch to default + spec->freq = RB_SAMPR; + } /* we've changed it */ SDL_CalculateAudioSpec(spec); diff --git a/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c b/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c index f9dc877..b9bd873 100644 --- a/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c +++ b/apps/plugins/sdl/src/thread/rockbox/SDL_systhread.c @@ -51,13 +51,13 @@ int SDL_SYS_CreateThread(SDL_Thread *thread, void *args) static int threadnum = 0; snprintf(names[threadnum], 16, "sdl_%d", threadnum); - while(global_args) rb->yield(); /* busy wait */ + while(global_args) rb->yield(); /* busy wait, pray that this works */ global_args = args; thread->handle = rb->create_thread(rbsdl_runthread, stacks[threadnum], DEFAULT_STACK_SIZE, 0, names[threadnum] /* collisions allowed? */ - IF_PRIO(, PRIORITY_USER_INTERFACE) + IF_PRIO(, PRIORITY_BUFFERING) // this is used for sound mixing IF_COP(, CPU)); threadnum++; diff --git a/apps/plugins/sdl/src/timer/rockbox/SDL_systimer.c b/apps/plugins/sdl/src/timer/rockbox/SDL_systimer.c index f4e8862..8da8455 100644 --- a/apps/plugins/sdl/src/timer/rockbox/SDL_systimer.c +++ b/apps/plugins/sdl/src/timer/rockbox/SDL_systimer.c @@ -28,6 +28,7 @@ #include "plugin.h" +/* color because greylib will use timer otherwise */ #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE) #define USE_TIMER #endif diff --git a/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c b/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c index 58de157..3a12d98 100644 --- a/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c +++ b/apps/plugins/sdl/src/video/rockbox/SDL_rockboxvideo.c @@ -769,8 +769,8 @@ static void ROCKBOX_UpdateRects(_THIS, int numrects, SDL_Rect *rects) /* FIXME: this won't work for rotated screen or overlapping rects */ flip_pixels(rects[i].x, rects[i].y, rects[i].w, rects[i].h); #endif + rb->lcd_update_rect(rects[i].x, rects[i].y, rects[i].w, rects[i].h); } /* for */ - rb->lcd_update(); } /* if */ } |