Add GetDeviceModeFinder to WndProc (#102)

This commit is contained in:
Christian Semmler 2023-08-06 16:26:14 -04:00 committed by GitHub
parent b59d8ef5cf
commit d41b7f2ca4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 13 deletions

View file

@ -357,7 +357,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return DefWindowProcA(hWnd, uMsg, wParam, lParam); return DefWindowProcA(hWnd, uMsg, wParam, lParam);
case WM_DISPLAYCHANGE: case WM_DISPLAYCHANGE:
if (g_isle && VideoManager() && g_isle->m_fullScreen && VideoManager()->m_unk74 && VideoManager()->m_unk74[0x220]) { if (g_isle && VideoManager() && g_isle->m_fullScreen && VideoManager()->GetDirect3D() && VideoManager()->GetDirect3D()->GetDeviceModeFinder()) {
int targetWidth = LOWORD(lParam); int targetWidth = LOWORD(lParam);
int targetHeight = HIWORD(lParam); int targetHeight = HIWORD(lParam);
int targetDepth = wParam; int targetDepth = wParam;

View file

@ -2,7 +2,9 @@
#define LEGOVIDEOMANAGER_H #define LEGOVIDEOMANAGER_H
#include "mxvideomanager.h" #include "mxvideomanager.h"
#include "mxdirect3d.h"
#include "lego3dmanager.h" #include "lego3dmanager.h"
#include "decomp.h"
// VTABLE 0x100d9c88 // VTABLE 0x100d9c88
// SIZE 0x590 // SIZE 0x590
@ -18,13 +20,16 @@ class LegoVideoManager : public MxVideoManager
__declspec(dllexport) void MoveCursor(int x, int y); __declspec(dllexport) void MoveCursor(int x, int y);
inline Lego3DManager *Get3DManager() { return this->m_3dManager; } inline Lego3DManager *Get3DManager() { return this->m_3dManager; }
inline MxDirect3D *GetDirect3D() { return this->m_direct3d; }
void SetSkyColor(float r, float g, float b); void SetSkyColor(float r, float g, float b);
int m_unk64; private:
undefined4 m_unk64;
Lego3DManager *m_3dManager; Lego3DManager *m_3dManager;
int m_unk6c; undefined4 m_unk6c;
int m_unk70; undefined4 m_unk70;
int *m_unk74; MxDirect3D *m_direct3d;
}; };
#endif // LEGOVIDEOMANAGER_H #endif // LEGOVIDEOMANAGER_H

View file

@ -0,0 +1,25 @@
#ifndef MXDIRECT3D_H
#define MXDIRECT3D_H
#include "mxdirectdraw.h"
#include "decomp.h"
#include <d3d.h>
class MxDeviceModeFinder;
// SIZE 0x894
class MxDirect3D : public MxDirectDraw
{
public:
inline MxDeviceModeFinder *GetDeviceModeFinder() { return this->m_pDeviceModeFinder; };
private:
MxDeviceModeFinder *m_pDeviceModeFinder;
IDirect3D *m_pDirect3d;
IDirect3DDevice *m_pDirect3dDevice;
undefined4 m_unk88c;
undefined4 m_unk890;
};
#endif // MXDIRECT3D_H

View file

@ -2,6 +2,7 @@
#include "mxdirectdraw.h" #include "mxdirectdraw.h"
#include "decomp.h" #include "decomp.h"
DECOMP_SIZE_ASSERT(MxDirectDraw, 0x880);
#ifndef DDSCAPS_3DDEVICE #ifndef DDSCAPS_3DDEVICE
#define DDSCAPS_3DDEVICE 0x00002000l #define DDSCAPS_3DDEVICE 0x00002000l
@ -100,7 +101,7 @@ int MxDirectDraw::GetPrimaryBitDepth()
dwRGBBitCount = ddsd.ddpfPixelFormat.dwRGBBitCount; dwRGBBitCount = ddsd.ddpfPixelFormat.dwRGBBitCount;
g_is_PALETTEINDEXED8 = (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) != 0; g_is_PALETTEINDEXED8 = (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) != 0;
pDDraw->Release(); pDDraw->Release();
} }
return dwRGBBitCount; return dwRGBBitCount;
} }
@ -738,7 +739,7 @@ BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp)
EnableResizing(m_hWndMain, FALSE); EnableResizing(m_hWndMain, FALSE);
if (!m_bIsOnPrimaryDevice) if (!m_bIsOnPrimaryDevice)
{ {
lpDD = NULL; lpDD = NULL;
result = DirectDrawCreate(0, &lpDD, 0); result = DirectDrawCreate(0, &lpDD, 0);
@ -1096,7 +1097,7 @@ BOOL MxDirectDraw::SetPaletteEntries(
if (m_pPalette != NULL) if (m_pPalette != NULL)
{ {
HRESULT result; HRESULT result;
result = m_pPalette->SetEntries(0, 0, _countof(m_paletteEntries), m_paletteEntries); result = m_pPalette->SetEntries(0, 0, _countof(m_paletteEntries), m_paletteEntries);
if (result != DD_OK) if (result != DD_OK)
{ {
@ -1194,13 +1195,12 @@ void MxDirectDraw::FUN_1009E020()
line = (byte*)ddsd.lpSurface; line = (byte*)ddsd.lpSurface;
for (j = ddsd.dwHeight; j-- ;) for (j = ddsd.dwHeight; j-- ;)
{ {
memset(line, 0, ddsd.dwWidth); memset(line, 0, ddsd.dwWidth);
line += ddsd.lPitch; line += ddsd.lPitch;
} }
m_pBackBuffer->Unlock(ddsd.lpSurface); m_pBackBuffer->Unlock(ddsd.lpSurface);
if (m_bFlipSurfaces) if (m_bFlipSurfaces)
{ {
m_pFrontBuffer->Flip(NULL, DDFLIP_WAIT); m_pFrontBuffer->Flip(NULL, DDFLIP_WAIT);

View file

@ -3,11 +3,11 @@
#define MXDIRECTDRAW_H #define MXDIRECTDRAW_H
#include <ddraw.h> #include <ddraw.h>
#include <Windows.h> #include <windows.h>
extern BOOL g_is_PALETTEINDEXED8; extern BOOL g_is_PALETTEINDEXED8;
//size 0x880 // SIZE 0x880
class MxDirectDraw class MxDirectDraw
{ {
public: public: