Merge remote-tracking branch 'upstream/master' into legobackgroundcolor

This commit is contained in:
Misha 2023-06-28 08:09:03 +03:00
commit 25e9bbbfb0
44 changed files with 1275 additions and 927 deletions

View file

@ -29,7 +29,7 @@ jobs:
if: steps.cache-dx5.outputs.cache-hit != 'true'
run: |
cd dx5sdk
C:\msys64\usr\bin\wget.exe https://archive.org/download/idx5sdk/idx5sdk.exe
curl -fLOSs https://archive.org/download/idx5sdk/idx5sdk.exe
7z x .\idx5sdk.exe
7z x .\DX5SDK.EXE
@ -55,14 +55,24 @@ jobs:
.\msvc420\bin\NMAKE.EXE /f isle.mak CFG="ISLE - Win32 Release"
- name: Summarize Accuracy
shell: cmd
shell: bash
run: |
C:\msys64\usr\bin\wget.exe https://legoisland.org/download/ISLE.EXE
C:\msys64\usr\bin\wget.exe https://legoisland.org/download/LEGO1.DLL
curl -fLOSs https://legoisland.org/download/ISLE.EXE
curl -fLOSs https://legoisland.org/download/LEGO1.DLL
pip install capstone
pip install colorama
python3 tools/reccmp/reccmp.py -H ISLEPROGRESS.HTML ISLE.EXE Release/ISLE.EXE Release/ISLE.PDB .
python3 tools/reccmp/reccmp.py -H LEGO1PROGRESS.HTML LEGO1.DLL Release/LEGO1.DLL Release/LEGO1.PDB .
python3 tools/reccmp/reccmp.py -S ISLEPROGRESS.SVG --svg-icon tools/reccmp/isle.png -H ISLEPROGRESS.HTML ISLE.EXE Release/ISLE.EXE Release/ISLE.PDB . | tee ISLEPROGRESS.TXT
python3 tools/reccmp/reccmp.py -S LEGO1PROGRESS.SVG -T 1929 --svg-icon tools/reccmp/lego1.png -H LEGO1PROGRESS.HTML LEGO1.DLL Release/LEGO1.DLL Release/LEGO1.PDB . | tee LEGO1PROGRESS.TXT
- name: Compare Accuracy With Current Master
shell: bash
run: |
# Compare with current master
curl -fLSs -o ISLEPROGRESS-OLD.TXT https://github.com/isledecomp/isle/releases/download/continuous/ISLEPROGRESS.TXT
curl -fLSs -o LEGO1PROGRESS-OLD.TXT https://github.com/isledecomp/isle/releases/download/continuous/LEGO1PROGRESS.TXT
diff -u ISLEPROGRESS-OLD.TXT ISLEPROGRESS.TXT || true
diff -u LEGO1PROGRESS-OLD.TXT LEGO1PROGRESS.TXT || true
- name: Upload Artifact
uses: actions/upload-artifact@master
@ -72,3 +82,30 @@ jobs:
Release
ISLEPROGRESS.HTML
LEGO1PROGRESS.HTML
ISLEPROGRESS.SVG
LEGO1PROGRESS.SVG
- name: Upload Continuous Release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Convert SVGs to PNG
INKSCAPE_DIR=inkscape-1.2.2_2022-12-09_732a01da63-x64
curl -fLOSs https://inkscape.org/gallery/item/37364/$INKSCAPE_DIR.7z
7z x $INKSCAPE_DIR.7z
$INKSCAPE_DIR/bin/inkscape -w 512 ISLEPROGRESS.SVG -o ISLEPROGRESS.PNG
$INKSCAPE_DIR/bin/inkscape -w 512 LEGO1PROGRESS.SVG -o LEGO1PROGRESS.PNG
curl -fLOSs https://raw.githubusercontent.com/probonopd/uploadtool/master/upload.sh
./upload.sh \
Release/ISLE.EXE \
Release/LEGO1.DLL \
ISLEPROGRESS.HTML \
ISLEPROGRESS.TXT \
ISLEPROGRESS.SVG \
ISLEPROGRESS.PNG \
LEGO1PROGRESS.HTML \
LEGO1PROGRESS.TXT \
LEGO1PROGRESS.PNG \
LEGO1PROGRESS.SVG

View file

