mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Init mupen64plus config at PluginStartup
This commit is contained in:
parent
f567186e01
commit
528744de19
|
@ -18,18 +18,19 @@ Config config;
|
||||||
static
|
static
|
||||||
const u32 uMegabyte = 1024U*1024U;
|
const u32 uMegabyte = 1024U*1024U;
|
||||||
|
|
||||||
static m64p_handle g_configVideoGeneral = nullptr;
|
m64p_handle g_configVideoGeneral = nullptr;
|
||||||
static m64p_handle g_configVideoGliden64 = nullptr;
|
m64p_handle g_configVideoGliden64 = nullptr;
|
||||||
|
|
||||||
static
|
|
||||||
bool Config_SetDefault()
|
bool Config_SetDefault()
|
||||||
{
|
{
|
||||||
if (ConfigOpenSection("Video-General", &g_configVideoGeneral) != M64ERR_SUCCESS) {
|
if (ConfigOpenSection("Video-General", &g_configVideoGeneral) != M64ERR_SUCCESS) {
|
||||||
LOG(LOG_ERROR, "Unable to open Video-General configuration section");
|
LOG(LOG_ERROR, "Unable to open Video-General configuration section");
|
||||||
|
g_configVideoGeneral = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ConfigOpenSection("Video-GLideN64", &g_configVideoGliden64) != M64ERR_SUCCESS) {
|
if (ConfigOpenSection("Video-GLideN64", &g_configVideoGliden64) != M64ERR_SUCCESS) {
|
||||||
LOG(LOG_ERROR, "Unable to open GLideN64 configuration section");
|
LOG(LOG_ERROR, "Unable to open GLideN64 configuration section");
|
||||||
|
g_configVideoGliden64 = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,23 +310,8 @@ void Config_LoadCustomConfig()
|
||||||
|
|
||||||
void Config_LoadConfig()
|
void Config_LoadConfig()
|
||||||
{
|
{
|
||||||
const u32 hacks = config.generalEmulation.hacks;
|
if (g_configVideoGeneral == nullptr || g_configVideoGliden64 == nullptr)
|
||||||
|
|
||||||
if (!Config_SetDefault()) {
|
|
||||||
config.generalEmulation.hacks = hacks;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
config.version = ConfigGetParamInt(g_configVideoGliden64, "configVersion");
|
|
||||||
if (config.version != CONFIG_VERSION_CURRENT) {
|
|
||||||
m64p_error res = ConfigDeleteSection("Video-GLideN64");
|
|
||||||
assert(res == M64ERR_SUCCESS);
|
|
||||||
ConfigSaveFile();
|
|
||||||
if (!Config_SetDefault()) {
|
|
||||||
config.generalEmulation.hacks = hacks;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
config.video.fullscreen = ConfigGetParamBool(g_configVideoGeneral, "Fullscreen");
|
config.video.fullscreen = ConfigGetParamBool(g_configVideoGeneral, "Fullscreen");
|
||||||
config.video.windowedWidth = ConfigGetParamInt(g_configVideoGeneral, "ScreenWidth");
|
config.video.windowedWidth = ConfigGetParamInt(g_configVideoGeneral, "ScreenWidth");
|
||||||
|
@ -429,5 +415,4 @@ void Config_LoadConfig()
|
||||||
|
|
||||||
if (config.generalEmulation.enableCustomSettings)
|
if (config.generalEmulation.enableCustomSettings)
|
||||||
Config_LoadCustomConfig();
|
Config_LoadCustomConfig();
|
||||||
config.generalEmulation.hacks = hacks;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,4 +49,8 @@ extern ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers;
|
||||||
|
|
||||||
extern void(*renderCallback)(int);
|
extern void(*renderCallback)(int);
|
||||||
|
|
||||||
|
extern m64p_handle g_configVideoGeneral;
|
||||||
|
extern m64p_handle g_configVideoGliden64;
|
||||||
|
bool Config_SetDefault();
|
||||||
|
|
||||||
#endif // GLIDEN64_MUPENPLUS_H
|
#endif // GLIDEN64_MUPENPLUS_H
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "GLideN64_mupenplus.h"
|
#include "GLideN64_mupenplus.h"
|
||||||
#include "../PluginAPI.h"
|
#include "../PluginAPI.h"
|
||||||
#include "../GLideN64.h"
|
#include "../GLideN64.h"
|
||||||
|
#include "../Config.h"
|
||||||
#include <DisplayWindow.h>
|
#include <DisplayWindow.h>
|
||||||
|
|
||||||
#ifdef OS_WINDOWS
|
#ifdef OS_WINDOWS
|
||||||
|
@ -81,6 +82,14 @@ m64p_error PluginAPI::PluginStartup(m64p_dynlib_handle _CoreLibHandle)
|
||||||
CoreVideo_GL_GetAttribute = (ptr_VidExt_GL_GetAttribute) DLSYM(_CoreLibHandle, "VidExt_GL_GetAttribute");
|
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_GL_SwapBuffers = (ptr_VidExt_GL_SwapBuffers) DLSYM(_CoreLibHandle, "VidExt_GL_SwapBuffers");
|
||||||
|
|
||||||
|
if (Config_SetDefault()) {
|
||||||
|
config.version = ConfigGetParamInt(g_configVideoGliden64, "configVersion");
|
||||||
|
if (config.version != CONFIG_VERSION_CURRENT) {
|
||||||
|
ConfigDeleteSection("Video-GLideN64");
|
||||||
|
ConfigSaveFile();
|
||||||
|
Config_SetDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
return M64ERR_SUCCESS;
|
return M64ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user