From 923cd5a6e3477ba9b97e877806afca00b2545372 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 18 Mar 2019 20:54:03 +0000 Subject: [PATCH] Added some Raspberry Pi hacks Also added a debug print that tells you what backend SDL2 is using --- src/Draw.cpp | 12 +++++++++++- src/Sound.cpp | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Draw.cpp b/src/Draw.cpp index 807ad59d..a3911ecd 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -85,12 +85,22 @@ BOOL StartDirectDraw(int lMagnification, int lColourDepth) //Initialize rendering SDL_InitSubSystem(SDL_INIT_VIDEO); - + +#ifdef RASPBERRY_PI + //Force OpenGLES2 on Raspberry Pi + SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengles2"); +#endif + //Create renderer gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED); if (gRenderer != NULL) { + //Print the name of the renderer SDL2 is using + SDL_RendererInfo info; + SDL_GetRendererInfo(gRenderer, &info); + printf("Renderer: %s\n", info.name); + switch (lMagnification) { case 0: diff --git a/src/Sound.cpp b/src/Sound.cpp index 52fda1b1..004b1ae2 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -11,7 +11,12 @@ #include "PixTone.h" #define FREQUENCY 44100 + +#ifdef RASPBERRY_PI +#define STREAM_SIZE 0x400 +#else #define STREAM_SIZE (FREQUENCY / 200) +#endif #define clamp(x, y, z) ((x > z) ? z : (x < y) ? y : x)