Move over function-pointers changes from options-menu branch.

This commit is contained in:
Skyth 2024-11-25 13:44:43 +03:00
parent 72fdf5b1a6
commit 8744acae5e
73 changed files with 988 additions and 173 deletions

View file

@ -2,7 +2,5 @@
namespace Chao::CSD
{
class CBase
{
};
class CBase {};
}

View file

@ -0,0 +1,8 @@
#pragma once
#include <SWA.inl>
namespace Chao::CSD
{
class CMotionPattern : CBase {};
}

View file

@ -13,13 +13,15 @@ namespace Chao::CSD
class CNode : public CResourceBase<Node>, SubjectBase<CNodeObserver, CNode>, CBase
{
public:
SWA_INSERT_PADDING(0x4C);
SWA_INSERT_PADDING(0x34);
xpointer<CMotionPattern> m_pMotionPattern;
SWA_INSERT_PADDING(0x18);
~CNode() override = default;
~CNode();
void SetText(const char* in_pText);
void SetText(const wchar_t* in_pText);
Hedgehog::Math::CVector2 GetPosition() const;
Hedgehog::Math::CVector2* GetPosition() const;
void SetPosition(float in_X, float in_Y);
void SetHideFlag(uint32_t in_HideFlag);
void SetRotation(float in_Rotation);

View file

@ -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<int>(0x830BF640, this, in_pText);
@ -12,11 +17,11 @@ namespace Chao::CSD
GuestToHostFunction<int>(0x830BF640, this, in_pText);
}
inline Hedgehog::Math::CVector2 CNode::GetPosition() const
inline Hedgehog::Math::CVector2* CNode::GetPosition() const
{
Hedgehog::Math::CVector2 position;
GuestToHostFunction<void>(0x830BF008, this, &position);
return position;
guest_stack_var<Hedgehog::Math::CVector2> pos;
GuestToHostFunction<void>(0x830BF008, pos.get(), this);
return pos.get();
}
inline void CNode::SetPosition(float in_X, float in_Y)

View file

@ -6,7 +6,5 @@ namespace Chao::CSD
{
class CNode;
class CNodeObserver : public CObserverBase<CNode>
{
};
class CNodeObserver : public CObserverBase<CNode> {};
}

View file

@ -8,8 +8,16 @@ namespace Chao::CSD
class CObserverBase
{
public:
SWA_INSERT_PADDING(0x0C);
struct Vftable
{
be<uint32_t> m_fpDtor;
};
virtual ~CObserverBase() = default;
xpointer<Vftable> m_pVftable;
SWA_INSERT_PADDING(0x08);
~CObserverBase();
};
}
#include "CSD/Manager/csdmObserverBase.inl"

View file

@ -0,0 +1,8 @@
namespace Chao::CSD
{
template<typename TObservee>
inline CObserverBase<TObservee>::~CObserverBase()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
}

View file

@ -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<uint32_t> m_fpDtor;
be<uint32_t> m_fpDeallocate;
};
xpointer<Vftable> m_pVftable;
xpointer<void> m_pMemory;
be<uint32_t> m_RefCount;
xpointer<void> m_pDealloctor;
be<uint32_t> m_eDealloctor;
virtual ~RCObject();
virtual void Deallocate(void* in_pMemory) = 0;
~RCObject();
void Deallocate(void* in_pMemory);
void Release();
};
}
#include "CSD/Manager/csdmRCObject.inl"

View file

@ -1,13 +1,14 @@
namespace Chao::CSD
{
inline void RCPtrAbs::RCObject::Release()
inline RCPtrAbs::RCObject::~RCObject()
{
GuestToHostFunction<void>(0x830BA068, this);
GuestToHostFunction<void>(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<void>(m_pVftable->m_fpDeallocate, this, in_pMemory);
}
inline void RCPtrAbs::RCObject::Release()
{
GuestToHostFunction<void>(0x830BA068, this);
}
}

View file

@ -5,8 +5,5 @@
namespace Chao::CSD
{
template<typename T>
class RCPtr<T>::RCObjectImp : public RCObject
{
void Deallocate(void* in_pMemory) override;
};
class RCPtr<T>::RCObjectImp : public RCObject {};
}

View file

@ -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"

View file

@ -9,6 +9,13 @@ namespace Chao::CSD
public:
class RCObject;
struct Vftable
{
be<uint32_t> m_fpDtor;
be<uint32_t> m_fpCreateRCObject;
};
xpointer<Vftable> m_pVftable;
xpointer<RCObject> 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"

View file

@ -20,6 +20,11 @@ namespace Chao::CSD
in_rPtr.m_pObject = nullptr;
}
inline RCPtrAbs::RCObject* RCPtrAbs::CreateRCObject()
{
return GuestToHostFunction<RCPtrAbs::RCObject*>(m_pVftable->m_fpCreateRCObject, this);
}
inline void RCPtrAbs::AttachAbs(void* in_pMemory)
{
GuestToHostFunction<void>(0x830BA298, this, in_pMemory);

View file

@ -8,11 +8,19 @@ namespace Chao::CSD
class CResourceBase
{
public:
struct Vftable
{
be<uint32_t> m_fpDtor;
be<uint32_t> m_fpCopyResource;
};
xpointer<Vftable> m_pVftable;
RCPtr<uint8_t> m_rcResourceHolder;
xpointer<T> m_pResource;
virtual ~CResourceBase() = default;
virtual void CopyResource(const CResourceBase& in_rOther);
~CResourceBase();
void CopyResource(const CResourceBase& in_rOther);
};
}
#include "CSD/Manager/csdmResourceBase.h"

View file

@ -1,7 +1,13 @@
namespace Chao::CSD
{
template<typename T>
void CResourceBase<T>::CopyResource(const CResourceBase& in_rOther)
inline CResourceBase<T>::~CResourceBase()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
template<typename T>
inline void CResourceBase<T>::CopyResource(const CResourceBase& in_rOther)
{
m_rcResourceHolder = in_rOther.m_rcResourceHolder;
m_pResource = in_rOther.m_pResource;

View file

@ -23,7 +23,7 @@ namespace Chao::CSD
class CScene : public CResourceBase<Scene>, SubjectBase<CSceneObserver, CScene>, CBase
{
public:
SWA_INSERT_PADDING(0x5C);
SWA_INSERT_PADDING(0x60);
be<float> m_PrevMotionFrame;
be<float> m_MotionFrame;
be<float> m_MotionSpeed;
@ -35,24 +35,11 @@ namespace Chao::CSD
be<EMotionRepeatType> m_MotionRepeatType;
SWA_INSERT_PADDING(0x2C);
~CScene() override = default;
~CScene();
void Update(float in_DeltaTime = 0.0f);
void Render(void* in_pUnk);
// 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*);
RCPtr<CNode> GetNode(const char* in_pName) const;
void GetNode(RCPtr<CNode>& out_rResult, const char* in_pName);
bool SetMotion(const char* in_pName);
void SetMotionFrame(float in_MotionFrame);
@ -62,3 +49,5 @@ namespace Chao::CSD
void SetScale(float in_X, float in_Y);
};
}
#include "CSD/Manager/csdmScene.inl"

View file

@ -1,10 +1,23 @@
namespace Chao::CSD
{
inline RCPtr<CNode> CScene::GetNode(const char* in_pName) const
inline CScene::~CScene()
{
RCPtr<CNode> rcNode;
GuestToHostFunction<void>(0x830BCCA8, this, rcNode, in_pName);
return rcNode;
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 void CScene::GetNode(RCPtr<CNode>& out_rResult, const char* in_pName)
{
GuestToHostFunction<void>(sub_830BCCA8, &out_rResult, this, in_pName);
}
inline bool CScene::SetMotion(const char* in_pName)

View file

@ -6,7 +6,5 @@ namespace Chao::CSD
{
class CScene;
class CSceneObserver : public CObserverBase<CScene>
{
};
class CSceneObserver : public CObserverBase<CScene> {};
}

View file

@ -8,9 +8,18 @@ namespace Chao::CSD
class SubjectBase
{
public:
struct Vftable
{
be<uint32_t> m_fpDtor;
be<uint32_t> m_fpGetObservee;
};
xpointer<Vftable> m_pVftable;
SWA_INSERT_PADDING(0x0C);
virtual ~SubjectBase() = default;
virtual TObservee* GetObservee() const { return nullptr; }
~SubjectBase();
TObservee* GetObservee() const;
};
}
#include "CSD/Manager/csdmSubjectBase.inl"

View file

@ -0,0 +1,14 @@
namespace Chao::CSD
{
template<typename TObserver, typename TObservee>
inline SubjectBase<TObserver, TObservee>::~SubjectBase()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
template<typename TObserver, typename TObservee>
inline TObservee* SubjectBase<TObserver, TObservee>::GetObservee() const
{
return nullptr;
}
}

View file

@ -8,8 +8,16 @@ namespace Chao::CSD
class CTexList : public CBase
{
public:
struct Vftable
{
be<uint32_t> m_fpDtor;
};
xpointer<Vftable> m_pVftable;
RCPtr<uint8_t> m_rcData;
virtual ~CTexList() = default;
~CTexList();
};
}
#include "CSD/Platform/csdTexList.inl"

View file

@ -0,0 +1,7 @@
namespace Chao::CSD
{
inline CTexList::~CTexList()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
}

View file

@ -20,7 +20,7 @@ namespace Hedgehog::Base
const size_t memSize = GetMemorySize(in_Length);
const size_t memSizeAligned = GetMemorySizeAligned(in_Length);
SStringHolder* pHolder = (SStringHolder*)__HH_ALLOC(memSizeAligned);
auto pHolder = (SStringHolder*)__HH_ALLOC(memSizeAligned);
pHolder->RefCount = 1;
pHolder->Length = (uint16_t)in_Length;

View file

@ -332,7 +332,7 @@ namespace Hedgehog::Base
inline int CSharedString::compare(const CSharedString& in_rOther) const
{
// TODO: DO NOT PASS BY REFERENCE.
GuestToHostFunction<int>(0x82DFB028, this, &in_rOther);
return GuestToHostFunction<int>(0x82DFB028, this, &in_rOther);
}
inline CSharedString& CSharedString::operator=(const CSharedString& in_rOther)

View file

@ -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<uint32_t> m_fpDtor;
be<uint32_t> m_fpCheckMadeAll;
};
virtual ~CDatabaseData() = default;
virtual bool CheckMadeAll();
xpointer<Vftable> m_pVftable;
uint8_t m_Flags;
Base::CSharedString m_TypeAndName;
~CDatabaseData();
bool CheckMadeAll();
bool IsMadeOne() const;
void SetMadeOne();

View file

@ -1,5 +1,10 @@
namespace Hedgehog::Database
{
inline CDatabaseData::~CDatabaseData()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
inline bool CDatabaseData::CheckMadeAll()
{
return true;

View file

@ -8,7 +8,7 @@ namespace Hedgehog::Mirage
class CRenderable : public Base::CObject
{
public:
xpointer<void> m_pVftable;
bool m_Enabled;
be<float> m_SortDepth;
};
}

View file

@ -9,6 +9,6 @@ namespace Hedgehog::Universe
class CMessageActor : public IMessageProcess, public IParallelJob
{
public:
SWA_INSERT_PADDING(0x7C);
SWA_INSERT_PADDING(0x88);
};
}

