mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
Use glX/wgl VSync toggling... Detect default audio driver.
This commit is contained in:
parent
d37bd214e6
commit
064ab9e7bd
15
config.def.h
15
config.def.h
@ -26,6 +26,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "libsnes.hpp"
|
||||
#include "driver.h"
|
||||
#include "config.h"
|
||||
#include <samplerate.h>
|
||||
|
||||
|
||||
@ -43,7 +44,21 @@
|
||||
////////////////////////
|
||||
|
||||
#define VIDEO_DEFAULT_DRIVER VIDEO_GL
|
||||
|
||||
#if HAVE_ALSA
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_ALSA
|
||||
#elif HAVE_OSS
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_OSS
|
||||
#elif HAVE_JACK
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_JACK
|
||||
#elif HAVE_RSOUND
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_RSOUND
|
||||
#elif HAVE_ROAR
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_ROAR
|
||||
#elif HAVE_AL
|
||||
#define AUDIO_DEFAULT_DRIVER AUDIO_AL
|
||||
#endif
|
||||
|
||||
#define INPUT_DEFAULT_DRIVER INPUT_SDL
|
||||
|
||||
|
||||
|
24
gfx/gl.c
24
gfx/gl.c
@ -34,6 +34,10 @@
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glext.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CG
|
||||
#include "shader_cg.h"
|
||||
#endif
|
||||
@ -271,12 +275,20 @@ static void gl_set_nonblock_state(void *data, bool state)
|
||||
if (gl->vsync)
|
||||
{
|
||||
SSNES_LOG("GL VSync => %s\n", state ? "off" : "on");
|
||||
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, state ? 0 : 1);
|
||||
int attr = 0;
|
||||
SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &attr);
|
||||
if ((bool)attr == state)
|
||||
SSNES_WARN("Couldn't change VSync settings. Fast forwarding might not work.\n");
|
||||
//SDL_SetVideoMode(gl->win_width, gl->win_height, 32, SDL_OPENGL | SDL_RESIZABLE | (g_settings.video.fullscreen ? SDL_FULLSCREEN : 0));
|
||||
#ifdef _WIN32
|
||||
static BOOL (APIENTRY wgl_swap_interval*)(int) = NULL;
|
||||
if (!wgl_swap_interval)
|
||||
SSNES_WARN("SDL VSync toggling seems to be broken, attempting to use WGL VSync call directly instead.\n");
|
||||
if (!wgl_swap_interval) wgl_swap_interval = (BOOL (APIENTRY*)(int)) wglGetProcAddress("wglSwapIntervalEXT");
|
||||
if (wgl_swap_interval) wgl_swap_interval(state ? 0 : 1);
|
||||
#else
|
||||
static int (*glx_swap_interval)(int) = NULL;
|
||||
if (!glx_swap_interval)
|
||||
SSNES_WARN("SDL VSync toggling seems to be broken, attempting to use GLX VSync call directly instead.\n");
|
||||
if (!glx_swap_interval) glx_swap_interval = (int (*)(int))glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI");
|
||||
if (!glx_swap_interval) glx_swap_interval = (int (*)(int))glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA");
|
||||
if (glx_swap_interval) glx_swap_interval(state ? 0 : 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#define NO_SDL_GLEXT
|
||||
#include <GL/gl.h>
|
||||
//#include <GL/glfw.h>
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_opengl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -73,8 +73,6 @@ static void set_defaults(void)
|
||||
break;
|
||||
}
|
||||
|
||||
// No input atm ... It is in the GLFW driver.
|
||||
|
||||
if (def_video)
|
||||
strncpy(g_settings.video.driver, def_video, sizeof(g_settings.video.driver) - 1);
|
||||
if (def_audio)
|
||||
@ -129,6 +127,10 @@ void parse_config(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Just do something for now.
|
||||
conf = config_file_new("ssnes.cfg");
|
||||
#else
|
||||
const char *xdg = getenv("XDG_CONFIG_HOME");
|
||||
const char *home = getenv("HOME");
|
||||
if (xdg)
|
||||
@ -148,6 +150,7 @@ void parse_config(void)
|
||||
// Try this as a last chance...
|
||||
if (!conf)
|
||||
conf = config_file_new("/etc/ssnes.cfg");
|
||||
#endif
|
||||
}
|
||||
|
||||
set_defaults();
|
||||
|
Loading…
x
Reference in New Issue
Block a user