@ -6,7 +6,7 @@ Generally, decompilation is a fairly advanced skill. If you aren't already famil
## Ghidra Server
For documenting the original binaries and generating pseudocode that we decompile with, we primarily use [Ghidra](https://ghidra-sre.org/) (it's free and open source). To help with collaboration, we have a shared Ghidra repository with all of our current work. It is available to the public but read-only; to contribute to it yourself, you'll need approval from a current maintainer.
For documenting the original binaries and generating pseudocode that we decompile with, we primarily use [Ghidra](https://ghidra-sre.org/) (it's free and open source). To help with collaboration, we have a shared Ghidra repository with all of our current work. You are free to check it out and mess around with it locally, however to prevent sabotage, you will need to request permission before you can push back to the server (ask in the Matrix room).
To access the Ghidra repository, use the following details:
@ -21,6 +21,7 @@ In general, we're not exhaustively strict about coding style, but there are some
- `PascalCase` for classes and function names.
- `m_camelCase` for member variables.
- `g_camelCase` for global variables.
- `p_camelCase` for function parameters.
## Kinds of Contributions

View file

@ -1,7 +1,7 @@
#include "define.h"
// 0x410030
Isle *g_isle = 0;
IsleApp *g_isle = 0;
// 0x410034
unsigned char g_mousedown = 0;
@ -28,7 +28,7 @@ int g_targetWidth = 640;
int g_targetHeight = 480;
// 0x410060
unsigned int g_targetDepth = 16;
int g_targetDepth = 16;
// 0x410064
int g_reqEnableRMDevice = 0;

View file

@ -1,11 +1,11 @@
#ifndef DEFINE_H
#define DEFINE_H
#include "legoinc.h"
#include <windows.h>
class Isle;
class IsleApp;
extern Isle *g_isle;
extern IsleApp *g_isle;
extern int g_closed;
// 0x4101c4
#define WNDCLASS_NAME "Lego Island MainNoM App"
@ -18,7 +18,7 @@ extern int g_rmDisabled;
extern int g_waitingForTargetDepth;
extern int g_targetWidth;
extern int g_targetHeight;
extern unsigned int g_targetDepth;
extern int g_targetDepth;
extern int g_reqEnableRMDevice;
extern int g_startupDelay;
extern long g_lastFrameTime;

View file

@ -1,7 +1,21 @@
#include "isle.h"
#include "define.h"
#include <dsound.h>
#include "legoomni.h"
#include "legoanimationmanager.h"
#include "legobuildingmanager.h"
#include "legomodelpresenter.h"
#include "legopartpresenter.h"
#include "legoworldpresenter.h"
#include "mxdirectdraw.h"
#include "mxdsaction.h"
#include "res/resource.h"
// OFFSET: ISLE 0x401000
Isle::Isle()
IsleApp::IsleApp()
{
m_hdPath = NULL;
m_cdPath = NULL;
@ -38,7 +52,7 @@ Isle::Isle()
}
// OFFSET: ISLE 0x4011a0
Isle::~Isle()
IsleApp::~IsleApp()
{
if (LegoOmni::GetInstance()) {
Close();
@ -63,7 +77,7 @@ Isle::~Isle()
}
// OFFSET: ISLE 0x401260
void Isle::Close()
void IsleApp::Close()
{
MxDSAction ds;
ds.SetUnknown24(-2);
@ -87,7 +101,7 @@ void Isle::Close()
} while (lVar8 == 0);
while (Lego()) {
if (Lego()->vtable28(ds) != MX_FALSE) {
if (Lego()->vtable28(ds) != FALSE) {
break;
}
@ -97,8 +111,461 @@ void Isle::Close()
}
}
// OFFSET: ISLE 0x4013b0
BOOL IsleApp::SetupLegoOmni()
{
BOOL result = FALSE;
char mediaPath[256];
GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath));
BOOL failure = Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE;
if (!failure) {
VariableTable()->SetVariable("ACTOR_01", "");
TickleManager()->vtable1c(VideoManager(), 10);
result = TRUE;
}
return result;
}
// OFFSET: ISLE 0x401560
void IsleApp::SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers,
BOOL using8bit, BOOL using16bit, BOOL param_6, BOOL param_7,
BOOL wideViewAngle, char *deviceId)
{
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().Set16Bit(0);
}
if (using16bit) {
m_videoParam.flags().Set16Bit(1);
}
}
BOOL FindExistingInstance(void);
BOOL StartDirectSound(void);
// OFFSET: ISLE 0x401610
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\xAE Island\" is not detecting a DirectSound compatible sound card. Please quit all other applications and try again.",
"Lego Island Error", MB_OK);
return 0;
}
// Create global app instance
g_isle = new IsleApp();
// Create window
if (g_isle->SetupWindow(hInstance, lpCmdLine) != SUCCESS) {
MessageBoxA(NULL, "\"LEGO\xAE Island\" failed to start. Please quit all other applications and try again.", "LEGO\xAE Island Error", MB_OK);
return 0;
}
// Get reference to window
HWND window;
if (g_isle->m_windowHandle) {
window = g_isle->m_windowHandle;
}
// Load accelerators (this call actually achieves nothing - there is no "AppAccel" resource in the original - but we'll keep this for authenticity)
// This line may actually be here because it's in DFVIEW, an example project that ships with
// MSVC420, and was such a clean example of a Win32 app, that it was later adapted
// into an "ExeSkeleton" sample for MSVC600. It's quite possible Mindscape derived
// this app from that example since they no longer had the luxury of the
// MFC AppWizard which we know they used for the frontend used during development (ISLEMFC.EXE, MAIN.EXE, et al.)
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(0);
}
while (!g_closed) {
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 (g_reqEnableRMDevice) {
g_reqEnableRMDevice = 0;
VideoManager()->EnableRMDevice();
g_rmDisabled = 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;
}
}
}
DestroyWindow(window);
return msg.wParam;
}
// OFFSET: ISLE 0x401ca0
BOOL FindExistingInstance(void)
{
HWND hWnd = FindWindowA(WNDCLASS_NAME, WINDOW_TITLE);
if (hWnd) {
if (SetForegroundWindow(hWnd)) {
ShowWindow(hWnd, SW_RESTORE);
}
return 0;
}
return 1;
}
// OFFSET: ISLE 0x401ce0
BOOL StartDirectSound(void)
{
LPDIRECTSOUND lpDS = NULL;
HRESULT ret = DirectSoundCreate(NULL, &lpDS, NULL);
if (ret == DS_OK && lpDS != NULL) {
lpDS->Release();
return TRUE;
}
return FALSE;
}
// OFFSET: ISLE 0x401d20
LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
NotificationId type;
unsigned char keyCode = 0;
if (!g_isle) {
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
}
switch (uMsg) {
case WM_PAINT:
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
case WM_ACTIVATE:
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
case WM_ACTIVATEAPP:
if (g_isle) {
if ((wParam != 0) && (g_isle->m_fullScreen)) {
MoveWindow(hWnd, g_windowRect.left, g_windowRect.top,
(g_windowRect.right - g_windowRect.left) + 1,
(g_windowRect.bottom - g_windowRect.top) + 1, TRUE);
}
g_isle->m_windowActive = wParam;
}
return DefWindowProcA(hWnd,uMsg,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,uMsg,wParam,lParam);
case WM_GETMINMAXINFO:
((MINMAXINFO*) lParam)->ptMaxTrackSize.x = (g_windowRect.right - g_windowRect.left) + 1;
((MINMAXINFO*) lParam)->ptMaxTrackSize.y = (g_windowRect.bottom - g_windowRect.top) + 1;
((MINMAXINFO*) lParam)->ptMinTrackSize.x = (g_windowRect.right - g_windowRect.left) + 1;
((MINMAXINFO*) lParam)->ptMinTrackSize.y = (g_windowRect.bottom - g_windowRect.top) + 1;
return 0;
case WM_ENTERMENULOOP:
return DefWindowProcA(hWnd,uMsg,wParam,lParam);
case WM_SYSCOMMAND:
if (wParam == SC_SCREENSAVE) {
return 0;
}
if (wParam == SC_CLOSE && g_closed == 0) {
if (g_isle) {
if (g_rmDisabled) {
ShowWindow(g_isle->m_windowHandle, SW_RESTORE);
}
PostMessageA(g_isle->m_windowHandle, WM_CLOSE, 0, 0);
return 0;
}
} else if (g_isle && g_isle->m_fullScreen && (wParam == SC_MOVE || wParam == SC_KEYMENU)) {
return 0;
}
return DefWindowProcA(hWnd,uMsg,wParam,lParam);
case WM_EXITMENULOOP:
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
case WM_MOVING:
if (g_isle && g_isle->m_fullScreen) {
GetWindowRect(hWnd, (LPRECT) lParam);
return 0;
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
case WM_NCPAINT:
if (g_isle && g_isle->m_fullScreen) {
return 0;
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
case WM_DISPLAYCHANGE:
if (g_isle && VideoManager() && g_isle->m_fullScreen && VideoManager()->m_unk74 && VideoManager()->m_unk74[0x220]) {
int targetWidth = LOWORD(lParam);
int targetHeight = HIWORD(lParam);
int targetDepth = wParam;
if (g_waitingForTargetDepth) {
g_waitingForTargetDepth = 0;
g_targetDepth = targetDepth;
}
else {
BOOL valid = FALSE;
if (targetWidth == g_targetWidth && targetHeight == g_targetHeight && g_targetDepth == targetDepth) {
valid = TRUE;
}
if (g_rmDisabled) {
if (valid) {
g_reqEnableRMDevice = 1;
}
}
else if (!valid) {
g_rmDisabled = 1;
Lego()->vtable38();
VideoManager()->DisableRMDevice();
}
}
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
case WM_SETCURSOR:
if (g_isle) {
HCURSOR hCursor = g_isle->m_cursorCurrent;
if (hCursor == g_isle->m_cursorBusy || hCursor == g_isle->m_cursorNo || !hCursor) {
SetCursor(hCursor);
return 0;
}
}
break;
case WM_KEYDOWN:
// While this probably should be (HIWORD(lParam) & KF_REPEAT), this seems
// to be what the assembly is actually doing
if (lParam & (KF_REPEAT << 16)) {
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
}
keyCode = wParam;
type = KEYDOWN;
break;
case WM_MOUSEMOVE:
g_mousemoved = 1;
type = MOUSEMOVE;
break;
case WM_TIMER:
type = TIMER;
break;
case WM_LBUTTONDOWN:
g_mousedown = 1;
type = MOUSEDOWN;
break;
case WM_LBUTTONUP:
g_mousedown = 0;
type = MOUSEUP;
break;
case 0x5400:
if (g_isle) {
g_isle->SetupCursor(wParam);
return 0;
}
break;
default:
return DefWindowProcA(hWnd,uMsg,wParam,lParam);
}
if (g_isle) {
if (InputManager()) {
InputManager()->QueueEvent(type, wParam, LOWORD(lParam), HIWORD(lParam), keyCode);
}
if (g_isle && g_isle->m_drawCursor && type == MOUSEMOVE) {
int x = LOWORD(lParam);
int y = HIWORD(lParam);
if (x >= 640) {
x = 639;
}
if (y >= 480) {
y = 479;
}
VideoManager()->MoveCursor(x,y);
}
}
return 0;
}
// OFFSET: ISLE 0x4023e0
MxResult IsleApp::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine)
{
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, MAKEINTRESOURCEA(APP_ICON));
wndclass.hCursor = m_cursorArrow = m_cursorCurrent = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_ARROW));
m_cursorBusy = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_BUSY));
m_cursorNo = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_NO));
wndclass.hInstance = hInstance;
wndclass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wndclass.lpszClassName = WNDCLASS_NAME;
if (!RegisterClassA(&wndclass)) {
return FAILURE;
}
if (m_fullScreen) {
AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW);
m_windowHandle = CreateWindowExA(
WS_EX_APPWINDOW,
WNDCLASS_NAME,
WINDOW_TITLE,
WS_CAPTION | WS_SYSMENU,
g_windowRect.left,
g_windowRect.top,
g_windowRect.right - g_windowRect.left + 1,
g_windowRect.bottom - g_windowRect.top + 1,
NULL, NULL, hInstance, NULL
);
} else {
AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW);
m_windowHandle = CreateWindowExA(
WS_EX_APPWINDOW,
WNDCLASS_NAME,
WINDOW_TITLE,
WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
g_windowRect.right - g_windowRect.left + 1,
g_windowRect.bottom - g_windowRect.top + 1,
NULL, NULL, hInstance, NULL
);
}
if (!m_windowHandle) {
return FAILURE;
}
if (m_fullScreen) {
MoveWindow(m_windowHandle, g_windowRect.left, g_windowRect.top, (g_windowRect.right - g_windowRect.left) + 1, (g_windowRect.bottom - g_windowRect.top) + 1, TRUE);
}
ShowWindow(m_windowHandle, SW_SHOWNORMAL);
UpdateWindow(m_windowHandle);
if (!SetupLegoOmni()) {
return FAILURE;
}
GameState()->SetSavePath(m_savePath);
GameState()->SerializePlayersInfo(1);
GameState()->SerializeScoreHistory(1);
int iVar10;
switch (m_islandQuality) {
case 0:
iVar10 = 1;
break;
case 1:
iVar10 = 2;
break;
default:
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_useJoystick = m_useJoystick;
LegoOmni::GetInstance()->GetInputManager()->m_joystickIndex = m_joystickIndex;
}
}
if (m_fullScreen) {
MoveWindow(m_windowHandle, g_windowRect.left, g_windowRect.top, (g_windowRect.right - g_windowRect.left) + 1, (g_windowRect.bottom - g_windowRect.top) + 1, TRUE);
}
ShowWindow(m_windowHandle, SW_SHOWNORMAL);
UpdateWindow(m_windowHandle);
return SUCCESS;
}
// OFFSET: ISLE 0x402740
BOOL Isle::ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize)
BOOL IsleApp::ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize)
{
HKEY hKey;
DWORD valueType;
@ -117,7 +584,7 @@ BOOL Isle::ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize)
}
// OFFSET: ISLE 0x4027b0
int Isle::ReadRegBool(LPCSTR name, BOOL *out)
int IsleApp::ReadRegBool(LPCSTR name, BOOL *out)
{
char buffer[256];
@ -139,7 +606,7 @@ int Isle::ReadRegBool(LPCSTR name, BOOL *out)
}
// OFFSET: ISLE 0x402880
int Isle::ReadRegInt(LPCSTR name, int *out)
int IsleApp::ReadRegInt(LPCSTR name, int *out)
{
char buffer[256];
@ -152,7 +619,7 @@ int Isle::ReadRegInt(LPCSTR name, int *out)
}
// OFFSET: ISLE 0x4028d0
void Isle::LoadConfig()
void IsleApp::LoadConfig()
{
char buffer[1024];
@ -216,46 +683,76 @@ void Isle::LoadConfig()
}
}
// OFFSET: ISLE 0x401560
void Isle::SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers,
BOOL using8bit, BOOL using16bit, BOOL param_6, BOOL param_7,
BOOL wideViewAngle, char *deviceId)
// OFFSET: ISLE 0x402c20
inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
{
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().Set16Bit(0);
}
if (using16bit) {
m_videoParam.flags().Set16Bit(1);
}
}
// OFFSET: ISLE 0x4013b0
BOOL Isle::SetupLegoOmni()
{
BOOL result = FALSE;
char mediaPath[256];
GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath));
BOOL failure = Lego()->Create(MxOmniCreateParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE;
if (!failure) {
VariableTable()->SetVariable("ACTOR_01", "");
TickleManager()->vtable1c(VideoManager(), 10);
result = TRUE;
if (!this->m_windowActive) {
Sleep(0);
return;
}
return result;
if (!Lego()) return;
if (!TickleManager()) return;
if (!Timer()) return;
long currentTime = Timer()->GetRealTime();
if (currentTime < g_lastFrameTime) {
g_lastFrameTime = -this->m_frameDelta;
}
if (this->m_frameDelta + g_lastFrameTime < currentTime) {
if (!Lego()->vtable40()) {
TickleManager()->Tickle();
}
g_lastFrameTime = currentTime;
if (g_startupDelay == 0) {
return;
}
g_startupDelay--;
if (g_startupDelay != 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.SetAtomId(stream->atom);
ds.SetUnknown24(-1);
ds.SetUnknown1c(0);
VideoManager()->EnableFullScreenMovie(TRUE, TRUE);
if (Start(&ds) != SUCCESS) {
return;
}
} else {
ds.SetAtomId(stream->atom);
ds.SetUnknown24(-1);
ds.SetUnknown1c(0);
if (Start(&ds) != SUCCESS) {
return;
}
this->m_gameStarted = 1;
}
return;
}
if (sleepIfNotNextFrame != 0)
Sleep(0);
}
// OFFSET: ISLE 0x402e80
void Isle::SetupCursor(WPARAM wParam)
void IsleApp::SetupCursor(WPARAM wParam)
{
switch (wParam) {
case 0:
@ -281,4 +778,4 @@ void Isle::SetupCursor(WPARAM wParam)
}
SetCursor(m_cursorCurrent);
}
}

View file

