Reverts Spacy's Divide by Zero fix that caused GBA rom white screen (mudlord)

Note, spacy, in the future, have mudlord check any code you want to commit to svn, or have him fix the bug.
This commit is contained in:
squall_leonhart69r 2008-02-01 09:11:34 +00:00
parent 0d11a13ef7
commit 33299f49d3
1 changed files with 31 additions and 53 deletions

View File

@ -46,28 +46,7 @@
#include <GL/glu.h> #include <GL/glu.h>
#include "glFont.h" #include "glFont.h"
#include <gl/glext.h> #include <gl/glext.h>
typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int ); typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int );
/*We need to declare the procs for these functions like this
If anyone's got a better solution, I'd love to see it =D */
PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL;
PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB = NULL;
PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
PFNGLGETINFOLOGARBPROC glGetInfoLogARB = NULL;
PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
PFNGLUNIFORM4FARBPROC glUniform4fARB = NULL;
PFNGLUNIFORM1IARBPROC glUniform1iARB = NULL;
extern int Init_2xSaI(u32); extern int Init_2xSaI(u32);
extern void winlog(const char *,...); extern void winlog(const char *,...);
extern int systemSpeed; extern int systemSpeed;
@ -94,7 +73,6 @@ private:
u8 *filterData; u8 *filterData;
RECT destRect; RECT destRect;
bool failed; bool failed;
bool initialized;
GLFONT font; GLFONT font;
int pitch; int pitch;
GLuint displaylist; GLuint displaylist;
@ -170,7 +148,6 @@ OpenGLDisplay::OpenGLDisplay()
height = 0; height = 0;
size = 0.0f; size = 0.0f;
failed = false; failed = false;
initialized = false;
filterData = NULL; filterData = NULL;
currentAdapter = 0; currentAdapter = 0;
} }
@ -235,8 +212,6 @@ void OpenGLDisplay::cleanup()
EnumDisplayDevices( NULL, currentAdapter, &dev, 0 ); EnumDisplayDevices( NULL, currentAdapter, &dev, 0 );
// restore default video mode // restore default video mode
ChangeDisplaySettingsEx( dev.DeviceName, NULL, NULL, 0, NULL ); ChangeDisplaySettingsEx( dev.DeviceName, NULL, NULL, 0, NULL );
initialized = false;
} }
//init renderer //init renderer
@ -274,9 +249,6 @@ bool OpenGLDisplay::initialize()
ChangeDisplaySettingsEx( dev.DeviceName, NULL, NULL, 0, NULL ); ChangeDisplaySettingsEx( dev.DeviceName, NULL, NULL, 0, NULL );
} }
width = theApp.rect.right;
height = theApp.rect.bottom;
EnableOpenGL(); EnableOpenGL();
initializeFont(); initializeFont();
glPushAttrib( GL_ENABLE_BIT ); glPushAttrib( GL_ENABLE_BIT );
@ -315,7 +287,6 @@ bool OpenGLDisplay::initialize()
if(failed) if(failed)
return false; return false;
initialized = true;
return true; return true;
} }
@ -329,7 +300,7 @@ void OpenGLDisplay::clear()
//dlist //dlist
void OpenGLDisplay::renderlist() void OpenGLDisplay::renderlist()
{ {
displaylist = glGenLists(1); //Generate a List displaylist = glGenLists(1); //set the cube list to Generate a List
glNewList(displaylist,GL_COMPILE); //compile the new list glNewList(displaylist,GL_COMPILE); //compile the new list
glBegin( GL_QUADS ); glBegin( GL_QUADS );
@ -429,7 +400,6 @@ void OpenGLDisplay::render()
//resize screen //resize screen
void OpenGLDisplay::resize( int w, int h ) void OpenGLDisplay::resize( int w, int h )
{ {
if( initialized ) {
initializeMatrices( w, h ); initializeMatrices( w, h );
/* Display lists are not mutable, so we have to do this*/ /* Display lists are not mutable, so we have to do this*/
if (displaylist) if (displaylist)
@ -438,7 +408,6 @@ void OpenGLDisplay::resize( int w, int h )
displaylist = 0; displaylist = 0;
renderlist(); renderlist();
} }
}
} }
//update filtering methods //update filtering methods
@ -486,6 +455,12 @@ void OpenGLDisplay::initializeMatrices( int w, int h )
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
if (displaylist)
{
glDeleteLists(displaylist, 1);
displaylist = 0;
renderlist();
}
} }
//init font texture //init font texture
@ -557,7 +532,6 @@ void OpenGLDisplay::setVSync( int interval )
bool OpenGLDisplay::changeRenderSize( int w, int h ) bool OpenGLDisplay::changeRenderSize( int w, int h )
{ {
if( (width != w) || (height != h) ) { if( (width != w) || (height != h) ) {
if( initialized ) {
if( texture != 0 ) { if( texture != 0 ) {
glDeleteTextures( 1, &texture ); glDeleteTextures( 1, &texture );
texture = 0; texture = 0;
@ -571,7 +545,6 @@ bool OpenGLDisplay::changeRenderSize( int w, int h )
free(filterData); free(filterData);
filterData = (u8 *)malloc(4*w*h); filterData = (u8 *)malloc(4*w*h);
} }
}
if (displaylist) if (displaylist)
{ {
glDeleteLists(displaylist, 1); glDeleteLists(displaylist, 1);
@ -586,7 +559,6 @@ void OpenGLDisplay::calculateDestRect( int w, int h )
{ {
float scaleX = (float)w / (float)width; float scaleX = (float)w / (float)width;
float scaleY = (float)h / (float)height; float scaleY = (float)h / (float)height;
float min = (scaleX < scaleY) ? scaleX : scaleY; float min = (scaleX < scaleY) ? scaleX : scaleY;
if( theApp.fsMaxScale && (min > theApp.fsMaxScale) ) { if( theApp.fsMaxScale && (min > theApp.fsMaxScale) ) {
min = (float)theApp.fsMaxScale; min = (float)theApp.fsMaxScale;
@ -605,6 +577,12 @@ void OpenGLDisplay::calculateDestRect( int w, int h )
destRect.top += diff; destRect.top += diff;
destRect.bottom += diff; destRect.bottom += diff;
} }
if (displaylist)
{
glDeleteLists(displaylist, 1);
displaylist = 0;
renderlist();
}
} }
//config options //config options