|
coastline 0.0.4
|
The DirectDraw and Direct3D renderer of a window, and the host the game uses it through. More...
#include <cstring>#include <d3d.h>#include <ddraw.h>#include <windows.h>#include "common/textureentry.h"#include "common/texturetile.h"
Go to the source code of this file.
Classes | |
| class | DirectDrawDriver |
| A DirectDraw driver the game found. More... | |
| class | D3DDeviceNode |
| A Direct3D device of a driver. More... | |
| class | DisplayMode |
| A display mode of a driver. More... | |
| class | D3DMaterial |
| A Direct3D material and the description it was set from. More... | |
| class | D3DTexture |
| A texture of Direct3D created from an image in memory. More... | |
| class | DirectDrawRenderer |
| The DirectDraw and Direct3D objects of a window. More... | |
| class | RenderHost |
| What the game draws through: the renderer of the main window. More... | |
| struct | DriverEnumContext |
| What the search of the DirectDraw drivers found. More... | |
Macros | |
| #define | RENDERER_E_NOT_IN_GDI_MODE static_cast<HRESULT>(0x88762711) |
| A renderer told to take the screen back from GDI that had not given it. | |
| #define | RENDERER_E_OUT_OF_MEMORY static_cast<HRESULT>(0x88762714) |
| A renderer that ran out of memory. | |
| #define | RENDERER_E_NOT_CREATED static_cast<HRESULT>(0x88762712) |
| A renderer that is missing its window or its host. | |
| #define | RENDERER_E_NOT_READY static_cast<HRESULT>(0x88762713) |
| A renderer that is not ready to draw. | |
| #define | WM_RENDERER_CREATED 0xbd0 |
| The message a renderer sends its window after it creates its objects, with itself. | |
| #define | WM_RENDERER_DESTROYING 0xbd1 |
| The message a renderer sends its window before it releases its objects, with itself. | |
| #define | WM_RENDERER_IS_READY 0x7e8 |
| Query the window for whether its renderer can draw. | |
| #define | WM_RENDERER_GET 0x7e9 |
| Query the window for its renderer. | |
| #define | WM_RENDERER_GET_BACK_BUFFER 0x7ea |
| Query the window for the back buffer of its renderer. | |
| #define | RENDERER_STATE_READY 0x1f |
| The bits of DirectDrawRenderer::dwRenderStateFlags of a renderer that can draw. | |
| #define | DIRECTDRAW_DRIVER_USABLE 0x1 |
| A DirectDraw driver usable by the game. | |
| #define | DIRECTDRAW_DRIVER_PRIMARY 0x2 |
| The primary DirectDraw driver, selected without a GUID. | |
Functions | |
| IDirectDraw * | GetDirectDrawFromD3DDevice (IDirect3DDevice2 *pDevice) |
| Find the DirectDraw object of a device through its render target. | |
| DirectDrawDriver * | FindDirectDrawDriverOrDefault (GUID *pGuid) |
| The first DirectDraw driver the game found with a GUID, or the default. | |
| HRESULT | AppendDirectDrawDriverNode (DirectDrawDriver *pDriver) |
| Add a driver to the end of the list of drivers. | |
| DirectDrawDriver * | FindDirectDrawDriverByGuid (GUID *pGuid, DirectDrawDriver **ppPrimary, DirectDrawDriver *pFirst) |
| Find the driver a GUID selects, and the primary driver on the way. | |
| void | InitializeAllTextureSurfaces (void) |
| Load every texture the game loaded into its texture surface again, after the surfaces were lost. | |
| HRESULT | SelectDriverDeviceAndModeFromConfig (GUID *pDriverGuid, int nWidth, int nHeight, int nBitDepth, void *pSurfaceFormat, GUID *pDeviceGuid, bool bMatchMode, DirectDrawDriver **ppDriver, DisplayMode **ppMode, D3DDeviceNode **ppDevice) |
| Select the driver, device, and mode of a renderer, finding the drivers first if the game has not. | |
| HRESULT | EnsureDirectDrawDriversEnumerated (void) |
| Find the DirectDraw drivers and their devices and modes, once. | |
| bool | SelectDeviceAndDisplayMode (DirectDrawDriver *pDriver, GUID *pDeviceGuid, int nWidth, int nHeight, int nBitDepth, void *pSurfaceFormat, DisplayMode **ppMode, D3DDeviceNode **ppDevice) |
| Select a device of a driver and a mode that matches a size. | |
| bool | FindDesktopDisplayModeAndDevice (DirectDrawDriver *pDriver, GUID *pDeviceGuid, DisplayMode **ppMode, D3DDeviceNode **ppDevice) |
| Select a device of a driver and the mode of the desktop. | |
| D3DDeviceNode * | ResolveRenderDeviceOrFind (DirectDrawDriver *pDriver, GUID *pDeviceGuid, DisplayMode *pMode) |
| Resolve a device by GUID and optional display mode, using the reported fallback on failure. | |
| int | DDBDToBitDepth (DWORD dwMask) |
| The bits of a depth from the DDBD_ flags of the depths. | |
| DWORD | BitDepthToDDBD (int nBitDepth) |
| The DDBD_ flag of a depth. | |
| HRESULT WINAPI | EnumDisplayModesCallback_AddMode (DDSURFACEDESC *pDesc, LPVOID pContext) |
| Record a display mode of a driver that DirectDraw reports. | |
| HRESULT WINAPI | EnumDeviceTextureFormatsCallback_AddFormat (DDSURFACEDESC *pDesc, LPVOID pContext) |
| Record a texture format of a device that Direct3D reports. | |
| HRESULT WINAPI | EnumD3DDevicesCallback (GUID *pGuid, LPSTR pszDescription, LPSTR pszName, D3DDEVICEDESC *pHardwareDesc, D3DDEVICEDESC *pSoftwareDesc, LPVOID pContext) |
| Record a Direct3D device of a driver that Direct3D reports. | |
| BOOL WINAPI | EnumDirectDrawDriversCallback (GUID *pGuid, LPSTR pszDescription, LPSTR pszName, LPVOID pContext) |
| Record a DirectDraw driver that DirectDraw reports. | |
| HRESULT | EnumerateDirectDrawDrivers (void) |
| Find the DirectDraw drivers and their devices and modes. | |
| void | QueryD3DDeviceCaps (IDirect3DDevice2 *pD3DDevice) |
| Read what a Direct3D device can do. | |
| void | EnumerateTextureFormats (IDirect3DDevice2 *pD3DDevice) |
| Find the texture formats of a Direct3D device for each entry of g_aTexturePixelFormats, at most 8 bits a pixel first, then 16, then 32 when no format of 16 bits was found. | |
| bool | IsPixelFormatPalettized (const DDPIXELFORMAT *pFormat) |
| Whether a pixel format indexes a palette of 1, 2, 4, or 8 bits. | |
| DisplayMode * | FindDisplayModeWithFallback (DirectDrawDriver *pDriver, int nWidth, int nHeight, int nBitDepth, int nUnknown, D3DDeviceNode *pDevice) |
| Find a mode of a driver for a size and a depth, for a device. | |
| void | PresentFrameCallback_FlipSurfaces (void) |
| Flip the frame of the main window. | |
| static DirectDrawRenderer * | GetWindowRenderer (HWND hWnd) |
| The renderer a window stores, set by AttachRenderDeviceToWindow(). | |
| DirectDrawDriver * | FindDisplayDeviceByGuid (GUID *pGuid) |
| Find the DirectDraw driver of a GUID and make it the selected one. | |
| bool | ApplySelectedDisplayMode (int nWidth, int nHeight, int nBitDepth, int nExtra) |
| Move the main window to the DirectDraw driver of g_GlobalRallyConfig when it differs from the driver of the window, in the display mode of the driver nearest a size and a depth. | |
Variables | |
| RenderHost * | g_pRenderHost |
| The host the game draws through. | |
| IDirect3D2 * | g_pDirect3D2 |
| The Direct3D interface of the renderer that created it last. | |
| DirectDrawDriver * | g_pDirectDrawDriverListHead |
| The DirectDraw drivers the game found, linked by DirectDrawDriver::pNext. | |
| IDirect3DDevice2 * | g_pD3DDevice2 |
| The Direct3D device of the renderer that created it last. | |
| D3DTexture ** | g_ppTextureIdTable |
| The textures of Direct3D by identifier. | |
| unsigned char | g_bDirectDrawDriversEnumerated |
| Whether the DirectDraw drivers were found, in bit 0. | |
| D3DDEVICEDESC | g_D3DHalDeviceDesc |
| What the hardware of the device created last does. | |
| D3DDEVICEDESC | g_D3DHelDeviceDesc |
| What the emulation of the device created last does. | |
| int | g_dwScreenBitDepth |
| The bits of a pixel of the display mode set. | |
| int | g_dwActiveDisplayDeviceIndex |
| The index in the list of DirectDraw drivers of the driver in use. | |
| int | g_dwSelectedDisplayDeviceIndex |
| The index in the list of DirectDraw drivers of the driver the menu of devices selects. | |
| DirectDrawDriver * | g_pSelectedDisplayDriver |
| The DirectDraw driver chosen in the configuration. | |
The DirectDraw and Direct3D renderer of a window, and the host the game uses it through.
| #define RENDERER_E_NOT_IN_GDI_MODE static_cast<HRESULT>(0x88762711) |
A renderer told to take the screen back from GDI that had not given it.
| #define RENDERER_E_OUT_OF_MEMORY static_cast<HRESULT>(0x88762714) |
A renderer that ran out of memory.
| #define RENDERER_E_NOT_CREATED static_cast<HRESULT>(0x88762712) |
A renderer that is missing its window or its host.
| #define RENDERER_E_NOT_READY static_cast<HRESULT>(0x88762713) |
A renderer that is not ready to draw.
| #define WM_RENDERER_CREATED 0xbd0 |
The message a renderer sends its window after it creates its objects, with itself.
| #define WM_RENDERER_DESTROYING 0xbd1 |
The message a renderer sends its window before it releases its objects, with itself.
| #define WM_RENDERER_IS_READY 0x7e8 |
Query the window for whether its renderer can draw.
| #define WM_RENDERER_GET 0x7e9 |
Query the window for its renderer.
| #define WM_RENDERER_GET_BACK_BUFFER 0x7ea |
Query the window for the back buffer of its renderer.
| #define RENDERER_STATE_READY 0x1f |
The bits of DirectDrawRenderer::dwRenderStateFlags of a renderer that can draw.
| #define DIRECTDRAW_DRIVER_USABLE 0x1 |
A DirectDraw driver usable by the game.
| #define DIRECTDRAW_DRIVER_PRIMARY 0x2 |
The primary DirectDraw driver, selected without a GUID.
| IDirectDraw * GetDirectDrawFromD3DDevice | ( | IDirect3DDevice2 * | pDevice | ) |
Find the DirectDraw object of a device through its render target.
The reference the lookup takes is released before the object is returned.
| pDevice | The device. |
| DirectDrawDriver * FindDirectDrawDriverOrDefault | ( | GUID * | pGuid | ) |
| HRESULT AppendDirectDrawDriverNode | ( | DirectDrawDriver * | pDriver | ) |
Add a driver to the end of the list of drivers.
| pDriver | The driver. |
| DirectDrawDriver * FindDirectDrawDriverByGuid | ( | GUID * | pGuid, |
| DirectDrawDriver ** | ppPrimary, | ||
| DirectDrawDriver * | pFirst ) |
Find the driver a GUID selects, and the primary driver on the way.
| pGuid | The GUID, or nullptr for the primary driver. |
| ppPrimary | Receives the primary driver, or the first driver searched, unless nullptr. |
| pFirst | The driver the search starts at, or nullptr for the first driver found. |
| void InitializeAllTextureSurfaces | ( | void | ) |
Load every texture the game loaded into its texture surface again, after the surfaces were lost.
| HRESULT SelectDriverDeviceAndModeFromConfig | ( | GUID * | pDriverGuid, |
| int | nWidth, | ||
| int | nHeight, | ||
| int | nBitDepth, | ||
| void * | pSurfaceFormat, | ||
| GUID * | pDeviceGuid, | ||
| bool | bMatchMode, | ||
| DirectDrawDriver ** | ppDriver, | ||
| DisplayMode ** | ppMode, | ||
| D3DDeviceNode ** | ppDevice ) |
Select the driver, device, and mode of a renderer, finding the drivers first if the game has not.
A mode is matched to the size requested, or the mode of the desktop is taken.
| pDriverGuid | The DirectDraw driver, or nullptr for the default. |
| nWidth | The width of the mode, or 0. |
| nHeight | The height of the mode, or 0. |
| nBitDepth | The bits of a pixel of the mode, or 0. |
| pSurfaceFormat | The format of the surfaces, or nullptr. |
| pDeviceGuid | The Direct3D device, or nullptr for the default. |
| bMatchMode | Whether a mode is matched to the size rather than taken from the desktop. |
| ppDriver | Receives the driver. |
| ppMode | Receives the mode. |
| ppDevice | Receives the device. |
| HRESULT EnsureDirectDrawDriversEnumerated | ( | void | ) |
Find the DirectDraw drivers and their devices and modes, once.
| bool SelectDeviceAndDisplayMode | ( | DirectDrawDriver * | pDriver, |
| GUID * | pDeviceGuid, | ||
| int | nWidth, | ||
| int | nHeight, | ||
| int | nBitDepth, | ||
| void * | pSurfaceFormat, | ||
| DisplayMode ** | ppMode, | ||
| D3DDeviceNode ** | ppDevice ) |
Select a device of a driver and a mode that matches a size.
| pDriver | The driver. |
| pDeviceGuid | The Direct3D device, or nullptr for the default. |
| nWidth | The width of the mode. |
| nHeight | The height of the mode. |
| nBitDepth | The bits of a pixel of the mode. |
| pSurfaceFormat | The format of the surfaces, or nullptr. |
| ppMode | Receives the mode. |
| ppDevice | Receives the device. |
| bool FindDesktopDisplayModeAndDevice | ( | DirectDrawDriver * | pDriver, |
| GUID * | pDeviceGuid, | ||
| DisplayMode ** | ppMode, | ||
| D3DDeviceNode ** | ppDevice ) |
Select a device of a driver and the mode of the desktop.
| pDriver | The driver. |
| pDeviceGuid | The Direct3D device, or nullptr for the default. |
| ppMode | Receives the mode. |
| ppDevice | Receives the device. |
| D3DDeviceNode * ResolveRenderDeviceOrFind | ( | DirectDrawDriver * | pDriver, |
| GUID * | pDeviceGuid, | ||
| DisplayMode * | pMode ) |
Resolve a device by GUID and optional display mode, using the reported fallback on failure.
| int DDBDToBitDepth | ( | DWORD | dwMask | ) |
The bits of a depth from the DDBD_ flags of the depths.
| dwMask | The flags of the depths, of which the shallowest counts. |
| DWORD BitDepthToDDBD | ( | int | nBitDepth | ) |
The DDBD_ flag of a depth.
| nBitDepth | The bits, 1, 2, 4, 8, 16, 24, or 32. |
| HRESULT WINAPI EnumDisplayModesCallback_AddMode | ( | DDSURFACEDESC * | pDesc, |
| LPVOID | pContext ) |
Record a display mode of a driver that DirectDraw reports.
| pDesc | The description of the mode. |
| pContext | The DriverEnumContext of the search. |
| HRESULT WINAPI EnumDeviceTextureFormatsCallback_AddFormat | ( | DDSURFACEDESC * | pDesc, |
| LPVOID | pContext ) |
Record a texture format of a device that Direct3D reports.
| pDesc | The description of the format. |
| pContext | The DriverEnumContext of the search. |
| HRESULT WINAPI EnumD3DDevicesCallback | ( | GUID * | pGuid, |
| LPSTR | pszDescription, | ||
| LPSTR | pszName, | ||
| D3DDEVICEDESC * | pHardwareDesc, | ||
| D3DDEVICEDESC * | pSoftwareDesc, | ||
| LPVOID | pContext ) |
Record a Direct3D device of a driver that Direct3D reports.
| pGuid | The GUID of the device. |
| pszDescription | The description of the device. |
| pszName | The name of the device. |
| pHardwareDesc | What the hardware of the device does. |
| pSoftwareDesc | What the emulation of the device does. |
| pContext | The DriverEnumContext of the search. |
| BOOL WINAPI EnumDirectDrawDriversCallback | ( | GUID * | pGuid, |
| LPSTR | pszDescription, | ||
| LPSTR | pszName, | ||
| LPVOID | pContext ) |
Record a DirectDraw driver that DirectDraw reports.
| pGuid | The GUID of the driver, or nullptr for the primary. |
| pszDescription | The description of the driver. |
| pszName | The name of the driver. |
| pContext | The DriverEnumContext of the search. |
| HRESULT EnumerateDirectDrawDrivers | ( | void | ) |
Find the DirectDraw drivers and their devices and modes.
| void QueryD3DDeviceCaps | ( | IDirect3DDevice2 * | pD3DDevice | ) |
Read what a Direct3D device can do.
| pD3DDevice | The device. |
| void EnumerateTextureFormats | ( | IDirect3DDevice2 * | pD3DDevice | ) |
Find the texture formats of a Direct3D device for each entry of g_aTexturePixelFormats, at most 8 bits a pixel first, then 16, then 32 when no format of 16 bits was found.
| pD3DDevice | The device. |
| bool IsPixelFormatPalettized | ( | const DDPIXELFORMAT * | pFormat | ) |
Whether a pixel format indexes a palette of 1, 2, 4, or 8 bits.
| pFormat | The pixel format, or nullptr. |
| DisplayMode * FindDisplayModeWithFallback | ( | DirectDrawDriver * | pDriver, |
| int | nWidth, | ||
| int | nHeight, | ||
| int | nBitDepth, | ||
| int | nUnknown, | ||
| D3DDeviceNode * | pDevice ) |
Find a mode of a driver for a size and a depth, for a device.
| pDriver | The driver. |
| nWidth | The width of the mode. |
| nHeight | The height of the mode. |
| nBitDepth | The bits of a pixel of the mode. |
| nUnknown | The fourth value of the display mode, 0 from some callers. Its meaning is not recovered yet. |
| pDevice | The device, or nullptr. |
| void PresentFrameCallback_FlipSurfaces | ( | void | ) |
Flip the frame of the main window.
|
inlinestatic |
The renderer a window stores, set by AttachRenderDeviceToWindow().
| hWnd | The window. |
| DirectDrawDriver * FindDisplayDeviceByGuid | ( | GUID * | pGuid | ) |
| bool ApplySelectedDisplayMode | ( | int | nWidth, |
| int | nHeight, | ||
| int | nBitDepth, | ||
| int | nExtra ) |
Move the main window to the DirectDraw driver of g_GlobalRallyConfig when it differs from the driver of the window, in the display mode of the driver nearest a size and a depth.
| nWidth | The width of the display mode. |
| nHeight | The height of the display mode. |
| nBitDepth | The bits of a pixel of the display mode. |
| nExtra | The fourth value of the display mode. |
|
extern |
The host the game draws through.
|
extern |
The Direct3D interface of the renderer that created it last.
|
extern |
The DirectDraw drivers the game found, linked by DirectDrawDriver::pNext.
|
extern |
The Direct3D device of the renderer that created it last.
|
extern |
The textures of Direct3D by identifier.
|
extern |
Whether the DirectDraw drivers were found, in bit 0.
|
extern |
What the hardware of the device created last does.
|
extern |
What the emulation of the device created last does.
|
extern |
The bits of a pixel of the display mode set.
|
extern |
The index in the list of DirectDraw drivers of the driver in use.
|
extern |
The index in the list of DirectDraw drivers of the driver the menu of devices selects.
|
extern |
The DirectDraw driver chosen in the configuration.