From 0b800cf6917c29cb656736b7592464d97b257ce4 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Sun, 24 Nov 2024 09:22:17 +0000 Subject: [PATCH] api: update research --- UnleashedRecomp/api/CSD/Manager/csdmBase.h | 4 +--- UnleashedRecomp/api/CSD/Manager/csdmNode.h | 4 ++-- UnleashedRecomp/api/CSD/Manager/csdmNode.inl | 5 ++++ .../api/CSD/Manager/csdmNodeObserver.h | 4 +--- .../api/CSD/Manager/csdmObserverBase.h | 12 ++++++++-- .../api/CSD/Manager/csdmObserverBase.inl | 8 +++++++ .../api/CSD/Manager/csdmRCObject.h | 16 +++++++++---- .../api/CSD/Manager/csdmRCObject.inl | 17 +++++++++++--- .../api/CSD/Manager/csdmRCObjectImp.h | 5 +--- UnleashedRecomp/api/CSD/Manager/csdmRCPtr.h | 4 ++-- .../api/CSD/Manager/csdmRCPtrAbs.h | 13 +++++++++-- .../api/CSD/Manager/csdmRCPtrAbs.inl | 5 ++++ .../api/CSD/Manager/csdmResourceBase.h | 14 ++++++++--- .../api/CSD/Manager/csdmResourceBase.inl | 8 ++++++- UnleashedRecomp/api/CSD/Manager/csdmScene.h | 23 +++++-------------- UnleashedRecomp/api/CSD/Manager/csdmScene.inl | 15 ++++++++++++ .../api/CSD/Manager/csdmSceneObserver.h | 4 +--- .../api/CSD/Manager/csdmSubjectBase.h | 13 +++++++++-- .../api/CSD/Manager/csdmSubjectBase.inl | 14 +++++++++++ UnleashedRecomp/api/CSD/Platform/csdTexList.h | 10 +++++++- .../api/CSD/Platform/csdTexList.inl | 7 ++++++ .../Hedgehog/Database/System/hhDatabaseData.h | 15 ++++++++---- .../Database/System/hhDatabaseData.inl | 5 ++++ .../MirageCore/Renderable/hhRenderable.h | 2 +- .../Hedgehog/Universe/Engine/hhUpdateUnit.h | 4 ++-- .../Hedgehog/Universe/Thread/hhParallelJob.h | 2 +- UnleashedRecomp/api/SWA.h | 7 ++++++ UnleashedRecomp/api/SWA.inl | 3 +++ UnleashedRecomp/api/SWA/CSD/GameObjectCSD.h | 1 + UnleashedRecomp/api/SWA/Camera/Camera.h | 1 + UnleashedRecomp/api/SWA/HUD/Pause/HudPause.h | 1 + .../api/SWA/HUD/Sonic/HudSonicStage.h | 22 ++++++++++++++++++ .../api/SWA/Movie/MovieDisplayer.h | 14 +++++++++++ UnleashedRecomp/api/SWA/Movie/MovieManager.h | 17 ++++++++++++++ .../api/SWA/Movie/MovieManager.inl | 7 ++++++ .../Character/EvilSonic/Hud/EvilHudGuide.h | 1 + .../api/SWA/Sequence/Unit/SequenceUnitBase.h | 13 +++++++++++ .../SWA/Sequence/Unit/SequenceUnitPlayMovie.h | 8 +++++++ .../Utility/SequencePlayMovieWrapper.h | 21 +++++++++++++++-- UnleashedRecomp/api/SWA/Sound/Sound.h | 3 ++- .../api/SWA/System/ApplicationDocument.h | 12 ++++++++-- .../api/SWA/System/GameMode/GameModeStage.h | 7 +++++- .../SWA/System/GameMode/GameModeStageMovie.h | 20 ++++++++++++++++ UnleashedRecomp/patches/misc_patches.cpp | 2 +- 44 files changed, 326 insertions(+), 67 deletions(-) create mode 100644 UnleashedRecomp/api/CSD/Manager/csdmObserverBase.inl create mode 100644 UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.inl create mode 100644 UnleashedRecomp/api/CSD/Platform/csdTexList.inl create mode 100644 UnleashedRecomp/api/SWA/HUD/Sonic/HudSonicStage.h create mode 100644 UnleashedRecomp/api/SWA/Movie/MovieDisplayer.h create mode 100644 UnleashedRecomp/api/SWA/Movie/MovieManager.h create mode 100644 UnleashedRecomp/api/SWA/Movie/MovieManager.inl create mode 100644 UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitBase.h create mode 100644 UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitPlayMovie.h create mode 100644 UnleashedRecomp/api/SWA/System/GameMode/GameModeStageMovie.h diff --git a/UnleashedRecomp/api/CSD/Manager/csdmBase.h b/UnleashedRecomp/api/CSD/Manager/csdmBase.h index 39eff13d..d2ffca59 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmBase.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmBase.h @@ -2,7 +2,5 @@ namespace Chao::CSD { - class CBase - { - }; + class CBase {}; } diff --git a/UnleashedRecomp/api/CSD/Manager/csdmNode.h b/UnleashedRecomp/api/CSD/Manager/csdmNode.h index 3bba6c33..8f7df548 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmNode.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmNode.h @@ -13,9 +13,9 @@ namespace Chao::CSD class CNode : public CResourceBase, SubjectBase, CBase { public: - SWA_INSERT_PADDING(0x4C); + SWA_INSERT_PADDING(0x50); - ~CNode() override = default; + ~CNode(); void SetText(const char* in_pText); void SetText(const wchar_t* in_pText); diff --git a/UnleashedRecomp/api/CSD/Manager/csdmNode.inl b/UnleashedRecomp/api/CSD/Manager/csdmNode.inl index 4cca9069..da8f8683 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmNode.inl +++ b/UnleashedRecomp/api/CSD/Manager/csdmNode.inl @@ -2,6 +2,11 @@ namespace Chao::CSD { + inline CNode::~CNode() + { + SWA_VIRTUAL_FUNCTION(void, 0, this); + } + inline void CNode::SetText(const char* in_pText) { GuestToHostFunction(0x830BF640, this, in_pText); diff --git a/UnleashedRecomp/api/CSD/Manager/csdmNodeObserver.h b/UnleashedRecomp/api/CSD/Manager/csdmNodeObserver.h index 19fcf3cb..abfba980 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmNodeObserver.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmNodeObserver.h @@ -6,7 +6,5 @@ namespace Chao::CSD { class CNode; - class CNodeObserver : public CObserverBase - { - }; + class CNodeObserver : public CObserverBase {}; } diff --git a/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.h b/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.h index 1cec107e..63daf398 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.h @@ -8,8 +8,16 @@ namespace Chao::CSD class CObserverBase { public: - SWA_INSERT_PADDING(0x0C); + struct Vftable + { + be m_fpDtor; + }; - virtual ~CObserverBase() = default; + xpointer m_pVftable; + SWA_INSERT_PADDING(0x08); + + ~CObserverBase(); }; } + +#include "CSD/Manager/csdmObserverBase.inl" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.inl b/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.inl new file mode 100644 index 00000000..beeabb4f --- /dev/null +++ b/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.inl @@ -0,0 +1,8 @@ +namespace Chao::CSD +{ + template + inline CObserverBase::~CObserverBase() + { + GuestToHostFunction(m_pVftable->m_fpDtor, this); + } +} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCObject.h b/UnleashedRecomp/api/CSD/Manager/csdmRCObject.h index 81844c64..143dcb07 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCObject.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmRCObject.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "CSD/Manager/csdmRCPtrAbs.h" @@ -7,14 +7,22 @@ namespace Chao::CSD class RCPtrAbs::RCObject { public: + struct Vftable + { + be m_fpDtor; + be m_fpDeallocate; + }; + + xpointer m_pVftable; xpointer m_pMemory; be m_RefCount; xpointer m_pDealloctor; be m_eDealloctor; - virtual ~RCObject(); - virtual void Deallocate(void* in_pMemory) = 0; - + ~RCObject(); + void Deallocate(void* in_pMemory); void Release(); }; } + +#include "CSD/Manager/csdmRCObject.inl" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCObject.inl b/UnleashedRecomp/api/CSD/Manager/csdmRCObject.inl index f9c7741f..60909972 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCObject.inl +++ b/UnleashedRecomp/api/CSD/Manager/csdmRCObject.inl @@ -1,13 +1,14 @@ namespace Chao::CSD { - inline void RCPtrAbs::RCObject::Release() + inline RCPtrAbs::RCObject::~RCObject() { - GuestToHostFunction(0x830BA068, this); + GuestToHostFunction(m_pVftable->m_fpDtor, this); } inline RCPtrAbs::~RCPtrAbs() { - RCObject* pObj = m_pObject; + RCPtrAbs::RCObject* pObj = m_pObject; + m_pObject = nullptr; if (pObj) @@ -21,4 +22,14 @@ namespace Chao::CSD return m_pObject->m_pMemory; } + + inline void RCPtrAbs::RCObject::Deallocate(void* in_pMemory) + { + GuestToHostFunction(m_pVftable->m_fpDeallocate, this, in_pMemory); + } + + inline void RCPtrAbs::RCObject::Release() + { + GuestToHostFunction(0x830BA068, this); + } } diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.h b/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.h index c21987d8..aa814cfa 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.h @@ -5,8 +5,5 @@ namespace Chao::CSD { template - class RCPtr::RCObjectImp : public RCObject - { - void Deallocate(void* in_pMemory) override; - }; + class RCPtr::RCObjectImp : public RCObject {}; } diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.h b/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.h index a4a3caf5..10878100 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.h @@ -15,8 +15,6 @@ namespace Chao::CSD RCPtr(const RCPtr& in_rOther) : RCPtrAbs(in_rOther) {} RCPtr(RCPtr&& in_rOther) : RCPtrAbs(std::move(in_rOther)) {} - RCObject* CreateRCObject() override; - void Attach(T* in_pObject); T* Get() const; @@ -30,3 +28,5 @@ namespace Chao::CSD operator bool() const; }; } + +#include "CSD/Manager/csdmRCPtr.inl" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.h b/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.h index 429df724..e1e46be8 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.h @@ -9,6 +9,13 @@ namespace Chao::CSD public: class RCObject; + struct Vftable + { + be m_fpDtor; + be m_fpCreateRCObject; + }; + + xpointer m_pVftable; xpointer m_pObject; RCPtrAbs(); @@ -16,8 +23,8 @@ namespace Chao::CSD RCPtrAbs(const RCPtrAbs& in_rOther); RCPtrAbs(RCPtrAbs&& in_rPtr); - virtual ~RCPtrAbs(); - virtual RCObject* CreateRCObject() = 0; + ~RCPtrAbs(); + RCObject* CreateRCObject(); void AttachAbs(void* in_pMemory); void* GetAbs() const; @@ -31,3 +38,5 @@ namespace Chao::CSD operator bool() const; }; } + +#include "CSD/Manager/csdmRCPtrAbs.inl" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.inl b/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.inl index c6d68674..2925fc54 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.inl +++ b/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.inl @@ -20,6 +20,11 @@ namespace Chao::CSD in_rPtr.m_pObject = nullptr; } + inline RCPtrAbs::RCObject* RCPtrAbs::CreateRCObject() + { + return GuestToHostFunction(m_pVftable->m_fpCreateRCObject, this); + } + inline void RCPtrAbs::AttachAbs(void* in_pMemory) { GuestToHostFunction(0x830BA298, this, in_pMemory); diff --git a/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.h b/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.h index 089c3048..094ed06f 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.h @@ -8,11 +8,19 @@ namespace Chao::CSD class CResourceBase { public: + struct Vftable + { + be m_fpDtor; + be m_fpCopyResource; + }; + + xpointer m_pVftable; RCPtr m_rcResourceHolder; xpointer m_pResource; - virtual ~CResourceBase() = default; - - virtual void CopyResource(const CResourceBase& in_rOther); + ~CResourceBase(); + void CopyResource(const CResourceBase& in_rOther); }; } + +#include "CSD/Manager/csdmResourceBase.h" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.inl b/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.inl index 923b8073..d459e3c9 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.inl +++ b/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.inl @@ -1,7 +1,13 @@ namespace Chao::CSD { template - void CResourceBase::CopyResource(const CResourceBase& in_rOther) + inline CResourceBase::~CResourceBase() + { + GuestToHostFunction(m_pVftable->m_fpDtor, this); + } + + template + inline void CResourceBase::CopyResource(const CResourceBase& in_rOther) { m_rcResourceHolder = in_rOther.m_rcResourceHolder; m_pResource = in_rOther.m_pResource; diff --git a/UnleashedRecomp/api/CSD/Manager/csdmScene.h b/UnleashedRecomp/api/CSD/Manager/csdmScene.h index d8e683a1..cc8cdde2 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmScene.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmScene.h @@ -23,7 +23,7 @@ namespace Chao::CSD class CScene : public CResourceBase, SubjectBase, CBase { public: - SWA_INSERT_PADDING(0x5C); + SWA_INSERT_PADDING(0x60); be m_PrevMotionFrame; be m_MotionFrame; be m_MotionSpeed; @@ -35,22 +35,9 @@ namespace Chao::CSD be m_MotionRepeatType; SWA_INSERT_PADDING(0x2C); - ~CScene() override = default; - - // Update should be called with a delta time of zero - // after making changes to a motion. - - // Example: - // SetMotion("Intro_Anim"); - // SetMotionFrame(0.0); - // m_MotionSpeed = 2.0f; - // Update(0.0f); - - // Changes are not going to be recognized if - // update is not called. - - virtual void Update(float in_DeltaTime = 0.0f); - virtual void Render(void*); + ~CScene(); + void Update(float in_DeltaTime = 0.0f); + void Render(void* in_pUnk); RCPtr GetNode(const char* in_pName) const; @@ -62,3 +49,5 @@ namespace Chao::CSD void SetScale(float in_X, float in_Y); }; } + +#include "CSD/Manager/csdmScene.inl" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmScene.inl b/UnleashedRecomp/api/CSD/Manager/csdmScene.inl index c045987d..c5a77f1e 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmScene.inl +++ b/UnleashedRecomp/api/CSD/Manager/csdmScene.inl @@ -1,5 +1,20 @@ namespace Chao::CSD { + inline CScene::~CScene() + { + SWA_VIRTUAL_FUNCTION(void, 0, this); + } + + inline void CScene::Update(float in_DeltaTime) + { + SWA_VIRTUAL_FUNCTION(void, 2, this, in_DeltaTime); + } + + inline void CScene::Render(void* in_pUnk) + { + SWA_VIRTUAL_FUNCTION(void, 3, this, in_pUnk); + } + inline RCPtr CScene::GetNode(const char* in_pName) const { RCPtr rcNode; diff --git a/UnleashedRecomp/api/CSD/Manager/csdmSceneObserver.h b/UnleashedRecomp/api/CSD/Manager/csdmSceneObserver.h index a238062f..2e6abb2c 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmSceneObserver.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmSceneObserver.h @@ -6,7 +6,5 @@ namespace Chao::CSD { class CScene; - class CSceneObserver : public CObserverBase - { - }; + class CSceneObserver : public CObserverBase {}; } diff --git a/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.h b/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.h index 2570e24c..cb420c30 100644 --- a/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.h +++ b/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.h @@ -8,9 +8,18 @@ namespace Chao::CSD class SubjectBase { public: + struct Vftable + { + be m_fpDtor; + be m_fpGetObservee; + }; + + xpointer m_pVftable; SWA_INSERT_PADDING(0x0C); - virtual ~SubjectBase() = default; - virtual TObservee* GetObservee() const { return nullptr; } + ~SubjectBase(); + TObservee* GetObservee() const; }; } + +#include "CSD/Manager/csdmSubjectBase.inl" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.inl b/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.inl new file mode 100644 index 00000000..9c9b7f8f --- /dev/null +++ b/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.inl @@ -0,0 +1,14 @@ +namespace Chao::CSD +{ + template + inline SubjectBase::~SubjectBase() + { + GuestToHostFunction(m_pVftable->m_fpDtor, this); + } + + template + inline TObservee* SubjectBase::GetObservee() const + { + return nullptr; + } +} diff --git a/UnleashedRecomp/api/CSD/Platform/csdTexList.h b/UnleashedRecomp/api/CSD/Platform/csdTexList.h index 3f5f162c..88fb7c81 100644 --- a/UnleashedRecomp/api/CSD/Platform/csdTexList.h +++ b/UnleashedRecomp/api/CSD/Platform/csdTexList.h @@ -8,8 +8,16 @@ namespace Chao::CSD class CTexList : public CBase { public: + struct Vftable + { + be m_fpDtor; + }; + + xpointer m_pVftable; RCPtr m_rcData; - virtual ~CTexList() = default; + ~CTexList(); }; } + +#include "CSD/Platform/csdTexList.inl" diff --git a/UnleashedRecomp/api/CSD/Platform/csdTexList.inl b/UnleashedRecomp/api/CSD/Platform/csdTexList.inl new file mode 100644 index 00000000..14835026 --- /dev/null +++ b/UnleashedRecomp/api/CSD/Platform/csdTexList.inl @@ -0,0 +1,7 @@ +namespace Chao::CSD +{ + inline CTexList::~CTexList() + { + GuestToHostFunction(m_pVftable->m_fpDtor, this); + } +} diff --git a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h index 7bfdb4f9..8552a514 100644 --- a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h +++ b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h @@ -15,11 +15,18 @@ namespace Hedgehog::Database class CDatabaseData : public Base::CObject { public: - uint8_t m_Flags; // see EDatabaseDataFlags - SWA_INSERT_PADDING(0x04); // TODO: Base::CSharedString m_TypeAndName; + struct Vftable + { + be m_fpDtor; + be m_fpCheckMadeAll; + }; - virtual ~CDatabaseData() = default; - virtual bool CheckMadeAll(); + xpointer m_pVftable; + uint8_t m_Flags; + Base::CSharedString m_TypeAndName; + + ~CDatabaseData(); + bool CheckMadeAll(); bool IsMadeOne() const; void SetMadeOne(); diff --git a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl index b544a718..7e3e383f 100644 --- a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl +++ b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl @@ -1,5 +1,10 @@ namespace Hedgehog::Database { + inline CDatabaseData::~CDatabaseData() + { + GuestToHostFunction(m_pVftable->m_fpDtor, this); + } + inline bool CDatabaseData::CheckMadeAll() { return true; diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/Renderable/hhRenderable.h b/UnleashedRecomp/api/Hedgehog/MirageCore/Renderable/hhRenderable.h index ccca4133..73fd409e 100644 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/Renderable/hhRenderable.h +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/Renderable/hhRenderable.h @@ -8,7 +8,7 @@ namespace Hedgehog::Mirage class CRenderable : public Base::CObject { public: + xpointer m_pVftable; bool m_Enabled; - be m_SortDepth; }; } diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateUnit.h b/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateUnit.h index 0abcd3c5..64513e66 100644 --- a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateUnit.h +++ b/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateUnit.h @@ -8,8 +8,8 @@ namespace Hedgehog::Universe class CUpdateUnit : public Base::CObject, public IParallelJob { public: - SWA_INSERT_PADDING(0x04); // vftable ptr - SWA_INSERT_PADDING(0x24); + xpointer m_pVftable; + SWA_INSERT_PADDING(0x20); CUpdateUnit(const swa_null_ctor& nil) : CObject(nil), IParallelJob(nil) {} CUpdateUnit(); diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Thread/hhParallelJob.h b/UnleashedRecomp/api/Hedgehog/Universe/Thread/hhParallelJob.h index bac80820..60b59be3 100644 --- a/UnleashedRecomp/api/Hedgehog/Universe/Thread/hhParallelJob.h +++ b/UnleashedRecomp/api/Hedgehog/Universe/Thread/hhParallelJob.h @@ -8,7 +8,7 @@ namespace Hedgehog::Universe class IParallelJob { public: - SWA_INSERT_PADDING(0x04); // vftable ptr + xpointer m_pVftable; IParallelJob() {} IParallelJob(const swa_null_ctor&) {} diff --git a/UnleashedRecomp/api/SWA.h b/UnleashedRecomp/api/SWA.h index 46c23437..f63fa8d6 100644 --- a/UnleashedRecomp/api/SWA.h +++ b/UnleashedRecomp/api/SWA.h @@ -38,9 +38,15 @@ #include "SWA/CSD/GameObjectCSD.h" #include "SWA/HUD/Loading/Loading.h" #include "SWA/HUD/Pause/HudPause.h" +#include "SWA/HUD/Sonic/HudSonicStage.h" +#include "SWA/Movie/MovieDisplayer.h" +#include "SWA/Movie/MovieManager.h" #include "SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h" #include "SWA/Player/Character/EvilSonic/EvilSonic.h" #include "SWA/Player/Character/EvilSonic/EvilSonicContext.h" +#include "SWA/Sequence/Unit/SequenceUnitBase.h" +#include "SWA/Sequence/Unit/SequenceUnitPlayMovie.h" +#include "SWA/Sequence/Utility/SequencePlayMovieWrapper.h" #include "SWA/Sound/Sound.h" #include "SWA/Sound/SoundBGMActSonic.h" #include "SWA/Sound/SoundBGMBase.h" @@ -48,6 +54,7 @@ #include "SWA/System/GameMode/Title/TitleStateBase.h" #include "SWA/System/GameMode/GameMode.h" #include "SWA/System/GameMode/GameModeStage.h" +#include "SWA/System/GameMode/GameModeStageMovie.h" #include "SWA/System/Application.h" #include "SWA/System/ApplicationD3D9.h" #include "SWA/System/ApplicationXenon.h" diff --git a/UnleashedRecomp/api/SWA.inl b/UnleashedRecomp/api/SWA.inl index b83b15eb..3582348d 100644 --- a/UnleashedRecomp/api/SWA.inl +++ b/UnleashedRecomp/api/SWA.inl @@ -9,4 +9,7 @@ #define SWA_INSERT_PADDING(length) \ uint8_t SWA_CONCAT2(pad, __LINE__)[length] +#define SWA_VIRTUAL_FUNCTION(returnType, virtualIndex, ...) \ + GuestToHostFunction(*(be*)(g_memory.Translate(*(be*)(this) + (4 * virtualIndex))), __VA_ARGS__) + struct swa_null_ctor {}; diff --git a/UnleashedRecomp/api/SWA/CSD/GameObjectCSD.h b/UnleashedRecomp/api/SWA/CSD/GameObjectCSD.h index b4325c65..5049fdb0 100644 --- a/UnleashedRecomp/api/SWA/CSD/GameObjectCSD.h +++ b/UnleashedRecomp/api/SWA/CSD/GameObjectCSD.h @@ -14,6 +14,7 @@ namespace SWA class CGameObjectCSD : public CGameObject { public: + xpointer m_pVftable; Chao::CSD::RCPtr m_rcProject; }; } diff --git a/UnleashedRecomp/api/SWA/Camera/Camera.h b/UnleashedRecomp/api/SWA/Camera/Camera.h index b64c24b6..1d3db6c6 100644 --- a/UnleashedRecomp/api/SWA/Camera/Camera.h +++ b/UnleashedRecomp/api/SWA/Camera/Camera.h @@ -8,6 +8,7 @@ namespace SWA class CCamera : public CGameObject // , public Hedgehog::Universe::TStateMachine { public: + xpointer m_pVftable; SWA_INSERT_PADDING(0xC4); be m_VertAspectRatio; SWA_INSERT_PADDING(0x48); diff --git a/UnleashedRecomp/api/SWA/HUD/Pause/HudPause.h b/UnleashedRecomp/api/SWA/HUD/Pause/HudPause.h index 72406351..a6f53311 100644 --- a/UnleashedRecomp/api/SWA/HUD/Pause/HudPause.h +++ b/UnleashedRecomp/api/SWA/HUD/Pause/HudPause.h @@ -46,6 +46,7 @@ namespace SWA class CHudPause : public CGameObject { public: + xpointer m_pVftable; SWA_INSERT_PADDING(0xC8); be m_Action; be m_Menu; diff --git a/UnleashedRecomp/api/SWA/HUD/Sonic/HudSonicStage.h b/UnleashedRecomp/api/SWA/HUD/Sonic/HudSonicStage.h new file mode 100644 index 00000000..59e2d070 --- /dev/null +++ b/UnleashedRecomp/api/SWA/HUD/Sonic/HudSonicStage.h @@ -0,0 +1,22 @@ +#pragma once + +#include + +namespace SWA +{ + class CHudSonicStage + { + public: + SWA_INSERT_PADDING(0xE0); + Chao::CSD::RCPtr m_rcPlayScreen; + Chao::CSD::RCPtr m_rcSpeedGauge; + Chao::CSD::RCPtr m_rcRingEnergyGauge; + Chao::CSD::RCPtr m_rcGaugeFrame; + SWA_INSERT_PADDING(0x28); + Chao::CSD::RCPtr m_rcScoreCount; + Chao::CSD::RCPtr m_rcTimeCount; + Chao::CSD::RCPtr m_rcTimeCount2; + Chao::CSD::RCPtr m_rcTimeCount3; + Chao::CSD::RCPtr m_rcPlayerCount; + }; +} diff --git a/UnleashedRecomp/api/SWA/Movie/MovieDisplayer.h b/UnleashedRecomp/api/SWA/Movie/MovieDisplayer.h new file mode 100644 index 00000000..64e13e34 --- /dev/null +++ b/UnleashedRecomp/api/SWA/Movie/MovieDisplayer.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace SWA +{ + class CMovieDisplayer : public Hedgehog::Universe::CUpdateUnit, public Hedgehog::Mirage::CRenderable + { + public: + SWA_INSERT_PADDING(0x04); + be m_MovieWidth; + be m_MovieHeight; + }; +} diff --git a/UnleashedRecomp/api/SWA/Movie/MovieManager.h b/UnleashedRecomp/api/SWA/Movie/MovieManager.h new file mode 100644 index 00000000..4de3429e --- /dev/null +++ b/UnleashedRecomp/api/SWA/Movie/MovieManager.h @@ -0,0 +1,17 @@ +#pragma once + +#include + +namespace SWA +{ + class CMovieManager // : Hedgehog::Base::TSingleton + { + public: + static CMovieManager* GetInstance(); + + xpointer m_pVftable; + SWA_INSERT_PADDING(0x330); + }; +} + +#include "SWA/Movie/MovieManager.inl" diff --git a/UnleashedRecomp/api/SWA/Movie/MovieManager.inl b/UnleashedRecomp/api/SWA/Movie/MovieManager.inl new file mode 100644 index 00000000..e9412070 --- /dev/null +++ b/UnleashedRecomp/api/SWA/Movie/MovieManager.inl @@ -0,0 +1,7 @@ +namespace SWA +{ + inline CMovieManager* CMovieManager::GetInstance() + { + return *(xpointer*)MmGetHostAddress(0x8336758C); + } +} diff --git a/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h b/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h index 6330ab2e..d872fe48 100644 --- a/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h +++ b/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h @@ -21,6 +21,7 @@ namespace SWA::Player class CEvilHudGuide : public CGameObject { public: + xpointer m_pVftable; SWA_INSERT_PADDING(0x8D); bool m_IsShown; bool m_IsVisible; diff --git a/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitBase.h b/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitBase.h new file mode 100644 index 00000000..d45387f2 --- /dev/null +++ b/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitBase.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +namespace SWA::Sequence::Unit +{ + class CUnitBase : public Hedgehog::Base::CObject + { + public: + xpointer m_pVftable; + SWA_INSERT_PADDING(0x14); + }; +} diff --git a/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitPlayMovie.h b/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitPlayMovie.h new file mode 100644 index 00000000..b7f64e36 --- /dev/null +++ b/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitPlayMovie.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace SWA::Sequence::Unit +{ + class CPlayMovieUnit : public CUnitBase {}; +} diff --git a/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h b/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h index c225c01a..a73c7add 100644 --- a/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h +++ b/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h @@ -7,16 +7,33 @@ namespace SWA::Sequence::Utility { class CPlayMovieWrapper { + public: class CRender : public Hedgehog::Mirage::CRenderable { - SWA_INSERT_PADDING(0x08); + public: be m_ScreenWidth; be m_ScreenHeight; be m_MovieWidth; be m_MovieHeight; + SWA_INSERT_PADDING(0x74); + be m_TopLeftX; + be m_TopLeftY; + SWA_INSERT_PADDING(0x0C); + be m_TopRightX; + be m_TopRightY; + SWA_INSERT_PADDING(0x0C); + be m_BottomRightX; + be m_BottomRightY; + SWA_INSERT_PADDING(0x0C); + be m_BottomLeftX; + be m_BottomLeftY; + SWA_INSERT_PADDING(0xD4); + bool m_MaintainAspectRatio; + SWA_INSERT_PADDING(0x18); + be m_TimeElapsed; }; SWA_INSERT_PADDING(0x18); - CRender* m_pRender; + xpointer m_pRender; }; } diff --git a/UnleashedRecomp/api/SWA/Sound/Sound.h b/UnleashedRecomp/api/SWA/Sound/Sound.h index 86969f30..d43c43a7 100644 --- a/UnleashedRecomp/api/SWA/Sound/Sound.h +++ b/UnleashedRecomp/api/SWA/Sound/Sound.h @@ -49,7 +49,8 @@ namespace SWA SWA_INSERT_PADDING(0x58); }; - SWA_INSERT_PADDING(0x04); // vftable ptr + xpointer m_pVftable; + SWA_INSERT_PADDING(0x04); xpointer m_pMember; }; } diff --git a/UnleashedRecomp/api/SWA/System/ApplicationDocument.h b/UnleashedRecomp/api/SWA/System/ApplicationDocument.h index 37a76e82..6dfdc7da 100644 --- a/UnleashedRecomp/api/SWA/System/ApplicationDocument.h +++ b/UnleashedRecomp/api/SWA/System/ApplicationDocument.h @@ -21,6 +21,12 @@ namespace SWA eVoiceLanguage_Japanese }; + enum ERegion : uint32_t + { + eRegion_Japan, + eRegion_RestOfWorld + }; + class CApplicationDocument : public Hedgehog::Base::CSynchronizedObject { public: @@ -39,8 +45,10 @@ namespace SWA xpointer m_pMember; be m_Language; be m_VoiceLanguage; - SWA_INSERT_PADDING(0x0D); - bool m_Subtitles; + SWA_INSERT_PADDING(0x08); + be m_Region; + bool m_InspireVoices; + bool m_InspireSubtitles; }; } diff --git a/UnleashedRecomp/api/SWA/System/GameMode/GameModeStage.h b/UnleashedRecomp/api/SWA/System/GameMode/GameModeStage.h index c99d4a17..eeba70c5 100644 --- a/UnleashedRecomp/api/SWA/System/GameMode/GameModeStage.h +++ b/UnleashedRecomp/api/SWA/System/GameMode/GameModeStage.h @@ -4,5 +4,10 @@ namespace SWA { - class CGameModeStage : public CGameMode {}; + class CGameModeStage : public CGameMode + { + public: + xpointer m_pVftable; + SWA_INSERT_PADDING(0x1B4); + }; } diff --git a/UnleashedRecomp/api/SWA/System/GameMode/GameModeStageMovie.h b/UnleashedRecomp/api/SWA/System/GameMode/GameModeStageMovie.h new file mode 100644 index 00000000..e1a95df4 --- /dev/null +++ b/UnleashedRecomp/api/SWA/System/GameMode/GameModeStageMovie.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +namespace SWA +{ + class CGameModeStageMovie : public CGameModeStage + { + public: + class CRender : public Hedgehog::Mirage::CRenderable + { + public: + xpointer m_pThis; + }; + + xpointer m_pVftable; + SWA_INSERT_PADDING(0x224); + xpointer m_pRender; + }; +} diff --git a/UnleashedRecomp/patches/misc_patches.cpp b/UnleashedRecomp/patches/misc_patches.cpp index d645b9f2..6020980e 100644 --- a/UnleashedRecomp/patches/misc_patches.cpp +++ b/UnleashedRecomp/patches/misc_patches.cpp @@ -26,7 +26,7 @@ void ToggleSubtitlesMidAsmHook(PPCRegister& r27) { auto pApplicationDocument = (SWA::CApplicationDocument*)g_memory.Translate(r27.u32); - pApplicationDocument->m_Subtitles = Config::Subtitles; + pApplicationDocument->m_InspireSubtitles = Config::Subtitles; } void WerehogBattleMusicMidAsmHook(PPCRegister& r11)