Merge branch 'isledecomp:master' into mxpalette

This commit is contained in:
Joshua Peisach 2023-07-02 10:03:42 -04:00 committed by GitHub
commit ef4ffe2e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
142 changed files with 1126 additions and 358 deletions

7
.editorconfig Normal file
View File

@ -0,0 +1,7 @@
root = true
[*.{cpp,h,py,txt,editorconfig}]
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

View File

@ -1,10 +1,6 @@
name: Build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
on: [push, pull_request]
jobs:
build:
@ -61,6 +57,27 @@ jobs:
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "NMake Makefiles"
cmake --build .
- name: Upload Artifact
uses: actions/upload-artifact@master
with:
name: Win32
path: |
build/ISLE.EXE
build/ISLE.PDB
build/LEGO1.DLL
build/LEGO1.PDB
compare:
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@master
with:
name: Win32
path: build
- name: Restore cached original binaries
id: cache-original-binaries
uses: actions/cache/restore@v3
@ -103,14 +120,6 @@ jobs:
run: |
python3 tools/verexp/verexp.py legobin/LEGO1.DLL build/LEGO1.DLL
- name: Upload Artifact
uses: actions/upload-artifact@master
with:
name: Win32
path: |
build/ISLE.EXE
build/LEGO1.DLL
- name: Upload Artifact
uses: actions/upload-artifact@master
with:
@ -118,23 +127,35 @@ jobs:
path: |
ISLEPROGRESS.*
LEGO1PROGRESS.*
upload:
needs: [build, compare]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v3
with:
repository: 'probonopd/uploadtool'
- uses: actions/download-artifact@master
with:
name: Win32
path: build
- uses: actions/download-artifact@master
with:
name: Accuracy Report
- name: Upload Continuous Release
shell: bash
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPLOAD_KEY: ${{ secrets.UPLOAD_KEY }}
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 \
build/ISLE.EXE \
build/LEGO1.DLL \
ISLEPROGRESS.* \
LEGO1PROGRESS.*
curl -X POST -F key=$UPLOAD_KEY -F 'file=@ISLEPROGRESS.SVG' https://legoisland.org/progress/
curl -X POST -F key=$UPLOAD_KEY -F 'file=@LEGO1PROGRESS.SVG' https://legoisland.org/progress/

View File

