Permalink
Browse files

video: glide2gl runs!

  • Loading branch information...
fzurita committed Feb 8, 2016
1 parent a320658 commit bab65c86656e33bb7337d4e51872265541ea3688
@@ -58,8 +58,6 @@ static m64p_error PluginLoadTry(const char *filepath, int MapIndex)
ptr_PluginGetVersion PluginGetVersion = (ptr_PluginGetVersion) osal_dynlib_getproc(handle, "PluginGetVersion");
if (PluginGetVersion == NULL)
{
- DebugMessage(M64MSG_ERROR,"library '%s' is not a Mupen64Plus library.", filepath);
-
if (g_Verbose)
DebugMessage(M64MSG_ERROR, "library '%s' is not a Mupen64Plus library.", filepath);
osal_dynlib_close(handle);
@@ -81,14 +79,12 @@ static m64p_error PluginLoadTry(const char *filepath, int MapIndex)
ptr_PluginStartup PluginStartup = (ptr_PluginStartup) osal_dynlib_getproc(handle, "PluginStartup");
if (PluginStartup == NULL)
{
- DebugMessage(M64MSG_ERROR, "library '%s' broken. No PluginStartup() function found.", filepath);
osal_dynlib_close(handle);
return M64ERR_INCOMPATIBLE;
}
rval = (*PluginStartup)(CoreHandle, g_PluginMap[MapIndex].name, DebugCallback); /* DebugCallback is in main.c */
if (rval != M64ERR_SUCCESS)
{
- DebugMessage(M64MSG_ERROR, "Error: %s plugin library '%s' failed to start.", g_PluginMap[MapIndex].name, filepath);
osal_dynlib_close(handle);
return rval;
}
@@ -184,17 +180,13 @@ m64p_error PluginSearchLoad(m64p_handle ConfigUI)
}
else /* otherwise search for a plugin specified in the config file */
{
- DebugMessage(M64MSG_ERROR, "Searching for plugin in config file");
-
const char *config_path = (*ConfigGetParamString)(ConfigUI, config_var);
if (config_path != NULL && strlen(config_path) > 0)
{
/* if full path was given, try loading exactly this file */
if (strchr(config_path, OSAL_DIR_SEPARATOR) != NULL)
{
- int lnReturn = PluginLoadTry(config_path, i);
-
- DebugMessage(M64MSG_ERROR, "Trying this plugin: %s, return=%i", config_path, lnReturn);
+ PluginLoadTry(config_path, i);
}
else if (strcmp(config_path, "dummy") == 0)
{
@@ -39,6 +39,8 @@ LOCAL_SRC_FILES := \
$(SRCDIR)/libretro/gdp.c \
$(SRCDIR)/libretro/libretro.c \
$(SRCDIR)/libretro/libretro_crc.c \
+ $(SRCDIR)/osal/dynamiclib_unix.c \
+
LOCAL_CFLAGS := \
$(COMMON_CFLAGS) \
@@ -347,34 +347,66 @@ ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = NULL;
void(*renderCallback)(int) = NULL;
+static void setAttributes(void)
+{
+ CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 2);
+ CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 0);
+
+ CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, 1);
+ CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL,false);
+ CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, 32);
+ CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, 16);
+ /*if (config.video.multisampling > 0 && config.frameBufferEmulation.enable == 0) {
+ CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLEBUFFERS, 1);
+ if (config.video.multisampling <= 2)
+ CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 2);
+ else if (config.video.multisampling <= 4)
+ CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 4);
+ else if (config.video.multisampling <= 8)
+ CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 8);
+ else
+ CoreVideo_GL_SetAttribute(M64P_GL_MULTISAMPLESAMPLES, 16);
+ }*/
+}
+
EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Context,
void (*DebugCallback)(void *, int, const char *))
{
/* 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");
- CoreVideo_ListFullscreenModes = (ptr_VidExt_ListFullscreenModes) dlsym(CoreLibHandle, "VidExt_ListFullscreenModes");
- CoreVideo_SetVideoMode = (ptr_VidExt_SetVideoMode) dlsym(CoreLibHandle, "VidExt_SetVideoMode");
- CoreVideo_SetCaption = (ptr_VidExt_SetCaption) dlsym(CoreLibHandle, "VidExt_SetCaption");
- CoreVideo_ToggleFullScreen = (ptr_VidExt_ToggleFullScreen) dlsym(CoreLibHandle, "VidExt_ToggleFullScreen");
- CoreVideo_ResizeWindow = (ptr_VidExt_ResizeWindow) dlsym(CoreLibHandle, "VidExt_ResizeWindow");
- CoreVideo_GL_GetProcAddress = (ptr_VidExt_GL_GetProcAddress) dlsym(CoreLibHandle, "VidExt_GL_GetProcAddress");
- CoreVideo_GL_SetAttribute = (ptr_VidExt_GL_SetAttribute) dlsym(CoreLibHandle, "VidExt_GL_SetAttribute");
- CoreVideo_GL_GetAttribute = (ptr_VidExt_GL_GetAttribute) dlsym(CoreLibHandle, "VidExt_GL_GetAttribute");
- CoreVideo_GL_SwapBuffers = (ptr_VidExt_GL_SwapBuffers) dlsym(CoreLibHandle, "VidExt_GL_SwapBuffers");
-
+ CoreVideo_Init = (ptr_VidExt_Init) osal_dynlib_getproc(CoreLibHandle, "VidExt_Init");
+ CoreVideo_Quit = (ptr_VidExt_Quit) osal_dynlib_getproc(CoreLibHandle, "VidExt_Quit");
+ CoreVideo_ListFullscreenModes = (ptr_VidExt_ListFullscreenModes) osal_dynlib_getproc(CoreLibHandle, "VidExt_ListFullscreenModes");
+ CoreVideo_SetVideoMode = (ptr_VidExt_SetVideoMode) osal_dynlib_getproc(CoreLibHandle, "VidExt_SetVideoMode");
+ CoreVideo_SetCaption = (ptr_VidExt_SetCaption) osal_dynlib_getproc(CoreLibHandle, "VidExt_SetCaption");
+ CoreVideo_ToggleFullScreen = (ptr_VidExt_ToggleFullScreen) osal_dynlib_getproc(CoreLibHandle, "VidExt_ToggleFullScreen");
+ CoreVideo_ResizeWindow = (ptr_VidExt_ResizeWindow) osal_dynlib_getproc(CoreLibHandle, "VidExt_ResizeWindow");
+ CoreVideo_GL_GetProcAddress = (ptr_VidExt_GL_GetProcAddress) osal_dynlib_getproc(CoreLibHandle, "VidExt_GL_GetProcAddress");
+ CoreVideo_GL_SetAttribute = (ptr_VidExt_GL_SetAttribute) osal_dynlib_getproc(CoreLibHandle, "VidExt_GL_SetAttribute");
+ CoreVideo_GL_GetAttribute = (ptr_VidExt_GL_GetAttribute) osal_dynlib_getproc(CoreLibHandle, "VidExt_GL_GetAttribute");
+ CoreVideo_GL_SwapBuffers = (ptr_VidExt_GL_SwapBuffers) osal_dynlib_getproc(CoreLibHandle, "VidExt_GL_SwapBuffers");
+
+ CoreVideo_Init();
retro_init();
-
l_DebugCallback = DebugCallback;
l_DebugCallContext = Context;
ReadSettings();
+ setAttributes();
+
+ if(CoreVideo_GL_SwapBuffers == NULL)
+ {
+ log_cb(RETRO_LOG_INFO, "Invalid SwapByffers function");
+ }
+
+ CoreVideo_SetVideoMode(settings.scr_res_x, settings.scr_res_y, 0, M64VIDEO_FULLSCREEN, (m64p_video_flags) 0);
return M64ERR_SUCCESS;
}
EXPORT m64p_error CALL PluginShutdown(void)
{
+ CoreVideo_Quit();
+
return M64ERR_SUCCESS;
}
@@ -30,6 +30,8 @@
#include "SDL.h"
extern retro_environment_t environ_cb;
+extern ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers;
+
int width, height;
int bgra8888_support;
@@ -337,6 +339,13 @@ grLfbWriteRegion( int32_t dst_buffer,
void grBufferSwap(uint32_t swap_interval)
{
bool swapmode = settings.swapmode_retro && BUFFERSWAP;
+
+ if(CoreVideo_GL_SwapBuffers == NULL)
+ {
+ log_cb(RETRO_LOG_INFO, "Invalid SwapByffers function");
+ }
+
+ CoreVideo_GL_SwapBuffers();
//if (!swapmode)
// retro_return(true);
}
@@ -269,7 +269,7 @@ void androidLog(enum retro_log_level level, const char *fmt, ...)
default:
break;
}
- __android_log_print(logPriority, "glide2gl",fmt, arguments);
+ __android_log_vprint(logPriority, "glide2gl",fmt, arguments);
va_end ( arguments );
}
@@ -22,7 +22,7 @@
#if !defined(OSAL_DYNAMICLIB_H)
#define OSAL_DYNAMICLIB_H
-#include "api/m64p_types.h"
+#include "m64p_types.h"
void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName);
@@ -22,8 +22,8 @@
#include <dlfcn.h>
#include <stdlib.h>
-#include "api/callbacks.h"
-#include "api/m64p_types.h"
+#include "callbacks.h"
+#include "m64p_types.h"
#include "dynamiclib.h"
void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName)

0 comments on commit bab65c8

Please sign in to comment.