View file

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "SWA.inl"
#include "Hedgehog/Universe/Thread/hhParallelJob.h"
@ -8,15 +8,18 @@ namespace Hedgehog::Universe
class CUpdateUnit : public Base::CObject, public IParallelJob
{
public:
SWA_INSERT_PADDING(0x24);
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0x20);
CUpdateUnit(const swa_null_ctor& nil) : CObject(nil), IParallelJob(nil) {}
CUpdateUnit();
virtual ~CUpdateUnit();
virtual void ExecuteParallelJob(const SUpdateInfo& in_rUpdateInfo) override;
virtual void UpdateParallel(const SUpdateInfo& in_rUpdateInfo) {}
virtual void UpdateSerial(const SUpdateInfo& in_rUpdateInfo) {}
// TODO: implement virtual functions.
// virtual ~CUpdateUnit();
//
// virtual void ExecuteParallelJob(const SUpdateInfo& in_rUpdateInfo) override;
//
// virtual void UpdateParallel(const SUpdateInfo& in_rUpdateInfo) {}
// virtual void UpdateSerial(const SUpdateInfo& in_rUpdateInfo) {}
};
}

View file

@ -8,11 +8,14 @@ namespace Hedgehog::Universe
class IParallelJob
{
public:
xpointer<void> m_pVftable;
IParallelJob() {}
IParallelJob(const swa_null_ctor&) {}
virtual ~IParallelJob() = default;
virtual void ExecuteParallelJob(const SUpdateInfo& in_rUpdateInfo) = 0;
// TODO: implement virtual functions.
// virtual ~IParallelJob() = default;
//
// virtual void ExecuteParallelJob(const SUpdateInfo& in_rUpdateInfo) = 0;
};
}

View file

@ -17,6 +17,7 @@
#include "Hedgehog/Universe/Thread/hhParallelJob.h"
#include "CSD/Manager/csdmBase.h"
#include "CSD/Manager/csdmMotionPattern.h"
#include "CSD/Manager/csdmNode.h"
#include "CSD/Manager/csdmNodeObserver.h"
#include "CSD/Manager/csdmObserverBase.h"
@ -36,10 +37,32 @@
#include "SWA/CSD/CsdProject.h"
#include "SWA/CSD/CsdTexListMirage.h"
#include "SWA/CSD/GameObjectCSD.h"
#include "SWA/HUD/GeneralWindow/GeneralWindow.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"
#include "SWA/System/GameMode/Title/TitleMenu.h"
#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"
#include "SWA/System/ApplicationDocument.h"
#include "SWA/System/Game.h"
#include "SWA/System/GameDocument.h"
#include "SWA/System/GameObject.h"
#include "SWA/System/InputState.h"
#include "SWA/System/PadState.h"

View file

@ -1,6 +1,7 @@
#pragma once
#include <cpu/guest_code.h>
#include <cpu/guest_stack_var.h>
#include <kernel/function.h>
#define SWA__CONCAT2(x, y) x##y
@ -9,4 +10,7 @@
#define SWA_INSERT_PADDING(length) \
uint8_t SWA_CONCAT2(pad, __LINE__)[length]
#define SWA_VIRTUAL_FUNCTION(returnType, virtualIndex, ...) \
GuestToHostFunction<returnType>(*(be<uint32_t>*)(g_memory.Translate(*(be<uint32_t>*)(this) + (4 * virtualIndex))), __VA_ARGS__)
struct swa_null_ctor {};

View file

@ -14,7 +14,7 @@ namespace SWA
class CGameObjectCSD : public CGameObject
{
public:
xpointer<void> m_pVftable;
Chao::CSD::RCPtr<Chao::CSD::CProject> m_rcProject;
SWA_INSERT_PADDING(0x38);
};
}

View file

@ -1,13 +1,15 @@
#pragma once
#include "SWA.inl"
#include <SWA.inl>
#include <SWA/System/GameObject.h>
namespace SWA
{
class CCamera // : public CGameObject, public Hedgehog::Universe::TStateMachine<CCamera>
class CCamera : public CGameObject // , public Hedgehog::Universe::TStateMachine<CCamera>
{
public:
SWA_INSERT_PADDING(0x184);
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0xC4);
be<float> m_VertAspectRatio;
SWA_INSERT_PADDING(0x48);
be<float> m_HorzAspectRatio;
@ -15,5 +17,8 @@ namespace SWA
be<float> m_FieldOfView;
be<float> m_VertFieldOfView;
be<float> m_HorzFieldOfView;
SWA_INSERT_PADDING(0x18);
bool m_InvertY;
bool m_InvertX;
};
}

View file

@ -0,0 +1,18 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CGeneralWindow
{
public:
SWA_INSERT_PADDING(0xD0);
Chao::CSD::RCPtr<Chao::CSD::CProject> m_rcGeneral;
Chao::CSD::RCPtr<Chao::CSD::CScene> m_rcBg;
Chao::CSD::RCPtr<Chao::CSD::CScene> m_rcWindow;
Chao::CSD::RCPtr<Chao::CSD::CScene> m_rcWindow_2;
Chao::CSD::RCPtr<Chao::CSD::CScene> m_rcWindowSelect;
Chao::CSD::RCPtr<Chao::CSD::CScene> m_rcFooter;
};
}

View file

@ -0,0 +1,30 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
enum ELoadingDisplayType
{
eLoadingDisplayType_MilesElectric,
eLoadingDisplayType_None,
eLoadingDisplayType_WerehogMovie,
eLoadingDisplayType_MilesElectricContext,
eLoadingDisplayType_Arrows,
eLoadingDisplayType_NowLoading,
eLoadingDisplayType_EventGallery,
eLoadingDisplayType_ChangeTimeOfDay,
eLoadingDisplayType_Blank
};
class CLoading
{
public:
SWA_INSERT_PADDING(0x128);
bool m_IsVisible;
SWA_INSERT_PADDING(0x0C);
be<ELoadingDisplayType> m_LoadingDisplayType;
SWA_INSERT_PADDING(0x65);
bool m_IsNightToDay;
};
}

View file

@ -0,0 +1,67 @@
#pragma once
#include <SWA.inl>
using namespace Chao::CSD;
namespace SWA
{
enum EActionType : uint32_t
{
eActionType_Undefined,
eActionType_Status,
eActionType_Return,
eActionType_Inventory,
eActionType_Skills,
eActionType_Lab,
eActionType_Wait,
eActionType_Restart = 8,
eActionType_Continue
};
enum EMenuType : uint32_t
{
eMenuType_WorldMap,
eMenuType_Village,
eMenuType_Stage,
eMenuType_Hub,
eMenuType_Misc
};
enum EStatusType : uint32_t
{
eStatusType_Idle,
eStatusType_Accept,
eStatusType_Decline
};
enum ETransitionType : uint32_t
{
eTransitionType_Undefined,
eTransitionType_Quit = 2,
eTransitionType_Dialog = 5,
eTransitionType_Hide,
eTransitionType_Abort,
eTransitionType_SubMenu
};
class CHudPause : public CGameObject
{
public:
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0x2C);
RCPtr<CProject> m_rcPause;
RCPtr<CScene> m_rcBg;
RCPtr<CScene> m_rcBg1;
RCPtr<CScene> m_rcBg1_2;
RCPtr<CScene> m_rcBg1Select;
RCPtr<CScene> m_rcBg1Select_2;
RCPtr<CScene> m_rcStatusTitle;
RCPtr<CScene> m_rcFooterA;
SWA_INSERT_PADDING(0x5C);
be<EActionType> m_Action;
be<EMenuType> m_Menu;
be<EStatusType> m_Status;
be<ETransitionType> m_Transition;
};
}

View file

@ -0,0 +1,22 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CHudSonicStage
{
public:
SWA_INSERT_PADDING(0xE0);
Chao::CSD::RCPtr<Chao::CSD::CProject> m_rcPlayScreen;
Chao::CSD::RCPtr<Chao::CSD::CScene> m_rcSpeedGauge;
Chao::CSD::RCPtr<Chao::CSD::CScene> m_rcRingEnergyGauge;
Chao::CSD::RCPtr<Chao::CSD::CScene> m_rcGaugeFrame;
SWA_INSERT_PADDING(0x28);
Chao::CSD::RCPtr<Chao::CSD::CNode> m_rcScoreCount;
Chao::CSD::RCPtr<Chao::CSD::CNode> m_rcTimeCount;
Chao::CSD::RCPtr<Chao::CSD::CNode> m_rcTimeCount2;
Chao::CSD::RCPtr<Chao::CSD::CNode> m_rcTimeCount3;
Chao::CSD::RCPtr<Chao::CSD::CNode> m_rcPlayerCount;
};
}

View file

@ -0,0 +1,14 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CMovieDisplayer : public Hedgehog::Universe::CUpdateUnit, public Hedgehog::Mirage::CRenderable
{
public:
SWA_INSERT_PADDING(0x04);
be<uint32_t> m_MovieWidth;
be<uint32_t> m_MovieHeight;
};
}

View file

@ -0,0 +1,17 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CMovieManager // : Hedgehog::Base::TSingleton<SWA::CMovieManager, 0>
{
public:
static CMovieManager* GetInstance();
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0x330);
};
}
#include "SWA/Movie/MovieManager.inl"

View file

@ -0,0 +1,7 @@
namespace SWA
{
inline CMovieManager* CMovieManager::GetInstance()
{
return *(xpointer<CMovieManager>*)MmGetHostAddress(0x8336758C);
}
}

View file

@ -5,7 +5,7 @@
namespace SWA::Player
{
class CEvilSonic
class CEvilSonic // : public CPlayer
{
public:
SWA_INSERT_PADDING(0xC4);

View file

@ -18,12 +18,13 @@ namespace SWA::Player
eGuideType_Y
};
class CEvilHudGuide
class CEvilHudGuide : public CGameObject
{
public:
SWA_INSERT_PADDING(0x14D);
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0x8D);
bool m_IsShown;
bool m_IsVisible;
EGuideType m_GuideType;
be<EGuideType> m_GuideType;
};
}

View file

@ -0,0 +1,13 @@
#pragma once
#include <SWA.inl>
namespace SWA::Sequence::Unit
{
class CUnitBase : public Hedgehog::Base::CObject
{
public:
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0x14);
};
}

View file

@ -0,0 +1,8 @@
#pragma once
#include <SWA.inl>
namespace SWA::Sequence::Unit
{
class CPlayMovieUnit : public CUnitBase {};
}

View file

@ -7,16 +7,33 @@ namespace SWA::Sequence::Utility
{
class CPlayMovieWrapper
{
public:
class CRender : public Hedgehog::Mirage::CRenderable
{
SWA_INSERT_PADDING(0x08);
public:
be<uint32_t> m_ScreenWidth;
be<uint32_t> m_ScreenHeight;
be<float> m_MovieWidth;
be<float> m_MovieHeight;
SWA_INSERT_PADDING(0x74);
be<float> m_TopLeftX;
be<float> m_TopLeftY;
SWA_INSERT_PADDING(0x0C);
be<float> m_TopRightX;
be<float> m_TopRightY;
SWA_INSERT_PADDING(0x0C);
be<float> m_BottomRightX;
be<float> m_BottomRightY;
SWA_INSERT_PADDING(0x0C);
be<float> m_BottomLeftX;
be<float> m_BottomLeftY;
SWA_INSERT_PADDING(0xD4);
bool m_MaintainAspectRatio;
SWA_INSERT_PADDING(0x18);
be<float> m_TimeElapsed;
};
SWA_INSERT_PADDING(0x18);
CRender* m_pRender;
xpointer<CRender> m_pRender;
};
}

View file

@ -1,20 +1,56 @@
#pragma once
#include <SWA.inl>
#include <SWA/Sound/SoundBGMBase.h>
namespace SWA
{
class CSound // : public CGameObject
class CSoundAdministrator : public CGameObject
{
public:
struct SSoundInfo
class CSimplePlayer {};
class CBgm
{
public:
SWA_INSERT_PADDING(0x04);
xpointer<void> m_pAdminSimplePlayer;
SWA_INSERT_PADDING(0x04);
xpointer<void> m_pAdminBgm;
xpointer<CSoundAdministrator> m_pThis;
boost::shared_ptr<CSoundBGMBase> m_spSoundBGM;
be<float> m_Volume1;
be<float> m_Volume2;
be<float> m_Volume3;
be<float> m_Volume4;
SWA_INSERT_PADDING(0x10);
};
SWA_INSERT_PADDING(0xC4);
xpointer<SSoundInfo> m_pSoundInfo;
class CCommunicator
{
public:
class CCommunicatorDevice : Hedgehog::Base::CSynchronizedObject
{
public:
SWA_INSERT_PADDING(0x08);
Hedgehog::Base::CSharedString m_HostName;
SWA_INSERT_PADDING(0x04);
Hedgehog::Base::CSharedString m_Category;
Hedgehog::Base::CSharedString m_Command;
SWA_INSERT_PADDING(0x04);
};
xpointer<CSoundAdministrator> m_pThis;
boost::shared_ptr<CCommunicatorDevice> m_spCommunicatorDevice;
};
class CMember
{
public:
boost::shared_ptr<CSimplePlayer> m_spSimplePlayer;
boost::shared_ptr<CBgm> m_spBgm;
boost::shared_ptr<CCommunicator> m_spCommunicator;
SWA_INSERT_PADDING(0x58);
};
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0x04);
xpointer<CMember> m_pMember;
};
}

View file

@ -1,8 +0,0 @@
#pragma once
namespace SWA
{
class CSoundBGMActEvil
{
};
}

View file

@ -0,0 +1,21 @@
#pragma once
#include <SWA.inl>
#include <SWA/Sound/SoundBGMBase.h>
namespace SWA
{
class CSoundBGMActSonic : public CSoundBGMBase
{
public:
class CMember
{
public:
SWA_INSERT_PADDING(0x58);
be<float> m_Volume1;
be<float> m_Volume2;
};
xpointer<CMember> m_pMember;
};
}

View file

@ -0,0 +1,15 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CSoundBGMBase : Hedgehog::Universe::CMessageActor
{
public:
SWA_INSERT_PADDING(0x04); // vftable ptr
SWA_INSERT_PADDING(0x04);
xpointer<CGameDocument> m_pGameDocument;
bool m_Unk;
};
}

View file

@ -0,0 +1,21 @@
#pragma once
#include <SWA.inl>
#include <SWA/System/ApplicationDocument.h>
namespace SWA
{
class CApplication : public Hedgehog::Base::CObject
{
public:
class CMember
{
public:
xpointer<CApplicationDocument> m_pApplicationDocument;
};
xpointer<void> m_pVftable;
xpointer<CMember> m_pMember;
SWA_INSERT_PADDING(0x18);
};
}

View file

@ -0,0 +1,8 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CApplicationD3D9 : public CApplication {};
}

View file

@ -1,24 +1,54 @@
#pragma once
#include <SWA.inl>
#include <SWA/System/Game.h>
namespace SWA
{
class CApplicationDocument // : public Hedgehog::Base::CSynchronizedObject
enum ELanguage : uint32_t
{
eLanguage_English,
eLanguage_Japanese,
eLanguage_German,
eLanguage_French,
eLanguage_Italian,
eLanguage_Spanish
};
enum EVoiceLanguage : uint32_t
{
eVoiceLanguage_English,
eVoiceLanguage_Japanese
};
enum ERegion : uint32_t
{
eRegion_Japan,
eRegion_RestOfWorld
};
class CApplicationDocument : public Hedgehog::Base::CSynchronizedObject
{
public:
class CMember
{
public:
SWA_INSERT_PADDING(0x138);
void* m_spGameParameter;
SWA_INSERT_PADDING(0x20);
boost::shared_ptr<CGame> m_pGame;
SWA_INSERT_PADDING(0x114);
xpointer<void> m_spGameParameter;
};
// TODO: Hedgehog::Base::TSynchronizedPtr<CApplicationDocument>
static CApplicationDocument* GetInstance();
SWA_INSERT_PADDING(0x04);
xpointer<CMember> m_pMember;
SWA_INSERT_PADDING(0x14);
be<uint32_t> m_Region;
be<ELanguage> m_Language;
be<EVoiceLanguage> m_VoiceLanguage;
SWA_INSERT_PADDING(0x08);
be<ERegion> m_Region;
bool m_InspireVoices;
bool m_InspireSubtitles;
};
}

View file

@ -0,0 +1,12 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CApplicationXenon : public CApplicationD3D9
{
public:
SWA_INSERT_PADDING(0x1B4);
};
}

View file

@ -0,0 +1,10 @@
#pragma once
namespace SWA
{
class CGame // : Hedgehog::Universe::TStateMachine<SWA::CGame>
{
public:
SWA_INSERT_PADDING(0xFC);
};
}