@ -50,6 +50,7 @@ add_library(lego1 SHARED
LEGO1/legoanimmmpresenter.cpp
LEGO1/legoanimpresenter.cpp
LEGO1/legobackgroundcolor.cpp
LEGO1/legobackgroundcolor.cpp
LEGO1/legobuildingmanager.cpp
LEGO1/legocachesound.cpp
LEGO1/legocameracontroller.cpp
@ -80,6 +81,7 @@ add_library(lego1 SHARED
LEGO1/legosoundmanager.cpp
LEGO1/legostate.cpp
LEGO1/legotexturepresenter.cpp
LEGO1/legoutil.cpp
LEGO1/legovideomanager.cpp
LEGO1/legoworld.cpp
LEGO1/legoworldpresenter.cpp
@ -119,10 +121,13 @@ add_library(lego1 SHARED
LEGO1/mxflcpresenter.cpp
LEGO1/mxioinfo.cpp
LEGO1/mxloopingflcpresenter.cpp
LEGO1/mxloopingmidipresenter.cpp
LEGO1/mxloopingsmkpresenter.cpp
LEGO1/mxmediapresenter.cpp
LEGO1/mxmidipresenter.cpp
LEGO1/mxmusicpresenter.cpp
LEGO1/mxnotificationmanager.cpp
LEGO1/mxobjectfactory.cpp
LEGO1/mxomni.cpp
LEGO1/mxomnicreateflags.cpp
LEGO1/mxomnicreateparam.cpp
@ -136,9 +141,11 @@ add_library(lego1 SHARED
LEGO1/mxstillpresenter.cpp
LEGO1/mxstreamer.cpp
LEGO1/mxstring.cpp
LEGO1/mxstringvariable.cpp
LEGO1/mxtimer.cpp
LEGO1/mxtransitionmanager.cpp
LEGO1/mxunknown100dc6b0.cpp
LEGO1/mxunknown100dc6e0.cpp
LEGO1/mxvariabletable.cpp
LEGO1/mxvideomanager.cpp
LEGO1/mxvideoparam.cpp

View File

@ -30,6 +30,7 @@ In general, we're not exhaustively strict about coding style, but there are some
- `m_camelCase` for member variables.
- `g_camelCase` for global variables.
- `p_camelCase` for function parameters.
- Instead of C++ primitives (e.g. `int`, `long`, etc.), use types in `mxtypes.h` instead. This will help us ensure that variables will be the correct size regardless of the underlying compiler/platform/architecture.
## Questions?

View File

@ -37,4 +37,4 @@ int g_reqEnableRMDevice = 0;
int g_startupDelay = 200;
// 0x4101c0
long g_lastFrameTime = 0;
MxLong g_lastFrameTime = 0;

View File

@ -1,6 +1,7 @@
#ifndef DEFINE_H
#define DEFINE_H
#include <mxtypes.h>
#include <windows.h>
class IsleApp;
@ -21,6 +22,6 @@ extern int g_targetHeight;
extern int g_targetDepth;
extern int g_reqEnableRMDevice;
extern int g_startupDelay;
extern long g_lastFrameTime;
extern MxLong g_lastFrameTime;
#endif // DEFINE_H

View File

@ -95,7 +95,7 @@ void IsleApp::Close()
TransitionManager()->SetWaitIndicator(NULL);
Lego()->vtable3c();
long lVar8;
MxLong lVar8;
do {
lVar8 = Streamer()->Close(NULL);
} while (lVar8 == 0);
@ -571,7 +571,7 @@ BOOL IsleApp::ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize)
DWORD valueType;
BOOL out = FALSE;
unsigned long size = outSize;
DWORD size = outSize;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Mindscape\\LEGO Island", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
if (RegQueryValueExA(hKey, name, NULL, &valueType, (LPBYTE) outValue, &size) == ERROR_SUCCESS) {
if (RegCloseKey(hKey) == ERROR_SUCCESS) {
@ -695,7 +695,7 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
if (!TickleManager()) return;
if (!Timer()) return;
long currentTime = Timer()->GetRealTime();
MxLong currentTime = Timer()->GetRealTime();
if (currentTime < g_lastFrameTime) {
g_lastFrameTime = -this->m_frameDelta;
}

View File

@ -56,7 +56,7 @@ class IsleApp
// 40
int m_islandTexture;
int m_gameStarted;
long m_frameDelta;
MxLong m_frameDelta;
// 4c
MxVideoParam m_videoParam;

View File

@ -13,7 +13,7 @@ Act2Brick::~Act2Brick()
}
// STUB OFFSET: LEGO1 0x1007a8c0 STUB
long Act2Brick::Notify(MxParam &p)
MxLong Act2Brick::Notify(MxParam &p)
{
// TODO
@ -21,7 +21,7 @@ long Act2Brick::Notify(MxParam &p)
}
// OFFSET: LEGO1 0x1007a7f0 STUB
long Act2Brick::Tickle()
MxLong Act2Brick::Tickle()
{
// TODO

View File

@ -8,21 +8,21 @@
class Act2Brick : public LegoPathActor
{
public:
Act2Brick();
Act2Brick();
virtual ~Act2Brick() override; // vtable+0x0
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual long Tickle() override; // vtable+0x08
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Tickle() override; // vtable+0x08
// OFFSET: LEGO1 0x1007a360
inline virtual const char *ClassName() override // vtable+0x0c
inline virtual const char *ClassName() const override // vtable+0x0c
{
// 0x100f0438
return "Act2Brick";
}
// OFFSET: LEGO1 0x1007a370
inline virtual MxBool IsA(const char *name) override // vtable+0x10
inline virtual MxBool IsA(const char *name) const override // vtable+0x10
{
return !strcmp(Act2Brick::ClassName(), name) || LegoEntity::IsA(name);
}

View File

@ -1,7 +1,7 @@
#include "act2policestation.h"
// OFFSET: LEGO1 0x1004e0e0 STUB
long Act2PoliceStation::Notify(MxParam &p)
MxLong Act2PoliceStation::Notify(MxParam &p)
{
// TODO

View File

@ -8,7 +8,7 @@
class Act2PoliceStation : public LegoEntity
{
public:
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
// OFFSET: LEGO1 0x1000e200
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -1,7 +1,7 @@
#include "beachhouseentity.h"
// OFFSET: LEGO1 0x100150a0 STUB
long BeachHouseEntity::Notify(MxParam &p)
MxLong BeachHouseEntity::Notify(MxParam &p)
{
// TODO

View File

@ -8,7 +8,7 @@
class BeachHouseEntity : public BuildingEntity
{
public:
virtual long Notify(MxParam &p) override; // vtable+04
virtual MxLong Notify(MxParam &p) override; // vtable+04
// OFFSET: LEGO1 0x1000ee80
inline virtual const char *ClassName() const override // vtable+0x0c

14
LEGO1/compat.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef ISLECOMPAT_H
#define ISLECOMPAT_H
// Various macros to enable compiling with other/newer compilers.
// Use `COMPAT_CONST` where something ought to be 'const', and a newer compiler would complain if it
// wasn't, but we know it isn't 'const' in the original code.
#ifdef __MINGW32__
#define COMPAT_CONST const
#else
#define COMPAT_CONST
#endif
#endif // ISLECOMPAT_H

11
LEGO1/decomp.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef DECOMP_H
#define DECOMP_H
#define DECOMP_STATIC_ASSERT(V) namespace { typedef int foo[(V)?1:-1]; }
#define DECOMP_SIZE_ASSERT(T, S) DECOMP_STATIC_ASSERT(sizeof(T) == S)
typedef unsigned char undefined;
typedef unsigned short undefined2;
typedef unsigned int undefined4;
#endif // DECOMP_H

View File

@ -13,7 +13,7 @@ ElevatorBottom::~ElevatorBottom()
}
// OFFSET: LEGO1 0x10018150 STUB
long ElevatorBottom::Notify(MxParam &p)
MxLong ElevatorBottom::Notify(MxParam &p)
{
// TODO

View File

@ -10,7 +10,7 @@ class ElevatorBottom : public LegoWorld
ElevatorBottom();
virtual ~ElevatorBottom() override; // vtable+0x0
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
// OFFSET: LEGO1 0x10017f20
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -13,7 +13,7 @@ GasStation::~GasStation()
}
// OFFSET: LEGO1 0x10004a60 STUB
long GasStation::Notify(MxParam &p)
MxLong GasStation::Notify(MxParam &p)
{
// TODO
@ -21,7 +21,7 @@ long GasStation::Notify(MxParam &p)
}
// OFFSET: LEGO1 0x10005c90 STUB
long GasStation::Tickle()
MxLong GasStation::Tickle()
{
// TODO

View File

@ -12,8 +12,8 @@ class GasStation : public LegoWorld
GasStation();
virtual ~GasStation() override; // vtable+0x0
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual long Tickle() override; // vtable+0x8
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Tickle() override; // vtable+0x8
// OFFSET: LEGO1 0x10004780
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -13,7 +13,7 @@ HistoryBook::~HistoryBook()
}
// OFFSET: LEGO1 0x10082680 STUB
long HistoryBook::Notify(MxParam &p)
MxLong HistoryBook::Notify(MxParam &p)
{
// TODO

View File

@ -11,7 +11,7 @@ class HistoryBook : public LegoWorld
HistoryBook();
virtual ~HistoryBook() override; // vtable+0x0
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
// OFFSET: LEGO1 0x10082390
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -13,7 +13,7 @@ Hospital::~Hospital()
}
// OFFSET: LEGO1 0x10074990 STUB
long Hospital::Notify(MxParam &p)
MxLong Hospital::Notify(MxParam &p)
{
// TODO

View File

@ -11,7 +11,7 @@ class Hospital : public LegoWorld
Hospital();
virtual ~Hospital() override; // vtable+0x0
virtual long Notify(MxParam &p) override; // vtable+0x04
virtual MxLong Notify(MxParam &p) override; // vtable+0x04
// OFFSET: LEGO1 0x100746b0
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -13,7 +13,7 @@ Infocenter::~Infocenter()
}
// OFFSET: LEGO1 0x1006ef10 STUB
long Infocenter::Notify(MxParam &p)
MxLong Infocenter::Notify(MxParam &p)
{
// TODO
@ -21,7 +21,7 @@ long Infocenter::Notify(MxParam &p)
}
// OFFSET: LEGO1 0x10070af0 STUB
long Infocenter::Tickle()
MxLong Infocenter::Tickle()
{
// TODO

View File

@ -11,8 +11,8 @@ class Infocenter : public LegoWorld
Infocenter();
virtual ~Infocenter() override;
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual long Tickle() override; // vtable+0x8
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Tickle() override; // vtable+0x8
// OFFSET: LEGO1 0x1006eb40
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -13,7 +13,7 @@ InfocenterDoor::~InfocenterDoor()
}
// OFFSET: LEGO1 0x100379e0 STUB
long InfocenterDoor::Notify(MxParam &p)
MxLong InfocenterDoor::Notify(MxParam &p)
{
// TODO

View File

@ -11,7 +11,7 @@ class InfocenterDoor : public LegoWorld
InfocenterDoor();
virtual ~InfocenterDoor(); // vtable+0x0
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
// OFFSET: LEGO1 0x100377b0
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -15,7 +15,7 @@ LegoAnimationManager::~LegoAnimationManager()
}
// OFFSET: LEGO1 0x100619f0 STUB
long LegoAnimationManager::Notify(MxParam &p)
MxLong LegoAnimationManager::Notify(MxParam &p)
{
// TODO
@ -23,7 +23,7 @@ long LegoAnimationManager::Notify(MxParam &p)
}
// OFFSET: LEGO1 0x10061cc0 STUB
long LegoAnimationManager::Tickle()
MxLong LegoAnimationManager::Tickle()
{
// TODO

View File

@ -11,8 +11,8 @@ class LegoAnimationManager : public MxCore
LegoAnimationManager();
virtual ~LegoAnimationManager() override; // vtable+0x0
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual long Tickle() override; // vtable+0x8
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Tickle() override; // vtable+0x8
// OFFSET: LEGO1 0x1005ec80
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -1,7 +1,56 @@
#include "legobackgroundcolor.h"
#include "legoomni.h"
#include "legoutil.h"
#include "legovideomanager.h"
const char *Delimiter = "\t";
const char *set = "set";
const char *reset = "reset";
// OFFSET: LEGO1 0x1003bfb0
LegoBackgroundColor::LegoBackgroundColor(const char *, const char *)
LegoBackgroundColor::LegoBackgroundColor(const char *name, const char *colorString)
{
// TODO
m_name = name;
m_name.ToUpperCase();
SetColorString(colorString);
}
// OFFSET: LEGO1 0x1003c070
void LegoBackgroundColor::SetColorString(const char *colorString)
{
m_name = colorString;
m_string.ToLowerCase();
float converted_r;
float converted_b;
float converted_g;
LegoVideoManager *videomanager = VideoManager();
if (videomanager && colorString)
{
int length = strlen(colorString) + 1;
char *colorStringCopy = new char[length];
strcpy(colorStringCopy, colorString);
char *colorStringSplit = strtok(colorStringCopy, Delimiter);
if (!strcmp(colorStringSplit, set))
{
char *hue = strtok(0, Delimiter);
if (hue)
h = atoi(hue) * 0.01;
char *sat = strtok(0, Delimiter);
if (sat)
s = atoi(sat) * 0.01;
char *val = strtok(0, Delimiter);
if (val)
v = atoi(val) * 0.01;
}
else if (!strcmp(colorStringSplit, reset))
{
// reset it
ConvertHSVToRGB(this->h, this->s, this->v, &converted_r, &converted_g, &converted_b);
videomanager->SetSkyColor(converted_r, converted_g, converted_b);
}
delete[] colorStringCopy;
}
}

View File

@ -1,10 +1,18 @@
#ifndef LEGOBACKGROUNDCOLOR_H
#define LEGOBACKGROUNDCOLOR_H
#include "mxstring.h"
#include "mxcore.h"
#include "mxstringvariable.h"
class LegoBackgroundColor
class LegoBackgroundColor : public MxStringVariable
{
public:
__declspec(dllexport) LegoBackgroundColor(const char *, const char *);
void SetColorString(const char *colorString);
protected:
float h;
float s;
float v;
};
#endif // LEGOBACKGROUNDCOLOR_H

View File

@ -13,7 +13,7 @@ LegoCarBuild::~LegoCarBuild()
}
// OFFSET: LEGO1 0x10024050 STUB
long LegoCarBuild::Notify(MxParam &p)
MxLong LegoCarBuild::Notify(MxParam &p)
{
// TODO
@ -21,7 +21,7 @@ long LegoCarBuild::Notify(MxParam &p)
}
// OFFSET: LEGO1 0x100238b0 STUB
long LegoCarBuild::Tickle()
MxLong LegoCarBuild::Tickle()
{
// TODO

View File

@ -11,8 +11,8 @@ class LegoCarBuild : public LegoWorld
LegoCarBuild();
virtual ~LegoCarBuild() override;
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual long Tickle() override; // vtable+0x8
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Tickle() override; // vtable+0x8
// OFFSET: LEGO1 0x10022940
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -13,7 +13,7 @@ LegoControlManager::~LegoControlManager()
}
// OFFSET: LEGO1 0x10029600 STUB
long LegoControlManager::Tickle()
MxLong LegoControlManager::Tickle()
{
// TODO

View File

@ -10,7 +10,7 @@ class LegoControlManager : public MxCore
LegoControlManager();
virtual ~LegoControlManager() override; // vtable+0x0
virtual long Tickle() override; // vtable+0x8
virtual MxLong Tickle() override; // vtable+0x8
// OFFSET: LEGO1 0x10028cb0
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -7,7 +7,7 @@ LegoEntity::~LegoEntity()
}
// OFFSET: LEGO1 0x100114f0 STUB
long LegoEntity::Notify(MxParam &p)
MxLong LegoEntity::Notify(MxParam &p)
{
// TODO

View File

@ -15,7 +15,7 @@ class LegoEntity : public MxEntity
__declspec(dllexport) virtual ~LegoEntity() override; // vtable+0x0
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
// OFFSET: LEGO1 0x1000c2f0
inline const char *ClassName() const override // vtable+0xc

View File

@ -13,27 +13,27 @@ LegoGameState::~LegoGameState()
}
// OFFSET: LEGO1 0x10039c60
long LegoGameState::Load(unsigned long)
MxResult LegoGameState::Load(MxULong)
{
// TODO
return 0;
}
// OFFSET: LEGO1 0x10039980
long LegoGameState::Save(unsigned long p)
MxResult LegoGameState::Save(MxULong p)
{
// TODO
return 0;
}
// OFFSET: LEGO1 0x1003a2e0
void LegoGameState::SerializePlayersInfo(short p)
void LegoGameState::SerializePlayersInfo(MxS16 p)
{
// TODO
}
// OFFSET: LEGO1 0x1003cdd0
void LegoGameState::SerializeScoreHistory(short p)
void LegoGameState::SerializeScoreHistory(MxS16 p)
{
// TODO
}

View File

@ -1,15 +1,17 @@
#ifndef LEGOGAMESTATE_H
#define LEGOGAMESTATE_H
#include "mxtypes.h"
class LegoGameState
{
public:
__declspec(dllexport) LegoGameState();
__declspec(dllexport) ~LegoGameState();
__declspec(dllexport) long Load(unsigned long);
__declspec(dllexport) long Save(unsigned long p);
__declspec(dllexport) void SerializePlayersInfo(short p);
__declspec(dllexport) void SerializeScoreHistory(short p);
__declspec(dllexport) MxResult Load(MxULong);
__declspec(dllexport) MxResult Save(MxULong p);
__declspec(dllexport) void SerializePlayersInfo(MxS16 p);
__declspec(dllexport) void SerializeScoreHistory(MxS16 p);
__declspec(dllexport) void SetSavePath(char *p);
};

View File

@ -1,5 +1,9 @@
#include "legoinputmanager.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338); // 0x10059085
// OFFSET: LEGO1 0x1005b790 STUB
LegoInputManager::LegoInputManager()
{
@ -13,7 +17,7 @@ LegoInputManager::~LegoInputManager()
}
// OFFSET: LEGO1 0x1005c740 STUB
void LegoInputManager::QueueEvent(NotificationId id, unsigned char p2, long p3, long p4, unsigned char p5)
void LegoInputManager::QueueEvent(NotificationId id, unsigned char p2, MxLong p3, MxLong p4, unsigned char p5)
{
// TODO
}
@ -31,7 +35,7 @@ void LegoInputManager::UnRegister(MxCore *)
}
// OFFSET: LEGO1 0x1005b8b0 STUB
long LegoInputManager::Tickle()
MxLong LegoInputManager::Tickle()
{
// TODO

View File

@ -1,9 +1,10 @@
#ifndef LEGOINPUTMANAGER_H
#define LEGOINPUTMANAGER_H
#include "mxcore.h"
#include "decomp.h"
#include "mxpresenter.h"
__declspec(dllexport) enum NotificationId
enum NotificationId
{
NONE = 0,
KEYDOWN = 7,
@ -15,21 +16,21 @@ __declspec(dllexport) enum NotificationId
// VTABLE 0x100d8760
// SIZE 0x338
class LegoInputManager
class LegoInputManager : public MxPresenter
{
public:
LegoInputManager();
virtual ~LegoInputManager() override;
__declspec(dllexport) void QueueEvent(NotificationId id, unsigned char p2, long p3, long p4, unsigned char p5);
__declspec(dllexport) void QueueEvent(NotificationId id, unsigned char p2, MxLong p3, MxLong p4, unsigned char p5);
__declspec(dllexport) void Register(MxCore *);
__declspec(dllexport) void UnRegister(MxCore *);
virtual long Tickle() override; // vtable+0x8
virtual MxLong Tickle() override; // vtable+0x8
char m_pad00[0x19C];
undefined m_pad40[0x15c];
int m_joystickIndex;
char m_pad200[0x194];
undefined m_pad200[0x194];
MxBool m_useJoystick;
};

View File

@ -106,8 +106,7 @@ void LegoNavController::SetControlMax(int p_hMax, int p_vMax)
this->m_hMax = p_hMax;
this->m_vMax = p_vMax;
if (VideoManager()->GetVideoParam().flags().GetFullScreen())
{
if (VideoManager()->GetVideoParam().flags().GetFullScreen()) {
this->m_hMax = 640;
this->m_vMax = 480;
}
@ -134,19 +133,15 @@ void LegoNavController::ResetToDefault()
void LegoNavController::SetTargets(int p_hPos, int p_vPos, MxBool p_accel)
{
if (this->m_trackDefault != FALSE)
{
ResetToDefault();
}
if (p_accel != 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);
this->m_turnAccel = CalculateNewAccel(p_hPos, this->m_hMax / 2, this->m_turnMaxAccel, (int)this->m_turnMinAccel);
this->m_movementAccel = CalculateNewAccel(this->m_vMax - p_vPos, this->m_vMax / 2, this->m_movementMaxAccel, (int)this->m_movementMinAccel);
}
else
{
else {
this->m_targetTurnSpeed = 0.0f;
this->m_targetMovementSpeed = 0.0f;
this->m_movementAccel = this->m_movementDecel;
@ -179,9 +174,28 @@ float LegoNavController::CalculateNewAccel(int p_pos, int p_center, float p_maxA
result = Abs(diff) * p_maxAccel / p_center;
if (result < p_minAccel)
{
result = (float)p_minAccel;
}
result = (float) p_minAccel;
return result;
}
// OFFSET: LEGO1 0x10054fe0
float LegoNavController::CalculateNewVel(float p_targetVel, float p_currentVel, float p_accel, float p_time)
{
float newVel = p_currentVel;
float velDiff = p_targetVel - p_currentVel;
int vSign = velDiff > 0 ? 1 : -1;
if (Abs(velDiff) > this->m_zeroThreshold) {
float deltaVel = p_accel * p_time;
newVel = p_currentVel + (deltaVel * vSign);
if (vSign > 0)
newVel = Min(newVel, p_targetVel);
else
newVel = Max(newVel, p_targetVel);
}
return newVel;
}

View File

@ -40,6 +40,7 @@ class LegoNavController : public MxCore
void SetTargets(int p_hPos, int p_vPos, MxBool p_accel);
float CalculateNewTargetSpeed(int p_pos, int p_center, float p_maxSpeed);
float CalculateNewAccel(int p_pos, int p_center, float p_maxAccel, int p_minAccel);
float CalculateNewVel(float p_targetVel, float p_currentVel, float p_accel, float p_time);
private:
int m_hMax;

View File

@ -25,7 +25,7 @@ void LegoOmni::CreateBackgroundAudio()
}
// OFFSET: LEGO1 0x1005af10 STUB
void LegoOmni::RemoveWorld(const MxAtomId &p1, long p2)
void LegoOmni::RemoveWorld(const MxAtomId &p1, MxLong p2)
{
// TODO
}
@ -50,7 +50,7 @@ void SetOmniUserMessage(void (*p_userMsg)(const char *,int))
}
// OFFSET: LEGO1 0x100acf50 STUB
long Start(MxDSAction *)
MxLong Start(MxDSAction *)
{
// TODO
return 0;
@ -112,7 +112,7 @@ MxBackgroundAudioManager *BackgroundAudioManager()
}
// OFFSET: LEGO1 0x100c0280 STUB
MxDSObject *CreateStreamObject(MxDSFile *,short)
MxDSObject *CreateStreamObject(MxDSFile *,MxS16)
{
// TODO
return NULL;
@ -149,21 +149,21 @@ const char *GetNoCD_SourceName()
}
// OFFSET: LEGO1 0x1005b5f0
long LegoOmni::Notify(MxParam &p)
MxLong LegoOmni::Notify(MxParam &p)
{
// FIXME: Stub
return 0;
}
// OFFSET: LEGO1 0x1003dd70 STUB
LegoROI *PickROI(long,long)
LegoROI *PickROI(MxLong,MxLong)
{
// TODO
return NULL;
}
// OFFSET: LEGO1 0x1003ddc0 STUB
LegoEntity *PickEntity(long,long)
LegoEntity *PickEntity(MxLong,MxLong)
{
// TODO
return NULL;
@ -176,7 +176,7 @@ void LegoOmni::Init()
}
// OFFSET: LEGO1 0x10058e70
MxResult LegoOmni::Create(MxOmniCreateParam &p)
MxResult LegoOmni::Create(COMPAT_CONST MxOmniCreateParam &p)
{
// FIXME: Stub
return SUCCESS;

View File

@ -1,6 +1,7 @@
#ifndef LEGOOMNI_H
#define LEGOOMNI_H
#include "compat.h"
#include "legoentity.h"
#include "legoinputmanager.h"
#include "legogamestate.h"
@ -27,7 +28,7 @@ class LegoOmni : public MxOmni
{
public:
__declspec(dllexport) void CreateBackgroundAudio();
__declspec(dllexport) void RemoveWorld(const MxAtomId &p1, long p2);
__declspec(dllexport) void RemoveWorld(const MxAtomId &p1, MxLong p2);
__declspec(dllexport) static int GetCurrPathInfo(LegoPathBoundary **,int &);
__declspec(dllexport) static void CreateInstance();
__declspec(dllexport) static LegoOmni *GetInstance();
@ -35,7 +36,7 @@ class LegoOmni : public MxOmni
LegoOmni();
virtual ~LegoOmni(); // vtable+00
virtual long Notify(MxParam &p); // vtable+04
virtual MxLong Notify(MxParam &p); // vtable+04
// OFFSET: LEGO1 0x10058aa0
inline virtual const char *ClassName() const // vtable+0c
@ -51,7 +52,7 @@ class LegoOmni : public MxOmni
}
virtual void Init(); // vtable+14
virtual MxResult Create(MxOmniCreateParam &p); // vtable+18
virtual MxResult Create(COMPAT_CONST MxOmniCreateParam &p); // vtable+18
virtual void Destroy(); // vtable+1c
virtual void vtable20();
virtual void vtable24(MxDSAction &ds);
@ -94,20 +95,20 @@ class LegoOmni : public MxOmni
};
__declspec(dllexport) MxBackgroundAudioManager * BackgroundAudioManager();
__declspec(dllexport) MxDSObject * CreateStreamObject(MxDSFile *,short);
__declspec(dllexport) MxDSObject * CreateStreamObject(MxDSFile *,MxS16);
__declspec(dllexport) LegoGameState * GameState();
__declspec(dllexport) const char * GetNoCD_SourceName();
__declspec(dllexport) LegoInputManager * InputManager();
__declspec(dllexport) LegoOmni * Lego();
__declspec(dllexport) void MakeSourceName(char *, const char *);
__declspec(dllexport) LegoEntity * PickEntity(long,long);
__declspec(dllexport) LegoROI * PickROI(long,long);
__declspec(dllexport) LegoEntity * PickEntity(MxLong,MxLong);
__declspec(dllexport) LegoROI * PickROI(MxLong,MxLong);
__declspec(dllexport) void SetOmniUserMessage(void (*)(const char *,int));
__declspec(dllexport) LegoSoundManager * SoundManager();
__declspec(dllexport) long Start(MxDSAction *);
__declspec(dllexport) MxLong Start(MxDSAction *);
__declspec(dllexport) MxTransitionManager * TransitionManager();
__declspec(dllexport) LegoVideoManager * VideoManager();
__declspec(dllexport) long Start(MxDSAction *a);
__declspec(dllexport) MxLong Start(MxDSAction *a);
LegoBuildingManager* BuildingManager();
Isle* GetIsle();

View File

@ -13,7 +13,7 @@ LegoPathController::~LegoPathController()
}
// OFFSET: LEGO1 0x10045c10 STUB
long LegoPathController::Tickle()
MxLong LegoPathController::Tickle()
{
// TODO
return 0;

View File

@ -11,7 +11,7 @@ class LegoPathController : public MxCore
LegoPathController();
virtual ~LegoPathController() override;
virtual long Tickle() override; // vtable+08
virtual MxLong Tickle() override; // vtable+08
// OFFSET: LEGO1 0x10045110
inline const char *ClassName() const override // vtable+0xc

View File

@ -13,7 +13,7 @@ LegoPlantManager::~LegoPlantManager()
}
// OFFSET: LEGO1 0x10026e00 STUB
long LegoPlantManager::Tickle()
MxLong LegoPlantManager::Tickle()
{
// TODO

View File

@ -11,7 +11,7 @@ class LegoPlantManager : public MxCore
LegoPlantManager();
virtual ~LegoPlantManager() override; // vtable+0x0
virtual long Tickle() override; // vtable+0x8
virtual MxLong Tickle() override; // vtable+0x8
// OFFSET: LEGO1 0x10026290
inline const char *ClassName() const override // vtable+0xc

View File

@ -13,7 +13,7 @@ LegoRace::~LegoRace()
}
// OFFSET: LEGO1 0x10015e00 STUB
long LegoRace::Notify(MxParam &p)
MxLong LegoRace::Notify(MxParam &p)
{
// TODO

View File

@ -10,7 +10,7 @@ class LegoRace : public LegoWorld
LegoRace();
virtual ~LegoRace() override; // vtable+0x0
virtual long Notify(MxParam &p) override; // vtable+0x4
virtual MxLong Notify(MxParam &p) override; // vtable+0x4
// OFFSET: LEGO1 0x10015ba0
inline const char *ClassName() const override // vtable+0xc

View File

@ -13,7 +13,7 @@ LegoSoundManager::~LegoSoundManager()
}
// OFFSET: LEGO1 0x1002a3a0 STUB
long LegoSoundManager::Tickle()
MxLong LegoSoundManager::Tickle()
{
// TODO
return 0;

View File

@ -10,7 +10,7 @@ class LegoSoundManager : public MxSoundManager
public:
LegoSoundManager();
virtual ~LegoSoundManager() override;
virtual long Tickle() override; // vtable+08
virtual MxLong Tickle() override; // vtable+08
private:
void Init();

View File

@ -4,3 +4,8 @@
LegoState::~LegoState()
{
}
// OFFSET: LEGO1 0x10005f90
MxBool LegoState::VTable0x14() {
return TRUE;
}

View File

@ -11,7 +11,7 @@ class LegoState : public MxCore
// OFFSET: LEGO1 0x100060d0
inline virtual const char *ClassName() const override // vtable+0x0c
{
{
// 0x100f01b8
return "LegoState";
}
@ -22,6 +22,8 @@ class LegoState : public MxCore
return !strcmp(name, LegoState::ClassName()) || MxCore::IsA(name);
}
virtual MxBool VTable0x14();
};
#endif // LEGOSTATE_H

73
LEGO1/legoutil.cpp Normal file
View File

@ -0,0 +1,73 @@
#include "legoutil.h"
#include "mxtypes.h"
// OFFSET: LEGO1 0x1003eae0
void ConvertHSVToRGB(float h, float s, float v, float *r_out, float *b_out, float *g_out)
{
double calc;
double p;
MxLong hue_index;
double v9;
double v12;
double v13;
double s_dbl = s;
if (s > 0.5f)
calc = (1.0f - v) * s + v;
else
calc = (v + 1.0) * s_dbl;
if (calc <= 0.0)
{
*g_out = 0.0f;
*b_out = 0.0f;
*r_out = 0.0f;
return;
}
p = s * 2.0f - calc;
hue_index = h * 6.0;
v9 = (h * 6.0 - (float)hue_index) * ((calc - p) / calc) * calc;
v12 = p + v9;
v13 = calc - v9;
switch (hue_index)
{
case 0:
*r_out = calc;
*b_out = v12;
*g_out = p;
break;
case 1:
*r_out = v13;
*b_out = calc;
*g_out = p;
break;
case 2:
*r_out = p;
*b_out = calc;
*g_out = v12;
break;
case 3:
*r_out = p;
*b_out = v13;
*g_out = calc;
break;
case 4:
*r_out = v12;
*b_out = p;
*g_out = calc;
break;
case 5:
*r_out = calc;
*b_out = p;
*g_out = v13;
break;
case 6:
*r_out = calc;
*b_out = p;
*g_out = v13;
break;
default:
return;
}
}

View File

@ -7,4 +7,18 @@ inline T Abs(T p_t)
return p_t < 0 ? -p_t : p_t;
}
template <class T>
inline T Min(T p_t1, T p_t2)
{
return p_t1 < p_t2 ? p_t1 : p_t2;
}
template <class T>
inline T Max(T p_t1, T p_t2)
{
return p_t1 > p_t2 ? p_t1 : p_t2;
}
void ConvertHSVToRGB(float r, float g, float b, float* out_r, float* out_g, float* out_b);
#endif // LEGOUTIL_H

View File

@ -1,4 +1,5 @@
#include "legovideomanager.h"
#include <ddraw.h>
// OFFSET: LEGO1 0x1007aa20 STUB
LegoVideoManager::LegoVideoManager()
@ -37,3 +38,15 @@ void LegoVideoManager::MoveCursor(int x, int y)
{
// TODO
}
// OFFSET: LEGO1 0x1007c440
void LegoVideoManager::SetSkyColor(float red, float green, float blue)
{
PALETTEENTRY colorStrucure; // [esp+0h] [ebp-4h] BYREF
colorStrucure.peRed = (red* 255.0);
colorStrucure.peGreen = (green * 255.0);
colorStrucure.peBlue = (blue * 255.0);
colorStrucure.peFlags = -124;
// TODO
}

View File

@ -18,6 +18,7 @@ class LegoVideoManager : public MxVideoManager
__declspec(dllexport) void MoveCursor(int x, int y);
inline Lego3DManager *Get3DManager() { return this->m_3dManager; }
void SetSkyColor(float r, float g, float b);
int m_unk64;
Lego3DManager *m_3dManager;

View File

@ -1,8 +1,14 @@
#ifndef MXATOMID_H
#define MXATOMID_H
#include "mxtypes.h"
enum LookupMode
{
LookupMode_Exact = 0,
LookupMode_LowerCase = 1,
LookupMode_UpperCase = 2,
LookupMode_LowerCase2 = 3
};
class MxAtomId
@ -17,6 +23,11 @@ class MxAtomId
this->m_internal = 0;
}
inline MxBool operator ==(const MxAtomId &other) const
{
return this->m_internal == other.m_internal;
}
private:
char *m_internal;
};

View File

@ -1 +1,5 @@
#include "mxaudiopresenter.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxAudioPresenter, 0x54);

View File

@ -7,9 +7,13 @@
class MxAudioPresenter : public MxMediaPresenter
{
public:
MxAudioPresenter() {
m_unk50 = 100;
}
// OFFSET: LEGO1 0x1000d280
inline virtual const char *ClassName() const override // vtable+0x0c
{
{
// 0x100f078c
return "MxAudioPresenter";
}
@ -19,6 +23,8 @@ class MxAudioPresenter : public MxMediaPresenter
{
return !strcmp(name, MxAudioPresenter::ClassName()) || MxMediaPresenter::IsA(name);
}
int m_unk50;
};
#endif // MXAUDIOPRESENTER_H

View File

@ -3,25 +3,127 @@
// OFFSET: LEGO1 0x100bc980
MxBitmap::MxBitmap()
{
// TODO
this->m_info = NULL;
this->m_bmiHeader = NULL;
this->m_paletteData = NULL;
this->m_data = NULL;
this->m_unk18 = FALSE;
this->m_palette = NULL;
}
// OFFSET: LEGO1 0x100bca10
MxBitmap::~MxBitmap()
{
// TODO
if (this->m_info != NULL)
delete m_info;
if (this->m_data != NULL)
delete m_data;
if (this->m_palette != NULL)
delete m_palette;
}
// OFFSET: LEGO1 0x100bcc40 STUB
int MxBitmap::vtable14(int)
{
return 0;
}
// OFFSET: LEGO1 0x100bcba0 STUB
int MxBitmap::vtable18(BITMAPINFOHEADER *p_bmiHeader)
{
return 0;
}
// OFFSET: LEGO1 0x100bcaa0 STUB
int MxBitmap::vtable1c(int p_width, int p_height, MxPalette *p_palette, int)
{
return 0;
}
// OFFSET: LEGO1 0x100bcd60 STUB
MxResult MxBitmap::LoadFile(HANDLE p_handle)
{
return SUCCESS;
}
// OFFSET: LEGO1 0x100bcd10
MxLong MxBitmap::Read(const char *p_filename)
{
MxResult result = FAILURE;
HANDLE handle = CreateFileA(
p_filename,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL
);
if (handle != INVALID_HANDLE_VALUE && !LoadFile(handle))
result = SUCCESS;
if (handle)
CloseHandle(handle);
return result;
}
// OFFSET: LEGO1 0x1004e0d0
int MxBitmap::vtable28(int)
{
return -1;
}
// OFFSET: LEGO1 0x100ce70 STUB
void MxBitmap::vtable2c(int, int, int, int, int, int, int)
{
}
// OFFSET: LEGO1 0x100d020 STUB
void MxBitmap::vtable30(int, int, int, int, int, int, int)
{
}
// OFFSET: LEGO1 0x100bd1c0
MxPalette *MxBitmap::CreatePalette()
{
// TODO
return NULL;
// FIXME: This function needs MxPalette to be completed. Also INFERRING usage of MxBool
MxPalette *pal = NULL;
MxPalette *ppal;
MxBool success = FALSE;
if(this->m_unk18 == FALSE) {
// ppal = MxPalette::FromBitmapPalette(this->m_paletteData);
} else {
if(this->m_unk18 != TRUE) {
if(!success && pal != NULL) {
delete pal;
pal = NULL;
}
}
//.pal = MxPalette::Clone(this->m_palette);
}
if(pal != NULL) {
success = TRUE;
}
return pal;
}
// OFFSET: LEGO1 0x100bcd10
long MxBitmap::Read(const char *)
// OFFSET: LEGO1 0x100bd280 STUB
void MxBitmap::vtable38(void*)
{
}
// OFFSET: LEGO1 0x100bd2d0 STUB
int MxBitmap::vtable3c(MxBool)
{
// TODO
return 0;
}
// OFFSET: LEGO1 0x100bd3e0 STUB
int MxBitmap::vtable40(HDC p_hdc, int p_xSrc, int p_ySrc, int p_xDest, int p_yDest, int p_destWidth, int p_destHeight)
{
return 0;
}

View File

@ -1,15 +1,38 @@
#ifndef MXBITMAP_H
#define MXBITMAP_H
#include "mxpalette.h"
#include <stdlib.h>
class MxBitmap
#include "mxcore.h"
#include "mxpalette.h"
#include "mxtypes.h"
class MxBitmap : public MxCore
{
public:
__declspec(dllexport) MxBitmap();
__declspec(dllexport) virtual ~MxBitmap();
__declspec(dllexport) virtual MxPalette *CreatePalette();
__declspec(dllexport) virtual long Read(const char *);
__declspec(dllexport) virtual ~MxBitmap(); // vtable+00
virtual int vtable14(int);
virtual int vtable18(BITMAPINFOHEADER *p_bmiHeader);
virtual int vtable1c(int p_width, int p_height, MxPalette *p_palette, int);
virtual MxResult LoadFile(HANDLE p_handle);
__declspec(dllexport) virtual MxLong Read(const char *p_filename); // vtable+24
virtual int vtable28(int);
virtual void vtable2c(int, int, int, int, int, int, int);
virtual void vtable30(int, int, int, int, int, int, int);
__declspec(dllexport) virtual MxPalette *CreatePalette(); // vtable+34
virtual void vtable38(void*);
virtual int vtable3c(MxBool);
virtual int vtable40(HDC p_hdc, int p_xSrc, int p_ySrc, int p_xDest, int p_yDest, int p_destWidth, int p_destHeight);
private:
BITMAPINFO *m_info;
BITMAPINFOHEADER *m_bmiHeader;
RGBQUAD *m_paletteData;
LPVOID *m_data;
MxBool m_unk18;
MxPalette *m_palette;
};
#endif // MXBITMAP_H

View File

@ -1,5 +1,9 @@
#include "mxcompositepresenter.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxCompositePresenter, 0x4c);
// OFFSET: LEGO1 0x100b60b0 STUB
MxCompositePresenter::MxCompositePresenter()
{

View File

@ -13,7 +13,7 @@ class MxCompositePresenter : public MxPresenter
// OFFSET: LEGO1 0x100b6210
inline virtual const char *ClassName() const override // vtable+0x0c
{
{
// 0x100f0774
return "MxCompositePresenter";
}
@ -24,6 +24,9 @@ class MxCompositePresenter : public MxPresenter
return !strcmp(name, MxCompositePresenter::ClassName()) || MxPresenter::IsA(name);
}
undefined m_unk40;
undefined4 *m_unk44;
undefined4 m_unk48;
};
#endif // MXCOMPOSITEPRESENTER_H

View File

@ -16,13 +16,13 @@ MxCore::~MxCore()
}
// OFFSET: LEGO1 0x100ae1f0
long MxCore::Notify(MxParam &p)
MxLong MxCore::Notify(MxParam &p)
{
return 0;
}
// OFFSET: LEGO1 0x10001f70
long MxCore::Tickle()
MxLong MxCore::Tickle()
{
return 0;
}

View File

@ -14,8 +14,8 @@ class MxCore
public:
__declspec(dllexport) MxCore();
__declspec(dllexport) virtual ~MxCore(); // vtable+00
__declspec(dllexport) virtual long Notify(MxParam &p); // vtable+04
virtual long Tickle(); // vtable+08
__declspec(dllexport) virtual MxLong Notify(MxParam &p); // vtable+04
virtual MxLong Tickle(); // vtable+08
// OFFSET: LEGO1 0x100144c0
inline virtual const char *ClassName() const // vtable+0c

View File

@ -13,7 +13,7 @@ MxDiskStreamController::~MxDiskStreamController()
}
// OFFSET: LEGO1 0x100c8640 STUB
long MxDiskStreamController::Tickle()
MxLong MxDiskStreamController::Tickle()
{
// TODO

View File

@ -14,7 +14,7 @@ class MxDiskStreamController : public MxStreamController
MxDiskStreamController();
virtual ~MxDiskStreamController() override;
virtual long Tickle() override; // vtable+0x8
virtual MxLong Tickle() override; // vtable+0x8
// OFFSET: LEGO1 0x100c7360
inline virtual const char *ClassName() const override // vtable+0x0c

View File

@ -8,7 +8,7 @@
#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)
MxDSFile::MxDSFile(const char *filename, MxULong skipReadingChunks)
{
m_filename = filename;
m_skipReadingChunks = skipReadingChunks;
@ -21,18 +21,17 @@ MxDSFile::~MxDSFile()
}
// OFFSET: LEGO1 0x100cc590
long MxDSFile::Open(unsigned long uStyle)
MxLong MxDSFile::Open(MxULong 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));
MXIOINFO& io = m_io;
MxLong longResult = 1;
memset(&io, 0, sizeof(MXIOINFO));
if (m_io.Open(m_filename.GetData(), uStyle) != 0) {
if (io.Open(m_filename.GetData(), uStyle) != 0) {
return -1;
}
m_io.SetBuffer(NULL, 0, 0);
io.SetBuffer(NULL, 0, 0);
m_position = 0;
if (m_skipReadingChunks == 0) {
@ -50,7 +49,7 @@ long MxDSFile::Open(unsigned long uStyle)
}
// OFFSET: LEGO1 0x100cc780
long MxDSFile::Read(unsigned char *pch, unsigned long cch)
MxLong MxDSFile::Read(unsigned char *pch, MxULong cch)
{
if (m_io.Read((char*)pch, cch) != cch)
return -1;
@ -60,7 +59,7 @@ long MxDSFile::Read(unsigned char *pch, unsigned long cch)
}
// OFFSET: LEGO1 0x100cc620
long MxDSFile::ReadChunks()
MxLong MxDSFile::ReadChunks()
{
_MMCKINFO topChunk;
_MMCKINFO childChunk;
@ -82,7 +81,7 @@ long MxDSFile::ReadChunks()
if (m_io.Descend(&childChunk, &topChunk, 0) != 0) {
return -1;
}
unsigned long* pLengthInDWords = &m_lengthInDWords;
MxULong* pLengthInDWords = &m_lengthInDWords;
m_io.Read((char *)pLengthInDWords, 4);
m_pBuffer = malloc(*pLengthInDWords * 4);
m_io.Read((char*)m_pBuffer, *pLengthInDWords * 4);
@ -97,25 +96,25 @@ long MxDSFile::ReadChunks()
}
// OFFSET: LEGO1 0x100cc7b0
long MxDSFile::Seek(long lOffset, int iOrigin)
MxLong MxDSFile::Seek(MxLong lOffset, int iOrigin)
{
return (m_position = m_io.Seek(lOffset, iOrigin)) == -1 ? -1 : 0;
}
// OFFSET: LEGO1 0x100cc7e0
unsigned long MxDSFile::GetBufferSize()
MxULong MxDSFile::GetBufferSize()
{
return m_header.bufferSize;
}
// OFFSET: LEGO1 0x100cc7f0
unsigned long MxDSFile::GetStreamBuffersNum()
MxULong MxDSFile::GetStreamBuffersNum()
{
return m_header.streamBuffersNum;
}
// OFFSET: LEGO1 0x100cc740
long MxDSFile::Close()
MxLong MxDSFile::Close()
{
m_io.Close(0);
m_position = -1;

View File

@ -9,7 +9,7 @@
class MxDSFile : public MxDSSource
{
public:
__declspec(dllexport) MxDSFile(const char *filename, unsigned long skipReadingChunks);
__declspec(dllexport) MxDSFile(const char *filename, MxULong skipReadingChunks);
__declspec(dllexport) virtual ~MxDSFile(); // vtable+0x0
// OFFSET: LEGO1 0x100c0120
@ -25,14 +25,14 @@ class MxDSFile : public MxDSSource
return !strcmp(name, MxDSFile::ClassName()) || MxDSSource::IsA(name);
}
__declspec(dllexport) virtual long Open(unsigned long); // vtable+0x14
__declspec(dllexport) virtual long Close(); // vtable+0x18
__declspec(dllexport) virtual long Read(unsigned char *,unsigned long); // vtable+0x20
__declspec(dllexport) virtual long Seek(long,int); // vtable+0x24
__declspec(dllexport) virtual unsigned long GetBufferSize(); // vtable+0x28
__declspec(dllexport) virtual unsigned long GetStreamBuffersNum(); // vtable+0x2c
__declspec(dllexport) virtual MxLong Open(MxULong); // vtable+0x14
__declspec(dllexport) virtual MxLong Close(); // vtable+0x18
__declspec(dllexport) virtual MxLong Read(unsigned char *,MxULong); // vtable+0x20
__declspec(dllexport) virtual MxLong Seek(MxLong,int); // vtable+0x24
__declspec(dllexport) virtual MxULong GetBufferSize(); // vtable+0x28
__declspec(dllexport) virtual MxULong GetStreamBuffersNum(); // vtable+0x2c
private:
long ReadChunks();
MxLong ReadChunks();
struct ChunkHeader {
ChunkHeader()
: majorVersion(0)
@ -41,11 +41,11 @@ class MxDSFile : public MxDSSource
, streamBuffersNum(0)
{}
unsigned short majorVersion;
unsigned short minorVersion;
unsigned long bufferSize;
short streamBuffersNum;
short reserved;
MxU16 majorVersion;
MxU16 minorVersion;
MxULong bufferSize;
MxS16 streamBuffersNum;
MxS16 reserved;
};
MxString m_filename;
@ -54,7 +54,7 @@ class MxDSFile : public MxDSSource
// If false, read chunks immediately on open, otherwise
// skip reading chunks until ReadChunks is explicitly called.
unsigned long m_skipReadingChunks;
MxULong m_skipReadingChunks;
};
#endif // MXDSFILE_H

View File

@ -45,16 +45,16 @@ MxDSObject &MxDSObject::operator=(MxDSObject &p_dsObject)
}
// OFFSET: LEGO1 0x100bf8e0
void MxDSObject::SetObjectName(const char *p_name)
void MxDSObject::SetObjectName(const char *p_objectName)
{
if (p_name != this->m_objectName) {
if (p_objectName != this->m_objectName) {
delete[] this->m_objectName;
if (p_name) {
this->m_objectName = new char[strlen(p_name) + 1];
if (p_objectName) {
this->m_objectName = new char[strlen(p_objectName) + 1];
if (this->m_objectName) {
strcpy(this->m_objectName, p_name);
strcpy(this->m_objectName, p_objectName);
}
}
else {
@ -111,7 +111,7 @@ unsigned int MxDSObject::CalculateUnk08()
}
// OFFSET: LEGO1 0x100bfa20
void MxDSObject::Parse(char **p_source, unsigned short p_unk24)
void MxDSObject::Parse(char **p_source, MxU16 p_unk24)
{
this->SetSourceName(*p_source);
*p_source += strlen(this->m_sourceName) + 1;

View File

@ -25,7 +25,7 @@ class MxDSObject : public MxCore
virtual int unk14(); // vtable+14;
virtual unsigned int CalculateUnk08(); // vtable+18;
virtual void Parse(char **p_source, unsigned short p_unk24); // vtable+1c;
virtual void Parse(char **p_source, MxU16 p_unk24); // vtable+1c;
void SetSourceName(const char *p_sourceName);
@ -33,7 +33,7 @@ class MxDSObject : public MxCore
inline int GetUnknown1c() { return this->m_unk1c; }
inline void SetUnknown1c(int p_unk1c) { this->m_unk1c = p_unk1c; }
inline void SetUnknown24(short p_unk24) { this->m_unk24 = p_unk24; }
inline void SetUnknown24(MxS16 p_unk24) { this->m_unk24 = p_unk24; }
// OFFSET: ISLE 0x401c40
// OFFSET: LEGO1 0x10005530
@ -41,14 +41,14 @@ class MxDSObject : public MxCore
private:
unsigned int m_unk08;
short m_unk0c;
MxS16 m_unk0c;
char* m_sourceName;
int m_unk14;
char *m_objectName;
int m_unk1c;
MxAtomId m_atomId;
short m_unk24;
unsigned short m_unk26;
MxS16 m_unk24;
MxU16 m_unk26;
int m_unk28;
};

View File

@ -8,7 +8,7 @@ void MxDSSource::SomethingWhichCallsRead(void* pUnknownObject)
}
// OFFSET: LEGO1 0x100bfff0
long MxDSSource::GetLengthInDWords()
MxLong MxDSSource::GetLengthInDWords()
{
return m_lengthInDWords;
}

View File

@ -26,19 +26,19 @@ class MxDSSource : public MxCore
return !strcmp(name, MxDSSource::ClassName()) || MxCore::IsA(name);
}
virtual long Open(unsigned long) = 0;
virtual long Close() = 0;
virtual MxLong Open(MxULong) = 0;
virtual MxLong 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();
virtual MxLong Read(unsigned char *, MxULong) = 0;
virtual MxLong Seek(MxLong, int) = 0;
virtual MxULong GetBufferSize() = 0;
virtual MxULong GetStreamBuffersNum() = 0;
virtual MxLong GetLengthInDWords();
protected:
unsigned long m_lengthInDWords;
MxULong m_lengthInDWords;
void* m_pBuffer;
long m_position;
MxLong m_position;
};
#endif // MXDSSOURCE_H

View File

@ -11,3 +11,9 @@ MxEntity::~MxEntity()
{
// TODO
}
// OFFSET: LEGO1 0x10001070 STUB
void MxEntity::Destroy()
{
// TODO
}

View File

@ -23,6 +23,8 @@ class MxEntity : public MxCore
return !strcmp(name, MxEntity::ClassName()) || MxCore::IsA(name);
}
virtual void Destroy(); // vtable+0x1c
// 0x8: MxResult
// 0xc MxAtomId
};

View File

@ -1,5 +1,9 @@
#include "mxeventpresenter.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxEventPresenter, 0x54);
// OFFSET: LEGO1 0x100c2b70
MxEventPresenter::MxEventPresenter()
{
@ -12,8 +16,8 @@ MxEventPresenter::~MxEventPresenter()
// TODO
}
// OFFSET: LEGO1 0x100c2da0 STUB
// OFFSET: LEGO1 0x100c2da0
void MxEventPresenter::Init()
{
// TODO
m_unk50 = 0;
}

View File

@ -3,6 +3,8 @@
#include "mxmediapresenter.h"
#include "decomp.h"
// VTABLE 0x100dca88
// SIZE 0x54
class MxEventPresenter : public MxMediaPresenter
@ -23,9 +25,10 @@ class MxEventPresenter : public MxMediaPresenter
{
return !strcmp(name, MxEventPresenter::ClassName()) || MxMediaPresenter::IsA(name);
}
private:
void Init();
undefined4 m_unk50;
};

View File

@ -1,5 +1,9 @@
#include "mxflcpresenter.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxFlcPresenter, 0x68);
// OFFSET: LEGO1 0x100b3310 STUB
MxFlcPresenter::MxFlcPresenter()
{

View File

@ -3,6 +3,8 @@
#include "mxvideopresenter.h"
#include "decomp.h"
// VTABLE 0x100dc2c0
// SIZE 0x68
class MxFlcPresenter : public MxVideoPresenter
@ -23,6 +25,8 @@ class MxFlcPresenter : public MxVideoPresenter
{
return !strcmp(name, MxFlcPresenter::ClassName()) || MxVideoPresenter::IsA(name);
}
undefined4 m_unk64;
};
#endif // MXFLCPRESENTER_H

View File

@ -13,19 +13,19 @@ MXIOINFO::~MXIOINFO()
}
// OFFSET: LEGO1 0x100cc830
unsigned short MXIOINFO::Open(const char *filename, DWORD fdwOpen)
MxU16 MXIOINFO::Open(const char *filename, DWORD fdwOpen)
{
return 0;
}
// OFFSET: LEGO1 0x100cc8e0
void MXIOINFO::Close(long arg)
void MXIOINFO::Close(MxLong arg)
{
}
// OFFSET: LEGO1 0x100cc930
unsigned long MXIOINFO::Read(HPSTR pch, LONG cch)
MxULong MXIOINFO::Read(HPSTR pch, LONG cch)
{
return 0;
}
@ -43,7 +43,7 @@ void MXIOINFO::SetBuffer(LPSTR pchBuffer, LONG cchBuffer, LONG unk)
}
// OFFSET: LEGO1 0x100cce60
unsigned short MXIOINFO::Descend(LPMMCKINFO pmmcki, const MMCKINFO *pmmckiParent, UINT fuDescend)
MxU16 MXIOINFO::Descend(LPMMCKINFO pmmcki, const MMCKINFO *pmmckiParent, UINT fuDescend)
{
return 0;
}
}

View File

@ -2,8 +2,9 @@
#define MXIOINFO_H
#include <windows.h>
#include <mmsystem.h>
#include "mmsystem.h"
#include "mxtypes.h"
class MXIOINFO
{
@ -11,12 +12,12 @@ class MXIOINFO
MXIOINFO();
__declspec(dllexport) ~MXIOINFO();
unsigned short Open(const char *filename, DWORD fdwOpen);
void Close(long arg);
MxU16 Open(const char *filename, DWORD fdwOpen);
void Close(MxLong arg);
LONG Seek(LONG lOffset, int iOrigin);
unsigned long Read(HPSTR pch, LONG cch);
MxULong Read(HPSTR pch, LONG cch);
void SetBuffer(LPSTR pchBuffer, LONG cchBuffer, LONG unk);
unsigned short Descend(LPMMCKINFO pmmcki, const MMCKINFO *pmmckiParent, UINT fuDescend);
MxU16 Descend(LPMMCKINFO pmmcki, const MMCKINFO *pmmckiParent, UINT fuDescend);
MMIOINFO m_info;
};

View File

@ -1,5 +1,9 @@
#include "mxloopingflcpresenter.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxLoopingFlcPresenter, 0x6c);
// OFFSET: LEGO1 0x100b4310 STUB
MxLoopingFlcPresenter::MxLoopingFlcPresenter()
{

View File

@ -3,6 +3,8 @@
#include "mxflcpresenter.h"
#include "decomp.h"
// VTABLE 0x100dc480
// SIZE 0x6c
class MxLoopingFlcPresenter : public MxFlcPresenter
@ -17,9 +19,10 @@ class MxLoopingFlcPresenter : public MxFlcPresenter
// 0x10101e20
return "MxLoopingFlcPresenter";
}
private:
void Init();
undefined4 m_unk68;
};
#endif // MXLOOPINGFLCPRESENTER_H

