mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-30 17:53:01 +00:00
Do not check for erroring video twice
This commit is contained in:
parent
a747e4b20a
commit
51b55f3d99
1 changed files with 7 additions and 14 deletions
21
src/uxnemu.c
21
src/uxnemu.c
|
@ -146,26 +146,19 @@ init(void)
|
||||||
as.callback = audio_callback;
|
as.callback = audio_callback;
|
||||||
as.samples = 512;
|
as.samples = 512;
|
||||||
as.userdata = NULL;
|
as.userdata = NULL;
|
||||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0) {
|
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
|
||||||
error("sdl", SDL_GetError());
|
return error("sdl", SDL_GetError());
|
||||||
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
|
||||||
return error("sdl", SDL_GetError());
|
|
||||||
} else {
|
|
||||||
audio_id = SDL_OpenAudioDevice(NULL, 0, &as, NULL, 0);
|
|
||||||
if(!audio_id)
|
|
||||||
error("sdl_audio", SDL_GetError());
|
|
||||||
}
|
|
||||||
gWindow = SDL_CreateWindow("Uxn", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (WIDTH + PAD * 2) * zoom, (HEIGHT + PAD * 2) * zoom, SDL_WINDOW_SHOWN);
|
gWindow = SDL_CreateWindow("Uxn", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (WIDTH + PAD * 2) * zoom, (HEIGHT + PAD * 2) * zoom, SDL_WINDOW_SHOWN);
|
||||||
if(gWindow == NULL)
|
if(gWindow == NULL)
|
||||||
return error("sdl_window", SDL_GetError());
|
return error("sdl_window", SDL_GetError());
|
||||||
gRenderer = SDL_CreateRenderer(gWindow, -1, 0);
|
gRenderer = SDL_CreateRenderer(gWindow, -1, 0);
|
||||||
if(gRenderer == NULL)
|
if(gRenderer == NULL)
|
||||||
return error("sdl_renderer", SDL_GetError());
|
return error("sdl_renderer", SDL_GetError());
|
||||||
if(SDL_NumJoysticks()) {
|
audio_id = SDL_OpenAudioDevice(NULL, 0, &as, NULL, 0);
|
||||||
gGameController = SDL_JoystickOpen(0);
|
if(!audio_id)
|
||||||
if(gGameController == NULL)
|
error("sdl_audio", SDL_GetError());
|
||||||
return error("sdl_joystick", SDL_GetError());
|
if(SDL_NumJoysticks() > 0 && !(gGameController = SDL_JoystickOpen(0)))
|
||||||
}
|
error("sdl_joystick", SDL_GetError());
|
||||||
stdin_event = SDL_RegisterEvents(1);
|
stdin_event = SDL_RegisterEvents(1);
|
||||||
audio0_event = SDL_RegisterEvents(POLYPHONY);
|
audio0_event = SDL_RegisterEvents(POLYPHONY);
|
||||||
SDL_CreateThread(stdin_handler, "stdin", NULL);
|
SDL_CreateThread(stdin_handler, "stdin", NULL);
|
||||||
|
|
Loading…
Reference in a new issue