Skip to content
Permalink
Browse files

video: glide2gl is now configurable

  • Loading branch information
fzurita committed Feb 10, 2016
1 parent bab65c8 commit 65db13aca9c11ec5aa107b18e8674a8851b88656
@@ -11,16 +11,22 @@ videoPlugin=libmupen64plus-video-glide64mk2.so
glide64Frameskip=-5

[libretro-Glide64-Accurate]
comment=glide64 video with recommended settings for quality
comment=libretro glide64 video with recommended settings for quality
r4300Emulator=2
videoPlugin=libmupen64plus-video-glide2gl.so
glide64Frameskip=0
glide2glAccuracy=high

[libretro-Glide64-Fast]
comment=glide64 video with recommended settings for speed
comment=libretro glide64 video with recommended settings for speed
r4300Emulator=2
videoPlugin=libmupen64plus-video-glide2gl.so
glide64Frameskip=-5
glide2glAccuracy=medium

[libretro-Glide64-Low end]
comment=libretro glide64 video with recommended settings for low end devices
r4300Emulator=2
videoPlugin=libmupen64plus-video-glide2gl.so
glide2glAccuracy=low

[GlideN64-GLES-2.0]
comment=gliden64 video with recommended settings for most older devices
@@ -25,6 +25,7 @@ LOCAL_SRC_FILES := \
$(SRCDIR)/Glitch64/glitch64_textures.c \
$(SRCDIR)/Glitch64/glitchmain.c \
$(SRCDIR)/Glide64/Combine.c \
$(SRCDIR)/Glide64/Config.c \
$(SRCDIR)/Glide64/DepthBufferRender.c \
$(SRCDIR)/Glide64/FBtoScreen.c \
$(SRCDIR)/Glide64/glide64_3dmath.c \
@@ -0,0 +1,106 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2010 Jon Ring
* Copyright (c) 2002 Dave2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* Licence along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*/
#include "Gfx_1.3.h"
#include "Config.h"
#include "m64p.h"
#include "rdp.h"

extern ptr_ConfigOpenSection CoreConfig_ConfigOpenSection;
extern ptr_ConfigSetParameter CoreConfig_ConfigSetParameter;
extern ptr_ConfigGetParameter CoreConfig_ConfigGetParameter;
extern ptr_ConfigGetParameterHelp CoreConfig_ConfigGetParameterHelp;
extern ptr_ConfigSetDefaultInt CoreConfig_ConfigSetDefaultInt;
extern ptr_ConfigSetDefaultFloat CoreConfig_ConfigSetDefaultFloat;
extern ptr_ConfigSetDefaultBool CoreConfig_ConfigSetDefaultBool;
extern ptr_ConfigSetDefaultString CoreConfig_ConfigSetDefaultString;
extern ptr_ConfigGetParamInt CoreConfig_ConfigGetParamInt;
extern ptr_ConfigGetParamFloat CoreConfig_ConfigGetParamFloat;
extern ptr_ConfigGetParamBool CoreConfig_ConfigGetParamBool;
extern ptr_ConfigGetParamString CoreConfig_ConfigGetParamString;

extern ptr_ConfigGetSharedDataFilepath CoreConfig_ConfigGetSharedDataFilepath;
extern ptr_ConfigGetUserConfigPath CoreConfig_ConfigGetUserConfigPath;
extern ptr_ConfigGetUserDataPath CoreConfig_ConfigGetUserDataPath;
extern ptr_ConfigGetUserCachePath CoreConfig_ConfigGetUserCachePath;

static m64p_handle video_general_section;
static m64p_handle video_glide2gl_section;

