isle: Accuracy improvements (#27)

* Isle::Isle 100% accuracy

* Isle::~Isle 100%

* improve accuracy of ReadReg functions

* refactor

* fix Isle::ReadRegBool

* fix Isle::ReadRegInt

* empty commit to reset GH action

* fix Isle::SetupLegoOmni
This commit is contained in:
Christian Semmler 2023-06-21 09:30:46 +02:00 committed by GitHub
parent 6207d1f775
commit 124a5ddaa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 20 deletions

View file

@ -37,13 +37,7 @@ Isle::Isle()
m_frameDelta = 10; m_frameDelta = 10;
m_windowActive = 1; m_windowActive = 1;
MxRect32 rect; m_videoParam = MxVideoParam(MxRect32(0, 0, 639, 479), NULL, 1, MxVideoParamFlags());
rect.m_left = 0;
rect.m_top = 0;
rect.m_right = 639;
rect.m_bottom = 479;
m_videoParam = MxVideoParam(rect, NULL, 1, MxVideoParamFlags());
m_videoParam.flags().Enable16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16); m_videoParam.flags().Enable16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16);
m_windowHandle = NULL; m_windowHandle = NULL;
@ -116,7 +110,7 @@ void Isle::Close()
} }
// OFFSET: ISLE 0x402740 // OFFSET: ISLE 0x402740
BOOL ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize) BOOL Isle::ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize)
{ {
HKEY hKey; HKEY hKey;
DWORD valueType; DWORD valueType;
@ -135,7 +129,7 @@ BOOL ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize)
} }
// OFFSET: ISLE 0x4027b0 // OFFSET: ISLE 0x4027b0
int ReadRegBool(LPCSTR name, BOOL *out) int Isle::ReadRegBool(LPCSTR name, BOOL *out)
{ {
char buffer[256]; char buffer[256];
@ -143,28 +137,30 @@ int ReadRegBool(LPCSTR name, BOOL *out)
if (read) { if (read) {
if (strcmp("YES", buffer) == 0) { if (strcmp("YES", buffer) == 0) {
*out = TRUE; *out = TRUE;
return TRUE; return read;
} }
if (strcmp("NO", buffer) == 0) { if (strcmp("NO", buffer) == 0) {
*out = FALSE; *out = FALSE;
return TRUE; return read;
} }
read = FALSE;
} }
return FALSE; return read;
} }
// OFFSET: ISLE 0x402880 // OFFSET: ISLE 0x402880
int ReadRegInt(LPCSTR name, int *out) int Isle::ReadRegInt(LPCSTR name, int *out)
{ {
char buffer[256]; char buffer[256];
if (ReadReg(name, buffer, sizeof(buffer))) { BOOL read = ReadReg(name, buffer, sizeof(buffer));
if (read) {
*out = atoi(buffer); *out = atoi(buffer);
return TRUE;
} }
return FALSE; return read;
} }
// OFFSET: ISLE 0x4028d0 // OFFSET: ISLE 0x4028d0
@ -256,16 +252,18 @@ void Isle::SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers,
// OFFSET: ISLE 0x4013b0 // OFFSET: ISLE 0x4013b0
BOOL Isle::SetupLegoOmni() BOOL Isle::SetupLegoOmni()
{ {
BOOL result = FALSE;
char mediaPath[256]; char mediaPath[256];
GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath)); GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath));
if (Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags())) != FAILURE) { BOOL failure = Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE;
if (!failure) {
VariableTable()->SetVariable("ACTOR_01", ""); VariableTable()->SetVariable("ACTOR_01", "");
TickleManager()->vtable1c(VideoManager(), 10); TickleManager()->vtable1c(VideoManager(), 10);
return TRUE; result = TRUE;
} }
return FALSE; return result;
} }
// OFFSET: ISLE 0x402e80 // OFFSET: ISLE 0x402e80

View file

@ -12,7 +12,11 @@ class Isle
Isle(); Isle();
~Isle(); ~Isle();
static void Close(); void Close();
BOOL ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize);
int ReadRegBool(LPCSTR name, BOOL *out);
int ReadRegInt(LPCSTR name, int *out);
MxResult SetupWindow(HINSTANCE hInstance); MxResult SetupWindow(HINSTANCE hInstance);

View file

@ -4,6 +4,14 @@
class MxRect32 class MxRect32
{ {
public: public:
MxRect32(int p_left, int p_top, int p_right, int p_bottom)
{
this->m_left = p_left;
this->m_top = p_top;
this->m_right = p_right;
this->m_bottom = p_bottom;
}
int m_left; int m_left;
int m_top; int m_top;
int m_right; int m_right;