View File

@ -0,0 +1,5 @@
#include "mxloopingmidipresenter.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxLoopingMIDIPresenter, 0x58);

View File

@ -1,5 +1,9 @@
#include "mxloopingsmkpresenter.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxLoopingSmkPresenter, 0x724);
// OFFSET: LEGO1 0x100b48b0
MxLoopingSmkPresenter::MxLoopingSmkPresenter()
{

View File

@ -3,6 +3,8 @@
#include "mxsmkpresenter.h"
#include "decomp.h"
// VTABLE 0x100dc540
// SIZE 0x724
class MxLoopingSmkPresenter : public MxSmkPresenter
@ -17,9 +19,10 @@ class MxLoopingSmkPresenter : public MxSmkPresenter
// 0x10101e08
return "MxLoopingSmkPresenter";
}
private:
void Init();
undefined4 m_unk720;
};
#endif // MXLOOPINGSMKPRESENTER_H

View File

@ -1,7 +1,9 @@
#include "mxmediapresenter.h"
DECOMP_SIZE_ASSERT(MxMediaPresenter, 0x50);
// OFFSET: LEGO1 0x100b5d10 STUB
long MxMediaPresenter::Tickle()
MxLong MxMediaPresenter::Tickle()
{
// TODO
return 0;

View File

@ -3,6 +3,8 @@
#include "mxpresenter.h"
#include "decomp.h"
// VTABLE 0x100d4cd8
class MxMediaPresenter : public MxPresenter
{
@ -12,21 +14,25 @@ class MxMediaPresenter : public MxPresenter
Init();
}
virtual long Tickle() override; // vtable+0x8, override MxCore
virtual MxLong Tickle() override; // vtable+0x8, override MxCore
// OFFSET: LEGO1 0x1000c5c0
inline virtual const char *MxMediaPresenter::ClassName() const override // vtable+0xc
inline virtual const char *ClassName() const override // vtable+0xc
{
// 0x100f074c
return "MxMediaPresenter";
}
// OFFSET: LEGO1 0x1000c5d0
inline virtual MxBool MxMediaPresenter::IsA(const char *name) const override // vtable+0x10
inline virtual MxBool IsA(const char *name) const override // vtable+0x10
{
return !strcmp(name, MxMediaPresenter::ClassName()) || MxPresenter::IsA(name);
}
undefined4 m_unk40;
undefined4 m_unk44;
undefined4 m_unk48;
undefined4 m_unk4c;
private:
void Init();

16
LEGO1/mxmidipresenter.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "mxmidipresenter.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxMIDIPresenter, 0x58);
// OFFSET: LEGO1 0x100c25e0
MxMIDIPresenter::MxMIDIPresenter() {
Init();
}
// OFFSET: LEGO1 0x100c2820
void MxMIDIPresenter::Init()
{
m_unk54 = 0;
}

View File

@ -6,6 +6,11 @@
// VTABLE 0x100dca20
class MxMIDIPresenter : public MxMusicPresenter
{
public:
MxMIDIPresenter();
private:
void Init();
undefined4 m_unk54;
};
#endif // MXMIDIPRESENTER_H

View File

@ -7,7 +7,7 @@ MxNotificationManager::~MxNotificationManager()
}
// OFFSET: LEGO1 0x100ac800 STUB
long MxNotificationManager::Tickle()
MxLong MxNotificationManager::Tickle()
{
// TODO

View File

@ -9,7 +9,7 @@ class MxNotificationManager : public MxCore
public:
virtual ~MxNotificationManager(); // vtable+0x0
virtual long Tickle(); // vtable+0x8
virtual MxLong Tickle(); // vtable+0x8
// 0x10: MxCriticalSection
};

