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 "glFont.h"
#include <gl/glext.h>
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 void winlog(const char *,...);
extern int systemSpeed;
@ -94,7 +73,6 @@ private:
u8 *filterData;
RECT destRect;
bool failed;
bool initialized;
GLFONT font;
int pitch;
GLuint displaylist;
@ -170,7 +148,6 @@ OpenGLDisplay::OpenGLDisplay()
height = 0;
size = 0.0f;
failed = false;
initialized = false;
filterData = NULL;
currentAdapter = 0;
}
@ -235,8 +212,6 @@ void OpenGLDisplay::cleanup()
EnumDisplayDevices( NULL, currentAdapter, &dev, 0 );
// restore default video mode
ChangeDisplaySettingsEx( dev.DeviceName, NULL, NULL, 0, NULL );
initialized = false;
}
//init renderer
@ -274,9 +249,6 @@ bool OpenGLDisplay::initialize()
ChangeDisplaySettingsEx( dev.DeviceName, NULL, NULL, 0, NULL );
}
width = theApp.rect.right;
height = theApp.rect.bottom;
EnableOpenGL();
initializeFont();
glPushAttrib( GL_ENABLE_BIT );
@ -315,7 +287,6 @@ bool OpenGLDisplay::initialize()
if(failed)
return false;
initialized = true;
return true;
}
@ -329,7 +300,7 @@ void OpenGLDisplay::clear()
//dlist
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
glBegin( GL_QUADS );
@ -429,15 +400,13 @@ void OpenGLDisplay::render()
//resize screen
void OpenGLDisplay::resize( int w, int h )
{
if( initialized ) {
initializeMatrices( w, h );
/* Display lists are not mutable, so we have to do this*/
if (displaylist)
{
glDeleteLists(displaylist, 1);
displaylist = 0;
renderlist();
}
initializeMatrices( w, h );
/* Display lists are not mutable, so we have to do this*/
if (displaylist)
{
glDeleteLists(displaylist, 1);
displaylist = 0;
renderlist();
}
}
@ -486,6 +455,12 @@ void OpenGLDisplay::initializeMatrices( int w, int h )
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
if (displaylist)
{
glDeleteLists(displaylist, 1);
displaylist = 0;
renderlist();
}
}
//init font texture
@ -557,20 +532,18 @@ void OpenGLDisplay::setVSync( int interval )
bool OpenGLDisplay::changeRenderSize( int w, int h )
{
if( (width != w) || (height != h) ) {
if( initialized ) {
if( texture != 0 ) {
glDeleteTextures( 1, &texture );
texture = 0;
}
if( !initializeTexture( w, h ) ) {
failed = true;
return false;
}
if (filterData)
free(filterData);
filterData = (u8 *)malloc(4*w*h);
if( texture != 0 ) {
glDeleteTextures( 1, &texture );
texture = 0;
}
if( !initializeTexture( w, h ) ) {
failed = true;
return false;
}
if (filterData)
free(filterData);
filterData = (u8 *)malloc(4*w*h);
}
if (displaylist)
{
@ -586,7 +559,6 @@ void OpenGLDisplay::calculateDestRect( int w, int h )
{
float scaleX = (float)w / (float)width;
float scaleY = (float)h / (float)height;
float min = (scaleX < scaleY) ? scaleX : scaleY;
if( theApp.fsMaxScale && (min > theApp.fsMaxScale) ) {
min = (float)theApp.fsMaxScale;
@ -605,6 +577,12 @@ void OpenGLDisplay::calculateDestRect( int w, int h )
destRect.top += diff;
destRect.bottom += diff;
}
if (displaylist)
{
glDeleteLists(displaylist, 1);
displaylist = 0;
renderlist();
}
}
//config options