From 7d5dbc64fc17ca14a1e1cc544b6fee222bc899d7 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Fri, 30 Jul 2010 09:52:34 +0000 Subject: [PATCH] zzogl-pg: More minor changes to the Liux config code. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3581 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/zzogl-pg/opengl/Linux/Conf.cpp | 83 +++++++------------------ plugins/zzogl-pg/opengl/Linux/Linux.cpp | 5 +- plugins/zzogl-pg/opengl/Util.h | 31 +++++++++ plugins/zzogl-pg/opengl/ZZoglShoots.cpp | 2 +- 4 files changed, 60 insertions(+), 61 deletions(-) diff --git a/plugins/zzogl-pg/opengl/Linux/Conf.cpp b/plugins/zzogl-pg/opengl/Linux/Conf.cpp index 6cbb31129a..de4a1e7ce7 100644 --- a/plugins/zzogl-pg/opengl/Linux/Conf.cpp +++ b/plugins/zzogl-pg/opengl/Linux/Conf.cpp @@ -33,23 +33,22 @@ void SaveConfig() if (f == NULL) { - printf("failed to open %s\n", iniFile.c_str()); + ZZLog::Error_Log("Failed to open '%s'", iniFile.c_str()); return; } fprintf(f, "interlace = %hhx\n", conf.interlace); fprintf(f, "mrtdepth = %hhx\n", conf.mrtdepth); - fprintf(f, "zzoptions = %x\n", conf.zz_options._u32); //u32 - fprintf(f, "options = %x\n", tempHacks); //u32 + fprintf(f, "zzoptions = %x\n", conf.zz_options._u32); + fprintf(f, "options = %x\n", tempHacks); fprintf(f, "bilinear = %hhx\n", conf.bilinear); fprintf(f, "aliasing = %hhx\n", conf.aa); - //fprintf(f, "gamesettings = %x\n", conf.def_hacks); //u32 - fprintf(f, "width = %x\n", conf.width); //u32 - fprintf(f, "height = %x\n", conf.height); //u32 - fprintf(f, "x = %x\n", conf.x); //u32 - fprintf(f, "y = %x\n", conf.y); //u32 - fprintf(f, "log = %x\n", conf.log); //u32 + fprintf(f, "width = %x\n", conf.width); + fprintf(f, "height = %x\n", conf.height); + fprintf(f, "x = %x\n", conf.x); + fprintf(f, "y = %x\n", conf.y); + fprintf(f, "log = %x\n", conf.log); fclose(f); } @@ -59,14 +58,7 @@ void LoadConfig() memset(&conf, 0, sizeof(conf)); conf.interlace = 0; // on, mode 1 conf.mrtdepth = 1; - conf.zz_options._u32 = 0; - conf.hacks._u32 = 0; conf.bilinear = 1; - conf.width = 640; - conf.height = 480; - conf.x = 0; - conf.y = 0; - conf.aa = 0; conf.log = 1; const std::string iniFile(s_strIniPath + "zzogl-pg.ini"); @@ -74,7 +66,7 @@ void LoadConfig() if (f == NULL) { - printf("failed to open %s\n", iniFile.c_str()); + ZZLog::Error_Log("Failed to open '%s'", iniFile.c_str()); SaveConfig();//save and return return; } @@ -82,60 +74,33 @@ void LoadConfig() err = fscanf(f, "interlace = %hhx\n", &conf.interlace); err = fscanf(f, "mrtdepth = %hhx\n", &conf.mrtdepth); - err = fscanf(f, "zzoptions = %x\n", &conf.zz_options._u32);//u32 - err = fscanf(f, "options = %x\n", &conf.hacks._u32);//u32 + err = fscanf(f, "zzoptions = %x\n", &conf.zz_options._u32); + err = fscanf(f, "options = %x\n", &conf.hacks._u32); err = fscanf(f, "bilinear = %hhx\n", &conf.bilinear); err = fscanf(f, "aliasing = %hhx\n", &conf.aa); - //err = fscanf(f, "gamesettings = %x\n", &conf.gamesettings);//u32 - err = fscanf(f, "width = %x\n", &conf.width);//u32 - err = fscanf(f, "height = %x\n", &conf.height);//u32 - err = fscanf(f, "x = %x\n", &conf.x);//u32 - err = fscanf(f, "y = %x\n", &conf.y);//u32 - err = fscanf(f, "log = %x\n", &conf.log);//u32 + err = fscanf(f, "width = %x\n", &conf.width); + err = fscanf(f, "height = %x\n", &conf.height); + err = fscanf(f, "x = %x\n", &conf.x); + err = fscanf(f, "y = %x\n", &conf.y); + err = fscanf(f, "log = %x\n", &conf.log); fclose(f); - // filter bad files - - if (conf.aa > 4) conf.aa = 0; - - conf.isWideScreen = conf.widescreen(); - - switch (conf.zz_options.dimensions) - { - - case GSDim_640: - conf.width = 640; - conf.height = conf.isWideScreen ? 360 : 480; - break; - - case GSDim_800: - conf.width = 800; - conf.height = conf.isWideScreen ? 450 : 600; - break; - - case GSDim_1024: - conf.width = 1024; - conf.height = conf.isWideScreen ? 576 : 768; - break; - - case GSDim_1280: - conf.width = 1280; - conf.height = conf.isWideScreen ? 720 : 960; - break; - } - // turn off all hacks by default conf.setWireframe(false); conf.setCaptureAvi(false); conf.setLoaded(true); - + + conf.isWideScreen = conf.widescreen(); + + // filter bad files + if (conf.interlace > 2) conf.interlace = 0; + if (conf.aa > 4) conf.aa = 0; if (conf.width <= 0 || conf.height <= 0) { - conf.width = 640; - conf.height = 480; + conf.set_dimensions(conf.zz_options.dimensions); } - if (conf.x <= 0 || conf.y <= 0) + if (conf.x < 0 || conf.y < 0) { conf.x = 0; conf.y = 0; diff --git a/plugins/zzogl-pg/opengl/Linux/Linux.cpp b/plugins/zzogl-pg/opengl/Linux/Linux.cpp index 8081d8a9ca..2e3ea2acab 100644 --- a/plugins/zzogl-pg/opengl/Linux/Linux.cpp +++ b/plugins/zzogl-pg/opengl/Linux/Linux.cpp @@ -353,7 +353,9 @@ void DisplayDialog() conf.negaa = 0; if (gtk_combo_box_get_active(GTK_COMBO_BOX(size_box)) != -1) + { fake_options.dimensions = gtk_combo_box_get_active(GTK_COMBO_BOX(size_box)); + } conf.log = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_check)); @@ -364,8 +366,9 @@ void DisplayDialog() fake_options.fullscreen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fullscreen_check)); fake_options.widescreen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widescreen_check)); fake_options.tga_snap = gtk_combo_box_get_active(GTK_COMBO_BOX(snap_box)); - + conf.zz_options = fake_options; + conf.set_dimensions(fake_options.dimensions); SaveConfig(); } diff --git a/plugins/zzogl-pg/opengl/Util.h b/plugins/zzogl-pg/opengl/Util.h index 691e4aaf64..3e8f57deb2 100644 --- a/plugins/zzogl-pg/opengl/Util.h +++ b/plugins/zzogl-pg/opengl/Util.h @@ -245,6 +245,37 @@ typedef struct { zz_options.loaded = (flag) ? 1 : 0; } + void set_dimensions(u32 dim) + { + switch (dim) + { + + case GSDim_640: + width = 640; + height = isWideScreen ? 360 : 480; + break; + + case GSDim_800: + width = 800; + height = isWideScreen ? 450 : 600; + break; + + case GSDim_1024: + width = 1024; + height = isWideScreen ? 576 : 768; + break; + + case GSDim_1280: + width = 1280; + height = isWideScreen ? 720 : 960; + break; + + default: + width = 640; + height = 480; + break; + } + } } GSconf; extern GSconf conf; diff --git a/plugins/zzogl-pg/opengl/ZZoglShoots.cpp b/plugins/zzogl-pg/opengl/ZZoglShoots.cpp index 1bfee36060..291bdf7886 100644 --- a/plugins/zzogl-pg/opengl/ZZoglShoots.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglShoots.cpp @@ -313,7 +313,7 @@ bool ZeroGS::SaveTGA(const char* filename, int width, int height, void* pdata) } // AVI capture stuff -// AVI start -- set needed glabal variables +// AVI start -- set needed global variables void ZeroGS::StartCapture() { if (conf.captureAvi()) return;