From 1690784a8b0c931f082373030664200b2dab90a2 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Sat, 29 Apr 2023 20:39:27 -0700 Subject: [PATCH] fixed inaccurate mxvideoparamflags --- app/isle.cpp | 7 +++-- lib/mxvideoparamflags.h | 65 ++++++++++++++++++----------------------- 2 files changed, 33 insertions(+), 39 deletions(-) diff --git a/app/isle.cpp b/app/isle.cpp index 55dc91aa..06e49b77 100644 --- a/app/isle.cpp +++ b/app/isle.cpp @@ -233,14 +233,15 @@ void Isle::setupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers, m_videoParam.flags().EnableFlipSurfaces(flipSurfaces); m_videoParam.flags().EnableBackBuffers(backBuffers); m_videoParam.flags().EnableUnknown1(param_6); - m_videoParam.flags().EnableUnknown2(TRUE); + m_videoParam.flags().SetUnknown3(param_7); + m_videoParam.flags().EnableUnknown2(); m_videoParam.flags().EnableWideViewAngle(wideViewAngle); m_videoParam.SetDeviceName(deviceId); if (using8bit) { - m_videoParam.flags().Enable16Bit(FALSE); + m_videoParam.flags().Set8Bit(); } if (m_using16bit) { - m_videoParam.flags().Enable16Bit(TRUE); + m_videoParam.flags().Set16Bit(); } } diff --git a/lib/mxvideoparamflags.h b/lib/mxvideoparamflags.h index 192eb397..02b27883 100644 --- a/lib/mxvideoparamflags.h +++ b/lib/mxvideoparamflags.h @@ -10,7 +10,8 @@ class MxVideoParamFlags FLIP_SURFACES = 0x2, BACK_BUFFERS = 0x4, ENABLE_16BIT = 0x20, - WIDE_VIEW_ANGLE = 0x40 + WIDE_VIEW_ANGLE = 0x40, + UNKNOWN3 = 0x80 }; enum HighFlags @@ -23,65 +24,57 @@ class MxVideoParamFlags inline void EnableFullScreen(BOOL e) { - if (e) { - m_flags1 |= FULL_SCREEN; - } else { - m_flags1 &= ~FULL_SCREEN; - } + m_flags1 = (m_flags1 ^ (e << 0)) & FULL_SCREEN ^ m_flags1; } inline void EnableFlipSurfaces(BOOL e) { - if (e) { - m_flags1 |= FLIP_SURFACES; - } else { - m_flags1 &= ~FLIP_SURFACES; - } + m_flags1 = (m_flags1 ^ (e << 1)) & FLIP_SURFACES ^ m_flags1; } inline void EnableBackBuffers(BOOL e) { - if (e) { - m_flags1 |= BACK_BUFFERS; - } else { - m_flags1 &= ~BACK_BUFFERS; - } + m_flags1 = (m_flags1 ^ ((!e) << 2)) & BACK_BUFFERS ^ m_flags1; + } + + inline void SetUnknown3(BOOL e) + { + m_flags1 = (m_flags1 ^ (e << 7)) & UNKNOWN3 ^ m_flags1; + } + + inline void Set8Bit() + { + m_flags1 &= ~ENABLE_16BIT; + } + + inline void Set16Bit() + { + m_flags1 |= ENABLE_16BIT; } inline void Enable16Bit(BOOL e) { - if (e) { - m_flags1 |= ENABLE_16BIT; - } else { - m_flags1 &= ~ENABLE_16BIT; - } + m_flags1 = ((e << 5) ^ m_flags1) & ENABLE_16BIT ^ m_flags1; } inline void EnableWideViewAngle(BOOL e) { - if (e) { - m_flags1 |= WIDE_VIEW_ANGLE; - } else { - m_flags1 &= ~WIDE_VIEW_ANGLE; - } + m_flags1 = (m_flags1 ^ (e << 6)) & WIDE_VIEW_ANGLE ^ m_flags1; } inline void EnableUnknown1(BOOL e) { - if (e) { - m_flags2 |= UNKNOWN1; - } else { - m_flags2 &= ~UNKNOWN1; - } + m_flags2 = (m_flags2 ^ ((!e) << 0)) & UNKNOWN1 ^ m_flags2; } inline void EnableUnknown2(BOOL e) { - if (e) { - m_flags2 |= UNKNOWN2; - } else { - m_flags2 &= ~UNKNOWN2; - } + m_flags2 = (m_flags2 ^ (e << 1)) & UNKNOWN2 ^ m_flags2; + } + + inline void EnableUnknown2() + { + m_flags2 |= UNKNOWN2; } private: