mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 08:24:16 +00:00
Merge remote-tracking branch 'upstream/master' into legobackgroundcolor
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "legoinc.h"
|
||||
#include <windows.h>
|
||||
|
||||
// OFFSET: LEGO1 0x10091ee0
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
|
@@ -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
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@
|
||||
#define LEGONAVCONTROLLER_H
|
||||
|
||||
#include "mxcore.h"
|
||||
#include "mxbool.h"
|
||||
#include "mxtimer.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
class LegoNavController : public MxCore
|
||||
{
|
||||
|
@@ -99,7 +99,7 @@ void LegoOmni::vtable24(MxDSAction &ds)
|
||||
MxBool LegoOmni::vtable28(MxDSAction &ds)
|
||||
{
|
||||
// FIXME: Stub
|
||||
return MX_TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LegoOmni::vtable2c()
|
||||
|
@@ -32,12 +32,10 @@ public:
|
||||
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
|
||||
|
@@ -7,7 +7,7 @@ class MxAutoLocker
|
||||
{
|
||||
public:
|
||||
MxAutoLocker(MxCriticalSection* cs);
|
||||
virtual ~MxAutoLocker();
|
||||
~MxAutoLocker();
|
||||
private:
|
||||
MxCriticalSection* m_criticalSection;
|
||||
};
|
||||
|
@@ -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
|
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mxbool.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
class MxParam;
|
||||
|
||||
@@ -16,12 +16,10 @@ public:
|
||||
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;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef MXCRITICALSECTION_H
|
||||
#define MXCRITICALSECTION_H
|
||||
|
||||
#include "legoinc.h"
|
||||
#include <windows.h>
|
||||
|
||||
class MxCriticalSection
|
||||
{
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
14
LEGO1/mxdssource.cpp
Normal 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
30
LEGO1/mxdssource.h
Normal 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
49
LEGO1/mxioinfo.cpp
Normal 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;
|
||||
}
|
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef MXOMNICREATEFLAGS_H
|
||||
#define MXOMNICREATEFLAGS_H
|
||||
|
||||
#include "mxbool.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
class MxOmniCreateFlags
|
||||
{
|
||||
@@ -36,17 +36,17 @@ public:
|
||||
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;
|
||||
|
@@ -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
0
LEGO1/mxpalette.cpp
Executable file → Normal 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;
|
||||
}
|
||||
|
@@ -14,7 +14,11 @@ public:
|
||||
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;
|
||||
|
@@ -9,8 +9,8 @@ public:
|
||||
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);
|
||||
|
@@ -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
21
LEGO1/mxtypes.h
Normal 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
0
LEGO1/mxunknown100dc6b0.cpp
Executable file → Normal file
0
LEGO1/mxunknown100dc6b0.h
Executable file → Normal file
0
LEGO1/mxunknown100dc6b0.h
Executable file → Normal file
4
LEGO1/mxvideomanager.cpp
Executable file → Normal file
4
LEGO1/mxvideomanager.cpp
Executable file → Normal 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;
|
||||
}
|
||||
}
|
||||
|
@@ -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"
|
||||
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user