45
LEGO1/mxobjectfactory.cpp Normal file
View File

@ -0,0 +1,45 @@
#include "mxobjectfactory.h"
#include "mxpresenter.h"
#include "mxcompositepresenter.h"
#include "mxvideopresenter.h"
#include "mxflcpresenter.h"
#include "mxsmkpresenter.h"
#include "mxstillpresenter.h"
#include "mxwavepresenter.h"
#include "mxmidipresenter.h"
#include "mxeventpresenter.h"
#include "mxloopingflcpresenter.h"
#include "mxloopingsmkpresenter.h"
#include "mxloopingmidipresenter.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(MxObjectFactory, 0x38); // 100af1db
// OFFSET: LEGO1 0x100b0d80
MxObjectFactory::MxObjectFactory()
{
#define X(V) this->m_id##V = MxAtomId(#V, LookupMode_Exact);
FOR_MXOBJECTFACTORY_OBJECTS(X)
#undef X
}
// OFFSET: LEGO1 0x100b12c0
MxCore *MxObjectFactory::Create(const char *name)
{
MxAtomId atom(name, LookupMode_Exact);
if (0) {
#define X(V) } else if (this->m_id##V == atom) { return new V;
FOR_MXOBJECTFACTORY_OBJECTS(X)
#undef X
} else {
return NULL;
}
}
// OFFSET: LEGO1 0x100b1a30 STUB
void MxObjectFactory::vtable18(void *) {
// FIXME
}

