diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91a218f5..07fe411d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,8 +60,8 @@ jobs: C:\msys64\usr\bin\wget.exe https://legoisland.org/download/ISLE.EXE C:\msys64\usr\bin\wget.exe https://legoisland.org/download/LEGO1.DLL pip install capstone - python3 tools/reccmp/reccmp.py -H ISLEPROGRESS.HTML ISLE.EXE Release/ISLE.EXE Release/ISLE.PDB ISLE - python3 tools/reccmp/reccmp.py -H LEGO1PROGRESS.HTML LEGO1.DLL Release/LEGO1.DLL Release/LEGO1.PDB LEGO1 + python3 tools/reccmp/reccmp.py -H ISLEPROGRESS.HTML ISLE.EXE Release/ISLE.EXE Release/ISLE.PDB . + python3 tools/reccmp/reccmp.py -H LEGO1PROGRESS.HTML LEGO1.DLL Release/LEGO1.DLL Release/LEGO1.PDB . - name: Upload Artifact uses: actions/upload-artifact@master diff --git a/.gitignore b/.gitignore index b1838781..ef562599 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ Debug/ Release/ *.ncb +ISLE.EXE +LEGO1.DLL diff --git a/ISLE/define.cpp b/ISLE/define.cpp index a5122188..b5501b08 100644 --- a/ISLE/define.cpp +++ b/ISLE/define.cpp @@ -38,6 +38,3 @@ int g_startupDelay = 200; // 0x4101c0 long g_lastFrameTime = 0; - -// 0x4101dc -const char *WINDOW_TITLE = "LEGO\xAE"; diff --git a/ISLE/define.h b/ISLE/define.h index 36f69993..27a347b7 100644 --- a/ISLE/define.h +++ b/ISLE/define.h @@ -1,14 +1,16 @@ #ifndef DEFINE_H #define DEFINE_H -#include +#include "legoinc.h" class Isle; extern Isle *g_isle; extern int g_closed; +// 0x4101c4 #define WNDCLASS_NAME "Lego Island MainNoM App" -extern const char *WINDOW_TITLE; +// 0x4101dc +#define WINDOW_TITLE "LEGO\xAE" extern unsigned char g_mousedown; extern unsigned char g_mousemoved; extern RECT g_windowRect; diff --git a/ISLE/isle.cpp b/ISLE/isle.cpp index f16ced34..b6a19ab2 100644 --- a/ISLE/isle.cpp +++ b/ISLE/isle.cpp @@ -1,10 +1,8 @@ #include "isle.h" -#include "define.h" #include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legomodelpresenter.h" -#include "legoomni.h" #include "legopartpresenter.h" #include "legoworldpresenter.h" #include "mxdirectdraw.h" @@ -38,7 +36,7 @@ Isle::Isle() m_windowActive = 1; m_videoParam = MxVideoParam(MxRect32(0, 0, 639, 479), NULL, 1, MxVideoParamFlags()); - m_videoParam.flags().Enable16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16); + m_videoParam.flags().Set16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16); m_windowHandle = NULL; m_cursorArrow = NULL; @@ -78,7 +76,7 @@ Isle::~Isle() void Isle::Close() { MxDSAction ds; - ds.SetUnknown24(0xFFFE); + ds.SetUnknown24(-2); if (Lego()) { GameState()->Save(0); @@ -230,22 +228,22 @@ void Isle::LoadConfig() // OFFSET: ISLE 0x401560 void Isle::SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers, - BOOL using8bit, BOOL m_using16bit, BOOL param_6, BOOL param_7, + BOOL using8bit, BOOL using16bit, BOOL param_6, BOOL param_7, BOOL wideViewAngle, char *deviceId) { - m_videoParam.flags().EnableFullScreen(fullScreen); - m_videoParam.flags().EnableFlipSurfaces(flipSurfaces); - m_videoParam.flags().EnableBackBuffers(backBuffers); - m_videoParam.flags().EnableUnknown1(param_6); - m_videoParam.flags().SetUnknown3(param_7); - m_videoParam.flags().EnableWideViewAngle(wideViewAngle); - m_videoParam.flags().EnableUnknown2(); + m_videoParam.flags().SetFullScreen(fullScreen); + m_videoParam.flags().SetFlipSurfaces(flipSurfaces); + m_videoParam.flags().SetBackBuffers(!backBuffers); + m_videoParam.flags().Set_f2bit0(!param_6); + m_videoParam.flags().Set_f1bit7(param_7); + m_videoParam.flags().SetWideViewAngle(wideViewAngle); + m_videoParam.flags().Set_f2bit1(1); m_videoParam.SetDeviceName(deviceId); if (using8bit) { - m_videoParam.flags().Set8Bit(); + m_videoParam.flags().Set16Bit(0); } - if (m_using16bit) { - m_videoParam.flags().Set16Bit(); + if (using16bit) { + m_videoParam.flags().Set16Bit(1); } } @@ -574,67 +572,3 @@ MxResult Isle::SetupWindow(HINSTANCE hInstance) return SUCCESS; } - -// OFFSET: ISLE 0x402c20 -void Isle::Tick(BOOL sleepIfNotNextFrame) -{ - if (this->m_windowActive) { - if (!Lego()) return; - if (!TickleManager()) return; - if (!Timer()) return; - - long currentTime = Timer()->GetRealTime(); - if (currentTime < g_lastFrameTime) { - g_lastFrameTime = -this->m_frameDelta; - } - if (this->m_frameDelta + g_lastFrameTime < currentTime) { - if (!Lego()->vtable40()) { - TickleManager()->Tickle(); - } - g_lastFrameTime = currentTime; - - if (g_startupDelay == 0) { - return; - } - - g_startupDelay--; - if (g_startupDelay != 0) { - return; - } - - LegoOmni::GetInstance()->CreateBackgroundAudio(); - BackgroundAudioManager()->Enable(this->m_useMusic); - - MxStreamController *stream = Streamer()->Open("\\lego\\scripts\\isle\\isle", 0); - MxDSAction ds; - - if (!stream) { - stream = Streamer()->Open("\\lego\\scripts\\nocd", 0); - if (!stream) { - return; - } - - ds.SetAtomId(stream->atom); - ds.SetUnknown24(0xFFFF); - ds.SetUnknown1c(0); - VideoManager()->EnableFullScreenMovie(TRUE, TRUE); - - if (Start(&ds) != SUCCESS) { - return; - } - } else { - ds.SetAtomId(stream->atom); - ds.SetUnknown24(0xFFFF); - ds.SetUnknown1c(0); - if (Start(&ds) != SUCCESS) { - return; - } - this->m_gameStarted = 1; - } - return; - } - if (sleepIfNotNextFrame == 0) return; - } - - Sleep(0); -} \ No newline at end of file diff --git a/ISLE/isle.h b/ISLE/isle.h index 4d6b73c4..0b31d748 100644 --- a/ISLE/isle.h +++ b/ISLE/isle.h @@ -1,8 +1,10 @@ #ifndef ISLE_H #define ISLE_H -#include +#include "legoinc.h" +#include "define.h" +#include "legoomni.h" #include "mxresult.h" #include "mxvideoparam.h" @@ -25,7 +27,7 @@ class Isle BOOL SetupLegoOmni(); void LoadConfig(); void SetupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers, - BOOL using8bit, BOOL m_using16bit, BOOL param_6, BOOL param_7, + BOOL using8bit, BOOL using16bit, BOOL param_6, BOOL param_7, BOOL wideViewAngle, char *deviceId); void SetupCursor(WPARAM wParam); @@ -77,4 +79,68 @@ class Isle }; +// OFFSET: ISLE 0x402c20 +inline void Isle::Tick(BOOL sleepIfNotNextFrame) +{ + if (this->m_windowActive) { + if (!Lego()) return; + if (!TickleManager()) return; + if (!Timer()) return; + + long currentTime = Timer()->GetRealTime(); + if (currentTime < g_lastFrameTime) { + g_lastFrameTime = -this->m_frameDelta; + } + if (this->m_frameDelta + g_lastFrameTime < currentTime) { + if (!Lego()->vtable40()) { + TickleManager()->Tickle(); + } + g_lastFrameTime = currentTime; + + if (g_startupDelay == 0) { + return; + } + + g_startupDelay--; + if (g_startupDelay != 0) { + return; + } + + LegoOmni::GetInstance()->CreateBackgroundAudio(); + BackgroundAudioManager()->Enable(this->m_useMusic); + + MxStreamController *stream = Streamer()->Open("\\lego\\scripts\\isle\\isle", 0); + MxDSAction ds; + + if (!stream) { + stream = Streamer()->Open("\\lego\\scripts\\nocd", 0); + if (!stream) { + return; + } + + ds.SetAtomId(stream->atom); + ds.SetUnknown24(-1); + ds.SetUnknown1c(0); + VideoManager()->EnableFullScreenMovie(TRUE, TRUE); + + if (Start(&ds) != SUCCESS) { + return; + } + } else { + ds.SetAtomId(stream->atom); + ds.SetUnknown24(-1); + ds.SetUnknown1c(0); + if (Start(&ds) != SUCCESS) { + return; + } + this->m_gameStarted = 1; + } + return; + } + if (sleepIfNotNextFrame == 0) return; + } + + Sleep(0); +} + #endif // ISLE_H diff --git a/ISLE/main.cpp b/ISLE/main.cpp index 6e4c6621..632ed43d 100644 --- a/ISLE/main.cpp +++ b/ISLE/main.cpp @@ -1,9 +1,10 @@ #include -#include +#include "legoinc.h" #include "define.h" -#include "isle.h" + #include "legoomni.h" +#include "isle.h" // OFFSET: ISLE 0x401ca0 BOOL FindExistingInstance(void) diff --git a/ISLE/mx.cpp b/ISLE/mx.cpp deleted file mode 100644 index c0417e5a..00000000 --- a/ISLE/mx.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "mxdsobject.h" - -// OFFSET: ISLE 0x00401c40 -void MxDSObject::SetAtomId(MxAtomId p_atomId) -{ - this->m_atomId = p_atomId; -} \ No newline at end of file diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index 9d7c5062..0fc438be 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -24,6 +24,13 @@ LegoOmni *Lego() return (LegoOmni *) MxOmni::GetInstance(); } +// OFFSET: LEGO1 0x10015710 +LegoSoundManager *SoundManager() +{ + return LegoOmni::GetInstance()->GetSoundManager(); +} + + // OFFSET: LEGO1 0x10015720 LegoVideoManager *VideoManager() { @@ -48,6 +55,30 @@ LegoPlantManager *PlantManager() return LegoOmni::GetInstance()->GetLegoPlantManager(); } +// OFFSET: LEGO1 0x10015730 +MxBackgroundAudioManager *BackgroundAudioManager() +{ + return LegoOmni::GetInstance()->GetBackgroundAudioManager(); +} + +// OFFSET: LEGO1 0x10015740 +LegoInputManager *InputManager() +{ + return LegoOmni::GetInstance()->GetInputManager(); +} + +// OFFSET: LEGO1 0x10015760 +LegoGameState *GameState() +{ + return LegoOmni::GetInstance()->GetGameState(); +} + +// OFFSET: LEGO1 0x10015780 +LegoNavController *NavController() +{ + return LegoOmni::GetInstance()->GetNavController(); +} + // OFFSET: LEGO1 0x1005b5f0 long LegoOmni::Notify(MxParam &p) { diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 82972847..4b106796 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -49,10 +49,14 @@ class LegoOmni : public MxOmni virtual unsigned char vtable40(); LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; } + LegoSoundManager *GetSoundManager() { return (LegoSoundManager *)m_soundManager;} + MxBackgroundAudioManager *GetBackgroundAudioManager() { return m_bkgAudioManager; } LegoInputManager *GetInputManager() { return m_inputMgr; } Isle *GetIsle() { return m_isle; } LegoBuildingManager *GetLegoBuildingManager() { return m_buildingManager; } LegoPlantManager *GetLegoPlantManager() { return m_plantManager; } + LegoGameState *GetGameState() { return m_gameState; } + LegoNavController *GetNavController() { return m_navController; } private: int m_unk68; diff --git a/LEGO1/mxdsobject.cpp b/LEGO1/mxdsobject.cpp index 5e7d7103..7323f446 100644 --- a/LEGO1/mxdsobject.cpp +++ b/LEGO1/mxdsobject.cpp @@ -6,14 +6,11 @@ // OFFSET: LEGO1 0x100bf6a0 MxDSObject::MxDSObject() { - // The following code yields 100% matching assembly if m_unk24 is declared as (signed) short. - // However, in other areas m_unk24 (notably, ISLE.EXE) is treated as unsigned short. - // Since we don't have a proper solution yet, we are using a union to work around this discrepancy. this->m_unk0c = 0; this->m_unk10 = 0; this->m_unk14 = 0; this->m_name = NULL; - this->m_unk24signed = -1; + this->m_unk24 = -1; this->m_unk1c = -1; this->m_unk28 = 0; } @@ -37,9 +34,3 @@ void MxDSObject::SetObjectName(const char *p_name) } } } - -// OFFSET: LEGO1 0x10005530 -void MxDSObject::SetAtomId(MxAtomId p_atomId) -{ - this->m_atomId = p_atomId; -} diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index 99c62dd2..468076f7 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -15,9 +15,11 @@ 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(unsigned short p_unk24) { this->m_unk24 = p_unk24; } + inline void SetUnknown24(short p_unk24) { this->m_unk24 = p_unk24; } - void SetAtomId(MxAtomId p_atomId); + // OFFSET: ISLE 0x401c40 + // OFFSET: LEGO1 0x10005530 + inline void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } private: int m_unk08; @@ -27,13 +29,7 @@ class MxDSObject : public MxCore char *m_name; int m_unk1c; MxAtomId m_atomId; - // So far, implementing MxDSObject::MxDSObject correctly required that m_unk24 is declared a (signed) short. - // Most of the other game's code appears to treat it as unsigned short, however. - // This union is a workaround until we have figured this out. - union { - unsigned short m_unk24; - short m_unk24signed; - }; + short m_unk24; unsigned short m_unk26; int m_unk28; }; diff --git a/LEGO1/mxrect32.h b/LEGO1/mxrect32.h index 092396f5..8ba5f6d6 100644 --- a/LEGO1/mxrect32.h +++ b/LEGO1/mxrect32.h @@ -4,6 +4,7 @@ class MxRect32 { public: + MxRect32() { } MxRect32(int p_left, int p_top, int p_right, int p_bottom) { this->m_left = p_left; diff --git a/LEGO1/mxvideoparam.cpp b/LEGO1/mxvideoparam.cpp index 2a33736a..063d97f7 100644 --- a/LEGO1/mxvideoparam.cpp +++ b/LEGO1/mxvideoparam.cpp @@ -6,31 +6,57 @@ // OFFSET: LEGO1 0x100bec70 MxVideoParam::MxVideoParam() { - this->m_flags = MxVideoParamFlags(); - this->m_right = 640; - this->m_bottom = 480; - this->m_left = 0; - this->m_top = 0; + this->m_rect.m_right = 640; + this->m_rect.m_bottom = 480; + this->m_rect.m_left = 0; + this->m_rect.m_top = 0; this->m_palette = 0; this->m_backBuffers = 0; this->m_unk1c = 0; this->m_deviceId = 0; } -// OFFSET: LEGO1 0x100becf0 -MxVideoParam &MxVideoParam::operator=(const MxVideoParam &other) +// OFFSET: LEGO1 0x100beca0 +MxVideoParam::MxVideoParam(MxRect32 &p_rect, MxPalette *p_pal, unsigned long p_backBuffers, MxVideoParamFlags &p_flags) { - m_flags = MxVideoParamFlags(); - m_left = other.m_left; - m_top = other.m_top; - m_right = other.m_right; - m_bottom = other.m_bottom; - m_palette = other.m_palette; - m_backBuffers = other.m_backBuffers; - m_flags = other.m_flags; - m_unk1c = other.m_unk1c; - m_deviceId = other.m_deviceId; - SetDeviceName(other.m_deviceId); + this->m_rect.m_left = p_rect.m_left; + this->m_rect.m_top = p_rect.m_top; + this->m_rect.m_right = p_rect.m_right; + this->m_rect.m_bottom = p_rect.m_bottom; + this->m_palette = p_pal; + this->m_backBuffers = p_backBuffers; + this->m_flags = p_flags; + this->m_unk1c = 0; + this->m_deviceId = NULL; +} + +// OFFSET: LEGO1 0x100becf0 +MxVideoParam::MxVideoParam(MxVideoParam &p_videoParam) +{ + this->m_rect.m_left = p_videoParam.m_rect.m_left; + this->m_rect.m_top = p_videoParam.m_rect.m_top; + this->m_rect.m_right = p_videoParam.m_rect.m_right; + this->m_rect.m_bottom = p_videoParam.m_rect.m_bottom; + this->m_palette = p_videoParam.m_palette; + this->m_backBuffers = p_videoParam.m_backBuffers; + this->m_flags = p_videoParam.m_flags; + this->m_unk1c = p_videoParam.m_unk1c; + this->m_deviceId = NULL; + SetDeviceName(p_videoParam.m_deviceId); +} + +// OFFSET: LEGO1 0x100bede0 +MxVideoParam &MxVideoParam::operator=(const MxVideoParam &p_videoParam) +{ + this->m_rect.m_left = p_videoParam.m_rect.m_left; + this->m_rect.m_top = p_videoParam.m_rect.m_top; + this->m_rect.m_right = p_videoParam.m_rect.m_right; + this->m_rect.m_bottom = p_videoParam.m_rect.m_bottom; + this->m_palette = p_videoParam.m_palette; + this->m_backBuffers = p_videoParam.m_backBuffers; + this->m_flags = p_videoParam.m_flags; + this->m_unk1c = p_videoParam.m_unk1c; + SetDeviceName(p_videoParam.m_deviceId); return *this; } diff --git a/LEGO1/mxvideoparam.h b/LEGO1/mxvideoparam.h index eedf3167..aeb50554 100644 --- a/LEGO1/mxvideoparam.h +++ b/LEGO1/mxvideoparam.h @@ -20,16 +20,12 @@ class MxVideoParam inline MxVideoParamFlags &flags() { return m_flags; } private: - int m_left; - int m_top; - int m_right; - int m_bottom; + MxRect32 m_rect; MxPalette *m_palette; - int m_backBuffers; + unsigned int m_backBuffers; MxVideoParamFlags m_flags; int m_unk1c; char *m_deviceId; - }; #endif // MXVIDEOPARAM_H diff --git a/LEGO1/mxvideoparamflags.cpp b/LEGO1/mxvideoparamflags.cpp index 97f01515..07fc9ee3 100644 --- a/LEGO1/mxvideoparamflags.cpp +++ b/LEGO1/mxvideoparamflags.cpp @@ -3,15 +3,13 @@ // OFFSET: LEGO1 0x100bec40 MxVideoParamFlags::MxVideoParamFlags() { - // TODO: convert to EnableXXX function calls - unsigned char bVar1 = this->m_flags1; - this->m_flags1 = bVar1 & 0xfe; - this->m_flags1 = bVar1 & 0xfc; - this->m_flags1 = bVar1 & 0xf8; - this->m_flags1 = bVar1 & 0xf0; - this->m_flags1 = bVar1 & 0xe0; - this->m_flags2 = this->m_flags2 | 2; - this->m_flags1 = bVar1 & 0xc0; - this->m_flags1 = bVar1 & 0xc0 | 0x40; - this->m_flags1 = 0xc0; + this->SetFullScreen(0); + this->SetFlipSurfaces(0); + this->SetBackBuffers(0); + this->Set_f1bit3(0); + this->Set_f1bit4(0); + this->Set16Bit(0); + this->SetWideViewAngle(1); + this->Set_f1bit7(1); + this->Set_f2bit1(1); } diff --git a/LEGO1/mxvideoparamflags.h b/LEGO1/mxvideoparamflags.h index ef1b971d..ba7d821e 100644 --- a/LEGO1/mxvideoparamflags.h +++ b/LEGO1/mxvideoparamflags.h @@ -1,88 +1,49 @@ -#ifndef MXVIDEOPARAMFLAGS_H -#define MXVIDEOPARAMFLAGS_H - -#include "legoinc.h" - -class MxVideoParamFlags -{ -public: - enum LowFlags - { - FULL_SCREEN = 0x1, - FLIP_SURFACES = 0x2, - BACK_BUFFERS = 0x4, - ENABLE_16BIT = 0x20, - WIDE_VIEW_ANGLE = 0x40, - UNKNOWN3 = 0x80 - }; - - enum HighFlags - { - UNKNOWN1 = 0x1, - UNKNOWN2 = 0x2 - }; - - __declspec(dllexport) MxVideoParamFlags(); - - inline void EnableFullScreen(BOOL e) - { - m_flags1 = (m_flags1 ^ (e << 0)) & FULL_SCREEN ^ m_flags1; - } - - inline void EnableFlipSurfaces(BOOL e) - { - m_flags1 = (m_flags1 ^ (e << 1)) & FLIP_SURFACES ^ m_flags1; - } - - inline void EnableBackBuffers(BOOL e) - { - m_flags1 = (m_flags1 ^ ((!e) << 2)) & BACK_BUFFERS ^ m_flags1; - } - - inline void SetUnknown3(BOOL e) - { - m_flags1 = (m_flags1 ^ (e << 7)) & UNKNOWN3 ^ m_flags1; - } - - inline void Set8Bit() - { - m_flags1 &= ~ENABLE_16BIT; - } - - inline void Set16Bit() - { - m_flags1 |= ENABLE_16BIT; - } - - inline void Enable16Bit(unsigned char e) - { - m_flags1 = ((e << 5) ^ m_flags1) & ENABLE_16BIT ^ m_flags1; - } - - inline void EnableWideViewAngle(BOOL e) - { - m_flags1 = (m_flags1 ^ (e << 6)) & WIDE_VIEW_ANGLE ^ m_flags1; - } - - inline void EnableUnknown1(BOOL e) - { - m_flags2 = (m_flags2 ^ ((!e) << 0)) & UNKNOWN1 ^ m_flags2; - } - - inline void EnableUnknown2(BOOL e) - { - m_flags2 = (m_flags2 ^ (e << 1)) & UNKNOWN2 ^ m_flags2; - } - - inline void EnableUnknown2() - { - m_flags2 |= UNKNOWN2; - } - -private: - unsigned char m_flags1; - unsigned char m_flags2; - -}; - -#endif // MXVIDEOPARAMFLAGS_H +#ifndef MXVIDEOPARAMFLAGS_H +#define MXVIDEOPARAMFLAGS_H + +#include "legoinc.h" + +// Must be union with struct for match. +typedef union { + struct { + BYTE bit0: 1; + BYTE bit1: 1; + BYTE bit2: 1; + BYTE bit3: 1; + BYTE bit4: 1; + BYTE bit5: 1; + BYTE bit6: 1; + BYTE bit7: 1; + }; + // BYTE all; // ? +} flag_bitfield; + +class MxVideoParamFlags +{ +public: + __declspec(dllexport) MxVideoParamFlags(); + + inline void SetFullScreen(BOOL e) { m_flags1.bit0 = e; } + inline void SetFlipSurfaces(BOOL e) { m_flags1.bit1 = e; } + inline void SetBackBuffers(BOOL e) { m_flags1.bit2 = e; } + inline void Set_f1bit3(BOOL e) { m_flags1.bit3 = e; } + inline void Set_f1bit4(BOOL e) { m_flags1.bit4 = e; } + inline void Set16Bit(BYTE e) { m_flags1.bit5 = e; } + inline void SetWideViewAngle(BOOL e) { m_flags1.bit6 = e; } + inline void Set_f1bit7(BOOL e) { m_flags1.bit7 = e; } + inline void Set_f2bit0(BOOL e) { m_flags2.bit0 = e; } + inline void Set_f2bit1(BOOL e) { m_flags2.bit1 = e; } + inline void Set_f2bit2(BOOL e) { m_flags2.bit2 = e; } + inline void Set_f2bit3(BOOL e) { m_flags2.bit3 = e; } + inline void Set_f2bit4(BOOL e) { m_flags2.bit4 = e; } + inline void Set_f2bit5(BOOL e) { m_flags2.bit5 = e; } + inline void Set_f2bit6(BOOL e) { m_flags2.bit6 = e; } + inline void Set_f2bit7(BOOL e) { m_flags2.bit7 = e; } + +private: + flag_bitfield m_flags1; + flag_bitfield m_flags2; + +}; + +#endif // MXVIDEOPARAMFLAGS_H diff --git a/isle.mak b/isle.mak index f0f905ff..53c8f2bd 100644 --- a/isle.mak +++ b/isle.mak @@ -288,7 +288,6 @@ CLEAN : -@erase "$(INTDIR)\isle.obj" -@erase "$(INTDIR)\isle.res" -@erase "$(INTDIR)\main.obj" - -@erase "$(INTDIR)\mx.obj" -@erase "$(INTDIR)\vc40.pdb" -@erase ".\Release\ISLE.EXE" -@erase ".\Release\ISLE.PDB" @@ -350,7 +349,6 @@ LINK32_OBJS= \ "$(INTDIR)\isle.obj" \ "$(INTDIR)\isle.res" \ "$(INTDIR)\main.obj" \ - "$(INTDIR)\mx.obj" \ ".\Release\LEGO1.LIB" ".\Release\ISLE.EXE" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) @@ -380,7 +378,6 @@ CLEAN : -@erase "$(INTDIR)\isle.obj" -@erase "$(INTDIR)\isle.res" -@erase "$(INTDIR)\main.obj" - -@erase "$(INTDIR)\mx.obj" -@erase "$(INTDIR)\vc40.idb" -@erase "$(INTDIR)\vc40.pdb" -@erase ".\Debug\ISLE.EXE" @@ -444,7 +441,6 @@ LINK32_OBJS= \ "$(INTDIR)\isle.obj" \ "$(INTDIR)\isle.res" \ "$(INTDIR)\main.obj" \ - "$(INTDIR)\mx.obj" \ ".\LEGO1\Debug\LEGO1.lib" ".\Debug\ISLE.EXE" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) @@ -551,6 +547,7 @@ DEP_CPP_LEGOO=\ SOURCE=.\LEGO1\mxcriticalsection.cpp DEP_CPP_MXCRI=\ + ".\LEGO1\legoinc.h"\ ".\LEGO1\mxcriticalsection.h"\ @@ -564,6 +561,7 @@ DEP_CPP_MXCRI=\ SOURCE=.\LEGO1\mxautolocker.cpp DEP_CPP_MXAUT=\ + ".\LEGO1\legoinc.h"\ ".\LEGO1\mxautolocker.h"\ ".\LEGO1\mxcriticalsection.h"\ @@ -850,9 +848,6 @@ DEP_CPP_DEFIN=\ # Begin Source File SOURCE=.\ISLE\isle.cpp - -!IF "$(CFG)" == "ISLE - Win32 Release" - DEP_CPP_ISLE_=\ ".\ISLE\define.h"\ ".\ISLE\isle.h"\ @@ -910,72 +905,11 @@ DEP_CPP_ISLE_=\ $(CPP) $(CPP_PROJ) $(SOURCE) -!ELSEIF "$(CFG)" == "ISLE - Win32 Debug" - -DEP_CPP_ISLE_=\ - ".\ISLE\define.h"\ - ".\ISLE\isle.h"\ - ".\ISLE\res\resource.h"\ - ".\LEGO1\lego3dmanager.h"\ - ".\LEGO1\lego3dview.h"\ - ".\LEGO1\legoanimationmanager.h"\ - ".\LEGO1\legobuildingmanager.h"\ - ".\LEGO1\legoentity.h"\ - ".\LEGO1\legogamestate.h"\ - ".\LEGO1\legoinc.h"\ - ".\LEGO1\legoinputmanager.h"\ - ".\LEGO1\legomodelpresenter.h"\ - ".\LEGO1\legonavcontroller.h"\ - ".\LEGO1\legoomni.h"\ - ".\LEGO1\legopartpresenter.h"\ - ".\LEGO1\legoroi.h"\ - ".\LEGO1\legovideomanager.h"\ - ".\LEGO1\legoworldpresenter.h"\ - ".\LEGO1\mxatomid.h"\ - ".\LEGO1\mxbackgroundaudiomanager.h"\ - ".\LEGO1\mxbool.h"\ - ".\LEGO1\mxcore.h"\ - ".\LEGO1\mxcriticalsection.h"\ - ".\LEGO1\mxdirectdraw.h"\ - ".\LEGO1\mxdsaction.h"\ - ".\LEGO1\mxdsfile.h"\ - ".\LEGO1\mxdsobject.h"\ - ".\LEGO1\mxeventmanager.h"\ - ".\LEGO1\mxmusicmanager.h"\ - ".\LEGO1\mxnotificationmanager.h"\ - ".\LEGO1\mxobjectfactory.h"\ - ".\LEGO1\mxomni.h"\ - ".\LEGO1\mxomnicreateflags.h"\ - ".\LEGO1\mxomnicreateparam.h"\ - ".\LEGO1\mxomnicreateparambase.h"\ - ".\LEGO1\mxresult.h"\ - ".\LEGO1\mxsoundmanager.h"\ - ".\LEGO1\mxstreamcontroller.h"\ - ".\LEGO1\mxstreamer.h"\ - ".\LEGO1\mxstring.h"\ - ".\LEGO1\mxticklemanager.h"\ - ".\LEGO1\mxtimer.h"\ - ".\LEGO1\mxtransitionmanager.h"\ - ".\LEGO1\mxvariabletable.h"\ - ".\LEGO1\mxvideomanager.h"\ - ".\LEGO1\mxvideoparam.h"\ - ".\LEGO1\viewmanager.h"\ - - -"$(INTDIR)\isle.obj" : $(SOURCE) $(DEP_CPP_ISLE_) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - # End Source File ################################################################################ # Begin Source File SOURCE=.\ISLE\main.cpp - -!IF "$(CFG)" == "ISLE - Win32 Release" - DEP_CPP_MAIN_=\ ".\ISLE\define.h"\ ".\ISLE\isle.h"\ @@ -1026,57 +960,6 @@ DEP_CPP_MAIN_=\ $(CPP) $(CPP_PROJ) $(SOURCE) -!ELSEIF "$(CFG)" == "ISLE - Win32 Debug" - -DEP_CPP_MAIN_=\ - ".\ISLE\define.h"\ - ".\ISLE\isle.h"\ - ".\LEGO1\lego3dmanager.h"\ - ".\LEGO1\lego3dview.h"\ - ".\LEGO1\legoentity.h"\ - ".\LEGO1\legogamestate.h"\ - ".\LEGO1\legoinc.h"\ - ".\LEGO1\legoinputmanager.h"\ - ".\LEGO1\legonavcontroller.h"\ - ".\LEGO1\legoomni.h"\ - ".\LEGO1\legoroi.h"\ - ".\LEGO1\legovideomanager.h"\ - ".\LEGO1\mxatomid.h"\ - ".\LEGO1\mxbackgroundaudiomanager.h"\ - ".\LEGO1\mxbool.h"\ - ".\LEGO1\mxcore.h"\ - ".\LEGO1\mxcriticalsection.h"\ - ".\LEGO1\mxdsaction.h"\ - ".\LEGO1\mxdsfile.h"\ - ".\LEGO1\mxdsobject.h"\ - ".\LEGO1\mxeventmanager.h"\ - ".\LEGO1\mxmusicmanager.h"\ - ".\LEGO1\mxnotificationmanager.h"\ - ".\LEGO1\mxobjectfactory.h"\ - ".\LEGO1\mxomni.h"\ - ".\LEGO1\mxomnicreateflags.h"\ - ".\LEGO1\mxomnicreateparam.h"\ - ".\LEGO1\mxomnicreateparambase.h"\ - ".\LEGO1\mxresult.h"\ - ".\LEGO1\mxsoundmanager.h"\ - ".\LEGO1\mxstreamcontroller.h"\ - ".\LEGO1\mxstreamer.h"\ - ".\LEGO1\mxstring.h"\ - ".\LEGO1\mxticklemanager.h"\ - ".\LEGO1\mxtimer.h"\ - ".\LEGO1\mxtransitionmanager.h"\ - ".\LEGO1\mxvariabletable.h"\ - ".\LEGO1\mxvideomanager.h"\ - ".\LEGO1\mxvideoparam.h"\ - ".\LEGO1\viewmanager.h"\ - - -"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - # End Source File ################################################################################ # Begin Source File @@ -1517,22 +1400,6 @@ SOURCE=.\LEGO1\mxvideoparamflags.h !ENDIF # End Project Dependency -################################################################################ -# Begin Source File - -SOURCE=.\ISLE\mx.cpp -DEP_CPP_MX_CP=\ - ".\LEGO1\mxatomid.h"\ - ".\LEGO1\mxbool.h"\ - ".\LEGO1\mxcore.h"\ - ".\LEGO1\mxdsobject.h"\ - - -"$(INTDIR)\mx.obj" : $(SOURCE) $(DEP_CPP_MX_CP) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -# End Source File # End Target # End Project ################################################################################ diff --git a/isle.mdp b/isle.mdp index e164ac1e..375126de 100644 Binary files a/isle.mdp and b/isle.mdp differ diff --git a/tools/reccmp/reccmp.py b/tools/reccmp/reccmp.py index 02189dfe..6e9826ce 100755 --- a/tools/reccmp/reccmp.py +++ b/tools/reccmp/reccmp.py @@ -118,14 +118,23 @@ def __init__(self, pdb, file): if current_section == 'SYMBOLS' and 'S_GPROC32' in line: addr = int(line[26:34], 16) - debug_offs = line_dump[i + 2] - debug_start = int(debug_offs[22:30], 16) - debug_end = int(debug_offs[43:], 16) + info = RecompiledInfo() info.addr = addr + recompfile.imagebase + recompfile.textvirt - info.start = debug_start - info.size = debug_end - debug_start + + use_dbg_offs = False + if use_dbg_offs: + debug_offs = line_dump[i + 2] + debug_start = int(debug_offs[22:30], 16) + debug_end = int(debug_offs[43:], 16) + + info.start = debug_start + info.size = debug_end - debug_start + else: + info.start = 0 + info.size = int(line[41:49], 16) + info.name = line[77:] self.funcs[addr] = info @@ -189,7 +198,14 @@ def get_recompiled_address(self, filename, line): def sanitize(file, mnemonic, op_str): offsetplaceholder = '' - if mnemonic == 'call' or mnemonic == 'jmp': + op_str_is_number = False + try: + int(op_str, 16) + op_str_is_number = True + except ValueError: + pass + + if (mnemonic == 'call' or mnemonic == 'jmp') and op_str_is_number: # Filter out "calls" because the offsets we're not currently trying to # match offsets. As long as there's a call in the right place, it's # probably accurate. @@ -243,6 +259,10 @@ def parse_asm(file, addr, size): total_accuracy = 0 htmlinsert = [] +# Generate basename of original file, used in locating OFFSET lines +basename = os.path.basename(os.path.splitext(original)[0]) +pattern = '// OFFSET:' + for subdir, dirs, files in os.walk(source): for file in files: srcfilename = os.path.join(os.path.abspath(subdir), file) @@ -257,9 +277,14 @@ def parse_asm(file, addr, size): if not line: break - if line.startswith('// OFFSET:'): - par = line[10:].strip().split() + line = line.strip() + + if line.startswith(pattern): + par = line[len(pattern):].strip().split() module = par[0] + if module != basename: + continue + addr = int(par[1], 16) find_open_bracket = line