Use bitfield for MxVideoParamFlags (#40)

* Use bitfield for MxVideoParamFlags

Using a bitfield for MxVideoParamFlags results in the same xor/and logic that was partially inlined in the header file. This approach is a lot cleaner and there's a good chance this is what the devs would have landed on.

The code generation is really finicky -- other inlines in the header influence the code just by being there -- so I decided to stub out all of them. This got the match to 100%.

While I was in isle.cpp::SetupVideoFlags, I changed the signature so that the `m_using16bit` parameter is just `using16bit`.

* fix: cast Set16Bit inline arg to byte
This commit is contained in:
MS
2023-06-23 02:00:51 -04:00
committed by GitHub
parent bd245dc6d8
commit 4f4863af6f
4 changed files with 71 additions and 112 deletions

View File

@@ -36,7 +36,7 @@ Isle::Isle()
m_windowActive = 1;
m_videoParam = MxVideoParam(MxRect32(0, 0, 639, 479), NULL, 1, MxVideoParamFlags());
m_videoParam.flags().Enable16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16);
m_videoParam.flags().Set16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16);
m_windowHandle = NULL;
m_cursorArrow = NULL;
@@ -228,22 +228,22 @@ void Isle::LoadConfig()
// OFFSET: ISLE 0x401560
void Isle::SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers,
BOOL using8bit, BOOL m_using16bit, BOOL param_6, BOOL param_7,
BOOL using8bit, BOOL using16bit, BOOL param_6, BOOL param_7,
BOOL wideViewAngle, char *deviceId)
{
m_videoParam.flags().EnableFullScreen(fullScreen);
m_videoParam.flags().EnableFlipSurfaces(flipSurfaces);
m_videoParam.flags().EnableBackBuffers(backBuffers);
m_videoParam.flags().EnableUnknown1(param_6);
m_videoParam.flags().SetUnknown3(param_7);
m_videoParam.flags().EnableWideViewAngle(wideViewAngle);
m_videoParam.flags().EnableUnknown2();
m_videoParam.flags().SetFullScreen(fullScreen);
m_videoParam.flags().SetFlipSurfaces(flipSurfaces);
m_videoParam.flags().SetBackBuffers(!backBuffers);
m_videoParam.flags().Set_f2bit0(!param_6);
m_videoParam.flags().Set_f1bit7(param_7);
m_videoParam.flags().SetWideViewAngle(wideViewAngle);
m_videoParam.flags().Set_f2bit1(1);
m_videoParam.SetDeviceName(deviceId);
if (using8bit) {
m_videoParam.flags().Set8Bit();
m_videoParam.flags().Set16Bit(0);
}
if (m_using16bit) {
m_videoParam.flags().Set16Bit();
if (using16bit) {
m_videoParam.flags().Set16Bit(1);
}
}

View File

@@ -27,7 +27,7 @@ public:
BOOL SetupLegoOmni();
void LoadConfig();
void SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers,
BOOL using8bit, BOOL m_using16bit, BOOL param_6, BOOL param_7,
BOOL using8bit, BOOL using16bit, BOOL param_6, BOOL param_7,
BOOL wideViewAngle, char *deviceId);
void SetupCursor(WPARAM wParam);