BOOL Config_Open()
{
if (CoreConfig_ConfigOpenSection("Video-General", &video_general_section) != M64ERR_SUCCESS ||
CoreConfig_ConfigOpenSection("Video-Glide2gl", &video_glide2gl_section) != M64ERR_SUCCESS)
{
ERRLOG("Could not open configuration");
return FALSE;
}

CoreConfig_ConfigSetDefaultString(video_glide2gl_section, "accuracy", "medium",
"FX Accuracy (restart); medium|high|veryhigh|low");
CoreConfig_ConfigSetDefaultString(video_glide2gl_section, "aspect", "normal",
"Aspect ratio hint (reinit); normal|widescreen");
CoreConfig_ConfigSetDefaultString(video_glide2gl_section, "filtering", "automatic",
"Texture Filtering; automatic|N64 3-point|bilinear|nearest");
CoreConfig_ConfigSetDefaultString(video_glide2gl_section, "polyoffset-factor", "-3.0",
"Polygon Offset Factor; -3.0|-2.5|-2.0|-1.5|-1.0|-0.5|0.0|0.5|1.0|1.5|2.0|2.5|3.0|3.5|4.0|4.5|5.0|-3.5|-4.0|-4.5|-5.0");
CoreConfig_ConfigSetDefaultString(video_glide2gl_section, "polyoffset-units", "-3.0",
"Polygon Offset Factor; -3.0|-2.5|-2.0|-1.5|-1.0|-0.5|0.0|0.5|1.0|1.5|2.0|2.5|3.0|3.5|4.0|4.5|5.0|-3.5|-4.0|-4.5|-5.0");
CoreConfig_ConfigSetDefaultString(video_glide2gl_section, "bufferswap", "on",
"Buffer Swap; on|off");
CoreConfig_ConfigSetDefaultString(video_glide2gl_section, "framerate", "original",
"Framerate (restart); original|fullspeed");
CoreConfig_ConfigSetDefaultString(video_glide2gl_section, "vcache-vbo", "ofg",
"Vertex cache VBO (restart); off|on");

return TRUE;
}

int Config_ReadScreenInt(const char *itemname)
{
return CoreConfig_ConfigGetParamInt(video_general_section, itemname);
}

BOOL Config_ReadInt(const char *itemname, const char *desc, int def_value, int create, int isBoolean)
{
if (isBoolean)
{
CoreConfig_ConfigSetDefaultBool(video_glide2gl_section, itemname, def_value, desc);
return CoreConfig_ConfigGetParamBool(video_glide2gl_section, itemname);
}
else
{
CoreConfig_ConfigSetDefaultInt(video_glide2gl_section, itemname, def_value, desc);
return CoreConfig_ConfigGetParamInt(video_glide2gl_section, itemname);
}

}

float Config_ReadFloat(const char *itemname, const char *desc, float def_value)
{
CoreConfig_ConfigSetDefaultFloat(video_glide2gl_section, itemname, def_value, desc);
return CoreConfig_ConfigGetParamFloat(video_glide2gl_section, itemname);
}

const char* Config_ReadString(const char *itemname, const char *desc, const char *def_value)
{
CoreConfig_ConfigSetDefaultString(video_glide2gl_section, itemname, def_value, desc);
return CoreConfig_ConfigGetParamString(video_glide2gl_section, itemname);
}
@@ -0,0 +1,35 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2010 Jon Ring
* Copyright (c) 2002 Dave2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* Licence along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*/

#ifndef CONFIG_H
#define CONFIG_H

#include "winlnxdefs.h"
#include "m64p.h"

BOOL Config_Open();
int Config_ReadScreenInt(const char *itemname);
BOOL Config_ReadInt(const char *itemname, const char *desc, int def_value, int create, BOOL isBoolean);
float Config_ReadFloat(const char *itemname, const char *desc, float def_value);
const char* Config_ReadString(const char *itemname, const char *desc, const char *def_value);

#endif /* CONFIG_H */

@@ -48,6 +48,7 @@
#include "Glide64_Ini.h"
#include "libretro/libretro.h"
#include "m64p.h"
#include "Config.h"

extern void CRC_BuildTable();
extern uint32_t screen_aspectmodehint;
@@ -345,6 +346,25 @@ ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = NULL;
ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = NULL;
ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = NULL;

/* definitions of pointers to Core config functions */
ptr_ConfigOpenSection CoreConfig_ConfigOpenSection = NULL;
ptr_ConfigSetParameter CoreConfig_ConfigSetParameter = NULL;
ptr_ConfigGetParameter CoreConfig_ConfigGetParameter = NULL;
ptr_ConfigGetParameterHelp CoreConfig_ConfigGetParameterHelp = NULL;
ptr_ConfigSetDefaultInt CoreConfig_ConfigSetDefaultInt = NULL;
ptr_ConfigSetDefaultFloat CoreConfig_ConfigSetDefaultFloat = NULL;
ptr_ConfigSetDefaultBool CoreConfig_ConfigSetDefaultBool = NULL;
ptr_ConfigSetDefaultString CoreConfig_ConfigSetDefaultString = NULL;
ptr_ConfigGetParamInt CoreConfig_ConfigGetParamInt = NULL;
ptr_ConfigGetParamFloat CoreConfig_ConfigGetParamFloat = NULL;
ptr_ConfigGetParamBool CoreConfig_ConfigGetParamBool = NULL;
ptr_ConfigGetParamString CoreConfig_ConfigGetParamString = NULL;

