fix indents, and globals

This commit is contained in:
Roman Masanin 2023-06-25 20:59:42 +02:00
parent 5a90ca6422
commit de24ebdfc9
2 changed files with 837 additions and 837 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,138 +5,137 @@
#include <ddraw.h> #include <ddraw.h>
#include <Windows.h> #include <Windows.h>
BOOL g_is_PALETTEINDEXED8 = 0; extern BOOL g_is_PALETTEINDEXED8;
BOOL g_isInsideError = FALSE;
//size 0x880 //size 0x880
class MxDirectDraw class MxDirectDraw
{ {
public: public:
typedef void (*ErrorHandler)(const char*, HRESULT, void*); typedef void (*ErrorHandler)(const char*, HRESULT, void*);
//size 0x0c //size 0x0c
struct Mode struct Mode
{
int width;
int height;
int bitsPerPixel;
int operator==(const Mode& rMode) const
{ {
int width; return ((width == rMode.width) &&
int height; (height == rMode.height) &&
int bitsPerPixel; (bitsPerPixel == rMode.bitsPerPixel));
}
};
int operator==(const Mode& rMode) const //size 0x17c
{ struct DeviceModesInfo
return ((width == rMode.width) && {
(height == rMode.height) && GUID* p_guid;
(bitsPerPixel == rMode.bitsPerPixel)); Mode* m_mode_ARRAY;
} int count;
}; DDCAPS_DX5 m_ddcaps;
void* a_178;
//size 0x17c ~DeviceModesInfo()
struct DeviceModesInfo
{ {
GUID* p_guid; if (p_guid != NULL)
Mode* m_mode_ARRAY; {
int count; free(p_guid);
DDCAPS_DX5 m_ddcaps; }
void* a_178;
~DeviceModesInfo() if (m_mode_ARRAY != NULL)
{ {
if (p_guid != NULL) free(m_mode_ARRAY);
{ }
free(p_guid); }
} };
if (m_mode_ARRAY != NULL)
{
free(m_mode_ARRAY);
}
}
};
private: private:
BOOL m_bOnlySoftRender; BOOL m_bOnlySoftRender;
BOOL m_bFlipSurfaces; BOOL m_bFlipSurfaces;
IDirectDraw* m_pDirectDraw; IDirectDraw* m_pDirectDraw;
IDirectDrawSurface* m_pFrontBuffer; IDirectDrawSurface* m_pFrontBuffer;
IDirectDrawSurface* m_pBackBuffer; IDirectDrawSurface* m_pBackBuffer;
IDirectDrawSurface* m_pZBuffer; IDirectDrawSurface* m_pZBuffer;
IDirectDrawSurface* m_pText1Surface; IDirectDrawSurface* m_pText1Surface;
IDirectDrawSurface* m_pText2Surface; IDirectDrawSurface* m_pText2Surface;
IDirectDrawClipper* m_pClipper; IDirectDrawClipper* m_pClipper;
IDirectDrawPalette* m_pPalette; IDirectDrawPalette* m_pPalette;
PALETTEENTRY m_paletteEntries[256]; PALETTEENTRY m_paletteEntries[256];
PALETTEENTRY m_originalPaletteEntries[256]; PALETTEENTRY m_originalPaletteEntries[256];
SIZE m_text1SizeOnSurface; SIZE m_text1SizeOnSurface;
SIZE m_text2SizeOnSurface; SIZE m_text2SizeOnSurface;
HWND m_hWndMain; HWND m_hWndMain;
HFONT m_hFont; HFONT m_hFont;
BOOL m_bIgnoreWM_SIZE; BOOL m_bIgnoreWM_SIZE;
BOOL m_bPrimaryPalettized; BOOL m_bPrimaryPalettized;
BOOL m_bFullScreen; BOOL m_bFullScreen;
void* a_850; void* a_850;
BOOL m_bOnlySystemMemory; BOOL m_bOnlySystemMemory;
BOOL m_bIsOnPrimaryDevice; BOOL m_bIsOnPrimaryDevice;
ErrorHandler m_pErrorHandler; ErrorHandler m_pErrorHandler;
ErrorHandler m_pFatalErrorHandler; ErrorHandler m_pFatalErrorHandler;
void* m_pErrorHandlerArg; void* m_pErrorHandlerArg;
void* m_pFatalErrorHandlerArg; void* m_pFatalErrorHandlerArg;
int m_pauseCount; int m_pauseCount;
DeviceModesInfo* m_pCurrentDeviceModesList; DeviceModesInfo* m_pCurrentDeviceModesList;
Mode m_currentMode; Mode m_currentMode;
public: public:
__declspec(dllexport) int FlipToGDISurface(); __declspec(dllexport) int FlipToGDISurface();
__declspec(dllexport) static int GetPrimaryBitDepth(); __declspec(dllexport) static int GetPrimaryBitDepth();
__declspec(dllexport) int Pause(int); __declspec(dllexport) int Pause(int);
MxDirectDraw(); MxDirectDraw();
virtual ~MxDirectDraw(); virtual ~MxDirectDraw();
virtual BOOL Create( virtual BOOL Create(
HWND hWnd, HWND hWnd,
BOOL fullscreen_1, BOOL fullscreen_1,
BOOL surface_fullscreen, BOOL surface_fullscreen,
BOOL onlySystemMemory, BOOL onlySystemMemory,
int width, int width,
int height, int height,
int bpp, int bpp,
const PALETTEENTRY* pPaletteEntries, const PALETTEENTRY* pPaletteEntries,
int paletteEntryCount); int paletteEntryCount);
virtual void Destroy(); virtual void Destroy();
virtual void DestroyButNotDirectDraw(); virtual void DestroyButNotDirectDraw();
virtual const char* ErrorToString(HRESULT error); virtual const char* ErrorToString(HRESULT error);
private: private:
BOOL CacheOriginalPaletteEntries(); BOOL CacheOriginalPaletteEntries();
HRESULT CreateDDSurface( HRESULT CreateDDSurface(
LPDDSURFACEDESC a2, LPDDSURFACEDESC a2,
LPDIRECTDRAWSURFACE* a3, LPDIRECTDRAWSURFACE* a3,
IUnknown* a4); IUnknown* a4);
BOOL CreateTextSurfaces(); BOOL CreateTextSurfaces();
BOOL CreateZBuffer(DWORD memorytype, DWORD depth); BOOL CreateZBuffer(DWORD memorytype, DWORD depth);
BOOL DDCreateSurfaces(); BOOL DDCreateSurfaces();
BOOL DDInit(BOOL fullscreen); BOOL DDInit(BOOL fullscreen);
BOOL DDSetMode(int width, int height, int bpp); BOOL DDSetMode(int width, int height, int bpp);
void Error(const char* message, int error); void Error(const char* message, int error);
BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf); BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf);
BOOL IsSupportedMode(int width, int height, int bpp); BOOL IsSupportedMode(int width, int height, int bpp);
BOOL RecreateDirectDraw(GUID** a2); BOOL RecreateDirectDraw(GUID** a2);
BOOL RestoreOriginalPaletteEntries(); BOOL RestoreOriginalPaletteEntries();
BOOL RestorePaletteEntries(); BOOL RestorePaletteEntries();
BOOL RestoreSurfaces(); BOOL RestoreSurfaces();
BOOL SetPaletteEntries( BOOL SetPaletteEntries(
const PALETTEENTRY* pPaletteEntries, const PALETTEENTRY* pPaletteEntries,
int paletteEntryCount, int paletteEntryCount,
BOOL fullscreen); BOOL fullscreen);
BOOL TextToTextSurface( BOOL TextToTextSurface(
const char* text, const char* text,
IDirectDrawSurface* pSurface, IDirectDrawSurface* pSurface,
SIZE& textSizeOnSurface); SIZE& textSizeOnSurface);
BOOL TextToTextSurface1(const char* text); BOOL TextToTextSurface1(const char* text);
BOOL TextToTextSurface2(const char* lpString); BOOL TextToTextSurface2(const char* lpString);
void unk1(); void unk1();
void unk2(); void unk2();
}; };
#endif // MXDIRECTDRAW_H #endif // MXDIRECTDRAW_H