View File

@ -2,11 +2,33 @@
#define MXOBJECTFACTORY_H
#include "mxcore.h"
#include "mxatomid.h"
#define FOR_MXOBJECTFACTORY_OBJECTS(X) \
X(MxPresenter) \
X(MxCompositePresenter) \
X(MxVideoPresenter) \
X(MxFlcPresenter) \
X(MxSmkPresenter) \
X(MxStillPresenter) \
X(MxWavePresenter) \
X(MxMIDIPresenter) \
X(MxEventPresenter) \
X(MxLoopingFlcPresenter) \
X(MxLoopingSmkPresenter) \
X(MxLoopingMIDIPresenter)
// VTABLE 0x100dc220
class MxObjectFactory : public MxCore
{
public:
MxObjectFactory();
virtual MxCore *Create(const char *name); // vtable 0x14
virtual void vtable18(void *); // vtable 0x18
private:
#define X(V) MxAtomId m_id##V;
FOR_MXOBJECTFACTORY_OBJECTS(X)
#undef X
};
#endif MXOBJECTFACTORY_H
#endif // MXOBJECTFACTORY_H

View File

@ -123,7 +123,7 @@ void MxOmni::Destroy()
}
// OFFSET: LEGO1 0x100b07f0
long MxOmni::Notify(MxParam &p)
MxLong MxOmni::Notify(MxParam &p)
{
// FIXME: Stub
return 0;

View File

@ -28,10 +28,11 @@ class MxOmni : public MxCore
__declspec(dllexport) static void SetCD(const char *p_cd);
__declspec(dllexport) static void SetHD(const char *p_hd);
__declspec(dllexport) static void SetSound3D(MxBool p_3dsound);
virtual ~MxOmni();
virtual long Notify(MxParam &p); // vtable+04
MxOmni();
virtual ~MxOmni() override;
virtual MxLong Notify(MxParam &p); // vtable+04
virtual void Init(); // vtable+14
virtual MxResult Create(MxOmniCreateParam &p); // vtable+18
virtual void Destroy(); // vtable+1c

Some files were not shown because too many files have changed in this diff Show More