@ -1,48 +1,34 @@
#ifndef ISLE_H
#define ISLE_H
#include "legoinc.h"
#include "define.h"
#include <windows.h>
#include "legoomni.h"
#include "legoanimationmanager.h"
#include "legobuildingmanager.h"
#include "legomodelpresenter.h"
#include "legopartpresenter.h"
#include "legoworldpresenter.h"
#include "mxresult.h"
#include "mxvideoparam.h"
#include "mxdirectdraw.h"
#include "mxdsaction.h"
#include "mxomni.h"
#include "res/resource.h"
class Isle
class IsleApp
{
public:
Isle();
~Isle();
IsleApp();
~IsleApp();
void Close();
BOOL SetupLegoOmni();
void SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers,
BOOL using8bit, BOOL using16bit, BOOL param_6, BOOL param_7,
BOOL wideViewAngle, char *deviceId);
MxResult SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine);
BOOL ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize);
int ReadRegBool(LPCSTR name, BOOL *out);
int ReadRegInt(LPCSTR name, int *out);
MxResult SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine);
void Tick(BOOL sleepIfNotNextFrame);
BOOL SetupLegoOmni();
void LoadConfig();
void SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers,
BOOL using8bit, BOOL using16bit, BOOL param_6, BOOL param_7,
BOOL wideViewAngle, char *deviceId);
void Tick(BOOL sleepIfNotNextFrame);
void SetupCursor(WPARAM wParam);
// private:
// private:
// 0
LPSTR m_hdPath;
LPSTR m_cdPath;
@ -85,193 +71,6 @@ class Isle
HCURSOR m_cursorBusy;
HCURSOR m_cursorNo;
HCURSOR m_cursorCurrent;
};
extern LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
// OFFSET: ISLE 0x4023e0
inline MxResult Isle::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine)
{
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, MAKEINTRESOURCEA(APP_ICON));
wndclass.hCursor = m_cursorArrow = m_cursorCurrent = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_ARROW));
m_cursorBusy = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_BUSY));
m_cursorNo = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_NO));
wndclass.hInstance = hInstance;
wndclass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wndclass.lpszClassName = WNDCLASS_NAME;
if (!RegisterClassA(&wndclass)) {
return FAILURE;
}
if (m_fullScreen) {
AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW);
m_windowHandle = CreateWindowExA(
WS_EX_APPWINDOW,
WNDCLASS_NAME,
WINDOW_TITLE,
WS_CAPTION | WS_SYSMENU,
g_windowRect.left,
g_windowRect.top,
g_windowRect.right - g_windowRect.left + 1,
g_windowRect.bottom - g_windowRect.top + 1,
NULL, NULL, hInstance, NULL
);
} else {
AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW);
m_windowHandle = CreateWindowExA(
WS_EX_APPWINDOW,
WNDCLASS_NAME,
WINDOW_TITLE,
WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
g_windowRect.right - g_windowRect.left + 1,
g_windowRect.bottom - g_windowRect.top + 1,
NULL, NULL, hInstance, NULL
);
}
if (!m_windowHandle) {
return FAILURE;
}
if (m_fullScreen) {
MoveWindow(m_windowHandle, g_windowRect.left, g_windowRect.top, (g_windowRect.right - g_windowRect.left) + 1, (g_windowRect.bottom - g_windowRect.top) + 1, TRUE);
}
ShowWindow(m_windowHandle, SW_SHOWNORMAL);
UpdateWindow(m_windowHandle);
if (!SetupLegoOmni()) {
return FAILURE;
}
GameState()->SetSavePath(m_savePath);
GameState()->SerializePlayersInfo(1);
GameState()->SerializeScoreHistory(1);
int iVar10;
switch (m_islandQuality) {
case 0:
iVar10 = 1;
break;
case 1:
iVar10 = 2;
break;
default:
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_useJoystick = m_useJoystick;
LegoOmni::GetInstance()->GetInputManager()->m_joystickIndex = m_joystickIndex;
}
}
if (m_fullScreen) {
MoveWindow(m_windowHandle, g_windowRect.left, g_windowRect.top, (g_windowRect.right - g_windowRect.left) + 1, (g_windowRect.bottom - g_windowRect.top) + 1, TRUE);
}
ShowWindow(m_windowHandle, SW_SHOWNORMAL);
UpdateWindow(m_windowHandle);
return SUCCESS;
}
// OFFSET: ISLE 0x402c20
inline void Isle::Tick(BOOL sleepIfNotNextFrame)
{
if (!this->m_windowActive) {
Sleep(0);
return;
}
if (!Lego()) return;
if (!TickleManager()) return;
if (!Timer()) return;
long currentTime = Timer()->GetRealTime();
if (currentTime < g_lastFrameTime) {
g_lastFrameTime = -this->m_frameDelta;
}
if (this->m_frameDelta + g_lastFrameTime < currentTime) {
if (!Lego()->vtable40()) {
TickleManager()->Tickle();
}
g_lastFrameTime = currentTime;
if (g_startupDelay == 0) {
return;
}
g_startupDelay--;
if (g_startupDelay != 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.SetAtomId(stream->atom);
ds.SetUnknown24(-1);
ds.SetUnknown1c(0);
VideoManager()->EnableFullScreenMovie(TRUE, TRUE);
if (Start(&ds) != SUCCESS) {
return;
}
} else {
ds.SetAtomId(stream->atom);
ds.SetUnknown24(-1);
ds.SetUnknown1c(0);
if (Start(&ds) != SUCCESS) {
return;
}
this->m_gameStarted = 1;
}
return;
}
if (sleepIfNotNextFrame != 0)
Sleep(0);
}
#endif // ISLE_H

View file

