From 4adad9af494d0f7c2e9407a4f30b73d7c0e18634 Mon Sep 17 00:00:00 2001 From: MattKC <34096995+itsmattkc@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:00:27 -0700 Subject: [PATCH 01/16] ci: upload SVGs to external sites Can't embed SVGs from GitHub Releases (made an issue that will probably get ignored here https://github.com/orgs/community/discussions/59781). Uploading to external site instead for the time being. --- .github/workflows/build.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ae88155..09bf06a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -124,17 +124,14 @@ jobs: 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/ From c4d0ea8746de77b493ff7a31700196f1ad7cf07d Mon Sep 17 00:00:00 2001 From: MattKC <34096995+itsmattkc@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:06:30 -0700 Subject: [PATCH 02/16] readme: use SVGs [skip ci] Had to use an external site for this because GitHub doesn't seem to have a good way to do this right now. But this works... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc4c4802..2be5373a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is a **work-in-progress** decompilation of LEGO Island version 1.1. It aims ## Status - + Currently `ISLE.EXE` is completely decompiled and behaves identically to the original. A handful of stubborn instructions are not yet matching, however we anticipate they will as more of the overall codebase is implemented. From e929d76f3c24a623ebffcc3985169709f8af777d Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:12:12 -0700 Subject: [PATCH 03/16] reccmp: use "monospace" in svg font For some reason Inkscape made this "mono", but it seems like "monospace" is the right attribute here --- tools/reccmp/template.svg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/reccmp/template.svg b/tools/reccmp/template.svg index bd36e9b2..626ed08d 100644 --- a/tools/reccmp/template.svg +++ b/tools/reccmp/template.svg @@ -55,12 +55,12 @@ x="58.13345" y="51.967873" />{name}{percent} Date: Fri, 30 Jun 2023 19:24:00 -0400 Subject: [PATCH 04/16] Initial implementation of MxBitmap (#34) Co-authored-by: Anonymous Maarten --- LEGO1/mxbitmap.cpp | 61 ++++++++++++++++++++++++++++++++++++++++------ LEGO1/mxbitmap.h | 15 ++++++++++-- 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/LEGO1/mxbitmap.cpp b/LEGO1/mxbitmap.cpp index 81126d9b..a7425dd8 100644 --- a/LEGO1/mxbitmap.cpp +++ b/LEGO1/mxbitmap.cpp @@ -3,25 +3,72 @@ // 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 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 *) +long MxBitmap::Read(const char *filename) { - // TODO - return 0; + HANDLE handle; + int unk1; + MxResult ret = FAILURE; + + handle = CreateFileA(filename,GENERIC_READ,FILE_SHARE_READ,(LPSECURITY_ATTRIBUTES)NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,(HANDLE)NULL); + if(handle != (HANDLE)INVALID_HANDLE_VALUE) { // INVALID_HANDLE_VALUE = -1, or 0xffffffff + // FIXME: line 16. iVar gets changed in this line + if(unk1 == 0) { + ret = SUCCESS; + } + } + if(handle != (HANDLE)NULL) { + CloseHandle(handle); + } + + return ret; } + diff --git a/LEGO1/mxbitmap.h b/LEGO1/mxbitmap.h index 1fc54260..24d9e166 100644 --- a/LEGO1/mxbitmap.h +++ b/LEGO1/mxbitmap.h @@ -1,15 +1,26 @@ #ifndef MXBITMAP_H #define MXBITMAP_H -#include "mxpalette.h" +#include -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 *); +private: + BITMAPINFO *m_info; + BITMAPINFOHEADER *m_bmiHeader; + RGBQUAD *m_paletteData; + LPVOID *m_data; + MxBool m_unk18; + MxPalette *m_palette; }; #endif // MXBITMAP_H From d7b8d6463bcba9b433e8fa61abe7dd1558a6c4c3 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 1 Jul 2023 01:24:46 +0200 Subject: [PATCH 05/16] lego: Implement/match CalculateNewVel (#66) * lego: Implement/match CalculateNewVel * remove braces * consistency --- LEGO1/legonavcontroller.cpp | 36 +++++++++++++++++++++++++----------- LEGO1/legonavcontroller.h | 1 + LEGO1/legoutil.h | 12 ++++++++++++ LEGO1/mxdsobject.cpp | 10 +++++----- 4 files changed, 43 insertions(+), 16 deletions(-) diff --git a/LEGO1/legonavcontroller.cpp b/LEGO1/legonavcontroller.cpp index af618de9..90c0a485 100644 --- a/LEGO1/legonavcontroller.cpp +++ b/LEGO1/legonavcontroller.cpp @@ -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; +} \ No newline at end of file diff --git a/LEGO1/legonavcontroller.h b/LEGO1/legonavcontroller.h index 9bffd7dd..89af9f12 100644 --- a/LEGO1/legonavcontroller.h +++ b/LEGO1/legonavcontroller.h @@ -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; diff --git a/LEGO1/legoutil.h b/LEGO1/legoutil.h index e94a6440..f0e97ac5 100644 --- a/LEGO1/legoutil.h +++ b/LEGO1/legoutil.h @@ -7,4 +7,16 @@ inline T Abs(T p_t) return p_t < 0 ? -p_t : p_t; } +template +inline T Min(T p_t1, T p_t2) +{ + return p_t1 < p_t2 ? p_t1 : p_t2; +} + +template +inline T Max(T p_t1, T p_t2) +{ + return p_t1 > p_t2 ? p_t1 : p_t2; +} + #endif // LEGOUTIL_H diff --git a/LEGO1/mxdsobject.cpp b/LEGO1/mxdsobject.cpp index fd4b7434..66b1ed6c 100644 --- a/LEGO1/mxdsobject.cpp +++ b/LEGO1/mxdsobject.cpp @@ -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 { From a66dbb8136a718e9217e00acc006ab905441c636 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Fri, 30 Jun 2023 16:33:59 -0700 Subject: [PATCH 06/16] Squashed commit of the following: commit a41a442f5aba5fa2f22efc46e66b055f8e99b04e Author: MishaProductions <106913236+MishaProductions@users.noreply.github.com> Date: Fri Jun 30 08:10:54 2023 +0300 Update .editorconfig Co-authored-by: Anonymous Maarten commit 5768cf4a0cf58778cd1265220936081c43c91769 Author: Misha Date: Fri Jun 30 08:04:37 2023 +0300 add legoutil commit 7d6b00c831d01688749d6cadb8b8ea683d18a52d Author: Misha Date: Fri Jun 30 08:02:17 2023 +0300 Update CMakeLists.txt commit d9b49087f8681a858b7d32b38cc937160b5a5ab0 Author: Misha Date: Fri Jun 30 08:01:06 2023 +0300 Update CMakeLists.txt commit d5a2891965b0e3c992c92e7782c4cc54fc7ae7af Author: Misha Date: Fri Jun 30 07:59:03 2023 +0300 Update CMakeLists.txt commit 519253bff43426d2b4cbb916f0fecba8fd677695 Merge: 6cefa2e 13df3f9 Author: Misha Date: Fri Jun 30 07:57:15 2023 +0300 Merge remote-tracking branch 'upstream/master' into legobackgroundcolor commit 6cefa2e9e259f57033d6e50f9be0af5de6e2df61 Author: Misha Date: Thu Jun 29 16:51:53 2023 +0300 add back stuff to mak file after merge commit c2b16eb8ff2e99b160bf5d5b75df7960da8f2877 Merge: 3c8add2 07912eb Author: Misha Date: Thu Jun 29 16:49:51 2023 +0300 Merge remote-tracking branch 'upstream/master' into legobackgroundcolor commit 3c8add2f1979f1ac2372f06c2025cda4104c2db2 Author: Misha Date: Thu Jun 29 13:34:15 2023 +0300 Update legobackgroundcolor.cpp commit 6879f30e79caaef23319488b729283cda6f46c25 Author: Misha Date: Wed Jun 28 18:22:35 2023 +0300 add fixme + rename MxStringVariable functions commit a883f37b9d67c57bc336812bf83ee85c363f8931 Author: Misha Date: Wed Jun 28 18:15:42 2023 +0300 address review commit a919eeb7f48b31554b8edf499c131f570b1529bf Author: Misha Date: Wed Jun 28 08:19:45 2023 +0300 Update mxbackgroundcolor.cpp commit 710c1dd5ea53212c43e1564480f27370f28ca7e4 Author: Misha Date: Wed Jun 28 08:11:13 2023 +0300 add back mak file commit 25e9bbbfb0d330e70570f59823b2e88f159ad49d Merge: 78b0e8d 2d9af63 Author: Misha Date: Wed Jun 28 08:09:03 2023 +0300 Merge remote-tracking branch 'upstream/master' into legobackgroundcolor commit 78b0e8dd625add18ea9a62dcd72a820e1a0beab5 Author: Misha Date: Tue Jun 27 18:35:58 2023 +0300 improve accuracy commit 4c2e1ca95c4463da20266f61299370fa0ecda9f4 Author: Misha Date: Mon Jun 26 13:50:40 2023 +0300 improve accuracy commit 7dd3469ca330254e0177c838991b9436bb3c90c2 Author: Misha Date: Mon Jun 26 13:24:11 2023 +0300 ConvertColor wip commit b0288803a834a9e4f41486bb60c81935b94a4cd2 Merge: 3d16867 0b47f3f Author: MishaProductions <106913236+MishaProductions@users.noreply.github.com> Date: Mon Jun 26 09:42:08 2023 +0300 Merge branch 'isledecomp:master' into legobackgroundcolor commit 3d16867a901862d66aec632e269061c81e7d443d Author: Misha Date: Sun Jun 25 17:03:14 2023 +0300 90% match commit 2208573eb2cf73465c2a5b49a63db66dd8f6f841 Author: Misha Date: Sun Jun 25 12:23:47 2023 +0300 improve accuracy + add editorconfig commit 288f8614281788fd3a19f07a7732b06337253e34 Author: Misha Date: Sun Jun 25 07:57:14 2023 +0300 fix makefile commit 3590e59a3a9f021b0de3833e80d320238255bc46 Author: Misha Date: Sun Jun 25 07:51:35 2023 +0300 Update isle.mak commit fb52ad57813214a8af9ef21fdb9ef39005961778 Author: Misha Date: Sun Jun 25 07:47:06 2023 +0300 fix build commit 791cf1301af1e194025908d8812edaa4faf0f3cf Merge: b9ecd15 64d2b9e Author: Misha Date: Sun Jun 25 07:42:09 2023 +0300 Merge remote-tracking branch 'upstream/master' into legobackgroundcolor commit b9ecd15ca60b6d4c26fe10405e80b08bbf02d62e Author: Misha Date: Sun Jun 25 07:40:22 2023 +0300 undo change commit 6327a797bce26c277c21c71e5ec56a446f227aa5 Author: Misha Date: Sat Jun 24 21:48:08 2023 +0300 delete accidently committed files commit 7ae1c05df962ff64029c3264aaf824801a3055cc Author: Misha Date: Sat Jun 24 21:47:05 2023 +0300 implement SetColorString commit 323a2ee0e7a4c767d80535f2f0e3a8036124da05 Author: Misha Date: Sat Jun 24 20:47:03 2023 +0300 constructor and some methods are matching commit 0ce6fab3d085b2e2e68c95bdff59557c483486fe Author: Misha Date: Sat Jun 24 20:38:10 2023 +0300 constructor is almost matching --- .editorconfig | 7 ++++ CMakeLists.txt | 3 ++ LEGO1/legobackgroundcolor.cpp | 53 +++++++++++++++++++++++++-- LEGO1/legobackgroundcolor.h | 11 ++++-- LEGO1/legoutil.cpp | 68 +++++++++++++++++++++++++++++++++++ LEGO1/legoutil.h | 2 ++ LEGO1/legovideomanager.cpp | 13 +++++++ LEGO1/legovideomanager.h | 1 + LEGO1/mxstringvariable.cpp | 23 ++++++++++++ LEGO1/mxstringvariable.h | 20 +++++++++++ 10 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 .editorconfig create mode 100644 LEGO1/legoutil.cpp create mode 100644 LEGO1/mxstringvariable.cpp create mode 100644 LEGO1/mxstringvariable.h diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..937b347f --- /dev/null +++ b/.editorconfig @@ -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 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c5900ac..e7b584d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -136,6 +138,7 @@ 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 diff --git a/LEGO1/legobackgroundcolor.cpp b/LEGO1/legobackgroundcolor.cpp index 17d24108..b818267f 100644 --- a/LEGO1/legobackgroundcolor.cpp +++ b/LEGO1/legobackgroundcolor.cpp @@ -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; + } } diff --git a/LEGO1/legobackgroundcolor.h b/LEGO1/legobackgroundcolor.h index c660c0bf..812e8882 100644 --- a/LEGO1/legobackgroundcolor.h +++ b/LEGO1/legobackgroundcolor.h @@ -1,10 +1,17 @@ #ifndef LEGOBACKGROUNDCOLOR_H #define LEGOBACKGROUNDCOLOR_H - -class LegoBackgroundColor +#include "mxstring.h" +#include "mxcore.h" +#include "MxStringVariable.h" +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 diff --git a/LEGO1/legoutil.cpp b/LEGO1/legoutil.cpp new file mode 100644 index 00000000..58e11e8f --- /dev/null +++ b/LEGO1/legoutil.cpp @@ -0,0 +1,68 @@ +#include "legoutil.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; + long hue_index; + double v9; + double v12; + double v13; + if (s > 0.5f) + calc = (1.0f - v) * s + v; + else + calc = (v + 1.0) * s; + if (calc <= 0.0) + { + *g_out = 0.0f; + *b_out = 0.0f; + *r_out = 0.0f; + return; + } + p = s * 2.0 - 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; + } +} \ No newline at end of file diff --git a/LEGO1/legoutil.h b/LEGO1/legoutil.h index f0e97ac5..6a0113e8 100644 --- a/LEGO1/legoutil.h +++ b/LEGO1/legoutil.h @@ -19,4 +19,6 @@ 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 diff --git a/LEGO1/legovideomanager.cpp b/LEGO1/legovideomanager.cpp index 060cc61f..9c1044e2 100644 --- a/LEGO1/legovideomanager.cpp +++ b/LEGO1/legovideomanager.cpp @@ -1,4 +1,5 @@ #include "legovideomanager.h" +#include // 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 +} diff --git a/LEGO1/legovideomanager.h b/LEGO1/legovideomanager.h index ec1aa6fd..379ec468 100644 --- a/LEGO1/legovideomanager.h +++ b/LEGO1/legovideomanager.h @@ -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; diff --git a/LEGO1/mxstringvariable.cpp b/LEGO1/mxstringvariable.cpp new file mode 100644 index 00000000..a9432679 --- /dev/null +++ b/LEGO1/mxstringvariable.cpp @@ -0,0 +1,23 @@ +#include "MxStringVariable.h" +#include "mxstring.h" + +//FIXME: Figure out what exactly this class is used for. It is used in LegoGameState::LegoGameState when loading the background color, and for loading the "fsmovie" variable +// OFFSET: LEGO1 0x1003bec0 +MxStringVariable::~MxStringVariable() +{ + + delete &m_string; + delete &m_name; +} + +// OFFSET: LEGO1 0x1003bea0 +MxString *MxStringVariable::GetString() +{ + return &m_string; +} + +// OFFSET: LEGO1 0x1003beb0 +void MxStringVariable::SetString(const char *colorString) +{ + m_string = colorString; +} diff --git a/LEGO1/mxstringvariable.h b/LEGO1/mxstringvariable.h new file mode 100644 index 00000000..5284fc5d --- /dev/null +++ b/LEGO1/mxstringvariable.h @@ -0,0 +1,20 @@ +#ifndef MXSTRINGVARIABLE_H +#define MXSTRINGVARIABLE_H +#include "mxstring.h" +#include "mxcore.h" +//VTABLE: 0x100d74a8 +class MxStringVariable +{ +public: + __declspec(dllexport) MxStringVariable(const char *, const char *); + MxStringVariable() {} + virtual MxString *GetString(); + virtual void SetString(const char *colorString); + virtual ~MxStringVariable(); + +protected: + MxString m_name; + MxString m_string; +}; + +#endif // MXSTRINGVARIABLE_H From 8aad15d18bb9421d70114872403d9a58626e3030 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 2 Jul 2023 06:49:42 +0200 Subject: [PATCH 07/16] lego1: match MxBitmap::Read and vtable (#67) * lego1: match MxBitmap::Read and vtable * fix param name --- LEGO1/mxbitmap.cpp | 103 ++++++++++++++++++++++++++++++++++----------- LEGO1/mxbitmap.h | 18 ++++++-- 2 files changed, 94 insertions(+), 27 deletions(-) diff --git a/LEGO1/mxbitmap.cpp b/LEGO1/mxbitmap.cpp index a7425dd8..2ccdd80b 100644 --- a/LEGO1/mxbitmap.cpp +++ b/LEGO1/mxbitmap.cpp @@ -14,15 +14,75 @@ MxBitmap::MxBitmap() // OFFSET: LEGO1 0x100bca10 MxBitmap::~MxBitmap() { - if (this->m_info != NULL) { + if (this->m_info != NULL) delete m_info; - } - if (this->m_data != NULL) { + if (this->m_data != NULL) delete m_data; - } - if (this->m_palette != NULL) { + 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 +long 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 @@ -51,24 +111,19 @@ MxPalette *MxBitmap::CreatePalette() return pal; } -// OFFSET: LEGO1 0x100bcd10 -long MxBitmap::Read(const char *filename) +// OFFSET: LEGO1 0x100bd280 STUB +void MxBitmap::vtable38(void*) { - HANDLE handle; - int unk1; - MxResult ret = FAILURE; - - handle = CreateFileA(filename,GENERIC_READ,FILE_SHARE_READ,(LPSECURITY_ATTRIBUTES)NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,(HANDLE)NULL); - if(handle != (HANDLE)INVALID_HANDLE_VALUE) { // INVALID_HANDLE_VALUE = -1, or 0xffffffff - // FIXME: line 16. iVar gets changed in this line - if(unk1 == 0) { - ret = SUCCESS; - } - } - if(handle != (HANDLE)NULL) { - CloseHandle(handle); - } - - return ret; } +// OFFSET: LEGO1 0x100bd2d0 STUB +int MxBitmap::vtable3c(MxBool) +{ + 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; +} \ No newline at end of file diff --git a/LEGO1/mxbitmap.h b/LEGO1/mxbitmap.h index 24d9e166..e16fcb0e 100644 --- a/LEGO1/mxbitmap.h +++ b/LEGO1/mxbitmap.h @@ -11,9 +11,21 @@ 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 long 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; From 904640e028e7aa00b17c730887cfce070801cc66 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sun, 2 Jul 2023 06:51:26 +0200 Subject: [PATCH 08/16] CI steps (#65) * break build up into steps * download artifacts * clone uploadtool * need env on windows * just use ubuntu for inkscape * report went missing * add inkscape to path * use ubuntu for compare * Revert "use ubuntu for compare" This reverts commit a4ce103d091185471bcd629f6dfa6d1ab97829eb. * reinstall after cache * try different apt cache * use im * use rsvg * change size to avoid downscaling * remove png * do not install librsvg anymore --- .github/workflows/build.yml | 58 ++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09bf06a2..3bbc6d50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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,15 +127,30 @@ 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: | - curl -fLOSs https://raw.githubusercontent.com/probonopd/uploadtool/master/upload.sh ./upload.sh \ build/ISLE.EXE \ build/LEGO1.DLL \ From 40dd0a93d473400f55cc2377c613eb469a0944ba Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 2 Jul 2023 08:52:47 +0200 Subject: [PATCH 09/16] Faster reccmp.py on linux (#62) * reccmp: avoid repeated execution of winepath Executing winepath many times is slow, so try we like to avoid it as much as possible. When the path start with a known prefix, replace it with a cached prefix and do some string manipulation. This change reduces execution time of reccmp.py from 90s to 2s. Which is nice. m * reccmp: continue looking when source cannot be found Most often, the reasons is mismatched sources. * reccmp: add basic logging + optional debug * Read the addresses in the exe headers as little endian --- tools/reccmp/reccmp.py | 93 ++++++++++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 27 deletions(-) diff --git a/tools/reccmp/reccmp.py b/tools/reccmp/reccmp.py index abfe71a7..226be15d 100755 --- a/tools/reccmp/reccmp.py +++ b/tools/reccmp/reccmp.py @@ -6,6 +6,7 @@ import difflib import struct import subprocess +import logging import os import sys import colorama @@ -24,8 +25,14 @@ parser.add_argument('--svg-icon', metavar='icon', help='Icon to use in SVG (PNG)') parser.add_argument('--print-rec-addr', action='store_true', help='Print addresses of recompiled functions too') +parser.set_defaults(loglevel=logging.INFO) +parser.add_argument('--debug', action='store_const', const=logging.DEBUG, dest='loglevel', help='Print script debug information') + args = parser.parse_args() +logging.basicConfig(level=args.loglevel, format='[%(levelname)s] %(message)s') +logger = logging.getLogger(__name__) + colorama.init() verbose = None @@ -61,6 +68,7 @@ # to file addresses class Bin: def __init__(self, filename): + logger.debug('Parsing headers of "%s"... ', filename) self.file = open(filename, 'rb') #HACK: Strictly, we should be parsing the header, but we know where @@ -68,15 +76,16 @@ def __init__(self, filename): # Read ImageBase self.file.seek(0xB4) - self.imagebase = struct.unpack('i', self.file.read(4))[0] + self.imagebase, = struct.unpack(' str: + if unix_fn.startswith('./'): + return self.win_cmd + '\\' + unix_fn[2:].replace('/', '\\') + if unix_fn.startswith(self.unix_cwd): + return self.win_cwd + '\\' + unix_fn.removeprefix(self.unix_cwd).replace('/', '\\').lstrip('\\') + return self._call_winepath_unix2win(unix_fn) + + def get_unix_path(self, win_fn: str) -> str: + if win_fn.startswith('.\\') or win_fn.startswith('./'): + return self.unix_cwd + '/' + win_fn[2:].replace('\\', '/') + if win_fn.startswith(self.win_cwd): + return self.unix_cwd + '/' + win_fn.removeprefix(self.win_cwd).replace('\\', '/') + return self._call_winepath_win2unix(win_fn) + + @staticmethod + def _call_winepath_unix2win(fn: str) -> str: + return subprocess.check_output(['winepath', '-w', fn], text=True).strip() + + @staticmethod + def _call_winepath_win2unix(fn: str) -> str: + return subprocess.check_output(['winepath', fn], text=True).strip() def get_file_in_script_dir(fn): return os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), fn) @@ -109,22 +140,24 @@ class SymInfo: funcs = {} lines = {} - def __init__(self, pdb, file): + def __init__(self, pdb, file, wine_path_converter): call = [get_file_in_script_dir('cvdump.exe'), '-l', '-s'] - if os.name != 'nt': + if wine_path_converter: # Run cvdump through wine and convert path to Windows-friendly wine path call.insert(0, 'wine') - call.append(get_wine_path(pdb)) + call.append(wine_path_converter.get_wine_path(pdb)) else: call.append(pdb) - print('Parsing %s...' % pdb) - + logger.info('Parsing %s ...', pdb) + logger.debug('Command = %r', call) line_dump = subprocess.check_output(call).decode('utf-8').split('\r\n') current_section = None + logger.debug('Parsing output of cvdump.exe ...') + for i, line in enumerate(line_dump): if line.startswith('***'): current_section = line[4:] @@ -132,8 +165,6 @@ def __init__(self, pdb, file): if current_section == 'SYMBOLS' and 'S_GPROC32' in line: addr = int(line[26:34], 16) - - info = RecompiledInfo() info.addr = addr + recompfile.imagebase + recompfile.textvirt @@ -155,9 +186,9 @@ def __init__(self, pdb, file): elif current_section == 'LINES' and line.startswith(' ') and not line.startswith(' '): sourcepath = line.split()[0] - if os.name != 'nt': + if wine_path_converter: # Convert filename to Unix path for file compare - sourcepath = get_unix_path(sourcepath) + sourcepath = wine_path_converter.get_unix_path(sourcepath) if sourcepath not in self.lines: self.lines[sourcepath] = {} @@ -178,18 +209,23 @@ def __init__(self, pdb, file): j += 1 + logger.debug('... Parsing output of cvdump.exe finished') + def get_recompiled_address(self, filename, line): addr = None found = False - #print('Looking for ' + filename + ' line ' + str(line)) + logger.debug('Looking for %s:%d', filename, line) for fn in self.lines: # Sometimes a PDB is compiled with a relative path while we always have # an absolute path. Therefore we must - if os.path.samefile(fn, filename): - filename = fn - break + try: + if os.path.samefile(fn, filename): + filename = fn + break + except FileNotFoundError as e: + continue if filename in self.lines and line in self.lines[fn]: addr = self.lines[fn][line] @@ -197,13 +233,16 @@ def get_recompiled_address(self, filename, line): if addr in self.funcs: return self.funcs[addr] else: - print('Failed to find function symbol with address: %s' % hex(addr)) + logger.error('Failed to find function symbol with address: 0x%x', addr) else: - print('Failed to find function symbol with filename and line: %s:%s' % (filename, str(line))) + logger.error('Failed to find function symbol with filename and line: %s:%d', filename, line) +wine_path_converter = None +if os.name != 'nt': + wine_path_converter = WinePathConverter(source) origfile = Bin(original) recompfile = Bin(recomp) -syminfo = SymInfo(syms, recompfile) +syminfo = SymInfo(syms, recompfile, wine_path_converter) print() From 302b3f66f09133bd8feaff24992ffbd4e986211b Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 2 Jul 2023 08:53:54 +0200 Subject: [PATCH 10/16] Get Isle building on MinGW32 (#63) * Add MxUnknown100dc6b0::~MxUnknown100dc6b0 stub * Declare destructor of MxOmni and MxTransitionManager in class * inline attribute must go first * Stub LegoState::Vtable0x14 for Act3State * MxStreamer::VTable0x14 is not an override * Stub MxEntity::Destroy for LegoState::Destroy * Stub MxUnknown100dc6e0 for MxSoundManager * ::ClassName and ::IsA are const methods * methods in the class body don't need a namespace * MxSoundManager subclasses MxUnknown100dc6e0 * LegoInputManager subclasses MxPresenter * NotificationId is an enum, and does not need __declspec(dllexport) * Fix final #endif of legoomni.h and mxobjectfactory.h * Add const alternative for LegoOmni::Create and MxVideoParam, only available for MinGW * Alternative approach to MinGW compatibility * MinGW on Linux is case sensitve * Don't delete a member variable. C++ automatically destructs member variables --------- Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com> --- CMakeLists.txt | 1 + LEGO1/act2brick.h | 6 +++--- LEGO1/compat.h | 14 ++++++++++++++ LEGO1/legobackgroundcolor.h | 3 ++- LEGO1/legoinputmanager.h | 8 ++++---- LEGO1/legoomni.cpp | 2 +- LEGO1/legoomni.h | 3 ++- LEGO1/legostate.cpp | 5 +++++ LEGO1/legostate.h | 4 +++- LEGO1/mxentity.cpp | 6 ++++++ LEGO1/mxentity.h | 2 ++ LEGO1/mxmediapresenter.h | 4 ++-- LEGO1/mxobjectfactory.h | 2 +- LEGO1/mxomni.h | 5 +++-- LEGO1/mxsoundmanager.cpp | 12 ++++++++++-- LEGO1/mxsoundmanager.h | 8 ++++++-- LEGO1/mxstreamer.h | 2 +- LEGO1/mxstringvariable.cpp | 17 ++++++++--------- LEGO1/mxstringvariable.h | 2 +- LEGO1/mxtimer.h | 2 +- LEGO1/mxtransitionmanager.h | 3 ++- LEGO1/mxunknown100dc6b0.cpp | 6 ++++++ LEGO1/mxunknown100dc6b0.h | 1 + LEGO1/mxunknown100dc6e0.cpp | 19 +++++++++++++++++++ LEGO1/mxunknown100dc6e0.h | 19 +++++++++++++++++++ LEGO1/mxvideoparam.cpp | 2 +- LEGO1/mxvideoparam.h | 3 ++- 27 files changed, 126 insertions(+), 35 deletions(-) create mode 100644 LEGO1/compat.h create mode 100644 LEGO1/mxunknown100dc6e0.cpp create mode 100644 LEGO1/mxunknown100dc6e0.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e7b584d9..4d4976fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,6 +142,7 @@ add_library(lego1 SHARED LEGO1/mxtimer.cpp LEGO1/mxtransitionmanager.cpp LEGO1/mxunknown100dc6b0.cpp + LEGO1/mxunknown100dc6e0.cpp LEGO1/mxvariabletable.cpp LEGO1/mxvideomanager.cpp LEGO1/mxvideoparam.cpp diff --git a/LEGO1/act2brick.h b/LEGO1/act2brick.h index d5703081..fd10a997 100644 --- a/LEGO1/act2brick.h +++ b/LEGO1/act2brick.h @@ -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 // 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); } diff --git a/LEGO1/compat.h b/LEGO1/compat.h new file mode 100644 index 00000000..496fa4db --- /dev/null +++ b/LEGO1/compat.h @@ -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 \ No newline at end of file diff --git a/LEGO1/legobackgroundcolor.h b/LEGO1/legobackgroundcolor.h index 812e8882..1daa6311 100644 --- a/LEGO1/legobackgroundcolor.h +++ b/LEGO1/legobackgroundcolor.h @@ -2,7 +2,8 @@ #define LEGOBACKGROUNDCOLOR_H #include "mxstring.h" #include "mxcore.h" -#include "MxStringVariable.h" +#include "mxstringvariable.h" + class LegoBackgroundColor : public MxStringVariable { public: diff --git a/LEGO1/legoinputmanager.h b/LEGO1/legoinputmanager.h index caafed52..c629134e 100644 --- a/LEGO1/legoinputmanager.h +++ b/LEGO1/legoinputmanager.h @@ -1,9 +1,9 @@ #ifndef LEGOINPUTMANAGER_H #define LEGOINPUTMANAGER_H -#include "mxcore.h" +#include "mxpresenter.h" -__declspec(dllexport) enum NotificationId +enum NotificationId { NONE = 0, KEYDOWN = 7, @@ -15,7 +15,7 @@ __declspec(dllexport) enum NotificationId // VTABLE 0x100d8760 // SIZE 0x338 -class LegoInputManager +class LegoInputManager : public MxPresenter { public: LegoInputManager(); @@ -27,7 +27,7 @@ class LegoInputManager virtual long Tickle() override; // vtable+0x8 - char m_pad00[0x19C]; + char m_pad00[0x15c]; int m_joystickIndex; char m_pad200[0x194]; MxBool m_useJoystick; diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index 365748e7..45f7a9f7 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -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; diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 9d825ebc..512fba41 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -1,6 +1,7 @@ #ifndef LEGOOMNI_H #define LEGOOMNI_H +#include "compat.h" #include "legoentity.h" #include "legoinputmanager.h" #include "legogamestate.h" @@ -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); diff --git a/LEGO1/legostate.cpp b/LEGO1/legostate.cpp index 2b49fcd7..55637dc4 100644 --- a/LEGO1/legostate.cpp +++ b/LEGO1/legostate.cpp @@ -4,3 +4,8 @@ LegoState::~LegoState() { } + +// OFFSET: LEGO1 0x10005f90 +MxBool LegoState::VTable0x14() { + return TRUE; +} diff --git a/LEGO1/legostate.h b/LEGO1/legostate.h index be7289bc..904ad323 100644 --- a/LEGO1/legostate.h +++ b/LEGO1/legostate.h @@ -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 diff --git a/LEGO1/mxentity.cpp b/LEGO1/mxentity.cpp index 526a03e2..7459dd24 100644 --- a/LEGO1/mxentity.cpp +++ b/LEGO1/mxentity.cpp @@ -11,3 +11,9 @@ MxEntity::~MxEntity() { // TODO } + +// OFFSET: LEGO1 0x10001070 STUB +void MxEntity::Destroy() +{ + // TODO +} diff --git a/LEGO1/mxentity.h b/LEGO1/mxentity.h index dda04646..7123abbf 100644 --- a/LEGO1/mxentity.h +++ b/LEGO1/mxentity.h @@ -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 }; diff --git a/LEGO1/mxmediapresenter.h b/LEGO1/mxmediapresenter.h index 3fb70d31..647150c4 100644 --- a/LEGO1/mxmediapresenter.h +++ b/LEGO1/mxmediapresenter.h @@ -15,14 +15,14 @@ class MxMediaPresenter : public MxPresenter virtual long 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); } diff --git a/LEGO1/mxobjectfactory.h b/LEGO1/mxobjectfactory.h index 57809be9..bdd172a8 100644 --- a/LEGO1/mxobjectfactory.h +++ b/LEGO1/mxobjectfactory.h @@ -9,4 +9,4 @@ class MxObjectFactory : public MxCore }; -#endif MXOBJECTFACTORY_H +#endif // MXOBJECTFACTORY_H diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index 0e837ad1..dee03229 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -28,8 +28,9 @@ 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(); + + MxOmni(); + virtual ~MxOmni() override; virtual long Notify(MxParam &p); // vtable+04 virtual void Init(); // vtable+14 diff --git a/LEGO1/mxsoundmanager.cpp b/LEGO1/mxsoundmanager.cpp index d12ecee1..275d0514 100644 --- a/LEGO1/mxsoundmanager.cpp +++ b/LEGO1/mxsoundmanager.cpp @@ -1,9 +1,9 @@ #include "mxsoundmanager.h" -// OFFSET: LEGO1 0x100ae740 STUB +// OFFSET: LEGO1 0x100ae740 MxSoundManager::MxSoundManager() { - // TODO + Init(); } // OFFSET: LEGO1 0x100ae7d0 STUB @@ -11,3 +11,11 @@ MxSoundManager::~MxSoundManager() { // TODO } + +// OFFSET: LEGO1 0x100ae830 +void MxSoundManager::Init() +{ + m_unk30 = 0; + m_unk34 = 0; +} + diff --git a/LEGO1/mxsoundmanager.h b/LEGO1/mxsoundmanager.h index 3421a5d6..4d74fa95 100644 --- a/LEGO1/mxsoundmanager.h +++ b/LEGO1/mxsoundmanager.h @@ -1,17 +1,21 @@ #ifndef MXSOUNDMANAGER_H #define MXSOUNDMANAGER_H -#include "mxcore.h" +#include "mxunknown100dc6e0.h" // VTABLE 0x100dc128 // SIZE 0x3c // Base vtables are: MxCore -> 0x100dc6b0 -> 0x100dc6e0 -> MxSoundManager -class MxSoundManager +class MxSoundManager : public MxUnknown100dc6e0 { public: MxSoundManager(); virtual ~MxSoundManager() override; // vtable+0x0 +private: + void Init(); + int m_unk30; + int m_unk34; }; #endif // MXSOUNDMANAGER_H diff --git a/LEGO1/mxstreamer.h b/LEGO1/mxstreamer.h index f8eeb43b..de84ed01 100644 --- a/LEGO1/mxstreamer.h +++ b/LEGO1/mxstreamer.h @@ -15,7 +15,7 @@ class MxStreamer : public MxCore __declspec(dllexport) long Close(const char *p); virtual long Notify(MxParam &p) override; // vtable+0x4 - virtual MxResult VTable0x14() override; // vtable+0x14 + virtual MxResult VTable0x14(); // vtable+0x14 }; #endif // MXSTREAMER_H diff --git a/LEGO1/mxstringvariable.cpp b/LEGO1/mxstringvariable.cpp index a9432679..e63329c1 100644 --- a/LEGO1/mxstringvariable.cpp +++ b/LEGO1/mxstringvariable.cpp @@ -1,14 +1,6 @@ -#include "MxStringVariable.h" +#include "mxstringvariable.h" #include "mxstring.h" -//FIXME: Figure out what exactly this class is used for. It is used in LegoGameState::LegoGameState when loading the background color, and for loading the "fsmovie" variable -// OFFSET: LEGO1 0x1003bec0 -MxStringVariable::~MxStringVariable() -{ - - delete &m_string; - delete &m_name; -} // OFFSET: LEGO1 0x1003bea0 MxString *MxStringVariable::GetString() @@ -21,3 +13,10 @@ void MxStringVariable::SetString(const char *colorString) { m_string = colorString; } + +//FIXME: Figure out what exactly this class is used for. It is used in LegoGameState::LegoGameState when loading the background color, and for loading the "fsmovie" variable +// OFFSET: LEGO1 0x1003bec0 +void MxStringVariable::Destroy() +{ + delete this; +} diff --git a/LEGO1/mxstringvariable.h b/LEGO1/mxstringvariable.h index 5284fc5d..dd623dfb 100644 --- a/LEGO1/mxstringvariable.h +++ b/LEGO1/mxstringvariable.h @@ -10,7 +10,7 @@ class MxStringVariable MxStringVariable() {} virtual MxString *GetString(); virtual void SetString(const char *colorString); - virtual ~MxStringVariable(); + virtual void Destroy(); protected: MxString m_name; diff --git a/LEGO1/mxtimer.h b/LEGO1/mxtimer.h index d79023d8..564eedfa 100644 --- a/LEGO1/mxtimer.h +++ b/LEGO1/mxtimer.h @@ -15,7 +15,7 @@ class MxTimer : public MxCore __declspec(dllexport) long GetRealTime(); - long GetTime() inline + inline long GetTime() { if (this->m_isRunning) return s_LastTimeCalculated; diff --git a/LEGO1/mxtransitionmanager.h b/LEGO1/mxtransitionmanager.h index 3fdb1ebf..9dcb7f7c 100644 --- a/LEGO1/mxtransitionmanager.h +++ b/LEGO1/mxtransitionmanager.h @@ -9,7 +9,8 @@ class MxVideoPresenter; class MxTransitionManager : public MxCore { public: - virtual ~MxTransitionManager(); // vtable+0x0 + MxTransitionManager(); + virtual ~MxTransitionManager() override; // vtable+0x0 __declspec(dllexport) void SetWaitIndicator(MxVideoPresenter *videoPresenter); diff --git a/LEGO1/mxunknown100dc6b0.cpp b/LEGO1/mxunknown100dc6b0.cpp index 029be1f7..b896fa10 100644 --- a/LEGO1/mxunknown100dc6b0.cpp +++ b/LEGO1/mxunknown100dc6b0.cpp @@ -6,6 +6,12 @@ MxUnknown100dc6b0::MxUnknown100dc6b0() Init(); } +// OFFSET: LEGO1 0x100b8560 STUB +MxUnknown100dc6b0::~MxUnknown100dc6b0() +{ + // TODO +} + // OFFSET: LEGO1 0x100b85d0 MxResult MxUnknown100dc6b0::Init() { diff --git a/LEGO1/mxunknown100dc6b0.h b/LEGO1/mxunknown100dc6b0.h index ca2ee600..29d42209 100644 --- a/LEGO1/mxunknown100dc6b0.h +++ b/LEGO1/mxunknown100dc6b0.h @@ -10,6 +10,7 @@ class MxUnknown100dc6b0 : public MxCore { public: MxUnknown100dc6b0(); + virtual ~MxUnknown100dc6b0() override; MxResult Init(); diff --git a/LEGO1/mxunknown100dc6e0.cpp b/LEGO1/mxunknown100dc6e0.cpp new file mode 100644 index 00000000..b896e89b --- /dev/null +++ b/LEGO1/mxunknown100dc6e0.cpp @@ -0,0 +1,19 @@ +#include "mxunknown100dc6e0.h" + +// OFFSET: LEGO1 0x100b8d00 +MxUnknown100dc6e0::MxUnknown100dc6e0() +{ + Init(); +} + +// OFFSET: LEGO1 0x100b8d90 STUB +MxUnknown100dc6e0::~MxUnknown100dc6e0() +{ + // TODO +} + +// OFFSET: LEGO1 0x100b8df0 +void MxUnknown100dc6e0::Init() +{ + this->m_unk2c = 100; +} diff --git a/LEGO1/mxunknown100dc6e0.h b/LEGO1/mxunknown100dc6e0.h new file mode 100644 index 00000000..79c63bab --- /dev/null +++ b/LEGO1/mxunknown100dc6e0.h @@ -0,0 +1,19 @@ +#ifndef MXUNKNOWN100DC6E0_H +#define MXUNKNOWN100DC6E0_H + +#include "mxunknown100dc6b0.h" + +// VTABLE 0x100dc6e0 +class MxUnknown100dc6e0 : public MxUnknown100dc6b0 +{ +public: + MxUnknown100dc6e0(); + virtual ~MxUnknown100dc6e0() override; + +protected: + void Init(); + + int m_unk2c; +}; + +#endif // MXUNKNOWN100DC6E0_H diff --git a/LEGO1/mxvideoparam.cpp b/LEGO1/mxvideoparam.cpp index b72107c7..81f5d2d7 100644 --- a/LEGO1/mxvideoparam.cpp +++ b/LEGO1/mxvideoparam.cpp @@ -17,7 +17,7 @@ MxVideoParam::MxVideoParam() } // OFFSET: LEGO1 0x100beca0 -MxVideoParam::MxVideoParam(MxRect32 &p_rect, MxPalette *p_pal, unsigned long p_backBuffers, MxVideoParamFlags &p_flags) +MxVideoParam::MxVideoParam(COMPAT_CONST MxRect32 &p_rect, MxPalette *p_pal, unsigned long p_backBuffers, COMPAT_CONST MxVideoParamFlags &p_flags) { this->m_rect.m_left = p_rect.m_left; this->m_rect.m_top = p_rect.m_top; diff --git a/LEGO1/mxvideoparam.h b/LEGO1/mxvideoparam.h index 3e00a920..0b6b2a38 100644 --- a/LEGO1/mxvideoparam.h +++ b/LEGO1/mxvideoparam.h @@ -3,6 +3,7 @@ #include +#include "compat.h" #include "mxpalette.h" #include "mxrect32.h" #include "mxtypes.h" @@ -14,7 +15,7 @@ class MxVideoParam public: __declspec(dllexport) MxVideoParam(); __declspec(dllexport) MxVideoParam(MxVideoParam &); - __declspec(dllexport) MxVideoParam(MxRect32 &rect, MxPalette *pal, unsigned long p3, MxVideoParamFlags &flags); + __declspec(dllexport) MxVideoParam(COMPAT_CONST MxRect32 &rect, MxPalette *pal, unsigned long p3, COMPAT_CONST MxVideoParamFlags &flags); __declspec(dllexport) MxVideoParam &operator=(const MxVideoParam &); __declspec(dllexport) ~MxVideoParam(); From 646b39e8765d0c93897c210f0308be7d47e053bf Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 2 Jul 2023 09:00:28 +0200 Subject: [PATCH 11/16] Implement MxObjectFactory::{MxObjectFactory,Create} + match sizes of Mx.*Presenter objects created by it (#59) * Get Isle building on MinGW32 (#63) * Add MxUnknown100dc6b0::~MxUnknown100dc6b0 stub * Declare destructor of MxOmni and MxTransitionManager in class * inline attribute must go first * Stub LegoState::Vtable0x14 for Act3State * MxStreamer::VTable0x14 is not an override * Stub MxEntity::Destroy for LegoState::Destroy * Stub MxUnknown100dc6e0 for MxSoundManager * ::ClassName and ::IsA are const methods * methods in the class body don't need a namespace * MxSoundManager subclasses MxUnknown100dc6e0 * LegoInputManager subclasses MxPresenter * NotificationId is an enum, and does not need __declspec(dllexport) * Fix final #endif of legoomni.h and mxobjectfactory.h * Add const alternative for LegoOmni::Create and MxVideoParam, only available for MinGW * Alternative approach to MinGW compatibility * MinGW on Linux is case sensitve * Don't delete a member variable. C++ automatically destructs member variables --------- Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com> * MxatomId: implement inline operator== * Add decomp.h header, containing macro's only used when matching the original binaries * Add in-line constructor of MxPresenter * MxMediaPresenter: add members to match size * MxVideoPresenter: add members to match size * MxCompositePresenter: add members to match size * MxFlcPresenter: add members to match size * MxSmkPresenter: add members to match size * MxStillPresenter: add members to match size * MxAudioPresenter: add members to match size * MxWavePresenter: add members to match size * MxMIDIPresenter: add members to match size * MxEventPresenter: add members to match size * MxLoopingFlcPresenter: add members to match size * MxLoopingSmkPresenter: add members to match size * MxLoopingMIDIPresenter: add check for size * Implement MxObjectFactory::{MxObjectFactory,Create} Matching of MxObjectFactory::Create is not good, because none of the other objects have been implemented. * Implement a few MxPresenter methods * Fix size of LegoInputManager * Fix name of first padding member of legoinputmanager.h * add DECOMP_SIZE_ASSERT macro * Use DECOMP_SIZE_ASSERT macro + convert to hexadecimal * fixed minor typos --------- Co-authored-by: MattKC <34096995+itsmattkc@users.noreply.github.com> Co-authored-by: itsmattkc --- CMakeLists.txt | 3 ++ LEGO1/decomp.h | 11 ++++++ LEGO1/legoinputmanager.cpp | 4 +++ LEGO1/legoinputmanager.h | 5 +-- LEGO1/mxatomid.h | 11 ++++++ LEGO1/mxaudiopresenter.cpp | 4 +++ LEGO1/mxaudiopresenter.h | 8 ++++- LEGO1/mxcompositepresenter.cpp | 4 +++ LEGO1/mxcompositepresenter.h | 5 ++- LEGO1/mxeventpresenter.cpp | 8 +++-- LEGO1/mxeventpresenter.h | 5 ++- LEGO1/mxflcpresenter.cpp | 4 +++ LEGO1/mxflcpresenter.h | 4 +++ LEGO1/mxloopingflcpresenter.cpp | 4 +++ LEGO1/mxloopingflcpresenter.h | 5 ++- LEGO1/mxloopingmidipresenter.cpp | 5 +++ LEGO1/mxloopingsmkpresenter.cpp | 4 +++ LEGO1/mxloopingsmkpresenter.h | 5 ++- LEGO1/mxmediapresenter.cpp | 2 ++ LEGO1/mxmediapresenter.h | 6 ++++ LEGO1/mxmidipresenter.cpp | 16 +++++++++ LEGO1/mxmidipresenter.h | 5 +++ LEGO1/mxobjectfactory.cpp | 45 ++++++++++++++++++++++++ LEGO1/mxobjectfactory.h | 24 ++++++++++++- LEGO1/mxpresenter.cpp | 59 +++++++++++++++++--------------- LEGO1/mxpresenter.h | 47 +++++++++++++------------ LEGO1/mxsmkpresenter.cpp | 4 +++ LEGO1/mxsmkpresenter.h | 7 ++-- LEGO1/mxstillpresenter.cpp | 4 +++ LEGO1/mxstillpresenter.h | 7 ++++ LEGO1/mxvideopresenter.cpp | 7 ++++ LEGO1/mxvideopresenter.h | 16 ++++++++- LEGO1/mxwavepresenter.cpp | 15 ++++++-- LEGO1/mxwavepresenter.h | 16 ++++++++- 34 files changed, 312 insertions(+), 67 deletions(-) create mode 100644 LEGO1/decomp.h create mode 100644 LEGO1/mxloopingmidipresenter.cpp create mode 100644 LEGO1/mxmidipresenter.cpp create mode 100644 LEGO1/mxobjectfactory.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d4976fa..cdfebd05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,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 diff --git a/LEGO1/decomp.h b/LEGO1/decomp.h new file mode 100644 index 00000000..5466e6d8 --- /dev/null +++ b/LEGO1/decomp.h @@ -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 diff --git a/LEGO1/legoinputmanager.cpp b/LEGO1/legoinputmanager.cpp index 792da404..6c0bd709 100644 --- a/LEGO1/legoinputmanager.cpp +++ b/LEGO1/legoinputmanager.cpp @@ -1,5 +1,9 @@ #include "legoinputmanager.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(LegoInputManager, 0x338); // 0x10059085 + // OFFSET: LEGO1 0x1005b790 STUB LegoInputManager::LegoInputManager() { diff --git a/LEGO1/legoinputmanager.h b/LEGO1/legoinputmanager.h index c629134e..74a2a8fa 100644 --- a/LEGO1/legoinputmanager.h +++ b/LEGO1/legoinputmanager.h @@ -1,6 +1,7 @@ #ifndef LEGOINPUTMANAGER_H #define LEGOINPUTMANAGER_H +#include "decomp.h" #include "mxpresenter.h" enum NotificationId @@ -27,9 +28,9 @@ class LegoInputManager : public MxPresenter virtual long Tickle() override; // vtable+0x8 - char m_pad00[0x15c]; + undefined m_pad40[0x15c]; int m_joystickIndex; - char m_pad200[0x194]; + undefined m_pad200[0x194]; MxBool m_useJoystick; }; diff --git a/LEGO1/mxatomid.h b/LEGO1/mxatomid.h index 9a218a1b..6b7dddbb 100644 --- a/LEGO1/mxatomid.h +++ b/LEGO1/mxatomid.h @@ -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; }; diff --git a/LEGO1/mxaudiopresenter.cpp b/LEGO1/mxaudiopresenter.cpp index b15c2556..ac634362 100644 --- a/LEGO1/mxaudiopresenter.cpp +++ b/LEGO1/mxaudiopresenter.cpp @@ -1 +1,5 @@ #include "mxaudiopresenter.h" + +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxAudioPresenter, 0x54); diff --git a/LEGO1/mxaudiopresenter.h b/LEGO1/mxaudiopresenter.h index b23eefe9..c1001a13 100644 --- a/LEGO1/mxaudiopresenter.h +++ b/LEGO1/mxaudiopresenter.h @@ -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 diff --git a/LEGO1/mxcompositepresenter.cpp b/LEGO1/mxcompositepresenter.cpp index e42dbadb..342f3d96 100644 --- a/LEGO1/mxcompositepresenter.cpp +++ b/LEGO1/mxcompositepresenter.cpp @@ -1,5 +1,9 @@ #include "mxcompositepresenter.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxCompositePresenter, 0x4c); + // OFFSET: LEGO1 0x100b60b0 STUB MxCompositePresenter::MxCompositePresenter() { diff --git a/LEGO1/mxcompositepresenter.h b/LEGO1/mxcompositepresenter.h index 471f3087..9f517652 100644 --- a/LEGO1/mxcompositepresenter.h +++ b/LEGO1/mxcompositepresenter.h @@ -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 diff --git a/LEGO1/mxeventpresenter.cpp b/LEGO1/mxeventpresenter.cpp index ba78203f..88c20ce3 100644 --- a/LEGO1/mxeventpresenter.cpp +++ b/LEGO1/mxeventpresenter.cpp @@ -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; } diff --git a/LEGO1/mxeventpresenter.h b/LEGO1/mxeventpresenter.h index 2adb8cfa..256d0c7f 100644 --- a/LEGO1/mxeventpresenter.h +++ b/LEGO1/mxeventpresenter.h @@ -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; }; diff --git a/LEGO1/mxflcpresenter.cpp b/LEGO1/mxflcpresenter.cpp index 1e6ee289..8bd23d22 100644 --- a/LEGO1/mxflcpresenter.cpp +++ b/LEGO1/mxflcpresenter.cpp @@ -1,5 +1,9 @@ #include "mxflcpresenter.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxFlcPresenter, 0x68); + // OFFSET: LEGO1 0x100b3310 STUB MxFlcPresenter::MxFlcPresenter() { diff --git a/LEGO1/mxflcpresenter.h b/LEGO1/mxflcpresenter.h index 5d63c41c..bc34ff12 100644 --- a/LEGO1/mxflcpresenter.h +++ b/LEGO1/mxflcpresenter.h @@ -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 diff --git a/LEGO1/mxloopingflcpresenter.cpp b/LEGO1/mxloopingflcpresenter.cpp index f4602f3c..041ae6a5 100644 --- a/LEGO1/mxloopingflcpresenter.cpp +++ b/LEGO1/mxloopingflcpresenter.cpp @@ -1,5 +1,9 @@ #include "mxloopingflcpresenter.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxLoopingFlcPresenter, 0x6c); + // OFFSET: LEGO1 0x100b4310 STUB MxLoopingFlcPresenter::MxLoopingFlcPresenter() { diff --git a/LEGO1/mxloopingflcpresenter.h b/LEGO1/mxloopingflcpresenter.h index 5152e4d9..1973c28e 100644 --- a/LEGO1/mxloopingflcpresenter.h +++ b/LEGO1/mxloopingflcpresenter.h @@ -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 diff --git a/LEGO1/mxloopingmidipresenter.cpp b/LEGO1/mxloopingmidipresenter.cpp new file mode 100644 index 00000000..ebeed4b4 --- /dev/null +++ b/LEGO1/mxloopingmidipresenter.cpp @@ -0,0 +1,5 @@ +#include "mxloopingmidipresenter.h" + +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxLoopingMIDIPresenter, 0x58); diff --git a/LEGO1/mxloopingsmkpresenter.cpp b/LEGO1/mxloopingsmkpresenter.cpp index cb038462..da9223df 100644 --- a/LEGO1/mxloopingsmkpresenter.cpp +++ b/LEGO1/mxloopingsmkpresenter.cpp @@ -1,5 +1,9 @@ #include "mxloopingsmkpresenter.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxLoopingSmkPresenter, 0x724); + // OFFSET: LEGO1 0x100b48b0 MxLoopingSmkPresenter::MxLoopingSmkPresenter() { diff --git a/LEGO1/mxloopingsmkpresenter.h b/LEGO1/mxloopingsmkpresenter.h index 129d98b9..8ca18d20 100644 --- a/LEGO1/mxloopingsmkpresenter.h +++ b/LEGO1/mxloopingsmkpresenter.h @@ -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 diff --git a/LEGO1/mxmediapresenter.cpp b/LEGO1/mxmediapresenter.cpp index 793b3ea8..9df33285 100644 --- a/LEGO1/mxmediapresenter.cpp +++ b/LEGO1/mxmediapresenter.cpp @@ -1,5 +1,7 @@ #include "mxmediapresenter.h" +DECOMP_SIZE_ASSERT(MxMediaPresenter, 0x50); + // OFFSET: LEGO1 0x100b5d10 STUB long MxMediaPresenter::Tickle() { diff --git a/LEGO1/mxmediapresenter.h b/LEGO1/mxmediapresenter.h index 647150c4..b3a1b38a 100644 --- a/LEGO1/mxmediapresenter.h +++ b/LEGO1/mxmediapresenter.h @@ -3,6 +3,8 @@ #include "mxpresenter.h" +#include "decomp.h" + // VTABLE 0x100d4cd8 class MxMediaPresenter : public MxPresenter { @@ -27,6 +29,10 @@ class MxMediaPresenter : public MxPresenter return !strcmp(name, MxMediaPresenter::ClassName()) || MxPresenter::IsA(name); } + undefined4 m_unk40; + undefined4 m_unk44; + undefined4 m_unk48; + undefined4 m_unk4c; private: void Init(); diff --git a/LEGO1/mxmidipresenter.cpp b/LEGO1/mxmidipresenter.cpp new file mode 100644 index 00000000..98868f8a --- /dev/null +++ b/LEGO1/mxmidipresenter.cpp @@ -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; +} diff --git a/LEGO1/mxmidipresenter.h b/LEGO1/mxmidipresenter.h index 8a46d12a..1cd65c4a 100644 --- a/LEGO1/mxmidipresenter.h +++ b/LEGO1/mxmidipresenter.h @@ -6,6 +6,11 @@ // VTABLE 0x100dca20 class MxMIDIPresenter : public MxMusicPresenter { +public: + MxMIDIPresenter(); +private: + void Init(); + undefined4 m_unk54; }; #endif // MXMIDIPRESENTER_H diff --git a/LEGO1/mxobjectfactory.cpp b/LEGO1/mxobjectfactory.cpp new file mode 100644 index 00000000..d52e4dac --- /dev/null +++ b/LEGO1/mxobjectfactory.cpp @@ -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 +} diff --git a/LEGO1/mxobjectfactory.h b/LEGO1/mxobjectfactory.h index bdd172a8..53aee2cb 100644 --- a/LEGO1/mxobjectfactory.h +++ b/LEGO1/mxobjectfactory.h @@ -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 diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index 893de60d..5ef01c64 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -1,5 +1,9 @@ #include "mxpresenter.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxPresenter, 0x40); + // OFFSET: LEGO1 0x1000bee0 STUB void MxPresenter::DoneTickle() { @@ -24,10 +28,9 @@ void MxPresenter::ParseExtra() // TODO } -// OFFSET: LEGO1 0x1000c070 STUB +// OFFSET: LEGO1 0x1000bf00 MxPresenter::~MxPresenter() { - // TODO } // OFFSET: LEGO1 0x100b5200 STUB @@ -46,52 +49,57 @@ long MxPresenter::StartAction(MxStreamController *, MxDSAction *) return 0; } -// OFFSET: LEGO1 0x100d4d74 STUB +// OFFSET: LEGO1 0x100b4e40 STUB void MxPresenter::EndAction() { // TODO } -// OFFSET: LEGO1 0x100d4d8c STUB +// OFFSET: LEGO1 0x100b52d0 STUB void MxPresenter::Enable(unsigned char) { // TODO } -// OFFSET: LEGO1 0x1000be30 STUB +// OFFSET: LEGO1 0x1000be30 void MxPresenter::VTable0x14() { - // TODO } -// OFFSET: LEGO1 0x1000be40 STUB +// OFFSET: LEGO1 0x1000be40 void MxPresenter::VTable0x18() { - // TODO + ParseExtra(); + m_unk0xc |= 1 << (unsigned char)m_unk0x8; + m_unk0x8 = 2; } -// OFFSET: LEGO1 0x1000be60 STUB +// OFFSET: LEGO1 0x1000be60 void MxPresenter::VTable0x1c() { - // TODO + m_unk0xc |= 1 << (unsigned char)m_unk0x8; + m_unk0x8 = 3; } -// OFFSET: LEGO1 0x1000be80 STUB +// OFFSET: LEGO1 0x1000be80 void MxPresenter::VTable0x20() { - // TODO + m_unk0xc |= 1 << (unsigned char)m_unk0x8; + m_unk0x8 = 4; } -// OFFSET: LEGO1 0x1000bea0 STUB +// OFFSET: LEGO1 0x1000bea0 void MxPresenter::VTable0x24() { - // TODO + m_unk0xc |= 1 << (unsigned char)m_unk0x8; + m_unk0x8 = 5; } -// OFFSET: LEGO1 0x1000bec0 STUB +// OFFSET: LEGO1 0x1000bec0 void MxPresenter::VTable0x28() { - // TODO + m_unk0xc |= 1 << (unsigned char)m_unk0x8; + m_unk0x8 = 6; } // OFFSET: LEGO1 0x1000bf70 @@ -105,18 +113,17 @@ void MxPresenter::InitVirtual() { Init(); } -// OFFSET: LEGO1 0x1000bf90 STUB +// OFFSET: LEGO1 0x1000bf90 void MxPresenter::VTable0x44(undefined4 param) { - // TODO + m_unk0xc |= 1 << (unsigned char)m_unk0x8; + m_unk0x8 = param; } -// OFFSET: LEGO1 0x1000bfb0 STUB -undefined4 MxPresenter::VTable0x48(undefined4 param) +// OFFSET: LEGO1 0x1000bfb0 +unsigned char MxPresenter::VTable0x48(unsigned char param) { - // TODO - - return undefined4(); + return m_unk0xc & (1 << param); } // OFFSET: LEGO1 0x1000bfc0 @@ -125,10 +132,8 @@ undefined4 MxPresenter::VTable0x4c() return 0; } -// OFFSET: LEGO1 0x1000bfd0 STUB -undefined MxPresenter::VTable0x50() +// OFFSET: LEGO1 0x1000bfd0 +undefined MxPresenter::VTable0x50(undefined4, undefined4) { - // TODO - return 0; } diff --git a/LEGO1/mxpresenter.h b/LEGO1/mxpresenter.h index 6ea022da..a6616bd8 100644 --- a/LEGO1/mxpresenter.h +++ b/LEGO1/mxpresenter.h @@ -5,65 +5,64 @@ #include "mxcriticalsection.h" +#include "decomp.h" + class MxStreamController; class MxDSAction; -#ifndef undefined4 -#define undefined4 int -#endif - -#ifndef undefined -#define undefined int -#endif - class MxPresenter : public MxCore { public: + MxPresenter() { + Init(); + } __declspec(dllexport) virtual ~MxPresenter(); // vtable+0x0 // OFFSET: LEGO1 0x1000bfe0 - inline virtual const char *ClassName() const // vtable+0xc + inline virtual const char *ClassName() const override// vtable+0xc { // 0x100f0740 return "MxPresenter"; } // OFFSET: LEGO1 0x1000bff0 - inline virtual MxBool IsA(const char *name) const // vtable+0x10 + inline virtual MxBool IsA(const char *name) const override// vtable+0x10 { return !strcmp(name, MxPresenter::ClassName()) || MxCore::IsA(name); } - __declspec(dllexport) virtual long Tickle(); // vtable+0x8 + __declspec(dllexport) virtual long Tickle() override; // vtable+0x8 virtual void VTable0x14(); // vtable+0x14 virtual void VTable0x18(); // vtable+0x18 virtual void VTable0x1c(); // vtable+0x1c virtual void VTable0x20(); // vtable+0x20 virtual void VTable0x24(); // vtable+0x24 virtual void VTable0x28(); // vtable+0x28 - virtual undefined4 VTable0x34(); // vtable+0x34 - virtual void InitVirtual(); // vtable+0x38 - virtual void VTable0x44(undefined4 param); // vtable+0x44 - virtual undefined4 VTable0x48(undefined4 param); // vtable+0x48 - virtual undefined4 VTable0x4c(); // vtable+0x4c - virtual undefined VTable0x50(); // vtable+0x50 protected: __declspec(dllexport) virtual void DoneTickle(); // vtable+0x2c - __declspec(dllexport) void Init(); __declspec(dllexport) virtual void ParseExtra(); // vtable+0x30 public: + virtual undefined4 VTable0x34(); // vtable+0x34 + virtual void InitVirtual(); // vtable+0x38 __declspec(dllexport) virtual long StartAction(MxStreamController *, MxDSAction *); // vtable+0x3c __declspec(dllexport) virtual void EndAction(); // vtable+0x40 + virtual void VTable0x44(undefined4 param); // vtable+0x44 + virtual unsigned char VTable0x48(unsigned char param); // vtable+0x48 + virtual undefined4 VTable0x4c(); // vtable+0x4c + virtual undefined VTable0x50(undefined4, undefined4); // vtable+0x50 __declspec(dllexport) virtual void Enable(unsigned char); // vtable+0x54 +protected: + __declspec(dllexport) void Init(); +public: - int m_unk0x8; - int m_unk0xc; - int m_unk0x10; - int m_unk0x14; - int m_unk0x18; + undefined4 m_unk0x8; + undefined4 m_unk0xc; + undefined4 m_unk0x10; + undefined4 m_unk0x14; + undefined4 m_unk0x18; MxDSAction* m_action; // 0 MxCriticalSection m_criticalSection; - int m_unk0x3c; + undefined4 m_unk0x3c; // VTABLE 0x100d4d38 }; diff --git a/LEGO1/mxsmkpresenter.cpp b/LEGO1/mxsmkpresenter.cpp index 9f160a99..cc7efec1 100644 --- a/LEGO1/mxsmkpresenter.cpp +++ b/LEGO1/mxsmkpresenter.cpp @@ -1,5 +1,9 @@ #include "mxsmkpresenter.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxSmkPresenter, 0x720); + // OFFSET: LEGO1 0x100b3650 STUB MxSmkPresenter::MxSmkPresenter() { diff --git a/LEGO1/mxsmkpresenter.h b/LEGO1/mxsmkpresenter.h index b439bc2a..325091bb 100644 --- a/LEGO1/mxsmkpresenter.h +++ b/LEGO1/mxsmkpresenter.h @@ -3,16 +3,19 @@ #include "mxvideopresenter.h" +#include "decomp.h" + // VTABLE 0x100dc348 // SIZE 0x720 class MxSmkPresenter : public MxVideoPresenter { public: MxSmkPresenter(); - + + undefined4 m_unk64[430]; + undefined4 m_unk71c; private: void Init(); - }; #endif // MXSMKPRESENTER_H diff --git a/LEGO1/mxstillpresenter.cpp b/LEGO1/mxstillpresenter.cpp index bc2b03b5..351971f0 100644 --- a/LEGO1/mxstillpresenter.cpp +++ b/LEGO1/mxstillpresenter.cpp @@ -1 +1,5 @@ #include "mxstillpresenter.h" + +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxStillPresenter, 0x6c); diff --git a/LEGO1/mxstillpresenter.h b/LEGO1/mxstillpresenter.h index d9376b8e..9b7c5810 100644 --- a/LEGO1/mxstillpresenter.h +++ b/LEGO1/mxstillpresenter.h @@ -3,11 +3,18 @@ #include "mxvideopresenter.h" +#include "decomp.h" + // VTABLE 0x100d7a38 // SIZE 0x6c class MxStillPresenter : public MxVideoPresenter { public: + MxStillPresenter() { + m_unk68 = 0; + } + undefined4 m_unk64; + undefined4 m_unk68; }; #endif // MXSTILLPRESENTER_H diff --git a/LEGO1/mxvideopresenter.cpp b/LEGO1/mxvideopresenter.cpp index 894b1e9c..ee12968a 100644 --- a/LEGO1/mxvideopresenter.cpp +++ b/LEGO1/mxvideopresenter.cpp @@ -1 +1,8 @@ #include "mxvideopresenter.h" + +DECOMP_SIZE_ASSERT(MxVideoPresenter, 0x64); + +// OFFSET: LEGO1 0x100b2760 STUB +void MxVideoPresenter::Init() { + // TODO +} diff --git a/LEGO1/mxvideopresenter.h b/LEGO1/mxvideopresenter.h index eba5040c..e9634427 100644 --- a/LEGO1/mxvideopresenter.h +++ b/LEGO1/mxvideopresenter.h @@ -3,12 +3,17 @@ #include "mxmediapresenter.h" +#include "decomp.h" + class MxVideoPresenter : public MxMediaPresenter { public: + MxVideoPresenter() { + Init(); + } // OFFSET: LEGO1 0x1000c820 inline virtual const char *ClassName() const override // vtable+0x0c - { + { // 0x100f0760 return "MxVideoPresenter"; } @@ -18,6 +23,15 @@ class MxVideoPresenter : public MxMediaPresenter { return !strcmp(name, MxVideoPresenter::ClassName()) || MxMediaPresenter::IsA(name); } + + void Init(); + + undefined4 m_unk50; + undefined4 m_unk54; + undefined4 m_unk58; + short m_unk5c; + unsigned char m_flags; + int m_unk60; }; #endif // MXVIDEOPRESENTER_H diff --git a/LEGO1/mxwavepresenter.cpp b/LEGO1/mxwavepresenter.cpp index bfd69c5f..cba9106e 100644 --- a/LEGO1/mxwavepresenter.cpp +++ b/LEGO1/mxwavepresenter.cpp @@ -1,7 +1,18 @@ #include "mxwavepresenter.h" -// OFFSET: LEGO1 0x100b1ad0 STUB +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxWavePresenter, 0x6c); + +// OFFSET: LEGO1 0x100b1ad0 void MxWavePresenter::Init() { - // TODO + m_unk54 = 0; + m_unk58 = 0; + m_unk5c = 0; + m_unk60 = 0; + m_unk64 = 0; + m_unk65 = 0; + m_unk66 = 0; + m_unk68 = 0; } diff --git a/LEGO1/mxwavepresenter.h b/LEGO1/mxwavepresenter.h index c00d978d..a8a1de45 100644 --- a/LEGO1/mxwavepresenter.h +++ b/LEGO1/mxwavepresenter.h @@ -3,14 +3,28 @@ #include "mxsoundpresenter.h" +#include "decomp.h" + // VTABLE 0x100d49a8 // SIZE 0x6c class MxWavePresenter : public MxSoundPresenter { private: void Init(); - + public: + MxWavePresenter() { + Init(); + } + undefined4 m_unk54; + undefined4 m_unk58; + undefined4 m_unk5c; + undefined4 m_unk60; + undefined m_unk64; + undefined m_unk65; + undefined m_unk66; + undefined m_unk67; + undefined m_unk68; }; #endif // MXWAVEPRESENTER_H From b91c7d436babc48b812f6e2874072afc67ef52ea Mon Sep 17 00:00:00 2001 From: Kai Kaufman <92912278+ktkaufman03@users.noreply.github.com> Date: Sun, 2 Jul 2023 03:51:57 -0400 Subject: [PATCH 12/16] fix: MxDSFile::Open is now matching 100% (#69) --- LEGO1/mxdsfile.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/LEGO1/mxdsfile.cpp b/LEGO1/mxdsfile.cpp index 327fab46..3e587b07 100644 --- a/LEGO1/mxdsfile.cpp +++ b/LEGO1/mxdsfile.cpp @@ -23,16 +23,15 @@ MxDSFile::~MxDSFile() // 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. + MXIOINFO& io = m_io; long longResult = 1; - memset(&m_io, 0, sizeof(MXIOINFO)); + 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) { From 0555e0575658f64f4976f7b823d774c710d7ff01 Mon Sep 17 00:00:00 2001 From: Kai Kaufman <92912278+ktkaufman03@users.noreply.github.com> Date: Sun, 2 Jul 2023 04:02:05 -0400 Subject: [PATCH 13/16] fix: ConvertHSVToRGB is effectively 100% matching (#70) --- LEGO1/legoutil.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/LEGO1/legoutil.cpp b/LEGO1/legoutil.cpp index 58e11e8f..5ea567e8 100644 --- a/LEGO1/legoutil.cpp +++ b/LEGO1/legoutil.cpp @@ -9,10 +9,13 @@ void ConvertHSVToRGB(float h, float s, float v, float *r_out, float *b_out, floa 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; + calc = (v + 1.0) * s_dbl; if (calc <= 0.0) { *g_out = 0.0f; @@ -20,7 +23,7 @@ void ConvertHSVToRGB(float h, float s, float v, float *r_out, float *b_out, floa *r_out = 0.0f; return; } - p = s * 2.0 - calc; + p = s * 2.0f - calc; hue_index = h * 6.0; v9 = (h * 6.0 - (float)hue_index) * ((calc - p) / calc) * calc; v12 = p + v9; From e16249b6726eb649ad4684c8c980c214ade9107b Mon Sep 17 00:00:00 2001 From: MattKC <34096995+itsmattkc@users.noreply.github.com> Date: Sun, 2 Jul 2023 01:05:49 -0700 Subject: [PATCH 14/16] Define MxLong/MxULong (#71) * define MxLong/MxULong The "long" type has different sizes on different platforms, and this may cause issues. * use DWORD to match RegQueryValueExA arg --- ISLE/define.cpp | 2 +- ISLE/define.h | 3 ++- ISLE/isleapp.cpp | 6 +++--- ISLE/isleapp.h | 2 +- LEGO1/act2brick.cpp | 4 ++-- LEGO1/act2brick.h | 4 ++-- LEGO1/act2policestation.cpp | 2 +- LEGO1/act2policestation.h | 2 +- LEGO1/beachhouseentity.cpp | 2 +- LEGO1/beachhouseentity.h | 2 +- LEGO1/elevatorbottom.cpp | 2 +- LEGO1/elevatorbottom.h | 2 +- LEGO1/gasstation.cpp | 4 ++-- LEGO1/gasstation.h | 4 ++-- LEGO1/historybook.cpp | 2 +- LEGO1/historybook.h | 2 +- LEGO1/hospital.cpp | 2 +- LEGO1/hospital.h | 2 +- LEGO1/infocenter.cpp | 4 ++-- LEGO1/infocenter.h | 4 ++-- LEGO1/infocenterdoor.cpp | 2 +- LEGO1/infocenterdoor.h | 2 +- LEGO1/legoanimationmanager.cpp | 4 ++-- LEGO1/legoanimationmanager.h | 4 ++-- LEGO1/legocarbuild.cpp | 4 ++-- LEGO1/legocarbuild.h | 4 ++-- LEGO1/legocontrolmanager.cpp | 2 +- LEGO1/legocontrolmanager.h | 2 +- LEGO1/legoentity.cpp | 2 +- LEGO1/legoentity.h | 2 +- LEGO1/legogamestate.cpp | 4 ++-- LEGO1/legogamestate.h | 6 ++++-- LEGO1/legoinputmanager.cpp | 4 ++-- LEGO1/legoinputmanager.h | 4 ++-- LEGO1/legoomni.cpp | 10 +++++----- LEGO1/legoomni.h | 12 ++++++------ LEGO1/legopathcontroller.cpp | 2 +- LEGO1/legopathcontroller.h | 2 +- LEGO1/legoplantmanager.cpp | 2 +- LEGO1/legoplantmanager.h | 2 +- LEGO1/legorace.cpp | 2 +- LEGO1/legorace.h | 2 +- LEGO1/legosoundmanager.cpp | 2 +- LEGO1/legosoundmanager.h | 2 +- LEGO1/legoutil.cpp | 6 ++++-- LEGO1/mxbitmap.cpp | 2 +- LEGO1/mxbitmap.h | 2 +- LEGO1/mxcore.cpp | 4 ++-- LEGO1/mxcore.h | 4 ++-- LEGO1/mxdiskstreamcontroller.cpp | 2 +- LEGO1/mxdiskstreamcontroller.h | 2 +- LEGO1/mxdsfile.cpp | 20 ++++++++++---------- LEGO1/mxdsfile.h | 20 ++++++++++---------- LEGO1/mxdssource.cpp | 2 +- LEGO1/mxdssource.h | 18 +++++++++--------- LEGO1/mxioinfo.cpp | 4 ++-- LEGO1/mxioinfo.h | 7 ++++--- LEGO1/mxmediapresenter.cpp | 2 +- LEGO1/mxmediapresenter.h | 2 +- LEGO1/mxnotificationmanager.cpp | 2 +- LEGO1/mxnotificationmanager.h | 2 +- LEGO1/mxomni.cpp | 2 +- LEGO1/mxomni.h | 2 +- LEGO1/mxpresenter.cpp | 4 ++-- LEGO1/mxpresenter.h | 4 ++-- LEGO1/mxscheduler.cpp | 2 +- LEGO1/mxscheduler.h | 4 +++- LEGO1/mxstreamer.cpp | 4 ++-- LEGO1/mxstreamer.h | 4 ++-- LEGO1/mxticklemanager.h | 2 +- LEGO1/mxtimer.cpp | 10 +++++----- LEGO1/mxtimer.h | 10 +++++----- LEGO1/mxtransitionmanager.cpp | 2 +- LEGO1/mxtransitionmanager.h | 2 +- LEGO1/mxtypes.h | 21 +++++++++++++++++---- LEGO1/mxvideomanager.cpp | 4 ++-- LEGO1/mxvideomanager.h | 4 ++-- LEGO1/mxvideoparam.cpp | 2 +- LEGO1/mxvideoparam.h | 2 +- LEGO1/police.cpp | 2 +- LEGO1/police.h | 2 +- LEGO1/registrationbook.cpp | 2 +- LEGO1/registrationbook.h | 2 +- LEGO1/score.cpp | 2 +- LEGO1/score.h | 2 +- 85 files changed, 180 insertions(+), 159 deletions(-) diff --git a/ISLE/define.cpp b/ISLE/define.cpp index f236ea29..61de399e 100644 --- a/ISLE/define.cpp +++ b/ISLE/define.cpp @@ -37,4 +37,4 @@ int g_reqEnableRMDevice = 0; int g_startupDelay = 200; // 0x4101c0 -long g_lastFrameTime = 0; +MxLong g_lastFrameTime = 0; diff --git a/ISLE/define.h b/ISLE/define.h index ffc74654..ff2a4c2f 100644 --- a/ISLE/define.h +++ b/ISLE/define.h @@ -1,6 +1,7 @@ #ifndef DEFINE_H #define DEFINE_H +#include #include 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 diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 3697e816..a1836e8c 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -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; } diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index d31c6f42..a622697a 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -56,7 +56,7 @@ class IsleApp // 40 int m_islandTexture; int m_gameStarted; - long m_frameDelta; + MxLong m_frameDelta; // 4c MxVideoParam m_videoParam; diff --git a/LEGO1/act2brick.cpp b/LEGO1/act2brick.cpp index 4bb2f3f9..84c8bbb3 100644 --- a/LEGO1/act2brick.cpp +++ b/LEGO1/act2brick.cpp @@ -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 diff --git a/LEGO1/act2brick.h b/LEGO1/act2brick.h index fd10a997..bf909198 100644 --- a/LEGO1/act2brick.h +++ b/LEGO1/act2brick.h @@ -11,8 +11,8 @@ class Act2Brick : public LegoPathActor 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() const override // vtable+0x0c diff --git a/LEGO1/act2policestation.cpp b/LEGO1/act2policestation.cpp index 14f69db4..32c15e3e 100644 --- a/LEGO1/act2policestation.cpp +++ b/LEGO1/act2policestation.cpp @@ -1,7 +1,7 @@ #include "act2policestation.h" // OFFSET: LEGO1 0x1004e0e0 STUB -long Act2PoliceStation::Notify(MxParam &p) +MxLong Act2PoliceStation::Notify(MxParam &p) { // TODO diff --git a/LEGO1/act2policestation.h b/LEGO1/act2policestation.h index e935e252..7b0ea9c5 100644 --- a/LEGO1/act2policestation.h +++ b/LEGO1/act2policestation.h @@ -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 diff --git a/LEGO1/beachhouseentity.cpp b/LEGO1/beachhouseentity.cpp index 029e022f..4ccf5777 100644 --- a/LEGO1/beachhouseentity.cpp +++ b/LEGO1/beachhouseentity.cpp @@ -1,7 +1,7 @@ #include "beachhouseentity.h" // OFFSET: LEGO1 0x100150a0 STUB -long BeachHouseEntity::Notify(MxParam &p) +MxLong BeachHouseEntity::Notify(MxParam &p) { // TODO diff --git a/LEGO1/beachhouseentity.h b/LEGO1/beachhouseentity.h index 1749ff54..77555a81 100644 --- a/LEGO1/beachhouseentity.h +++ b/LEGO1/beachhouseentity.h @@ -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 diff --git a/LEGO1/elevatorbottom.cpp b/LEGO1/elevatorbottom.cpp index d216fe35..048ecbba 100644 --- a/LEGO1/elevatorbottom.cpp +++ b/LEGO1/elevatorbottom.cpp @@ -13,7 +13,7 @@ ElevatorBottom::~ElevatorBottom() } // OFFSET: LEGO1 0x10018150 STUB -long ElevatorBottom::Notify(MxParam &p) +MxLong ElevatorBottom::Notify(MxParam &p) { // TODO diff --git a/LEGO1/elevatorbottom.h b/LEGO1/elevatorbottom.h index 0d86080a..e6a56836 100644 --- a/LEGO1/elevatorbottom.h +++ b/LEGO1/elevatorbottom.h @@ -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 diff --git a/LEGO1/gasstation.cpp b/LEGO1/gasstation.cpp index d50ef317..33590dc9 100644 --- a/LEGO1/gasstation.cpp +++ b/LEGO1/gasstation.cpp @@ -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 diff --git a/LEGO1/gasstation.h b/LEGO1/gasstation.h index 9f22ca3f..7f2263d0 100644 --- a/LEGO1/gasstation.h +++ b/LEGO1/gasstation.h @@ -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 diff --git a/LEGO1/historybook.cpp b/LEGO1/historybook.cpp index 89c81315..1666cc9d 100644 --- a/LEGO1/historybook.cpp +++ b/LEGO1/historybook.cpp @@ -13,7 +13,7 @@ HistoryBook::~HistoryBook() } // OFFSET: LEGO1 0x10082680 STUB -long HistoryBook::Notify(MxParam &p) +MxLong HistoryBook::Notify(MxParam &p) { // TODO diff --git a/LEGO1/historybook.h b/LEGO1/historybook.h index bbdc6246..2fdcee78 100644 --- a/LEGO1/historybook.h +++ b/LEGO1/historybook.h @@ -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 diff --git a/LEGO1/hospital.cpp b/LEGO1/hospital.cpp index 2581cf34..9f84d7ce 100644 --- a/LEGO1/hospital.cpp +++ b/LEGO1/hospital.cpp @@ -13,7 +13,7 @@ Hospital::~Hospital() } // OFFSET: LEGO1 0x10074990 STUB -long Hospital::Notify(MxParam &p) +MxLong Hospital::Notify(MxParam &p) { // TODO diff --git a/LEGO1/hospital.h b/LEGO1/hospital.h index b14de205..bcce9823 100644 --- a/LEGO1/hospital.h +++ b/LEGO1/hospital.h @@ -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 diff --git a/LEGO1/infocenter.cpp b/LEGO1/infocenter.cpp index 1ad07ee4..b9ea67c6 100644 --- a/LEGO1/infocenter.cpp +++ b/LEGO1/infocenter.cpp @@ -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 diff --git a/LEGO1/infocenter.h b/LEGO1/infocenter.h index 49a71acb..a6e06f0f 100644 --- a/LEGO1/infocenter.h +++ b/LEGO1/infocenter.h @@ -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 diff --git a/LEGO1/infocenterdoor.cpp b/LEGO1/infocenterdoor.cpp index be57f96e..20e01771 100644 --- a/LEGO1/infocenterdoor.cpp +++ b/LEGO1/infocenterdoor.cpp @@ -13,7 +13,7 @@ InfocenterDoor::~InfocenterDoor() } // OFFSET: LEGO1 0x100379e0 STUB -long InfocenterDoor::Notify(MxParam &p) +MxLong InfocenterDoor::Notify(MxParam &p) { // TODO diff --git a/LEGO1/infocenterdoor.h b/LEGO1/infocenterdoor.h index 77a0c021..0692fbca 100644 --- a/LEGO1/infocenterdoor.h +++ b/LEGO1/infocenterdoor.h @@ -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 diff --git a/LEGO1/legoanimationmanager.cpp b/LEGO1/legoanimationmanager.cpp index c25aa436..d396d431 100644 --- a/LEGO1/legoanimationmanager.cpp +++ b/LEGO1/legoanimationmanager.cpp @@ -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 diff --git a/LEGO1/legoanimationmanager.h b/LEGO1/legoanimationmanager.h index c42b7715..49b95f94 100644 --- a/LEGO1/legoanimationmanager.h +++ b/LEGO1/legoanimationmanager.h @@ -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 diff --git a/LEGO1/legocarbuild.cpp b/LEGO1/legocarbuild.cpp index d96668e4..c9254c37 100644 --- a/LEGO1/legocarbuild.cpp +++ b/LEGO1/legocarbuild.cpp @@ -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 diff --git a/LEGO1/legocarbuild.h b/LEGO1/legocarbuild.h index 10396c9e..d320cd6e 100644 --- a/LEGO1/legocarbuild.h +++ b/LEGO1/legocarbuild.h @@ -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 diff --git a/LEGO1/legocontrolmanager.cpp b/LEGO1/legocontrolmanager.cpp index 0959df9c..16733e13 100644 --- a/LEGO1/legocontrolmanager.cpp +++ b/LEGO1/legocontrolmanager.cpp @@ -13,7 +13,7 @@ LegoControlManager::~LegoControlManager() } // OFFSET: LEGO1 0x10029600 STUB -long LegoControlManager::Tickle() +MxLong LegoControlManager::Tickle() { // TODO diff --git a/LEGO1/legocontrolmanager.h b/LEGO1/legocontrolmanager.h index d3e183fd..c4563776 100644 --- a/LEGO1/legocontrolmanager.h +++ b/LEGO1/legocontrolmanager.h @@ -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 diff --git a/LEGO1/legoentity.cpp b/LEGO1/legoentity.cpp index fe500cb7..b79bc587 100644 --- a/LEGO1/legoentity.cpp +++ b/LEGO1/legoentity.cpp @@ -7,7 +7,7 @@ LegoEntity::~LegoEntity() } // OFFSET: LEGO1 0x100114f0 STUB -long LegoEntity::Notify(MxParam &p) +MxLong LegoEntity::Notify(MxParam &p) { // TODO diff --git a/LEGO1/legoentity.h b/LEGO1/legoentity.h index 774b19f2..46aea940 100644 --- a/LEGO1/legoentity.h +++ b/LEGO1/legoentity.h @@ -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 diff --git a/LEGO1/legogamestate.cpp b/LEGO1/legogamestate.cpp index 473003a7..66873f12 100644 --- a/LEGO1/legogamestate.cpp +++ b/LEGO1/legogamestate.cpp @@ -13,14 +13,14 @@ 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; diff --git a/LEGO1/legogamestate.h b/LEGO1/legogamestate.h index 239719eb..fdd5bcb1 100644 --- a/LEGO1/legogamestate.h +++ b/LEGO1/legogamestate.h @@ -1,13 +1,15 @@ #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) MxResult Load(MxULong); + __declspec(dllexport) MxResult Save(MxULong p); __declspec(dllexport) void SerializePlayersInfo(short p); __declspec(dllexport) void SerializeScoreHistory(short p); __declspec(dllexport) void SetSavePath(char *p); diff --git a/LEGO1/legoinputmanager.cpp b/LEGO1/legoinputmanager.cpp index 6c0bd709..90be0c2c 100644 --- a/LEGO1/legoinputmanager.cpp +++ b/LEGO1/legoinputmanager.cpp @@ -17,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 } @@ -35,7 +35,7 @@ void LegoInputManager::UnRegister(MxCore *) } // OFFSET: LEGO1 0x1005b8b0 STUB -long LegoInputManager::Tickle() +MxLong LegoInputManager::Tickle() { // TODO diff --git a/LEGO1/legoinputmanager.h b/LEGO1/legoinputmanager.h index 74a2a8fa..7ae2dd62 100644 --- a/LEGO1/legoinputmanager.h +++ b/LEGO1/legoinputmanager.h @@ -22,11 +22,11 @@ class LegoInputManager : public MxPresenter 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 undefined m_pad40[0x15c]; int m_joystickIndex; diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index 45f7a9f7..32fb4d7f 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -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; @@ -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; diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 512fba41..9c8df71f 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -28,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(); @@ -36,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 @@ -101,14 +101,14 @@ __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(); diff --git a/LEGO1/legopathcontroller.cpp b/LEGO1/legopathcontroller.cpp index 46e23f5e..0cebbc0f 100644 --- a/LEGO1/legopathcontroller.cpp +++ b/LEGO1/legopathcontroller.cpp @@ -13,7 +13,7 @@ LegoPathController::~LegoPathController() } // OFFSET: LEGO1 0x10045c10 STUB -long LegoPathController::Tickle() +MxLong LegoPathController::Tickle() { // TODO return 0; diff --git a/LEGO1/legopathcontroller.h b/LEGO1/legopathcontroller.h index 9686b2bd..ba415076 100644 --- a/LEGO1/legopathcontroller.h +++ b/LEGO1/legopathcontroller.h @@ -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 diff --git a/LEGO1/legoplantmanager.cpp b/LEGO1/legoplantmanager.cpp index 8f67b939..eee83726 100644 --- a/LEGO1/legoplantmanager.cpp +++ b/LEGO1/legoplantmanager.cpp @@ -13,7 +13,7 @@ LegoPlantManager::~LegoPlantManager() } // OFFSET: LEGO1 0x10026e00 STUB -long LegoPlantManager::Tickle() +MxLong LegoPlantManager::Tickle() { // TODO diff --git a/LEGO1/legoplantmanager.h b/LEGO1/legoplantmanager.h index 272fb451..3e8bfefe 100644 --- a/LEGO1/legoplantmanager.h +++ b/LEGO1/legoplantmanager.h @@ -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 diff --git a/LEGO1/legorace.cpp b/LEGO1/legorace.cpp index 888b1fe1..2b2e3390 100644 --- a/LEGO1/legorace.cpp +++ b/LEGO1/legorace.cpp @@ -13,7 +13,7 @@ LegoRace::~LegoRace() } // OFFSET: LEGO1 0x10015e00 STUB -long LegoRace::Notify(MxParam &p) +MxLong LegoRace::Notify(MxParam &p) { // TODO diff --git a/LEGO1/legorace.h b/LEGO1/legorace.h index 003e57ed..26c88b9b 100644 --- a/LEGO1/legorace.h +++ b/LEGO1/legorace.h @@ -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 diff --git a/LEGO1/legosoundmanager.cpp b/LEGO1/legosoundmanager.cpp index 518b8c55..e56747f6 100644 --- a/LEGO1/legosoundmanager.cpp +++ b/LEGO1/legosoundmanager.cpp @@ -13,7 +13,7 @@ LegoSoundManager::~LegoSoundManager() } // OFFSET: LEGO1 0x1002a3a0 STUB -long LegoSoundManager::Tickle() +MxLong LegoSoundManager::Tickle() { // TODO return 0; diff --git a/LEGO1/legosoundmanager.h b/LEGO1/legosoundmanager.h index 9b1e6450..1d191e03 100644 --- a/LEGO1/legosoundmanager.h +++ b/LEGO1/legosoundmanager.h @@ -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(); diff --git a/LEGO1/legoutil.cpp b/LEGO1/legoutil.cpp index 5ea567e8..bac8f284 100644 --- a/LEGO1/legoutil.cpp +++ b/LEGO1/legoutil.cpp @@ -1,11 +1,13 @@ #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; - long hue_index; + MxLong hue_index; double v9; double v12; double v13; @@ -68,4 +70,4 @@ void ConvertHSVToRGB(float h, float s, float v, float *r_out, float *b_out, floa default: return; } -} \ No newline at end of file +} diff --git a/LEGO1/mxbitmap.cpp b/LEGO1/mxbitmap.cpp index 2ccdd80b..6ad26f94 100644 --- a/LEGO1/mxbitmap.cpp +++ b/LEGO1/mxbitmap.cpp @@ -47,7 +47,7 @@ MxResult MxBitmap::LoadFile(HANDLE p_handle) } // OFFSET: LEGO1 0x100bcd10 -long MxBitmap::Read(const char *p_filename) +MxLong MxBitmap::Read(const char *p_filename) { MxResult result = FAILURE; HANDLE handle = CreateFileA( diff --git a/LEGO1/mxbitmap.h b/LEGO1/mxbitmap.h index e16fcb0e..66550f7e 100644 --- a/LEGO1/mxbitmap.h +++ b/LEGO1/mxbitmap.h @@ -17,7 +17,7 @@ class MxBitmap : public MxCore 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 long Read(const char *p_filename); // vtable+24 + __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); diff --git a/LEGO1/mxcore.cpp b/LEGO1/mxcore.cpp index aec24c00..78441d8d 100644 --- a/LEGO1/mxcore.cpp +++ b/LEGO1/mxcore.cpp @@ -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; } \ No newline at end of file diff --git a/LEGO1/mxcore.h b/LEGO1/mxcore.h index 446ee91e..5e6586ba 100644 --- a/LEGO1/mxcore.h +++ b/LEGO1/mxcore.h @@ -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 diff --git a/LEGO1/mxdiskstreamcontroller.cpp b/LEGO1/mxdiskstreamcontroller.cpp index c178c0a5..61243410 100644 --- a/LEGO1/mxdiskstreamcontroller.cpp +++ b/LEGO1/mxdiskstreamcontroller.cpp @@ -13,7 +13,7 @@ MxDiskStreamController::~MxDiskStreamController() } // OFFSET: LEGO1 0x100c8640 STUB -long MxDiskStreamController::Tickle() +MxLong MxDiskStreamController::Tickle() { // TODO diff --git a/LEGO1/mxdiskstreamcontroller.h b/LEGO1/mxdiskstreamcontroller.h index 773f6b85..c0142663 100644 --- a/LEGO1/mxdiskstreamcontroller.h +++ b/LEGO1/mxdiskstreamcontroller.h @@ -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 diff --git a/LEGO1/mxdsfile.cpp b/LEGO1/mxdsfile.cpp index 3e587b07..60f8533e 100644 --- a/LEGO1/mxdsfile.cpp +++ b/LEGO1/mxdsfile.cpp @@ -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,10 +21,10 @@ MxDSFile::~MxDSFile() } // OFFSET: LEGO1 0x100cc590 -long MxDSFile::Open(unsigned long uStyle) +MxLong MxDSFile::Open(MxULong uStyle) { MXIOINFO& io = m_io; - long longResult = 1; + MxLong longResult = 1; memset(&io, 0, sizeof(MXIOINFO)); if (io.Open(m_filename.GetData(), uStyle) != 0) { @@ -49,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; @@ -59,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; @@ -81,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); @@ -96,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; diff --git a/LEGO1/mxdsfile.h b/LEGO1/mxdsfile.h index 8e136984..ae44ff46 100644 --- a/LEGO1/mxdsfile.h +++ b/LEGO1/mxdsfile.h @@ -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) @@ -43,7 +43,7 @@ class MxDSFile : public MxDSSource unsigned short majorVersion; unsigned short minorVersion; - unsigned long bufferSize; + MxULong bufferSize; short streamBuffersNum; short reserved; }; @@ -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 diff --git a/LEGO1/mxdssource.cpp b/LEGO1/mxdssource.cpp index 8612c5c4..9a94f110 100644 --- a/LEGO1/mxdssource.cpp +++ b/LEGO1/mxdssource.cpp @@ -8,7 +8,7 @@ void MxDSSource::SomethingWhichCallsRead(void* pUnknownObject) } // OFFSET: LEGO1 0x100bfff0 -long MxDSSource::GetLengthInDWords() +MxLong MxDSSource::GetLengthInDWords() { return m_lengthInDWords; } \ No newline at end of file diff --git a/LEGO1/mxdssource.h b/LEGO1/mxdssource.h index 2837e7c2..5ff4c33c 100644 --- a/LEGO1/mxdssource.h +++ b/LEGO1/mxdssource.h @@ -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 diff --git a/LEGO1/mxioinfo.cpp b/LEGO1/mxioinfo.cpp index ebe2a480..d95a00ef 100644 --- a/LEGO1/mxioinfo.cpp +++ b/LEGO1/mxioinfo.cpp @@ -19,13 +19,13 @@ unsigned short MXIOINFO::Open(const char *filename, DWORD fdwOpen) } // 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; } diff --git a/LEGO1/mxioinfo.h b/LEGO1/mxioinfo.h index c88a55b9..9556e5df 100644 --- a/LEGO1/mxioinfo.h +++ b/LEGO1/mxioinfo.h @@ -2,8 +2,9 @@ #define MXIOINFO_H #include +#include -#include "mmsystem.h" +#include "mxtypes.h" class MXIOINFO { @@ -12,9 +13,9 @@ class MXIOINFO __declspec(dllexport) ~MXIOINFO(); unsigned short Open(const char *filename, DWORD fdwOpen); - void Close(long arg); + 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); diff --git a/LEGO1/mxmediapresenter.cpp b/LEGO1/mxmediapresenter.cpp index 9df33285..58c068ac 100644 --- a/LEGO1/mxmediapresenter.cpp +++ b/LEGO1/mxmediapresenter.cpp @@ -3,7 +3,7 @@ DECOMP_SIZE_ASSERT(MxMediaPresenter, 0x50); // OFFSET: LEGO1 0x100b5d10 STUB -long MxMediaPresenter::Tickle() +MxLong MxMediaPresenter::Tickle() { // TODO return 0; diff --git a/LEGO1/mxmediapresenter.h b/LEGO1/mxmediapresenter.h index b3a1b38a..64de0614 100644 --- a/LEGO1/mxmediapresenter.h +++ b/LEGO1/mxmediapresenter.h @@ -14,7 +14,7 @@ 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 *ClassName() const override // vtable+0xc diff --git a/LEGO1/mxnotificationmanager.cpp b/LEGO1/mxnotificationmanager.cpp index 8ce1f98b..472c87b5 100644 --- a/LEGO1/mxnotificationmanager.cpp +++ b/LEGO1/mxnotificationmanager.cpp @@ -7,7 +7,7 @@ MxNotificationManager::~MxNotificationManager() } // OFFSET: LEGO1 0x100ac800 STUB -long MxNotificationManager::Tickle() +MxLong MxNotificationManager::Tickle() { // TODO diff --git a/LEGO1/mxnotificationmanager.h b/LEGO1/mxnotificationmanager.h index e350ba56..86cb4f00 100644 --- a/LEGO1/mxnotificationmanager.h +++ b/LEGO1/mxnotificationmanager.h @@ -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 }; diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index 76287b82..10e8eccb 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -123,7 +123,7 @@ void MxOmni::Destroy() } // OFFSET: LEGO1 0x100b07f0 -long MxOmni::Notify(MxParam &p) +MxLong MxOmni::Notify(MxParam &p) { // FIXME: Stub return 0; diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index dee03229..f3f1ee9a 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -32,7 +32,7 @@ class MxOmni : public MxCore MxOmni(); virtual ~MxOmni() override; - virtual long Notify(MxParam &p); // vtable+04 + virtual MxLong Notify(MxParam &p); // vtable+04 virtual void Init(); // vtable+14 virtual MxResult Create(MxOmniCreateParam &p); // vtable+18 virtual void Destroy(); // vtable+1c diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index 5ef01c64..4629fdba 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -34,7 +34,7 @@ MxPresenter::~MxPresenter() } // OFFSET: LEGO1 0x100b5200 STUB -long MxPresenter::Tickle() +MxLong MxPresenter::Tickle() { // TODO @@ -42,7 +42,7 @@ long MxPresenter::Tickle() } // OFFSET: LEGO1 0x100b4d80 STUB -long MxPresenter::StartAction(MxStreamController *, MxDSAction *) +MxLong MxPresenter::StartAction(MxStreamController *, MxDSAction *) { // TODO diff --git a/LEGO1/mxpresenter.h b/LEGO1/mxpresenter.h index a6616bd8..e01100c1 100644 --- a/LEGO1/mxpresenter.h +++ b/LEGO1/mxpresenter.h @@ -31,7 +31,7 @@ class MxPresenter : public MxCore return !strcmp(name, MxPresenter::ClassName()) || MxCore::IsA(name); } - __declspec(dllexport) virtual long Tickle() override; // vtable+0x8 + __declspec(dllexport) virtual MxLong Tickle() override; // vtable+0x8 virtual void VTable0x14(); // vtable+0x14 virtual void VTable0x18(); // vtable+0x18 virtual void VTable0x1c(); // vtable+0x1c @@ -44,7 +44,7 @@ class MxPresenter : public MxCore public: virtual undefined4 VTable0x34(); // vtable+0x34 virtual void InitVirtual(); // vtable+0x38 - __declspec(dllexport) virtual long StartAction(MxStreamController *, MxDSAction *); // vtable+0x3c + __declspec(dllexport) virtual MxLong StartAction(MxStreamController *, MxDSAction *); // vtable+0x3c __declspec(dllexport) virtual void EndAction(); // vtable+0x40 virtual void VTable0x44(undefined4 param); // vtable+0x44 virtual unsigned char VTable0x48(unsigned char param); // vtable+0x48 diff --git a/LEGO1/mxscheduler.cpp b/LEGO1/mxscheduler.cpp index 94228303..08bcd04c 100644 --- a/LEGO1/mxscheduler.cpp +++ b/LEGO1/mxscheduler.cpp @@ -8,7 +8,7 @@ MxScheduler *MxScheduler::GetInstance() } // OFFSET: LEGO1 0x100bf500 -void MxScheduler::StartMultiTasking(unsigned long) +void MxScheduler::StartMultiTasking(MxULong) { // Intentionally empty } diff --git a/LEGO1/mxscheduler.h b/LEGO1/mxscheduler.h index 4f7ee387..fabb33dc 100644 --- a/LEGO1/mxscheduler.h +++ b/LEGO1/mxscheduler.h @@ -1,11 +1,13 @@ #ifndef MXSCHEDULER_H #define MXSCHEDULER_H +#include "mxtypes.h" + class MxScheduler { public: __declspec(dllexport) static MxScheduler *GetInstance(); - __declspec(dllexport) void StartMultiTasking(unsigned long); + __declspec(dllexport) void StartMultiTasking(MxULong); }; #endif // MXSCHEDULER_H diff --git a/LEGO1/mxstreamer.cpp b/LEGO1/mxstreamer.cpp index 57c9a5b8..3f377151 100644 --- a/LEGO1/mxstreamer.cpp +++ b/LEGO1/mxstreamer.cpp @@ -14,14 +14,14 @@ MxStreamController *MxStreamer::Open(const char *name, unsigned short p) } // OFFSET: LEGO1 0x100b9570 STUB -long MxStreamer::Close(const char *p) +MxLong MxStreamer::Close(const char *p) { // TODO return 0; } // OFFSET: LEGO1 0x100b9b60 STUB -long MxStreamer::Notify(MxParam &p) +MxLong MxStreamer::Notify(MxParam &p) { // TODO diff --git a/LEGO1/mxstreamer.h b/LEGO1/mxstreamer.h index de84ed01..36f1a30f 100644 --- a/LEGO1/mxstreamer.h +++ b/LEGO1/mxstreamer.h @@ -12,9 +12,9 @@ class MxStreamer : public MxCore virtual ~MxStreamer() override; __declspec(dllexport) MxStreamController *Open(const char *name, unsigned short p); - __declspec(dllexport) long Close(const char *p); + __declspec(dllexport) MxLong Close(const char *p); - virtual long Notify(MxParam &p) override; // vtable+0x4 + virtual MxLong Notify(MxParam &p) override; // vtable+0x4 virtual MxResult VTable0x14(); // vtable+0x14 }; diff --git a/LEGO1/mxticklemanager.h b/LEGO1/mxticklemanager.h index 7ef50622..60f2f14d 100644 --- a/LEGO1/mxticklemanager.h +++ b/LEGO1/mxticklemanager.h @@ -9,7 +9,7 @@ class MxTickleManager : public MxCore public: virtual ~MxTickleManager(); - virtual long Tickle(); + virtual MxLong Tickle(); virtual const char *ClassName() const; virtual MxBool IsA(const char *name) const; virtual void vtable14(); diff --git a/LEGO1/mxtimer.cpp b/LEGO1/mxtimer.cpp index 47afaa03..0d5752d6 100644 --- a/LEGO1/mxtimer.cpp +++ b/LEGO1/mxtimer.cpp @@ -3,10 +3,10 @@ #include // 0x10101414 -long MxTimer::s_LastTimeCalculated = 0; +MxLong MxTimer::s_LastTimeCalculated = 0; // 0x10101418 -long MxTimer::s_LastTimeTimerStarted = 0; +MxLong MxTimer::s_LastTimeTimerStarted = 0; // OFFSET: LEGO1 0x100ae060 MxTimer::MxTimer() @@ -27,15 +27,15 @@ void MxTimer::Start() // OFFSET: LEGO1 0x100ae180 void MxTimer::Stop() { - long elapsed = this->GetRealTime(); - long startTime = elapsed - MxTimer::s_LastTimeTimerStarted; + MxLong elapsed = this->GetRealTime(); + MxLong startTime = elapsed - MxTimer::s_LastTimeTimerStarted; this->m_isRunning = FALSE; // this feels very stupid but it's what the assembly does this->m_startTime = this->m_startTime + startTime - 5; } // OFFSET: LEGO1 0x100ae140 -long MxTimer::GetRealTime() +MxLong MxTimer::GetRealTime() { MxTimer::s_LastTimeCalculated = timeGetTime(); return MxTimer::s_LastTimeCalculated - this->m_startTime; diff --git a/LEGO1/mxtimer.h b/LEGO1/mxtimer.h index 564eedfa..1714e8e1 100644 --- a/LEGO1/mxtimer.h +++ b/LEGO1/mxtimer.h @@ -13,9 +13,9 @@ class MxTimer : public MxCore void Start(); void Stop(); - __declspec(dllexport) long GetRealTime(); + __declspec(dllexport) MxLong GetRealTime(); - inline long GetTime() + inline MxLong GetTime() { if (this->m_isRunning) return s_LastTimeCalculated; @@ -24,10 +24,10 @@ class MxTimer : public MxCore } private: - long m_startTime; + MxLong m_startTime; MxBool m_isRunning; - static long s_LastTimeCalculated; - static long s_LastTimeTimerStarted; + static MxLong s_LastTimeCalculated; + static MxLong s_LastTimeTimerStarted; }; #endif // MXTIMER_H diff --git a/LEGO1/mxtransitionmanager.cpp b/LEGO1/mxtransitionmanager.cpp index b9631629..8af3f497 100644 --- a/LEGO1/mxtransitionmanager.cpp +++ b/LEGO1/mxtransitionmanager.cpp @@ -13,7 +13,7 @@ MxTransitionManager::~MxTransitionManager() } // OFFSET: LEGO1 0x1004bac0 STUB -long MxTransitionManager::Tickle() +MxLong MxTransitionManager::Tickle() { // TODO diff --git a/LEGO1/mxtransitionmanager.h b/LEGO1/mxtransitionmanager.h index 9dcb7f7c..c6cc28aa 100644 --- a/LEGO1/mxtransitionmanager.h +++ b/LEGO1/mxtransitionmanager.h @@ -14,7 +14,7 @@ class MxTransitionManager : public MxCore __declspec(dllexport) void SetWaitIndicator(MxVideoPresenter *videoPresenter); - virtual long Tickle(); // vtable+0x8 + virtual MxLong Tickle(); // vtable+0x8 }; #endif // MXTRANSITIONMANAGER_H diff --git a/LEGO1/mxtypes.h b/LEGO1/mxtypes.h index 71421d91..bcc401b2 100644 --- a/LEGO1/mxtypes.h +++ b/LEGO1/mxtypes.h @@ -8,11 +8,24 @@ typedef short MxS16; typedef unsigned int MxU32; typedef int MxS32; -typedef unsigned long MxResult; -const MxResult SUCCESS = 0; -const MxResult FAILURE = 0xFFFFFFFFL; +// On MSVC, a long is 32-bit, but on GCC/Clang, it's 64-bit. LEGO Island obviously +// assumes the former in all cases, which could become an issue in the future. +// The "longs" can't all be changed to "ints" (which are 32-bit on both) because +// this will break DLL export compatibility. Therefore, we define MxLong/MxULong, +// which is guaranteed to be 32-bit, and guaranteed to be a "long" on MSVC. +#if defined(_MSC_VER) +typedef long MxLong; +typedef unsigned long MxULong; +#else +typedef int MxLong; +typedef unsigned int MxULong; +#endif -typedef unsigned char MxBool; +typedef MxLong MxResult; +const MxResult SUCCESS = 0; +const MxResult FAILURE = -1; + +typedef MxU8 MxBool; #ifndef TRUE #define TRUE 1 diff --git a/LEGO1/mxvideomanager.cpp b/LEGO1/mxvideomanager.cpp index 178bc883..543f4136 100644 --- a/LEGO1/mxvideomanager.cpp +++ b/LEGO1/mxvideomanager.cpp @@ -7,7 +7,7 @@ MxVideoManager::~MxVideoManager() } // OFFSET: LEGO1 0x100bea90 STUB -long MxVideoManager::Tickle() +MxLong MxVideoManager::Tickle() { // TODO @@ -39,7 +39,7 @@ void MxVideoManager::InvalidateRect(MxRect32 &p_rect) } // OFFSET: LEGO1 0x100bebe0 -long MxVideoManager::RealizePalette(MxPalette *p_palette) +MxLong MxVideoManager::RealizePalette(MxPalette *p_palette) { PALETTEENTRY paletteEntries[256]; diff --git a/LEGO1/mxvideomanager.h b/LEGO1/mxvideomanager.h index d8e0c7bd..f70bf06e 100644 --- a/LEGO1/mxvideomanager.h +++ b/LEGO1/mxvideomanager.h @@ -11,10 +11,10 @@ class MxVideoManager : public MxUnknown100dc6b0 public: virtual ~MxVideoManager(); - virtual long Tickle(); // vtable+0x8 + virtual MxLong Tickle(); // vtable+0x8 __declspec(dllexport) void InvalidateRect(MxRect32 &); - __declspec(dllexport) virtual long RealizePalette(MxPalette *); // vtable+0x30 + __declspec(dllexport) virtual MxLong RealizePalette(MxPalette *); // vtable+0x30 MxVideoManager(); diff --git a/LEGO1/mxvideoparam.cpp b/LEGO1/mxvideoparam.cpp index 81f5d2d7..6f74f7a9 100644 --- a/LEGO1/mxvideoparam.cpp +++ b/LEGO1/mxvideoparam.cpp @@ -17,7 +17,7 @@ MxVideoParam::MxVideoParam() } // OFFSET: LEGO1 0x100beca0 -MxVideoParam::MxVideoParam(COMPAT_CONST MxRect32 &p_rect, MxPalette *p_pal, unsigned long p_backBuffers, COMPAT_CONST MxVideoParamFlags &p_flags) +MxVideoParam::MxVideoParam(COMPAT_CONST MxRect32 &p_rect, MxPalette *p_pal, MxULong p_backBuffers, COMPAT_CONST MxVideoParamFlags &p_flags) { this->m_rect.m_left = p_rect.m_left; this->m_rect.m_top = p_rect.m_top; diff --git a/LEGO1/mxvideoparam.h b/LEGO1/mxvideoparam.h index 0b6b2a38..2376e5db 100644 --- a/LEGO1/mxvideoparam.h +++ b/LEGO1/mxvideoparam.h @@ -15,7 +15,7 @@ class MxVideoParam public: __declspec(dllexport) MxVideoParam(); __declspec(dllexport) MxVideoParam(MxVideoParam &); - __declspec(dllexport) MxVideoParam(COMPAT_CONST MxRect32 &rect, MxPalette *pal, unsigned long p3, COMPAT_CONST MxVideoParamFlags &flags); + __declspec(dllexport) MxVideoParam(COMPAT_CONST MxRect32 &rect, MxPalette *pal, MxULong p3, COMPAT_CONST MxVideoParamFlags &flags); __declspec(dllexport) MxVideoParam &operator=(const MxVideoParam &); __declspec(dllexport) ~MxVideoParam(); diff --git a/LEGO1/police.cpp b/LEGO1/police.cpp index bd268411..37f10295 100644 --- a/LEGO1/police.cpp +++ b/LEGO1/police.cpp @@ -13,7 +13,7 @@ Police::~Police() } // OFFSET: LEGO1 0x1005e480 STUB -long Police::Notify(MxParam &p) +MxLong Police::Notify(MxParam &p) { // TODO diff --git a/LEGO1/police.h b/LEGO1/police.h index c4bea1cf..8ff6dff9 100644 --- a/LEGO1/police.h +++ b/LEGO1/police.h @@ -12,7 +12,7 @@ class Police : public LegoWorld Police(); virtual ~Police() override; // vtable+0x0 - virtual long Notify(MxParam &p) override; // vtable+0x4 + virtual MxLong Notify(MxParam &p) override; // vtable+0x4 }; diff --git a/LEGO1/registrationbook.cpp b/LEGO1/registrationbook.cpp index 5668d31c..dc03a327 100644 --- a/LEGO1/registrationbook.cpp +++ b/LEGO1/registrationbook.cpp @@ -13,7 +13,7 @@ RegistrationBook::~RegistrationBook() } // OFFSET: LEGO1 0x100770e0 STUB -long RegistrationBook::Notify(MxParam &p) +MxLong RegistrationBook::Notify(MxParam &p) { // TODO diff --git a/LEGO1/registrationbook.h b/LEGO1/registrationbook.h index 4dba2173..a8219569 100644 --- a/LEGO1/registrationbook.h +++ b/LEGO1/registrationbook.h @@ -11,7 +11,7 @@ class RegistrationBook : public LegoWorld RegistrationBook(); virtual ~RegistrationBook() override; // vtable+0x0 - virtual long Notify(MxParam &p) override; // vtable+0x4 + virtual MxLong Notify(MxParam &p) override; // vtable+0x4 }; diff --git a/LEGO1/score.cpp b/LEGO1/score.cpp index 4e3c7801..fc4070f7 100644 --- a/LEGO1/score.cpp +++ b/LEGO1/score.cpp @@ -13,7 +13,7 @@ Score::~Score() } // OFFSET: LEGO1 0x10001410 STUB -long Score::Notify(MxParam &p) +MxLong Score::Notify(MxParam &p) { // TODO diff --git a/LEGO1/score.h b/LEGO1/score.h index d2a7a7f6..e103b4bc 100644 --- a/LEGO1/score.h +++ b/LEGO1/score.h @@ -11,7 +11,7 @@ class Score : public LegoWorld Score(); virtual ~Score() override; // vtable+0x0 - virtual long Notify(MxParam &p) override; // vtable+0x4 + virtual MxLong Notify(MxParam &p) override; // vtable+0x4 }; From 5d099115fee55f14fe8364adf4866d6fe2147caf Mon Sep 17 00:00:00 2001 From: MattKC <34096995+itsmattkc@users.noreply.github.com> Date: Sun, 2 Jul 2023 01:11:49 -0700 Subject: [PATCH 15/16] Update CONTRIBUTING.md [skip ci] --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5633e7c6..c9d3364a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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? From 8fa45bbe0f4d1242fdb71846cd11a72de2ca0430 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sun, 2 Jul 2023 02:07:11 -0700 Subject: [PATCH 16/16] replace shorts with MxS16/MxU16/undefined2 --- LEGO1/legogamestate.cpp | 4 ++-- LEGO1/legogamestate.h | 4 ++-- LEGO1/legoomni.cpp | 2 +- LEGO1/legoomni.h | 2 +- LEGO1/mxdsfile.h | 8 ++++---- LEGO1/mxdsobject.cpp | 2 +- LEGO1/mxdsobject.h | 10 +++++----- LEGO1/mxioinfo.cpp | 6 +++--- LEGO1/mxioinfo.h | 4 ++-- LEGO1/mxstreamer.cpp | 2 +- LEGO1/mxstreamer.h | 2 +- LEGO1/mxstring.h | 2 +- LEGO1/mxvideopresenter.cpp | 3 ++- LEGO1/mxvideopresenter.h | 8 +++++--- 14 files changed, 31 insertions(+), 28 deletions(-) diff --git a/LEGO1/legogamestate.cpp b/LEGO1/legogamestate.cpp index 66873f12..c12a5e06 100644 --- a/LEGO1/legogamestate.cpp +++ b/LEGO1/legogamestate.cpp @@ -27,13 +27,13 @@ MxResult LegoGameState::Save(MxULong p) } // 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 } diff --git a/LEGO1/legogamestate.h b/LEGO1/legogamestate.h index fdd5bcb1..80437051 100644 --- a/LEGO1/legogamestate.h +++ b/LEGO1/legogamestate.h @@ -10,8 +10,8 @@ class LegoGameState __declspec(dllexport) ~LegoGameState(); __declspec(dllexport) MxResult Load(MxULong); __declspec(dllexport) MxResult Save(MxULong p); - __declspec(dllexport) void SerializePlayersInfo(short p); - __declspec(dllexport) void SerializeScoreHistory(short p); + __declspec(dllexport) void SerializePlayersInfo(MxS16 p); + __declspec(dllexport) void SerializeScoreHistory(MxS16 p); __declspec(dllexport) void SetSavePath(char *p); }; diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index 32fb4d7f..b5cbca8e 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -112,7 +112,7 @@ MxBackgroundAudioManager *BackgroundAudioManager() } // OFFSET: LEGO1 0x100c0280 STUB -MxDSObject *CreateStreamObject(MxDSFile *,short) +MxDSObject *CreateStreamObject(MxDSFile *,MxS16) { // TODO return NULL; diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 9c8df71f..0ba27cf2 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -95,7 +95,7 @@ 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(); diff --git a/LEGO1/mxdsfile.h b/LEGO1/mxdsfile.h index ae44ff46..ac812df7 100644 --- a/LEGO1/mxdsfile.h +++ b/LEGO1/mxdsfile.h @@ -41,11 +41,11 @@ class MxDSFile : public MxDSSource , streamBuffersNum(0) {} - unsigned short majorVersion; - unsigned short minorVersion; + MxU16 majorVersion; + MxU16 minorVersion; MxULong bufferSize; - short streamBuffersNum; - short reserved; + MxS16 streamBuffersNum; + MxS16 reserved; }; MxString m_filename; diff --git a/LEGO1/mxdsobject.cpp b/LEGO1/mxdsobject.cpp index 66b1ed6c..abe8902f 100644 --- a/LEGO1/mxdsobject.cpp +++ b/LEGO1/mxdsobject.cpp @@ -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; diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index ef4701bc..ff7d4a02 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -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; }; diff --git a/LEGO1/mxioinfo.cpp b/LEGO1/mxioinfo.cpp index d95a00ef..2d55ef36 100644 --- a/LEGO1/mxioinfo.cpp +++ b/LEGO1/mxioinfo.cpp @@ -13,7 +13,7 @@ MXIOINFO::~MXIOINFO() } // OFFSET: LEGO1 0x100cc830 -unsigned short MXIOINFO::Open(const char *filename, DWORD fdwOpen) +MxU16 MXIOINFO::Open(const char *filename, DWORD fdwOpen) { 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; -} \ No newline at end of file +} diff --git a/LEGO1/mxioinfo.h b/LEGO1/mxioinfo.h index 9556e5df..5ce0947a 100644 --- a/LEGO1/mxioinfo.h +++ b/LEGO1/mxioinfo.h @@ -12,12 +12,12 @@ class MXIOINFO MXIOINFO(); __declspec(dllexport) ~MXIOINFO(); - unsigned short Open(const char *filename, DWORD fdwOpen); + MxU16 Open(const char *filename, DWORD fdwOpen); void Close(MxLong arg); LONG Seek(LONG lOffset, int iOrigin); 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; }; diff --git a/LEGO1/mxstreamer.cpp b/LEGO1/mxstreamer.cpp index 3f377151..12f51f99 100644 --- a/LEGO1/mxstreamer.cpp +++ b/LEGO1/mxstreamer.cpp @@ -7,7 +7,7 @@ MxStreamer::~MxStreamer() } // OFFSET: LEGO1 0x100b92c0 STUB -MxStreamController *MxStreamer::Open(const char *name, unsigned short p) +MxStreamController *MxStreamer::Open(const char *name, MxU16 p) { // TODO return NULL; diff --git a/LEGO1/mxstreamer.h b/LEGO1/mxstreamer.h index 36f1a30f..f14ac66d 100644 --- a/LEGO1/mxstreamer.h +++ b/LEGO1/mxstreamer.h @@ -11,7 +11,7 @@ class MxStreamer : public MxCore public: virtual ~MxStreamer() override; - __declspec(dllexport) MxStreamController *Open(const char *name, unsigned short p); + __declspec(dllexport) MxStreamController *Open(const char *name, MxU16 p); __declspec(dllexport) MxLong Close(const char *p); virtual MxLong Notify(MxParam &p) override; // vtable+0x4 diff --git a/LEGO1/mxstring.h b/LEGO1/mxstring.h index a6552bb5..a24a0df1 100644 --- a/LEGO1/mxstring.h +++ b/LEGO1/mxstring.h @@ -23,7 +23,7 @@ class MxString : public MxCore private: char *m_data; - unsigned short m_length; + MxU16 m_length; }; diff --git a/LEGO1/mxvideopresenter.cpp b/LEGO1/mxvideopresenter.cpp index ee12968a..4e47e4a4 100644 --- a/LEGO1/mxvideopresenter.cpp +++ b/LEGO1/mxvideopresenter.cpp @@ -3,6 +3,7 @@ DECOMP_SIZE_ASSERT(MxVideoPresenter, 0x64); // OFFSET: LEGO1 0x100b2760 STUB -void MxVideoPresenter::Init() { +void MxVideoPresenter::Init() +{ // TODO } diff --git a/LEGO1/mxvideopresenter.h b/LEGO1/mxvideopresenter.h index e9634427..19c211c3 100644 --- a/LEGO1/mxvideopresenter.h +++ b/LEGO1/mxvideopresenter.h @@ -8,9 +8,11 @@ class MxVideoPresenter : public MxMediaPresenter { public: - MxVideoPresenter() { + MxVideoPresenter() + { Init(); } + // OFFSET: LEGO1 0x1000c820 inline virtual const char *ClassName() const override // vtable+0x0c { @@ -29,9 +31,9 @@ class MxVideoPresenter : public MxMediaPresenter undefined4 m_unk50; undefined4 m_unk54; undefined4 m_unk58; - short m_unk5c; + undefined2 m_unk5c; unsigned char m_flags; - int m_unk60; + undefined4 m_unk60; }; #endif // MXVIDEOPRESENTER_H