Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

GlideDrv.c File Reference

#include <Windows.h>
#include "DCommon.h"
#include "GlideDrv.h"
#include "GMain.h"
#include "Glide.h"
#include "GTHandle.h"
#include "Render.h"

Go to the source code of this file.

Defines

#define ENABLE_WIREFRAME
#define NUM_PIXEL_FORMATS   (sizeof(PixelFormats)/sizeof(geRDriver_PixelFormat))

Functions

geBoolean DRIVERCC DrvInit (DRV_DriverHook *Hook)
geBoolean DRIVERCC DrvShutdown (void)
geBoolean DRIVERCC DrvResetAll (void)
geBoolean DRIVERCC SetGamma (geFloat Gamma)
geBoolean DRIVERCC GetGamma (geFloat *Gamma)
geBoolean DRIVERCC EnumModes (int32 Driver, char *DriverName, DRV_ENUM_MODES_CB *Cb, void *Context)
geBoolean DRIVERCC EnumSubDrivers (DRV_ENUM_DRV_CB *Cb, void *Context)
geBoolean DRIVERCC EnumPixelFormats (DRV_ENUM_PFORMAT_CB *Cb, void *Context)
geBoolean DRIVERCC DrvUpdateWindow (void)
geBoolean DRIVERCC DrvSetActive (geBoolean Active)
DllExport geBoolean DriverHook (DRV_Driver **Driver)
void SetLastDrvError (int32 Error, char *ErrorStr)

Variables

int32 LastError
char LastErrorStr [255]
geFloat CurrentGamma
DRV_EngineSettings EngineSettings
geRDriver_PixelFormat PixelFormats []
DRV_Driver GLIDEDRV


Define Documentation

#define ENABLE_WIREFRAME
 

Definition at line 37 of file GlideDrv.c.

#define NUM_PIXEL_FORMATS   (sizeof(PixelFormats)/sizeof(geRDriver_PixelFormat))
 

Definition at line 164 of file GlideDrv.c.


Function Documentation

DllExport geBoolean DriverHook DRV_Driver **  Driver  ) 
 

Definition at line 261 of file GlideDrv.c.

References DRV_EngineSettings::CanSupportFlags, DllExport, DRV_ERROR_NONE, DRV_SUPPORT_ALPHA, DRV_SUPPORT_COLORKEY, DRV_Driver::EngineSettings, EngineSettings, FALSE, geBoolean, GLIDEDRV, LastErrorStr, DRV_Driver::LastErrorStr, DRV_EngineSettings::PreferenceFlags, SetLastDrvError(), and TRUE.

00262 {
00263         GrHwConfiguration g;
00264         FxBool b;
00265         
00266         EngineSettings.CanSupportFlags = (DRV_SUPPORT_ALPHA | DRV_SUPPORT_COLORKEY);
00267         EngineSettings.PreferenceFlags = 0;
00268 
00269         GLIDEDRV.EngineSettings = &EngineSettings;
00270 
00271         *Driver = &GLIDEDRV;
00272 
00273         // Make sure the error string ptr is not null, or invalid!!!
00274         GLIDEDRV.LastErrorStr = LastErrorStr;
00275 
00276         SetLastDrvError(DRV_ERROR_NONE, "GLIDE_DRV:  No error.");
00277 
00278         // query glide2x.dll for how many boards are installed
00279         b=grSstQueryBoards(&g);
00280 
00281         return (b && g.num_sst)?TRUE:FALSE;
00282 }

geBoolean DRIVERCC DrvInit DRV_DriverHook Hook  ) 
 

Definition at line 41 of file GlideDrv.c.

References DRIVERCC, geBoolean, GMain_Startup(), and uint32.

00042 {
00043         #ifdef ENABLE_WIREFRAME 
00044         {
00045                 // reset key states (compensate for windows bug)
00046                 uint32 KeyState1, KeyState2;
00047                 #pragma message("Glide : WireFrame enabled!")
00048                 KeyState1 = GetAsyncKeyState(VK_CONTROL);
00049                 KeyState2 = GetAsyncKeyState(VK_F8);
00050         }
00051         #endif
00052 
00053         return GMain_Startup(Hook);
00054 }

geBoolean DRIVERCC DrvResetAll void   ) 
 

Definition at line 67 of file GlideDrv.c.

References DRIVERCC, geBoolean, and GMain_ResetAll().

00068 {
00069         return GMain_ResetAll();
00070 }

geBoolean DRIVERCC DrvSetActive geBoolean  Active  ) 
 

Definition at line 186 of file GlideDrv.c.

00187 {
00188         return  GE_TRUE;
00189 }

geBoolean DRIVERCC DrvShutdown void   ) 
 

Definition at line 58 of file GlideDrv.c.

00059 {
00060         GMain_Shutdown();
00061 
00062         return TRUE;
00063 }

geBoolean DRIVERCC DrvUpdateWindow void   ) 
 

Definition at line 182 of file GlideDrv.c.

00183 {
00184         return  GE_TRUE;
00185 }

