mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-23 14:55:39 +00:00
SDL is now fully shut down with the RPi renderer.
This commit is contained in:
parent
7e6498df60
commit
e08391080b
|
@ -1,3 +1,6 @@
|
||||||
|
September 29
|
||||||
|
-SDL is now completely shut down on both the RPi and SDL GL renderer. You may see the flicker of a terminal when you launch a game. This was done in preparation for audio.
|
||||||
|
|
||||||
September 23
|
September 23
|
||||||
-Fixed crash when "%ROM%" isn't present in a launch command. Not sure why you'd ever do this on purpose, but hey.
|
-Fixed crash when "%ROM%" isn't present in a launch command. Not sure why you'd ever do this on purpose, but hey.
|
||||||
-Added relative path operator ("./") support for gamelist.xml, for both game paths and image paths.
|
-Added relative path operator ("./") support for gamelist.xml, for both game paths and image paths.
|
||||||
|
|
|
@ -6,9 +6,13 @@
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <EGL/eglext.h>
|
#include <EGL/eglext.h>
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#include "InputManager.h"
|
||||||
|
|
||||||
namespace Renderer
|
namespace Renderer
|
||||||
{
|
{
|
||||||
|
SDL_Surface* sdlScreen;
|
||||||
|
|
||||||
EGLDisplay display;
|
EGLDisplay display;
|
||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
EGLContext context;
|
EGLContext context;
|
||||||
|
@ -24,6 +28,26 @@ namespace Renderer
|
||||||
|
|
||||||
bool createSurface() //unsigned int display_width, unsigned int display_height)
|
bool createSurface() //unsigned int display_width, unsigned int display_height)
|
||||||
{
|
{
|
||||||
|
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) != 0)
|
||||||
|
{
|
||||||
|
std::cerr << "Error initializing SDL!\n";
|
||||||
|
std::cerr << SDL_GetError() << "\n";
|
||||||
|
std::cerr << "Are you in the 'video' and 'input' groups? Is X closed? Is your firmware up to date? Are you using at least the 192/64 memory split?\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sdlScreen = SDL_SetVideoMode(1, 1, 0, SDL_SWSURFACE);
|
||||||
|
if(sdlScreen == NULL)
|
||||||
|
{
|
||||||
|
std::cerr << "Error creating SDL window for input!\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//have to reload config to re-open SDL joysticks
|
||||||
|
InputManager::loadConfig();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::cout << "Creating surface...";
|
std::cout << "Creating surface...";
|
||||||
|
|
||||||
DISPMANX_ELEMENT_HANDLE_T dispman_element;
|
DISPMANX_ELEMENT_HANDLE_T dispman_element;
|
||||||
|
@ -148,6 +172,10 @@ namespace Renderer
|
||||||
|
|
||||||
void destroySurface()
|
void destroySurface()
|
||||||
{
|
{
|
||||||
|
SDL_FreeSurface(sdlScreen);
|
||||||
|
sdlScreen = NULL;
|
||||||
|
SDL_Quit();
|
||||||
|
|
||||||
eglSwapBuffers(display, surface);
|
eglSwapBuffers(display, surface);
|
||||||
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
eglDestroySurface(display, surface);
|
eglDestroySurface(display, surface);
|
||||||
|
|
22
src/main.cpp
22
src/main.cpp
|
@ -71,27 +71,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
|
|
||||||
//desktop uses SDL to set up an OpenGL context, and has its own SDL window...so I #ifdefed here.
|
//the renderer also takes care of setting up SDL for input
|
||||||
//this should be moved to the RPi init/deinit file
|
|
||||||
|
|
||||||
//ALWAYS INITIALIZE VIDEO. It starts SDL's event system, and without it, input won't work.
|
|
||||||
#ifdef _RPI_
|
|
||||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) != 0)
|
|
||||||
{
|
|
||||||
std::cerr << "Error - could not initialize SDL!\n";
|
|
||||||
std::cerr << " " << SDL_GetError() << "\n";
|
|
||||||
std::cerr << "Are you in the 'video' and 'input' groups? Are you running with X closed? Is your firmware up to date? Are you using at least the 192/64 memory split?\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface* sdlScreen = SDL_SetVideoMode(1, 1, 0, SDL_SWSURFACE);
|
|
||||||
if(sdlScreen == NULL)
|
|
||||||
{
|
|
||||||
std::cerr << "Error initializing SDL screen!\n";
|
|
||||||
running = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool renderInit = Renderer::init(width, height);
|
bool renderInit = Renderer::init(width, height);
|
||||||
if(!renderInit)
|
if(!renderInit)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue