lego1/isle: Add MxDSObject, implement SetObjectName, adjust MxDSAction (#20)

* add MxDSObject, implement SetObjectName, adjust MxDSAction

* add a TODO

* update project files

* add WIP MxDSObject stuff

* merge

* update project file

* add addresses and SetAtomId

* switch addresses

* remove comment since it's fixed now (?)

* refactor

* update project file

* refactor into separate unit

* refactor into separate unit

* rename unit to avoid NMAKE issue

* rename param

* add last missing piece to Isle::Close

* fix spelling

* merge

* use union hack
This commit is contained in:
Christian Semmler 2023-06-20 02:18:53 +02:00 committed by GitHub
parent 66dd2cdeb9
commit 0ab8fc52d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 291 additions and 30 deletions

View file

@ -84,6 +84,7 @@ Isle::~Isle()
void Isle::Close()
{
MxDSAction ds;
ds.SetUnknown24(0xFFFE);
if (Lego()) {
GameState()->Save(0);
@ -93,8 +94,7 @@ void Isle::Close()
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL);
long local_88 = 0;
Lego()->RemoveWorld(ds.m_atomId, local_88);
Lego()->RemoveWorld(ds.GetAtomId(), ds.GetUnknown1c());
Lego()->vtable24(ds);
TransitionManager()->SetWaitIndicator(NULL);
Lego()->vtable3c();
@ -608,18 +608,18 @@ void Isle::Tick(BOOL sleepIfNotNextFrame)
return;
}
ds.setAtomId(stream->atom);
ds.m_unk24 = 0xFFFF;
ds.m_unk1c = 0;
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.m_unk24 = 0xFFFF;
ds.m_unk1c = 0;
ds.SetAtomId(stream->atom);
ds.SetUnknown24(0xFFFF);
ds.SetUnknown1c(0);
if (Start(&ds) != SUCCESS) {
return;
}

7
ISLE/mx.cpp Normal file
View file

@ -0,0 +1,7 @@
#include "mxdsobject.h"
// OFFSET: ISLE 0x00401c40
void MxDSObject::SetAtomId(MxAtomId p_atomId)
{
this->m_atomId = p_atomId;
}

0
LEGO1/lego3dmanager.h Executable file → Normal file
View file

0
LEGO1/lego3dview.h Executable file → Normal file
View file

14
LEGO1/mxatomid.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "mxatomid.h"
// OFFSET: LEGO1 0x100acfd0
MxAtomId::~MxAtomId()
{
// TODO
}
// OFFSET: LEGO1 0x100ad1c0
MxAtomId &MxAtomId::operator=(const MxAtomId &id)
{
// TODO
return *this;
}

View file

@ -12,8 +12,13 @@ class MxAtomId
__declspec(dllexport) MxAtomId &operator=(const MxAtomId &id);
__declspec(dllexport) ~MxAtomId();
char *m_internal;
MxAtomId()
{
this->m_internal = 0;
};
private:
char *m_internal;
};
#endif // MXATOMID_H

View file

@ -1,25 +1,14 @@
#ifndef MXDSACTION_H
#define MXDSACTION_H
#include "mxatomid.h"
#include "mxdsobject.h"
class MxDSAction
class MxDSAction : public MxDSObject
{
public:
__declspec(dllexport) MxDSAction();
__declspec(dllexport) virtual ~MxDSAction();
int m_unk04;
int m_unk08;
int m_unk0c;
int m_unk10;
int m_unk14;
int m_unk18;
int m_unk1c;
MxAtomId m_atomId;
unsigned short m_unk24;
unsigned short m_unk26;
int m_unk28;
int m_unk2c;
int m_unk30;
int m_unk34;
@ -46,12 +35,6 @@ class MxDSAction
int m_unk88;
int m_unk8c;
int m_unk90;
void setAtomId(MxAtomId &atomId)
{
this->m_atomId = atomId;
}
};
#endif // MXDSACTION_H

45
LEGO1/mxdsobject.cpp Normal file
View file

@ -0,0 +1,45 @@
#include "mxdsobject.h"
#include <string.h>
#include <stdlib.h>
// 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_unk1c = -1;
this->m_unk28 = 0;
}
// OFFSET: LEGO1 0x100bf8e0
void MxDSObject::SetObjectName(const char *p_name)
{
if (p_name != this->m_name)
{
free(this->m_name);
if (p_name) {
this->m_name = (char *)malloc(strlen(p_name) + 1);
if (this->m_name) {
strcpy(this->m_name, p_name);
}
}
else {
this->m_name = NULL;
}
}
}
// OFFSET: LEGO1 0x10005530
void MxDSObject::SetAtomId(MxAtomId p_atomId)
{
this->m_atomId = p_atomId;
}

View file

@ -1,10 +1,41 @@
#ifndef MXDSOBJECT_H
#define MXDSOBJECT_H
class MxDSObject
#include "mxcore.h"
#include "mxatomid.h"
class MxDSObject : public MxCore
{
public:
__declspec(dllexport) void SetObjectName(const char *);
MxDSObject();
inline const MxAtomId& GetAtomId() { return this->m_atomId; }
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; }
void SetAtomId(MxAtomId p_atomId);
private:
int m_unk08;
short m_unk0c;
char* m_unk10;
int m_unk14;
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;
};
unsigned short m_unk26;
int m_unk28;
};
#endif // MXDSOBJECT_H

178
isle.mak
View file

@ -57,9 +57,11 @@ CLEAN :
-@erase "$(INTDIR)\dllmain.obj"
-@erase "$(INTDIR)\legonavcontroller.obj"
-@erase "$(INTDIR)\legoomni.obj"
-@erase "$(INTDIR)\mxatomid.obj"
-@erase "$(INTDIR)\mxautolocker.obj"
-@erase "$(INTDIR)\mxcore.obj"
-@erase "$(INTDIR)\mxcriticalsection.obj"
-@erase "$(INTDIR)\mxdsobject.obj"
-@erase "$(INTDIR)\mxomni.obj"
-@erase "$(INTDIR)\mxomnicreateflags.obj"
-@erase "$(INTDIR)\mxomnicreateparam.obj"
@ -129,9 +131,11 @@ LINK32_OBJS= \
"$(INTDIR)\dllmain.obj" \
"$(INTDIR)\legonavcontroller.obj" \
"$(INTDIR)\legoomni.obj" \
"$(INTDIR)\mxatomid.obj" \
"$(INTDIR)\mxautolocker.obj" \
"$(INTDIR)\mxcore.obj" \
"$(INTDIR)\mxcriticalsection.obj" \
"$(INTDIR)\mxdsobject.obj" \
"$(INTDIR)\mxomni.obj" \
"$(INTDIR)\mxomnicreateflags.obj" \
"$(INTDIR)\mxomnicreateparam.obj" \
@ -167,9 +171,11 @@ CLEAN :
-@erase "$(INTDIR)\dllmain.obj"
-@erase "$(INTDIR)\legonavcontroller.obj"
-@erase "$(INTDIR)\legoomni.obj"
-@erase "$(INTDIR)\mxatomid.obj"
-@erase "$(INTDIR)\mxautolocker.obj"
-@erase "$(INTDIR)\mxcore.obj"
-@erase "$(INTDIR)\mxcriticalsection.obj"
-@erase "$(INTDIR)\mxdsobject.obj"
-@erase "$(INTDIR)\mxomni.obj"
-@erase "$(INTDIR)\mxomnicreateflags.obj"
-@erase "$(INTDIR)\mxomnicreateparam.obj"
@ -241,9 +247,11 @@ LINK32_OBJS= \
"$(INTDIR)\dllmain.obj" \
"$(INTDIR)\legonavcontroller.obj" \
"$(INTDIR)\legoomni.obj" \
"$(INTDIR)\mxatomid.obj" \
"$(INTDIR)\mxautolocker.obj" \
"$(INTDIR)\mxcore.obj" \
"$(INTDIR)\mxcriticalsection.obj" \
"$(INTDIR)\mxdsobject.obj" \
"$(INTDIR)\mxomni.obj" \
"$(INTDIR)\mxomnicreateflags.obj" \
"$(INTDIR)\mxomnicreateparam.obj" \
@ -280,6 +288,7 @@ 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"
@ -341,6 +350,7 @@ 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)
@ -370,6 +380,7 @@ 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"
@ -433,6 +444,7 @@ 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)
@ -620,7 +632,7 @@ DEP_CPP_MXOMN=\
SOURCE=.\LEGO1\mxvideoparam.cpp
DEP_CPP_MXVID=\
".\LEGO1\mxbool.h"\
".\LEGO1\legoinc.h"\
".\LEGO1\mxpalette.h"\
".\LEGO1\mxrect32.h"\
".\LEGO1\mxvariabletable.h"\
@ -638,6 +650,7 @@ DEP_CPP_MXVID=\
SOURCE=.\LEGO1\mxvideoparamflags.cpp
DEP_CPP_MXVIDE=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxvideoparamflags.h"\
@ -651,6 +664,7 @@ DEP_CPP_MXVIDE=\
SOURCE=.\LEGO1\mxomnicreateparam.cpp
DEP_CPP_MXOMNI=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxomnicreateflags.h"\
@ -674,6 +688,7 @@ DEP_CPP_MXOMNI=\
SOURCE=.\LEGO1\mxomnicreateparambase.cpp
DEP_CPP_MXOMNIC=\
".\LEGO1\legoinc.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxomnicreateflags.h"\
@ -775,6 +790,35 @@ DEP_CPP_LEGON=\
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxdsobject.cpp
DEP_CPP_MXDSO=\
".\LEGO1\mxatomid.h"\
".\LEGO1\mxbool.h"\
".\LEGO1\mxcore.h"\
".\LEGO1\mxdsobject.h"\
"$(INTDIR)\mxdsobject.obj" : $(SOURCE) $(DEP_CPP_MXDSO) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\LEGO1\mxatomid.cpp
DEP_CPP_MXATO=\
".\LEGO1\mxatomid.h"\
"$(INTDIR)\mxatomid.obj" : $(SOURCE) $(DEP_CPP_MXATO) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
# End Source File
# End Target
################################################################################
@ -806,6 +850,9 @@ DEP_CPP_DEFIN=\
# Begin Source File
SOURCE=.\ISLE\isle.cpp
!IF "$(CFG)" == "ISLE - Win32 Release"
DEP_CPP_ISLE_=\
".\ISLE\define.h"\
".\ISLE\isle.h"\
@ -816,6 +863,7 @@ DEP_CPP_ISLE_=\
".\LEGO1\legobuildingmanager.h"\
".\LEGO1\legoentity.h"\
".\LEGO1\legogamestate.h"\
".\LEGO1\legoinc.h"\
".\LEGO1\legoinputmanager.h"\
".\LEGO1\legomodelpresenter.h"\
".\LEGO1\legonavcontroller.h"\
@ -862,11 +910,72 @@ 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"\
@ -917,6 +1026,57 @@ 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
@ -1357,6 +1517,22 @@ 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
################################################################################

BIN
isle.mdp

Binary file not shown.