More fixes

This commit is contained in:
Christian Semmler 2023-12-12 10:22:58 -05:00
parent e2bfeb6817
commit 78c37ada37
21 changed files with 95 additions and 94 deletions

View File

@ -636,21 +636,21 @@ void SetOmniUserMessage(void (*p_userMsg)(const char*, int))
MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)
{
char* buf;
_MMCKINFO tmp_chunk;
_MMCKINFO tmpChunk;
if (p_file->Seek(((MxLong*) p_file->GetBuffer())[p_ofs], 0)) {
return NULL;
}
if (p_file->Read((MxU8*) &tmp_chunk.ckid, 8) == 0 && tmp_chunk.ckid == FOURCC('M', 'x', 'S', 't')) {
if (p_file->Read((MxU8*) &tmp_chunk.ckid, 8) == 0 && tmp_chunk.ckid == FOURCC('M', 'x', 'O', 'b')) {
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'S', 't')) {
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'O', 'b')) {
buf = new char[tmp_chunk.cksize];
buf = new char[tmpChunk.cksize];
if (!buf) {
return NULL;
}
if (p_file->Read((MxU8*) buf, tmp_chunk.cksize) != 0) {
if (p_file->Read((MxU8*) buf, tmpChunk.cksize) != 0) {
return NULL;
}

View File

@ -35,67 +35,67 @@ ExtraActionType MatchActionString(const char* p_str)
}
// FUNCTION: LEGO1 0x1003eae0
void ConvertHSVToRGB(float h, float s, float v, float* r_out, float* b_out, float* g_out)
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut)
{
double calc;
double p;
MxLong hue_index;
MxLong hueIndex;
double v9;
double v12;
double v13;
double s_dbl = s;
double sDbl = p_s;
if (s > 0.5f)
calc = (1.0f - v) * s + v;
if (p_s > 0.5f)
calc = (1.0f - p_v) * p_s + p_v;
else
calc = (v + 1.0) * s_dbl;
calc = (p_v + 1.0) * sDbl;
if (calc <= 0.0) {
*g_out = 0.0f;
*b_out = 0.0f;
*r_out = 0.0f;
*p_gOut = 0.0f;
*p_bOut = 0.0f;
*p_rOut = 0.0f;
return;
}
p = s * 2.0f - calc;
hue_index = h * 6.0;
v9 = (h * 6.0 - (float) hue_index) * ((calc - p) / calc) * calc;
p = p_s * 2.0f - calc;
hueIndex = p_h * 6.0;
v9 = (p_h * 6.0 - (float) hueIndex) * ((calc - p) / calc) * calc;
v12 = p + v9;
v13 = calc - v9;
switch (hue_index) {
switch (hueIndex) {
case 0:
*r_out = calc;
*b_out = v12;
*g_out = p;
*p_rOut = calc;
*p_bOut = v12;
*p_gOut = p;
break;
case 1:
*r_out = v13;
*b_out = calc;
*g_out = p;
*p_rOut = v13;
*p_bOut = calc;
*p_gOut = p;
break;
case 2:
*r_out = p;
*b_out = calc;
*g_out = v12;
*p_rOut = p;
*p_bOut = calc;
*p_gOut = v12;
break;
case 3:
*r_out = p;
*b_out = v13;
*g_out = calc;
*p_rOut = p;
*p_bOut = v13;
*p_gOut = calc;
break;
case 4:
*r_out = v12;
*b_out = p;
*g_out = calc;
*p_rOut = v12;
*p_bOut = p;
*p_gOut = calc;
break;
case 5:
*r_out = calc;
*b_out = p;
*g_out = v13;
*p_rOut = calc;
*p_bOut = p;
*p_gOut = v13;
break;
case 6:
*r_out = calc;
*b_out = p;
*g_out = v13;
*p_rOut = calc;
*p_bOut = p;
*p_gOut = v13;
break;
default:
return;

View File

@ -54,7 +54,7 @@ inline void GetString(char** p_source, const char* p_dest, T* p_obj, void (T::*p
}
ExtraActionType MatchActionString(const char*);
void ConvertHSVToRGB(float r, float g, float b, float* out_r, float* out_g, float* out_b);
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut);
void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id);
void SetAppCursor(WPARAM p_wparam);

View File

@ -19,12 +19,12 @@ class LegoVideoManager : public MxVideoManager {
__declspec(dllexport) int DisableRMDevice();
void EnableFullScreenMovie(MxBool p_enable);
__declspec(dllexport) void EnableFullScreenMovie(MxBool p_enable, MxBool p_scale);
__declspec(dllexport) void MoveCursor(int x, int y);
__declspec(dllexport) void MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY);
inline Lego3DManager* Get3DManager() { return this->m_3dManager; }
inline MxDirect3D* GetDirect3D() { return this->m_direct3d; }
void SetSkyColor(float r, float g, float b);
void SetSkyColor(float p_red, float p_green, float p_blue);
inline void SetUnkE4(MxBool p_unk0xe4) { this->m_unk0xe4 = p_unk0xe4; }
// FUNCTION: LEGO1 0x1007c4c0

View File

@ -17,13 +17,13 @@ void LegoWorld::VTable0x60()
}
// STUB: LEGO1 0x10015820
void FUN_10015820(MxU32 p_unk1, MxU32 p_unk2)
void FUN_10015820(MxU32, MxU32)
{
// TODO
}
// STUB: LEGO1 0x10015910
void FUN_10015910(MxU32 p_unk1)
void FUN_10015910(MxU32)
{
// TODO
}

View File

@ -51,8 +51,8 @@ class LegoWorld : public LegoEntity {
undefined m_unk0xf7;
};
void FUN_10015820(MxU32 p_unk1, MxU32 p_unk2);
void FUN_10015910(MxU32 p_unk1);
void FUN_10015820(MxU32, MxU32);
void FUN_10015910(MxU32);
void SetIsWorldActive(MxBool p_isWorldActive);
#endif // LEGOWORLD_H

View File

@ -1,12 +1,12 @@
#include "legoworldpresenter.h"
// GLOBAL: LEGO1 0x100f75d4
undefined4 g_LegoWorldPresenterQuality = 1;
undefined4 g_legoWorldPresenterQuality = 1;
// FUNCTION: LEGO1 0x100665b0
void LegoWorldPresenter::configureLegoWorldPresenter(int p_quality)
void LegoWorldPresenter::configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQuality)
{
g_LegoWorldPresenterQuality = p_quality;
g_legoWorldPresenterQuality = p_legoWorldPresenterQuality;
}
// FUNCTION: LEGO1 0x100665c0

