From f42357bb39831abbcee6e23b9e9382f6b39c5127 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Sun, 21 Sep 2014 12:54:13 +0700 Subject: [PATCH] Fix posix compilation errors --- CMakeLists.txt | 1 - GLideN64.vcxproj | 4 --- GLideN64.vcxproj.filters | 3 --- ZilmarGFX_1_3.h | 4 +++ mupenplus/GLideN64_mupenplus.cpp | 19 -------------- mupenplus/MupenPlusAPIImpl.cpp | 20 ++++++++++++++- posix/CommonAPIImpl_posix.cpp | 5 ++-- posix/Config.cpp | 43 ++++++++++++++++---------------- posix/MicrocodeDialog.cpp | 7 ++++++ posix/OpenGL_posix.cpp | 3 +++ posix/ZilmarAPIImpl_posix.cpp | 1 + 11 files changed, 58 insertions(+), 52 deletions(-) delete mode 100644 mupenplus/GLideN64_mupenplus.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f04c15e..dfbb21ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,6 @@ if(MUPENPLUSAPI) MupenPlusPluginAPI.cpp mupenplus/Config.cpp mupenplus/CommonAPIImpl_mupenplus.cpp - mupenplus/GLideN64_mupenplus.cpp mupenplus/MicrocodeDialog.cpp mupenplus/MupenPlusAPIImpl.cpp mupenplus/OpenGL_mupenplus.cpp diff --git a/GLideN64.vcxproj b/GLideN64.vcxproj index 7aead5f2..1f34bee9 100644 --- a/GLideN64.vcxproj +++ b/GLideN64.vcxproj @@ -266,10 +266,6 @@ true true - - true - true - true true diff --git a/GLideN64.vcxproj.filters b/GLideN64.vcxproj.filters index c1a4df66..473148a3 100644 --- a/GLideN64.vcxproj.filters +++ b/GLideN64.vcxproj.filters @@ -144,9 +144,6 @@ Source Files\mupenplus - - Source Files\mupenplus - Source Files\mupenplus diff --git a/ZilmarGFX_1_3.h b/ZilmarGFX_1_3.h index 4faabf0a..dfb7ba2b 100644 --- a/ZilmarGFX_1_3.h +++ b/ZilmarGFX_1_3.h @@ -27,7 +27,11 @@ extern "C" { #define PLUGIN_TYPE_GFX 2 #define EXPORT __declspec(dllexport) +#ifdef _WINDOWS #define CALL __cdecl +#else +#define CALL _cdecl +#endif /***** Structures *****/ typedef struct { diff --git a/mupenplus/GLideN64_mupenplus.cpp b/mupenplus/GLideN64_mupenplus.cpp deleted file mode 100644 index e8c743a3..00000000 --- a/mupenplus/GLideN64_mupenplus.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "GLideN64_MupenPlus.h" - -ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = NULL; -ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = NULL; - -/* definitions of pointers to Core video extension functions */ -ptr_VidExt_Init CoreVideo_Init = NULL; -ptr_VidExt_Quit CoreVideo_Quit = NULL; -ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes = NULL; -ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = NULL; -ptr_VidExt_SetCaption CoreVideo_SetCaption = NULL; -ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen = NULL; -ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = NULL; -ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress = NULL; -ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = NULL; -ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = NULL; -ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = NULL; - -void (*renderCallback)() = NULL; diff --git a/mupenplus/MupenPlusAPIImpl.cpp b/mupenplus/MupenPlusAPIImpl.cpp index fa1765eb..23b61e1d 100644 --- a/mupenplus/MupenPlusAPIImpl.cpp +++ b/mupenplus/MupenPlusAPIImpl.cpp @@ -1,4 +1,4 @@ -#include "GLideN64_MupenPlus.h" +#include "GLideN64_mupenplus.h" #include "../PluginAPI.h" #include "../GLideN64.h" #include "../OpenGL.h" @@ -9,6 +9,24 @@ #define DLSYM(a, b) dlsym(a, b) #endif // _WINDOWS +ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = NULL; +ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = NULL; + +/* definitions of pointers to Core video extension functions */ +ptr_VidExt_Init CoreVideo_Init = NULL; +ptr_VidExt_Quit CoreVideo_Quit = NULL; +ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes = NULL; +ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = NULL; +ptr_VidExt_SetCaption CoreVideo_SetCaption = NULL; +ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen = NULL; +ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = NULL; +ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress = NULL; +ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = NULL; +ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = NULL; +ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = NULL; + +void (*renderCallback)() = NULL; + m64p_error PluginAPI::PluginStartup(m64p_dynlib_handle _CoreLibHandle) { ConfigGetSharedDataFilepath = (ptr_ConfigGetSharedDataFilepath) DLSYM(_CoreLibHandle, "ConfigGetSharedDataFilepath"); diff --git a/posix/CommonAPIImpl_posix.cpp b/posix/CommonAPIImpl_posix.cpp index be5fe578..e20b2574 100644 --- a/posix/CommonAPIImpl_posix.cpp +++ b/posix/CommonAPIImpl_posix.cpp @@ -1,8 +1,9 @@ -#include "../CommonPluginAPI.h" +#include "../winlnxdefs.h" +#include "../PluginAPI.h" #include "../OpenGL.h" #include "../Config.h" -int CommonPluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo) +int PluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo) { _initiateGFX(_gfxInfo); diff --git a/posix/Config.cpp b/posix/Config.cpp index 5c77dcf1..6b4db345 100644 --- a/posix/Config.cpp +++ b/posix/Config.cpp @@ -1,21 +1,21 @@ -#include "winlnxdefs.h" -#include +#include "../winlnxdefs.h" +//#include #include #include #include -#include "Config.h" -#include "GLideN64.h" -#include "RSP.h" -#include "Textures.h" -#include "OpenGL.h" +#include "../Config.h" +#include "../GLideN64.h" +#include "../RSP.h" +#include "../Textures.h" +#include "../OpenGL.h" Config config; static GtkWidget *configWindow = NULL; //static GtkWidget *bitdepthCombo[2], *resolutionCombo[2]; static GtkWidget *resolutionCombo; -static GtkWidget *enable2xSAICheck, *forceBilinearCheck, *enableFogCheck; +static GtkWidget *depthWriteCheck, *forceBilinearCheck, *enableFogCheck; static GtkWidget *enableHardwareFBCheck, *enableHardwareLighting; static GtkWidget *textureDepthCombo; static GtkWidget *textureCacheEntry; @@ -76,7 +76,7 @@ static void okButton_clicked( GtkWidget *widget, void *data ) config.video.fullscreenHeight = config.video.windowedHeight = i2; config.texture.forceBilinear = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(forceBilinearCheck) ); - config.texture.enable2xSaI = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enable2xSAICheck) ); + config.frameBufferEmulation.copyDepthToRDRAM = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(depthWriteCheck) ); config.enableFog = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableFogCheck) ); config.frameBufferEmulation.enable = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck) ); config.enableHWLighting = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareLighting) ); @@ -87,7 +87,7 @@ static void okButton_clicked( GtkWidget *widget, void *data ) if (!strcmp( depth, textureBitDepth[i] )) config.texture.textureBitDepth = i; } - cache.maxBytes = atoi( gtk_entry_get_text( GTK_ENTRY(textureCacheEntry) ) ) * 1048576; + config.texture.maxBytes = atoi( gtk_entry_get_text( GTK_ENTRY(textureCacheEntry) ) ) * 1048576; // write configuration if (pluginDir == 0) @@ -111,12 +111,12 @@ static void okButton_clicked( GtkWidget *widget, void *data ) /* fprintf( f, "width=%d\n", OGL.width ); fprintf( f, "height=%d\n", OGL.height );*/ fprintf( f, "force bilinear=%d\n", config.texture.forceBilinear ); - fprintf( f, "enable 2xSAI=%d\n", config.texture.enable2xSaI ); + fprintf( f, "enable depth buffer write=%d\n", config.frameBufferEmulation.copyDepthToRDRAM ); fprintf( f, "enable fog=%d\n", config.enableFog ); fprintf( f, "enable HardwareFB=%d\n", config.frameBufferEmulation.enable ); fprintf( f, "enable hardware lighting=%d\n", config.enableHWLighting ); fprintf( f, "texture depth=%d\n", config.texture.textureBitDepth ); - fprintf( f, "cache size=%d\n", cache.maxBytes / 1048576 ); + fprintf( f, "cache size=%d\n", config.texture.maxBytes / 1048576 ); fclose( f ); @@ -149,7 +149,7 @@ static void configWindow_show( GtkWidget *widget, void *data ) sprintf( text, "%d x %d", config.video.windowedWidth, config.video.windowedHeight ); gtk_entry_set_text( GTK_ENTRY(GTK_COMBO(resolutionCombo)->entry), text ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enable2xSAICheck), (config.texture.enable2xSaI) ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(depthWriteCheck), (config.frameBufferEmulation.copyDepthToRDRAM) ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(forceBilinearCheck), (config.texture.forceBilinear) ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableFogCheck), (config.enableFog) ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareLighting), (config.enableHWLighting) ); @@ -157,7 +157,7 @@ static void configWindow_show( GtkWidget *widget, void *data ) // textures gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck), (config.frameBufferEmulation.enable) ); gtk_entry_set_text( GTK_ENTRY(GTK_COMBO(textureDepthCombo)->entry), textureBitDepth[config.texture.textureBitDepth] ); - sprintf( text, "%d", cache.maxBytes / 1048576 ); + sprintf( text, "%d", config.texture.maxBytes / 1048576 ); gtk_entry_set_text( GTK_ENTRY(textureCacheEntry), text ); } @@ -270,7 +270,7 @@ static int Config_CreateWindow() gtk_combo_set_value_in_list( GTK_COMBO(resolutionCombo), TRUE, FALSE ); gtk_combo_set_popdown_strings( GTK_COMBO(resolutionCombo), resolutionList ); - enable2xSAICheck = gtk_check_button_new_with_label( "Enable 2xSAI texture scaling" ); + depthWriteCheck = gtk_check_button_new_with_label( "Enable depth buffer writes" ); forceBilinearCheck = gtk_check_button_new_with_label( "Force bilinear filtering" ); enableFogCheck = gtk_check_button_new_with_label( "Enable fog" ); enableHardwareLighting = gtk_check_button_new_with_label( "Enable hardware lighting" ); @@ -301,7 +301,7 @@ static int Config_CreateWindow() gtk_table_attach_defaults( GTK_TABLE(displayTable), forceBilinearCheck, 1, 2, 3, 4 ); // row 4 - gtk_table_attach_defaults( GTK_TABLE(displayTable), enable2xSAICheck, 0, 1, 4, 5 ); + gtk_table_attach_defaults( GTK_TABLE(displayTable), depthWriteCheck, 0, 1, 4, 5 ); gtk_table_attach_defaults( GTK_TABLE(displayTable), enableHardwareLighting, 1, 2, 4, 5 ); // textures frame @@ -371,12 +371,12 @@ void Config_LoadConfig() config.video.windowedHeight = 480; // OGL.windowedBits = 0; config.texture.forceBilinear = 0; - config.texture.enable2xSaI = 0; + config.frameBufferEmulation.copyDepthToRDRAM = 0; config.enableFog = 1; config.texture.textureBitDepth = 1; // normal (16 & 32 bits) config.frameBufferEmulation.enable = 0; config.enableHWLighting = 0; - cache.maxBytes = 32 * 1048576; + config.texture.maxBytes = 32 * 1048576; // read configuration char filename[PATH_MAX]; @@ -436,9 +436,9 @@ void Config_LoadConfig() { config.texture.forceBilinear = atoi( val ); } - else if (!strcasecmp( line, "enable 2xSAI" )) + else if (!strcasecmp( line, "enable depth buffer write" )) { - config.texture.enable2xSaI = atoi( val ); + config.frameBufferEmulation.copyDepthToRDRAM = atoi( val ); } else if (!strcasecmp( line, "enable fog" )) { @@ -446,7 +446,7 @@ void Config_LoadConfig() } else if (!strcasecmp( line, "cache size" )) { - cache.maxBytes = atoi( val ) * 1048576; + config.texture.maxBytes = atoi( val ) * 1048576; } else if (!strcasecmp( line, "enable HardwareFB" )) { @@ -470,7 +470,6 @@ void Config_LoadConfig() // manually set frame bufer emulation options config.frameBufferEmulation.copyToRDRAM = FALSE; - config.frameBufferEmulation.copyDepthToRDRAM = FALSE; config.frameBufferEmulation.copyFromRDRAM = FALSE; config.frameBufferEmulation.ignoreCFB = TRUE; config.frameBufferEmulation.N64DepthCompare = FALSE; diff --git a/posix/MicrocodeDialog.cpp b/posix/MicrocodeDialog.cpp index d6203521..8a069d91 100644 --- a/posix/MicrocodeDialog.cpp +++ b/posix/MicrocodeDialog.cpp @@ -1,10 +1,17 @@ #include #include +#include "../winlnxdefs.h" +#include "../GLideN64.h" +#include "../GBI.h" static int selectedMicrocode = -1; static GtkWidget *microcodeWindow = 0; static GtkWidget *microcodeList = 0; +static const int numMicrocodeTypes = 11; +static unsigned int uc_crc; +static const char * uc_str; + static void okButton_clicked( GtkWidget *widget, void *data ) { gtk_widget_hide( microcodeWindow ); diff --git a/posix/OpenGL_posix.cpp b/posix/OpenGL_posix.cpp index ba202831..0da96ec4 100644 --- a/posix/OpenGL_posix.cpp +++ b/posix/OpenGL_posix.cpp @@ -1,4 +1,7 @@ +#include "../winlnxdefs.h" +#include "../GLideN64.h" #include "../OpenGL.h" +#include "../Config.h" void OGL_InitGLFunctions() { diff --git a/posix/ZilmarAPIImpl_posix.cpp b/posix/ZilmarAPIImpl_posix.cpp index b3fd0bbc..ebdf438a 100644 --- a/posix/ZilmarAPIImpl_posix.cpp +++ b/posix/ZilmarAPIImpl_posix.cpp @@ -1,3 +1,4 @@ +#include "../winlnxdefs.h" #include "../PluginAPI.h" #include "../GLideN64.h" #include "../OpenGL.h"