#include <Windows.h>#include <stdio.h>#include "D3DDrv.h"#include "DCommon.h"#include "Scene.h"#include "Render.h"#include "D3DCache.h"#include "D3D_Main.h"#include "PCache.h"#include "THandle.h"Go to the source code of this file.
Defines | |
| #define | NUM_PIXEL_FORMATS (sizeof(PixelFormats)/sizeof(geRDriver_PixelFormat)) |
Functions | |
| geBoolean DRIVERCC | DrvShutdown (void) |
| geBoolean DRIVERCC | ScreenShot (const char *Name) |
| BOOL DRIVERCC | DrvInit (DRV_DriverHook *Hook) |
| geBoolean DRIVERCC | DrvResetAll (void) |
| geBoolean DRIVERCC | EnumPixelFormats (DRV_ENUM_PFORMAT_CB *Cb, void *Context) |
| geBoolean DRIVERCC | SetGamma (geFloat Gamma) |
| geBoolean DRIVERCC | GetGamma (geFloat *Gamma) |
| BOOL DRIVERCC | EnumSubDrivers2 (DRV_ENUM_DRV_CB *Cb, void *Context) |
| BOOL DRIVERCC | EnumModes2 (int32 Driver, char *DriverName, DRV_ENUM_MODES_CB *Cb, void *Context) |
| DllExport BOOL | DriverHook (DRV_Driver **Driver) |
| void | SetLastDrvError (int32 Error, char *ErrorStr) |
Variables | |
| DRV_Window | ClientWindow |
| BOOL | ExitHandlerActive = FALSE |
| int32 | LastError |
| char | LastErrorStr [200] |
| geRDriver_PixelFormat | PixelFormat [10] |
| DRV_Driver | D3DDRV |
| DRV_EngineSettings | EngineSettings |
|
|
Definition at line 90 of file D3DDrv/D3ddrv.cpp. |
|
|
Definition at line 227 of file D3DDrv/D3ddrv.cpp. References DRV_EngineSettings::CanSupportFlags, D3DDRV, DllExport, DRV_ERROR_NONE, DRV_SUPPORT_ALPHA, DRV_SUPPORT_COLORKEY, DRV_Driver::EngineSettings, EngineSettings, LastErrorStr, DRV_Driver::LastErrorStr, DRV_EngineSettings::PreferenceFlags, SetLastDrvError(), and TRUE.
00228 {
00229 EngineSettings.CanSupportFlags = (DRV_SUPPORT_ALPHA | DRV_SUPPORT_COLORKEY);
00230 EngineSettings.PreferenceFlags = 0;//DRV_PREFERENCE_NO_MIRRORS;
00231
00232 D3DDRV.EngineSettings = &EngineSettings;
00233
00234 *Driver = &D3DDRV;
00235
00236 // Make sure the error string ptr is not null, or invalid!!!
00237 D3DDRV.LastErrorStr = LastErrorStr;
00238
00239 SetLastDrvError(DRV_ERROR_NONE, "D3DDrv: No error.");
00240
00241 return TRUE;
00242 }
|
|
|
Definition at line 45 of file D3DDrv/D3ddrv.cpp. References tagRECT::bottom, ClientWindow, D3DMain_InitD3D(), DRIVERCC, DRV_DriverHook::DriverName, FALSE, DRV_Window::Height, DRV_DriverHook::Height, DRV_Window::hWnd, DRV_DriverHook::hWnd, tagRECT::left, tagRECT::right, tagRECT::top, TRUE, DRV_Window::Width, and DRV_DriverHook::Width.
00046 {
00047 RECT WRect;
00048
00049 // Start up
00050 if (!D3DMain_InitD3D(Hook->hWnd, Hook->DriverName+5, Hook->Width, Hook->Height))
00051 {
00052 //SetLastDrvError(DRV_ERROR_INIT_ERROR, "D3D_DrvInit: Could not init driver.\n");
00053 return FALSE;
00054 }
00055
00056 // If they are asking for a window mode, use there hWnd for the size
00057 if (Hook->Width ==-1 && Hook->Height == -1)
00058 {
00059 GetClientRect(Hook->hWnd, &WRect);
00060
00061 Hook->Width = (WRect.right - WRect.left);
00062 Hook->Height = (WRect.bottom - WRect.top);
00063 }
00064
00065 ClientWindow.Width = Hook->Width;
00066 ClientWindow.Height = Hook->Height;
00067 ClientWindow.hWnd = Hook->hWnd;
00068
00069 return TRUE;
00070 }
|
|
|
Definition at line 83 of file D3DDrv/D3ddrv.cpp. References D3DMain_Reset(), DRIVERCC, and geBoolean.
00084 {
00085 return D3DMain_Reset();
00086 }
|
|
|
Definition at line 58 of file GlideDrv.c.
00059 {
00060 GMain_Shutdown();
00061
00062 return TRUE;
00063 }
|
|
||||||||||||||||||||
|
Definition at line 2779 of file D3D7xDrv/D3d_main.cpp.
02780 {
02781 HRESULT hr;
02782 int32 i, Width, Height;
02783 char ModeName[MAX_DRIVER_NAME];
02784 DDEnumInfo Info;
02785
02786 //Cb(0, "HackMode 2", 640, 480, Context);
02787 //return GE_TRUE;
02788
02789 Info.Drivers = Drivers;
02790 Info.NumDrivers = 0;
02791
02792 /* 07/16/2000 Wendell Buckner
02793 Convert to Directx7...
02794 hr = DirectDrawEnumerate(EnumDriversCB2, &Info); */
02795 hr = DirectDrawEnumerateEx((LPDDENUMCALLBACKEX) EnumDriversCB2, &Info, NULL);
02796
02797
02798 if (hr != DD_OK)
02799 {
02800 D3DMain_Log("D3DMain_EnumModes: DirectDrawEnumerate failed.\n");
02801 return FALSE;
02802 }
02803
02804
02805 if (!CreateDDFromName(DriverName, &Info))
02806 return GE_FALSE;
02807
02808 if (!D3DMain_EnumDisplayModes())
02809 {
02810 D3DMain_ShutdownD3D();
02811
02812 D3DMain_Log("D3DMain_EnumModes: D3DMain_EnumDisplayModes failed.\n");
02813 return FALSE;
02814 }
02815
02816 for (i=0; i< AppInfo.NumModes; i++)
02817 {
02818 if (AppInfo.Modes[i].Bpp != 16)
02819 continue;
02820
02821 // Get the width/height of mode
02822 Width = AppInfo.Modes[i].Width;
02823 Height = AppInfo.Modes[i].Height;
02824
02825 // Make a unique name
02826 sprintf(ModeName, "%ix%i", Width, Height);
02827
02828 // Call their callback with this driver mode
02829 if (!Cb(i, ModeName, Width, Height, Context))
02830 {
02831 D3DMain_ShutdownD3D();
02832 return GE_TRUE;
02833 }
02834 }
02835
02836 if (AppInfo.CanDoWindow)
02837 {
02838 if (!Cb(i, "WindowMode", -1, -1, Context))
02839 {
02840 D3DMain_ShutdownD3D();
02841 return GE_TRUE;
02842 }
02843 }
02844
02845 D3DMain_ShutdownD3D();
02846
02847 return TRUE;
02848 }
|
|
||||||||||||
|
Definition at line 92 of file D3DDrv/D3ddrv.cpp. References AppInfo, App_Info::ddsd, App_Info::ddSurfFormat, App_Info::ddTexFormat, DRIVERCC, geRDriver_PixelFormat::Flags, GE_PIXELFORMAT_16BIT_1555_ARGB, GE_PIXELFORMAT_16BIT_4444_ARGB, GE_PIXELFORMAT_16BIT_555_RGB, GE_PIXELFORMAT_16BIT_565_RGB, GE_PIXELFORMAT_24BIT_RGB, GE_PIXELFORMAT_32BIT_ARGB, GE_PIXELFORMAT_32BIT_XRGB, GE_TRUE, geBoolean, gePixelFormat, int32, geRDriver_PixelFormat::PixelFormat, PixelFormat, RDRIVER_PF_2D, RDRIVER_PF_3D, RDRIVER_PF_CAN_DO_COLORKEY, RDRIVER_PF_COMBINE_LIGHTMAP, RDRIVER_PF_LIGHTMAP, TRUE, and uint32.
00093 {
00094 int32 i;
00095 gePixelFormat Format3d, Format2d;
00096 uint32 CurrentBpp;
00097
00098 CurrentBpp = AppInfo.ddsd.ddpfPixelFormat.dwRGBBitCount;
00099
00100 // Setup the 2d surface format
00101 if (CurrentBpp == 32 && AppInfo.ddSurfFormat.ddpfPixelFormat.dwRGBAlphaBitMask == 0xff000000)
00102 Format2d = GE_PIXELFORMAT_32BIT_ARGB;
00103 else if (CurrentBpp == 32 && AppInfo.ddSurfFormat.ddpfPixelFormat.dwBBitMask == 0xff)
00104 Format2d = GE_PIXELFORMAT_32BIT_XRGB;
00105 else if (CurrentBpp == 24 && AppInfo.ddSurfFormat.ddpfPixelFormat.dwBBitMask == 0xff)
00106 Format2d = GE_PIXELFORMAT_24BIT_RGB;
00107 else if (AppInfo.ddSurfFormat.ddpfPixelFormat.dwGBitMask == (31<<5))
00108 Format2d = GE_PIXELFORMAT_16BIT_555_RGB;
00109 else
00110 Format2d = GE_PIXELFORMAT_16BIT_565_RGB;
00111
00112 // Setup the 3d (Texture) format
00113 if (AppInfo.ddTexFormat.ddpfPixelFormat.dwGBitMask == (31<<5))
00114 Format3d = GE_PIXELFORMAT_16BIT_555_RGB;
00115 else
00116 Format3d = GE_PIXELFORMAT_16BIT_565_RGB;
00117
00118
00119 // Create the surface formats now
00120 PixelFormat[0].PixelFormat = Format3d; // 3d 565/555 surface
00121 PixelFormat[0].Flags = RDRIVER_PF_3D | RDRIVER_PF_COMBINE_LIGHTMAP;
00122
00123 PixelFormat[1].PixelFormat = GE_PIXELFORMAT_16BIT_4444_ARGB; // 3d 4444 surface
00124 PixelFormat[1].Flags = RDRIVER_PF_3D | RDRIVER_PF_COMBINE_LIGHTMAP;
00125
00126 PixelFormat[2].PixelFormat = Format2d; // 2d 565/555 surface
00127 PixelFormat[2].Flags = RDRIVER_PF_2D | RDRIVER_PF_CAN_DO_COLORKEY;
00128
00129 PixelFormat[3].PixelFormat = Format3d; // Lightmap 565/555 surface
00130 PixelFormat[3].Flags = RDRIVER_PF_LIGHTMAP;
00131
00132 PixelFormat[4].PixelFormat = GE_PIXELFORMAT_16BIT_1555_ARGB;
00133 PixelFormat[4].Flags = RDRIVER_PF_3D | RDRIVER_PF_COMBINE_LIGHTMAP;
00134
00135 // Then hand them off to the caller
00136 for (i=0; i<5; i++)
00137 {
00138 if (!Cb(&PixelFormat[i], Context))
00139 return GE_TRUE;
00140 }
00141
00142 return TRUE;
00143 }
|
|
||||||||||||
|
Definition at line 2718 of file D3D7xDrv/D3d_main.cpp.
02719 {
02720 HRESULT hr;
02721 int32 i;
02722 DDEnumInfo Info;
02723
02724 unlink(D3DMAIN_LOG_FILENAME);
02725
02726 Info.Drivers = Drivers;
02727 Info.NumDrivers = 0;
02728
02729 /* 07/16/2000 Wendell Buckner
02730 Convert to Directx7...
02731 hr = DirectDrawEnumerate(EnumDriversCB2, &Info); */
02732 hr = DirectDrawEnumerateEx((LPDDENUMCALLBACKEX) EnumDriversCB2, &Info, NULL);
02733
02734
02735 if (hr != DD_OK)
02736 {
02737 D3DMain_Log("D3DMain_EnumSubDrivers: DirectDrawEnumerate failed.\n");
02738 return FALSE;
02739 }
02740
02741 for (i=0; i< Info.NumDrivers; i++)
02742 {
02743 // Create the DD object for this driver
02744 if (!CreateDDFromDriver(&Info.Drivers[i]))
02745 return GE_FALSE;
02746
02747 if (Main_CheckDD())
02748 {
02749 if (!Cb(i, Info.Drivers[i].Name, Context))
02750 {
02751 RELEASE(AppInfo.lpD3D);
02752 AppInfo.lpD3D = NULL;
02753
02754 //D3DMain_ShutdownD3D();
02755 RELEASE(AppInfo.lpDD);
02756 AppInfo.lpDD = NULL;
02757 memset(&AppInfo, 0, sizeof(AppInfo));
02758 break;
02759 }
02760 }
02761
02762 RELEASE(AppInfo.lpD3D);
02763 AppInfo.lpD3D = NULL;
02764
02765 //D3DMain_ShutdownD3D();
02766 RELEASE(AppInfo.lpDD);
02767 AppInfo.lpDD = NULL;
02768 memset(&AppInfo, 0, sizeof(AppInfo));
02769 }
02770
02771 //Cb(i, "(D3D)HackDriver", Context);
02772
02773 return TRUE;
02774 }
|
|
|
Definition at line 150 of file D3DDrv/D3ddrv.cpp. References DRIVERCC, GE_TRUE, and geBoolean.
00151 {
00152 *Gamma = 1.0f;
00153
00154 return GE_TRUE;
00155 }
|
|
|
Definition at line 357 of file OGLDrv.c.
00358 {
00359 unsigned char tgaHeader[18];
00360 GLubyte *buffer;
00361 FILE *fp;
00362 char *newName;
00363 int nameLen;
00364
00365 buffer = (GLubyte *)malloc(sizeof(GLubyte) * ClientWindow.Width * ClientWindow.Height * 3);
00366
00367 glFinish();
00368
00369 glReadPixels(0, 0, ClientWindow.Width, ClientWindow.Height,
00370 GL_BGR_EXT, GL_UNSIGNED_BYTE, buffer);
00371
00372 memset(tgaHeader, 0, sizeof(tgaHeader));
00373 tgaHeader[2] = 2;
00374 tgaHeader[12] = (unsigned char)ClientWindow.Width;
00375 tgaHeader[13] = (unsigned char)((unsigned long)ClientWindow.Width >> 8);
00376 tgaHeader[14] = (unsigned char)ClientWindow.Height;
00377 tgaHeader[15] = (unsigned char)((unsigned long)ClientWindow.Height >> 8);
00378 tgaHeader[16] = 24;
00379
00380 // Convert the extention (if one exists) to .tga. They probably expect a .bmp.
00381 newName = strdup(Name);
00382
00383 nameLen = strlen(newName);
00384
00385 if(nameLen > 3)
00386 {
00387 if(newName[nameLen - 4] == '.')
00388 {
00389 strcpy(newName + nameLen - 3, "tga");
00390 }
00391 }
00392
00393 fp = fopen(newName, "wb");
00394
00395 free(newName);
00396
00397 if(fp == NULL)
00398 {
00399 free(buffer);
00400 return GE_FALSE;
00401 }
00402
00403 fwrite(tgaHeader, 1, 18, fp);
00404 fwrite(buffer, 3, ClientWindow.Width * ClientWindow.Height, fp);
00405 fclose(fp);
00406
00407 free(buffer);
00408
00409 return GE_TRUE;
00410 }
|
|
|
Definition at line 145 of file D3DDrv/D3ddrv.cpp. References DRIVERCC, GE_TRUE, and geBoolean.
00146 {
00147 return GE_TRUE;
00148 }
|
|
||||||||||||
|
Definition at line 244 of file D3DDrv/D3ddrv.cpp. References D3DDRV, Error, DRV_Driver::LastError, LastError, DRV_Driver::LastErrorStr, LastErrorStr, and NULL.
00245 {
00246 LastError = Error;
00247
00248 if (ErrorStr)
00249 {
00250 strcpy(LastErrorStr, ErrorStr);
00251 }
00252 else
00253 LastErrorStr[0] = NULL;
00254
00255 D3DDRV.LastErrorStr = LastErrorStr;
00256 D3DDRV.LastError = LastError;
00257 }
|
|
|
Definition at line 36 of file D3DDrv/D3ddrv.cpp. |
|
|
Definition at line 160 of file D3DDrv/D3ddrv.cpp. |
|
|
Definition at line 225 of file D3DDrv/D3ddrv.cpp. |
|
|
Definition at line 37 of file D3DDrv/D3ddrv.cpp. |
|
|
Definition at line 39 of file D3DDrv/D3ddrv.cpp. |
|
|
Definition at line 40 of file D3DDrv/D3ddrv.cpp. |
|
|
Definition at line 88 of file D3DDrv/D3ddrv.cpp. |
1.3.2