commit 37100bf9c139155ead730ad9acfaf4cea7cdde4b Author: itsmattkc Date: Thu Apr 27 19:19:39 2023 -0700 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c509ad24 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Release/ diff --git a/app/define.cpp b/app/define.cpp new file mode 100644 index 00000000..09b3f25c --- /dev/null +++ b/app/define.cpp @@ -0,0 +1,14 @@ +#include "define.h" + +Isle *g_isle = 0; +int g_closed = 0; + +const char *WNDCLASS_NAME = "Lego Island MainNoM App"; +const char *WINDOW_TITLE = "LEGO®"; + +unsigned char g_mousedown = 0; +unsigned char g_mousemoved = 0; +int _DAT_00410050 = 0; +int _DAT_00410064 = 0; +int _DAT_004101bc = 200; +int _last_frame_time = 0; diff --git a/app/define.h b/app/define.h new file mode 100644 index 00000000..45522c2c --- /dev/null +++ b/app/define.h @@ -0,0 +1,17 @@ +#ifndef DEFINE_H +#define DEFINE_H + +class Isle; + +extern Isle *g_isle; +extern int g_closed; +extern const char *WNDCLASS_NAME; +extern const char *WINDOW_TITLE; +extern unsigned char g_mousedown; +extern unsigned char g_mousemoved; +extern int _DAT_00410050; +extern int _DAT_00410064; +extern int _DAT_004101bc; +extern int _last_frame_time; + +#endif // DEFINE_H diff --git a/app/isle.cpp b/app/isle.cpp new file mode 100644 index 00000000..bfaadc8c --- /dev/null +++ b/app/isle.cpp @@ -0,0 +1,603 @@ +#include "isle.h" + +#include "define.h" +#include "../lib/legoomni.h" +#include "../lib/mxdirectdraw.h" +#include "../lib/mxdsaction.h" +#include "../lib/mxomni.h" + +RECT windowRect = {0, 0, 640, 480}; + +Isle::Isle() +{ + m_hdPath = NULL; + m_cdPath = NULL; + m_deviceId = NULL; + m_savePath = NULL; + m_fullScreen = 1; + m_flipSurfaces = 0; + m_backBuffersInVram = 1; + m_using8bit = 0; + m_using16bit = 1; + m_unk24 = 0; + m_drawCursor = 0; + m_use3dSound = 1; + m_useMusic = 1; + m_useJoystick = 0; + m_joystickIndex = 0; + m_wideViewAngle = 1; + m_islandQuality = 1; + m_islandTexture = 1; + m_gameStarted = 0; + m_frameDelta = 10; + m_windowActive = 1; + + MxRect32 rect; + 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_windowHandle = NULL; + m_cursor1 = NULL; + m_cursor2 = NULL; + m_cursor3 = NULL; + m_cursor4 = NULL; + + LegoOmni::CreateInstance(); +} + +Isle::~Isle() +{ + if (LegoOmni::GetInstance()) { + close(); + MxOmni::DestroyInstance(); + } + + if (m_hdPath) { + delete [] m_hdPath; + } + + if (m_cdPath) { + delete [] m_cdPath; + } + + if (m_deviceId) { + delete [] m_deviceId; + } + + if (m_savePath) { + delete [] m_savePath; + } +} + +void Isle::close() +{ + MxDSAction ds; + + if (Lego()) { + GameState()->Save(0); + if (InputManager()) { + InputManager()->QueueEvent(KEYDOWN, 0, 0, 0, 0x20); + } + + // FIXME: Untangle + //VideoManager()->GetViewManager()->RemoveAll(NULL); + //ViewManager::RemoveAll + // (*(ViewManager **)(*(int *)(*(int *)(pLVar4 + 0x68) + 8) + 0x88), NULL); + + MxAtomId id; + long local_88 = 0; + Lego()->RemoveWorld(id, local_88); + Lego()->vtable24(ds); + TransitionManager()->SetWaitIndicator(NULL); + Lego()->vtable3c(); + + long lVar8; + do { + lVar8 = Streamer()->Close(NULL); + } while (lVar8 == 0); + + while (Lego()) { + if (Lego()->vtable28(ds) != 0) { + break; + } + + Timer()->GetRealTime(); + TickleManager()->vtable08(); + } + } +} + +BOOL readReg(LPCSTR name, LPSTR outValue, DWORD outSize) +{ + HKEY hKey; + DWORD valueType; + + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Mindscape\\LEGO Island", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { + if (RegQueryValueExA(hKey, name, NULL, &valueType, (LPBYTE) outValue, &outSize) == ERROR_SUCCESS) { + if (RegCloseKey(hKey) == ERROR_SUCCESS) { + return TRUE; + } + } + } + + return FALSE; +} + +int readRegBool(LPCSTR name, BOOL *out) +{ + char buffer[256]; + + BOOL read = readReg(name, buffer, 0x100); + if (read) { + if (strcmp("YES", buffer) == 0) { + *out = TRUE; + return TRUE; + } + + if (strcmp("NO", buffer) == 0) { + *out = FALSE; + return TRUE; + } + } + return FALSE; +} + +int readRegInt(LPCSTR name, int *out) +{ + char buffer[256]; + + if (readReg(name, buffer, 0x100)) { + *out = atoi(buffer); + return TRUE; + } + + return FALSE; +} + +void Isle::loadConfig() +{ + char buffer[256]; + + if (!readReg("diskpath", buffer, 0x400)) { + strcpy(buffer, MxOmni::GetHD()); + } + + m_hdPath = new char[strlen(buffer) + 1]; + strcpy(m_hdPath, buffer); + MxOmni::SetHD(m_hdPath); + + if (!readReg("cdpath", buffer, 0x400)) { + strcpy(buffer, MxOmni::GetCD()); + } + + m_cdPath = new char[strlen(buffer) + 1]; + strcpy(m_cdPath, buffer); + MxOmni::SetCD(m_cdPath); + + readRegBool("Flip Surfaces", &m_flipSurfaces); + readRegBool("Full Screen", &m_fullScreen); + readRegBool("Wide View Angle", &m_wideViewAngle); + readRegBool("3DSound", &m_use3dSound); + readRegBool("Music", &m_useMusic); + readRegBool("UseJoystick", &m_useJoystick); + readRegInt("JoystickIndex", &m_joystickIndex); + readRegBool("Draw Cursor", &m_drawCursor); + + int backBuffersInVRAM; + if (readRegBool("Back Buffers in Video RAM",&backBuffersInVRAM)) { + m_backBuffersInVram = !backBuffersInVRAM; + } + + int bitDepth; + if (readRegInt("Display Bit Depth", &bitDepth)) { + if (bitDepth == 8) { + m_using8bit = TRUE; + } else if (bitDepth == 16) { + m_using16bit = TRUE; + } + } + + if (!readReg("Island Quality", buffer, 0x400)) { + strcpy(buffer, "1"); + } + m_islandQuality = atoi(buffer); + + if (!readReg("Island Texture", buffer, 0x400)) { + strcpy(buffer, "1"); + } + m_islandTexture = atoi(buffer); + + if (readReg("3D Device ID", buffer, 0x400)) { + m_deviceId = new char[strlen(buffer) + 1]; + strcpy(m_deviceId, buffer); + } + + if (readReg("savepath", buffer, 0x400)) { + m_savePath = new char[strlen(buffer) + 1]; + strcpy(m_savePath, buffer); + } +} + +void Isle::setupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers, + BOOL using8bit, BOOL m_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().EnableUnknown2(TRUE); + m_videoParam.flags().EnableWideViewAngle(wideViewAngle); + m_videoParam.SetDeviceName(deviceId); + if (using8bit) { + m_videoParam.flags().Enable16Bit(FALSE); + } + if (m_using16bit) { + m_videoParam.flags().Enable16Bit(TRUE); + } +} + +BOOL Isle::setupMediaPath() +{ + char mediaPath[256]; + GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, 0x100); + + MxOmniCreateParam createParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags()); + + if (Lego()->Create(createParam) != FAILURE) { + VariableTable()->SetVariable("ACTOR_01", ""); + TickleManager()->vtable1c(VideoManager(), 10); + return TRUE; + } + + return FALSE; +} + +LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (!g_isle) { + return DefWindowProcA(hWnd, uMsg, wParam, lParam); + } + + switch (uMsg) { + case WM_PAINT: + return DefWindowProcA(hWnd, WM_PAINT, wParam, lParam); + case WM_ACTIVATE: + return DefWindowProcA(hWnd, WM_ACTIVATE, wParam, lParam); + case WM_ACTIVATEAPP: + if (g_isle) { + if ((wParam != 0) && (g_isle->m_fullScreen)) { + MoveWindow(hWnd, windowRect.left, windowRect.top, + (windowRect.right - windowRect.left) + 1, + (windowRect.bottom - windowRect.top) + 1, TRUE); + } + // FIXME: Untangle + //g_isle->m_windowActive = wParam; + } + return DefWindowProcA(hWnd,WM_ACTIVATEAPP,wParam,lParam); + case WM_CLOSE: + if (!g_closed && g_isle) { + if (g_isle) { + delete g_isle; + } + g_isle = NULL; + g_closed = TRUE; + return 0; + } + return DefWindowProcA(hWnd,WM_CLOSE,wParam,lParam); + case WM_GETMINMAXINFO: + { + MINMAXINFO *mmi = (MINMAXINFO *) lParam; + + mmi->ptMaxTrackSize.x = (windowRect.right - windowRect.left) + 1; + mmi->ptMaxTrackSize.y = (windowRect.bottom - windowRect.top) + 1; + mmi->ptMinTrackSize.x = (windowRect.right - windowRect.left) + 1; + mmi->ptMinTrackSize.y = (windowRect.bottom - windowRect.top) + 1; + + return 0; + } + case WM_ENTERMENULOOP: + return DefWindowProcA(hWnd,WM_ENTERMENULOOP,wParam,lParam); + case WM_SYSCOMMAND: + if (wParam == 0xf140) { + return 0; + } + if (wParam == 0xf060 && g_closed == 0) { + if (g_isle) { + if (_DAT_00410050 != 0) { + ShowWindow(g_isle->m_windowHandle, SW_RESTORE); + } + PostMessageA(g_isle->m_windowHandle, 0x10, 0, 0); + return 0; + } + } else if (g_isle && g_isle->m_fullScreen && (wParam == 0xf010 || wParam == 0xf100)) { + return 0; + } + return DefWindowProcA(hWnd,WM_SYSCOMMAND,wParam,lParam); + case WM_EXITMENULOOP: + return DefWindowProcA(hWnd,WM_EXITMENULOOP,wParam,lParam); + case WM_MOVING: + if (g_isle && g_isle->m_fullScreen) { + GetWindowRect(hWnd, (LPRECT) lParam); + return 0; + } + return DefWindowProcA(hWnd,WM_MOVING,wParam,lParam); + case WM_NCPAINT: + if (g_isle && g_isle->m_fullScreen) { + return 0; + } + return DefWindowProcA(hWnd, WM_NCPAINT, wParam, lParam); + case WM_DISPLAYCHANGE: + /* FIXME: Untangle + if (g_isle && VideoManager() && g_isle->m_fullScreen && ((pLVar7 = VideoManager(), *(int *)(pLVar7 + 0x74) != 0 && (pLVar7 = VideoManager(), *(int *)(*(int *)(pLVar7 + 0x74) + 0x880) != 0))) { + if (_DAT_00410054 == 0) { + unsigned char bVar1 = FALSE; + if (LOWORD(lParam) == _DAT_00410058 && HIWORD(lParam) == _DAT_0041005c && _DAT_00410060 == wParam) { + bVar1 = TRUE; + } + if (_DAT_00410050 == 0) { + if (!bVar1) { + _DAT_00410050 = 1; + Lego()->vtable38(); + VideoManager()->DisableRMDevice(); + } + } + else if (bVar1) { + _DAT_00410064 = 1; + } + } + else { + _DAT_00410054 = 0; + _DAT_00410060 = wParam; + } + }*/ + return DefWindowProcA(hWnd,WM_DISPLAYCHANGE,wParam,lParam); + + case WM_SETCURSOR: + case WM_KEYDOWN: + case WM_MOUSEMOVE: + case WM_TIMER: + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + { + + NotificationId type = NONE; + unsigned char keyCode = 0; + + switch (uMsg) { + case WM_KEYDOWN: + if (lParam & 0x40000000) { + return DefWindowProcA(hWnd,WM_KEYDOWN,wParam,lParam); + } + keyCode = wParam; + type = KEYDOWN; + break; + case WM_MOUSEMOVE: + g_mousemoved = 1; + type = MOUSEMOVE; + break; + case WM_TIMER: + type = TIMER; + break; + case WM_SETCURSOR: + if (g_isle) { + HCURSOR hCursor = g_isle->m_cursor4; + if (g_isle->m_cursor2 == hCursor || g_isle->m_cursor3 == hCursor || hCursor == NULL) { + SetCursor(hCursor); + return 0; + } + } + break; + case WM_LBUTTONDOWN: + g_mousedown = 1; + type = MOUSEDOWN; + break; + case WM_LBUTTONUP: + g_mousedown = 0; + type = MOUSEUP; + break; + case 0x5400: + if (g_isle) { + // FIXME: Untangle + //FUN_00402e80(g_isle,wParam); + return 0; + } + } + + if (g_isle) { + if (InputManager()) { + InputManager()->QueueEvent(type, wParam, LOWORD(lParam), HIWORD(lParam), keyCode); + } + if (g_isle && g_isle->m_drawCursor && type == MOUSEMOVE) { + unsigned short x = LOWORD(lParam); + unsigned short y = HIWORD(lParam); + if (639 < x) { + x = 639; + } + if (479 < y) { + y = 479; + } + VideoManager()->MoveCursor(x,y); + } + } + return 0; + } + } + + return DefWindowProcA(hWnd,uMsg,wParam,lParam); +} + +MxResult Isle::setupWindow(HINSTANCE hInstance) +{ + WNDCLASSA wndclass; + ZeroMemory(&wndclass, sizeof(WNDCLASSA)); + + loadConfig(); + + setupVideoFlags(m_fullScreen, m_flipSurfaces, m_backBuffersInVram, m_using8bit, + m_using16bit, m_unk24, FALSE, m_wideViewAngle, m_deviceId); + + MxOmni::SetSound3D(m_use3dSound); + + srand(timeGetTime() / 1000); + SystemParametersInfoA(SPI_SETMOUSETRAILS, 0, NULL, 0); + + ZeroMemory(&wndclass, sizeof(WNDCLASSA)); + + wndclass.cbClsExtra = 0; + wndclass.style = CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = WndProc; + wndclass.cbWndExtra = 0; + wndclass.hIcon = LoadIconA(hInstance, MAKEINTRESOURCE(105)); + wndclass.hCursor = LoadCursorA(hInstance, MAKEINTRESOURCE(102)); + m_cursor4 = wndclass.hCursor; + m_cursor1 = wndclass.hCursor; + m_cursor2 = LoadCursorA(hInstance, MAKEINTRESOURCE(104)); + m_cursor3 = LoadCursorA(hInstance, MAKEINTRESOURCE(103)); + wndclass.hInstance = hInstance; + wndclass.hbrBackground = GetStockObject(BLACK_BRUSH); + wndclass.lpszClassName = WNDCLASS_NAME; + + if (!RegisterClassA(&wndclass)) { + return FAILURE; + } + + DWORD dwStyle; + int x, y, width, height; + + if (!m_fullScreen) { + AdjustWindowRectEx(&windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW); + + height = windowRect.bottom - windowRect.top; + width = windowRect.right - windowRect.left; + + y = CW_USEDEFAULT; + x = CW_USEDEFAULT; + dwStyle = WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX; + } else { + AdjustWindowRectEx(&windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW); + height = windowRect.bottom - windowRect.top; + width = windowRect.right - windowRect.left; + dwStyle = WS_CAPTION | WS_SYSMENU; + x = windowRect.left; + y = windowRect.top; + } + + m_windowHandle = CreateWindowExA(WS_EX_APPWINDOW, WNDCLASS_NAME, WINDOW_TITLE, dwStyle, + x, y, width + 1, height + 1, NULL, NULL, hInstance, NULL); + if (!m_windowHandle) { + return FAILURE; + } + + if (m_fullScreen) { + MoveWindow(m_windowHandle, windowRect.left, windowRect.top, (windowRect.right - windowRect.left) + 1, (windowRect.bottom - windowRect.top) + 1, TRUE); + } + + ShowWindow(m_windowHandle, SW_SHOWNORMAL); + UpdateWindow(m_windowHandle); + if (!setupMediaPath()) { + return FAILURE; + } + + GameState()->SetSavePath(m_savePath); + GameState()->SerializePlayersInfo(1); + GameState()->SerializeScoreHistory(1); + + int iVar10; + if (m_islandQuality == 0) { + iVar10 = 1; + } else if (m_islandQuality == 1) { + iVar10 = 2; + } else { + iVar10 = 100; + } + + int uVar1 = (m_islandTexture == 0); + LegoModelPresenter::configureLegoModelPresenter(uVar1); + LegoPartPresenter::configureLegoPartPresenter(uVar1,iVar10); + LegoWorldPresenter::configureLegoWorldPresenter(m_islandQuality); + LegoBuildingManager::configureLegoBuildingManager(m_islandQuality); + LegoROI::configureLegoROI(iVar10); + LegoAnimationManager::configureLegoAnimationManager(m_islandQuality); + if (LegoOmni::GetInstance()) { + if (LegoOmni::GetInstance()->GetInputManager()) { + LegoOmni::GetInstance()->GetInputManager()->m_unk00[0xCD] = m_useJoystick; + LegoOmni::GetInstance()->GetInputManager()->m_unk00[0x67] = m_joystickIndex; + } + } + if (m_fullScreen) { + MoveWindow(m_windowHandle, windowRect.left, windowRect.top, (windowRect.right - windowRect.left) + 1, (windowRect.bottom - windowRect.top) + 1, TRUE); + } + ShowWindow(m_windowHandle, SW_SHOWNORMAL); + UpdateWindow(m_windowHandle); + + return SUCCESS; +} + +void Isle::tick(BOOL sleepIfNotNextFrame) +{ + if (this->m_windowActive) { + if (!Lego()) return; + if (!TickleManager()) return; + if (!Timer()) return; + + long currentTime = Timer()->GetRealTime(); + if (currentTime < _last_frame_time) { + _last_frame_time = -this->m_frameDelta; + } + if (this->m_frameDelta + _last_frame_time < currentTime) { + if (!Lego()->vtable40()) { + TickleManager()->vtable08(); + } + _last_frame_time = currentTime; + + if (_DAT_004101bc == 0) { + return; + } + + _DAT_004101bc--; + if (_DAT_004101bc != 0) { + return; + } + + LegoOmni::GetInstance()->CreateBackgroundAudio(); + BackgroundAudioManager()->Enable(this->m_useMusic); + + MxStreamController *stream = Streamer()->Open("\\lego\\scripts\\isle\\isle", 0); + MxDSAction ds; + + if (!stream) { + stream = Streamer()->Open("\\lego\\scripts\\nocd", 0); + if (!stream) { + return; + } + + ds.m_atomId = stream->atom; + ds.m_unk24 = 0xFFFF; + ds.m_unk1c = 0; + VideoManager()->EnableFullScreenMovie(TRUE, TRUE); + + if (Start(&ds) != SUCCESS) { + return; + } + } else { + ds.m_atomId = stream->atom; + ds.m_unk24 = 0xFFFF; + ds.m_unk1c = 0; + if (Start(&ds) != SUCCESS) { + return; + } + this->m_gameStarted = 1; + } + return; + } + if (sleepIfNotNextFrame == 0) return; + } + + Sleep(0); +} diff --git a/app/isle.h b/app/isle.h new file mode 100644 index 00000000..9b7ffc05 --- /dev/null +++ b/app/isle.h @@ -0,0 +1,74 @@ +#ifndef ISLE_H +#define ISLE_H + +#include + +#include "../lib/define.h" +#include "../lib/mxvideoparam.h" + +class Isle +{ +public: + Isle(); + ~Isle(); + + static void close(); + + MxResult setupWindow(HINSTANCE hInstance); + + void tick(BOOL sleepIfNotNextFrame); + + BOOL setupMediaPath(); + void loadConfig(); + void setupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers, + BOOL using8bit, BOOL m_using16bit, BOOL param_6, BOOL param_7, + BOOL wideViewAngle, char *deviceId); + +//private: + + // 0 + LPSTR m_hdPath; + LPSTR m_cdPath; + LPSTR m_deviceId; + LPSTR m_savePath; + + // 10 + BOOL m_fullScreen; + BOOL m_flipSurfaces; + BOOL m_backBuffersInVram; + BOOL m_using8bit; + + // 20 + BOOL m_using16bit; + int m_unk24; + BOOL m_use3dSound; + BOOL m_useMusic; + + // 30 + BOOL m_useJoystick; + int m_joystickIndex; + BOOL m_wideViewAngle; + int m_islandQuality; + + // 40 + int m_islandTexture; + int m_gameStarted; + long m_frameDelta; + + // 4c + MxVideoParam m_videoParam; + + // 70 + BOOL m_windowActive; + HWND m_windowHandle; + BOOL m_drawCursor; + HCURSOR m_cursor1; + + // 80 + HCURSOR m_cursor2; + HCURSOR m_cursor3; + HCURSOR m_cursor4; + +}; + +#endif // ISLE_H diff --git a/app/main.cpp b/app/main.cpp new file mode 100644 index 00000000..e762cd69 --- /dev/null +++ b/app/main.cpp @@ -0,0 +1,134 @@ +#include +#include + +#include "define.h" +#include "isle.h" +#include "../lib/legoomni.h" + +BOOL findExistingInstance(void) +{ + HWND hWnd = FindWindowA(WNDCLASS_NAME, WINDOW_TITLE); + if (hWnd) { + if (SetForegroundWindow(hWnd)) { + ShowWindow(hWnd, SW_RESTORE); + } + return 0; + } + return 1; +} + +BOOL startDirectSound(void) +{ + LPDIRECTSOUND lpDS; + HRESULT ret = DirectSoundCreate(NULL, &lpDS, NULL); + if (ret == DS_OK && lpDS != NULL) { + lpDS->Release(); + return TRUE; + } + + return FALSE; +} + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + // Look for another instance, if we find one, bring it to the foreground instead + if (!findExistingInstance()) { + return 0; + } + + // Attempt to create DirectSound instance + BOOL soundReady = FALSE; + for (int i = 0; i < 20; i++) { + if (startDirectSound()) { + soundReady = TRUE; + break; + } + Sleep(500); + } + + // Throw error if sound unavailable + if (!soundReady) { + MessageBoxA(NULL, "\"LEGO® Island\" is not detecting a DirectSound compatible sound card. Please quit all other applications and try again.", + "Lego Island Error",0); + return 0; + } + + // Create global app instance + g_isle = new Isle(); + + // Create window + if (g_isle->setupWindow(hInstance) != SUCCESS) { + MessageBoxA(NULL, "\"LEGO® Island\" failed to start. Please quit all other applications and try again.", "LEGO® Island Error",0); + return 0; + } + + // Get reference to window + HWND window; + if (g_isle->m_windowHandle) { + window = g_isle->m_windowHandle; + } + + // Load accelerator (don't know what this does) + LoadAcceleratorsA(hInstance, "AppAccel"); + + MSG msg; + + while (!g_closed) { + while (!PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE)) { + if (g_isle) { + g_isle->tick(1); + } + } + + if (g_isle) { + g_isle->tick(1); + } + + if (g_closed) { + break; + } + + do { + if (!PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) { + break; + } + + MSG nextMsg; + if (!g_isle + || !g_isle->m_windowHandle + || msg.message != WM_MOUSEMOVE + || !PeekMessageA(&nextMsg, NULL, 0, 0, PM_NOREMOVE) + || nextMsg.message != WM_MOUSEMOVE) { + TranslateMessage(&msg); + DispatchMessageA(&msg); + } + + if (_DAT_00410064 != 0) { + _DAT_00410064 = 0; + VideoManager()->EnableRMDevice(); + _DAT_00410050 = 0; + Lego()->vtable3c(); + } + + if (g_closed) { + break; + } + + if (g_mousedown == 0) { +LAB_00401bc7: + if (g_mousemoved) { + g_mousemoved = FALSE; + } + } else if (g_mousemoved) { + if (g_isle) { + g_isle->tick(0); + } + goto LAB_00401bc7; + } + } while (!g_closed); + } + + DestroyWindow(window); + + return msg.wParam; +} diff --git a/isle.mak b/isle.mak new file mode 100644 index 00000000..37b25818 --- /dev/null +++ b/isle.mak @@ -0,0 +1,295 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=isle - Win32 Debug +!MESSAGE No configuration specified. Defaulting to isle - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "isle - Win32 Release" && "$(CFG)" != "isle - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "isle.mak" CFG="isle - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "isle - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "isle - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "isle - Win32 Debug" +CPP=cl.exe +MTL=mktyplib.exe +RSC=rc.exe + +!IF "$(CFG)" == "isle - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\isle.exe" + +CLEAN : + -@erase "$(INTDIR)\define.obj" + -@erase "$(INTDIR)\isle.obj" + -@erase "$(INTDIR)\main.obj" + -@erase "$(OUTDIR)\isle.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\ + /Fp"$(INTDIR)/isle.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/isle.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib winmm.lib lib/lego1.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib dsound.lib winmm.lib lib/lego1.lib /nologo /subsystem:windows\ + /incremental:no /pdb:"$(OUTDIR)/isle.pdb" /machine:I386\ + /out:"$(OUTDIR)/isle.exe" +LINK32_OBJS= \ + "$(INTDIR)\define.obj" \ + "$(INTDIR)\isle.obj" \ + "$(INTDIR)\main.obj" + +"$(OUTDIR)\isle.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "isle - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\isle.exe" + +CLEAN : + -@erase "$(INTDIR)\define.obj" + -@erase "$(INTDIR)\isle.obj" + -@erase "$(INTDIR)\main.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\isle.exe" + -@erase "$(OUTDIR)\isle.ilk" + -@erase "$(OUTDIR)\isle.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /Fp"$(INTDIR)/isle.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/isle.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib winmm.lib lib/lego1.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib dsound.lib winmm.lib lib/lego1.lib /nologo /subsystem:windows\ + /incremental:yes /pdb:"$(OUTDIR)/isle.pdb" /debug /machine:I386\ + /out:"$(OUTDIR)/isle.exe" +LINK32_OBJS= \ + "$(INTDIR)\define.obj" \ + "$(INTDIR)\isle.obj" \ + "$(INTDIR)\main.obj" + +"$(OUTDIR)\isle.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "isle - Win32 Release" +# Name "isle - Win32 Debug" + +!IF "$(CFG)" == "isle - Win32 Release" + +!ELSEIF "$(CFG)" == "isle - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\app\define.cpp +DEP_CPP_DEFIN=\ + ".\app\define.h"\ + + +"$(INTDIR)\define.obj" : $(SOURCE) $(DEP_CPP_DEFIN) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\app\isle.cpp +DEP_CPP_ISLE_=\ + ".\app\define.h"\ + ".\app\isle.h"\ + ".\lib\define.h"\ + ".\lib\legoanimationmanager.h"\ + ".\lib\legobuildingmanager.h"\ + ".\lib\legogamestate.h"\ + ".\lib\legoinputmanager.h"\ + ".\lib\legomodelpresenter.h"\ + ".\lib\legoomni.h"\ + ".\lib\legopartpresenter.h"\ + ".\lib\legoroi.h"\ + ".\lib\legovideomanager.h"\ + ".\lib\legoworldpresenter.h"\ + ".\lib\mxatomid.h"\ + ".\lib\mxbackgroundaudiomanager.h"\ + ".\lib\mxdirectdraw.h"\ + ".\lib\mxdsaction.h"\ + ".\lib\mxomni.h"\ + ".\lib\mxomnicreateflags.h"\ + ".\lib\mxomnicreateparam.h"\ + ".\lib\mxpalette.h"\ + ".\lib\mxrect32.h"\ + ".\lib\mxstreamcontroller.h"\ + ".\lib\mxstreamer.h"\ + ".\lib\mxstring.h"\ + ".\lib\mxticklemanager.h"\ + ".\lib\mxtimer.h"\ + ".\lib\mxtransitionmanager.h"\ + ".\lib\mxvariabletable.h"\ + ".\lib\mxvideoparam.h"\ + ".\lib\mxvideoparamflags.h"\ + + +"$(INTDIR)\isle.obj" : $(SOURCE) $(DEP_CPP_ISLE_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\app\main.cpp +DEP_CPP_MAIN_=\ + ".\app\define.h"\ + ".\app\isle.h"\ + ".\lib\define.h"\ + ".\lib\legoanimationmanager.h"\ + ".\lib\legobuildingmanager.h"\ + ".\lib\legogamestate.h"\ + ".\lib\legoinputmanager.h"\ + ".\lib\legomodelpresenter.h"\ + ".\lib\legoomni.h"\ + ".\lib\legopartpresenter.h"\ + ".\lib\legoroi.h"\ + ".\lib\legovideomanager.h"\ + ".\lib\legoworldpresenter.h"\ + ".\lib\mxatomid.h"\ + ".\lib\mxbackgroundaudiomanager.h"\ + ".\lib\mxdsaction.h"\ + ".\lib\mxomnicreateflags.h"\ + ".\lib\mxomnicreateparam.h"\ + ".\lib\mxpalette.h"\ + ".\lib\mxrect32.h"\ + ".\lib\mxstreamcontroller.h"\ + ".\lib\mxstreamer.h"\ + ".\lib\mxstring.h"\ + ".\lib\mxticklemanager.h"\ + ".\lib\mxtimer.h"\ + ".\lib\mxtransitionmanager.h"\ + ".\lib\mxvariabletable.h"\ + ".\lib\mxvideoparam.h"\ + ".\lib\mxvideoparamflags.h"\ + + +"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/isle.mdp b/isle.mdp new file mode 100644 index 00000000..311a68ed Binary files /dev/null and b/isle.mdp differ diff --git a/isle.ncb b/isle.ncb new file mode 100644 index 00000000..ff04c884 Binary files /dev/null and b/isle.ncb differ diff --git a/lib/define.h b/lib/define.h new file mode 100644 index 00000000..a591766f --- /dev/null +++ b/lib/define.h @@ -0,0 +1,8 @@ +#ifndef MX_DEFINE +#define MX_DEFINE + +typedef unsigned long MxResult; +const MxResult SUCCESS = 0; +const MxResult FAILURE = 0xFFFFFFFFL; + +#endif // MX_DEFINE diff --git a/lib/lego1.def b/lib/lego1.def new file mode 100644 index 00000000..eb8c8fb3 --- /dev/null +++ b/lib/lego1.def @@ -0,0 +1,137 @@ +; +; Definition file of Lego1.dll +; Automatic generated by gendef +; written by Kai Tietz 2008 +; +LIBRARY "Lego1.dll" +EXPORTS +??0LegoBackgroundColor@@QAE@PBD0@Z ; has WINAPI (@8) +??0LegoGameState@@QAE@XZ +??0LegoWorld@@QAE@XZ +??0MxAtomId@@QAE@PBDW4LookupMode@@@Z ; has WINAPI (@8) +??0MxBitmap@@QAE@XZ +??0MxCore@@QAE@XZ +??0MxCriticalSection@@QAE@XZ +??0MxDSAction@@QAE@XZ +??0MxDSFile@@QAE@PBDK@Z ; has WINAPI (@8) +??0MxOmniCreateFlags@@QAE@XZ +??0MxOmniCreateParam@@QAE@PBDPAUHWND__@@AAVMxVideoParam@@VMxOmniCreateFlags@@@Z ; has WINAPI (@16) +??0MxString@@QAE@ABV0@@Z ; has WINAPI (@4) +??0MxVideoParam@@QAE@AAV0@@Z ; has WINAPI (@4) +??0MxVideoParam@@QAE@AAVMxRect32@@PAVMxPalette@@KAAVMxVideoParamFlags@@@Z ; has WINAPI (@16) +??0MxVideoParam@@QAE@XZ +??0MxVideoParamFlags@@QAE@XZ +??1LegoEntity@@UAE@XZ +??1LegoGameState@@QAE@XZ +??1LegoWorld@@UAE@XZ +??1MXIOINFO@@QAE@XZ +??1MxAtomId@@QAE@XZ +??1MxBitmap@@UAE@XZ +??1MxCore@@UAE@XZ +??1MxCriticalSection@@QAE@XZ +??1MxDSAction@@UAE@XZ +??1MxDSFile@@UAE@XZ +??1MxPresenter@@UAE@XZ +??1MxString@@UAE@XZ +??1MxVideoParam@@QAE@XZ +??4MxAtomId@@QAEAAV0@ABV0@@Z ; has WINAPI (@4) +??4MxString@@QAEABV0@PBD@Z ; has WINAPI (@4) +??4MxVideoParam@@QAEAAV0@ABV0@@Z ; has WINAPI (@4) +??8MxPalette@@QAEEAAV0@@Z ; has WINAPI (@4) +?BackgroundAudioManager@@YAPAVMxBackgroundAudioManager@@XZ +?Close@MxDSFile@@UAEJXZ +?Close@MxStreamer@@QAEJPBD@Z ; has WINAPI (@4) +?CreateBackgroundAudio@LegoOmni@@QAEXXZ +?CreateInstance@LegoOmni@@SAXXZ +?CreatePalette@MxBitmap@@UAEPAVMxPalette@@XZ +?CreateStreamObject@@YAPAVMxDSObject@@PAVMxDSFile@@F@Z +?DestroyInstance@MxOmni@@SAXXZ +?Detach@MxPalette@@QAEXXZ +?DisableRMDevice@LegoVideoManager@@QAEHXZ +?DoneTickle@MxPresenter@@MAEXXZ +?Enable@MxBackgroundAudioManager@@QAEXE@Z ; has WINAPI (@4) +?Enable@MxPresenter@@UAEXE@Z ; has WINAPI (@4) +?EnableFullScreenMovie@LegoVideoManager@@QAEXEE@Z ; has WINAPI (@8) +?EnableRMDevice@LegoVideoManager@@QAEHXZ +?EndAction@MxPresenter@@UAEXXZ +?EventManager@@YAPAVMxEventManager@@XZ +?FlipToGDISurface@MxDirectDraw@@QAEHXZ +?GameState@@YAPAVLegoGameState@@XZ +?GetBufferSize@MxDSFile@@UAEKXZ +?GetCD@MxOmni@@SAPBDXZ +?GetCurrPathInfo@LegoOmni@@SAHPAPAVLegoPathBoundary@@AAH@Z +?GetDefaults@LegoNavController@@SAXPAHPAM11111111PAE@Z +?GetHD@MxOmni@@SAPBDXZ +?GetInstance@LegoOmni@@SAPAV1@XZ +?GetInstance@MxOmni@@SAPAV1@XZ +?GetInstance@MxScheduler@@SAPAV1@XZ +?GetNoCD_SourceName@@YAPBDXZ +?GetPartsThreshold@RealtimeView@@SAMXZ +?GetPrimaryBitDepth@MxDirectDraw@@SAHXZ +?GetRealTime@MxTimer@@QAEJXZ +?GetStreamBuffersNum@MxDSFile@@UAEKXZ +?GetUserMaxLOD@RealtimeView@@SAMXZ +?GetVariable@MxVariableTable@@QAEPBDPBD@Z ; has WINAPI (@4) +?Init@MxPresenter@@IAEXXZ +?InputManager@@YAPAVLegoInputManager@@XZ +?InvalidateRect@MxVideoManager@@QAEXAAVMxRect32@@@Z ; has WINAPI (@4) +?IsSound3D@MxOmni@@SAEXZ +?Lego@@YAPAVLegoOmni@@XZ +?Load@LegoGameState@@QAEJK@Z ; has WINAPI (@4) +?MSoundManager@@YAPAVMxSoundManager@@XZ +?MakeSourceName@@YAXPADPBD@Z +?MoveCursor@LegoVideoManager@@QAEXHH@Z ; has WINAPI (@8) +?MusicManager@@YAPAVMxMusicManager@@XZ +?NotificationManager@@YAPAVMxNotificationManager@@XZ +?Notify@MxCore@@UAEJAAVMxParam@@@Z ; has WINAPI (@4) +?Open@MxDSFile@@UAEJK@Z ; has WINAPI (@4) +?Open@MxStreamer@@QAEPAVMxStreamController@@PBDG@Z ; has WINAPI (@8) +?ParseExtra@MxPresenter@@MAEXXZ +?Pause@MxDirectDraw@@QAEHH@Z ; has WINAPI (@4) +?PickEntity@@YAPAVLegoEntity@@JJ@Z +?PickROI@@YAPAVLegoROI@@JJ@Z +?QueueEvent@LegoInputManager@@QAEXW4NotificationId@@EJJE@Z ; has WINAPI (@20) +?Read@MxBitmap@@UAEJPBD@Z ; has WINAPI (@4) +?Read@MxDSFile@@UAEJPAEK@Z ; has WINAPI (@8) +?RealizePalette@MxVideoManager@@UAEJPAVMxPalette@@@Z ; has WINAPI (@4) +?Register@LegoInputManager@@QAEXPAVMxCore@@@Z ; has WINAPI (@4) +?RemoveAll@ViewManager@@QAEXPAVViewROI@@@Z ; has WINAPI (@4) +?RemoveWorld@LegoOmni@@QAEXABVMxAtomId@@J@Z ; has WINAPI (@8) +?Save@LegoGameState@@QAEJK@Z ; has WINAPI (@4) +?Seek@MxDSFile@@UAEJJH@Z ; has WINAPI (@8) +?SerializePlayersInfo@LegoGameState@@QAEXF@Z ; has WINAPI (@4) +?SerializeScoreHistory@LegoGameState@@QAEXF@Z ; has WINAPI (@4) +?SetCD@MxOmni@@SAXPBD@Z +?SetDefaults@LegoNavController@@SAXHMMMMMMMMME@Z +?SetDeviceName@MxVideoParam@@QAEXPAD@Z ; has WINAPI (@4) +?SetDisplayBB@LegoROI@@QAEXH@Z ; has WINAPI (@4) +?SetDoMutex@MxCriticalSection@@SAXXZ +?SetHD@MxOmni@@SAXPBD@Z +?SetObjectName@MxDSObject@@QAEXPBD@Z ; has WINAPI (@4) +?SetOmniUserMessage@@YAXP6AXPBDH@Z@Z +?SetPartsThreshold@RealtimeView@@SAXM@Z +?SetSavePath@LegoGameState@@QAEXPAD@Z ; has WINAPI (@4) +?SetSound3D@MxOmni@@SAXE@Z +?SetUserMaxLOD@RealtimeView@@SAXM@Z +?SetVariable@MxVariableTable@@QAEXPAVMxVariable@@@Z ; has WINAPI (@4) +?SetVariable@MxVariableTable@@QAEXPBD0@Z ; has WINAPI (@8) +?SetWaitIndicator@MxTransitionManager@@QAEXPAVMxVideoPresenter@@@Z ; has WINAPI (@4) +?SoundManager@@YAPAVLegoSoundManager@@XZ +?Start@@YAJPAVMxDSAction@@@Z +?StartAction@MxPresenter@@UAEJPAVMxStreamController@@PAVMxDSAction@@@Z ; has WINAPI (@8) +?StartMultiTasking@MxScheduler@@QAEXK@Z ; has WINAPI (@4) +?Streamer@@YAPAVMxStreamer@@XZ +?Tickle@MxPresenter@@UAEJXZ +?TickleManager@@YAPAVMxTickleManager@@XZ +?Timer@@YAPAVMxTimer@@XZ +?TransitionManager@@YAPAVMxTransitionManager@@XZ +?UnRegister@LegoInputManager@@QAEXPAVMxCore@@@Z ; has WINAPI (@4) +?VariableTable@@YAPAVMxVariableTable@@XZ +?VideoManager@@YAPAVLegoVideoManager@@XZ +?configureLegoAnimationManager@LegoAnimationManager@@SAXH@Z +?configureLegoBuildingManager@LegoBuildingManager@@SAXH@Z +?configureLegoModelPresenter@LegoModelPresenter@@SAXH@Z +?configureLegoPartPresenter@LegoPartPresenter@@SAXHH@Z +?configureLegoROI@LegoROI@@SAXH@Z +?configureLegoWorldPresenter@LegoWorldPresenter@@SAXH@Z +_DllMain@12@12 diff --git a/lib/lego1.exp b/lib/lego1.exp new file mode 100644 index 00000000..300d78fd Binary files /dev/null and b/lib/lego1.exp differ diff --git a/lib/lego1.lib b/lib/lego1.lib new file mode 100644 index 00000000..684a82b7 Binary files /dev/null and b/lib/lego1.lib differ diff --git a/lib/legoanimationmanager.h b/lib/legoanimationmanager.h new file mode 100644 index 00000000..8e243dd3 --- /dev/null +++ b/lib/legoanimationmanager.h @@ -0,0 +1,10 @@ +#ifndef LEGOANIMATIONMANAGER_H +#define LEGOANIMATIONMANAGER_H + +class LegoAnimationManager +{ +public: + __declspec(dllexport) static void configureLegoAnimationManager(int param_1); +}; + +#endif // LEGOANIMATIONMANAGER_H diff --git a/lib/legobuildingmanager.h b/lib/legobuildingmanager.h new file mode 100644 index 00000000..a1173d3d --- /dev/null +++ b/lib/legobuildingmanager.h @@ -0,0 +1,10 @@ +#ifndef LEGOBUILDINGMANAGER_H +#define LEGOBUILDINGMANAGER_H + +class LegoBuildingManager +{ +public: + __declspec(dllexport) static void configureLegoBuildingManager(int param_1); +}; + +#endif // LEGOBUILDINGMANAGER_H diff --git a/lib/legogamestate.h b/lib/legogamestate.h new file mode 100644 index 00000000..4a41ca04 --- /dev/null +++ b/lib/legogamestate.h @@ -0,0 +1,13 @@ +#ifndef LEGOGAMESTATE_H +#define LEGOGAMESTATE_H + +class LegoGameState +{ +public: + __declspec(dllexport) long Save(unsigned long p); + __declspec(dllexport) void SerializePlayersInfo(short p); + __declspec(dllexport) void SerializeScoreHistory(short p); + __declspec(dllexport) void SetSavePath(char *p); +}; + +#endif // LEGOGAMESTATE_H diff --git a/lib/legoinputmanager.h b/lib/legoinputmanager.h new file mode 100644 index 00000000..6bdf18e0 --- /dev/null +++ b/lib/legoinputmanager.h @@ -0,0 +1,22 @@ +#ifndef LEGOINPUTMANAGER_H +#define LEGOINPUTMANAGER_H + +__declspec(dllexport) enum NotificationId +{ + NONE = 0x0, + KEYDOWN = 0x7, + MOUSEUP = 0x8, + MOUSEDOWN = 0x9, + MOUSEMOVE = 0x10, + TIMER = 0xF +}; + +class LegoInputManager +{ +public: + __declspec(dllexport) void QueueEvent(NotificationId id, unsigned char p2, long p3, long p4, unsigned char p5); + + int m_unk00[0x400]; +}; + +#endif // LEGOINPUTMANAGER_H diff --git a/lib/legomodelpresenter.h b/lib/legomodelpresenter.h new file mode 100644 index 00000000..a5c6306c --- /dev/null +++ b/lib/legomodelpresenter.h @@ -0,0 +1,10 @@ +#ifndef LEGOMODELPRESENTER_H +#define LEGOMODELPRESENTER_H + +class LegoModelPresenter +{ +public: + __declspec(dllexport) static void configureLegoModelPresenter(int param_1); +}; + +#endif // LEGOMODELPRESENTER_H diff --git a/lib/legoomni.h b/lib/legoomni.h new file mode 100644 index 00000000..d319fb7e --- /dev/null +++ b/lib/legoomni.h @@ -0,0 +1,99 @@ +#ifndef LEGOOMNI_H +#define LEGOOMNI_H + +#include "define.h" +#include "mxbackgroundaudiomanager.h" +#include "mxdsaction.h" +#include "mxomnicreateparam.h" +#include "mxstreamer.h" +#include "mxticklemanager.h" +#include "mxtimer.h" +#include "mxtransitionmanager.h" +#include "legoanimationmanager.h" +#include "legobuildingmanager.h" +#include "legogamestate.h" +#include "legoinputmanager.h" +#include "legomodelpresenter.h" +#include "legopartpresenter.h" +#include "legoroi.h" +#include "legoworldpresenter.h" +#include "legovideomanager.h" + +class MxBackgroundAudioManager; + +class LegoOmni +{ +public: + __declspec(dllexport) void CreateBackgroundAudio(); + __declspec(dllexport) void RemoveWorld(const MxAtomId &p1, long p2); + + __declspec(dllexport) static void CreateInstance(); + __declspec(dllexport) static LegoOmni *GetInstance(); + + virtual ~LegoOmni(); + + virtual void vtable04(); + virtual void vtable08(); + virtual void vtable0c(); + virtual void vtable10(); + virtual void vtable14(); + virtual MxResult Create(const MxOmniCreateParam &p); + virtual void vtable1c(); + virtual void vtable20(); + virtual void vtable24(MxDSAction &ds); + virtual int vtable28(MxDSAction &ds); + virtual void vtable2c(); + virtual void vtable30(); + virtual void vtable34(); + virtual void vtable38(); + virtual void vtable3c(); + virtual unsigned char vtable40(); + + LegoInputManager *GetInputManager() { return m_inputMgr; } + +private: + int m_unk04; + int m_unk08; + int m_unk0c; + int m_unk10; + int m_unk14; + int m_unk18; + int m_unk1c; + int m_unk20; + int m_unk24; + int m_unk28; + int m_unk2c; + int m_unk30; + int m_unk34; + int m_unk38; + int m_unk3c; + int m_unk40; + int m_unk44; + int m_unk48; + int m_unk4c; + int m_unk50; + int m_unk54; + int m_unk58; + int m_unk5c; + int m_unk60; + int m_unk64; + int m_unk68; + int m_unk6c; + LegoInputManager *m_inputMgr; + +}; + +__declspec(dllexport) LegoOmni *Lego(); +__declspec(dllexport) MxBackgroundAudioManager *BackgroundAudioManager(); +__declspec(dllexport) MxTickleManager *TickleManager(); +__declspec(dllexport) LegoVideoManager *VideoManager(); +__declspec(dllexport) MxVariableTable *VariableTable(); +__declspec(dllexport) LegoGameState *GameState(); +__declspec(dllexport) MxTimer *Timer(); +__declspec(dllexport) MxStreamer *Streamer(); +__declspec(dllexport) LegoInputManager *InputManager(); +__declspec(dllexport) MxTransitionManager *TransitionManager(); + +__declspec(dllexport) long Start(MxDSAction *a); + +#endif // LEGOOMNI_H diff --git a/lib/legopartpresenter.h b/lib/legopartpresenter.h new file mode 100644 index 00000000..05e0df7e --- /dev/null +++ b/lib/legopartpresenter.h @@ -0,0 +1,10 @@ +#ifndef LEGOPARTPRESENTER_H +#define LEGOPARTPRESENTER_H + +class LegoPartPresenter +{ +public: + __declspec(dllexport) static void configureLegoPartPresenter(int param_1, int param_2); +}; + +#endif // LEGOPARTPRESENTER_H diff --git a/lib/legoroi.h b/lib/legoroi.h new file mode 100644 index 00000000..a605b398 --- /dev/null +++ b/lib/legoroi.h @@ -0,0 +1,10 @@ +#ifndef LEGOROI_H +#define LEGOROI_H + +class LegoROI +{ +public: + __declspec(dllexport) static void configureLegoROI(int param_1); +}; + +#endif // LEGOROI_H diff --git a/lib/legovideomanager.h b/lib/legovideomanager.h new file mode 100644 index 00000000..0dc4ba53 --- /dev/null +++ b/lib/legovideomanager.h @@ -0,0 +1,15 @@ +#ifndef LEGOVIDEOMANAGER_H +#define LEGOVIDEOMANAGER_H + +class LegoVideoManager +{ +public: + __declspec(dllexport) int EnableRMDevice(); + + __declspec(dllexport) void EnableFullScreenMovie(unsigned char a, unsigned char b); + + __declspec(dllexport) void MoveCursor(int x, int y); + +}; + +#endif // LEGOVIDEOMANAGER_H diff --git a/lib/legoworldpresenter.h b/lib/legoworldpresenter.h new file mode 100644 index 00000000..006b4cf8 --- /dev/null +++ b/lib/legoworldpresenter.h @@ -0,0 +1,10 @@ +#ifndef LEGOWORLDPRESENTER_H +#define LEGOWORLDPRESENTER_H + +class LegoWorldPresenter +{ +public: + __declspec(dllexport) static void configureLegoWorldPresenter(int param_1); +}; + +#endif // LEGOWORLDPRESENTER_H diff --git a/lib/mxatomid.h b/lib/mxatomid.h new file mode 100644 index 00000000..83275795 --- /dev/null +++ b/lib/mxatomid.h @@ -0,0 +1,14 @@ +#ifndef MXATOMID_H +#define MXATOMID_H + +class MxAtomId +{ +public: + __declspec(dllexport) MxAtomId &operator=(const MxAtomId &id); + __declspec(dllexport) ~MxAtomId(); + + char *m_internal; + +}; + +#endif // MXATOMID_H diff --git a/lib/mxbackgroundaudiomanager.h b/lib/mxbackgroundaudiomanager.h new file mode 100644 index 00000000..765fc9c3 --- /dev/null +++ b/lib/mxbackgroundaudiomanager.h @@ -0,0 +1,10 @@ +#ifndef MXBACKGROUNDAUDIOMANAGER_H +#define MXBACKGROUNDAUDIOMANAGER_H + +class MxBackgroundAudioManager +{ +public: + __declspec(dllexport) void Enable(unsigned char p); +}; + +#endif // MXBACKGROUNDAUDIOMANAGER_H diff --git a/lib/mxbitmap.h b/lib/mxbitmap.h new file mode 100644 index 00000000..9e294a79 --- /dev/null +++ b/lib/mxbitmap.h @@ -0,0 +1,10 @@ +#ifndef MXBITMAP_H +#define MXBITMAP_H + +class MxBitmap +{ +public: + __declspec(dllexport) MxPalette *CreatePalette(); +}; + +#endif // MXBITMAP_H diff --git a/lib/mxdirectdraw.h b/lib/mxdirectdraw.h new file mode 100644 index 00000000..50c56847 --- /dev/null +++ b/lib/mxdirectdraw.h @@ -0,0 +1,10 @@ +#ifndef MXDIRECTDRAW_H +#define MXDIRECTDRAW_H + +class MxDirectDraw +{ +public: + __declspec(dllexport) static int GetPrimaryBitDepth(); +}; + +#endif // MXDIRECTDRAW_H diff --git a/lib/mxdsaction.h b/lib/mxdsaction.h new file mode 100644 index 00000000..75c5056d --- /dev/null +++ b/lib/mxdsaction.h @@ -0,0 +1,52 @@ +#ifndef MXDSACTION_H +#define MXDSACTION_H + +#include "mxatomid.h" + +class MxDSAction +{ +public: + __declspec(dllexport) MxDSAction(); + + int m_unk00; + int m_unk04; + int m_unk08; + int m_unk0c; + int m_unk10; + int m_unk14; + int m_unk18; + int m_unk1c; + MxAtomId m_atomId; + unsigned short m_unk24; + unsigned short m_unk26; + int m_unk28; + int m_unk2c; + int m_unk30; + int m_unk34; + int m_unk38; + int m_unk3c; + int m_unk40; + int m_unk44; + int m_unk48; + int m_unk4c; + int m_unk50; + int m_unk54; + int m_unk58; + int m_unk5c; + int m_unk60; + int m_unk64; + int m_unk68; + int m_unk6c; + int m_unk70; + int m_unk74; + int m_unk78; + int m_unk7c; + int m_unk80; + int m_unk84; + int m_unk88; + int m_unk8c; + int m_unk90; + +}; + +#endif // MXDSACTION_H diff --git a/lib/mxdsfile.h b/lib/mxdsfile.h new file mode 100644 index 00000000..4014a8e2 --- /dev/null +++ b/lib/mxdsfile.h @@ -0,0 +1,10 @@ +#ifndef MXDSFILE_H +#define MXDSFILE_H + +class MxDSFile +{ +public: + __declspec(dllexport) long Close(); +}; + +#endif // MXDSFILE_H diff --git a/lib/mxomni.h b/lib/mxomni.h new file mode 100644 index 00000000..b36a1925 --- /dev/null +++ b/lib/mxomni.h @@ -0,0 +1,15 @@ +#ifndef MXOMNI_H +#define MXOMNI_H + +class MxOmni +{ +public: + __declspec(dllexport) static const char *GetHD(); + __declspec(dllexport) static const char *GetCD(); + __declspec(dllexport) static void SetHD(const char *s); + __declspec(dllexport) static void SetCD(const char *s); + __declspec(dllexport) static void SetSound3D(unsigned char param_1); + __declspec(dllexport) static void DestroyInstance(); +}; + +#endif // MXOMNI_H diff --git a/lib/mxomnicreateflags.h b/lib/mxomnicreateflags.h new file mode 100644 index 00000000..ae57208d --- /dev/null +++ b/lib/mxomnicreateflags.h @@ -0,0 +1,14 @@ +#ifndef MXOMNICREATEFLAGS_H +#define MXOMNICREATEFLAGS_H + +class MxOmniCreateFlags +{ +public: + __declspec(dllexport) MxOmniCreateFlags(); + +private: + unsigned short m_flags; + +}; + +#endif // MXOMNICREATEFLAGS_H diff --git a/lib/mxomnicreateparam.h b/lib/mxomnicreateparam.h new file mode 100644 index 00000000..52a3a2bd --- /dev/null +++ b/lib/mxomnicreateparam.h @@ -0,0 +1,25 @@ +#ifndef MXOMNICREATEPARAM_H +#define MXOMNICREATEPARAM_H + +#include + +#include "mxomnicreateflags.h" +#include "mxstring.h" +#include "mxvideoparam.h" + +class MxOmniCreateParam +{ +public: + __declspec(dllexport) MxOmniCreateParam(const char *mediaPath, struct HWND__ *windowHandle, MxVideoParam &vparam, MxOmniCreateFlags flags); + + virtual void vtable00(); + +private: + MxString m_mediaPath; + HWND m_windowHandle; + MxVideoParam m_videoParam; + MxOmniCreateFlags m_createFlags; + +}; + +#endif // MXOMNICREATEPARAM_H diff --git a/lib/mxpalette.h b/lib/mxpalette.h new file mode 100644 index 00000000..6ed23153 --- /dev/null +++ b/lib/mxpalette.h @@ -0,0 +1,9 @@ +#ifndef MXPALETTE_H +#define MXPALETTE_H + +class MxPalette +{ +public: +}; + +#endif // MXPALETTE_H diff --git a/lib/mxrect32.h b/lib/mxrect32.h new file mode 100644 index 00000000..764117ec --- /dev/null +++ b/lib/mxrect32.h @@ -0,0 +1,13 @@ +#ifndef MXRECT32_H +#define MXRECT32_H + +class MxRect32 +{ +public: + int m_left; + int m_top; + int m_right; + int m_bottom; +}; + +#endif // MXRECT32_H diff --git a/lib/mxstreamcontroller.h b/lib/mxstreamcontroller.h new file mode 100644 index 00000000..d98699cd --- /dev/null +++ b/lib/mxstreamcontroller.h @@ -0,0 +1,21 @@ +#ifndef MXSTREAMCONTROLLER_H +#define MXSTREAMCONTROLLER_H + +class MxStreamController +{ +public: + int m_unk00; + int m_unk04; + int m_unk08; + int m_unk0c; + int m_unk10; + int m_unk14; + int m_unk18; + int m_unk1c; + int m_unk20; + MxAtomId atom; + int m_unk28; + int m_unk2c; +}; + +#endif // MXSTREAMCONTROLLER_H diff --git a/lib/mxstreamer.h b/lib/mxstreamer.h new file mode 100644 index 00000000..785c475b --- /dev/null +++ b/lib/mxstreamer.h @@ -0,0 +1,14 @@ +#ifndef MXSTREAMER_H +#define MXSTREAMER_H + +#include "mxstreamcontroller.h" + +class MxStreamer +{ +public: + __declspec(dllexport) MxStreamController *Open(const char *name, unsigned short p); + __declspec(dllexport) long Close(const char *p); + +}; + +#endif // MXSTREAMER_H diff --git a/lib/mxstring.h b/lib/mxstring.h new file mode 100644 index 00000000..a28e446c --- /dev/null +++ b/lib/mxstring.h @@ -0,0 +1,16 @@ +#ifndef MXSTRING_H +#define MXSTRING_H + +class MxString +{ +public: + +private: + int m_unk00; + int m_unk04; + int m_unk08; + int m_unk0c; + +}; + +#endif // MXSTRING_H diff --git a/lib/mxticklemanager.h b/lib/mxticklemanager.h new file mode 100644 index 00000000..ff27d76c --- /dev/null +++ b/lib/mxticklemanager.h @@ -0,0 +1,19 @@ +#ifndef MXTICKLEMANAGER_H +#define MXTICKLEMANAGER_H + +class MxTickleManager +{ +public: + virtual ~MxTickleManager(); + + virtual void vtable04(); + virtual void vtable08(); + virtual void vtable0c(); + virtual void vtable10(); + virtual void vtable14(); + virtual void vtable18(); + virtual void vtable1c(void *v, int p); + virtual void vtable20(); +}; + +#endif // MXTICKLEMANAGER_H diff --git a/lib/mxtimer.h b/lib/mxtimer.h new file mode 100644 index 00000000..35d888fa --- /dev/null +++ b/lib/mxtimer.h @@ -0,0 +1,10 @@ +#ifndef MXTIMER_H +#define MXTIMER_H + +class MxTimer +{ +public: + __declspec(dllexport) long GetRealTime(); +}; + +#endif // MXTIMER_H diff --git a/lib/mxtransitionmanager.h b/lib/mxtransitionmanager.h new file mode 100644 index 00000000..d91b4a4d --- /dev/null +++ b/lib/mxtransitionmanager.h @@ -0,0 +1,12 @@ +#ifndef MXTRANSITIONMANAGER_H +#define MXTRANSITIONMANAGER_H + +class MxVideoPresenter; + +class MxTransitionManager +{ +public: + void SetWaitIndicator(MxVideoPresenter *videoPresenter); +}; + +#endif // MXTRANSITIONMANAGER_H diff --git a/lib/mxvariabletable.h b/lib/mxvariabletable.h new file mode 100644 index 00000000..53868a22 --- /dev/null +++ b/lib/mxvariabletable.h @@ -0,0 +1,10 @@ +#ifndef MXVARIABLETABLE_H +#define MXVARIABLETABLE_H + +class MxVariableTable +{ +public: + __declspec(dllexport) void SetVariable(const char *key, const char *value); +}; + +#endif // MXVARIABLETABLE_H diff --git a/lib/mxvideoparam.h b/lib/mxvideoparam.h new file mode 100644 index 00000000..c5b7199f --- /dev/null +++ b/lib/mxvideoparam.h @@ -0,0 +1,32 @@ +#ifndef MXVIDEOPARAM_H +#define MXVIDEOPARAM_H + +#include "mxpalette.h" +#include "mxrect32.h" +#include "mxvariabletable.h" +#include "mxvideoparamflags.h" + +class MxVideoParam +{ +public: + __declspec(dllexport) MxVideoParam(); + __declspec(dllexport) MxVideoParam(MxRect32 &rect, MxPalette *pal, unsigned long p3, MxVideoParamFlags &flags); + + __declspec(dllexport) void SetDeviceName(char *id); + + inline MxVideoParamFlags &flags() { return m_flags; } + +private: + int m_left; + int m_top; + int m_right; + int m_bottom; + MxPalette *m_palette; + BOOL m_backBuffers; + MxVideoParamFlags m_flags; + int m_unk1c; + char *m_deviceId; + +}; + +#endif // MXVIDEOPARAM_H diff --git a/lib/mxvideoparamflags.h b/lib/mxvideoparamflags.h new file mode 100644 index 00000000..192eb397 --- /dev/null +++ b/lib/mxvideoparamflags.h @@ -0,0 +1,93 @@ +#ifndef MXVIDEOPARAMFLAGS_H +#define MXVIDEOPARAMFLAGS_H + +class MxVideoParamFlags +{ +public: + enum LowFlags + { + FULL_SCREEN = 0x1, + FLIP_SURFACES = 0x2, + BACK_BUFFERS = 0x4, + ENABLE_16BIT = 0x20, + WIDE_VIEW_ANGLE = 0x40 + }; + + enum HighFlags + { + UNKNOWN1 = 0x1, + UNKNOWN2 = 0x2 + }; + + __declspec(dllexport) MxVideoParamFlags(); + + inline void EnableFullScreen(BOOL e) + { + if (e) { + m_flags1 |= FULL_SCREEN; + } else { + m_flags1 &= ~FULL_SCREEN; + } + } + + inline void EnableFlipSurfaces(BOOL e) + { + if (e) { + m_flags1 |= FLIP_SURFACES; + } else { + m_flags1 &= ~FLIP_SURFACES; + } + } + + inline void EnableBackBuffers(BOOL e) + { + if (e) { + m_flags1 |= BACK_BUFFERS; + } else { + m_flags1 &= ~BACK_BUFFERS; + } + } + + inline void Enable16Bit(BOOL e) + { + if (e) { + m_flags1 |= ENABLE_16BIT; + } else { + m_flags1 &= ~ENABLE_16BIT; + } + } + + inline void EnableWideViewAngle(BOOL e) + { + if (e) { + m_flags1 |= WIDE_VIEW_ANGLE; + } else { + m_flags1 &= ~WIDE_VIEW_ANGLE; + } + } + + inline void EnableUnknown1(BOOL e) + { + if (e) { + m_flags2 |= UNKNOWN1; + } else { + m_flags2 &= ~UNKNOWN1; + } + } + + inline void EnableUnknown2(BOOL e) + { + if (e) { + m_flags2 |= UNKNOWN2; + } else { + m_flags2 &= ~UNKNOWN2; + } + } + +private: + unsigned char m_flags1; + unsigned char m_flags2; + +}; + +#endif // MXVIDEOPARAMFLAGS_H