ptr_ConfigGetSharedDataFilepath CoreConfig_ConfigGetSharedDataFilepath = NULL;
ptr_ConfigGetUserConfigPath CoreConfig_ConfigGetUserConfigPath = NULL;
ptr_ConfigGetUserDataPath CoreConfig_ConfigGetUserDataPath = NULL;
ptr_ConfigGetUserCachePath CoreConfig_ConfigGetUserCachePath = NULL;

void(*renderCallback)(int) = NULL;

static void setAttributes(void)
@@ -372,6 +392,24 @@ static void setAttributes(void)
EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Context,
void (*DebugCallback)(void *, int, const char *))
{
CoreConfig_ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreLibHandle, "ConfigOpenSection");
CoreConfig_ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigSetParameter");
CoreConfig_ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParameter");
CoreConfig_ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultInt");
CoreConfig_ConfigSetDefaultFloat = (ptr_ConfigSetDefaultFloat) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultFloat");
CoreConfig_ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultBool");
CoreConfig_ConfigSetDefaultString = (ptr_ConfigSetDefaultString) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultString");
CoreConfig_ConfigGetParamInt = (ptr_ConfigGetParamInt) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamInt");
CoreConfig_ConfigGetParamFloat = (ptr_ConfigGetParamFloat) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamFloat");
CoreConfig_ConfigGetParamBool = (ptr_ConfigGetParamBool) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamBool");
CoreConfig_ConfigGetParamString = (ptr_ConfigGetParamString) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamString");

CoreConfig_ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetSharedDataFilepath");
CoreConfig_ConfigGetUserConfigPath = (ptr_ConfigGetUserConfigPath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserConfigPath");
CoreConfig_ConfigGetUserDataPath = (ptr_ConfigGetUserDataPath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserDataPath");
CoreConfig_ConfigGetUserCachePath = (ptr_ConfigGetUserCachePath) osal_dynlib_getproc(CoreLibHandle, "ConfigGetUserCachePath");


/* Get the core Video Extension function pointers from the library handle */
CoreVideo_Init = (ptr_VidExt_Init) osal_dynlib_getproc(CoreLibHandle, "VidExt_Init");
CoreVideo_Quit = (ptr_VidExt_Quit) osal_dynlib_getproc(CoreLibHandle, "VidExt_Quit");
@@ -387,6 +425,8 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con

CoreVideo_Init();

Config_Open();

retro_init();
l_DebugCallback = DebugCallback;
l_DebugCallContext = Context;
@@ -0,0 +1,73 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
* Copyright (c) 2012-2013 balrog, wahrhaft
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/


#ifndef WINLNXDEFS_H
#define WINLNXDEFS_H

#define wxPtrToUInt (uintptr_t)
#define TRUE 1
#define FALSE 0

#define _T(x) x

#include <stdint.h>

typedef int BOOL;
typedef uint32_t wxUint32;
typedef uint16_t wxUint16;
typedef uint8_t wxUint8;
typedef uint8_t BYTE;
typedef long long LONGLONG;


typedef int32_t wxInt32;
typedef int16_t wxInt16;
typedef int8_t wxInt8;

typedef uint64_t wxUint64;
typedef int64_t wxInt64;

typedef unsigned char wxChar;
typedef uintptr_t wxUIntPtr;

#ifndef _WIN32

typedef union _LARGE_INTEGER
{
struct
{
uint32_t LowPart;
uint32_t HighPart;
} s;
struct
{
uint32_t LowPart;
uint32_t HighPart;
} u;
long long QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;

#define WINAPI

#endif

#endif

0 comments on commit 65db13a

Please sign in to comment.
You can’t perform that action at this time.