diff --git a/src/plugin/mupen64plus/gfx_m64p.c b/src/plugin/mupen64plus/gfx_m64p.c index b199c58..a7da290 100644 --- a/src/plugin/mupen64plus/gfx_m64p.c +++ b/src/plugin/mupen64plus/gfx_m64p.c @@ -35,6 +35,7 @@ #define KEY_VI_WIDESCREEN "ViWidescreen" #define KEY_VI_HIDE_OVERSCAN "ViHideOverscan" #define KEY_VI_INTEGER_SCALING "ViIntegerScaling" +#define KEY_VI_VSYNC "ViVsync" #define KEY_DP_COMPAT "DpCompat" @@ -121,6 +122,7 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle _CoreLibHandle, void *Co ConfigSetDefaultBool(configVideoAngrylionPlus, KEY_VI_WIDESCREEN, config.vi.widescreen, "Use anamorphic 16:9 output mode if True"); ConfigSetDefaultBool(configVideoAngrylionPlus, KEY_VI_HIDE_OVERSCAN, config.vi.hide_overscan, "Hide overscan area in filteded mode if True"); ConfigSetDefaultBool(configVideoAngrylionPlus, KEY_VI_INTEGER_SCALING, config.vi.integer_scaling, "Display upscaled pixels as groups of 1x1, 2x2, 3x3, etc. if True"); + ConfigSetDefaultBool(configVideoAngrylionPlus, KEY_VI_VSYNC, config.vi.vsync, "Enable vsync to prevent tearing"); ConfigSetDefaultInt(configVideoAngrylionPlus, KEY_DP_COMPAT, config.dp.compat, "Compatibility mode (0=Fast 1=Moderate 2=Slow"); ConfigSaveSection("Video-General"); @@ -210,6 +212,7 @@ EXPORT int CALL RomOpen (void) config.vi.widescreen = ConfigGetParamBool(configVideoAngrylionPlus, KEY_VI_WIDESCREEN); config.vi.hide_overscan = ConfigGetParamBool(configVideoAngrylionPlus, KEY_VI_HIDE_OVERSCAN); config.vi.integer_scaling = ConfigGetParamBool(configVideoAngrylionPlus, KEY_VI_INTEGER_SCALING); + config.vi.vsync = ConfigGetParamBool(configVideoAngrylionPlus, KEY_VI_VSYNC); config.dp.compat = ConfigGetParamInt(configVideoAngrylionPlus, KEY_DP_COMPAT); diff --git a/src/plugin/mupen64plus/screen.c b/src/plugin/mupen64plus/screen.c index 6d69afb..dd8bab2 100644 --- a/src/plugin/mupen64plus/screen.c +++ b/src/plugin/mupen64plus/screen.c @@ -34,8 +34,6 @@ void* IntGetProcAddress(const char *name) void screen_init(struct n64video_config* config) { - UNUSED(config); - /* Get the core Video Extension function pointers from the library handle */ CoreVideo_Init = (ptr_VidExt_Init) DLSYM(CoreLibHandle, "VidExt_Init"); CoreVideo_Quit = (ptr_VidExt_Quit) DLSYM(CoreLibHandle, "VidExt_Quit"); @@ -62,6 +60,8 @@ void screen_init(struct n64video_config* config) CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 0); #endif + CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, config->vi.vsync); + CoreVideo_SetVideoMode(win_width, win_height, 0, win_fullscreen ? M64VIDEO_FULLSCREEN : M64VIDEO_WINDOWED, M64VIDEOFLAG_SUPPORT_RESIZING); }