View File

@ -10,7 +10,7 @@ class LegoWorldPresenter : public LegoEntityPresenter {
LegoWorldPresenter();
virtual ~LegoWorldPresenter() override; // vtable+0x0
__declspec(dllexport) static void configureLegoWorldPresenter(int param_1);
__declspec(dllexport) static void configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQuality);
// FUNCTION: LEGO1 0x10066630
inline virtual const char* ClassName() const override // vtable+0x0c

View File

@ -61,7 +61,7 @@ MxAtomId& MxAtomId::operator=(const MxAtomId& p_atomId)
// FUNCTION: LEGO1 0x100ad210
MxAtomIdCounter* MxAtomId::GetCounter(const char* p_str, LookupMode p_mode)
{
MxAtomId _unused;
MxAtomId unused;
MxAtomIdCounter* counter = new MxAtomIdCounter(p_str);
switch (p_mode) {

View File

@ -14,12 +14,12 @@ enum LookupMode {
class MxAtomId {
public:
__declspec(dllexport) MxAtomId(const char*, LookupMode);
__declspec(dllexport) MxAtomId& operator=(const MxAtomId& id);
__declspec(dllexport) MxAtomId& operator=(const MxAtomId& p_atomId);
__declspec(dllexport) ~MxAtomId();
MxAtomId() { this->m_internal = 0; }
inline MxBool operator==(const MxAtomId& other) const { return this->m_internal == other.m_internal; }
inline MxBool operator==(const MxAtomId& p_atomId) const { return this->m_internal == p_atomId.m_internal; }
void Clear();

View File

@ -3,7 +3,7 @@
DECOMP_SIZE_ASSERT(MxAudioManager, 0x30);
// GLOBAL: LEGO1 0x10102108
MxS32 MxAudioManager::g_unkCount = 0;
MxS32 MxAudioManager::g_count = 0;
// FUNCTION: LEGO1 0x10029910
MxS32 MxAudioManager::GetVolume()
@ -33,7 +33,7 @@ void MxAudioManager::Init()
void MxAudioManager::Destroy(MxBool p_fromDestructor)
{
this->m_criticalSection.Enter();
g_unkCount--;
g_count--;
Init();
this->m_criticalSection.Leave();
@ -51,7 +51,7 @@ MxResult MxAudioManager::InitPresenters()
this->m_criticalSection.Enter();
success = TRUE;
result = SUCCESS;
g_unkCount++;
g_count++;
}
if (result)

View File

@ -18,7 +18,7 @@ class MxAudioManager : public MxMediaManager {
private:
void Destroy(MxBool p_fromDestructor);
static MxS32 g_unkCount;
static MxS32 g_count;
protected:
void Init();

View File

@ -1,9 +1,9 @@
#include "mxautolocker.h"
// FUNCTION: LEGO1 0x100b8ed0
MxAutoLocker::MxAutoLocker(MxCriticalSection* critsect)
MxAutoLocker::MxAutoLocker(MxCriticalSection* p_criticalSection)
{
this->m_criticalSection = critsect;
this->m_criticalSection = p_criticalSection;
if (this->m_criticalSection != 0)
this->m_criticalSection->Enter();
}

View File

@ -5,7 +5,7 @@
class MxAutoLocker {
public:
MxAutoLocker(MxCriticalSection* cs);
MxAutoLocker(MxCriticalSection* p_criticalSection);
~MxAutoLocker();
private:

View File

@ -230,7 +230,7 @@ void MxBackgroundAudioManager::StopAction(MxParam& p_param)
}
// FUNCTION: LEGO1 0x1007f2f0
MxResult MxBackgroundAudioManager::PlayMusic(MxDSAction& p_action, undefined4 p_unknown, undefined4 p_unknown2)
MxResult MxBackgroundAudioManager::PlayMusic(MxDSAction& p_action, undefined4 p_unk0x140, undefined4 p_unk0x13c)
{
if (!m_musicEnabled) {
return SUCCESS;
@ -253,8 +253,8 @@ MxResult MxBackgroundAudioManager::PlayMusic(MxDSAction& p_action, undefined4 p_
GetCurrentAction().SetUnknown24(action.GetUnknown24());
if (result == SUCCESS) {
m_unk0x13c = p_unknown2;
m_unk0x140 = p_unknown;
m_unk0x13c = p_unk0x13c;
m_unk0x140 = p_unk0x140;
}
return result;
}
@ -308,11 +308,11 @@ void MxBackgroundAudioManager::RaiseVolume()
}
// FUNCTION: LEGO1 0x1007f5f0
void MxBackgroundAudioManager::Enable(MxBool p)
void MxBackgroundAudioManager::Enable(MxBool p_enable)
{
if (this->m_musicEnabled != p) {
this->m_musicEnabled = p;
if (!p) {
if (this->m_musicEnabled != p_enable) {
this->m_musicEnabled = p_enable;
if (!p_enable) {
Stop();
}
}

View File

@ -33,13 +33,13 @@ class MxBackgroundAudioManager : public MxCore {
void StartAction(MxParam& p_param);
void StopAction(MxParam& p_param);
MxResult PlayMusic(MxDSAction& p_action, undefined4 p_unknown, undefined4 p_unknown2);
MxResult PlayMusic(MxDSAction& p_action, undefined4 p_unk0x140, undefined4 p_unk0x13c);
void FUN_1007ee70();
void FUN_1007ef40();
void FadeInOrFadeOut();
__declspec(dllexport) void Enable(unsigned char p);
__declspec(dllexport) void Enable(MxBool p_enable);
virtual MxResult Create(MxAtomId& p_script, MxU32 p_frequencyMS);
void Stop();

View File

@ -21,7 +21,7 @@ inline MxLong AlignToFourByte(MxLong p_value)
// Same as the one from legoutil.h, but flipped the other way
// TODO: While it's not outside the realm of possibility that they
// reimplemented Abs for only this file, that seems odd, right?
inline MxLong _Abs(MxLong p_value)
inline MxLong AbsFlipped(MxLong p_value)
{
return p_value > 0 ? p_value : -p_value;
}
@ -64,9 +64,9 @@ MxResult MxBitmap::SetSize(MxS32 p_width, MxS32 p_height, MxPalette* p_palette,
if (m_info) {
m_data = new MxU8[size];
if (m_data) {
m_bmiHeader = &m_info->bmiHeader;
m_paletteData = m_info->bmiColors;
memset(&m_info->bmiHeader, 0, sizeof(m_info->bmiHeader));
m_bmiHeader = &m_info->m_bmiHeader;
m_paletteData = m_info->m_bmiColors;
memset(&m_info->m_bmiHeader, 0, sizeof(m_info->m_bmiHeader));
m_bmiHeader->biSize = sizeof(*m_bmiHeader); // should be 40 bytes
m_bmiHeader->biWidth = p_width;
@ -103,8 +103,8 @@ MxResult MxBitmap::SetSize(MxS32 p_width, MxS32 p_height, MxPalette* p_palette,
MxResult MxBitmap::ImportBitmapInfo(MxBITMAPINFO* p_info)
{
MxResult result = FAILURE;
MxLong width = p_info->bmiHeader.biWidth;
MxLong height = p_info->bmiHeader.biHeight;
MxLong width = p_info->m_bmiHeader.biWidth;
MxLong height = p_info->m_bmiHeader.biHeight;
MxLong size = AlignToFourByte(width) * height;
this->m_info = new MxBITMAPINFO;
@ -112,8 +112,8 @@ MxResult MxBitmap::ImportBitmapInfo(MxBITMAPINFO* p_info)
this->m_data = new MxU8[size];
if (this->m_data) {
memcpy(this->m_info, p_info, sizeof(*this->m_info));
this->m_bmiHeader = &this->m_info->bmiHeader;
this->m_paletteData = this->m_info->bmiColors;
this->m_bmiHeader = &this->m_info->m_bmiHeader;
this->m_paletteData = this->m_info->m_bmiColors;
result = SUCCESS;
}
}
@ -140,16 +140,16 @@ MxResult MxBitmap::ImportBitmap(MxBitmap* p_bitmap)
this->m_info = new MxBITMAPINFO;
if (this->m_info) {
MxLong height = _Abs(p_bitmap->m_bmiHeader->biHeight);
MxLong height = AbsFlipped(p_bitmap->m_bmiHeader->biHeight);
this->m_data = new MxU8[AlignToFourByte(p_bitmap->m_bmiHeader->biWidth) * height];
if (this->m_data) {
memcpy(this->m_info, p_bitmap->m_info, sizeof(*this->m_info));
height = _Abs(p_bitmap->m_bmiHeader->biHeight);
height = AbsFlipped(p_bitmap->m_bmiHeader->biHeight);
memcpy(this->m_data, p_bitmap->m_data, AlignToFourByte(p_bitmap->m_bmiHeader->biWidth) * height);
result = SUCCESS;
this->m_bmiHeader = &this->m_info->bmiHeader;
this->m_paletteData = this->m_info->bmiColors;
this->m_bmiHeader = &this->m_info->m_bmiHeader;
this->m_paletteData = this->m_info->m_bmiColors;
}
}
@ -196,18 +196,18 @@ MxResult MxBitmap::LoadFile(HANDLE p_handle)
this->m_info = new MxBITMAPINFO;
if (this->m_info) {
ret = ReadFile(p_handle, this->m_info, sizeof(*this->m_info), &bytesRead, NULL);
if (ret && (this->m_info->bmiHeader.biBitCount == 8)) {
if (ret && (this->m_info->m_bmiHeader.biBitCount == 8)) {
MxLong size = hdr.bfSize - (sizeof(MxBITMAPINFO) + sizeof(BITMAPFILEHEADER));
this->m_data = new MxU8[size];
if (this->m_data) {
ret = ReadFile(p_handle, this->m_data, size, &bytesRead, NULL);
if (ret) {
this->m_bmiHeader = &this->m_info->bmiHeader;
this->m_paletteData = this->m_info->bmiColors;
if (this->m_info->bmiHeader.biSizeImage == 0) {
MxLong height = _Abs(this->m_info->bmiHeader.biHeight);
this->m_info->bmiHeader.biSizeImage =
AlignToFourByte(this->m_info->bmiHeader.biWidth) * height;
this->m_bmiHeader = &this->m_info->m_bmiHeader;
this->m_paletteData = this->m_info->m_bmiColors;
if (this->m_info->m_bmiHeader.biSizeImage == 0) {
MxLong height = AbsFlipped(this->m_info->m_bmiHeader.biHeight);
this->m_info->m_bmiHeader.biSizeImage =
AlignToFourByte(this->m_info->m_bmiHeader.biWidth) * height;
}
result = SUCCESS;
}

View File

@ -17,8 +17,8 @@
// SIZE 0x428
struct MxBITMAPINFO {
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[256];
BITMAPINFOHEADER m_bmiHeader;
RGBQUAD m_bmiColors[256];
};
// Non-standard value for biCompression in the BITMAPINFOHEADER struct.

View File

@ -10,10 +10,10 @@
DECOMP_SIZE_ASSERT(MxCompositePresenter, 0x4c);
// FUNCTION: LEGO1 0x1000caf0
MxBool MxCompositePresenter::VTable0x64(undefined4 p_unknown)
MxBool MxCompositePresenter::VTable0x64(undefined4 p_undefined)
{
if (m_compositePresenter)
return m_compositePresenter->VTable0x64(p_unknown);
return m_compositePresenter->VTable0x64(p_undefined);
return TRUE;
}

View File

@ -34,7 +34,7 @@ class MxCompositePresenter : public MxPresenter {
virtual void VTable0x58(MxParam& p_param); // vtable+0x58
virtual void VTable0x5c(MxParam& p_param); // vtable+0x5c
virtual void VTable0x60(MxPresenter* p_presenter); // vtable+0x60
virtual MxBool VTable0x64(undefined4 p_unknown); // vtable+0x64
virtual MxBool VTable0x64(undefined4 p_undefined); // vtable+0x64
private:
MxCompositePresenterList m_list; // 0x40

View File

@ -3,4 +3,5 @@ configureLegoBuildingManager(MxS32): 'DLL exported function'
configureLegoModelPresenter(MxS32): 'DLL exported function'
configureLegoPartPresenter(MxS32, MxS32): 'DLL exported function'
configureLegoROI(MxS32): 'DLL exported function'
GetNoCD_SourceName: 'DLL exported function'
configureLegoWorldPresenter(MxS32): 'DLL exported function'
GetNoCD_SourceName(): 'DLL exported function'