@ -1,311 +0,0 @@
#include <dsound.h>
#include "legoinc.h"
#include "define.h"
#include "legoomni.h"
#include "isle.h"
// OFFSET: ISLE 0x401ca0
BOOL FindExistingInstance(void)
{
HWND hWnd = FindWindowA(WNDCLASS_NAME, WINDOW_TITLE);
if (hWnd) {
if (SetForegroundWindow(hWnd)) {
ShowWindow(hWnd, SW_RESTORE);
}
return 0;
}
return 1;
}
// OFFSET: ISLE 0x401ce0
BOOL StartDirectSound(void)
{
LPDIRECTSOUND lpDS = NULL;
HRESULT ret = DirectSoundCreate(NULL, &lpDS, NULL);
if (ret == DS_OK && lpDS != NULL) {
lpDS->Release();
return TRUE;
}
return FALSE;
}
// OFFSET: ISLE 0x401610
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\xAE Island\" is not detecting a DirectSound compatible sound card. Please quit all other applications and try again.",
"Lego Island Error", MB_OK);
return 0;
}
// Create global app instance
g_isle = new Isle();
// Create window
if (g_isle->SetupWindow(hInstance, lpCmdLine) != SUCCESS) {
MessageBoxA(NULL, "\"LEGO\xAE Island\" failed to start. Please quit all other applications and try again.", "LEGO\xAE Island Error", MB_OK);
return 0;
}
// Get reference to window
HWND window;
if (g_isle->m_windowHandle) {
window = g_isle->m_windowHandle;
}
// Load accelerators (this call actually achieves nothing - there is no "AppAccel" resource in the original - but we'll keep this for authenticity)
// This line may actually be here because it's in DFVIEW, an example project that ships with
// MSVC420, and was such a clean example of a Win32 app, that it was later adapted
// into an "ExeSkeleton" sample for MSVC600. It's quite possible Mindscape derived
// this app from that example since they no longer had the luxury of the
// MFC AppWizard which we know they used for the frontend used during development (ISLEMFC.EXE, MAIN.EXE, et al.)
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(0);
}
while (!g_closed) {
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 (g_reqEnableRMDevice) {
g_reqEnableRMDevice = 0;
VideoManager()->EnableRMDevice();
g_rmDisabled = 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;
}
}
}
DestroyWindow(window);
return msg.wParam;
}
// OFFSET: ISLE 0x401d20
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, g_windowRect.left, g_windowRect.top,
(g_windowRect.right - g_windowRect.left) + 1,
(g_windowRect.bottom - g_windowRect.top) + 1, TRUE);
}
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 = (g_windowRect.right - g_windowRect.left) + 1;
mmi->ptMaxTrackSize.y = (g_windowRect.bottom - g_windowRect.top) + 1;
mmi->ptMinTrackSize.x = (g_windowRect.right - g_windowRect.left) + 1;
mmi->ptMinTrackSize.y = (g_windowRect.bottom - g_windowRect.top) + 1;
return 0;
}
case WM_ENTERMENULOOP:
return DefWindowProcA(hWnd,WM_ENTERMENULOOP,wParam,lParam);
case WM_SYSCOMMAND:
if (wParam == SC_SCREENSAVE) {
return 0;
}
if (wParam == SC_CLOSE && g_closed == 0) {
if (g_isle) {
if (g_rmDisabled) {
ShowWindow(g_isle->m_windowHandle, SW_RESTORE);
}
PostMessageA(g_isle->m_windowHandle, WM_CLOSE, 0, 0);
return 0;
}
} else if (g_isle && g_isle->m_fullScreen && (wParam == SC_MOVE || wParam == SC_KEYMENU)) {
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:
if (g_isle && VideoManager() && g_isle->m_fullScreen && VideoManager()->m_unk74 && VideoManager()->m_unk74[0x220]) {
if (!g_waitingForTargetDepth) {
unsigned char valid = FALSE;
if (LOWORD(lParam) == g_targetWidth && HIWORD(lParam) == g_targetHeight && g_targetDepth == wParam) {
valid = TRUE;
}
if (!g_rmDisabled) {
if (!valid) {
g_rmDisabled = 1;
Lego()->vtable38();
VideoManager()->DisableRMDevice();
}
} else if (valid) {
g_reqEnableRMDevice = 1;
}
} else {
g_waitingForTargetDepth = 0;
g_targetDepth = 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:
case 0x5400:
{
NotificationId type = NONE;
unsigned char keyCode = 0;
switch (uMsg) {
case WM_KEYDOWN:
// While this probably should be (HIWORD(lParam) & KF_REPEAT), this seems
// to be what the assembly is actually doing
if (lParam & (KF_REPEAT << 16)) {
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_cursorCurrent;
if (hCursor == g_isle->m_cursorBusy || hCursor == g_isle->m_cursorNo || !hCursor) {
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) {
g_isle->SetupCursor(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);
}

View file

@ -1,4 +1,4 @@
#include "legoinc.h"
#include <windows.h>
// OFFSET: LEGO1 0x10091ee0
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)

View file

@ -1,10 +0,0 @@
#ifndef LEGOINC_H
#define LEGOINC_H
// It is recommended to include this over <windows.h> directly because this way
// we can undef stuff that might cause issues with our code.
#include <windows.h>
#undef GetClassName
#endif // LEGOINC_H

View file

@ -26,7 +26,7 @@ float g_turnDecel = 50.0f;
// 0x100f4c50
float g_turnSensitivity = 0.4f;
// 0x100f4c54
MxBool g_turnUseVelocity = MX_FALSE;
MxBool g_turnUseVelocity = FALSE;
// OFFSET: LEGO1 0x10054d40
void LegoNavController::GetDefaults(int *p_mouseDeadzone, float *p_movementMaxSpeed, float *p_turnMaxSpeed,
@ -77,9 +77,9 @@ LegoNavController::LegoNavController()
this->m_targetTurnSpeed = 0.0f;
this->m_movementAccel = 0.0f;
this->m_turnAccel = 0.0f;
this->m_trackDefault = MX_FALSE;
this->m_unk5D = MX_FALSE;
this->m_unk6C = MX_FALSE;
this->m_trackDefault = FALSE;
this->m_unk5D = FALSE;
this->m_unk6C = FALSE;
this->m_unk64 = 0;
this->m_unk68 = 0;
this->m_unk60 = 0;
@ -133,12 +133,12 @@ void LegoNavController::ResetToDefault()
// OFFSET: LEGO1 0x10054e40
void LegoNavController::SetTargets(int p_hPos, int p_vPos, MxBool p_accel)
{
if (this->m_trackDefault != MX_FALSE)
if (this->m_trackDefault != FALSE)
{
ResetToDefault();
}
if (p_accel != MX_FALSE)
if (p_accel != FALSE)
{
this->m_targetTurnSpeed = CalculateNewTargetSpeed(p_hPos, this->m_hMax / 2, this->m_turnMaxSpeed);
this->m_targetMovementSpeed = CalculateNewTargetSpeed(this->m_vMax - p_vPos, this->m_vMax / 2, this->m_movementMaxSpeed);
@ -184,4 +184,4 @@ float LegoNavController::CalculateNewAccel(int p_pos, int p_center, float p_maxA
}
return result;
}
}

View file

@ -2,8 +2,8 @@
#define LEGONAVCONTROLLER_H
#include "mxcore.h"
#include "mxbool.h"
#include "mxtimer.h"
#include "mxtypes.h"
class LegoNavController : public MxCore
{

View file

@ -99,7 +99,7 @@ void LegoOmni::vtable24(MxDSAction &ds)
MxBool LegoOmni::vtable28(MxDSAction &ds)
{
// FIXME: Stub
return MX_TRUE;
return TRUE;
}
void LegoOmni::vtable2c()

View file

@ -32,12 +32,10 @@ class LegoOmni : public MxOmni
virtual long Notify(MxParam &p); // vtable+04
// OFFSET: LEGO1 0x10058aa0
inline virtual const char *GetClassName() const { return "LegoOmni"; }; // vtable+0c
inline virtual const char *ClassName() const { return "LegoOmni"; }; // vtable+0c
// OFFSET: LEGO1 0x10058ab0
inline virtual MxBool IsClass(const char *name) const {
return !strcmp(name, LegoOmni::GetClassName()) || MxOmni::IsClass(name);
}; // vtable+10;
inline virtual MxBool IsA(const char *name) const { return !strcmp(name, LegoOmni::ClassName()) || MxOmni::IsA(name); }; // vtable+10;
virtual void Init(); // vtable+14
virtual MxResult Create(MxOmniCreateParam &p); // vtable+18

View file

@ -7,7 +7,7 @@ class MxAutoLocker
{
public:
MxAutoLocker(MxCriticalSection* cs);
virtual ~MxAutoLocker();
~MxAutoLocker();
private:
MxCriticalSection* m_criticalSection;
};

View file

@ -1,9 +0,0 @@
#ifndef MXBOOL_H
#define MXBOOL_H
typedef unsigned char MxBool;
#define MX_TRUE 1
#define MX_FALSE 0
#endif // MXBOOL_H

View file

@ -3,7 +3,7 @@
#include <string.h>
#include "mxbool.h"
#include "mxtypes.h"
class MxParam;
@ -16,12 +16,10 @@ class MxCore
virtual long Tickle(); // vtable+08
// OFFSET: LEGO1 0x100144c0
inline virtual const char *GetClassName() const { return "MxCore"; }; // vtable+0c
inline virtual const char *ClassName() const { return "MxCore"; }; // vtable+0c
// OFFSET: LEGO1 0x100140d0
inline virtual MxBool IsClass(const char *name) const {
return !strcmp(name, MxCore::GetClassName());
}; // vtable+10
inline virtual MxBool IsA(const char *name) const { return !strcmp(name, MxCore::ClassName()); }; // vtable+10
private:
unsigned int m_id;

View file

@ -1,7 +1,7 @@
#ifndef MXCRITICALSECTION_H
#define MXCRITICALSECTION_H
#include "legoinc.h"
#include <windows.h>
class MxCriticalSection
{

View file

@ -1,6 +1,130 @@
#include "mxdsfile.h"
#include <stdio.h>
#define SI_MAJOR_VERSION 2
#define SI_MINOR_VERSION 2
#define FOURCC(a, b, c, d) (((a) << 0) | ((b) << 8) | ((c) << 16) | ((d) << 24))
// OFFSET: LEGO1 0x100cc4b0
MxDSFile::MxDSFile(const char *filename, unsigned long skipReadingChunks)
{
m_filename = filename;
m_skipReadingChunks = skipReadingChunks;
}
// OFFSET: LEGO1 0x100bfed0
MxDSFile::~MxDSFile()
{
Close();
}
// OFFSET: LEGO1 0x100cc590
long MxDSFile::Open(unsigned long uStyle)
{
// No idea what's stopping this one matching, but I'm pretty
// confident it has the correct behavior.
long longResult = 1;
memset(&m_io, 0, sizeof(MXIOINFO));
if (m_io.Open(m_filename.GetData(), uStyle) != 0) {
return -1;
}
m_io.SetBuffer(NULL, 0, 0);
m_position = 0;
if (m_skipReadingChunks == 0) {
longResult = ReadChunks();
}
if (longResult != 0) {
Close(); // vtable + 0x18
}
else {
Seek(0, 0); // vtable + 0x24
}
return longResult;
}
// OFFSET: LEGO1 0x100cc780
long MxDSFile::Read(unsigned char *pch, unsigned long cch)
{
if (m_io.Read((char*)pch, cch) != cch)
return -1;
m_position += cch;
return 0;
}
// OFFSET: LEGO1 0x100cc620
long MxDSFile::ReadChunks()
{
_MMCKINFO topChunk;
_MMCKINFO childChunk;
char tempBuffer[80];
topChunk.fccType = FOURCC('O', 'M', 'N', 'I');
if (m_io.Descend(&topChunk, NULL, MMIO_FINDRIFF) != 0) {
return -1;
}
childChunk.ckid = FOURCC('M', 'x', 'H', 'd');
if (m_io.Descend(&childChunk, &topChunk, 0) != 0) {
return -1;
}
m_io.Read((char*)&m_header, 0xc);
if ((m_header.majorVersion == SI_MAJOR_VERSION) && (m_header.minorVersion == SI_MINOR_VERSION))
{
childChunk.ckid = FOURCC('M', 'x', 'O', 'f');
if (m_io.Descend(&childChunk, &topChunk, 0) != 0) {
return -1;
}
unsigned long* pLengthInDWords = &m_lengthInDWords;
m_io.Read((char *)pLengthInDWords, 4);
m_pBuffer = malloc(*pLengthInDWords * 4);
m_io.Read((char*)m_pBuffer, *pLengthInDWords * 4);
return 0;
}
else
{
sprintf(tempBuffer, "Wrong SI file version. %d.%d expected.", SI_MAJOR_VERSION, SI_MINOR_VERSION);
MessageBoxA(NULL, tempBuffer, NULL, MB_ICONERROR);
return -1;
}
}
// OFFSET: LEGO1 0x100cc7b0
long MxDSFile::Seek(long lOffset, int iOrigin)
{
return (m_position = m_io.Seek(lOffset, iOrigin)) == -1 ? -1 : 0;
}
// OFFSET: LEGO1 0x100cc7e0
unsigned long MxDSFile::GetBufferSize()
{
return this->m_buffersize;
return m_header.bufferSize;
}
// OFFSET: LEGO1 0x100cc7f0
unsigned long MxDSFile::GetStreamBuffersNum()
{
return m_header.streamBuffersNum;
}
// OFFSET: LEGO1 0x100cc740
long MxDSFile::Close()
{
m_io.Close(0);
m_position = -1;
memset(&m_header, 0, sizeof(m_header));
if (m_lengthInDWords != 0)
{
m_lengthInDWords = 0;
free(m_pBuffer);
m_pBuffer = NULL;
}
return 0;
}

View file

@ -1,20 +1,47 @@
#ifndef MXDSFILE_H
#define MXDSFILE_H
class MxDSFile
#include "mxcore.h"
#include "mxstring.h"
#include "mxioinfo.h"
#include "mxdssource.h"
class MxDSFile : public MxDSSource
{
public:
__declspec(dllexport) MxDSFile(const char *,unsigned long);
__declspec(dllexport) MxDSFile(const char *filename, unsigned long skipReadingChunks);
__declspec(dllexport) virtual ~MxDSFile();
__declspec(dllexport) virtual long Close();
__declspec(dllexport) virtual unsigned long GetBufferSize();
__declspec(dllexport) virtual unsigned long GetStreamBuffersNum();
__declspec(dllexport) virtual long Open(unsigned long);
__declspec(dllexport) virtual long Close();
__declspec(dllexport) virtual long Read(unsigned char *,unsigned long);
__declspec(dllexport) virtual long Seek(long,int);
__declspec(dllexport) virtual unsigned long GetBufferSize();
__declspec(dllexport) virtual unsigned long GetStreamBuffersNum();
private:
char m_unknown[0x70];
unsigned long m_buffersize;
long ReadChunks();
struct ChunkHeader {
ChunkHeader()
: majorVersion(0)
, minorVersion(0)
, bufferSize(0)
, streamBuffersNum(0)
{}
unsigned short majorVersion;
unsigned short minorVersion;
unsigned long bufferSize;
short streamBuffersNum;
short reserved;
};
MxString m_filename;
MXIOINFO m_io;
ChunkHeader m_header;
// If false, read chunks immediately on open, otherwise
// skip reading chunks until ReadChunks is explicitly called.
unsigned long m_skipReadingChunks;
};
#endif // MXDSFILE_H

14
LEGO1/mxdssource.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "mxdssource.h"
// OFFSET: LEGO1 0x100bffd0
void MxDSSource::SomethingWhichCallsRead(void* pUnknownObject)
{
// TODO: Calls read, reading into a buffer somewhere in pUnknownObject.
Read(NULL, 0);
}
// OFFSET: LEGO1 0x100bfff0
long MxDSSource::GetLengthInDWords()
{
return m_lengthInDWords;
}

30
LEGO1/mxdssource.h Normal file
View file

@ -0,0 +1,30 @@
#ifndef MXDSSOURCE_H
#define MXDSSOURCE_H
#include "mxcore.h"
class MxDSSource : public MxCore
{
public:
MxDSSource()
: m_lengthInDWords(0)
, m_pBuffer(0)
, m_position(-1)
{}
virtual long Open(unsigned long) = 0;
virtual long Close() = 0;
virtual void SomethingWhichCallsRead(void* pUnknownObject);
virtual long Read(unsigned char *, unsigned long) = 0;
virtual long Seek(long, int) = 0;
virtual unsigned long GetBufferSize() = 0;
virtual unsigned long GetStreamBuffersNum() = 0;
virtual long GetLengthInDWords();
protected:
unsigned long m_lengthInDWords;
void* m_pBuffer;
long m_position;
};
#endif // MXDSSOURCE_H

49
LEGO1/mxioinfo.cpp Normal file
View file

@ -0,0 +1,49 @@
#include "mxioinfo.h"
// OFFSET: LEGO1 0x100cc800
MXIOINFO::MXIOINFO()
{
memset(&m_info, 0, sizeof(MMIOINFO));
}
// OFFSET: LEGO1 0x100cc820
MXIOINFO::~MXIOINFO()
{
Close(0);
}
// OFFSET: LEGO1 0x100cc830
unsigned short MXIOINFO::Open(const char *filename, DWORD fdwOpen)
{
return 0;
}
// OFFSET: LEGO1 0x100cc8e0
void MXIOINFO::Close(long arg)
{
}
// OFFSET: LEGO1 0x100cc930
unsigned long MXIOINFO::Read(HPSTR pch, LONG cch)
{
return 0;
}
// OFFSET: LEGO1 0x100cca00
LONG MXIOINFO::Seek(LONG lOffset, int iOrigin)
{
return 0;
}
// OFFSET: LEGO1 0x100ccbc0
void MXIOINFO::SetBuffer(LPSTR pchBuffer, LONG cchBuffer, LONG unk)
{
}
// OFFSET: LEGO1 0x100cce60
unsigned short MXIOINFO::Descend(LPMMCKINFO pmmcki, const MMCKINFO *pmmckiParent, UINT fuDescend)
{
return 0;
}

View file

@ -1,10 +1,24 @@
#ifndef MXIOINFO_H
#define MXIOINFO_H
#include <windows.h>
#include "mmsystem.h"
class MXIOINFO
{
public:
MXIOINFO();
__declspec(dllexport) ~MXIOINFO();
unsigned short Open(const char *filename, DWORD fdwOpen);
void Close(long arg);
LONG Seek(LONG lOffset, int iOrigin);
unsigned long Read(HPSTR pch, LONG cch);
void SetBuffer(LPSTR pchBuffer, LONG cchBuffer, LONG unk);
unsigned short Descend(LPMMCKINFO pmmcki, const MMCKINFO *pmmckiParent, UINT fuDescend);
MMIOINFO m_info;
};
#endif // MXIOINFO_H

View file

@ -3,15 +3,15 @@
// OFFSET: LEGO1 0x100b0a30
MxOmniCreateFlags::MxOmniCreateFlags()
{
this->CreateObjectFactory(MX_TRUE);
this->CreateVariableTable(MX_TRUE);
this->CreateTickleManager(MX_TRUE);
this->CreateNotificationManager(MX_TRUE);
this->CreateVideoManager(MX_TRUE);
this->CreateSoundManager(MX_TRUE);
this->CreateMusicManager(MX_TRUE);
this->CreateEventManager(MX_TRUE);
this->CreateObjectFactory(TRUE);
this->CreateVariableTable(TRUE);
this->CreateTickleManager(TRUE);
this->CreateNotificationManager(TRUE);
this->CreateVideoManager(TRUE);
this->CreateSoundManager(TRUE);
this->CreateMusicManager(TRUE);
this->CreateEventManager(TRUE);
this->CreateTimer(MX_TRUE);
this->CreateStreamer(MX_TRUE);
this->CreateTimer(TRUE);
this->CreateStreamer(TRUE);
}

View file

@ -1,7 +1,7 @@
#ifndef MXOMNICREATEFLAGS_H
#define MXOMNICREATEFLAGS_H
#include "mxbool.h"
#include "mxtypes.h"
class MxOmniCreateFlags
{
@ -36,17 +36,17 @@ class MxOmniCreateFlags
const inline MxBool CreateTimer() const { return this->m_flags2 & Flag_CreateTimer; }
const inline MxBool CreateStreamer() const { return this->m_flags2 & Flag_CreateStreamer; }
inline void CreateObjectFactory(MxBool b) { this->m_flags1 = (b == MX_TRUE ? this->m_flags1 | Flag_CreateObjectFactory : this->m_flags1 & ~Flag_CreateObjectFactory); }
inline void CreateVariableTable(MxBool b) { this->m_flags1 = (b == MX_TRUE ? this->m_flags1 | Flag_CreateVariableTable : this->m_flags1 & ~Flag_CreateVariableTable); }
inline void CreateTickleManager(MxBool b) { this->m_flags1 = (b == MX_TRUE ? this->m_flags1 | Flag_CreateTickleManager : this->m_flags1 & ~Flag_CreateTickleManager); }
inline void CreateNotificationManager(MxBool b) { this->m_flags1 = (b == MX_TRUE ? this->m_flags1 | Flag_CreateNotificationManager : this->m_flags1 & ~Flag_CreateNotificationManager); }
inline void CreateVideoManager(MxBool b) { this->m_flags1 = (b == MX_TRUE ? this->m_flags1 | Flag_CreateVideoManager : this->m_flags1 & ~Flag_CreateVideoManager); }
inline void CreateSoundManager(MxBool b) { this->m_flags1 = (b == MX_TRUE ? this->m_flags1 | Flag_CreateSoundManager : this->m_flags1 & ~Flag_CreateSoundManager); }
inline void CreateMusicManager(MxBool b) { this->m_flags1 = (b == MX_TRUE ? this->m_flags1 | Flag_CreateMusicManager : this->m_flags1 & ~Flag_CreateMusicManager); }
inline void CreateEventManager(MxBool b) { this->m_flags1 = (b == MX_TRUE ? this->m_flags1 | Flag_CreateEventManager : this->m_flags1 & ~Flag_CreateEventManager); }
inline void CreateObjectFactory(MxBool b) { this->m_flags1 = (b == TRUE ? this->m_flags1 | Flag_CreateObjectFactory : this->m_flags1 & ~Flag_CreateObjectFactory); }
inline void CreateVariableTable(MxBool b) { this->m_flags1 = (b == TRUE ? this->m_flags1 | Flag_CreateVariableTable : this->m_flags1 & ~Flag_CreateVariableTable); }
inline void CreateTickleManager(MxBool b) { this->m_flags1 = (b == TRUE ? this->m_flags1 | Flag_CreateTickleManager : this->m_flags1 & ~Flag_CreateTickleManager); }
inline void CreateNotificationManager(MxBool b) { this->m_flags1 = (b == TRUE ? this->m_flags1 | Flag_CreateNotificationManager : this->m_flags1 & ~Flag_CreateNotificationManager); }
inline void CreateVideoManager(MxBool b) { this->m_flags1 = (b == TRUE ? this->m_flags1 | Flag_CreateVideoManager : this->m_flags1 & ~Flag_CreateVideoManager); }
inline void CreateSoundManager(MxBool b) { this->m_flags1 = (b == TRUE ? this->m_flags1 | Flag_CreateSoundManager : this->m_flags1 & ~Flag_CreateSoundManager); }
inline void CreateMusicManager(MxBool b) { this->m_flags1 = (b == TRUE ? this->m_flags1 | Flag_CreateMusicManager : this->m_flags1 & ~Flag_CreateMusicManager); }
inline void CreateEventManager(MxBool b) { this->m_flags1 = (b == TRUE ? this->m_flags1 | Flag_CreateEventManager : this->m_flags1 & ~Flag_CreateEventManager); }
inline void CreateTimer(MxBool b) { this->m_flags2 = (b == MX_TRUE ? this->m_flags2 | Flag_CreateTimer : this->m_flags2 & ~Flag_CreateTimer); }
inline void CreateStreamer(MxBool b) { this->m_flags2 = (b == MX_TRUE ? this->m_flags2 | Flag_CreateStreamer : this->m_flags2 & ~Flag_CreateStreamer); }
inline void CreateTimer(MxBool b) { this->m_flags2 = (b == TRUE ? this->m_flags2 | Flag_CreateTimer : this->m_flags2 & ~Flag_CreateTimer); }
inline void CreateStreamer(MxBool b) { this->m_flags2 = (b == TRUE ? this->m_flags2 | Flag_CreateStreamer : this->m_flags2 & ~Flag_CreateStreamer); }
private:
unsigned char m_flags1;

View file

@ -1,7 +1,8 @@
#ifndef MXOMNICREATEPARAM_H
#define MXOMNICREATEPARAM_H
#include "legoinc.h"
#include <windows.h>
#include "mxomnicreateflags.h"
#include "mxomnicreateparambase.h"
#include "mxstring.h"

0
LEGO1/mxpalette.cpp Executable file → Normal file
View file

View file

@ -6,7 +6,7 @@
MxString::MxString()
{
// Set string to one char in length and set that char to null terminator
this->m_data = (char *)malloc(1);
this->m_data = new char[1];
this->m_data[0] = 0;
this->m_length = 0;
}
@ -15,7 +15,7 @@ MxString::MxString()
MxString::MxString(const MxString &str)
{
this->m_length = str.m_length;
this->m_data = (char *)malloc(this->m_length + 1);
this->m_data = new char[this->m_length + 1];
strcpy(this->m_data, str.m_data);
}
@ -24,10 +24,10 @@ MxString::MxString(const char *str)
{
if (str) {
this->m_length = strlen(str);
this->m_data = (char *)malloc(this->m_length + 1);
this->m_data = new char[this->m_length + 1];
strcpy(this->m_data, str);
} else {
this->m_data = (char *)malloc(1);
this->m_data = new char[1];
this->m_data[0] = 0;
this->m_length = 0;
}
@ -36,7 +36,7 @@ MxString::MxString(const char *str)
// OFFSET: LEGO1 0x100ae420
MxString::~MxString()
{
free(this->m_data);
delete[] this->m_data;
}
// OFFSET: LEGO1 0x100ae490
@ -52,30 +52,63 @@ void MxString::ToLowerCase()
}
// OFFSET: LEGO1 0x100ae4b0
const MxString &MxString::operator=(MxString *param)
MxString &MxString::operator=(MxString *param)
{
if (this->m_data != param->m_data)
{
free(this->m_data);
delete[] this->m_data;
this->m_length = param->m_length;
this->m_data = (char *)malloc(this->m_length + 1);
this->m_data = new char[this->m_length + 1];
strcpy(this->m_data, param->m_data);
}
return *this;
}
// TODO: this *mostly* matches, again weird with the comparison
// OFFSET: LEGO1 0x100ae510
const MxString &MxString::operator=(const char *param)
{
if (this->m_data != param)
{
free(this->m_data);
delete[] this->m_data;
this->m_length = strlen(param);
this->m_data = (char *)malloc(this->m_length + 1);
this->m_data = new char[this->m_length + 1];
strcpy(this->m_data, param);
}
return *this;
}
// Return type is intentionally just MxString, not MxString&.
// This forces MSVC to add $ReturnUdt$ to the stack for 100% match.
// OFFSET: LEGO1 0x100ae580
MxString MxString::operator+(const char *str)
{
// MxString constructor allocates 1 byte for m_data, so free that first
MxString tmp;
delete[] tmp.m_data;
tmp.m_length = strlen(str) + this->m_length;
tmp.m_data = new char[tmp.m_length + 1];
strcpy(tmp.m_data, this->m_data);
strcpy(tmp.m_data + this->m_length, str);
return MxString(tmp);
}
// OFFSET: LEGO1 0x100ae690
MxString& MxString::operator+=(const char *str)
{
int newlen = this->m_length + strlen(str);
char *tmp = new char[newlen + 1];
strcpy(tmp, this->m_data);
strcpy(tmp + this->m_length, str);
delete[] this->m_data;
this->m_length = newlen;
this->m_data = tmp;
return *this;
}

View file

@ -14,7 +14,11 @@ class MxString : public MxCore
MxString(const char *);
void ToUpperCase();
void ToLowerCase();
const MxString &operator=(MxString *);
MxString& operator=(MxString *);
MxString operator+(const char *);
MxString& operator+=(const char *);
inline const char *GetData() const { return m_data; }
private:
char *m_data;

View file

@ -9,8 +9,8 @@ class MxTickleManager : public MxCore
virtual ~MxTickleManager();
virtual long Tickle();
virtual const char *GetClassName() const;
virtual MxBool IsClass(const char *name) const;
virtual const char *ClassName() const;
virtual MxBool IsA(const char *name) const;
virtual void vtable14();
virtual void vtable18();
virtual void vtable1c(void *v, int p);

View file

@ -1,6 +1,6 @@
#include "mxtimer.h"
#include "legoinc.h"
#include <windows.h>
// 0x10101414
long MxTimer::s_LastTimeCalculated = 0;
@ -11,7 +11,7 @@ long MxTimer::s_LastTimeTimerStarted = 0;
// OFFSET: LEGO1 0x100ae060
MxTimer::MxTimer()
{
this->m_isRunning = MX_FALSE;
this->m_isRunning = FALSE;
m_startTime = timeGetTime();
// yeah this is somehow what the asm is
s_LastTimeCalculated = m_startTime;
@ -21,7 +21,7 @@ MxTimer::MxTimer()
void MxTimer::Start()
{
s_LastTimeTimerStarted = this->GetRealTime();
this->m_isRunning = MX_TRUE;
this->m_isRunning = TRUE;
}
// OFFSET: LEGO1 0x100ae180
@ -29,7 +29,7 @@ void MxTimer::Stop()
{
long elapsed = this->GetRealTime();
long startTime = elapsed - MxTimer::s_LastTimeTimerStarted;
this->m_isRunning = MX_FALSE;
this->m_isRunning = FALSE;
// this feels very stupid but it's what the assembly does
this->m_startTime = this->m_startTime + startTime - 5;
}

21
LEGO1/mxtypes.h Normal file
View file

@ -0,0 +1,21 @@
#ifndef MXTYPE_H
#define MXTYPE_H
typedef unsigned char MxU8;
typedef char MxS8;
typedef unsigned short MxU16;
typedef short MxS16;
typedef unsigned int MxU32;
typedef int MxS32;
typedef unsigned char MxBool;
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#endif MXTYPE_H

0
LEGO1/mxunknown100dc6b0.cpp Executable file → Normal file
View file

0
LEGO1/mxunknown100dc6b0.h Executable file → Normal file
View file

4
LEGO1/mxvideomanager.cpp Executable file → Normal file
View file

@ -14,7 +14,7 @@ int MxVideoManager::Init()
this->m_unk58 = NULL;
this->m_unk5c = 0;
this->m_videoParam.SetPalette(NULL);
this->m_unk60 = MX_FALSE;
this->m_unk60 = FALSE;
return 0;
}
@ -33,4 +33,4 @@ long MxVideoManager::RealizePalette(MxPalette *p_palette)
this->m_criticalSection.Leave();
return 0;
}
}

View file

@ -4,8 +4,8 @@
#include <ddraw.h>
#include "mxpalette.h"
#include "mxbool.h"
#include "mxrect32.h"
#include "mxtypes.h"
#include "mxvariabletable.h"
#include "mxvideoparamflags.h"

View file

@ -1,7 +1,7 @@
#ifndef MXVIDEOPARAMFLAGS_H
#define MXVIDEOPARAMFLAGS_H
#include "legoinc.h"
#include <windows.h>
// Must be union with struct for match.
typedef union {

View file

@ -6,7 +6,7 @@ This is a **work-in-progress** decompilation of LEGO Island version 1.1. It aims
## Status
*TODO: A progress bar showing the percentage progress of this decompilation.*
<img src="https://github.com/isledecomp/isle/releases/download/continuous/ISLEPROGRESS.PNG" width="50%"><img src="https://github.com/isledecomp/isle/releases/download/continuous/LEGO1PROGRESS.PNG" width="50%">
Currently `ISLE.EXE` is completely decompiled, however there are some known inaccuracies. It should work if you pair it with the original game's `LEGO1.DLL` (and other files), however small things may not work correctly yet. Work on decompiling `LEGO1.DLL` has only just started and currently it is too incomplete to be usable.

360
isle.mak
View file

@ -34,7 +34,7 @@ NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "isle - Win32 Debug"
# PROP Target_Last_Scanned "ISLE - Win32 Debug"
!IF "$(CFG)" == "LEGO1 - Win32 Release"
@ -55,17 +55,16 @@ ALL : ".\Release\LEGO1.DLL"
CLEAN :
-@erase "$(INTDIR)\dllmain.obj"
-@erase "$(INTDIR)\legobackgroundcolor.obj"
-@erase "$(INTDIR)\legonavcontroller.obj"
-@erase "$(INTDIR)\legoomni.obj"
-@erase "$(INTDIR)\legoutil.obj"
-@erase "$(INTDIR)\legovideomanager.obj"
-@erase "$(INTDIR)\mxatomid.obj"
-@erase "$(INTDIR)\mxautolocker.obj"
-@erase "$(INTDIR)\mxbackgroundcolor.obj"
-@erase "$(INTDIR)\mxcore.obj"
-@erase "$(INTDIR)\mxcriticalsection.obj"
-@erase "$(INTDIR)\mxdsfile.obj"
-@erase "$(INTDIR)\mxdsobject.obj"
-@erase "$(INTDIR)\mxdssource.obj"
-@erase "$(INTDIR)\mxioinfo.obj"
-@erase "$(INTDIR)\mxomni.obj"
-@erase "$(INTDIR)\mxomnicreateflags.obj"
-@erase "$(INTDIR)\mxomnicreateparam.obj"
@ -136,17 +135,16 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
/implib:"Release/LEGO1.LIB"
LINK32_OBJS= \
"$(INTDIR)\dllmain.obj" \
"$(INTDIR)\legobackgroundcolor.obj" \
"$(INTDIR)\legonavcontroller.obj" \
"$(INTDIR)\legoomni.obj" \
"$(INTDIR)\legoutil.obj" \
"$(INTDIR)\legovideomanager.obj" \
"$(INTDIR)\mxatomid.obj" \
"$(INTDIR)\mxautolocker.obj" \
"$(INTDIR)\mxbackgroundcolor.obj" \
"$(INTDIR)\mxcore.obj" \
"$(INTDIR)\mxcriticalsection.obj" \
"$(INTDIR)\mxdsfile.obj" \
"$(INTDIR)\mxdsobject.obj" \
"$(INTDIR)\mxdssource.obj" \
"$(INTDIR)\mxioinfo.obj" \
"$(INTDIR)\mxomni.obj" \
"$(INTDIR)\mxomnicreateflags.obj" \
"$(INTDIR)\mxomnicreateparam.obj" \
@ -183,17 +181,16 @@ ALL : ".\Debug\LEGO1.DLL"
CLEAN :
-@erase "$(INTDIR)\dllmain.obj"
-@erase "$(INTDIR)\legobackgroundcolor.obj"
-@erase "$(INTDIR)\legonavcontroller.obj"
-@erase "$(INTDIR)\legoomni.obj"
-@erase "$(INTDIR)\legoutil.obj"
-@erase "$(INTDIR)\legovideomanager.obj"
-@erase "$(INTDIR)\mxatomid.obj"
-@erase "$(INTDIR)\mxautolocker.obj"
-@erase "$(INTDIR)\mxbackgroundcolor.obj"
-@erase "$(INTDIR)\mxcore.obj"
-@erase "$(INTDIR)\mxcriticalsection.obj"
-@erase "$(INTDIR)\mxdsfile.obj"
-@erase "$(INTDIR)\mxdsobject.obj"
-@erase "$(INTDIR)\mxdssource.obj"
-@erase "$(INTDIR)\mxioinfo.obj"
-@erase "$(INTDIR)\mxomni.obj"
-@erase "$(INTDIR)\mxomnicreateflags.obj"
-@erase "$(INTDIR)\mxomnicreateparam.obj"
@ -266,17 +263,16 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
/implib:"$(OUTDIR)/LEGO1.lib"
LINK32_OBJS= \
"$(INTDIR)\dllmain.obj" \
"$(INTDIR)\legobackgroundcolor.obj" \
"$(INTDIR)\legonavcontroller.obj" \
"$(INTDIR)\legoomni.obj" \
"$(INTDIR)\legoutil.obj" \
"$(INTDIR)\legovideomanager.obj" \
"$(INTDIR)\mxatomid.obj" \
"$(INTDIR)\mxautolocker.obj" \
"$(INTDIR)\mxbackgroundcolor.obj" \
"$(INTDIR)\mxcore.obj" \
"$(INTDIR)\mxcriticalsection.obj" \
"$(INTDIR)\mxdsfile.obj" \
"$(INTDIR)\mxdsobject.obj" \
"$(INTDIR)\mxdssource.obj" \
"$(INTDIR)\mxioinfo.obj" \
"$(INTDIR)\mxomni.obj" \
"$(INTDIR)\mxomnicreateflags.obj" \
"$(INTDIR)\mxomnicreateparam.obj" \
@ -315,7 +311,6 @@ CLEAN :
-@erase "$(INTDIR)\define.obj"
-@erase "$(INTDIR)\isle.obj"
-@erase "$(INTDIR)\isle.res"
-@erase "$(INTDIR)\main.obj"
-@erase "$(INTDIR)\vc40.pdb"
-@erase ".\Release\ISLE.EXE"
-@erase ".\Release\ISLE.PDB"
@ -376,7 +371,6 @@ LINK32_OBJS= \
"$(INTDIR)\define.obj" \
"$(INTDIR)\isle.obj" \
"$(INTDIR)\isle.res" \
"$(INTDIR)\main.obj" \
".\Release\LEGO1.LIB"
".\Release\ISLE.EXE" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
@ -405,7 +399,6 @@ CLEAN :
-@erase "$(INTDIR)\define.obj"
-@erase "$(INTDIR)\isle.obj"
-@erase "$(INTDIR)\isle.res"
-@erase "$(INTDIR)\main.obj"
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase ".\Debug\ISLE.EXE"
@ -468,7 +461,6 @@ LINK32_OBJS= \
"$(INTDIR)\define.obj" \
"$(INTDIR)\isle.obj" \
"$(INTDIR)\isle.res" \
"$(INTDIR)\main.obj" \
".\LEGO1\Debug\LEGO1.lib"
".\Debug\ISLE.EXE" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
@ -495,8 +487,8 @@ LINK32_OBJS= \
SOURCE=.\LEGO1\mxcore.cpp
DEP_CPP_MXCOR=\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxtypes.h"\
"$(INTDIR)\mxcore.obj" : $(SOURCE) $(DEP_CPP_MXCOR) "$(INTDIR)"
@ -508,11 +500,8 @@ DEP_CPP_MXCOR=\
# Begin Source File
SOURCE=.\LEGO1\dllmain.cpp
DEP_CPP_DLLMA=\
".\LEGO1\legoinc.h"\
"$(INTDIR)\dllmain.obj" : $(SOURCE) $(DEP_CPP_DLLMA) "$(INTDIR)"
"$(INTDIR)\dllmain.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
@ -526,7 +515,6 @@ DEP_CPP_LEGOO=\
".\LEGO1\lego3dview.h"\
".\LEGO1\legoentity.h"\
".\LEGO1\legogamestate.h"\
".\LEGO1\legoinc.h"\
".\LEGO1\legoinputmanager.h"\
".\LEGO1\legonavcontroller.h"\
".\LEGO1\legoomni.h"\
@ -534,13 +522,14 @@ DEP_CPP_LEGOO=\
".\LEGO1\legovideomanager.h"\
".\LEGO1\mxatomid.h"\
".\LEGO1\mxbackgroundaudiomanager.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxdsaction.h"\
".\LEGO1\mxdsfile.h"\
".\LEGO1\mxdsobject.h"\
".\LEGO1\mxdssource.h"\
".\LEGO1\mxeventmanager.h"\
".\LEGO1\mxioinfo.h"\
".\LEGO1\mxmusicmanager.h"\
".\LEGO1\mxnotificationmanager.h"\
".\LEGO1\mxobjectfactory.h"\
@ -558,6 +547,7 @@ DEP_CPP_LEGOO=\
".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\
".\LEGO1\mxtransitionmanager.h"\
".\LEGO1\mxtypes.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\
@ -576,7 +566,6 @@ DEP_CPP_LEGOO=\
SOURCE=.\LEGO1\mxcriticalsection.cpp
DEP_CPP_MXCRI=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxcriticalsection.h"\
@ -590,7 +579,6 @@ DEP_CPP_MXCRI=\
SOURCE=.\LEGO1\mxautolocker.cpp
DEP_CPP_MXAUT=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxautolocker.h"\
".\LEGO1\mxcriticalsection.h"\
@ -605,8 +593,9 @@ DEP_CPP_MXAUT=\
SOURCE=.\LEGO1\mxtimer.cpp
DEP_CPP_MXTIM=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxtimer.h"\
".\LEGO1\mxtypes.h"\
"$(INTDIR)\mxtimer.obj" : $(SOURCE) $(DEP_CPP_MXTIM) "$(INTDIR)"
@ -619,9 +608,7 @@ DEP_CPP_MXTIM=\
SOURCE=.\LEGO1\mxomni.cpp
DEP_CPP_MXOMN=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxatomid.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxeventmanager.h"\
@ -641,6 +628,7 @@ DEP_CPP_MXOMN=\
".\LEGO1\mxstring.h"\
".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\
".\LEGO1\mxtypes.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\
@ -658,12 +646,11 @@ DEP_CPP_MXOMN=\
SOURCE=.\LEGO1\mxvideoparam.cpp
DEP_CPP_MXVID=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxpalette.h"\
".\LEGO1\mxrect32.h"\
".\LEGO1\mxresult.h"\
".\LEGO1\mxtypes.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideoparam.h"\
".\LEGO1\mxvideoparamflags.h"\
@ -679,7 +666,6 @@ DEP_CPP_MXVID=\
SOURCE=.\LEGO1\mxvideoparamflags.cpp
DEP_CPP_MXVIDE=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxvideoparamflags.h"\
@ -693,8 +679,6 @@ DEP_CPP_MXVIDE=\
SOURCE=.\LEGO1\mxomnicreateparam.cpp
DEP_CPP_MXOMNI=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxomnicreateflags.h"\
".\LEGO1\mxomnicreateparam.h"\
@ -703,6 +687,7 @@ DEP_CPP_MXOMNI=\
".\LEGO1\mxrect32.h"\
".\LEGO1\mxresult.h"\
".\LEGO1\mxstring.h"\
".\LEGO1\mxtypes.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideoparam.h"\
".\LEGO1\mxvideoparamflags.h"\
@ -718,8 +703,6 @@ DEP_CPP_MXOMNI=\
SOURCE=.\LEGO1\mxomnicreateparambase.cpp
DEP_CPP_MXOMNIC=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxomnicreateflags.h"\
".\LEGO1\mxomnicreateparam.h"\
@ -728,6 +711,7 @@ DEP_CPP_MXOMNIC=\
".\LEGO1\mxrect32.h"\
".\LEGO1\mxresult.h"\
".\LEGO1\mxstring.h"\
".\LEGO1\mxtypes.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideoparam.h"\
".\LEGO1\mxvideoparamflags.h"\
@ -744,9 +728,9 @@ DEP_CPP_MXOMNIC=\
SOURCE=.\LEGO1\mxstring.cpp
DEP_CPP_MXSTR=\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxstring.h"\
".\LEGO1\mxtypes.h"\
"$(INTDIR)\mxstring.obj" : $(SOURCE) $(DEP_CPP_MXSTR) "$(INTDIR)"
@ -760,6 +744,7 @@ DEP_CPP_MXSTR=\
SOURCE=.\LEGO1\mxomnicreateflags.cpp
DEP_CPP_MXOMNICR=\
".\LEGO1\mxomnicreateflags.h"\
".\LEGO1\mxtypes.h"\
"$(INTDIR)\mxomnicreateflags.obj" : $(SOURCE) $(DEP_CPP_MXOMNICR) "$(INTDIR)"
@ -776,7 +761,6 @@ DEP_CPP_LEGON=\
".\LEGO1\lego3dview.h"\
".\LEGO1\legoentity.h"\
".\LEGO1\legogamestate.h"\
".\LEGO1\legoinc.h"\
".\LEGO1\legoinputmanager.h"\
".\LEGO1\legonavcontroller.h"\
".\LEGO1\legoomni.h"\
@ -785,13 +769,14 @@ DEP_CPP_LEGON=\
".\LEGO1\legovideomanager.h"\
".\LEGO1\mxatomid.h"\
".\LEGO1\mxbackgroundaudiomanager.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxdsaction.h"\
".\LEGO1\mxdsfile.h"\
".\LEGO1\mxdsobject.h"\
".\LEGO1\mxdssource.h"\
".\LEGO1\mxeventmanager.h"\
".\LEGO1\mxioinfo.h"\
".\LEGO1\mxmusicmanager.h"\
".\LEGO1\mxnotificationmanager.h"\
".\LEGO1\mxobjectfactory.h"\
@ -809,6 +794,7 @@ DEP_CPP_LEGON=\
".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\
".\LEGO1\mxtransitionmanager.h"\
".\LEGO1\mxtypes.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\
@ -828,9 +814,9 @@ DEP_CPP_LEGON=\
SOURCE=.\LEGO1\mxdsobject.cpp
DEP_CPP_MXDSO=\
".\LEGO1\mxatomid.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxdsobject.h"\
".\LEGO1\mxtypes.h"\
"$(INTDIR)\mxdsobject.obj" : $(SOURCE) $(DEP_CPP_MXDSO) "$(INTDIR)"
@ -850,33 +836,16 @@ DEP_CPP_MXATO=\
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxbackgroundcolor.cpp
DEP_CPP_MXBAC=\
".\LEGO1\mxbackgroundcolor.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxstring.h"\
"$(INTDIR)\mxbackgroundcolor.obj" : $(SOURCE) $(DEP_CPP_MXBAC) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxunknown100dc6b0.cpp
DEP_CPP_MXUNK=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxresult.h"\
".\LEGO1\mxtypes.h"\
".\LEGO1\mxunknown100dc6b0.h"\
@ -884,76 +853,18 @@ DEP_CPP_MXUNK=\
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\legobackgroundcolor.cpp
DEP_CPP_LEGOB=\
".\LEGO1\lego3dmanager.h"\
".\LEGO1\lego3dview.h"\
".\LEGO1\legobackgroundcolor.h"\
".\LEGO1\legoentity.h"\
".\LEGO1\legogamestate.h"\
".\LEGO1\legoinc.h"\
".\LEGO1\legoinputmanager.h"\
".\LEGO1\legonavcontroller.h"\
".\LEGO1\legoomni.h"\
".\LEGO1\legoroi.h"\
".\LEGO1\legoutil.h"\
".\LEGO1\legovideomanager.h"\
".\LEGO1\mxatomid.h"\
".\LEGO1\mxbackgroundaudiomanager.h"\
".\LEGO1\mxbackgroundcolor.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxdsaction.h"\
".\LEGO1\mxdsfile.h"\
".\LEGO1\mxdsobject.h"\
".\LEGO1\mxeventmanager.h"\
".\LEGO1\mxmusicmanager.h"\
".\LEGO1\mxnotificationmanager.h"\
".\LEGO1\mxobjectfactory.h"\
".\LEGO1\mxomni.h"\
".\LEGO1\mxomnicreateflags.h"\
".\LEGO1\mxomnicreateparam.h"\
".\LEGO1\mxomnicreateparambase.h"\
".\LEGO1\mxpalette.h"\
".\LEGO1\mxrect32.h"\
".\LEGO1\mxresult.h"\
".\LEGO1\mxsoundmanager.h"\
".\LEGO1\mxstreamcontroller.h"\
".\LEGO1\mxstreamer.h"\
".\LEGO1\mxstring.h"\
".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\
".\LEGO1\mxtransitionmanager.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\
".\LEGO1\mxvideoparam.h"\
".\LEGO1\mxvideoparamflags.h"\
".\LEGO1\viewmanager.h"\
"$(INTDIR)\legobackgroundcolor.obj" : $(SOURCE) $(DEP_CPP_LEGOB) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxvideomanager.cpp
DEP_CPP_MXVIDEO=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxpalette.h"\
".\LEGO1\mxrect32.h"\
".\LEGO1\mxresult.h"\
".\LEGO1\mxtypes.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\
@ -965,63 +876,68 @@ DEP_CPP_MXVIDEO=\
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\legoutil.cpp
DEP_CPP_LEGOU=\
".\LEGO1\legoutil.h"\
"$(INTDIR)\legoutil.obj" : $(SOURCE) $(DEP_CPP_LEGOU) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\legovideomanager.cpp
DEP_CPP_LEGOV=\
".\LEGO1\lego3dmanager.h"\
".\LEGO1\lego3dview.h"\
".\LEGO1\legoinc.h"\
".\LEGO1\legovideomanager.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxpalette.h"\
".\LEGO1\mxrect32.h"\
".\LEGO1\mxresult.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\
".\LEGO1\mxvideoparam.h"\
".\LEGO1\mxvideoparamflags.h"\
".\LEGO1\viewmanager.h"\
"$(INTDIR)\legovideomanager.obj" : $(SOURCE) $(DEP_CPP_LEGOV) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxpalette.cpp
DEP_CPP_MXPAL=\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxpalette.h"\
".\LEGO1\mxresult.h"\
".\LEGO1\mxtypes.h"\
"$(INTDIR)\mxpalette.obj" : $(SOURCE) $(DEP_CPP_MXPAL) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxioinfo.cpp
DEP_CPP_MXIOI=\
".\LEGO1\mxioinfo.h"\
"$(INTDIR)\mxioinfo.obj" : $(SOURCE) $(DEP_CPP_MXIOI) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxdsfile.cpp
DEP_CPP_MXDSF=\
".\LEGO1\mxcore.h"\
".\LEGO1\mxdsfile.h"\
".\LEGO1\mxdssource.h"\
".\LEGO1\mxioinfo.h"\
".\LEGO1\mxstring.h"\
".\LEGO1\mxtypes.h"\
"$(INTDIR)\mxdsfile.obj" : $(SOURCE) $(DEP_CPP_MXDSF) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxdssource.cpp
DEP_CPP_MXDSS=\
".\LEGO1\mxcore.h"\
".\LEGO1\mxdssource.h"\
".\LEGO1\mxtypes.h"\
"$(INTDIR)\mxdssource.obj" : $(SOURCE) $(DEP_CPP_MXDSS) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
# End Target
################################################################################
@ -1039,19 +955,6 @@ DEP_CPP_MXPAL=\
################################################################################
# Begin Source File
SOURCE=.\ISLE\define.cpp
DEP_CPP_DEFIN=\
".\ISLE\define.h"\
"$(INTDIR)\define.obj" : $(SOURCE) $(DEP_CPP_DEFIN) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\ISLE\isle.cpp
DEP_CPP_ISLE_=\
".\ISLE\define.h"\
@ -1063,7 +966,6 @@ DEP_CPP_ISLE_=\
".\LEGO1\legobuildingmanager.h"\
".\LEGO1\legoentity.h"\
".\LEGO1\legogamestate.h"\
".\LEGO1\legoinc.h"\
".\LEGO1\legoinputmanager.h"\
".\LEGO1\legomodelpresenter.h"\
".\LEGO1\legonavcontroller.h"\
@ -1074,14 +976,15 @@ DEP_CPP_ISLE_=\
".\LEGO1\legoworldpresenter.h"\
".\LEGO1\mxatomid.h"\
".\LEGO1\mxbackgroundaudiomanager.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxdirectdraw.h"\
".\LEGO1\mxdsaction.h"\
".\LEGO1\mxdsfile.h"\
".\LEGO1\mxdsobject.h"\
".\LEGO1\mxdssource.h"\
".\LEGO1\mxeventmanager.h"\
".\LEGO1\mxioinfo.h"\
".\LEGO1\mxmusicmanager.h"\
".\LEGO1\mxnotificationmanager.h"\
".\LEGO1\mxobjectfactory.h"\
@ -1099,6 +1002,7 @@ DEP_CPP_ISLE_=\
".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\
".\LEGO1\mxtransitionmanager.h"\
".\LEGO1\mxtypes.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\
@ -1111,69 +1015,6 @@ DEP_CPP_ISLE_=\
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\ISLE\main.cpp
DEP_CPP_MAIN_=\
".\ISLE\define.h"\
".\ISLE\isle.h"\
".\ISLE\res\resource.h"\
".\LEGO1\lego3dmanager.h"\
".\LEGO1\lego3dview.h"\
".\LEGO1\legoanimationmanager.h"\
".\LEGO1\legobuildingmanager.h"\
".\LEGO1\legoentity.h"\
".\LEGO1\legogamestate.h"\
".\LEGO1\legoinc.h"\
".\LEGO1\legoinputmanager.h"\
".\LEGO1\legomodelpresenter.h"\
".\LEGO1\legonavcontroller.h"\
".\LEGO1\legoomni.h"\
".\LEGO1\legopartpresenter.h"\
".\LEGO1\legoroi.h"\
".\LEGO1\legovideomanager.h"\
".\LEGO1\legoworldpresenter.h"\
".\LEGO1\mxatomid.h"\
".\LEGO1\mxbackgroundaudiomanager.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxcriticalsection.h"\
".\LEGO1\mxdirectdraw.h"\
".\LEGO1\mxdsaction.h"\
".\LEGO1\mxdsfile.h"\
".\LEGO1\mxdsobject.h"\
".\LEGO1\mxeventmanager.h"\
".\LEGO1\mxmusicmanager.h"\
".\LEGO1\mxnotificationmanager.h"\
".\LEGO1\mxobjectfactory.h"\
".\LEGO1\mxomni.h"\
".\LEGO1\mxomnicreateflags.h"\
".\LEGO1\mxomnicreateparam.h"\
".\LEGO1\mxomnicreateparambase.h"\
".\LEGO1\mxpalette.h"\
".\LEGO1\mxrect32.h"\
".\LEGO1\mxresult.h"\
".\LEGO1\mxsoundmanager.h"\
".\LEGO1\mxstreamcontroller.h"\
".\LEGO1\mxstreamer.h"\
".\LEGO1\mxstring.h"\
".\LEGO1\mxticklemanager.h"\
".\LEGO1\mxtimer.h"\
".\LEGO1\mxtransitionmanager.h"\
".\LEGO1\mxunknown100dc6b0.h"\
".\LEGO1\mxvariabletable.h"\
".\LEGO1\mxvideomanager.h"\
".\LEGO1\mxvideoparam.h"\
".\LEGO1\mxvideoparamflags.h"\
".\LEGO1\viewmanager.h"\
"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
@ -1323,18 +1164,6 @@ SOURCE=.\LEGO1\legoworldpresenter.h
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxatomid.h
!IF "$(CFG)" == "ISLE - Win32 Release"
!ELSEIF "$(CFG)" == "ISLE - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxbackgroundaudiomanager.h
!IF "$(CFG)" == "ISLE - Win32 Release"
@ -1614,6 +1443,31 @@ SOURCE=.\LEGO1\mxvideoparamflags.h
!ENDIF
# End Project Dependency
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxatomid.h
!IF "$(CFG)" == "ISLE - Win32 Release"
!ELSEIF "$(CFG)" == "ISLE - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\ISLE\define.cpp
DEP_CPP_DEFIN=\
".\ISLE\define.h"\
"$(INTDIR)\define.obj" : $(SOURCE) $(DEP_CPP_DEFIN) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
# End Target
# End Project
################################################################################

BIN
isle.mdp

Binary file not shown.

BIN
tools/reccmp/isle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
tools/reccmp/lego1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
import argparse
import base64
from capstone import *
import difflib
import struct
@ -15,9 +16,12 @@
parser.add_argument('recompiled', metavar='recompiled-binary', help='The recompiled binary')
parser.add_argument('pdb', metavar='recompiled-pdb', help='The PDB of the recompiled binary')
parser.add_argument('decomp_dir', metavar='decomp-dir', help='The decompiled source tree')
parser.add_argument('--total', '-T', metavar='total-func-count', help='Total number of expected functions (improves total accuracy statistic)')
parser.add_argument('--verbose', '-v', metavar='offset', help='Print assembly diff for specific function (original file\'s offset)')
parser.add_argument('--html', '-H', metavar='output-file', help='Generate searchable HTML summary of status and diffs')
parser.add_argument('--no-color', '-n', action='store_true', help='Do not color the output')
parser.add_argument('--svg', '-S', metavar='output-svg', help='Generate SVG graphic of progress')
parser.add_argument('--svg-icon', metavar='svg-icon', help='Icon to use in SVG (PNG)')
args = parser.parse_args()
@ -50,6 +54,8 @@
if not os.path.isdir(source):
parser.error('Source directory does not exist')
svg = args.svg
# Declare a class that can automatically convert virtual executable addresses
# to file addresses
class Bin:
@ -365,7 +371,8 @@ def parse_asm(file, addr, size):
# If html, record the diffs to an HTML file
if html:
htmlinsert.append('{address: "%s", name: "%s", matching: %s, diff: "%s"}' % (hex(addr), recinfo.name, str(ratio), '\\n'.join(udiff).replace('"', '\\"').replace('\n', '\\n')))
escaped = '\\n'.join(udiff).replace('"', '\\"').replace('\n', '\\n').replace('<', '&lt;').replace('>', '&gt;')
htmlinsert.append('{address: "%s", name: "%s", matching: %s, diff: "%s"}' % (hex(addr), recinfo.name, str(ratio), escaped))
except UnicodeDecodeError:
break
@ -389,6 +396,49 @@ def gen_html(html, data):
htmlfile.write(templatedata)
htmlfile.close()
def gen_svg(svg, name, icon, implemented_funcs, total_funcs, raw_accuracy):
templatefile = open(get_file_in_script_dir('template.svg'), 'r')
if not templatefile:
print('Failed to find SVG template file, can\'t generate SVG summary')
return
templatedata = templatefile.read()
templatefile.close()
# Replace icon
if args.svg_icon:
iconfile = open(args.svg_icon, 'rb')
templatedata = templatedata.replace('{icon}', base64.b64encode(iconfile.read()).decode('utf-8'), 1)
iconfile.close()
# Replace name
templatedata = templatedata.replace('{name}', name, 1)
# Replace implemented statistic
templatedata = templatedata.replace('{implemented}', '%.2f%% (%i/%i)' % (implemented_funcs / total_funcs * 100, implemented_funcs, total_funcs), 1)
# Replace accuracy statistic
templatedata = templatedata.replace('{accuracy}', '%.2f%%' % (raw_accuracy / implemented_funcs * 100), 1)
# Generate progress bar width
total_statistic = raw_accuracy / total_funcs
percenttemplate = '{progbar'
percentstart = templatedata.index(percenttemplate)
percentend = templatedata.index('}', percentstart)
progwidth = float(templatedata[percentstart + len(percenttemplate) + 1:percentend]) * total_statistic
templatedata = templatedata[0:percentstart] + str(progwidth) + templatedata[percentend + 1:]
# Replace percentage statistic
templatedata = templatedata.replace('{percent}', '%.2f%%' % (total_statistic * 100), 2)
svgfile = open(svg, 'w')
if not svgfile:
print('Failed to write to SVG file %s' % svg)
return
svgfile.write(templatedata)
svgfile.close()
if html:
gen_html(html, htmlinsert)
@ -396,5 +446,13 @@ def gen_html(html, data):
if not found_verbose_target:
print('Failed to find the function with address %s' % hex(verbose))
else:
implemented_funcs = function_count
if args.total:
function_count = int(args.total)
if function_count > 0:
print('\nTotal accuracy %.2f%% across %i functions' % (total_accuracy / function_count * 100, function_count))
if svg:
gen_svg(svg, os.path.basename(original), args.svg_icon, implemented_funcs, function_count, total_accuracy)

119
tools/reccmp/template.svg Normal file
View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="640"
height="480"
viewBox="0 0 169.33333 127"
version="1.1"
id="svg5"
xml:space="preserve"
sodipodi:docname="template.svg"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview26"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
showgrid="false"
inkscape:zoom="1.6046875"
inkscape:cx="158.90944"
inkscape:cy="220.6037"
inkscape:window-width="2560"
inkscape:window-height="1379"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g1273" /><defs
id="defs5">
<clipPath
id="progBarCutoff">
<rect
width="{progbar:127.18422}"
height="8.6508904"
x="21.118132"
y="134.05507"
id="rect2" />
</clipPath>
</defs><g
id="g1273"
transform="matrix(1.2683581,0,0,1.2683581,-22.720969,-65.913871)"><image
width="53.066437"
height="53.066437"
preserveAspectRatio="none"
style="image-rendering:optimizeSpeed"
xlink:href="data:image/png;base64,{icon}"
id="image1060"
x="58.13345"
y="51.967873" /><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.7px;font-family:mono;-inkscape-font-specification:mono;text-align:center;text-anchor:middle;fill:#ffffff;stroke:#000000;stroke-width:1.25161812;stroke-opacity:1;stroke-dasharray:none;paint-order:stroke fill markers"
x="84.666656"
y="118.35877"
id="text740"><tspan
id="tspan738"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:mono;-inkscape-font-specification:mono;text-align:center;text-anchor:middle;stroke:#000000;stroke-width:1.25161812;stroke-opacity:1;stroke-dasharray:none;paint-order:stroke fill markers"
x="84.666656"
y="118.35877">{name}</tspan></text><g
id="g1250"
transform="translate(-0.04358834,8.1397473)"><rect
style="display:inline;fill:none;fill-opacity:1;stroke:#000000;stroke-width:2.50324;stroke-dasharray:none;stroke-opacity:1"
id="rect1619"
width="127.18422"
height="8.6508904"
x="21.118132"
y="134.05507" /><rect
style="display:inline;fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:0.87411;stroke-dasharray:none;stroke-opacity:1"
id="rect1167"
width="127.18422"
height="8.6508904"
x="21.118132"
y="134.05507" /><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333px;font-family:mono;-inkscape-font-specification:mono;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.05833;stroke-dasharray:none;stroke-opacity:1"
x="76.884926"
y="139.89182"
id="text2152"><tspan
style="font-size:4.23333px;fill:#ffffff;fill-opacity:1;stroke-width:1.05833"
x="76.884926"
y="139.89182"
id="tspan2150">{percent}</tspan></text><rect
style="display:inline;fill:#ffffff;stroke:none;stroke-width:2.6764"
id="rect1169"
width="127.18422"
height="8.6508904"
x="21.118132"
y="134.05507"
clip-path="url(#progBarCutoff)" /><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333px;font-family:mono;-inkscape-font-specification:mono;text-align:start;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.05833;stroke-dasharray:none;stroke-opacity:1"
x="76.884926"
y="139.89182"
id="text18"
clip-path="url(#progBarCutoff)"
inkscape:label="text18"><tspan
style="font-size:4.23333px;fill:#000000;fill-opacity:1;stroke-width:1.05833"
x="76.884926"
y="139.89182"
id="tspan16">{percent}</tspan></text></g><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333px;font-family:mono;-inkscape-font-specification:mono;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.83441208;stroke-dasharray:none;stroke-opacity:1;opacity:1;stroke-linejoin:miter;stroke-linecap:butt;paint-order:stroke fill markers"
x="46.947659"
y="129.67447"
id="text1260"><tspan
id="tspan1258"
style="font-size:4.23333px;stroke-width:0.83441208;stroke:#000000;stroke-opacity:1;stroke-dasharray:none;stroke-linejoin:miter;stroke-linecap:butt;paint-order:stroke fill markers"
x="46.947659"
y="129.67447">Implemented: {implemented}</tspan><tspan
style="font-size:4.23333px;stroke-width:0.83441208;stroke:#000000;stroke-opacity:1;stroke-dasharray:none;stroke-linejoin:miter;stroke-linecap:butt;paint-order:stroke fill markers"
x="46.947659"
y="134.96613"
id="tspan1262">Accuracy: {accuracy}</tspan></text></g></svg>

After

Width:  |  Height:  |  Size: 5.6 KiB