From d4a2f0051ab1a43fbf2376ec905319797a1fdc3c Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Sun, 2 Jan 2011 07:55:52 +0000 Subject: - dfsound: quick fix (FF9 music, maybe others as well). - peopsxgl (unix): imported new config utility written by Kivutar, with minor amendments (https://github.com/Kivutar/cfgPeopsMesaGL). git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@61694 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- plugins/dfsound/externals.h | 2 +- plugins/dfsound/spu.c | 7 +- plugins/peopsxgl/Makefile.am | 2 +- plugins/peopsxgl/gpucfg/main.c | 1220 ++++++++++++++----------- plugins/peopsxgl/gpucfg/peopsxgl.ui | 1727 ++++++++++++++++++----------------- 5 files changed, 1616 insertions(+), 1342 deletions(-) (limited to 'plugins') diff --git a/plugins/dfsound/externals.h b/plugins/dfsound/externals.h index 3143c6df..b8a5c43d 100644 --- a/plugins/dfsound/externals.h +++ b/plugins/dfsound/externals.h @@ -276,7 +276,7 @@ extern unsigned long spuAddr; extern int bEndThread; extern int bThreadEnded; extern int bSpuInit; -extern unsigned long dwNewChannel; +extern uint32_t dwNewChannel; extern int SSumR[]; extern int SSumL[]; diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index f6c8ebd5..40e32094 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -109,7 +109,7 @@ static HANDLE hMainThread; static pthread_t thread = (pthread_t)-1; // thread id (linux) #endif -unsigned long dwNewChannel=0; // flags for faster testing, if new channel starts +uint32_t dwNewChannel=0; // flags for faster testing, if new channel starts void (CALLBACK *irqCallback)(void)=0; // func of main emu, called on spu irq void (CALLBACK *cddavCallback)(unsigned short,unsigned short)=0; @@ -596,7 +596,10 @@ static void *MAINThread(void *arg) for(ch=0;ch - -#include -#include -#include +#include #include -#define SETCHECK(winame) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (wndMain,winame)), TRUE) -#define SETEDITVAL(winame,v) sprintf(t,"%d",v);gtk_entry_set_text(GTK_ENTRY(gtk_builder_get_object (wndMain,winame)), t) -#define SETLIST(winame,v) gtk_combo_box_set_active(GTK_COMBO_BOX(gtk_builder_get_object(wndMain,winame)), v) - -static GtkBuilder *wndMain; -void SaveConfig(void); - -int main (int argc, char *argv[]) -{ - GtkWidget *main_win; - GError *error = NULL; - FILE *in;char t[256];int len,val; - char * pB, * p; - - if(argc!=2) return 0; - if(strcmp(argv[1],"CFG")!=0 && strcmp(argv[1],"ABOUT")!=0) - return 0; - - gtk_set_locale (); - gtk_init (&argc, &argv); - - wndMain = gtk_builder_new(); - gtk_builder_set_translation_domain(wndMain, PACKAGE_NAME); - if (!gtk_builder_add_from_file (wndMain, DATADIR "peopsxgl.ui", &error)) - { - g_warning ("Couldn't load builder file: %s", error->message); - g_error_free (error); - return -1; - } - - if (strcmp(argv[1],"ABOUT") == 0) - { - main_win = GTK_WIDGET(gtk_builder_get_object(wndMain, "AboutWnd")); - gtk_widget_show_all (main_win); - gtk_dialog_run(GTK_DIALOG(main_win)); - return 0; - } - - main_win = GTK_WIDGET(gtk_builder_get_object(wndMain, "CfgWnd")); - - in = fopen("gpuPeopsMesaGL.cfg","rb"); - if(in) - { - pB=(char *)malloc(32767); - memset(pB,0,32767); - len = fread(pB, 1, 32767, in); - fclose(in); - } - else pB=0; - - val=640; - if(pB) - { - strcpy(t,"\nResX");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<10) val=10; - } - SETEDITVAL("edtXSize",val); - - val=480; - if(pB) - { - strcpy(t,"\nResY");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<10) val=10; - } - SETEDITVAL("edtYSize",val); - - val=0; - if(pB) - { - strcpy(t,"\nKeepRatio");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkKeepRatio"); - - val=0; - if(pB) - { - strcpy(t,"\nVRamSize");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1024) val=1024; - } - SETEDITVAL("edtMaxTex",val); - - val=0; - if(pB) - { - strcpy(t,"\n15bitMdec");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chk15bitMdec"); - - val=0; - if(pB) - { - strcpy(t,"\nHiResTextures");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>2) val=2; - } - SETLIST("cmbHiresTex",val); - - val=0; - if(pB) - { - strcpy(t,"\nFullScreen");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkFullScreen"); - - val=0; - if(pB) - { - strcpy(t,"\nScanLines");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkScanlines"); - - val=0; - if(pB) - { - strcpy(t,"\nScanLinesBlend");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<-1) val=-1; - if(val>255) val=255; - } - SETEDITVAL("edtScanBlend",val); - - val=1; - if(pB) - { - strcpy(t,"\nFrameTextures");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>3) val=3; - } - SETLIST("cmbFrameTex",val); - - val=0; - if(pB) - { - strcpy(t,"\nFrameAccess");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>4) val=4; - } - SETLIST("cmbFrameAcc",val); - - val=0; - if(pB) - { - strcpy(t,"\nTexFilter");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>6) val=6; - } - SETLIST("cmbFilter",val); - - val=0; - if(pB) - { - strcpy(t,"\nAdvancedBlend");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkABlend"); - - val=0; - if(pB) - { - strcpy(t,"\nDithering");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkDither"); - - val=0; - if(pB) - { - strcpy(t,"\nLineMode");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkLinemode"); - - val=0; - if(pB) - { - strcpy(t,"\nShowFPS");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkShowFPS"); - - val=1; - if(pB) - { - strcpy(t,"\nUseFrameLimit");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkFPSLimit"); - - val=0; - if(pB) - { - strcpy(t,"\nUseFrameSkip");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkFPSSkip"); - - val=2; - if(pB) - { - strcpy(t,"\nFPSDetection");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len)+1; - if(val<1) val=1; - if(val>2) val=2; - } - if(val==2) SETCHECK("rdbLimAuto"); - if(val==1) SETCHECK("rdbLimMan"); - - val=200; - if(pB) - { - strcpy(t,"\nFrameRate");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1000) val=1000; - } - SETEDITVAL("edtFPSlim",val); - - val=2; - if(pB) - { - strcpy(t,"\nOffscreenDrawing");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>4) val=4; - } - SETLIST("cmbOffscreen",val); - - val=1; - if(pB) - { - strcpy(t,"\nOpaquePass");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkOpaque"); - - val=0; - if(pB) - { - strcpy(t,"\nAntiAlias");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkAntiA"); - - val=0; - if(pB) - { - strcpy(t,"\nTexQuality");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>4) val=4; - } - SETLIST("cmbQuality",val); - - val=0; - if(pB) - { - strcpy(t,"\nMaskDetect");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkMaskBit"); - - val=1; - if(pB) - { - strcpy(t,"\nFastMdec");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkFastMdec"); - - val=1; - if(pB) - { - strcpy(t,"\nOGLExtensions");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkExtensions"); - - val=0; - if(pB) - { - strcpy(t,"\nScreenSmoothing");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkBlur"); - - val=0; - if(pB) - { - strcpy(t,"\nUseFixes");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - if(val<0) val=0; - if(val>1) val=1; - } - if(val) SETCHECK("chkGameFixes"); - - val=0; - if(pB) - { - strcpy(t,"\nCfgFixes");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;} - if(p) val=atoi(p+len); - } - - for(len=0;len<18;len++) - { - if(val & (1<'9')) p++; - if(*p==0 || *p=='\n') return; - ps=p; - while((*p>='0' && *p<='9') || *p=='-') p++; - pC=(char *)malloc(32767); - strcpy(pC,p); - strcpy(ps,t); - strcat(pB,pC); - free(pC); - } - else - { - strcat(pB,pE); - strcat(pB," = "); - strcat(pB,t); - strcat(pB,"\n"); - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////// - -#define GETEDITVAL(winame) atoi(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object (wndMain,winame)))) -#define GETCHECK(winame) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (wndMain,winame))) -#define GETLIST(winame) gtk_combo_box_get_active(GTK_COMBO_BOX(gtk_builder_get_object(wndMain,winame))) - -void SaveConfig(void) -{ - FILE *in;int len,val;char * pB;char t[16]; - - pB=(char *)malloc(32767); - memset(pB,0,32767); - - in = fopen("gpuPeopsMesaGL.cfg","rb"); - if(in) - { - len = fread(pB, 1, 32767, in); - fclose(in); - } - - /////////////////////////////////////////////////////////////////////////////// - - val=GETEDITVAL("edtXSize"); - if(val<10) val=10; - SetCfgVal(pB,"\nResX",val); - - val=GETEDITVAL("edtYSize"); - if(val<10) val=10; - SetCfgVal(pB,"\nResY",val); - - val=GETCHECK("chkKeepRatio"); - SetCfgVal(pB,"\nKeepRatio",val); - - val=GETEDITVAL("edtMaxTex"); - if(val<0) val=0; - if(val>1024) val=1024; - SetCfgVal(pB,"\nVRamSize",val); - - val=GETCHECK("chk15bitMdec"); - SetCfgVal(pB,"\n15bitMdec",val); - - val=GETLIST("cmbHiresTex"); - SetCfgVal(pB,"\nHiResTextures",val); - - val=GETCHECK("chkFullScreen"); - SetCfgVal(pB,"\nFullScreen",val); - - val=GETCHECK("chkScanlines"); - SetCfgVal(pB,"\nScanLines",val); - - val=GETEDITVAL("edtScanBlend"); - if(val<-1) val=-1; - if(val>255) val=255; - SetCfgVal(pB,"\nScanLinesBlend",val); - - val=GETLIST("cmbFrameTex"); - SetCfgVal(pB,"\nFrameTextures",val); - - val=GETLIST("cmbFrameAcc"); - SetCfgVal(pB,"\nFrameAccess",val); - - val=GETLIST("cmbFilter"); - SetCfgVal(pB,"\nTexFilter",val); - - val=GETCHECK("chkABlend"); - SetCfgVal(pB,"\nAdvancedBlend",val); +#include "config.h" - val=GETCHECK("chkDither"); - SetCfgVal(pB,"\nDithering",val); +#ifdef ENABLE_NLS +#include +#include +#endif - val=GETCHECK("chkLinemode"); - SetCfgVal(pB,"\nLineMode",val); +// Widgets +GtkWidget *window, + *btnCancel, + *btnSave, + *spinXSize, + *spinYSize, + *chkKeepRatio, + *chkDithering, + *chkFullScreen, + *cbxTexQuality, + *cbxTexFiltering, + *cbxHiResTex, + *spinVRam, + *chkShowFPS, + *chkUseFPSLimit, + *vboxFPSLimit, + *radFPSLimitAuto, + *radFPSLimitManual, + *spinFPSLimit, + *chkUseFrameSkipping, + *cbxOffscreen, + *cbxFBTex, + *cbxFBAccess, + *chkMaskDetect, + *chkOpaquePass, + *chkAdvancedBlend, + *chkScanLines, + *spinScanLinesBlend, + *chkFastMdec, + *chk15bitMdec, + *chkLineMode, + *chkAntiAlias, + *chkOGLExtensions, + *chkScreenSmoothing, + *chkUseGameFixes, + *tblGameFixes, + *chkCfgFix1, + *chkCfgFix2, + *chkCfgFix4, + *chkCfgFix8, + *chkCfgFix16, + *chkCfgFix32, + *chkCfgFix64, + *chkCfgFix128, + *chkCfgFix256, + *chkCfgFix512, + *chkCfgFix1024, + *chkCfgFix2048, + *chkCfgFix4096, + *chkCfgFix8192, + *chkCfgFix16384, + *chkCfgFix32768, + *chkCfgFix65536, + *chkCfgFix131072, + *btnFast, + *btnBeautiful; + +// Save values to the config file +void on_btnSave_clicked( GtkObject *object, gpointer user_data ) { + FILE *out; + out = fopen( "gpuPeopsMesaGL.cfg", "w+" ); + + if ( out != NULL ) { + + // Computes the 'fixes' bitfield + int cfgFixes = 0; + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix1 ) ) ) { cfgFixes |= (1 << 0); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix2 ) ) ) { cfgFixes |= (1 << 1); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix4 ) ) ) { cfgFixes |= (1 << 2); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix8 ) ) ) { cfgFixes |= (1 << 3); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix16 ) ) ) { cfgFixes |= (1 << 4); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix32 ) ) ) { cfgFixes |= (1 << 5); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix64 ) ) ) { cfgFixes |= (1 << 6); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix128 ) ) ) { cfgFixes |= (1 << 7); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix256 ) ) ) { cfgFixes |= (1 << 8); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix512 ) ) ) { cfgFixes |= (1 << 9); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix1024 ) ) ) { cfgFixes |= (1 << 10); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix2048 ) ) ) { cfgFixes |= (1 << 11); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix4096 ) ) ) { cfgFixes |= (1 << 12); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix8192 ) ) ) { cfgFixes |= (1 << 13); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix16384 ) ) ) { cfgFixes |= (1 << 14); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix32768 ) ) ) { cfgFixes |= (1 << 15); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix65536 ) ) ) { cfgFixes |= (1 << 16); } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkCfgFix131072 ) ) ) { cfgFixes |= (1 << 17); } + + // Print data to the config file + fprintf( out, "\nResX = %i", gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( spinXSize ) ) ); + fprintf( out, "\nResY = %i", gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( spinYSize ) ) ); + fprintf( out, "\nKeepRatio = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkKeepRatio ) ) ); + fprintf( out, "\nDithering = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkDithering ) ) ); + fprintf( out, "\nFullScreen = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkFullScreen ) ) ); + fprintf( out, "\nTexQuality = %i", gtk_combo_box_get_active( GTK_COMBO_BOX( cbxTexQuality ) ) ); + fprintf( out, "\nTexFilter = %i", gtk_combo_box_get_active( GTK_COMBO_BOX( cbxTexFiltering ) ) ); + fprintf( out, "\nHiResTextures = %i", gtk_combo_box_get_active( GTK_COMBO_BOX( cbxHiResTex ) ) ); + fprintf( out, "\nVRamSize = %i", gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( spinVRam ) ) ); + fprintf( out, "\nShowFPS = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkShowFPS ) ) ); + fprintf( out, "\nUseFrameLimit = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkUseFPSLimit ) ) ); + fprintf( out, "\nFPSDetection = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radFPSLimitAuto ) ) ); + fprintf( out, "\nFrameRate = %i", gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( spinFPSLimit ) ) ); + fprintf( out, "\nUseFrameSkip = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkUseFrameSkipping ) ) ); + fprintf( out, "\nOffscreenDrawing = %i", gtk_combo_box_get_active( GTK_COMBO_BOX( cbxOffscreen ) ) ); + fprintf( out, "\nFrameTextures = %i", gtk_combo_box_get_active( GTK_COMBO_BOX( cbxFBTex ) ) ); + fprintf( out, "\nFrameAccess = %i", gtk_combo_box_get_active( GTK_COMBO_BOX( cbxFBAccess ) ) ); + fprintf( out, "\nMaskDetect = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkMaskDetect ) ) ); + fprintf( out, "\nOpaquePass = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkOpaquePass ) ) ); + fprintf( out, "\nAdvancedBlend = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkAdvancedBlend ) ) ); + fprintf( out, "\nScanLines = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkScanLines ) ) ); + fprintf( out, "\nScanLinesBlend = %i", gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( spinScanLinesBlend ) ) ); + fprintf( out, "\nFastMdec = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkFastMdec ) ) ); + fprintf( out, "\n15bitMdec = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chk15bitMdec ) ) ); + fprintf( out, "\nLineMode = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkLineMode ) ) ); + fprintf( out, "\nAntiAlias = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkAntiAlias ) ) ); + fprintf( out, "\nOGLExtensions = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkOGLExtensions ) ) ); + fprintf( out, "\nScreenSmoothing = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkScreenSmoothing ) ) ); + fprintf( out, "\nUseFixes = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkUseGameFixes ) ) ); + fprintf( out, "\nCfgFixes = %i", cfgFixes ); + + fclose( out ); + } - val=GETCHECK("chkShowFPS"); - SetCfgVal(pB,"\nShowFPS",val); + gtk_main_quit(); +} - val=GETCHECK("chkFPSLimit"); - SetCfgVal(pB,"\nUseFrameLimit",val); +// Autoconfiguration callbacks + +void on_btnFast_clicked( GtkObject *object, gpointer user_data ) { + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinXSize ), 640 ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinYSize ), 480 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkKeepRatio ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkDithering ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkFullScreen ), 0 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxTexQuality ), 0 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxTexFiltering ), 0 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxHiResTex ), 0 ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinVRam ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkShowFPS ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkUseFPSLimit ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( radFPSLimitAuto ), 1 ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinFPSLimit ), 200 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkUseFrameSkipping ), 0 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxOffscreen ), 1 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxFBTex ), 1 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxFBAccess ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkMaskDetect ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkOpaquePass ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkAdvancedBlend ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkScanLines ), 0 ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinScanLinesBlend ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkFastMdec ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chk15bitMdec ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkLineMode ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkAntiAlias ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkOGLExtensions ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkScreenSmoothing ), 0 ); +} - val=GETCHECK("chkFPSSkip"); - SetCfgVal(pB,"\nUseFrameSkip",val); +void on_btnBeautiful_clicked( GtkObject *object, gpointer user_data ) { + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinXSize ), 640 ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinYSize ), 480 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkKeepRatio ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkDithering ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkFullScreen ), 0 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxTexQuality ), 3 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxTexFiltering ), 0 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxHiResTex ), 0 ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinVRam ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkShowFPS ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkUseFPSLimit ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( radFPSLimitAuto ), 1 ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinFPSLimit ), 200 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkUseFrameSkipping ), 0 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxOffscreen ), 3 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxFBTex ), 2 ); + gtk_combo_box_set_active( GTK_COMBO_BOX( cbxFBAccess ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkMaskDetect ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkOpaquePass ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkAdvancedBlend ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkScanLines ), 0 ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinScanLinesBlend ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkFastMdec ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chk15bitMdec ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkLineMode ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkAntiAlias ), 0 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkOGLExtensions ), 1 ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkScreenSmoothing ), 0 ); +} - val=GETCHECK("rdbLimAuto"); - if(val) val=1; else val=0; - SetCfgVal(pB,"\nFPSDetection",val); +// Callbacks used to toggle the sensitivity of some parts of the GUI - val=GETEDITVAL("edtFPSlim"); - if(val<0) val=0; - if(val>1000) val=1000; - SetCfgVal(pB,"\nFrameRate",val); +void on_chkUseGameFixes_toggled( GtkObject *object, gpointer user_data ) { + gtk_widget_set_sensitive( tblGameFixes, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkUseGameFixes ) ) ); +} - val=GETLIST("cmbOffscreen"); - SetCfgVal(pB,"\nOffscreenDrawing",val); +void on_chkUseFPSLimit_toggled( GtkObject *object, gpointer user_data ) { + gtk_widget_set_sensitive( vboxFPSLimit, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkUseFPSLimit ) ) ); +} - val=GETCHECK("chkOpaque"); - SetCfgVal(pB,"\nOpaquePass",val); +void on_radFPSLimitManual_toggled( GtkObject *object, gpointer user_data ) { + gtk_widget_set_sensitive( spinFPSLimit, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radFPSLimitManual ) ) ); +} - val=GETCHECK("chkAntiA"); - SetCfgVal(pB,"\nAntiAlias",val); +void on_chkScanLines_toggled( GtkObject *object, gpointer user_data ) { + gtk_widget_set_sensitive( spinScanLinesBlend, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkScanLines ) ) ); +} - val=GETLIST("cmbQuality"); - SetCfgVal(pB,"\nTexQuality",val); +/* Instanciates the GUI + Reads the config file + Sets widget states according to the config file + Connect callbacks to signals */ +int main( int argc, char **argv ) { + GtkBuilder *builder; + GError *error = NULL; + FILE *in; + char *pB, *p; + int len, val; + char t[256]; + +#ifdef ENABLE_NLS + setlocale (LC_ALL, ""); + bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); +#endif - val=GETCHECK("chkMaskBit"); - SetCfgVal(pB,"\nMaskDetect",val); + gtk_set_locale(); + gtk_init( &argc, &argv ); - val=GETCHECK("chkFastMdec"); - SetCfgVal(pB,"\nFastMdec",val); + builder = gtk_builder_new(); - val=GETCHECK("chkExtensions"); - SetCfgVal(pB,"\nOGLExtensions",val); + // Load the glade file + if ( !gtk_builder_add_from_file( builder, DATADIR "peopsxgl.ui", &error ) ) { + g_warning( "%s", error->message ); + g_free( error ); + return( 1 ); + } - val=GETCHECK("chkBlur"); - SetCfgVal(pB,"\nScreenSmoothing",val); + // Display the About dialog when the emulator ask for it + if ( argv[1] && strcmp( argv[1], "ABOUT" ) == 0 ) { + GtkWidget *widget; + const char *authors[]= {"Adapted from P.E.Op.S OpenGL GPU by Pete Bernert", NULL}; - val=GETCHECK("chkGameFixes"); - SetCfgVal(pB,"\nUseFixes",val); + widget = gtk_about_dialog_new(); + gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(widget), "OpenGL GPU Driver"); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(widget), "1.18"); + gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(widget), authors); + gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(widget), "http://pcsxr.codeplex.com/"); - val=0; - for(len=0;len<18;len++) - { - sprintf(t,"chkFix%d",len); - if(GETCHECK(t)) val|=(1< - + - - - - - - - - 0: Emulated vram - ok most times - - - 1: Gfx card buffer reads - - - 2: Gfx card buffer moves - - - 3: Gfx buffer reads - - - 4: Full Software (FVP) - - - - - - - - - - - 0: None - Fastest, most glitches - - - 1: Minimum - Missing screens - - - 2: Standard - OK for most games - - - 3: Enhanced - Shows more stuff - - - 4: Extended - Causing garbage - - - - - - - - - - - 0: Emulated vram - Needs FVP - - - 1: Black - Fast, no effects - - - 2: Gfx card buffer - Can be slow - - - 3: Gfx card - - - - - - - - - - - 0: None (standard) - - - 1: 2xSaI (much vram needed) - - - 2: Scaled (needs tex filtering) - - - - - - - - - - - 0: None - - - 1: Standard - Glitches will happen - - - 2: Extended - No black borders - - - 3: Standard without sprites - unfiltered 2D - - - 4: Extended without sprites - unfiltered 2D - - - 5: Standard + smoothed sprites - - - 6: Extended + smoothed sprites - - - - - - - - - - - 0: don't care - Use driver's default textures - - - 1: 4444 - Fast, but less colorful - - - 2: 5551 - Nice colors, bad transparency - - - 3: 8888 - Best colors, more ram needed - - - 4: BGR8888 - Faster on some cards - - - - + 5 - P.E.Op.S. MesaGL PSX GPU configuration... + OpenGL Driver configuration False - True center normal + False - + + True vertical + 2 - - 5 + + True + True - - 0 + + True + 10 + vertical + 5 - - 5 - vertical + + True + 2 + 2 + 5 + 5 - + True - 2 - 3 - - - Fullscreen - True - False - True - - - 2 - 3 - - - - - True - 5 - - - - 1 - 2 - - - - - True - - - - 1 - 2 - 1 - 2 - - - - - 0 - Width: - right - - - - - 0 - Height: - right - - - 1 - 2 - - - - - + True + + x + True - 0 + 1 + 2 + + - - Dithering - False - False - True + + True + True + + y + True - False - False - 1 + 1 + 2 + 1 + 2 + + - - Keep psx aspect ratio - False - False - True + + True + 0 + Width: - False - False - 2 + + + + + + + True + 0 + Height: + + + 1 + 2 + + + + False + False + 0 + - - - Window options + + + Fullscreen + True + True + False + True + + False + False + 1 + + + + Dithering + True + True + False + True + + + False + False + 2 + + + + + Keep psx aspect ratio + True + True + False + True + + + False + False + 3 + + + + + + + True + Window options - 0 + False - - 0 + + True + 10 + vertical + 5 - - 5 - vertical + + True + 3 + 2 + 5 + 5 - + True - - - True - vertical - 2 - - - 0 - Quality: - - - False - 0 - - - - - 0 - Filtering: - - - False - 1 - - - - - 0 - HiRes Tex: - - - False - 2 - - - - - 0 - - - - - True - vertical - 2 - - - liststore1 - - - - 0 - - - - - 0 - - - - - liststore2 - - - - 0 - - - - - 1 - - - - - liststore3 - - - - 0 - - - - - 2 - - - - - 1 - - + 0 + Quality: + + + + + True + 0 + Filtering: - 0 + 1 + 2 - - - - VRam size in MBytes (0..1024, 0=auto): - center - - - False - 0 - - - - - True - - - False - False - 5 - 1 - - + + True + 0 + HiRes Tex: - 1 + 2 + 3 - - - - - Textures - - - - - 1 - - - - - 0 - - - - - True - 5 - - - 0 - - - 5 - vertical - - Show FPS display on startup - True - False - True + + True + liststore6 + + + + 0 + + - False - False - 0 + 1 + 2 - - Use FPS limit - True - False - True + + True + liststore5 + + + + 0 + + - False - 1 + 1 + 2 + 1 + 2 - - Use Frame skipping - True - False - True + + True + liststore4 + + + + 0 + + - False - False - 2 + 1 + 2 + 2 + 3 + + + False + False + 0 + + + + + True + 5 - - FPS limit auto-detection - True - False - True - rdbLimMan + + True + 0 + VRam size in MBytes (0..1024, 0=auto): False False - 3 + 0 - - - - FPS limit manual - True - False - True - True - - - False - False - 0 - - - - - True - - - False - False - 5 - 1 - - - - - FPS - center - - - False - False - 2 - - + + True + True + + v False False - 4 + 1 - - - - Framerate - + + False + False + 1 + - 0 + 1 + False + + + + + True + Textures + + + 1 + False - - 0 + + True + 10 + vertical + 5 + + + Show FPS display on startup + True + True + False + True + + + False + False + 0 + + - - 5 - vertical + + Use FPS limit + True + True + False + True + + + False + 1 + + + + + True + 20 - + True + vertical + 5 - + + FPS limit auto-detector True - vertical + True + False + True + True + radFPSLimitManual + + + False + 0 + + + + + True + 5 - + + FPS limit manual True - - - True - vertical - 2 - - - 0 - Offscreen Drawing: - - - False - 0 - - - - - 0 - Framebuffer textures: - - - False - 1 - - - - - 0 - Framebuffer access: - - - False - 2 - - - - - 0 - - - - - True - vertical - 2 - - - liststore5 - - - - 0 - 0 - - - - - False - False - 0 - - - - - liststore6 - - - - 0 - - - - - False - False - 1 - - - - - liststore4 - - - - 0 - - - - - 2 - - - - - 1 - - - - - 0 - - - - - Mask bit detection (needed by a few games, zbuffer) True False + True True - 1 + False + False + 0 - - Alpha Multipass (correct opaque texture areas) + + True + False True - False - True + + f - 2 + False + False + 1 - - Advanced blending (Accurate psx color emulation) - True - False - True + + True + FPS - 3 + False + False + 2 - 0 + False + 1 - - 0 - + + False + 2 + - - - Compatibility + + + Use Frame skipping + True + True + False + True + + False + False + 3 + - 1 + 2 + + + + + True + Framerate + + + 2 + False - - - 1 - - - - - 5 - - 0 + + True + 10 + vertical + 5 - - 5 - vertical + + True + 3 + 2 + 5 + 5 - - - - Scanlines - False - False - True - - - False - False - 0 - - - - - Blending (0..255,-1=dot): - center - - - False - False - 13 - 1 - - - - - True - - - False - False - 2 - - + + True + 0 + Offscreen drawing: + + + + + True + 0 + Framebuffer textures: - False - False - 0 + 1 + 2 - - Unfiltered MDECs (small movie speedup) - False - False - True + + True + 0 + Framebuffer access: - False - False - 1 + 2 + 3 - - Force 15 bit framebuffer updates (faster movies) - False - False - True + + True + liststore3 + + + + 0 + + - False - False - 2 + 1 + 2 - - Line mode (polygons will not get filled) - False - False - True + + True + liststore2 + + + + 0 + + - False - False - 3 + 1 + 2 + 1 + 2 - - Polygon anti-aliasing (slow with most cards) - False - False - True + + True + liststore1 + + + + 0 + + - False - False - 4 + 1 + 2 + 2 + 3 + + + False + False + 0 + + + + + Mask bit detection (Needed by a few games, zbuffer) + True + True + False + True + + + False + 1 + + + + + Alpha multipass (Correct opaque texture areas) + True + True + False + True + + + False + 2 + + + + + Advanced blending (Accurate psx color emulation) + True + True + False + True + + + False + 3 + + + + + 3 + + + + + True + Compatibility + + + 3 + False + + + + + True + 10 + vertical + 5 + + + True + 5 - - Use OpenGL extensions (recommended) - False + + Scanlines Blending (0..255, -1=dot): + True + True False True False - False - 5 + 0 - - Screen smoothing (can be slow or unsupported) - False - False - True + + True + True + + s False - False - 6 + 1 + + False + 0 + - - - Misc + + + Unfiltered MDECs (Small movie speedup) + True + True + False + True + + + False + 1 + + + + + Force 15 bit framebuffer updates (Faster movies) + True + True + False + True + + + False + 2 + + + + + Line mode (Polygons will not get filled) + True + True + False + True + + + False + 3 + + + + + Polygon anti-aliasing (Slow with most cards) + True + True + False + True + + + False + 4 + + + + + Use OpenGL extensions (Recommended) + True + True + False + True + + + False + 5 + + + + + Screen smoothing (Can be slow or unsupported) + True + True + False + True + + False + 6 + - 0 + 4 + + + + + True + Misc + + + 4 + False - - 0 + + True + 10 + vertical + 5 - - 5 - vertical - - - Use game fixes - False - False - True - - - 0 - - + + Use game fixes + True + True + False + True + + + False + 0 + + + + + True + 20 - + + True 9 2 - True + 5 + 5 + + + Battle cursor (FF7) + True + True + False + True + + + + + - - 01: Battle cursor (FF7) - False + + Yellow rect (FF9) + True + True False True + + 1 + 2 + + - - 02: Direct FB updates - False + + Direct FB updates + True + True False True 1 2 + - - 04: Black brightness (Lunar) - False + + Black brightness (Lunar) + True + True False True 2 3 + - - 08: Swap front detection - False + + Swap front detection + True + True False True 3 4 + - - 10: Disable coord check - False + + Disable coord check + True + True False True 4 5 + - - 20: No blue glitches (LoD) - False + + No blue glitches (LoD) + True + True False True 5 6 + - - 40: Soft FB access - False + + Soft FB access + True + True False True 6 7 + - - 80: PC fps calculation - False + + PC FPS calculation + True + True False True 7 8 + - - 100: Old frame skipping - False + + Old frame skipping + True + True False True 8 9 + - - 200: Yellow rect (FF9) - False - False - True - - - 1 - 2 - - - - - 400: No subtr. blending - False + + No subtr. blending + True + True False True @@ -1007,12 +914,14 @@ 2 1 2 + - - 800: Lazy upload (DW7) - False + + Lazy upload (DW7) + True + True False True @@ -1021,12 +930,14 @@ 2 2 3 + - - 1000: Odd/even hack - False + + Odd/even hack + True + True False True @@ -1035,12 +946,14 @@ 2 3 4 + - - 2000: Adjust screen width - False + + Adjust screen width + True + True False True @@ -1049,12 +962,14 @@ 2 4 5 + - - 4000: Old texture filtering - False + + Old texture filtering + True + True False True @@ -1063,12 +978,14 @@ 2 5 6 + - - 8000: Additional uploads - False + + Additional uploads + True + True False True @@ -1077,12 +994,15 @@ 2 6 7 + - - 10000: unused - False + + Unused + True + False + True False True @@ -1091,12 +1011,14 @@ 2 7 8 + - - 20000: fake 'gpu busy' - False + + Fake 'GPU busy' + True + True False True @@ -1105,104 +1027,275 @@ 2 8 9 + - - 1 - - - - - Special game fixes - + + 1 + - 1 + 5 + + + + + True + Special game fixes + + + 5 + False - 2 + 0 - - center + + True + end + + + Fast + True + True + True + Autoconfigure for fast display + + + False + False + 0 + True + + + + + Beautiful + True + True + True + Auto configure for beautiful display + + + False + False + 1 + True + + gtk-ok True - False - False + True + True True False False - 0 + 2 gtk-cancel True - False - False + True + True True False False - 1 + 3 False end - 3 + 0 - btnSave - btnCancel + btnFast + btnBeautiful + btnSave + btnCancel - - 5 - dialog - P.E.Op.S. MesaGL PSX GPU - 1.78 - Coded by: Pete Bernert - Release date: 01.04.2009 - http://www.pbernert.com - http://www.pbernert.com - - - True - vertical - 2 - - - - - - True - end - - - False - end - 0 - - - - + + 9999 + 1 + 10 + + + 9999 + 1 + 10 + + + 60 + 20 + 200 + 1 + 10 + + + + + + + + + Emulated VRam - Ok most times + + + Gfx card buffer reads + + + Gfx card buffer moves + + + Gfx card buffer reads and moves + + + Full Software (FVP) + + + + + + + + + + + Emulated VRam - Needs FVP + + + Black - Fast, no effects + + + Gfx card buffer - Can be slow + + + Gfx card and soft - Slow + + + + + + + + + + + None - Fastest, most glitches + + + Minimum - Missing screens + + + Standard - OK for most games + + + Enhanced - Shows more stuff + + + Extended - Causing garbage + + + + + + + + + + + None (Standard) + + + 2xSaI (Much vram needed) + + + Scaled (Needs tex filtering) + + + + + + + + + + + None + + + Standard - Glitches will happen + + + Extended - No black borders + + + Standard without sprites - Unfiltered 2D + + + Extended without sprites - Unfiltered 2D + + + Standard + smoothed sprites + + + Extended + smoothed sprites + + + + + + + + + + + Don't care - Use driver's default textures + + + 4444 - Fast, but less colorful + + + 5551 - Nice colors, bad transparency + + + 8888 - Best colors, more ram needed + + + BGR8888 - Faster on some cards + + + + + 1024 + 1 + 10 + + + -1 + 255 + 1 + 10 -- cgit v1.2.3