2023-04-27 22:19:39 -04:00
|
|
|
#ifndef MXDIRECTDRAW_H
|
|
|
|
#define MXDIRECTDRAW_H
|
|
|
|
|
2023-12-13 05:48:14 -05:00
|
|
|
#include "mxtypes.h"
|
|
|
|
|
2023-08-03 13:09:22 -04:00
|
|
|
#include <ddraw.h>
|
2023-08-06 16:26:14 -04:00
|
|
|
#include <windows.h>
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// VTABLE: LEGO1 0x100db818
|
2023-08-06 16:26:14 -04:00
|
|
|
// SIZE 0x880
|
2023-10-24 19:38:27 -04:00
|
|
|
class MxDirectDraw {
|
2023-08-03 13:09:22 -04:00
|
|
|
public:
|
2023-10-24 19:38:27 -04:00
|
|
|
typedef void (*ErrorHandler)(const char*, HRESULT, void*);
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
// size 0x0c
|
|
|
|
struct Mode {
|
2023-12-13 05:48:14 -05:00
|
|
|
MxS32 m_width;
|
|
|
|
MxS32 m_height;
|
|
|
|
MxS32 m_bitsPerPixel;
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-12-13 05:48:14 -05:00
|
|
|
MxS32 operator==(const Mode& p_mode) const
|
2023-10-24 19:38:27 -04:00
|
|
|
{
|
2023-12-13 05:48:14 -05:00
|
|
|
return (
|
|
|
|
(m_width == p_mode.m_width) && (m_height == p_mode.m_height) &&
|
|
|
|
(m_bitsPerPixel == p_mode.m_bitsPerPixel)
|
|
|
|
);
|
2023-10-24 19:38:27 -04:00
|
|
|
}
|
|
|
|
};
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-12-13 05:48:14 -05:00
|
|
|
// SIZE 0x17c
|
2023-10-24 19:38:27 -04:00
|
|
|
struct DeviceModesInfo {
|
2023-12-13 05:48:14 -05:00
|
|
|
GUID* m_guid;
|
|
|
|
Mode* m_modeArray;
|
|
|
|
MxS32 m_count;
|
2023-10-24 19:38:27 -04:00
|
|
|
DDCAPS m_ddcaps;
|
2023-12-13 05:48:14 -05:00
|
|
|
void* m_unk0x178;
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
DeviceModesInfo();
|
|
|
|
~DeviceModesInfo();
|
|
|
|
};
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-09-10 08:56:16 -04:00
|
|
|
protected:
|
2023-10-24 19:38:27 -04:00
|
|
|
BOOL m_bOnlySoftRender;
|
|
|
|
BOOL m_bFlipSurfaces;
|
|
|
|
IDirectDraw* m_pDirectDraw;
|
|
|
|
IDirectDrawSurface* m_pFrontBuffer;
|
|
|
|
IDirectDrawSurface* m_pBackBuffer;
|
|
|
|
IDirectDrawSurface* m_pZBuffer;
|
|
|
|
IDirectDrawSurface* m_pText1Surface;
|
|
|
|
IDirectDrawSurface* m_pText2Surface;
|
|
|
|
IDirectDrawClipper* m_pClipper;
|
|
|
|
IDirectDrawPalette* m_pPalette;
|
|
|
|
PALETTEENTRY m_paletteEntries[256];
|
|
|
|
PALETTEENTRY m_originalPaletteEntries[256];
|
|
|
|
SIZE m_text1SizeOnSurface;
|
|
|
|
SIZE m_text2SizeOnSurface;
|
|
|
|
HWND m_hWndMain;
|
|
|
|
HFONT m_hFont;
|
2023-12-13 05:48:14 -05:00
|
|
|
BOOL m_bIgnoreWMSIZE;
|
2023-10-24 19:38:27 -04:00
|
|
|
BOOL m_bPrimaryPalettized;
|
|
|
|
BOOL m_bFullScreen;
|
2023-12-13 05:48:14 -05:00
|
|
|
void* m_unk0x850;
|
2023-10-24 19:38:27 -04:00
|
|
|
BOOL m_bOnlySystemMemory;
|
|
|
|
BOOL m_bIsOnPrimaryDevice;
|
|
|
|
ErrorHandler m_pErrorHandler;
|
|
|
|
ErrorHandler m_pFatalErrorHandler;
|
|
|
|
void* m_pErrorHandlerArg;
|
|
|
|
void* m_pFatalErrorHandlerArg;
|
|
|
|
int m_pauseCount;
|
|
|
|
DeviceModesInfo* m_pCurrentDeviceModesList;
|
|
|
|
Mode m_currentMode;
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-04-27 22:19:39 -04:00
|
|
|
public:
|
2023-10-24 19:38:27 -04:00
|
|
|
__declspec(dllexport) int FlipToGDISurface();
|
|
|
|
__declspec(dllexport) static int GetPrimaryBitDepth();
|
|
|
|
__declspec(dllexport) int Pause(int);
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
MxDirectDraw();
|
|
|
|
virtual ~MxDirectDraw();
|
2024-01-01 19:17:38 -05:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
virtual BOOL Create(
|
|
|
|
HWND hWnd,
|
|
|
|
BOOL fullscreen_1,
|
|
|
|
BOOL surface_fullscreen,
|
|
|
|
BOOL onlySystemMemory,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int bpp,
|
|
|
|
const PALETTEENTRY* pPaletteEntries,
|
|
|
|
int paletteEntryCount
|
2024-01-01 19:17:38 -05:00
|
|
|
); // vtable+0x04
|
|
|
|
virtual void Destroy(); // vtable+0x08
|
|
|
|
virtual void DestroyButNotDirectDraw(); // vtable+0x0c
|
|
|
|
virtual const char* ErrorToString(HRESULT p_error); // vtable+0x10
|
|
|
|
|
|
|
|
inline IDirectDraw* GetDirectDraw() { return m_pDirectDraw; }
|
|
|
|
inline IDirectDrawSurface* GetFrontBuffer() { return m_pFrontBuffer; }
|
|
|
|
inline IDirectDrawSurface* GetBackBuffer() { return m_pBackBuffer; }
|
|
|
|
inline IDirectDrawClipper* GetClipper() { return m_pClipper; }
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-09-10 08:56:16 -04:00
|
|
|
protected:
|
2023-10-24 19:38:27 -04:00
|
|
|
BOOL CacheOriginalPaletteEntries();
|
|
|
|
HRESULT CreateDDSurface(LPDDSURFACEDESC a2, LPDIRECTDRAWSURFACE* a3, IUnknown* a4);
|
|
|
|
BOOL CreateTextSurfaces();
|
|
|
|
BOOL CreateZBuffer(DWORD memorytype, DWORD depth);
|
|
|
|
BOOL DDCreateSurfaces();
|
|
|
|
BOOL DDInit(BOOL fullscreen);
|
|
|
|
BOOL DDSetMode(int width, int height, int bpp);
|
2023-12-13 05:48:14 -05:00
|
|
|
void Error(const char* p_message, MxS32 p_error);
|
2023-08-03 13:09:22 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf);
|
|
|
|
BOOL IsSupportedMode(int width, int height, int bpp);
|
|
|
|
BOOL RecreateDirectDraw(GUID** a2);
|
|
|
|
BOOL RestoreOriginalPaletteEntries();
|
|
|
|
BOOL RestorePaletteEntries();
|
|
|
|
BOOL RestoreSurfaces();
|
|
|
|
BOOL SetPaletteEntries(const PALETTEENTRY* pPaletteEntries, int paletteEntryCount, BOOL fullscreen);
|
|
|
|
BOOL TextToTextSurface(const char* text, IDirectDrawSurface* pSurface, SIZE& textSizeOnSurface);
|
|
|
|
BOOL TextToTextSurface1(const char* text);
|
|
|
|
BOOL TextToTextSurface2(const char* lpString);
|
2023-12-13 05:48:14 -05:00
|
|
|
void FUN_1009e020();
|
|
|
|
void FUN_1009d920();
|
2023-04-27 22:19:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MXDIRECTDRAW_H
|