From f1a252a6d0a7e522fa531885ec1915a6f5a93ab1 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Fri, 17 Apr 2015 21:03:38 +0600 Subject: [PATCH] Remove posix related code. It is unused legacy code. --- CMakeLists.txt | 21 +- posix/CommonAPIImpl_posix.cpp | 13 - posix/Config_posix.cpp | 455 ---------------------------------- posix/OpenGL_posix.cpp | 146 ----------- posix/ZilmarAPIImpl_posix.cpp | 9 - 5 files changed, 3 insertions(+), 641 deletions(-) delete mode 100644 posix/CommonAPIImpl_posix.cpp delete mode 100644 posix/Config_posix.cpp delete mode 100644 posix/OpenGL_posix.cpp delete mode 100644 posix/ZilmarAPIImpl_posix.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index ad045017..87aa9f4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,9 @@ if(MUPENPLUSAPI) ) set(GLideN64_DLL_NAME mupen64plus-video-GLideN64) else(MUPENPLUSAPI) + if(NOT UNIX) + message(ERROR "UNIX build requires MUPENPLUSAPI!") + endif(NOT UNIX) set(GLideN64_SOURCES_WIN ZilmarPluginAPI.cpp common/ZilmarAPIImpl_common.cpp @@ -71,14 +74,6 @@ else(MUPENPLUSAPI) windows/OpenGL_windows.cpp windows/ZilmarAPIImpl_windows.cpp ) - set(GLideN64_SOURCES_UNIX - ZilmarPluginAPI.cpp - common/ZilmarAPIImpl_common.cpp - posix/Config_posix.cpp - posix/CommonAPIImpl_posix.cpp - posix/OpenGL_posix.cpp - posix/ZilmarAPIImpl_posix.cpp - ) set(GLideN64_DLL_NAME GLideN64) endif(MUPENPLUSAPI) @@ -96,16 +91,6 @@ if(UNIX) -DOS_LINUX ) endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if( NOT MUPENPLUSAPI) - add_definitions( - -D_DEBUG - ) - find_package(PkgConfig) - pkg_check_modules(GLIB REQUIRED glib-2.0) - include_directories(${GLIB_INCLUDE_DIRS}) - find_package(GTK2 REQUIRED) - include_directories(${GTK2_INCLUDE_DIRS}) - endif( NOT MUPENPLUSAPI) endif(UNIX) if(WIN32) diff --git a/posix/CommonAPIImpl_posix.cpp b/posix/CommonAPIImpl_posix.cpp deleted file mode 100644 index 5a0e8f20..00000000 --- a/posix/CommonAPIImpl_posix.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "../winlnxdefs.h" -#include "../PluginAPI.h" -#include "../OpenGL.h" -#include "../Config.h" - -int PluginAPI::InitiateGFX(const GFX_INFO & _gfxInfo) -{ - _initiateGFX(_gfxInfo); - - Config_LoadConfig(); - - return TRUE; -} diff --git a/posix/Config_posix.cpp b/posix/Config_posix.cpp deleted file mode 100644 index 22ff63b0..00000000 --- a/posix/Config_posix.cpp +++ /dev/null @@ -1,455 +0,0 @@ -#include "../winlnxdefs.h" -//#include -#include -#include -#include - -#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 *depthWriteCheck, *forceBilinearCheck, *enableFogCheck; -static GtkWidget *enableHardwareFBCheck, *enableHardwareLighting; -static GtkWidget *textureDepthCombo; -static GtkWidget *textureCacheEntry; -static const char *pluginDir = 0; - -static void okButton_clicked( GtkWidget *widget, void *data ) -{ - const char *text; - int i, i1, i2; - FILE *f; - - gtk_widget_hide( configWindow ); - - // apply configuration -/* text = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(resolutionCombo[0])->entry) ); - if (sscanf( text, "%d x %d", &i1, &i2 ) != 2) - { - i1 = 640; - i2 = 480; - } - OGL.fullscreenWidth = i1; - OGL.fullscreenHeight = i2; - - text = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(bitdepthCombo[0])->entry) ); - if (sscanf( text, "%d Bit", &i1 ) != 1) - i1 = 0; - OGL.fullscreenBits = i1; - - text = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(resolutionCombo[1])->entry) ); - if (sscanf( text, "%d x %d", &i1, &i2 ) != 2) - { - i1 = 640; - i2 = 480; - } - OGL.windowedWidth = i1; - OGL.windowedHeight = i2; - - text = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(bitdepthCombo[1])->entry) ); - if (sscanf( text, "%d Bit", &i1 ) != 1) - i1 = 0; - OGL.windowedBits = i1;*/ - - text = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(resolutionCombo)->entry) ); - if (sscanf( text, "%d x %d", &i1, &i2 ) != 2) - { - i1 = 640; - i2 = 480; - } - config.video.fullscreenWidth = config.video.windowedWidth = i1; - config.video.fullscreenHeight = config.video.windowedHeight = i2; - - config.texture.forceBilinear = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(forceBilinearCheck) ); - config.frameBufferEmulation.copyDepthToRDRAM = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(depthWriteCheck) ); - config.generalEmulation.enableFog = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableFogCheck) ); - config.frameBufferEmulation.enable = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck) ); - config.generalEmulation.enableHWLighting = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareLighting) ); - const char *depth = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(textureDepthCombo)->entry) ); - config.texture.maxBytes = atoi( gtk_entry_get_text( GTK_ENTRY(textureCacheEntry) ) ) * 1048576; - - // write configuration - if (pluginDir == 0) - pluginDir = GetPluginDir(); - - char filename[PATH_MAX]; - snprintf( filename, PATH_MAX, "%s/glN64.conf", pluginDir ); - f = fopen( filename, "w" ); - if (!f) - { - fprintf( stderr, "[glN64]: (EE) Couldn't save config file '%s': %s\n", filename, strerror( errno ) ); - return; - } - -/* fprintf( f, "fullscreen width=%d\n", OGL.fullscreenWidth ); - fprintf( f, "fullscreen height=%d\n", OGL.fullscreenHeight ); - fprintf( f, "fullscreen depth=%d\n", OGL.fullscreenBits );*/ - fprintf( f, "width=%d\n", config.video.windowedWidth ); - fprintf( f, "height=%d\n", config.video.windowedHeight ); -// fprintf( f, "windowed depth=%d\n", OGL.windowedBits );*/ -/* 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 depth buffer write=%d\n", config.frameBufferEmulation.copyDepthToRDRAM ); - fprintf( f, "enable fog=%d\n", config.generalEmulation.enableFog ); - fprintf( f, "enable HardwareFB=%d\n", config.frameBufferEmulation.enable ); - fprintf( f, "enable hardware lighting=%d\n", config.generalEmulation.enableHWLighting ); - fprintf( f, "cache size=%d\n", config.texture.maxBytes / 1048576 ); - - fclose( f ); - -} - -static void cancelButton_clicked( GtkWidget *widget, void *data ) -{ - gtk_widget_hide( configWindow ); -} - -static void configWindow_show( GtkWidget *widget, void *data ) -{ - static char text[300]; - - // display -/* gtk_entry_set_text( GTK_ENTRY(GTK_COMBO(bitdepthCombo[0])->entry), - (OGL.fullscreenBits == 32) ? "32 Bit" : - ((OGL.fullscreenBits == 16) ? "16 Bit" : - "Desktop") ); - sprintf( text, "%d x %d", OGL.fullscreenWidth, OGL.fullscreenHeight ); - gtk_entry_set_text( GTK_ENTRY(GTK_COMBO(resolutionCombo[0])->entry), text ); - - gtk_entry_set_text( GTK_ENTRY(GTK_COMBO(bitdepthCombo[1])->entry), - (OGL.windowedBits == 32) ? "32 Bit" : - ((OGL.windowedBits == 16) ? "16 Bit" : - "Desktop") ); - sprintf( text, "%d x %d", OGL.windowedWidth, OGL.windowedHeight ); - gtk_entry_set_text( GTK_ENTRY(GTK_COMBO(resolutionCombo[1])->entry), text );*/ - - 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(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.generalEmulation.enableFog) ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareLighting), (config.generalEmulation.enableHWLighting) ); - - // textures - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck), (config.frameBufferEmulation.enable) ); - sprintf( text, "%d", config.texture.maxBytes / 1048576 ); - gtk_entry_set_text( GTK_ENTRY(textureCacheEntry), text ); -} - -static int Config_CreateWindow() -{ - GtkWidget *okButton, *cancelButton; - GtkWidget *displayFrame, *texturesFrame; - GtkWidget *displayTable, *texturesTable; -// GtkWidget *fullscreenModeLabel, *windowedModeLabel; - GtkWidget *videoModeLabel; -// GtkWidget *bitdepthLabel, *resolutionLabel; - GtkWidget *resolutionLabel; - GtkWidget *textureDepthLabel; - GtkWidget *textureCacheLabel; - GList *resolutionList = NULL, *textureDepthList = NULL; - SDL_Rect **modes; - static char modeBuf[20][20]; - - int i; - - // create dialog - configWindow = gtk_dialog_new(); - gtk_signal_connect_object( GTK_OBJECT(configWindow), "delete-event", - GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), GTK_OBJECT(configWindow) ); - gtk_signal_connect_object( GTK_OBJECT(configWindow), "show", - GTK_SIGNAL_FUNC(configWindow_show), NULL ); - gtk_window_set_title( GTK_WINDOW(configWindow), pluginName ); - - // ok button - okButton = gtk_button_new_with_label( "Ok" ); - gtk_signal_connect_object( GTK_OBJECT(okButton), "clicked", - GTK_SIGNAL_FUNC(okButton_clicked), NULL ); - gtk_container_add( GTK_CONTAINER(GTK_DIALOG(configWindow)->action_area), okButton ); - - // cancel button - cancelButton = gtk_button_new_with_label( "Cancel" ); - gtk_signal_connect_object( GTK_OBJECT(cancelButton), "clicked", - GTK_SIGNAL_FUNC(cancelButton_clicked), NULL ); - gtk_container_add( GTK_CONTAINER(GTK_DIALOG(configWindow)->action_area), cancelButton ); - - // display frame - displayFrame = gtk_frame_new( "Display" ); - gtk_container_set_border_width( GTK_CONTAINER(displayFrame), 7 ); - gtk_container_add( GTK_CONTAINER(GTK_DIALOG(configWindow)->vbox), displayFrame ); - - displayTable = gtk_table_new( 5, 3, FALSE ); - gtk_container_set_border_width( GTK_CONTAINER(displayTable), 7 ); - gtk_table_set_col_spacings( GTK_TABLE(displayTable), 3 ); - gtk_table_set_row_spacings( GTK_TABLE(displayTable), 3 ); - gtk_container_add( GTK_CONTAINER(displayFrame), displayTable ); - -/* fullscreenModeLabel = gtk_label_new( "Fullscreen mode" ); - windowedModeLabel = gtk_label_new( "Windowed mode" ); - bitdepthLabel = gtk_label_new( "Bit depth" );*/ - videoModeLabel = gtk_label_new( "Video mode" ); - resolutionLabel = gtk_label_new( "Resolution" ); - -/* for (i = 0; i < 2; i++) - { - static GList *bitdepthList = NULL; - if (!bitdepthList) - { - bitdepthList = g_list_append( bitdepthList, "Desktop" ); - bitdepthList = g_list_append( bitdepthList, "16 bit" ); - bitdepthList = g_list_append( bitdepthList, "32 bit" ); - } - - bitdepthCombo[i] = gtk_combo_new(); - gtk_combo_set_value_in_list( GTK_COMBO(bitdepthCombo[i]), TRUE, FALSE ); - gtk_combo_set_popdown_strings( GTK_COMBO(bitdepthCombo[i]), bitdepthList ); - - resolutionCombo[i] = gtk_combo_new(); - gtk_combo_set_value_in_list( GTK_COMBO(resolutionCombo[i]), TRUE, FALSE ); - }*/ - - // get video mode list -/* modes = SDL_ListModes( NULL, SDL_HWSURFACE );//SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_HWPALETTE | SDL_HWSURFACE | SDL_HWACCEL ); - - if (modes == (SDL_Rect **)0) - { - printf( "glNintendo64: No modes available!\n" ); - } - else if (modes == (SDL_Rect **)-1) - { - printf( "glNintendo64: All resolutions available.\n" ); - } - else - { - char buf[200]; - for (i = 0; modes[i]; i++)// ++i) - { - sprintf( modeBuf[i], "%d x %d", modes[i]->w, modes[i]->h ); - resolutionList = g_list_append( resolutionList, modeBuf[i] ); - } - }*/ - resolutionList = g_list_append( resolutionList, (void *)"320 x 240" ); - resolutionList = g_list_append( resolutionList, (void *)"400 x 300" ); - resolutionList = g_list_append( resolutionList, (void *)"480 x 360" ); - resolutionList = g_list_append( resolutionList, (void *)"640 x 480" ); - resolutionList = g_list_append( resolutionList, (void *)"800 x 600" ); - resolutionList = g_list_append( resolutionList, (void *)"960 x 720" ); - resolutionList = g_list_append( resolutionList, (void *)"1024 x 768" ); - resolutionList = g_list_append( resolutionList, (void *)"1152 x 864" ); - resolutionList = g_list_append( resolutionList, (void *)"1280 x 960" ); - resolutionList = g_list_append( resolutionList, (void *)"1280 x 1024" ); - resolutionList = g_list_append( resolutionList, (void *)"1440 x 1080" ); - resolutionList = g_list_append( resolutionList, (void *)"1600 x 1200" ); - - resolutionCombo = gtk_combo_new(); - gtk_combo_set_value_in_list( GTK_COMBO(resolutionCombo), TRUE, FALSE ); - gtk_combo_set_popdown_strings( GTK_COMBO(resolutionCombo), resolutionList ); - - 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" ); - -/* // row 0 - gtk_table_attach_defaults( GTK_TABLE(displayTable), bitdepthLabel, 1, 2, 0, 1 ); - gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionLabel, 2, 3, 0, 1 ); - - // row 1 - gtk_table_attach_defaults( GTK_TABLE(displayTable), fullscreenModeLabel, 0, 1, 1, 2 ); - gtk_table_attach_defaults( GTK_TABLE(displayTable), bitdepthCombo[0], 1, 2, 1, 2 ); - gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionCombo[0], 2, 3, 1, 2 ); - - // row 2 - gtk_table_attach_defaults( GTK_TABLE(displayTable), windowedModeLabel, 0, 1, 2, 3 ); - gtk_table_attach_defaults( GTK_TABLE(displayTable), bitdepthCombo[1], 1, 2, 2, 3 ); - gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionCombo[1], 2, 3, 2, 3 ); -*/ - // row 0 - gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionLabel, 2, 3, 0, 1 ); - - // row 1 - gtk_table_attach_defaults( GTK_TABLE(displayTable), videoModeLabel, 0, 1, 1, 2 ); - gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionCombo, 2, 3, 1, 2 ); - - // row 3 - gtk_table_attach_defaults( GTK_TABLE(displayTable), enableFogCheck, 0, 1, 3, 4 ); - gtk_table_attach_defaults( GTK_TABLE(displayTable), forceBilinearCheck, 1, 2, 3, 4 ); - - // row 4 - 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 - texturesFrame = gtk_frame_new( "Textures" ); - gtk_container_set_border_width( GTK_CONTAINER(texturesFrame), 7 ); - gtk_container_add( GTK_CONTAINER(GTK_DIALOG(configWindow)->vbox), texturesFrame ); - - texturesTable = gtk_table_new( 3, 2, FALSE ); - gtk_container_set_border_width( GTK_CONTAINER(texturesTable), 7 ); - gtk_table_set_col_spacings( GTK_TABLE(texturesTable), 3 ); - gtk_table_set_row_spacings( GTK_TABLE(texturesTable), 3 ); - gtk_container_add( GTK_CONTAINER(texturesFrame), texturesTable ); - - textureCacheLabel = gtk_label_new( "Texture cache size (MB)" ); - textureCacheEntry = gtk_entry_new(); - gtk_entry_set_text( GTK_ENTRY(textureCacheEntry), "0" ); - - enableHardwareFBCheck = gtk_check_button_new_with_label( "HW framebuffer textures (experimental)" ); - - // row 0 - gtk_table_attach_defaults( GTK_TABLE(texturesTable), textureDepthLabel, 0, 1, 0, 1 ); - gtk_table_attach_defaults( GTK_TABLE(texturesTable), textureDepthCombo, 1, 2, 0, 1 ); - - // row 1 - gtk_table_attach_defaults( GTK_TABLE(texturesTable), textureCacheLabel, 0, 1, 1, 2 ); - gtk_table_attach_defaults( GTK_TABLE(texturesTable), textureCacheEntry, 1, 2, 1, 2 ); - - // row 2 - gtk_table_attach_defaults( GTK_TABLE(texturesTable), enableHardwareFBCheck, 0, 2, 2, 3 ); - - return 0; -} - -void Config_LoadConfig() -{ - static int loaded = 0; - FILE *f; - char line[2000]; - - if (loaded) - return; - - loaded = 1; - - if (pluginDir == 0) - pluginDir = GetPluginDir(); - - // default configuration - config.video.fullscreenWidth = 640; - config.video.fullscreenHeight = 480; -// OGL.fullscreenBits = 0; - config.video.windowedWidth = 640; - config.video.windowedHeight = 480; -// OGL.windowedBits = 0; - config.texture.forceBilinear = 0; - config.frameBufferEmulation.copyDepthToRDRAM = 0; - config.generalEmulation.enableFog = 1; - config.frameBufferEmulation.enable = 0; - config.generalEmulation.enableHWLighting = 0; - config.texture.maxBytes = 32 * 1048576; - - // read configuration - char filename[PATH_MAX]; - snprintf( filename, PATH_MAX, "%s/glN64.conf", pluginDir ); - f = fopen( filename, "r" ); - if (!f) - { - fprintf( stderr, "[glN64]: (WW) Couldn't open config file '%s' for reading: %s\n", filename, strerror( errno ) ); - return; - } - - while (!feof( f )) - { - char *val; - fgets( line, 2000, f ); - - val = strchr( line, '=' ); - if (!val) - continue; - *val++ = '\0'; - -/* if (!strcasecmp( line, "fullscreen width" )) - { - OGL.fullscreenWidth = atoi( val ); - } - else if (!strcasecmp( line, "fullscreen height" )) - { - OGL.fullscreenHeight = atoi( val ); - } - else if (!strcasecmp( line, "fullscreen depth" )) - { - OGL.fullscreenBits = atoi( val ); - } - else if (!strcasecmp( line, "windowed width" )) - { - OGL.windowedWidth = atoi( val ); - } - else if (!strcasecmp( line, "windowed height" )) - { - OGL.windowedHeight = atoi( val ); - } - else if (!strcasecmp( line, "windowed depth" )) - { - OGL.windowedBits = atoi( val ); - }*/ - if (!strcasecmp( line, "width" )) - { - int w = atoi( val ); - config.video.fullscreenWidth = config.video.windowedWidth = (w == 0) ? (640) : (w); - } - else if (!strcasecmp( line, "height" )) - { - int h = atoi( val ); - config.video.fullscreenHeight = config.video.windowedHeight = (h == 0) ? (480) : (h); - } - else if (!strcasecmp( line, "force bilinear" )) - { - config.texture.forceBilinear = atoi( val ); - } - else if (!strcasecmp( line, "enable depth buffer write" )) - { - config.frameBufferEmulation.copyDepthToRDRAM = atoi( val ); - } - else if (!strcasecmp( line, "enable fog" )) - { - config.generalEmulation.enableFog = atoi( val ); - } - else if (!strcasecmp( line, "cache size" )) - { - config.texture.maxBytes = atoi( val ) * 1048576; - } - else if (!strcasecmp( line, "enable HardwareFB" )) - { - config.frameBufferEmulation.enable = atoi( val ); - } - else if (!strcasecmp( line, "enable hardware lighting" )) - { - config.generalEmulation.enableHWLighting = atoi( val ); - } - else - { - printf( "Unknown config option: %s\n", line ); - } - } - - fclose( f ); - - config.video.aspect = 1; - // manually set frame bufer emulation options - config.frameBufferEmulation.copyToRDRAM = FALSE; - config.frameBufferEmulation.copyFromRDRAM = FALSE; - config.frameBufferEmulation.ignoreCFB = TRUE; - config.frameBufferEmulation.N64DepthCompare = FALSE; - config.generalEmulation.enableLOD = TRUE; - config.generalEmulation.hacks = 0; - config.bloomFilter.mode = 0; -} - -void Config_DoConfig(HWND /*hParent*/) -{ - Config_LoadConfig(); - - if (!configWindow) - Config_CreateWindow(); - - gtk_widget_show_all( configWindow ); -} diff --git a/posix/OpenGL_posix.cpp b/posix/OpenGL_posix.cpp deleted file mode 100644 index ae787a8f..00000000 --- a/posix/OpenGL_posix.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include "../winlnxdefs.h" -#include "../GLideN64.h" -#include "../OpenGL.h" -#include "../Config.h" - -void initGLFunctions() -{ -} - -class OGLVideoPosix : public OGLVideo -{ -public: - OGLVideoPosix() : hScreen(NULL) {} - -private: - virtual bool _start(); - virtual void _stop(); - virtual void _swapBuffers(); - virtual void _saveScreenshot(); - virtual bool _resizeWindow(); - virtual void _changeWindow(); - -#if defined(USE_SDL) - SDL_Surface *hScreen; -#endif -}; - -OGLVideo & OGLVideo::get() -{ - static OGLVideoPosix video; - return video; -} - -bool OGLVideoPosix::_start() -{ -#ifdef USE_SDL - // init sdl & gl - Uint32 videoFlags = 0; - - if (m_bFullscreen) { - m_screenWidth = config.video.fullscreenWidth; - m_screenHeight = config.video.fullscreenHeight; - } else { - m_screenWidth = config.video.windowedWidth; - m_screenHeight = config.video.windowedHeight; - } - _setBufferSize(); - - /* Initialize SDL */ - printf( "[glN64]: (II) Initializing SDL video subsystem...\n" ); - if (SDL_InitSubSystem( SDL_INIT_VIDEO ) == -1) - { - printf( "[glN64]: (EE) Error initializing SDL video subsystem: %s\n", SDL_GetError() ); - return false; - } - - /* Video Info */ - const SDL_VideoInfo *videoInfo; - printf( "[glN64]: (II) Getting video info...\n" ); - if (!(videoInfo = SDL_GetVideoInfo())) - { - printf( "[glN64]: (EE) Video query failed: %s\n", SDL_GetError() ); - SDL_QuitSubSystem( SDL_INIT_VIDEO ); - return false; - } - - /* Set the video mode */ - videoFlags |= SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_HWPALETTE; - - if (videoInfo->hw_available) - videoFlags |= SDL_HWSURFACE; - else - videoFlags |= SDL_SWSURFACE; - - if (videoInfo->blit_hw) - videoFlags |= SDL_HWACCEL; - - SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); -/* SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); - SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); - SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );*/ - SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); // 32 bit z-buffer - - printf("[glN64]: (II) Setting video mode %dx%d...\n", m_screenWidth, m_screenHeight); - if (!(hScreen = SDL_SetVideoMode(m_screenWidth, m_screenHeight, 0, videoFlags))) - { - printf("[glN64]: (EE) Error setting videomode %dx%d: %s\n", m_screenWidth, m_screenHeight, SDL_GetError()); - SDL_QuitSubSystem( SDL_INIT_VIDEO ); - return false; - } - - SDL_WM_SetCaption( pluginName, pluginName ); -#endif // USE_SDL - - return true; -} - -void OGLVideoPosix::_stop() -{ -#if defined(USE_SDL) - SDL_QuitSubSystem( SDL_INIT_VIDEO ); - hScreen = NULL; -#endif // _WINDOWS -} - -void OGLVideoPosix::_swapBuffers() -{ -#if defined(USE_SDL) - static int frames[5] = { 0, 0, 0, 0, 0 }; - static int framesIndex = 0; - static Uint32 lastTicks = 0; - Uint32 ticks = SDL_GetTicks(); - - frames[framesIndex]++; - if (ticks >= (lastTicks + 1000)) - { - char caption[500]; - float fps = 0.0; - for (int i = 0; i < 5; i++) - fps += frames[i]; - fps /= 5.0; - snprintf( caption, 500, "%s - %.2f fps", pluginName, fps ); - SDL_WM_SetCaption( caption, pluginName ); - framesIndex = (framesIndex + 1) % 5; - frames[framesIndex] = 0; - lastTicks = ticks; - } - SDL_GL_SwapBuffers(); -#endif // USE_SDL -} - -void OGLVideoPosix::_saveScreenshot() -{ -} - -bool OGLVideoPosix::_resizeWindow() -{ - return false; -} - -void OGLVideoPosix::_changeWindow() -{ -#if defined(USE_SDL) - SDL_WM_ToggleFullScreen( hScreen ); -#endif -} diff --git a/posix/ZilmarAPIImpl_posix.cpp b/posix/ZilmarAPIImpl_posix.cpp deleted file mode 100644 index 266c71a4..00000000 --- a/posix/ZilmarAPIImpl_posix.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "../winlnxdefs.h" -#include "../PluginAPI.h" -#include "../GLideN64.h" -#include "../OpenGL.h" - -void PluginAPI::DllAbout(HWND _hParent) -{ - puts( "GLideN64 alpha. Based on Orkin's glN64 v0.4" ); -}