Fix crashes in sdl/sw-main

This commit is contained in:
Jeffrey Pfau 2014-10-01 01:59:03 -07:00
parent 5afd8ea1bb
commit 996cfe8a26
1 changed files with 4 additions and 2 deletions

View File

@ -82,6 +82,9 @@ int main(int argc, char** argv) {
renderer.audio.samples = context.audioBuffers;
GBASDLInitAudio(&renderer.audio);
renderer.events.bindings = &context.inputMap;
GBASDLInitEvents(&renderer.events);
#if SDL_VERSION_ATLEAST(2, 0, 0)
renderer.events.fullscreen = graphicsOpts.fullscreen;
renderer.window = SDL_CreateWindow(PROJECT_NAME, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, renderer.viewportWidth, renderer.viewportHeight, SDL_WINDOW_OPENGL | (SDL_WINDOW_FULLSCREEN_DESKTOP * renderer.events.fullscreen));
@ -139,8 +142,6 @@ static int _GBASDLInit(struct SoftwareRenderer* renderer) {
return 0;
}
GBASDLInitEvents(&renderer->events);
#if !SDL_VERSION_ATLEAST(2, 0, 0)
#ifdef COLOR_16_BIT
SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 16, SDL_DOUBLEBUF | SDL_HWSURFACE);
@ -203,6 +204,7 @@ static void _GBASDLDeinit(struct SoftwareRenderer* renderer) {
static void _GBASDLStart(struct GBAThread* threadContext) {
struct SoftwareRenderer* renderer = threadContext->userData;
renderer->audio.audio = &threadContext->gba->audio;
renderer->audio.thread = threadContext;
}
static void _GBASDLClean(struct GBAThread* threadContext) {