diff options
| author | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-07-26 17:00:47 +0000 |
|---|---|---|
| committer | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-07-26 17:00:47 +0000 |
| commit | 9cbd44224d555eb5d9fbd044676e92924407b57b (patch) | |
| tree | fe82f1d1dbf85e40ea27c82aa154c323efec8a76 /plugins | |
| parent | be2f9d6ef7c59535773efb10f59793b2d4de9eb3 (diff) | |
| download | pcsxr-9cbd44224d555eb5d9fbd044676e92924407b57b.tar.gz | |
peopsogl1, vertex accuracy.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@69230 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/peopsxgl/Makefile.am | 2 | ||||
| -rw-r--r-- | plugins/peopsxgl/cfg.c | 5 | ||||
| -rw-r--r-- | plugins/peopsxgl/draw.c | 89 | ||||
| -rw-r--r-- | plugins/peopsxgl/externals.h | 1 | ||||
| -rw-r--r-- | plugins/peopsxgl/gpu.c | 3 | ||||
| -rw-r--r-- | plugins/peopsxgl/gpucfg/main.c | 17 | ||||
| -rw-r--r-- | plugins/peopsxgl/gpucfg/peopsxgl.ui | 14 | ||||
| -rw-r--r-- | plugins/peopsxgl/gte_accuracy.c | 66 | ||||
| -rw-r--r-- | plugins/peopsxgl/gte_accuracy.h | 26 | ||||
| -rw-r--r-- | plugins/peopsxgl/key.h | 4 |
10 files changed, 204 insertions, 23 deletions
diff --git a/plugins/peopsxgl/Makefile.am b/plugins/peopsxgl/Makefile.am index e7478efa..2017472a 100644 --- a/plugins/peopsxgl/Makefile.am +++ b/plugins/peopsxgl/Makefile.am @@ -10,7 +10,7 @@ libdir = @libdir@/games/psemu/ lib_LTLIBRARIES = libpeopsxgl.la libpeopsxgl_la_SOURCES = cfg.c draw.c fps.c gpu.c key.c menu.c \ - prim.c soft.c texture.c + prim.c soft.c texture.c gte_accuracy.c libpeopsxgl_la_LDFLAGS = -module -avoid-version libpeopsxgl_la_LIBADD = -lX11 -lXxf86vm -lGL -lm diff --git a/plugins/peopsxgl/cfg.c b/plugins/peopsxgl/cfg.c index 3dcd0aba..6819327d 100644 --- a/plugins/peopsxgl/cfg.c +++ b/plugins/peopsxgl/cfg.c @@ -197,6 +197,10 @@ void ReadConfigFile() strcpy(t,"\nOGLExtensions");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;}
if(p) iUseExts=atoi(p+len);
if(iUseExts>1) iUseExts=1;
+
+ strcpy(t,"\nGteAccuracy");p=strstr(pB,t);if(p) {p=strstr(p,"=");len=1;}
+ if(p) bGteAccuracy=atoi(p+len);
+ if(bGteAccuracy>1) bGteAccuracy=1;
free(pB);
}
@@ -232,6 +236,7 @@ void ReadConfig(void) // read config (linux fil iFrameReadType=0;
bUse15bitMdec=FALSE;
iShowFPS=0;
+ bGteAccuracy=0;
bKeepRatio=FALSE;
iScanBlend=0;
iVRamSize=0;
diff --git a/plugins/peopsxgl/draw.c b/plugins/peopsxgl/draw.c index 748824a1..5b64554f 100644 --- a/plugins/peopsxgl/draw.c +++ b/plugins/peopsxgl/draw.c @@ -27,6 +27,8 @@ #include "texture.h"
#include "menu.h"
+#include "gte_accuracy.h"
+
#if defined(_MACGL)
// if you use it, you must include it
#include <OpenGL/gl.h>
@@ -121,6 +123,7 @@ int iUsePalTextures=1; BOOL bSnapShot=FALSE;
BOOL bSmallAlpha=FALSE;
int iShowFPS=0;
+BOOL bGteAccuracy;
// OGL extension support
@@ -1050,10 +1053,21 @@ BOOL offset2(void) if(CheckCoord2()) return TRUE;
}
- vertex[0].x=lx0+PSXDisplay.CumulOffset.x;
- vertex[1].x=lx1+PSXDisplay.CumulOffset.x;
- vertex[0].y=ly0+PSXDisplay.CumulOffset.y;
- vertex[1].y=ly1+PSXDisplay.CumulOffset.y;
+ if(!getGteVertex(lx0, ly0, &vertex[0].x, &vertex[0].y))
+ {
+ vertex[0].x=lx0;
+ vertex[0].y=ly0;
+ }
+ if(!getGteVertex(lx1, ly1, &vertex[1].x, &vertex[1].y))
+ {
+ vertex[1].x=lx1;
+ vertex[1].y=ly1;
+ }
+
+ vertex[0].x+=PSXDisplay.CumulOffset.x;
+ vertex[1].x+=PSXDisplay.CumulOffset.x;
+ vertex[0].y+=PSXDisplay.CumulOffset.y;
+ vertex[1].y+=PSXDisplay.CumulOffset.y;
return FALSE;
}
@@ -1076,13 +1090,29 @@ BOOL offset3(void) if(CheckCoord3()) return TRUE;
}
-
- vertex[0].x=lx0+PSXDisplay.CumulOffset.x;
- vertex[1].x=lx1+PSXDisplay.CumulOffset.x;
- vertex[2].x=lx2+PSXDisplay.CumulOffset.x;
- vertex[0].y=ly0+PSXDisplay.CumulOffset.y;
- vertex[1].y=ly1+PSXDisplay.CumulOffset.y;
- vertex[2].y=ly2+PSXDisplay.CumulOffset.y;
+
+ if(!getGteVertex(lx0, ly0, &vertex[0].x, &vertex[0].y))
+ {
+ vertex[0].x=lx0;
+ vertex[0].y=ly0;
+ }
+ if(!getGteVertex(lx1, ly1, &vertex[1].x, &vertex[1].y))
+ {
+ vertex[1].x=lx1;
+ vertex[1].y=ly1;
+ }
+ if(!getGteVertex(lx2, ly2, &vertex[2].x, &vertex[2].y))
+ {
+ vertex[2].x=lx2;
+ vertex[2].y=ly2;
+ }
+
+ vertex[0].x+=PSXDisplay.CumulOffset.x;
+ vertex[1].x+=PSXDisplay.CumulOffset.x;
+ vertex[2].x+=PSXDisplay.CumulOffset.x;
+ vertex[0].y+=PSXDisplay.CumulOffset.y;
+ vertex[1].y+=PSXDisplay.CumulOffset.y;
+ vertex[2].y+=PSXDisplay.CumulOffset.y;
return FALSE;
}
@@ -1108,14 +1138,35 @@ BOOL offset4(void) if(CheckCoord4()) return TRUE;
}
- vertex[0].x=lx0+PSXDisplay.CumulOffset.x;
- vertex[1].x=lx1+PSXDisplay.CumulOffset.x;
- vertex[2].x=lx2+PSXDisplay.CumulOffset.x;
- vertex[3].x=lx3+PSXDisplay.CumulOffset.x;
- vertex[0].y=ly0+PSXDisplay.CumulOffset.y;
- vertex[1].y=ly1+PSXDisplay.CumulOffset.y;
- vertex[2].y=ly2+PSXDisplay.CumulOffset.y;
- vertex[3].y=ly3+PSXDisplay.CumulOffset.y;
+ if(!getGteVertex(lx0, ly0, &vertex[0].x, &vertex[0].y))
+ {
+ vertex[0].x=lx0;
+ vertex[0].y=ly0;
+ }
+ if(!getGteVertex(lx1, ly1, &vertex[1].x, &vertex[1].y))
+ {
+ vertex[1].x=lx1;
+ vertex[1].y=ly1;
+ }
+ if(!getGteVertex(lx2, ly2, &vertex[2].x, &vertex[2].y))
+ {
+ vertex[2].x=lx2;
+ vertex[2].y=ly2;
+ }
+ if(!getGteVertex(lx3, ly3, &vertex[3].x, &vertex[3].y))
+ {
+ vertex[3].x=lx3;
+ vertex[3].y=ly3;
+ }
+
+ vertex[0].x+=PSXDisplay.CumulOffset.x;
+ vertex[1].x+=PSXDisplay.CumulOffset.x;
+ vertex[2].x+=PSXDisplay.CumulOffset.x;
+ vertex[3].x+=PSXDisplay.CumulOffset.x;
+ vertex[0].y+=PSXDisplay.CumulOffset.y;
+ vertex[1].y+=PSXDisplay.CumulOffset.y;
+ vertex[2].y+=PSXDisplay.CumulOffset.y;
+ vertex[3].y+=PSXDisplay.CumulOffset.y;
return FALSE;
}
diff --git a/plugins/peopsxgl/externals.h b/plugins/peopsxgl/externals.h index 569be698..6071b7c8 100644 --- a/plugins/peopsxgl/externals.h +++ b/plugins/peopsxgl/externals.h @@ -263,6 +263,7 @@ extern BOOL bCheckMask; extern unsigned short sSetMask;
extern uint32_t lSetMask;
extern int iShowFPS;
+extern BOOL bGteAccuracy;
extern BOOL bSetClip;
extern int iForceVSync;
extern int iUseExts;
diff --git a/plugins/peopsxgl/gpu.c b/plugins/peopsxgl/gpu.c index 7955a11c..46e98198 100644 --- a/plugins/peopsxgl/gpu.c +++ b/plugins/peopsxgl/gpu.c @@ -45,6 +45,7 @@ static int iOldMode=0; #include "menu.h"
#include "fps.h"
#include "key.h"
+#include "gte_accuracy.h"
#ifdef _WINDOWS
#include "resource.h"
#include "ssave.h"
@@ -687,6 +688,8 @@ long CALLBACK GPUopen(HWND hwndGPU) InitializeTextureStore(); // init texture mem
+ resetGteVertices();
+
// lGPUstatusRet = 0x74000000;
// with some emus, we could do the OGL init right here... oh my
diff --git a/plugins/peopsxgl/gpucfg/main.c b/plugins/peopsxgl/gpucfg/main.c index 3d7d9d68..67c47e64 100644 --- a/plugins/peopsxgl/gpucfg/main.c +++ b/plugins/peopsxgl/gpucfg/main.c @@ -43,6 +43,7 @@ GtkWidget *window, *chkAntiAlias,
*chkOGLExtensions,
*chkScreenSmoothing,
+ *chkGteAccuracy,
*chkUseGameFixes,
*tblGameFixes,
*chkCfgFix1,
@@ -125,6 +126,7 @@ void on_btnSave_clicked( GtkObject *object, gpointer user_data ) { 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 );
+ fprintf( out, "\nGteAccuracy = %i", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( chkGteAccuracy ) ) );
fclose( out );
}
@@ -163,6 +165,7 @@ void on_btnFast_clicked( GtkObject *object, gpointer user_data ) { 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 );
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkGteAccuracy ), 0 );
}
void on_btnBeautiful_clicked( GtkObject *object, gpointer user_data ) {
@@ -194,6 +197,7 @@ void on_btnBeautiful_clicked( GtkObject *object, gpointer user_data ) { 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 );
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkGteAccuracy ), 0 );
}
// Callbacks used to toggle the sensitivity of some parts of the GUI
@@ -296,6 +300,7 @@ int main( int argc, char **argv ) { chkAntiAlias = GTK_WIDGET( gtk_builder_get_object( builder, "chkAntiAlias" ) );
chkOGLExtensions = GTK_WIDGET( gtk_builder_get_object( builder, "chkOGLExtensions" ) );
chkScreenSmoothing = GTK_WIDGET( gtk_builder_get_object( builder, "chkScreenSmoothing" ) );
+ chkGteAccuracy = GTK_WIDGET( gtk_builder_get_object( builder, "chkGteAccuracy" ) );
chkUseGameFixes = GTK_WIDGET( gtk_builder_get_object( builder, "chkUseGameFixes" ) );
tblGameFixes = GTK_WIDGET( gtk_builder_get_object( builder, "tblGameFixes" ) );
chkCfgFix1 = GTK_WIDGET( gtk_builder_get_object( builder, "chkCfgFix1" ) );
@@ -667,6 +672,18 @@ int main( int argc, char **argv ) { val = 0;
if ( pB ) {
+ strcpy( t, "\nGteAccuracy" );
+ p = strstr( pB, t );
+ if ( p ) {
+ p = strstr( p, "=" );
+ len = 1;
+ val = atoi( p + len );
+ }
+ }
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( chkGteAccuracy ), val );
+
+ val = 0;
+ if ( pB ) {
strcpy( t, "\nUseFixes" );
p = strstr( pB, t );
if ( p ) {
diff --git a/plugins/peopsxgl/gpucfg/peopsxgl.ui b/plugins/peopsxgl/gpucfg/peopsxgl.ui index b96b6485..5d90a1fa 100644 --- a/plugins/peopsxgl/gpucfg/peopsxgl.ui +++ b/plugins/peopsxgl/gpucfg/peopsxgl.ui @@ -8,7 +8,6 @@ <property name="resizable">False</property> <property name="window_position">center</property> <property name="type_hint">normal</property> - <property name="has_separator">False</property> <child internal-child="vbox"> <object class="GtkVBox" id="dialog-vbox3"> <property name="visible">True</property> @@ -718,6 +717,19 @@ <property name="position">6</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="chkGteAccuracy"> + <property name="label" translatable="yes">Gte accuracy</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">7</property> + </packing> + </child> </object> <packing> <property name="position">4</property> diff --git a/plugins/peopsxgl/gte_accuracy.c b/plugins/peopsxgl/gte_accuracy.c new file mode 100644 index 00000000..3af37ab0 --- /dev/null +++ b/plugins/peopsxgl/gte_accuracy.c @@ -0,0 +1,66 @@ +/***************************************************************************
+ * Copyright (C) 2011 by Blade_Arma *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
+ ***************************************************************************/
+
+#include "stdafx.h"
+#include "externals.h"
+
+// TODO: use malloc and pointer to the array's center.
+float gteCoords[0x800 * 2][0x800 * 2][2];
+
+void CALLBACK GPUaddVertex(short sx, short sy, long long fx, long long fy, long long fz)
+{
+ if(bGteAccuracy)
+ {
+ if(sx >= -0x800 && sx <= 0x7ff &&
+ sy >= -0x800 && sy <= 0x7ff)
+ {
+ gteCoords[sy + 0x800][sx + 0x800][0] = fx / 65536.0f;
+ gteCoords[sy + 0x800][sx + 0x800][1] = fy / 65536.0f;
+ }
+ }
+}
+
+void resetGteVertices()
+{
+ if(bGteAccuracy)
+ {
+ memset(gteCoords, 0x00, sizeof(gteCoords));
+ }
+}
+
+int getGteVertex(short sx, short sy, float *fx, float *fy)
+{
+ if(bGteAccuracy)
+ {
+ if(sx >= -0x800 && sx <= 0x7ff &&
+ sy >= -0x800 && sy <= 0x7ff)
+ {
+ if(((int)gteCoords[sy + 0x800][sx + 0x800][0]) == sx &&
+ ((int)gteCoords[sy + 0x800][sx + 0x800][1]) == sy)
+ {
+ *fx = gteCoords[sy + 0x800][sx + 0x800][0];
+ *fy = gteCoords[sy + 0x800][sx + 0x800][1];
+
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/plugins/peopsxgl/gte_accuracy.h b/plugins/peopsxgl/gte_accuracy.h new file mode 100644 index 00000000..6f42f21c --- /dev/null +++ b/plugins/peopsxgl/gte_accuracy.h @@ -0,0 +1,26 @@ +/***************************************************************************
+ * Copyright (C) 2011 by Blade_Arma *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
+ ***************************************************************************/
+
+#ifndef _GTE_ACCURACY_H_
+#define _GTE_ACCURACY_H_
+
+extern void resetGteVertices();
+extern int getGteVertex(short sx, short sy, float *fx, float *fy);
+
+#endif // _GTE_ACCURACY_H_
diff --git a/plugins/peopsxgl/key.h b/plugins/peopsxgl/key.h index 3a523cff..63d25373 100644 --- a/plugins/peopsxgl/key.h +++ b/plugins/peopsxgl/key.h @@ -3,7 +3,7 @@ -------------------
begin : Sun Mar 08 2009
copyright : (C) 1999-2009 by Pete Bernert
- web : www.pbernert.com
+ web : www.pbernert.com
***************************************************************************/
/***************************************************************************
@@ -18,4 +18,4 @@ void InitKeyHandler(void);
void ExitKeyHandler(void);
-void ResetStuff(void);
\ No newline at end of file +void ResetStuff(void);
|