View file

@ -1,7 +1,5 @@
#pragma once
#include "SWA/Sound/Sound.h"
namespace Hedgehog::Database
{
class CDatabase;
@ -17,8 +15,8 @@ namespace SWA
public:
SWA_INSERT_PADDING(0x1C);
boost::shared_ptr<Hedgehog::Database::CDatabase> m_spDatabase;
SWA_INSERT_PADDING(0x90);
xpointer<CSound> m_pSound;
SWA_INSERT_PADDING(0x8C);
xpointer<CSoundAdministrator> m_pSoundAdministrator;
SWA_INSERT_PADDING(0x158);
be<uint32_t> m_Score;
};
@ -26,7 +24,7 @@ namespace SWA
// TODO: Hedgehog::Base::TSynchronizedPtr<CGameDocument>
static CGameDocument* GetInstance();
SWA_INSERT_PADDING(0x04);
xpointer<void> m_pVftable;
xpointer<CMember> m_pMember;
};
}

View file

@ -0,0 +1,13 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CGameMode // : Hedgehog::Universe::TStateMachine<SWA::CGame>::TState
{
public:
SWA_INSERT_PADDING(0x60); // base
SWA_INSERT_PADDING(0x08);
};
}

View file

@ -0,0 +1,13 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CGameModeStage : public CGameMode
{
public:
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0x1B4);
};
}

View file

@ -0,0 +1,20 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CGameModeStageMovie : public CGameModeStage
{
public:
class CRender : public Hedgehog::Mirage::CRenderable
{
public:
xpointer<CGameModeStageMovie> m_pThis;
};
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0x224);
xpointer<CRender> m_pRender;
};
}

View file

@ -0,0 +1,13 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CTitleMenu
{
public:
SWA_INSERT_PADDING(0x44);
be<uint32_t> m_CursorIndex;
};
}

View file

@ -0,0 +1,22 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CTitleStateBase // : Hedgehog::Universe::TStateMachine<SWA::CTitleManager>::TState
{
public:
class CMember
{
public:
SWA_INSERT_PADDING(0x1E8);
xpointer<CTitleMenu> m_pTitleMenu;
};
SWA_INSERT_PADDING(0x08);
xpointer<CMember> m_pMember;
SWA_INSERT_PADDING(0x5C);
be<uint32_t> m_State;
};
}

View file

@ -18,9 +18,10 @@ namespace SWA
public:
Hedgehog::Base::TSynchronizedPtr<CGameDocument> m_pGameDocument;
Hedgehog::Base::TSynchronizedPtr<CWorld> m_pWorld;
SWA_INSERT_PADDING(0x78);
SWA_INSERT_PADDING(0x70);
};
xpointer<void> m_pVftable;
xpointer<CMember> m_pMember;
};
}

View file