geBoolean DRIVERCC EnumModes int32  Driver,
char *  DriverName,
DRV_ENUM_MODES_CB Cb,
void *  Context
 

Definition at line 94 of file GlideDrv.c.

00095 {
00096         //if (!GMain_GetBoardInfo(&g_BoardInfo))
00097         //      return GE_TRUE;
00098 
00099         if (g_BoardInfo.MainRam == 0)
00100                 return GE_TRUE;                         // No modes
00101 
00102         if (g_BoardInfo.MainRam >= 1)
00103         {
00104                 if (!Cb(0, "512x384", 512, 384, Context))
00105                         return GE_TRUE;
00106         }
00107 
00108         if (g_BoardInfo.MainRam >= 2)
00109         {
00110                 if (!Cb(1, "640x480", 640, 480, Context))
00111                         return GE_TRUE;
00112         }
00113 
00114         if (g_BoardInfo.MainRam >= 4)
00115         {
00116                 if (!Cb(2, "800x600", 800, 600, Context))
00117                         return GE_TRUE;
00118         }
00119 
00120         if (g_BoardInfo.MainRam > 4)
00121         {
00122                 if (!Cb(3, "1024x768", 1024, 768, Context))
00123                         return GE_TRUE;
00124         }
00125 
00126         return GE_TRUE;
00127 }

geBoolean DRIVERCC EnumPixelFormats DRV_ENUM_PFORMAT_CB Cb,
void *  Context
 

Definition at line 168 of file GlideDrv.c.

References DRIVERCC, GE_TRUE, geBoolean, int32, NUM_PIXEL_FORMATS, and PixelFormats.

00169 {
00170         int32           i;
00171 
00172         // Then hand them off to the caller
00173         for (i=0; i<NUM_PIXEL_FORMATS; i++)
00174         {
00175                 if (!Cb(&PixelFormats[i], Context))
00176                         return GE_TRUE;
00177         }
00178 
00179         return GE_TRUE;
00180 }

BOOL DRIVERCC EnumSubDrivers DRV_ENUM_DRV_CB Cb,
void *  Context
 

Definition at line 131 of file GlideDrv.c.

00132 {
00133         // Initialize the Glide library 
00134         grGlideInit();
00135 
00136         // Get the info about this board
00137         if (!GMain_GetBoardInfo(&g_BoardInfo))
00138                 return GE_TRUE;
00139 
00140         if (g_BoardInfo.MainRam == 0)
00141                 return GE_TRUE;                         // No modes, so don't return any drivers
00142 
00143         if (!Cb(0, "Glide Driver v"DRV_VMAJS"."DRV_VMINS".", Context))
00144                 return GE_TRUE;
00145 
00146         // Shutdown Glide library
00147         grGlideShutdown();
00148 
00149         return GE_TRUE;
00150 }

geBoolean DRIVERCC GetGamma geFloat Gamma  ) 
 

Definition at line 84 of file GlideDrv.c.

References DRIVERCC, geBoolean, and TRUE.

00085 {
00086         //*Gamma = CurrentGamma;
00087         *Gamma = 1.0f;
00088 
00089         return TRUE;
00090 }

geBoolean DRIVERCC SetGamma geFloat  Gamma  ) 
 

Definition at line 74 of file GlideDrv.c.

References CurrentGamma, DRIVERCC, geBoolean, and TRUE.

00075 {
00076         CurrentGamma = Gamma;
00077 
00078         //grGammaCorrectionValue(CurrentGamma);
00079         return TRUE;
00080 }

void SetLastDrvError int32  Error,
char *  ErrorStr
 

Definition at line 286 of file GlideDrv.c.

References Error, GLIDEDRV, DRV_Driver::LastError, LastError, DRV_Driver::LastErrorStr, and LastErrorStr.

00287 {
00288         LastError = Error;
00289         
00290         if (ErrorStr)
00291         {
00292                 strcpy(LastErrorStr, ErrorStr);
00293         }
00294         else
00295                 LastErrorStr[0] = 0;
00296 
00297         GLIDEDRV.LastErrorStr = LastErrorStr;
00298         GLIDEDRV.LastError = LastError;
00299 }


Variable Documentation

geFloat CurrentGamma [static]
 

Definition at line 34 of file GlideDrv.c.

Referenced by SetGamma().

DRV_EngineSettings EngineSettings
 

Definition at line 36 of file GlideDrv.c.

DRV_Driver GLIDEDRV
 

Definition at line 193 of file GlideDrv.c.

Referenced by BeginScene(), BeginWorld(), DriverHook(), EndWorld(), Render_GouraudPoly(), Render_LinesPoly(), Render_WorldPoly(), and SetLastDrvError().

int32 LastError
 

Definition at line 31 of file GlideDrv.c.

char LastErrorStr[255]
 

Definition at line 32 of file GlideDrv.c.

geRDriver_PixelFormat PixelFormats[]
 

Initial value:

Definition at line 152 of file GlideDrv.c.

Referenced by EnumPixelFormats(), and Hack_FindPixelFormat().


Generated on Tue Sep 30 12:37:38 2003 for GTestAndEngine by doxygen 1.3.2