@ -5,16 +5,14 @@
namespace SWA
{
class CInputState // : public Hedgehog::Base::CSynchronizedObject
class CInputState : public Hedgehog::Base::CSynchronizedObject
{
public:
// TODO: Hedgehog::Base::TSynchronizedPtr<CInputState>
static CInputState* GetInstance();
SPadState m_PadStates[40];
SWA_INSERT_PADDING(0x50);
SPadState m_PadStates[8];
be<uint32_t> m_CurrentPadStateIndex;
SWA_INSERT_PADDING(0x04);
const SPadState& GetPadState() const;
};

View file

@ -3,7 +3,7 @@ namespace SWA
// TODO: Hedgehog::Base::TSynchronizedPtr<CInputState>
inline CInputState* CInputState::GetInstance()
{
return *(xpointer<CInputState>*)MmGetHostAddress(0x833671EC);
return *(xpointer<CInputState>*)MmGetHostAddress(0x83361F5C);
}
inline const SPadState& CInputState::GetPadState() const

View file

@ -43,15 +43,11 @@ namespace SWA
struct SPadState
{
SWA_INSERT_PADDING(0x20);
be<uint32_t> DownState;
be<uint32_t> UpState;
be<uint32_t> TappedState;
be<uint32_t> ReleasedState;
SWA_INSERT_PADDING(0x04);
be<float> LeftStickHorizontal;
be<float> LeftStickVertical;
@ -65,7 +61,7 @@ namespace SWA
be<float> LeftTrigger;
be<float> RightTrigger;
SWA_INSERT_PADDING(0x20);
SWA_INSERT_PADDING(0x08);
bool IsDown(const EKeyState in_Keys) const;
bool IsUp(const EKeyState in_Keys) const;

View file

@ -5,35 +5,117 @@
namespace boost
{
namespace detail
{
class sp_counted_base
{
protected:
struct vftable_t
{
be<uint32_t> destructor;
be<uint32_t> dispose;
be<uint32_t> destroy;
be<uint32_t> get_deleter;
};
xpointer<vftable_t> vftable_;
be<uint32_t> use_count_;
be<uint32_t> weak_count_;
public:
// TODO
sp_counted_base() = delete;
void add_ref()
{
be<uint32_t> original, incremented;
do
{
original = use_count_;
incremented = original + 1;
} while (InterlockedCompareExchange((unsigned long*)&use_count_, incremented.value, original.value) != original.value);
}
void release()
{
be<uint32_t> original, decremented;
do
{
original = use_count_;
decremented = original - 1;
} while (InterlockedCompareExchange((unsigned long*)&use_count_, decremented.value, original.value) != original.value);
if (decremented == 0)
{
GuestToHostFunction<void>(vftable_->dispose, this);
weak_release();
}
}
void weak_release()
{
be<uint32_t> original, decremented;
do
{
original = weak_count_;
decremented = original - 1;
} while (InterlockedCompareExchange((unsigned long*)&weak_count_, decremented.value, original.value) != original.value);
if (decremented == 0)
{
GuestToHostFunction<void>(vftable_->destroy, this);
}
}
uint32_t use_count() const
{
return use_count_;
}
};
template< class T > struct sp_dereference
{
typedef T& type;
};
template<> struct sp_dereference< void >
{
typedef void type;
};
}
template<typename T>
class shared_ptr
{
private:
xpointer<T> m_pObject;
xpointer<size_t> m_pRefCount;
xpointer<T> px;
xpointer<boost::detail::sp_counted_base> pn;
void add_ref()
{
if (pn)
pn->add_ref();
}
void release()
{
if (m_pRefCount && --(*m_pRefCount) == 0)
{
delete m_pObject;
delete m_pRefCount;
}
if (pn)
pn->release();
}
public:
shared_ptr() : m_pObject(nullptr), m_pRefCount(nullptr) {}
shared_ptr() : px(nullptr), pn(nullptr) {}
explicit shared_ptr(T* p) : m_pObject(p), m_pRefCount(new size_t(1)) {}
// TODO
explicit shared_ptr(T* p) = delete;
shared_ptr(const shared_ptr& other) : m_pObject(other.m_pObject), m_pRefCount(other.m_pRefCount)
shared_ptr(const shared_ptr& other) : px(other.px), pn(other.pn)
{
if (m_pRefCount)
++(*m_pRefCount);
add_ref();
}
shared_ptr(shared_ptr&& other) noexcept : m_pObject(std::exchange(other.m_pObject, nullptr)),
m_pRefCount(std::exchange(other.m_pRefCount, nullptr)) {}
shared_ptr(shared_ptr&& other) noexcept : px(std::exchange(other.px, nullptr)),
pn(std::exchange(other.pn, nullptr)) {}
~shared_ptr()
{
@ -46,11 +128,10 @@ namespace boost
{
release();
m_pObject = other.m_pObject;
m_pRefCount = other.m_pRefCount;
px = other.px;
pn = other.pn;
if (m_pRefCount)
++(*m_pRefCount);
add_ref();
}
return *this;
@ -62,20 +143,22 @@ namespace boost
{
release();
m_pObject = std::exchange(other.m_pObject, nullptr);
m_pRefCount = std::exchange(other.m_pRefCount, nullptr);
px = std::exchange(other.px, nullptr);
pn = std::exchange(other.pn, nullptr);
}
return *this;
}
T* get() const { return m_pObject; }
T* get() const { return px; }
T& operator*() const { assert(m_pObject); return *m_pObject; }
T* operator->() const { assert(m_pObject); return m_pObject; }
detail::sp_dereference<T> operator*() const { assert(px); return *px; }
T* operator->() const { assert(px); return px; }
explicit operator bool() const { return m_pObject != nullptr; }
explicit operator bool() const { return px != nullptr; }
size_t use_count() const { return m_pRefCount ? *m_pRefCount : 0; }
size_t use_count() const { return pn ? pn->use_count() : 0; }
};
using anonymous_shared_ptr = shared_ptr<void>;
}

View file

@ -0,0 +1,123 @@
#pragma once
#include "ppc_context.h"
#include <kernel/memory.h>
// DO NOT use this type as anything other than a local variable.
// This includes returning. It'll cause memory to leak in the guest stack!
template<typename T, bool Init = true>
class guest_stack_var
{
private:
uint32_t m_ptr = NULL;
uint32_t m_oldStackPtr = NULL;
void AllocGuestStackMemory()
{
auto ctx = GetPPCContext();
m_oldStackPtr = ctx->r1.u32;
m_ptr = (ctx->r1.u32 - sizeof(T)) & ~(std::max<uint32_t>(alignof(T), 8) - 1);
ctx->r1.u32 = m_ptr;
}
public:
T* get()
{
return reinterpret_cast<T*>(g_memory.Translate(m_ptr));
}
const T* get() const
{
return reinterpret_cast<const T*>(g_memory.Translate(m_ptr));
}
template<typename... Args>
guest_stack_var(Args&&... args)
{
AllocGuestStackMemory();
if (Init)
new (get()) T(std::forward<Args>(args)...);
}
guest_stack_var(const guest_stack_var<T>& other)
{
AllocGuestStackMemory();
if (Init)
new (get()) T(*other->get());
}
guest_stack_var(guest_stack_var<T>&& other)
{
AllocGuestStackMemory();
if (Init)
new (get()) T(std::move(*other->get()));
}
~guest_stack_var()
{
get()->~T();
auto ctx = GetPPCContext();
// This assert will fail if the type was used as anything other than a local variable.
assert(ctx->r1.u32 == m_ptr);
ctx->r1.u32 = m_oldStackPtr;
}
void operator=(const guest_stack_var<T>& other)
{
if (this != &other)
*get() = *other->get();
}
void operator=(guest_stack_var<T>&& other)
{
if (this != &other)
*get() = std::move(*other->get());
}
void operator=(const T& other)
{
if (get() != &other)
*get() = *other;
}
void operator=(T&& other)
{
if (get() != &other)
*get() = std::move(*other);
}
operator const T* () const
{
return get();
}
operator T* ()
{
return get();
}
const T* operator->() const
{
return get();
}
T* operator->()
{
return get();
}
const T& operator*() const
{
return *get();
}
T& operator*()
{
return *get();
}
};

View file

@ -3831,8 +3831,8 @@ void SetShadowResolutionMidAsmHook(PPCRegister& r11)
static void SetResolution(be<uint32_t>* device)
{
uint32_t width = uint32_t(g_swapChain->getWidth() * Config::ResolutionScale);
uint32_t height = uint32_t(g_swapChain->getHeight() * Config::ResolutionScale);
uint32_t width = uint32_t(round(g_swapChain->getWidth() * Config::ResolutionScale));
uint32_t height = uint32_t(round(g_swapChain->getHeight() * Config::ResolutionScale));
device[46] = width == 0 ? 880 : width;
device[47] = height == 0 ? 720 : height;
}

View file

@ -193,10 +193,10 @@ struct Argument
int ordinal{};
};
template<auto Func>
constexpr std::array<Argument, arg_count_t<Func>::value> GatherFunctionArguments()
template<typename T1>
constexpr std::array<Argument, std::tuple_size_v<T1>> GatherFunctionArguments(const T1& tpl)
{
std::array<Argument, arg_count_t<Func>::value> args{};
std::array<Argument, std::tuple_size_v<T1>> args{};
int floatOrdinal{};
size_t i{};
@ -205,9 +205,9 @@ constexpr std::array<Argument, arg_count_t<Func>::value> GatherFunctionArguments
{
std::apply([&](const auto& first, const auto&... rest)
{
auto append = [&]<typename T>(const T & v)
auto append = [&]<typename T2>(const T2& v)
{
if constexpr (is_precise_v<T>)
if constexpr (is_precise_v<T2>)
{
args[i] = { 1, floatOrdinal++ };
}
@ -221,12 +221,18 @@ constexpr std::array<Argument, arg_count_t<Func>::value> GatherFunctionArguments
append(first);
(append(rest), ...);
}, function_args(Func));
}, tpl);
}
return args;
}
template<auto Func>
constexpr std::array<Argument, arg_count_t<Func>::value> GatherFunctionArguments()
{
return GatherFunctionArguments(function_args(Func));
}
template<auto Func, size_t I>
struct arg_ordinal_t
{
@ -248,19 +254,19 @@ FORCEINLINE std::enable_if_t<(I < sizeof...(TArgs)), void> _translate_args_to_ho
_translate_args_to_host<Func, I + 1>(ctx, base, tpl);
}
template<auto Func, int I = 0, typename ...TArgs>
template<int I = 0, typename ...TArgs>
FORCEINLINE void _translate_args_to_guest(PPCContext& ctx, uint8_t* base, std::tuple<TArgs...>&) noexcept
requires (I >= sizeof...(TArgs))
{
}
template <auto Func, int I = 0, typename ...TArgs>
template <int I = 0, typename ...TArgs>
FORCEINLINE std::enable_if_t<(I < sizeof...(TArgs)), void> _translate_args_to_guest(PPCContext& ctx, uint8_t* base, std::tuple<TArgs...>& tpl) noexcept
{
using T = std::tuple_element_t<I, std::remove_reference_t<decltype(tpl)>>;
ArgTranslator::SetValue<T>(ctx, base, I, std::get<I>(tpl));
ArgTranslator::SetValue<T>(ctx, base, GatherFunctionArguments(std::tuple<TArgs...>{})[I].ordinal, std::get<I>(tpl));
_translate_args_to_guest<Func, I + 1>(ctx, base, tpl);
_translate_args_to_guest<I + 1>(ctx, base, tpl);
}
template<auto Func>
@ -301,22 +307,27 @@ FORCEINLINE PPC_FUNC(HostToGuestFunction)
}
}
template<typename T, typename... TArgs>
FORCEINLINE T GuestToHostFunction(uint32_t addr, TArgs... argv)
template<typename T, typename TFunction, typename... TArgs>
FORCEINLINE T GuestToHostFunction(const TFunction& func, TArgs&&... argv)
{
auto args = std::make_tuple(argv...);
auto args = std::make_tuple(std::forward<TArgs>(argv)...);
auto& currentCtx = *GetPPCContext();
auto newCtx = PPCContext{};
PPCContext newCtx; // NOTE: No need for zero initialization, has lots of unnecessary code generation.
newCtx.fn = currentCtx.fn;
newCtx.r1 = currentCtx.r1;
newCtx.r13 = currentCtx.r13;
newCtx.fpscr = currentCtx.fpscr;
_translate_args_to_guest<GuestToHostFunction<T, TArgs...>>(newCtx, (uint8_t*)g_memory.base, args);
_translate_args_to_guest(newCtx, (uint8_t*)g_memory.base, args);
SetPPCContext(newCtx);
(*(PPCFunc**)(newCtx.fn + uint64_t(addr) * 2))(newCtx, (uint8_t*)g_memory.base);
if constexpr (std::is_function_v<TFunction>)
func(newCtx, (uint8_t*)g_memory.base);
else
(*(PPCFunc**)(newCtx.fn + uint64_t(func) * 2))(newCtx, (uint8_t*)g_memory.base);
currentCtx.fpscr = newCtx.fpscr;
SetPPCContext(currentCtx);

View file

@ -1,7 +1,6 @@
#pragma once
#include "mutex.h"
#include <o1heap.h>
struct Heap
{

View file

@ -16,11 +16,17 @@ public:
void* Translate(size_t offset) const noexcept
{
if (offset)
assert(offset < 0x100000000ull);
return base + offset;
}
uint32_t MapVirtual(void* host) const noexcept
{
if (host)
assert(host >= base && host < (base + size));
return static_cast<uint32_t>(static_cast<char*>(host) - base);
}
};

View file

@ -26,6 +26,7 @@
#include <imgui.h>
#include <imgui_internal.h>
#include <imgui_impl_sdl2.h>
#include <o1heap.h>
#include "framework.h"
#include "mutex.h"

@ -1 +1 @@
Subproject commit d8676283fd1e8990b415cc0e4810c6db895b9fba
Subproject commit 7dd4f91ac635b001a56cc7a27af48f0436bbad3f