diff --git a/.gitignore b/.gitignore index 47d4afcc..53d6568c 100644 --- a/.gitignore +++ b/.gitignore @@ -397,3 +397,13 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml + +# IntelliJ IDEs +.idea/ + +# macOS metadata +*.DS_Store + +# CMake Files +**/cmake-build-debug +**/CMakeCache.txt \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 03e721f6..367a42b0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -58,3 +58,6 @@ [submodule "thirdparty/json"] path = thirdparty/json url = https://github.com/nlohmann/json +[submodule "UnleashedRecomp/api"] + path = UnleashedRecomp/api + url = https://github.com/hedge-dev/SWA.git diff --git a/UnleashedRecomp/CMakeLists.txt b/UnleashedRecomp/CMakeLists.txt index 66b60a44..10863c02 100644 --- a/UnleashedRecomp/CMakeLists.txt +++ b/UnleashedRecomp/CMakeLists.txt @@ -183,6 +183,8 @@ set(UNLEASHED_RECOMP_USER_CXX_SOURCES "user/config.cpp" "user/registry.cpp" "user/paths.cpp" + "user/persistent_data.cpp" + "user/persistent_storage_manager.cpp" ) set(UNLEASHED_RECOMP_MOD_CXX_SOURCES @@ -229,7 +231,8 @@ set(UNLEASHED_RECOMP_CXX_SOURCES "app.cpp" "exports.cpp" "main.cpp" - "misc_impl.cpp" + "misc_impl.cpp" + "preload_executable.cpp" "sdl_listener.cpp" "stdafx.cpp" "version.cpp" @@ -310,7 +313,11 @@ endif() if (UNLEASHED_RECOMP_D3D12) find_package(directx-headers CONFIG REQUIRED) find_package(directx12-agility CONFIG REQUIRED) - target_compile_definitions(UnleashedRecomp PRIVATE UNLEASHED_RECOMP_D3D12) + target_compile_definitions(UnleashedRecomp PRIVATE + UNLEASHED_RECOMP_D3D12 + D3D12MA_USING_DIRECTX_HEADERS + D3D12MA_OPTIONS16_SUPPORTED + ) endif() if (CMAKE_SYSTEM_NAME MATCHES "Linux") @@ -434,35 +441,6 @@ compile_pixel_shader(resolve_msaa_depth_2x) compile_pixel_shader(resolve_msaa_depth_4x) compile_pixel_shader(resolve_msaa_depth_8x) -function(generate_aggregate_header INPUT_DIRECTORY OUTPUT_FILE) - get_filename_component(ABS_OUTPUT_FILE "${OUTPUT_FILE}" ABSOLUTE) - file(GLOB_RECURSE HEADER_FILES "${INPUT_DIRECTORY}/*.h") - set(HEADER_CONTENT "#pragma once\n\n") - - foreach(HEADER_FILE IN LISTS HEADER_FILES) - get_filename_component(ABS_HEADER_FILE "${HEADER_FILE}" ABSOLUTE) - if (ABS_HEADER_FILE STREQUAL ABS_OUTPUT_FILE) - continue() - endif() - file(RELATIVE_PATH RELATIVE_HEADER_FILE "${INPUT_DIRECTORY}" "${HEADER_FILE}") - string(APPEND HEADER_CONTENT "#include \"${RELATIVE_HEADER_FILE}\"\n") - endforeach() - - if (EXISTS "${OUTPUT_FILE}") - file(READ "${OUTPUT_FILE}" EXISTING_CONTENT) - if (EXISTING_CONTENT STREQUAL HEADER_CONTENT) - return() - endif() - endif() - - file(WRITE "${OUTPUT_FILE}" "${HEADER_CONTENT}") -endfunction() - -generate_aggregate_header( - "${CMAKE_CURRENT_SOURCE_DIR}/api" - "${CMAKE_CURRENT_SOURCE_DIR}/api/SWA.h" -) - set(RESOURCES_SOURCE_PATH "${PROJECT_SOURCE_DIR}/../UnleashedRecompResources") set(RESOURCES_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/res") diff --git a/UnleashedRecomp/api b/UnleashedRecomp/api new file mode 160000 index 00000000..f299dd8c --- /dev/null +++ b/UnleashedRecomp/api @@ -0,0 +1 @@ +Subproject commit f299dd8cf272a0110c91e54e2b6e308a2d897966 diff --git a/UnleashedRecomp/api/CSD/Manager/csdmBase.h b/UnleashedRecomp/api/CSD/Manager/csdmBase.h deleted file mode 100644 index d2ffca59..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmBase.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -namespace Chao::CSD -{ - class CBase {}; -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmMotionPattern.h b/UnleashedRecomp/api/CSD/Manager/csdmMotionPattern.h deleted file mode 100644 index dd5df27b..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmMotionPattern.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include - -namespace Chao::CSD -{ - class CMotionPattern : CBase {}; -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmNode.h b/UnleashedRecomp/api/CSD/Manager/csdmNode.h deleted file mode 100644 index 3c876426..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmNode.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace Chao::CSD -{ - struct Node; - - class CNode : public CResourceBase, SubjectBase, CBase - { - public: - SWA_INSERT_PADDING(0x34); - xpointer m_pMotionPattern; - SWA_INSERT_PADDING(0x18); - - ~CNode(); - - void SetText(const char* in_pText); - void SetText(const wchar_t* in_pText); - void GetPosition(Hedgehog::Math::CVector2& out_rResult) const; - void SetPosition(float in_X, float in_Y); - void SetHideFlag(uint32_t in_HideFlag); - void SetRotation(float in_Rotation); - void SetScale(float in_X, float in_Y); - void SetPatternIndex(uint32_t in_PatternIndex); - }; -} - -#include diff --git a/UnleashedRecomp/api/CSD/Manager/csdmNode.inl b/UnleashedRecomp/api/CSD/Manager/csdmNode.inl deleted file mode 100644 index ffefcce5..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmNode.inl +++ /dev/null @@ -1,49 +0,0 @@ -#include "SWA.inl" - -namespace Chao::CSD -{ - inline CNode::~CNode() - { - SWA_VIRTUAL_FUNCTION(void, 0, this); - } - - inline void CNode::SetText(const char* in_pText) - { - GuestToHostFunction(sub_830BF640, this, in_pText); - } - - inline void CNode::SetText(const wchar_t* in_pText) - { - GuestToHostFunction(sub_830BF640, this, in_pText); - } - - inline void CNode::GetPosition(Hedgehog::Math::CVector2& out_rResult) const - { - GuestToHostFunction(sub_830BF008, &out_rResult, this); - } - - inline void CNode::SetPosition(float in_X, float in_Y) - { - GuestToHostFunction(sub_830BF078, this, in_X, in_Y); - } - - inline void CNode::SetHideFlag(uint32_t in_HideFlag) - { - GuestToHostFunction(sub_830BF080, this, in_HideFlag); - } - - inline void CNode::SetRotation(float in_Rotation) - { - GuestToHostFunction(sub_830BF088, this, in_Rotation); - } - - inline void CNode::SetScale(float in_X, float in_Y) - { - GuestToHostFunction(sub_830BF090, this, in_X, in_Y); - } - - inline void CNode::SetPatternIndex(uint32_t in_PatternIndex) - { - GuestToHostFunction(sub_830BF300, this, in_PatternIndex); - } -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmNodeObserver.h b/UnleashedRecomp/api/CSD/Manager/csdmNodeObserver.h deleted file mode 100644 index abfba980..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmNodeObserver.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "CSD/Manager/csdmObserverBase.h" - -namespace Chao::CSD -{ - class CNode; - - class CNodeObserver : public CObserverBase {}; -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.h b/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.h deleted file mode 100644 index 63daf398..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace Chao::CSD -{ - template - class CObserverBase - { - public: - struct Vftable - { - be m_fpDtor; - }; - - 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 deleted file mode 100644 index beeabb4f..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmObserverBase.inl +++ /dev/null @@ -1,8 +0,0 @@ -namespace Chao::CSD -{ - template - inline CObserverBase::~CObserverBase() - { - GuestToHostFunction(m_pVftable->m_fpDtor, this); - } -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmProject.h b/UnleashedRecomp/api/CSD/Manager/csdmProject.h deleted file mode 100644 index ed01cd3b..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmProject.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "CSD/Manager/csdmBase.h" -#include "CSD/Manager/csdmResourceBase.h" - -namespace Chao::CSD -{ - struct Project; - class CProject; - class CScene; - class CTexList; - - class CProject : public CResourceBase, CBase - { - public: - SWA_INSERT_PADDING(0x1C); - RCPtr m_rcTexList; - SWA_INSERT_PADDING(0x1C); - - RCPtr CreateScene(const char* in_pName) const; - RCPtr CreateScene(const char* in_pName, const char* in_pMotionName) const; - - void DestroyScene(CScene* in_pScene); - void DestroyScene(RCPtr& inout_rcScene); - - static void DestroyScene(CProject* in_pProject, RCPtr& inout_rcScene); - }; -} - -#include "CSD/Manager/csdmProject.inl" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmProject.inl b/UnleashedRecomp/api/CSD/Manager/csdmProject.inl deleted file mode 100644 index d106fa4a..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmProject.inl +++ /dev/null @@ -1,40 +0,0 @@ -#include "kernel/function.h" - -namespace Chao::CSD -{ - inline RCPtr CProject::CreateScene(const char* in_pName) const - { - RCPtr rcScene; - GuestToHostFunction(sub_830BEE00, this, rcScene, in_pName, nullptr); - return rcScene; - } - - inline RCPtr CProject::CreateScene(const char* in_pName, const char* in_pMotionName) const - { - RCPtr rcScene; - GuestToHostFunction(sub_830BECE0, this, rcScene, in_pName, in_pMotionName, nullptr); - return rcScene; - } - - inline void CProject::DestroyScene(CScene* in_pScene) - { - GuestToHostFunction(sub_830BE298, this, in_pScene); - } - - inline void CProject::DestroyScene(RCPtr& inout_rcScene) - { - if (!inout_rcScene) - return; - - DestroyScene(inout_rcScene.Get()); - inout_rcScene = nullptr; - } - - inline void CProject::DestroyScene(CProject* in_pProject, RCPtr& inout_rcScene) - { - if (in_pProject) - in_pProject->DestroyScene(inout_rcScene); - else - inout_rcScene = nullptr; - } -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCObject.h b/UnleashedRecomp/api/CSD/Manager/csdmRCObject.h deleted file mode 100644 index 143dcb07..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCObject.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include "CSD/Manager/csdmRCPtrAbs.h" - -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; - - ~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 deleted file mode 100644 index 9a9bb565..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCObject.inl +++ /dev/null @@ -1,35 +0,0 @@ -namespace Chao::CSD -{ - inline RCPtrAbs::RCObject::~RCObject() - { - GuestToHostFunction(m_pVftable->m_fpDtor, this); - } - - inline RCPtrAbs::~RCPtrAbs() - { - RCPtrAbs::RCObject* pObj = m_pObject; - - m_pObject = nullptr; - - if (pObj) - pObj->Release(); - } - - inline void* RCPtrAbs::GetAbs() const - { - if (!m_pObject) - return nullptr; - - 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(sub_830BA068, this); - } -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.h b/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.h deleted file mode 100644 index aa814cfa..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "CSD/Manager/csdmRCPtr.h" - -namespace Chao::CSD -{ - template - class RCPtr::RCObjectImp : public RCObject {}; -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.inl b/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.inl deleted file mode 100644 index 74465e61..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCObjectImp.inl +++ /dev/null @@ -1,14 +0,0 @@ -namespace Chao::CSD -{ - template - void RCPtr::RCObjectImp::Deallocate(void* in_pMemory) - { - // delete static_cast(in_pMemory); - } - - template - RCPtrAbs::RCObject* RCPtr::CreateRCObject() - { - return new RCObjectImp(); - } -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.h b/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.h deleted file mode 100644 index 10878100..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include "CSD/Manager/csdmRCPtrAbs.h" - -namespace Chao::CSD -{ - template - class RCPtr : RCPtrAbs - { - public: - class RCObjectImp; - - RCPtr() : RCPtrAbs() {} - RCPtr(T* in_pMemory) : RCPtrAbs(in_pMemory) {} - RCPtr(const RCPtr& in_rOther) : RCPtrAbs(in_rOther) {} - RCPtr(RCPtr&& in_rOther) : RCPtrAbs(std::move(in_rOther)) {} - - void Attach(T* in_pObject); - - T* Get() const; - void Set(const RCPtr& in_rOther); - - T* operator*() const; - T* operator->() const; - - RCPtr& operator=(const RCPtr& in_rOther); - - operator bool() const; - }; -} - -#include "CSD/Manager/csdmRCPtr.inl" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.inl b/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.inl deleted file mode 100644 index 01bcd6e1..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCPtr.inl +++ /dev/null @@ -1,45 +0,0 @@ -namespace Chao::CSD -{ - template - void RCPtr::Attach(T* in_pObject) - { - RCPtrAbs::AttachAbs(in_pObject); - } - - template - T* RCPtr::Get() const - { - return static_cast(RCPtrAbs::GetAbs()); - } - - template - void RCPtr::Set(const RCPtr& in_rOther) - { - RCPtrAbs::SetAbs(in_rOther); - } - - template - T* RCPtr::operator*() const - { - return Get(); - } - - template - T* RCPtr::operator->() const - { - return Get(); - } - - template - RCPtr& RCPtr::operator=(const RCPtr& in_rOther) - { - Set(in_rOther); - return *this; - } - - template - RCPtr::operator bool() const - { - return m_pObject != nullptr; - } -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.h b/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.h deleted file mode 100644 index e1e46be8..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace Chao::CSD -{ - class RCPtrAbs - { - public: - class RCObject; - - struct Vftable - { - be m_fpDtor; - be m_fpCreateRCObject; - }; - - xpointer m_pVftable; - xpointer m_pObject; - - RCPtrAbs(); - RCPtrAbs(void* in_pMemory); - RCPtrAbs(const RCPtrAbs& in_rOther); - RCPtrAbs(RCPtrAbs&& in_rPtr); - - ~RCPtrAbs(); - RCObject* CreateRCObject(); - - void AttachAbs(void* in_pMemory); - void* GetAbs() const; - void SetAbs(const RCPtrAbs& in_rPtr); - - void* operator*() const; - void* operator->() const; - - RCPtrAbs& operator=(const RCPtrAbs& in_rPtr); - - operator bool() const; - }; -} - -#include "CSD/Manager/csdmRCPtrAbs.inl" diff --git a/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.inl b/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.inl deleted file mode 100644 index 4374bc11..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmRCPtrAbs.inl +++ /dev/null @@ -1,58 +0,0 @@ -namespace Chao::CSD -{ - inline RCPtrAbs::RCPtrAbs() - { - AttachAbs(nullptr); - } - - inline RCPtrAbs::RCPtrAbs(void* in_pMemory) - { - AttachAbs(in_pMemory); - } - - inline RCPtrAbs::RCPtrAbs(const RCPtrAbs& in_rOther) - { - SetAbs(in_rOther); - } - - inline RCPtrAbs::RCPtrAbs(RCPtrAbs&& in_rPtr) : m_pObject(in_rPtr.m_pObject) - { - 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(sub_830BA298, this, in_pMemory); - } - - inline void RCPtrAbs::SetAbs(const RCPtrAbs& in_rPtr) - { - GuestToHostFunction(sub_830BA328, this, in_rPtr); - } - - inline void* RCPtrAbs::operator*() const - { - return GetAbs(); - } - - inline void* RCPtrAbs::operator->() const - { - return GetAbs(); - } - - inline RCPtrAbs& RCPtrAbs::operator=(const RCPtrAbs& in_rPtr) - { - SetAbs(in_rPtr); - return *this; - } - - inline RCPtrAbs::operator bool() const - { - return m_pObject != nullptr; - } -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.h b/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.h deleted file mode 100644 index 094ed06f..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "CSD/Manager/csdmRCPtr.h" - -namespace Chao::CSD -{ - template - class CResourceBase - { - public: - struct Vftable - { - be m_fpDtor; - be m_fpCopyResource; - }; - - xpointer m_pVftable; - RCPtr m_rcResourceHolder; - xpointer m_pResource; - - ~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 deleted file mode 100644 index d459e3c9..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmResourceBase.inl +++ /dev/null @@ -1,15 +0,0 @@ -namespace Chao::CSD -{ - template - 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 deleted file mode 100644 index e26f2b91..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmScene.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "CSD/Manager/csdmBase.h" -#include "CSD/Manager/csdmResourceBase.h" -#include "CSD/Manager/csdmSceneObserver.h" -#include "CSD/Manager/csdmSubjectBase.h" - -namespace Chao::CSD -{ - struct Scene; - class CScene; - class CNode; - - enum EMotionRepeatType : uint32_t - { - eMotionRepeatType_PlayOnce = 0, - eMotionRepeatType_Loop = 1, - eMotionRepeatType_PingPong = 2, - eMotionRepeatType_PlayThenDestroy = 3 - }; - - class CScene : public CResourceBase, SubjectBase, CBase - { - public: - SWA_INSERT_PADDING(0x60); - be m_PrevMotionFrame; - be m_MotionFrame; - be m_MotionSpeed; - be m_MotionStartFrame; - be m_MotionEndFrame; - SWA_INSERT_PADDING(0x0C); - be m_MotionDisableFlag; - SWA_INSERT_PADDING(0x10); - be m_MotionRepeatType; - SWA_INSERT_PADDING(0x2C); - - ~CScene(); - void Update(float in_DeltaTime = 0.0f); - void Render(void* in_pUnk); - - void GetNode(RCPtr& out_rResult, const char* in_pName); - - bool SetMotion(const char* in_pName); - void SetMotionFrame(float in_MotionFrame); - void SetPosition(float in_X, float in_Y); - void SetHideFlag(uint32_t in_HideFlag); - void SetRotation(float in_Angle); - 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 deleted file mode 100644 index 25a5ad60..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmScene.inl +++ /dev/null @@ -1,53 +0,0 @@ -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 void CScene::GetNode(RCPtr& out_rResult, const char* in_pName) - { - GuestToHostFunction(sub_830BCCA8, &out_rResult, this, in_pName); - } - - inline bool CScene::SetMotion(const char* in_pName) - { - return GuestToHostFunction(sub_830BA760, this, in_pName); - } - - inline void CScene::SetMotionFrame(float in_MotionFrame) - { - m_PrevMotionFrame = in_MotionFrame; - m_MotionFrame = in_MotionFrame; - } - - inline void CScene::SetPosition(float in_X, float in_Y) - { - GuestToHostFunction(sub_830BB550, this, in_X, in_Y); - } - - inline void CScene::SetHideFlag(uint32_t in_HideFlag) - { - GuestToHostFunction(sub_830BB378, this, in_HideFlag); - } - - inline void CScene::SetRotation(float in_Angle) - { - GuestToHostFunction(sub_830BB5F8, this, in_Angle); - } - - inline void CScene::SetScale(float in_X, float in_Y) - { - GuestToHostFunction(sub_830BB650, this, in_X, in_Y); - } -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmSceneObserver.h b/UnleashedRecomp/api/CSD/Manager/csdmSceneObserver.h deleted file mode 100644 index 2e6abb2c..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmSceneObserver.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "CSD/Manager/csdmObserverBase.h" - -namespace Chao::CSD -{ - class CScene; - - class CSceneObserver : public CObserverBase {}; -} diff --git a/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.h b/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.h deleted file mode 100644 index cb420c30..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace Chao::CSD -{ - template - class SubjectBase - { - public: - struct Vftable - { - be m_fpDtor; - be m_fpGetObservee; - }; - - xpointer m_pVftable; - SWA_INSERT_PADDING(0x0C); - - ~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 deleted file mode 100644 index 9c9b7f8f..00000000 --- a/UnleashedRecomp/api/CSD/Manager/csdmSubjectBase.inl +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index 88fb7c81..00000000 --- a/UnleashedRecomp/api/CSD/Platform/csdTexList.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "CSD/Manager/csdmBase.h" -#include "CSD/Manager/csdmRCPtr.h" - -namespace Chao::CSD -{ - class CTexList : public CBase - { - public: - struct Vftable - { - be m_fpDtor; - }; - - xpointer m_pVftable; - RCPtr m_rcData; - - ~CTexList(); - }; -} - -#include "CSD/Platform/csdTexList.inl" diff --git a/UnleashedRecomp/api/CSD/Platform/csdTexList.inl b/UnleashedRecomp/api/CSD/Platform/csdTexList.inl deleted file mode 100644 index 14835026..00000000 --- a/UnleashedRecomp/api/CSD/Platform/csdTexList.inl +++ /dev/null @@ -1,7 +0,0 @@ -namespace Chao::CSD -{ - inline CTexList::~CTexList() - { - GuestToHostFunction(m_pVftable->m_fpDtor, this); - } -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Container/hhMap.h b/UnleashedRecomp/api/Hedgehog/Base/Container/hhMap.h deleted file mode 100644 index a38ba356..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Container/hhMap.h +++ /dev/null @@ -1,378 +0,0 @@ -#pragma once - -#include - -namespace hh -{ - template< - class Key, - class T, - class Compare = std::less, - class Allocator = Hedgehog::Base::TAllocator>> - class map - { - protected: - enum EColor - { - eColor_Red, - eColor_Black - }; - - struct SNode - { - using allocator_type = typename std::allocator_traits::template rebind_alloc; - - xpointer pLeft; - xpointer pParent; - xpointer pRight; - std::pair Value; - uint8_t Color; - bool IsNil; - }; - - Compare m_Comp; - typename SNode::allocator_type m_Alloc; - xpointer m_pHead; - be m_Count; - - struct SFindResult - { - SNode* pParent; - bool IsRight; - SNode* pBound; - }; - - bool LowerBoundDuplicate(const SNode* pBound, const Key& in_rKey) const - { - return !pBound->IsNil && !m_Comp(in_rKey, pBound->Value.first); - } - - SFindResult FindLowerBound(const Key& in_rKey) const - { - SFindResult result{ m_pHead->pParent, true, m_pHead }; - SNode* pNode = result.pParent; - - while (!pNode->IsNil) - { - result.pParent = pNode; - if (m_Comp(pNode->Value.first, in_rKey)) - { - result.IsRight = true; - pNode = pNode->pRight; - } - else - { - result.IsRight = false; - result.pBound = pNode; - pNode = pNode->pLeft; - } - } - - return result; - } - - SNode* Find(const Key& in_rKey) const - { - const SFindResult result = FindLowerBound(in_rKey); - return LowerBoundDuplicate(result.pBound, in_rKey) ? result.pBound : m_pHead.get(); - } - - static SNode* Max(SNode* pNode) - { - while (!pNode->pRight->IsNil) - pNode = pNode->pRight; - - return pNode; - } - - static SNode* Min(SNode* pNode) - { - while (!pNode->pLeft->IsNil) - pNode = pNode->pLeft; - - return pNode; - } - - public: - using key_type = Key; - using mapped_type = T; - using value_type = std::pair; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - using key_compare = Compare; - using allocator_type = Allocator; - using reference = value_type&; - using const_reference = const value_type&; - using pointer = typename std::allocator_traits::pointer; - using const_pointer = typename std::allocator_traits::const_pointer; - - class iterator - { - public: - using iterator_category = std::bidirectional_iterator_tag; - using value_type = std::pair; - using difference_type = std::ptrdiff_t; - using pointer = value_type*; - using reference = value_type&; - - iterator(const std::nullptr_t&) = delete; - iterator(SNode* pNode) : m_pNode(pNode) {} - - reference operator*() const { return m_pNode->Value; } - pointer operator->() const { return &m_pNode->Value; } - - iterator& operator++() - { - if (m_pNode->pRight->IsNil) - { - SNode* pNode; - while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pRight) - m_pNode = pNode; - - m_pNode = pNode; - } - else - { - m_pNode = map::Min(m_pNode->pRight); - } - - return *this; - } - - iterator operator++(int) - { - iterator temp(*this); - ++(*this); - return temp; - } - - iterator& operator--() - { - if (m_pNode->IsNil) - { - m_pNode = m_pNode->pRight; - } - else if (m_pNode->pLeft->IsNil) - { - SNode* pNode; - while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pLeft) - m_pNode = pNode; - - if (!m_pNode->IsNil) - m_pNode = pNode; - } - else - { - m_pNode = map::Max(m_pNode->pLeft); - } - - return *this; - } - - iterator operator--(int) - { - iterator temp(*this); - --(*this); - return temp; - } - - bool operator==(const iterator& rhs) const { return m_pNode == rhs.m_pNode; } - bool operator!=(const iterator& rhs) const { return !(*this == rhs); } - - private: - SNode* m_pNode; - friend class iterator; - friend class map; - }; - - class const_iterator - { - public: - using iterator_category = std::bidirectional_iterator_tag; - using value_type = std::pair; - using difference_type = std::ptrdiff_t; - using pointer = const value_type*; - using reference = const value_type&; - - const_iterator(const std::nullptr_t&) = delete; - const_iterator(SNode* pNode) : m_pNode(pNode) {} - const_iterator(const iterator& iterator) : m_pNode(iterator.m_pNode) {} - - reference operator*() const { return m_pNode->Value; } - pointer operator->() const { return &m_pNode->Value; } - - const_iterator& operator++() - { - if (m_pNode->pRight->IsNil) - { - SNode* pNode; - while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pRight) - m_pNode = pNode; - - m_pNode = pNode; - } - else - { - m_pNode = map::Min(m_pNode->pRight); - } - - return *this; - } - - const_iterator operator++(int) - { - const_iterator temp(*this); - ++(*this); - return temp; - } - - const_iterator& operator--() - { - if (m_pNode->IsNil) - { - m_pNode = m_pNode->pRight; - } - else if (m_pNode->pLeft->IsNil) - { - SNode* pNode; - while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pLeft) - m_pNode = pNode; - - if (!m_pNode->IsNil) - m_pNode = pNode; - } - else - { - m_pNode = map::Max(m_pNode->pLeft); - } - - return *this; - } - - const_iterator operator--(int) - { - const_iterator temp(*this); - --(*this); - return temp; - } - - bool operator==(const const_iterator& rhs) const { return m_pNode == rhs.m_pNode; } - bool operator!=(const const_iterator& rhs) const { return !(*this == rhs); } - - private: - SNode* m_pNode; - friend class map; - }; - - using reverse_iterator = std::reverse_iterator; - using const_reverse_iterator = std::reverse_iterator; - - public: - allocator_type get_allocator() const - { - return m_Alloc; - } - - T& at(const Key& key) - { - return Find(key)->Value.second; - } - - const T& at(const Key& key) const - { - return Find(key)->Value.second; - } - - iterator begin() - { - return iterator(m_pHead->pLeft); - } - - const_iterator begin() const - { - return const_iterator(m_pHead->pLeft); - } - - const_iterator cbegin() const - { - return const_iterator(m_pHead->pLeft); - } - - iterator end() - { - return iterator(m_pHead); - } - - const_iterator end() const - { - return const_iterator(m_pHead); - } - - const_iterator cend() const - { - return const_iterator(m_pHead); - } - - reverse_iterator rbegin() - { - return reverse_iterator(end()); - } - - const_reverse_iterator rbegin() const - { - return const_reverse_iterator(end()); - } - - const_reverse_iterator crbegin() const - { - return const_reverse_iterator(cend()); - } - - reverse_iterator rend() - { - return reverse_iterator(begin()); - } - - const_reverse_iterator rend() const - { - return const_reverse_iterator(begin()); - } - - const_reverse_iterator crend() const - { - return const_reverse_iterator(cbegin()); - } - - bool empty() const - { - return m_Count == 0; - } - - size_type size() const - { - return m_Count; - } - - size_type max_size() const - { - return ~0u; - } - - size_type count(const Key& key) const - { - return LowerBoundDuplicate(FindLowerBound(key).pBound, key) ? 1u : 0u; - } - - iterator find(const Key& key) - { - return iterator(Find(key)); - } - - const_iterator find(const Key& key) const - { - return const_iterator(Find(key)); - } - }; - - static_assert(sizeof(map) == 0xC); -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Container/hhVector.h b/UnleashedRecomp/api/Hedgehog/Base/Container/hhVector.h deleted file mode 100644 index 42f3b959..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Container/hhVector.h +++ /dev/null @@ -1,255 +0,0 @@ -#pragma once - -#include - -namespace hh -{ - template> - class vector - { - protected: - Allocator m_Alloc; - xpointer m_pFirst; - xpointer m_pLast; - xpointer m_pEnd; - - public: - using value_type = T; - using allocator_type = Allocator; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - using reference = value_type&; - using const_reference = const value_type&; - using pointer = typename std::allocator_traits::pointer; - using const_pointer = typename std::allocator_traits::const_pointer; - - class iterator - { - public: - using iterator_category = std::random_access_iterator_tag; - using value_type = T; - using difference_type = std::ptrdiff_t; - using pointer = T*; - using reference = T&; - - iterator() : m_pPtr(nullptr) {} - iterator(T* p) : m_pPtr(p) {} - - reference operator*() const { return *m_pPtr; } - pointer operator->() const { return m_pPtr; } - - iterator& operator++() { ++m_pPtr; return *this; } - iterator operator++(int) { iterator tmp = *this; ++(*this); return tmp; } - - iterator& operator--() { --m_pPtr; return *this; } - iterator operator--(int) { iterator tmp = *this; --(*this); return tmp; } - - iterator& operator+=(difference_type n) { m_pPtr += n; return *this; } - iterator operator+(difference_type n) const { iterator tmp = *this; return tmp += n; } - friend iterator operator+(difference_type n, iterator it) { return it + n; } - - iterator& operator-=(difference_type n) { return *this += -n; } - iterator operator-(difference_type n) const { iterator tmp = *this; return tmp -= n; } - difference_type operator-(const iterator& other) const { return m_pPtr - other.m_pPtr; } - - reference operator[](difference_type n) const { return *(*this + n); } - - bool operator==(const iterator& other) const { return m_pPtr == other.m_pPtr; } - bool operator!=(const iterator& other) const { return !(*this == other); } - bool operator<(const iterator& other) const { return m_pPtr < other.m_pPtr; } - bool operator<=(const iterator& other) const { return !(other < *this); } - bool operator>(const iterator& other) const { return other < *this; } - bool operator>=(const iterator& other) const { return !(*this < other); } - - private: - T* m_pPtr; - - friend class vector; - friend class const_iterator; - }; - - class const_iterator - { - public: - using iterator_category = std::random_access_iterator_tag; - using value_type = T; - using difference_type = std::ptrdiff_t; - using pointer = const T*; - using reference = const T&; - - const_iterator() : m_pPtr(nullptr) {} - const_iterator(T* p) : m_pPtr(p) {} - const_iterator(const iterator& other) : m_pPtr(other.m_pPtr) {} - - reference operator*() const { return *m_pPtr; } - pointer operator->() const { return m_pPtr; } - - const_iterator& operator++() { ++m_pPtr; return *this; } - const_iterator operator++(int) { const_iterator tmp = *this; ++(*this); return tmp; } - - const_iterator& operator--() { --m_pPtr; return *this; } - const_iterator operator--(int) { const_iterator tmp = *this; --(*this); return tmp; } - - const_iterator& operator+=(difference_type n) { m_pPtr += n; return *this; } - const_iterator operator+(difference_type n) const { const_iterator tmp = *this; return tmp += n; } - friend const_iterator operator+(difference_type n, const_iterator it) { return it + n; } - - const_iterator& operator-=(difference_type n) { return *this += -n; } - const_iterator operator-(difference_type n) const { const_iterator tmp = *this; return tmp -= n; } - difference_type operator-(const const_iterator& other) const { return m_pPtr - other.m_pPtr; } - - reference operator[](difference_type n) const { return *(*this + n); } - - bool operator==(const const_iterator& other) const { return m_pPtr == other.m_pPtr; } - bool operator!=(const const_iterator& other) const { return !(*this == other); } - bool operator<(const const_iterator& other) const { return m_pPtr < other.m_pPtr; } - bool operator<=(const const_iterator& other) const { return !(other < *this); } - bool operator>(const const_iterator& other) const { return other < *this; } - bool operator>=(const const_iterator& other) const { return !(*this < other); } - - private: - T* m_pPtr; - friend class vector; - }; - - using reverse_iterator = std::reverse_iterator; - using const_reverse_iterator = std::reverse_iterator; - - allocator_type get_allocator() const - { - return m_Alloc; - } - - reference at(size_type pos) - { - return m_pFirst[pos]; - } - - const_reference at(size_type pos) const - { - return m_pFirst[pos]; - } - - reference operator[](size_type pos) - { - return m_pFirst[pos]; - } - - const_reference operator[](size_type pos) const - { - return m_pFirst[pos]; - } - - reference front() - { - return m_pFirst[0]; - } - - const_reference front() const - { - return m_pFirst[0]; - } - - reference back() - { - return m_pLast[-1]; - } - - const_reference back() const - { - return m_pLast[-1]; - } - - T* data() - { - return m_pFirst; - } - - const T* data() const - { - return m_pFirst; - } - - iterator begin() - { - return iterator(m_pFirst); - } - - const_iterator begin() const - { - return const_iterator(m_pFirst); - } - - const_iterator cbegin() const - { - return const_iterator(m_pFirst); - } - - iterator end() - { - return iterator(m_pLast); - } - - const_iterator end() const - { - return const_iterator(m_pLast); - } - - const_iterator cend() const - { - return const_iterator(m_pLast); - } - - reverse_iterator rbegin() - { - return reverse_iterator(end()); - } - - const_reverse_iterator rbegin() const - { - return const_reverse_iterator(end()); - } - - const_reverse_iterator crbegin() const - { - return const_reverse_iterator(cend()); - } - - reverse_iterator rend() - { - return reverse_iterator(begin()); - } - - const_reverse_iterator rend() const - { - return const_reverse_iterator(begin()); - } - - const_reverse_iterator crend() const - { - return const_reverse_iterator(cbegin()); - } - - bool empty() const - { - return m_pFirst == m_pLast; - } - - size_type size() const - { - return m_pLast - m_pFirst; - } - - size_type max_size() const - { - return ~0u; - } - - size_type capacity() const - { - return m_pEnd - m_pFirst; - } - }; - - SWA_ASSERT_SIZEOF(vector, 0x10); -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/System/hhAllocator.h b/UnleashedRecomp/api/Hedgehog/Base/System/hhAllocator.h deleted file mode 100644 index 044aad47..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/System/hhAllocator.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include "SWA.inl" - -inline void* __HH_ALLOC(const uint32_t in_Size) -{ - return GuestToHostFunction(sub_822C0988, in_Size); -} - -inline void __HH_FREE(const void* in_pData) -{ - GuestToHostFunction(sub_822C0270, in_pData); -} - -namespace Hedgehog::Base -{ - template - class TAllocator - { - public: - using value_type = T; - - TAllocator() noexcept {} - template TAllocator(TAllocator const&) noexcept {} - - value_type* allocate(std::size_t n) - { - return reinterpret_cast(__HH_ALLOC(n * sizeof(value_type))); - } - - void deallocate(value_type* p, std::size_t) noexcept - { - __HH_FREE(p); - } - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.h b/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.h deleted file mode 100644 index 2b874e9c..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Base -{ - class CSharedString; - - class CStringSymbol - { - public: - be m_Index; - - CStringSymbol(); - CStringSymbol(const char* in_pName); - CStringSymbol(const CSharedString& in_rName); - - bool operator==(const CStringSymbol& in_rOther) const; - bool operator!=(const CStringSymbol& in_rOther) const; - bool operator<(const CStringSymbol& in_rOther) const; - }; - - SWA_ASSERT_OFFSETOF(CStringSymbol, m_Index, 0); - SWA_ASSERT_SIZEOF(CStringSymbol, 4); -} - -#include diff --git a/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.inl b/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.inl deleted file mode 100644 index b0acc103..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/System/hhSymbol.inl +++ /dev/null @@ -1,31 +0,0 @@ -namespace Hedgehog::Base -{ - inline CStringSymbol::CStringSymbol() - { - } - - inline CStringSymbol::CStringSymbol(const char* in_pName) - { - GuestToHostFunction(sub_82E014D8, this, in_pName); - } - - inline CStringSymbol::CStringSymbol(const CSharedString& in_rName) - { - GuestToHostFunction(sub_82E013B0, this, &in_rName); - } - - inline bool CStringSymbol::operator==(const CStringSymbol& in_rOther) const - { - return m_Index == in_rOther.m_Index; - } - - inline bool CStringSymbol::operator!=(const CStringSymbol& in_rOther) const - { - return m_Index != in_rOther.m_Index; - } - - inline bool CStringSymbol::operator<(const CStringSymbol& in_rOther) const - { - return m_Index < in_rOther.m_Index; - } -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Thread/hhHolder.h b/UnleashedRecomp/api/Hedgehog/Base/Thread/hhHolder.h deleted file mode 100644 index 1e23c78c..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Thread/hhHolder.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "Hedgehog/Base/Thread/hhHolderBase.h" - -#define HH_BASE_HOLDER(x) \ - Hedgehog::Base::THolder(x) - -namespace Hedgehog::Base -{ - template - class THolder : public CHolderBase - { - public: - THolder(T* in_pObject) : CHolderBase(in_pObject, ForceSync) {} - - T* get() const; - T* operator->() const; - T* operator*() const; - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Thread/hhHolderBase.h b/UnleashedRecomp/api/Hedgehog/Base/Thread/hhHolderBase.h deleted file mode 100644 index 2d5d80a1..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Thread/hhHolderBase.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace Hedgehog::Base -{ - class CSynchronizedObject; - - class CHolderBase - { - protected: - xpointer m_pSynchronizedObject; - bool m_Locked; - - public: - CHolderBase() : m_pSynchronizedObject(nullptr), m_Locked(false) {} - CHolderBase(CSynchronizedObject* in_pSynchronizedObject, bool in_ForceSync = false); - CHolderBase(CHolderBase&& io_rOther); - CHolderBase(const CHolderBase& in_rOther); - ~CHolderBase(); - - CSynchronizedObject* get() const; - CSynchronizedObject* operator->() const; - CSynchronizedObject* operator*() const; - - explicit operator bool() const; - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Thread/hhSynchronizedObject.h b/UnleashedRecomp/api/Hedgehog/Base/Thread/hhSynchronizedObject.h deleted file mode 100644 index d84df970..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Thread/hhSynchronizedObject.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace Hedgehog::Base -{ - class CSynchronizedObject - { - public: - SWA_INSERT_PADDING(0x04); - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Thread/hhSynchronizedPtr.h b/UnleashedRecomp/api/Hedgehog/Base/Thread/hhSynchronizedPtr.h deleted file mode 100644 index 53889dd1..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Thread/hhSynchronizedPtr.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "Hedgehog/Base/Thread/hhHolder.h" - -namespace Hedgehog::Base -{ - template - class TSynchronizedPtr - { - xpointer m_pObject; - - public: - TSynchronizedPtr(T* in_pObject); - TSynchronizedPtr(); - TSynchronizedPtr(const TSynchronizedPtr& in_rOther); - TSynchronizedPtr(TSynchronizedPtr&& io_rOther); - - TSynchronizedPtr& operator=(T* const in_pObject); - - THolder get() const; - THolder operator->() const; - THolder operator*() const; - - explicit operator bool() const; - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.h b/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.h deleted file mode 100644 index bc3dbc2b..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Base -{ - struct SStringHolder - { - be RefCount; - char aStr[]; - - static SStringHolder* GetHolder(const char* in_pStr); - static SStringHolder* Make(const char* in_pStr); - - void AddRef(); - void Release(); - - bool IsUnique() const; - }; -} - -#include diff --git a/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.inl b/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.inl deleted file mode 100644 index 0daf6e6f..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Type/detail/hhStringHolder.inl +++ /dev/null @@ -1,47 +0,0 @@ -namespace Hedgehog::Base -{ - inline SStringHolder* SStringHolder::GetHolder(const char* in_pStr) - { - return (SStringHolder*)((size_t)in_pStr - sizeof(RefCount)); - } - - inline SStringHolder* SStringHolder::Make(const char* in_pStr) - { - auto pHolder = (SStringHolder*)__HH_ALLOC(sizeof(RefCount) + strlen(in_pStr) + 1); - pHolder->RefCount = 1; - strcpy(pHolder->aStr, in_pStr); - return pHolder; - } - - inline void SStringHolder::AddRef() - { - std::atomic_ref refCount(RefCount.value); - - be original, incremented; - do - { - original = RefCount; - incremented = original + 1; - } while (!refCount.compare_exchange_weak(original.value, incremented.value)); - } - - inline void SStringHolder::Release() - { - std::atomic_ref refCount(RefCount.value); - - be original, decremented; - do - { - original = RefCount; - decremented = original - 1; - } while (!refCount.compare_exchange_weak(original.value, decremented.value)); - - if (decremented == 0) - __HH_FREE(this); - } - - inline bool SStringHolder::IsUnique() const - { - return RefCount == 1; - } -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/Type/hhSharedString.h b/UnleashedRecomp/api/Hedgehog/Base/Type/hhSharedString.h deleted file mode 100644 index 8ce1201c..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Type/hhSharedString.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Base -{ - class CSharedString - { - private: - xpointer m_pStr; - - SStringHolder* GetHolder() const; - - CSharedString(SStringHolder* in_pHolder); - - public: - static constexpr size_t npos = ~0u; - - CSharedString(); - CSharedString(const char* in_pStr); - CSharedString(const CSharedString& in_rOther); - CSharedString(CSharedString&& io_rOther); - ~CSharedString(); - - const char* get() const; - const char* c_str() const; - const char* data() const; - - size_t size() const; - size_t length() const; - bool empty() const; - - const char* begin() const; - const char* end() const; - }; -} - -#include diff --git a/UnleashedRecomp/api/Hedgehog/Base/Type/hhSharedString.inl b/UnleashedRecomp/api/Hedgehog/Base/Type/hhSharedString.inl deleted file mode 100644 index 2bddc716..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/Type/hhSharedString.inl +++ /dev/null @@ -1,78 +0,0 @@ -namespace Hedgehog::Base -{ - inline SStringHolder* CSharedString::GetHolder() const - { - return SStringHolder::GetHolder(m_pStr); - } - - inline CSharedString::CSharedString(SStringHolder* in_pHolder) : m_pStr(in_pHolder->aStr) - { - } - - inline CSharedString::CSharedString() : m_pStr(nullptr) - { - } - - inline CSharedString::CSharedString(const char* in_pStr) : m_pStr(nullptr) - { - size_t length; - - if (in_pStr && (length = strlen(in_pStr)) != 0) - m_pStr.ptr = g_memory.MapVirtual(SStringHolder::Make(in_pStr)->aStr); - } - - inline CSharedString::CSharedString(const CSharedString& in_rOther) : m_pStr(in_rOther.m_pStr) - { - GetHolder()->AddRef(); - } - - inline CSharedString::CSharedString(CSharedString&& io_rOther) : m_pStr(io_rOther.m_pStr) - { - io_rOther.m_pStr = nullptr; - } - - inline CSharedString::~CSharedString() - { - GetHolder()->Release(); - } - - inline const char* CSharedString::get() const - { - return m_pStr; - } - - inline const char* CSharedString::c_str() const - { - return get(); - } - - inline const char* CSharedString::data() const - { - return get(); - } - - inline size_t CSharedString::size() const - { - return strlen(m_pStr); - } - - inline size_t CSharedString::length() const - { - return size(); - } - - inline bool CSharedString::empty() const - { - return size() == 0; - } - - inline const char* CSharedString::begin() const - { - return get(); - } - - inline const char* CSharedString::end() const - { - return &m_pStr[size()]; - } -} diff --git a/UnleashedRecomp/api/Hedgehog/Base/hhObject.h b/UnleashedRecomp/api/Hedgehog/Base/hhObject.h deleted file mode 100644 index 80723ee2..00000000 --- a/UnleashedRecomp/api/Hedgehog/Base/hhObject.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace Hedgehog::Base -{ - class CObject - { - public: - CObject(); - CObject(const swa_null_ctor&); - - void* operator new(const size_t in_Size); - void* operator new(const size_t in_Size, const size_t in_Align); - - void operator delete(void* in_pMem); - - void* operator new(const size_t in_Size, void* in_pObj); - void* operator new(const size_t in_Size, const size_t in_Align, void* in_pObj); - - void operator delete(void* in_pMem, void* in_pObj); - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h deleted file mode 100644 index 3a7ac2b0..00000000 --- a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include - -namespace Hedgehog::Database -{ - enum EDatabaseDataFlags : uint8_t - { - eDatabaseDataFlags_IsMadeOne = 0x1, - eDatabaseDataFlags_IsMadeAll = 0x2, - eDatabaseDataFlags_CreatedFromArchive = 0x4, - eDatabaseDataFlags_IsMadeMakingOne = 0x8 - }; - - class CDatabaseData : public Base::CObject - { - public: - struct Vftable - { - be m_fpDtor; - be m_fpCheckMadeAll; - }; - - xpointer m_pVftable; - uint8_t m_Flags; - Base::CSharedString m_TypeAndName; - - ~CDatabaseData(); - bool CheckMadeAll(); - - bool IsMadeOne() const; - void SetMadeOne(); - - bool IsMadeAllInternal(); - bool IsMadeAll(); - }; -} - -#include "Hedgehog/Database/System/hhDatabaseData.inl" diff --git a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl b/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl deleted file mode 100644 index 6132b394..00000000 --- a/UnleashedRecomp/api/Hedgehog/Database/System/hhDatabaseData.inl +++ /dev/null @@ -1,36 +0,0 @@ -namespace Hedgehog::Database -{ - inline CDatabaseData::~CDatabaseData() - { - GuestToHostFunction(m_pVftable->m_fpDtor, this); - } - - inline bool CDatabaseData::CheckMadeAll() - { - return GuestToHostFunction(m_pVftable->m_fpCheckMadeAll, this); - } - - inline bool CDatabaseData::IsMadeOne() const - { - return (m_Flags & eDatabaseDataFlags_IsMadeOne) != 0; - } - - inline void CDatabaseData::SetMadeOne() - { - m_Flags |= eDatabaseDataFlags_IsMadeOne; - } - - inline bool CDatabaseData::IsMadeAllInternal() - { - if ((m_Flags & eDatabaseDataFlags_IsMadeOne) == 0 || !CheckMadeAll()) - return false; - - m_Flags |= eDatabaseDataFlags_IsMadeAll; - return true; - } - - inline bool CDatabaseData::IsMadeAll() - { - return (m_Flags & eDatabaseDataFlags_IsMadeAll) != 0 || IsMadeAllInternal(); - } -} diff --git a/UnleashedRecomp/api/Hedgehog/Math/Matrix.h b/UnleashedRecomp/api/Hedgehog/Math/Matrix.h deleted file mode 100644 index a2798362..00000000 --- a/UnleashedRecomp/api/Hedgehog/Math/Matrix.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Math -{ - class CMatrix - { - public: - be m_M00; - be m_M01; - be m_M02; - be m_M03; - be m_M10; - be m_M11; - be m_M12; - be m_M13; - be m_M20; - be m_M21; - be m_M22; - be m_M23; - be m_M30; - be m_M31; - be m_M32; - be m_M33; - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Math/Quaternion.h b/UnleashedRecomp/api/Hedgehog/Math/Quaternion.h deleted file mode 100644 index b0bc5771..00000000 --- a/UnleashedRecomp/api/Hedgehog/Math/Quaternion.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Math -{ - class CQuaternion - { - public: - be X; - be Y; - be Z; - be W; - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Math/Vector.h b/UnleashedRecomp/api/Hedgehog/Math/Vector.h deleted file mode 100644 index 7ea0e382..00000000 --- a/UnleashedRecomp/api/Hedgehog/Math/Vector.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace Hedgehog::Math -{ - class CVector2 - { - public: - be X; - be Y; - }; - - class CVector - { - public: - be X; - be Y; - be Z; - be W; - }; - - class CVector4 - { - public: - be X; - be Y; - be Z; - be W; - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/MatrixNode/hhMatrixNode.h b/UnleashedRecomp/api/Hedgehog/MirageCore/MatrixNode/hhMatrixNode.h deleted file mode 100644 index 5304186d..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/MatrixNode/hhMatrixNode.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Mirage -{ - class CMatrixNodeListener; - - class CMatrixNode : public Base::CObject - { - public: - SWA_INSERT_PADDING(0x60); - }; - - SWA_ASSERT_SIZEOF(CMatrixNode, 0x60); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhTransform.h b/UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhTransform.h deleted file mode 100644 index 751598b7..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhTransform.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Mirage -{ - class CTransform - { - public: - Math::CQuaternion m_Rotation; - Math::CVector m_Position; - Math::CMatrix m_Matrix; - }; - - SWA_ASSERT_OFFSETOF(CTransform, m_Rotation, 0x00); - SWA_ASSERT_OFFSETOF(CTransform, m_Position, 0x10); - SWA_ASSERT_OFFSETOF(CTransform, m_Matrix, 0x20); - SWA_ASSERT_SIZEOF(CTransform, 0x60); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h b/UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h deleted file mode 100644 index bf0c4917..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Mirage -{ - class CRenderingInfrastructure; - - class CVertexDeclarationPtr - { - public: - xpointer m_pD3DVertexDeclaration; - xpointer m_pRenderingInfrastructure; - }; - - SWA_ASSERT_OFFSETOF(CVertexDeclarationPtr, m_pD3DVertexDeclaration, 0x0); - SWA_ASSERT_OFFSETOF(CVertexDeclarationPtr, m_pRenderingInfrastructure, 0x4); - SWA_ASSERT_SIZEOF(CVertexDeclarationPtr, 0x8); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMaterialData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMaterialData.h deleted file mode 100644 index 0be6a3e2..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMaterialData.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace Hedgehog::Mirage -{ - class CMaterialData; - class CTexsetData; - class CShaderListData; - class CParameterFloat4Element; - class CParameterInt4Element; - class CParameterBoolElement; - - class CMaterialData : public Database::CDatabaseData - { - public: - boost::shared_ptr m_spShaderListData; - boost::shared_ptr m_spTexsetData; - hh::vector> m_Float4Params; - hh::vector> m_Int4Params; - hh::vector> m_Bool4Params; - uint8_t m_AlphaThreshold; - bool m_DoubleSided; - bool m_Additive; - }; - - SWA_ASSERT_OFFSETOF(CMaterialData, m_spShaderListData, 0xC); - SWA_ASSERT_OFFSETOF(CMaterialData, m_spTexsetData, 0x14); - SWA_ASSERT_OFFSETOF(CMaterialData, m_Float4Params, 0x1C); - SWA_ASSERT_OFFSETOF(CMaterialData, m_Int4Params, 0x2C); - SWA_ASSERT_OFFSETOF(CMaterialData, m_Bool4Params, 0x3C); - SWA_ASSERT_OFFSETOF(CMaterialData, m_AlphaThreshold, 0x4C); - SWA_ASSERT_OFFSETOF(CMaterialData, m_DoubleSided, 0x4D); - SWA_ASSERT_OFFSETOF(CMaterialData, m_Additive, 0x4E); - SWA_ASSERT_SIZEOF(CMaterialData, 0x50); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMeshData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMeshData.h deleted file mode 100644 index 3fc6a9f9..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMeshData.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include - -#include -#include -#include - -namespace Hedgehog::Mirage -{ - class CMaterialData; - - class CMeshData : public Database::CDatabaseData - { - public: - be m_IndexNum; - be m_VertexNum; - be m_VertexSize; - be m_NodeNum; - xpointer m_pNodeIndices; - be m_VertexOffset; - be m_IndexOffset; - xpointer m_pD3DIndexBuffer; - xpointer m_pD3DVertexBuffer; - CVertexDeclarationPtr m_VertexDeclarationPtr; - SWA_INSERT_PADDING(0x4); - boost::shared_ptr m_spMaterial; - SWA_INSERT_PADDING(0xC); - }; - - SWA_ASSERT_OFFSETOF(CMeshData, m_IndexNum, 0xC); - SWA_ASSERT_OFFSETOF(CMeshData, m_VertexNum, 0x10); - SWA_ASSERT_OFFSETOF(CMeshData, m_VertexSize, 0x14); - SWA_ASSERT_OFFSETOF(CMeshData, m_NodeNum, 0x18); - SWA_ASSERT_OFFSETOF(CMeshData, m_pNodeIndices, 0x1C); - SWA_ASSERT_OFFSETOF(CMeshData, m_VertexOffset, 0x20); - SWA_ASSERT_OFFSETOF(CMeshData, m_IndexOffset, 0x24); - SWA_ASSERT_OFFSETOF(CMeshData, m_pD3DIndexBuffer, 0x28); - SWA_ASSERT_OFFSETOF(CMeshData, m_pD3DVertexBuffer, 0x2C); - SWA_ASSERT_OFFSETOF(CMeshData, m_VertexDeclarationPtr, 0x30); - SWA_ASSERT_OFFSETOF(CMeshData, m_spMaterial, 0x3C); - SWA_ASSERT_SIZEOF(CMeshData, 0x50); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMeshIndexData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMeshIndexData.h deleted file mode 100644 index 4c01e289..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMeshIndexData.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include - -namespace Hedgehog::Mirage -{ - class CMaterialData; - - class CMeshIndexData : public Hedgehog::Database::CDatabaseData - { - public: - be m_IndexNum; - be m_NodeNum; - xpointer m_pNodeIndices; - xpointer m_pD3DIndexBuffer; - boost::shared_ptr m_spMaterial; - }; - - SWA_ASSERT_OFFSETOF(CMeshIndexData, m_IndexNum, 0xC); - SWA_ASSERT_OFFSETOF(CMeshIndexData, m_NodeNum, 0x10); - SWA_ASSERT_OFFSETOF(CMeshIndexData, m_pNodeIndices, 0x14); - SWA_ASSERT_OFFSETOF(CMeshIndexData, m_pD3DIndexBuffer, 0x18); - SWA_ASSERT_OFFSETOF(CMeshIndexData, m_spMaterial, 0x1C); - SWA_ASSERT_SIZEOF(CMeshIndexData, 0x24); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhModelData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhModelData.h deleted file mode 100644 index d29bc11f..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhModelData.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include -#include - -namespace Hedgehog::Mirage -{ - class CNodeGroupModelData; - class CMeshData; - class CModelNodeData; - class CMatrixData; - class CAabbData; - class CSphereData; - class CMorphModelData; - - class CModelData : public Database::CDatabaseData - { - public: - be m_NodeGroupModelNum; - hh::vector> m_NodeGroupModels; - hh::vector> m_OpaqueMeshes; - hh::vector> m_TransparentMeshes; - hh::vector> m_PunchThroughMeshes; - be m_NodeNum; - boost::shared_ptr m_spNodeParentIndices; - boost::shared_ptr m_spNodes; - boost::shared_ptr m_spNodeMatrices; - boost::shared_ptr m_spAabb; - boost::shared_ptr m_spSphere; - hh::vector> m_MorphModels; - }; - - SWA_ASSERT_OFFSETOF(CModelData, m_NodeGroupModelNum, 0xC); - SWA_ASSERT_OFFSETOF(CModelData, m_NodeGroupModels, 0x10); - SWA_ASSERT_OFFSETOF(CModelData, m_OpaqueMeshes, 0x20); - SWA_ASSERT_OFFSETOF(CModelData, m_TransparentMeshes, 0x30); - SWA_ASSERT_OFFSETOF(CModelData, m_PunchThroughMeshes, 0x40); - SWA_ASSERT_OFFSETOF(CModelData, m_NodeNum, 0x50); - SWA_ASSERT_OFFSETOF(CModelData, m_spNodeParentIndices, 0x54); - SWA_ASSERT_OFFSETOF(CModelData, m_spNodes, 0x5C); - SWA_ASSERT_OFFSETOF(CModelData, m_spNodeMatrices, 0x64); - SWA_ASSERT_OFFSETOF(CModelData, m_spAabb, 0x6C); - SWA_ASSERT_OFFSETOF(CModelData, m_spSphere, 0x74); - SWA_ASSERT_OFFSETOF(CModelData, m_MorphModels, 0x7C); - SWA_ASSERT_SIZEOF(CModelData, 0x8C); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMorphModelData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMorphModelData.h deleted file mode 100644 index 7da092b0..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhMorphModelData.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include - -#include -#include -#include - -namespace Hedgehog::Mirage -{ - class CMorphTargetData; - class CMeshIndexData; - - class CMorphModelData : public Hedgehog::Database::CDatabaseData - { - public: - be m_VertexNum; - be m_VertexSize; - be m_MorphTargetVertexSize; - xpointer m_pD3DVertexBuffer; - CVertexDeclarationPtr m_VertexDeclarationPtr; - hh::vector> m_MorphTargetList; - hh::vector> m_OpaqueMeshList; - hh::vector> m_TransparentMeshList; - hh::vector> m_PunchThroughMeshList; - }; - - SWA_ASSERT_OFFSETOF(CMorphModelData, m_VertexNum, 0xC); - SWA_ASSERT_OFFSETOF(CMorphModelData, m_VertexSize, 0x10); - SWA_ASSERT_OFFSETOF(CMorphModelData, m_MorphTargetVertexSize, 0x14); - SWA_ASSERT_OFFSETOF(CMorphModelData, m_pD3DVertexBuffer, 0x18); - SWA_ASSERT_OFFSETOF(CMorphModelData, m_VertexDeclarationPtr, 0x1C); - SWA_ASSERT_OFFSETOF(CMorphModelData, m_MorphTargetList, 0x24); - SWA_ASSERT_OFFSETOF(CMorphModelData, m_OpaqueMeshList, 0x34); - SWA_ASSERT_OFFSETOF(CMorphModelData, m_TransparentMeshList, 0x44); - SWA_ASSERT_OFFSETOF(CMorphModelData, m_PunchThroughMeshList, 0x54); - SWA_ASSERT_SIZEOF(CMorphModelData, 0x64); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhNodeGroupModelData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhNodeGroupModelData.h deleted file mode 100644 index 1c37548b..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhNodeGroupModelData.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include -#include - -namespace Hedgehog::Mirage -{ - class CMeshData; - - class CNodeGroupModelData : public Database::CDatabaseData - { - public: - hh::vector> m_OpaqueMeshes; - hh::vector> m_TransparentMeshes; - hh::vector> m_PunchThroughMeshes; - be m_SpecialMeshGroupNum; - boost::shared_ptr> m_SpecialMeshGroupModes; - hh::vector>> m_SpecialMeshGroups; - Base::CSharedString m_Name; - }; - - SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_OpaqueMeshes, 0xC); - SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_TransparentMeshes, 0x1C); - SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_PunchThroughMeshes, 0x2C); - SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_SpecialMeshGroupNum, 0x3C); - SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_SpecialMeshGroupModes, 0x40); - SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_SpecialMeshGroups, 0x48); - SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_Name, 0x58); - SWA_ASSERT_SIZEOF(CNodeGroupModelData, 0x5C); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderCodeData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderCodeData.h deleted file mode 100644 index ab275e28..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderCodeData.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include - -#include - -namespace Hedgehog::Base -{ - class CCriticalSectionD3D9; -} - -namespace Hedgehog::Mirage -{ - class CRenderingInfrastructure; - - class CPixelShaderCodeData : public Database::CDatabaseData - { - public: - xpointer m_pD3DPixelShader; - xpointer m_spFunction; - boost::shared_ptr m_spCriticalSection; - xpointer m_pRenderingInfrastructure; - }; - - SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_pD3DPixelShader, 0xC); - SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_spFunction, 0x10); - SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_spCriticalSection, 0x14); - SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_pRenderingInfrastructure, 0x1C); - SWA_ASSERT_SIZEOF(CPixelShaderCodeData, 0x20); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderData.h deleted file mode 100644 index e2740243..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhPixelShaderData.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include - -namespace Hedgehog::Mirage -{ - class CPixelShaderCodeData; - class CPixelShaderParameterData; - - class CPixelShaderData : public Hedgehog::Database::CDatabaseData - { - public: - boost::shared_ptr m_spCode; - SWA_INSERT_PADDING(0x4); - hh::vector> m_ParameterList; - }; - - SWA_ASSERT_OFFSETOF(CPixelShaderData, m_spCode, 0xC); - SWA_ASSERT_OFFSETOF(CPixelShaderData, m_ParameterList, 0x18); - SWA_ASSERT_SIZEOF(CPixelShaderData, 0x28); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhShaderListData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhShaderListData.h deleted file mode 100644 index 3731fff8..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhShaderListData.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include - -#include -#include -#include - -namespace Hedgehog::Mirage -{ - class CVertexShaderData; - class CPixelShaderData; - - class CVertexShaderPermutationData - { - public: - hh::map, boost::shared_ptr> m_VertexShaders; - be m_SubPermutations; - }; - - SWA_ASSERT_OFFSETOF(CVertexShaderPermutationData, m_VertexShaders, 0x0); - SWA_ASSERT_OFFSETOF(CVertexShaderPermutationData, m_SubPermutations, 0xC); - SWA_ASSERT_SIZEOF(CVertexShaderPermutationData, 0x10); - - class CPixelShaderPermutationData - { - public: - hh::map> m_VertexShaderPermutations; - hh::map, boost::shared_ptr> m_PixelShaders; - be m_SubPermutations; - }; - - SWA_ASSERT_OFFSETOF(CPixelShaderPermutationData, m_VertexShaderPermutations, 0x0); - SWA_ASSERT_OFFSETOF(CPixelShaderPermutationData, m_PixelShaders, 0xC); - SWA_ASSERT_OFFSETOF(CPixelShaderPermutationData, m_SubPermutations, 0x18); - SWA_ASSERT_SIZEOF(CPixelShaderPermutationData, 0x1C); - - class CShaderListData : public Database::CDatabaseData - { - public: - hh::map m_PixelShaderPermutations; - }; - - SWA_ASSERT_OFFSETOF(CShaderListData, m_PixelShaderPermutations, 0xC); - SWA_ASSERT_SIZEOF(CShaderListData, 0x18); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTerrainModelData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTerrainModelData.h deleted file mode 100644 index 5f0d6b33..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTerrainModelData.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include - -namespace Hedgehog::Mirage -{ - class CSphereData; - class CNodeGroupModelData; - class CMeshData; - - class CTerrainModelData : public Database::CDatabaseData - { - public: - SWA_INSERT_PADDING(0x4); - hh::vector> m_NodeGroupModels; - hh::vector> m_OpaqueMeshes; - hh::vector> m_TransparentMeshes; - hh::vector> m_PunchThroughMeshes; - boost::shared_ptr m_spSphere; - }; - - SWA_ASSERT_OFFSETOF(CTerrainModelData, m_NodeGroupModels, 0x10); - SWA_ASSERT_OFFSETOF(CTerrainModelData, m_OpaqueMeshes, 0x20); - SWA_ASSERT_OFFSETOF(CTerrainModelData, m_TransparentMeshes, 0x30); - SWA_ASSERT_OFFSETOF(CTerrainModelData, m_PunchThroughMeshes, 0x40); - SWA_ASSERT_OFFSETOF(CTerrainModelData, m_spSphere, 0x50); - SWA_ASSERT_SIZEOF(CTerrainModelData, 0x58); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTexsetData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTexsetData.h deleted file mode 100644 index 627bf04d..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTexsetData.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace Hedgehog::Mirage -{ - class CTextureData; - - class CTexsetData : public Database::CDatabaseData - { - public: - hh::vector> m_TextureList; - hh::vector m_TextureNameList; - bool m_ConstTexCoord; - }; - - SWA_ASSERT_OFFSETOF(CTexsetData, m_TextureList, 0xC); - SWA_ASSERT_OFFSETOF(CTexsetData, m_TextureNameList, 0x1C); - SWA_ASSERT_OFFSETOF(CTexsetData, m_ConstTexCoord, 0x2C); - SWA_ASSERT_SIZEOF(CTexsetData, 0x30); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTextureData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTextureData.h deleted file mode 100644 index cf8abbee..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhTextureData.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Mirage -{ - class CTextureData : public Database::CDatabaseData - { - public: - SWA_INSERT_PADDING(0x8); - uint8_t m_TexcoordIndex; - SWA_INSERT_PADDING(0x1B); - }; - - SWA_ASSERT_OFFSETOF(CTextureData, m_TexcoordIndex, 0x14); - SWA_ASSERT_SIZEOF(CTextureData, 0x30); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderCodeData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderCodeData.h deleted file mode 100644 index 9956d2e2..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderCodeData.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include - -#include - -namespace Hedgehog::Base -{ - class CCriticalSectionD3D9; -} - -namespace Hedgehog::Mirage -{ - class CRenderingInfrastructure; - - class CVertexShaderCodeData : public Database::CDatabaseData - { - public: - xpointer m_pD3DVertexShader; - xpointer m_spFunction; - boost::shared_ptr m_spCriticalSection; - xpointer m_pRenderingInfrastructure; - }; - - SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_pD3DVertexShader, 0xC); - SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_spFunction, 0x10); - SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_spCriticalSection, 0x14); - SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_pRenderingInfrastructure, 0x1C); - SWA_ASSERT_SIZEOF(CVertexShaderCodeData, 0x20); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderData.h b/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderData.h deleted file mode 100644 index f9509952..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/RenderData/hhVertexShaderData.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include - -namespace Hedgehog::Mirage -{ - class CVertexShaderCodeData; - class CVertexShaderParameterData; - - class CVertexShaderData : public Hedgehog::Database::CDatabaseData - { - public: - boost::shared_ptr m_spCode; - SWA_INSERT_PADDING(0x4); - hh::vector> m_ParameterList; - }; - - SWA_ASSERT_OFFSETOF(CVertexShaderData, m_spCode, 0xC); - SWA_ASSERT_OFFSETOF(CVertexShaderData, m_ParameterList, 0x18); - SWA_ASSERT_SIZEOF(CVertexShaderData, 0x28); -} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/Renderable/hhRenderable.h b/UnleashedRecomp/api/Hedgehog/MirageCore/Renderable/hhRenderable.h deleted file mode 100644 index 73fd409e..00000000 --- a/UnleashedRecomp/api/Hedgehog/MirageCore/Renderable/hhRenderable.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "Hedgehog/Base/hhObject.h" - -namespace Hedgehog::Mirage -{ - class CRenderable : public Base::CObject - { - public: - xpointer m_pVftable; - bool m_Enabled; - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Sparkle/hhParticleMaterial.h b/UnleashedRecomp/api/Hedgehog/Sparkle/hhParticleMaterial.h deleted file mode 100644 index 75bb1b33..00000000 --- a/UnleashedRecomp/api/Hedgehog/Sparkle/hhParticleMaterial.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace Hedgehog::Mirage -{ - class CShaderListData; -} - -namespace Hedgehog::Sparkle -{ - class CParticleMaterial : public Hedgehog::Database::CDatabaseData - { - public: - enum EBlendMode - { - eBlendMode_Zero, - eBlendMode_Typical, - eBlendMode_Add, - eBlendMode_Subtract - }; - - hh::vector m_spFieldC; - boost::shared_ptr m_spDefaultShaderListData; // BillboardParticle_d[v] - boost::shared_ptr m_spShaderListData; - bool m_Field2C; - be m_BlendMode; - be m_AddressMode; - Hedgehog::Base::CSharedString m_MaterialName; - Hedgehog::Base::CSharedString m_TextureName; - Hedgehog::Base::CSharedString m_DeflectionTextureName; - Hedgehog::Base::CSharedString m_ShaderName; - be m_Field48; - be m_Field4C; - }; - - SWA_ASSERT_SIZEOF(CParticleMaterial, 0x50); -} diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhMessageActor.h b/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhMessageActor.h deleted file mode 100644 index c7d55493..00000000 --- a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhMessageActor.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "Hedgehog/Universe/Engine/hhMessageProcess.h" -#include "Hedgehog/Universe/Thread/hhParallelJob.h" - -namespace Hedgehog::Universe -{ - class CMessageActor : public IMessageProcess, public IParallelJob - { - public: - SWA_INSERT_PADDING(0x88); - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhMessageProcess.h b/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhMessageProcess.h deleted file mode 100644 index b5b42d49..00000000 --- a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhMessageProcess.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "Hedgehog/Base/hhObject.h" - -namespace Hedgehog::Universe -{ - class IMessageProcess : public Base::CObject - { - public: - IMessageProcess() {} - IMessageProcess(const swa_null_ctor& nil) : CObject(nil) {} - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhStateMachineBase.h b/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhStateMachineBase.h deleted file mode 100644 index 269cf865..00000000 --- a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhStateMachineBase.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace Hedgehog::Universe -{ - class CStateMachineBase : public IStateMachineMessageReceiver, public Base::CObject - { - public: - class CStateBase : public IMessageProcess - { - public: - SWA_INSERT_PADDING(0x08); - xpointer m_pContext; - xpointer m_pStateMachine; - be m_Time; - SWA_INSERT_PADDING(0x4C); - - void* GetContextBase() const; - - template - T* GetContextBase() const; - }; - - SWA_INSERT_PADDING(0x60); - }; -} - -#include diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhStateMachineBase.inl b/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhStateMachineBase.inl deleted file mode 100644 index 0750b37f..00000000 --- a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhStateMachineBase.inl +++ /dev/null @@ -1,13 +0,0 @@ -namespace Hedgehog::Universe -{ - inline void* CStateMachineBase::CStateBase::GetContextBase() const - { - return m_pContext; - } - - template - inline T* CStateMachineBase::CStateBase::GetContextBase() const - { - return (T*)m_pContext.get(); - } -} diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhStateMachineMessageReceiver.h b/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhStateMachineMessageReceiver.h deleted file mode 100644 index f75ce5ee..00000000 --- a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhStateMachineMessageReceiver.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace Hedgehog::Universe -{ - class IStateMachineMessageReceiver - { - public: - IStateMachineMessageReceiver(const swa_null_ctor&) {} - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateInfo.h b/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateInfo.h deleted file mode 100644 index 4369392e..00000000 --- a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateInfo.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace Hedgehog::Universe -{ - struct SUpdateInfo - { - be DeltaTime; - be Frame; - Base::CSharedString Category; - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateUnit.h b/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateUnit.h deleted file mode 100644 index 64513e66..00000000 --- a/UnleashedRecomp/api/Hedgehog/Universe/Engine/hhUpdateUnit.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "Hedgehog/Universe/Thread/hhParallelJob.h" - -namespace Hedgehog::Universe -{ - class CUpdateUnit : public Base::CObject, public IParallelJob - { - public: - xpointer m_pVftable; - SWA_INSERT_PADDING(0x20); - - CUpdateUnit(const swa_null_ctor& nil) : CObject(nil), IParallelJob(nil) {} - CUpdateUnit(); - - // 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) {} - }; -} diff --git a/UnleashedRecomp/api/Hedgehog/Universe/Thread/hhParallelJob.h b/UnleashedRecomp/api/Hedgehog/Universe/Thread/hhParallelJob.h deleted file mode 100644 index 60b59be3..00000000 --- a/UnleashedRecomp/api/Hedgehog/Universe/Thread/hhParallelJob.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "Hedgehog/Universe/Engine/hhUpdateInfo.h" - -namespace Hedgehog::Universe -{ - class IParallelJob - { - public: - xpointer m_pVftable; - - IParallelJob() {} - IParallelJob(const swa_null_ctor&) {} - - // TODO: implement virtual functions. - // virtual ~IParallelJob() = default; - // - // virtual void ExecuteParallelJob(const SUpdateInfo& in_rUpdateInfo) = 0; - }; -} diff --git a/UnleashedRecomp/api/README.md b/UnleashedRecomp/api/README.md deleted file mode 100644 index 8239ff7e..00000000 --- a/UnleashedRecomp/api/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# SWA - -## Contribution Guide - -### Naming Conventions - -- Use `camelCase` for local variables, `SNAKE_CASE` for preprocessor macros, and `PascalCase` for everything else. SWA-specific types that don't exist in the game should use `snake_case` for better differentiation. -- Class names should be prefixed with `C`, e.g., `CSonicContext`. -- Struct names should be prefixed with `S`, e.g., `SUpdateInfo`. -- Class members should be prefixed with `m_`, e.g., `m_Time`. Do not use this prefix for struct members. -- Enum names should be prefixed with `E`, e.g., `ELightType`. -- Enum members should start with `e`, followed by the enum name and an underscore, e.g., `eLightType_Point`. -- For enum members indicating the count of elements, prefix with `n`, followed by the name, e.g., `nLightType`. -- Pointers should be prefixed with `p`, e.g., `pSonicContext`. -- Shared pointers should be prefixed with `sp`, e.g., `spDatabase`. -- References should be prefixed with `r`, e.g., `rMessage`. -- Input function arguments should be prefixed with `in_`, e.g., `in_Name`. -- Output function arguments should be prefixed with `out_`, e.g., `out_Value`. -- Static class members should be prefixed with `ms_`, e.g., `ms_Instance`. -- Static members outside a class should be prefixed with `g_`, e.g., `g_AllocationTracker`. -- SWA-specific preprocessor macros should start with `SWA_`, e.g., `SWA_INSERT_PADDING`. -- Hedgehog namespace-specific preprocessor macros should start with `HH_` along with the library's shorthand, e.g., `HH_FND_MSG_MAKE_TYPE`. -- Function pointers should be prefixed with `fp`, e.g., `fpCGameObjectConstructor`. - -Combine prefixes as necessary, e.g., `m_sp` for a shared pointer as a class member or `in_r` for a const reference as a function argument. - -### Coding Style - -- Always place curly brackets on a new line. -- Prefer forward declaring types over including their respective headers. -- Use <> includes relative to the project's root directory path. -- Use C++17's nested namespace feature instead of defining multiple namespaces on separate lines. -- Enum classes are prohibited as they were not available when the game was developed. -- Avoid placing function definitions in .h files, instead, implement functions in the header's respective .inl file, similar to a .cpp file. -- Ensure that all class members are declared as public. Even if you suspect that a class member was private in the original code, having it public is more convenient in a modding API. -- Avoid placing multiple class definitions in a single header file unless you have a good reason to do so. -- Keep function pointers or addresses outside functions, define them as global variables in the corresponding .inl file. Mark these global variables as `inline` and never nest them within class definitions. You do not need to use the `g_` prefix for function pointers, `fp` is sufficient. -- Use primitive types defined in `cstdint` instead of using types that come with the language, e.g., use `uint32_t` instead of `unsigned int`. Using `float`, `double` and `bool` is okay. - -### Mapping Rules - -- Always include the corresponding `offsetof`/`sizeof` assertions for mapped classes/structs. If you are uncertain about the type's size, you can omit the `sizeof` assertion. -- Use the exact type name from the game if it's available through RTTI, otherwise, you can look for shared pointers that may reveal the original type name. -- If you are unsure about the name of a class/struct member, use `Field` followed by the hexadecimal byte offset (e.g., `m_Field194`). Avoid names like `m_StoresThisThingMaybe`, you can write comments next to the definition for speculations. -- If a portion of the byte range is irrelevant to your research or not mapped yet, use the `SWA_INSERT_PADDING` macro to align class/struct members correctly. -- When the class has a virtual function table, if you don't want to map every function in it, you can map only the virtual destructor. -- The original file locations are likely available in the executable file as assertion file paths. If you cannot find the file path, use your intuition to place the file in a sensible place. \ No newline at end of file diff --git a/UnleashedRecomp/api/SWA.h b/UnleashedRecomp/api/SWA.h deleted file mode 100644 index dbeb7dfd..00000000 --- a/UnleashedRecomp/api/SWA.h +++ /dev/null @@ -1,129 +0,0 @@ -#pragma once - -#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" -#include "CSD/Manager/csdmProject.h" -#include "CSD/Manager/csdmRCObject.h" -#include "CSD/Manager/csdmRCObjectImp.h" -#include "CSD/Manager/csdmRCPtr.h" -#include "CSD/Manager/csdmRCPtrAbs.h" -#include "CSD/Manager/csdmResourceBase.h" -#include "CSD/Manager/csdmScene.h" -#include "CSD/Manager/csdmSceneObserver.h" -#include "CSD/Manager/csdmSubjectBase.h" -#include "CSD/Platform/csdTexList.h" -#include "Hedgehog/Base/Container/hhMap.h" -#include "Hedgehog/Base/Container/hhVector.h" -#include "Hedgehog/Base/System/hhAllocator.h" -#include "Hedgehog/Base/System/hhSymbol.h" -#include "Hedgehog/Base/Thread/hhHolder.h" -#include "Hedgehog/Base/Thread/hhHolderBase.h" -#include "Hedgehog/Base/Thread/hhSynchronizedObject.h" -#include "Hedgehog/Base/Thread/hhSynchronizedPtr.h" -#include "Hedgehog/Base/Type/detail/hhStringHolder.h" -#include "Hedgehog/Base/Type/hhSharedString.h" -#include "Hedgehog/Base/hhObject.h" -#include "Hedgehog/Database/System/hhDatabaseData.h" -#include "Hedgehog/Math/Matrix.h" -#include "Hedgehog/Math/Quaternion.h" -#include "Hedgehog/Math/Vector.h" -#include "Hedgehog/MirageCore/MatrixNode/hhMatrixNode.h" -#include "Hedgehog/MirageCore/Misc/hhTransform.h" -#include "Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h" -#include "Hedgehog/MirageCore/RenderData/hhMaterialData.h" -#include "Hedgehog/MirageCore/RenderData/hhMeshData.h" -#include "Hedgehog/MirageCore/RenderData/hhMeshIndexData.h" -#include "Hedgehog/MirageCore/RenderData/hhModelData.h" -#include "Hedgehog/MirageCore/RenderData/hhMorphModelData.h" -#include "Hedgehog/MirageCore/RenderData/hhNodeGroupModelData.h" -#include "Hedgehog/MirageCore/RenderData/hhPixelShaderCodeData.h" -#include "Hedgehog/MirageCore/RenderData/hhPixelShaderData.h" -#include "Hedgehog/MirageCore/RenderData/hhShaderListData.h" -#include "Hedgehog/MirageCore/RenderData/hhTerrainModelData.h" -#include "Hedgehog/MirageCore/RenderData/hhTexsetData.h" -#include "Hedgehog/MirageCore/RenderData/hhTextureData.h" -#include "Hedgehog/MirageCore/RenderData/hhVertexShaderCodeData.h" -#include "Hedgehog/MirageCore/RenderData/hhVertexShaderData.h" -#include "Hedgehog/MirageCore/Renderable/hhRenderable.h" -#include "Hedgehog/Sparkle/hhParticleMaterial.h" -#include "Hedgehog/Universe/Engine/hhMessageActor.h" -#include "Hedgehog/Universe/Engine/hhMessageProcess.h" -#include "Hedgehog/Universe/Engine/hhStateMachineBase.h" -#include "Hedgehog/Universe/Engine/hhStateMachineMessageReceiver.h" -#include "Hedgehog/Universe/Engine/hhUpdateInfo.h" -#include "Hedgehog/Universe/Engine/hhUpdateUnit.h" -#include "Hedgehog/Universe/Thread/hhParallelJob.h" -#include "SWA/Achievement/AchievementID.h" -#include "SWA/Achievement/AchievementManager.h" -#include "SWA/Achievement/AchievementTest.h" -#include "SWA/Boss/EggDragoon/Object/BossEggDragoonDrillMissile.h" -#include "SWA/CSD/CsdDatabaseWrapper.h" -#include "SWA/CSD/CsdProject.h" -#include "SWA/CSD/CsdTexListMirage.h" -#include "SWA/CSD/GameObjectCSD.h" -#include "SWA/Camera/Camera.h" -#include "SWA/Camera/CameraController.h" -#include "SWA/CharacterUtility/CharacterProxy.h" -#include "SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h" -#include "SWA/ExtraStage/Tails/Enemy/Boss/State/StateBase.h" -#include "SWA/ExtraStage/Tails/Enemy/Boss/State/StateBattle.h" -#include "SWA/ExtraStage/Tails/Player/ExPlayerTails.h" -#include "SWA/Globals.h" -#include "SWA/HUD/GeneralWindow/GeneralWindow.h" -#include "SWA/HUD/Loading/Loading.h" -#include "SWA/HUD/Pause/HudPause.h" -#include "SWA/HUD/SaveIcon/SaveIcon.h" -#include "SWA/HUD/Sonic/HudSonicStage.h" -#include "SWA/Inspire/InspireMovieOverlay.h" -#include "SWA/Inspire/InspireMovieOverlayInfo.h" -#include "SWA/Inspire/InspireOpacityAnimationInfo.h" -#include "SWA/Inspire/InspireScene.h" -#include "SWA/Inspire/InspireSceneData.h" -#include "SWA/Inspire/InspireSceneInfo.h" -#include "SWA/Inspire/InspireTextureAnimationInfo.h" -#include "SWA/Inspire/InspireTextureOverlay.h" -#include "SWA/Inspire/InspireTextureOverlayInfo.h" -#include "SWA/Menu/MenuWindowBase.h" -#include "SWA/Message/MsgRequestHelp.h" -#include "SWA/Movie/MovieDisplayer.h" -#include "SWA/Movie/MovieManager.h" -#include "SWA/Object/Common/DashPanel/ObjDashPanel.h" -#include "SWA/Object/SonicStage/EU/RollingBarrel/ObjRollingBarrel.h" -#include "SWA/Player/Character/EvilSonic/EvilSonic.h" -#include "SWA/Player/Character/EvilSonic/EvilSonicContext.h" -#include "SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.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/Application.h" -#include "SWA/System/ApplicationD3D9.h" -#include "SWA/System/ApplicationDocument.h" -#include "SWA/System/ApplicationXenon.h" -#include "SWA/System/Game.h" -#include "SWA/System/GameDocument.h" -#include "SWA/System/GameMode/GameMode.h" -#include "SWA/System/GameMode/GameModeStage.h" -#include "SWA/System/GameMode/GameModeStageMovie.h" -#include "SWA/System/GameMode/GameModeStageTitle.h" -#include "SWA/System/GameMode/Title/TitleMenu.h" -#include "SWA/System/GameMode/Title/TitleStateBase.h" -#include "SWA/System/GameMode/Title/TitleStateIntro.h" -#include "SWA/System/GameMode/Title/TitleStateMenu.h" -#include "SWA/System/GameMode/Title/TitleStateWorldMap.h" -#include "SWA/System/GameMode/WorldMap/WorldMapCamera.h" -#include "SWA/System/GameMode/WorldMap/WorldMapCursor.h" -#include "SWA/System/GameObject.h" -#include "SWA/System/GameParameter.h" -#include "SWA/System/GammaController.h" -#include "SWA/System/InputState.h" -#include "SWA/System/MatrixNodeTransform.h" -#include "SWA/System/PadState.h" -#include "SWA/System/World.h" -#include "boost/smart_ptr/make_shared_object.h" -#include "boost/smart_ptr/shared_ptr.h" diff --git a/UnleashedRecomp/api/SWA.inl b/UnleashedRecomp/api/SWA.inl deleted file mode 100644 index acffd8fc..00000000 --- a/UnleashedRecomp/api/SWA.inl +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include -#include - -#define SWA_CONCAT2(x, y) x##y -#define SWA_CONCAT(x, y) SWA_CONCAT2(x, y) - -#define SWA_INSERT_PADDING(length) \ - uint8_t SWA_CONCAT(pad, __LINE__)[length] - -#define SWA_ASSERT_OFFSETOF(type, field, offset) \ - static_assert(offsetof(type, field) == offset) - -#define SWA_ASSERT_SIZEOF(type, size) \ - static_assert(sizeof(type) == size) - -#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/Achievement/AchievementID.h b/UnleashedRecomp/api/SWA/Achievement/AchievementID.h deleted file mode 100644 index 971894fe..00000000 --- a/UnleashedRecomp/api/SWA/Achievement/AchievementID.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -enum EAchievementID : uint32_t -{ - eAchievementID_StillBroken = 24, - eAchievementID_LookingBetter, - eAchievementID_StillAJigsawPuzzle, - eAchievementID_PickingUpThePieces, - eAchievementID_AlmostThere, - eAchievementID_OneMoreToGo, - eAchievementID_WorldSavior = 31, - eAchievementID_PartlyCloudy, - eAchievementID_Sunny, - eAchievementID_HalfMoon, - eAchievementID_FullMoon, - eAchievementID_BlueStreak, - eAchievementID_PowerOverwhelming, - eAchievementID_GettingTheHangOfThings, - eAchievementID_CreatureOfTheNight, - eAchievementID_HelpingHand, - eAchievementID_LayTheSmackdown, - eAchievementID_WallCrawler, - eAchievementID_Airdevil, - eAchievementID_Hyperdrive, - eAchievementID_Basher, - eAchievementID_Smasher, - eAchievementID_Crasher, - eAchievementID_Thrasher, - eAchievementID_SocialButterfly, - eAchievementID_HungryHungryHedgehog, - eAchievementID_AcePilot, - eAchievementID_DayTripper, - eAchievementID_HardDaysNight, - eAchievementID_GetOnTheExorciseBandwagon, - eAchievementID_GyroWithRelish = 64, - eAchievementID_PigInABlanket, - eAchievementID_ExoticToppings, - eAchievementID_SausageFriedRice, - eAchievementID_IcedHotdog, - eAchievementID_KebabOnABun, - eAchievementID_KetchupAndMustard, - eAchievementID_HardBoiled, - eAchievementID_FriedClamRoll, - eAchievementID_FirstTimeCustomer, - eAchievementID_OhYouShouldntHave, - eAchievementID_ThatsEnoughSeriously, - eAchievementID_Hedgehunk, - eAchievementID_IAintAfraidOfNoGhost, - eAchievementID_BFFs, - eAchievementID_SpeedingTicket, - eAchievementID_ComboKing, - eAchievementID_RingLeader, - eAchievementID_KnockoutBrawler, - eAchievementID_BlueMeteor -}; diff --git a/UnleashedRecomp/api/SWA/Achievement/AchievementManager.h b/UnleashedRecomp/api/SWA/Achievement/AchievementManager.h deleted file mode 100644 index 00c78fe7..00000000 --- a/UnleashedRecomp/api/SWA/Achievement/AchievementManager.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include - -namespace SWA::Achievement -{ - class CManager : public Hedgehog::Universe::CUpdateUnit - { - public: - class CMember - { - public: - SWA_INSERT_PADDING(0x08); - be m_AchievementID; - }; - - SWA_INSERT_PADDING(0x98); - xpointer m_pMember; - be m_IsUnlocked; - SWA_INSERT_PADDING(0x10); - }; -} diff --git a/UnleashedRecomp/api/SWA/Achievement/AchievementTest.h b/UnleashedRecomp/api/SWA/Achievement/AchievementTest.h deleted file mode 100644 index 02b4d8dc..00000000 --- a/UnleashedRecomp/api/SWA/Achievement/AchievementTest.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include -#include - -namespace SWA -{ - class CAchievementTest - { - public: - SWA_INSERT_PADDING(0x38); - be m_Unk1; - be m_AchievementID; - uint8_t m_Unk2; - }; -} diff --git a/UnleashedRecomp/api/SWA/Boss/EggDragoon/Object/BossEggDragoonDrillMissile.h b/UnleashedRecomp/api/SWA/Boss/EggDragoon/Object/BossEggDragoonDrillMissile.h deleted file mode 100644 index cbb3294b..00000000 --- a/UnleashedRecomp/api/SWA/Boss/EggDragoon/Object/BossEggDragoonDrillMissile.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include -#include "SWA/System/MatrixNodeTransform.h" - -namespace SWA::Boss::EggDragoon::DrillMissile -{ - class CMissile - { - public: - SWA_INSERT_PADDING(0xC4); - xpointer m_pMatrixNodeTransform; - SWA_INSERT_PADDING(0x68); - be m_Speed; - }; -} diff --git a/UnleashedRecomp/api/SWA/CSD/CsdDatabaseWrapper.h b/UnleashedRecomp/api/SWA/CSD/CsdDatabaseWrapper.h deleted file mode 100644 index 94abf973..00000000 --- a/UnleashedRecomp/api/SWA/CSD/CsdDatabaseWrapper.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "boost/smart_ptr/shared_ptr.h" - -namespace Hedgehog::Database -{ - class CDatabase; -} - -namespace SWA -{ - class CCsdProject; - - class CCsdDatabaseWrapper - { - public: - Hedgehog::Database::CDatabase* m_pDatabase; - - CCsdDatabaseWrapper(Hedgehog::Database::CDatabase* in_pDatabase) : m_pDatabase(in_pDatabase) {} - - boost::shared_ptr GetCsdProject(const Hedgehog::Base::CSharedString& in_rName); - }; -} - -#include "SWA/CSD/CsdDatabaseWrapper.inl" diff --git a/UnleashedRecomp/api/SWA/CSD/CsdDatabaseWrapper.inl b/UnleashedRecomp/api/SWA/CSD/CsdDatabaseWrapper.inl deleted file mode 100644 index 70c79455..00000000 --- a/UnleashedRecomp/api/SWA/CSD/CsdDatabaseWrapper.inl +++ /dev/null @@ -1,9 +0,0 @@ -namespace SWA -{ - inline boost::shared_ptr CCsdDatabaseWrapper::GetCsdProject(const Hedgehog::Base::CSharedString& in_rName) - { - boost::shared_ptr spCsdProject; - GuestToHostFunction(sub_825E2B40, &in_rName, this, &spCsdProject, 0); - return spCsdProject; - } -} diff --git a/UnleashedRecomp/api/SWA/CSD/CsdProject.h b/UnleashedRecomp/api/SWA/CSD/CsdProject.h deleted file mode 100644 index 0211933a..00000000 --- a/UnleashedRecomp/api/SWA/CSD/CsdProject.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "CSD/Manager/csdmRCPtr.h" -#include "Hedgehog/Database/System/hhDatabaseData.h" - -namespace Chao::CSD -{ - class CProject; -} - -namespace SWA -{ - class CCsdProject : public Hedgehog::Database::CDatabaseData - { - public: - Chao::CSD::RCPtr m_rcProject; - }; -} diff --git a/UnleashedRecomp/api/SWA/CSD/CsdTexListMirage.h b/UnleashedRecomp/api/SWA/CSD/CsdTexListMirage.h deleted file mode 100644 index ee0be919..00000000 --- a/UnleashedRecomp/api/SWA/CSD/CsdTexListMirage.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "CSD/Platform/csdTexList.h" - -namespace Hedgehog::Mirage -{ - class CTexsetData; -} - -namespace SWA -{ - class CCsdTexListMirage : public Chao::CSD::CTexList - { - public: - boost::shared_ptr m_spTexsetData; - SWA_INSERT_PADDING(0x04); - }; -} diff --git a/UnleashedRecomp/api/SWA/CSD/GameObjectCSD.h b/UnleashedRecomp/api/SWA/CSD/GameObjectCSD.h deleted file mode 100644 index 5049fdb0..00000000 --- a/UnleashedRecomp/api/SWA/CSD/GameObjectCSD.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "CSD/Manager/csdmRCPtr.h" -#include "SWA/System/GameObject.h" - -namespace Chao::CSD -{ - class CProject; -} - -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 deleted file mode 100644 index 1d3db6c6..00000000 --- a/UnleashedRecomp/api/SWA/Camera/Camera.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include -#include - -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); - be m_HorzAspectRatio; - SWA_INSERT_PADDING(0x178); - be m_FieldOfView; - be m_VertFieldOfView; - be m_HorzFieldOfView; - SWA_INSERT_PADDING(0x18); - bool m_InvertY; - bool m_InvertX; - }; -} diff --git a/UnleashedRecomp/api/SWA/Camera/CameraController.h b/UnleashedRecomp/api/SWA/Camera/CameraController.h deleted file mode 100644 index 9262ed05..00000000 --- a/UnleashedRecomp/api/SWA/Camera/CameraController.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CCameraController : public Hedgehog::Universe::CStateMachineBase::CStateBase - { - public: - SWA_INSERT_PADDING(0x04); - be m_FieldOfView; - SWA_INSERT_PADDING(0x68); - }; - - SWA_ASSERT_OFFSETOF(CCameraController, m_FieldOfView, 0x64); - SWA_ASSERT_SIZEOF(CCameraController, 0xD0); -} diff --git a/UnleashedRecomp/api/SWA/CharacterUtility/CharacterProxy.h b/UnleashedRecomp/api/SWA/CharacterUtility/CharacterProxy.h deleted file mode 100644 index 4032727c..00000000 --- a/UnleashedRecomp/api/SWA/CharacterUtility/CharacterProxy.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CCharacterProxy - { - public: - SWA_INSERT_PADDING(0x120); - Hedgehog::Math::CVector m_Position; - Hedgehog::Math::CVector m_Velocity; - }; -} diff --git a/UnleashedRecomp/api/SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h b/UnleashedRecomp/api/SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h deleted file mode 100644 index 90fec504..00000000 --- a/UnleashedRecomp/api/SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CExStageBoss - { - public: - class CStateBase; - class CStateBattle; - - class CExStageBossStateContext - { - public: - SWA_INSERT_PADDING(0x14C); - be m_SplineProgress; - SWA_INSERT_PADDING(0x0C); - be m_SplineSpeed; - SWA_INSERT_PADDING(0x28); - be m_Field188; - be m_Field18C; - SWA_INSERT_PADDING(0x21); - bool m_IsBattleStart; - SWA_INSERT_PADDING(0x36E); - be m_Field520; - }; - }; - - SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_SplineProgress, 0x14C); - SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_SplineSpeed, 0x15C); - SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_Field188, 0x188); - SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_Field18C, 0x18C); - SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_IsBattleStart, 0x1B1); - SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_Field520, 0x520); -} diff --git a/UnleashedRecomp/api/SWA/ExtraStage/Tails/Enemy/Boss/State/StateBase.h b/UnleashedRecomp/api/SWA/ExtraStage/Tails/Enemy/Boss/State/StateBase.h deleted file mode 100644 index 7aaa9b8b..00000000 --- a/UnleashedRecomp/api/SWA/ExtraStage/Tails/Enemy/Boss/State/StateBase.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include -#include "SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h" - -namespace SWA -{ - class CExStageBoss::CStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase {}; -} diff --git a/UnleashedRecomp/api/SWA/ExtraStage/Tails/Enemy/Boss/State/StateBattle.h b/UnleashedRecomp/api/SWA/ExtraStage/Tails/Enemy/Boss/State/StateBattle.h deleted file mode 100644 index 4fbfdd45..00000000 --- a/UnleashedRecomp/api/SWA/ExtraStage/Tails/Enemy/Boss/State/StateBattle.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include "SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h" - -namespace SWA -{ - class CExStageBoss::CStateBattle : public CExStageBoss::CStateBase - { - public: - SWA_INSERT_PADDING(0x08); - be m_Field68; - be m_FramesSinceLastMissile; - }; - - SWA_ASSERT_OFFSETOF(CExStageBoss::CStateBattle, m_Field68, 0x68); - SWA_ASSERT_OFFSETOF(CExStageBoss::CStateBattle, m_FramesSinceLastMissile, 0x6C); -} diff --git a/UnleashedRecomp/api/SWA/ExtraStage/Tails/Player/ExPlayerTails.h b/UnleashedRecomp/api/SWA/ExtraStage/Tails/Player/ExPlayerTails.h deleted file mode 100644 index c91eb1e1..00000000 --- a/UnleashedRecomp/api/SWA/ExtraStage/Tails/Player/ExPlayerTails.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CExPlayerTails - { - public: - class CExPlayerTailsStateContext - { - public: - SWA_INSERT_PADDING(0x1F8); - be m_SplineBossStart; - be m_SplineEnd; - SWA_INSERT_PADDING(0x30); - be m_SplineProgress; - SWA_INSERT_PADDING(0x10); - xpointer m_Field244; - SWA_INSERT_PADDING(0x18); - be m_SplineSpeed; - SWA_INSERT_PADDING(0x0C); - be m_State; // 0 - Intro; 1 - Boss Intro; 3 - Boss - }; - - class CStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase {}; - }; - - SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_SplineBossStart, 0x1F8); - SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_SplineEnd, 0x1FC); - SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_SplineProgress, 0x230); - SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_Field244, 0x244); - SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_SplineSpeed, 0x260); - SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_State, 0x270); -} diff --git a/UnleashedRecomp/api/SWA/Globals.h b/UnleashedRecomp/api/SWA/Globals.h deleted file mode 100644 index ddd6accd..00000000 --- a/UnleashedRecomp/api/SWA/Globals.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - struct SGlobals - { - // ms_DrawLightFieldSamplingPoint: サンプリング点をデバッグ表示 - static inline bool* ms_DrawLightFieldSamplingPoint; - - // N/A - static inline bool* ms_IsAutoSaveWarningShown; - - // ms_IgnoreLightFieldData: データを無視する - static inline bool* ms_IgnoreLightFieldData; - - // IsCollisionRender - static inline bool* ms_IsCollisionRender; - - // N/A - static inline bool* ms_IsLoading; - - // IsObjectCollisionRender - static inline bool* ms_IsObjectCollisionRender; - - // ms_IsRenderDebugDraw: デバッグ描画 - static inline bool* ms_IsRenderDebugDraw; - - // ms_IsRenderDebugDrawText: デバッグ文字描画 - static inline bool* ms_IsRenderDebugDrawText; - - // ms_IsRenderDebugPositionDraw: デバッグ位置描画 - static inline bool* ms_IsRenderDebugPositionDraw; - - // ms_IsRenderGameMainHud: ゲームメインHUD 描画 - static inline bool* ms_IsRenderGameMainHud; - - // ms_IsRenderHud: 全 HUD 描画 - static inline bool* ms_IsRenderHud; - - // ms_IsRenderHudPause: ポーズメニュー 描画 - static inline bool* ms_IsRenderHudPause; - - // N/A - static inline bool* ms_IsTitleStateMenu; - - // IsTriggerRender - static inline bool* ms_IsTriggerRender; - - // ms_LightFieldDebug: 値をデバッグ表示 - static inline bool* ms_LightFieldDebug; - - // VisualizeLoadedLevel: ミップレベルを視覚化 赤=0, 緑=1, 青=2, 黄=未ロード - static inline bool* ms_VisualizeLoadedLevel; - - static void Init() - { - ms_DrawLightFieldSamplingPoint = (bool*)MmGetHostAddress(0x83367BCE); - ms_IgnoreLightFieldData = (bool*)MmGetHostAddress(0x83367BCF); - ms_IsAutoSaveWarningShown = (bool*)MmGetHostAddress(0x83367BC1); - ms_IsCollisionRender = (bool*)MmGetHostAddress(0x833678A6); - ms_IsLoading = (bool*)MmGetHostAddress(0x83367A4C); - ms_IsObjectCollisionRender = (bool*)MmGetHostAddress(0x83367905); - ms_IsRenderDebugDraw = (bool*)MmGetHostAddress(0x8328BB23); - ms_IsRenderDebugDrawText = (bool*)MmGetHostAddress(0x8328BB25); - ms_IsRenderDebugPositionDraw = (bool*)MmGetHostAddress(0x8328BB24); - ms_IsRenderGameMainHud = (bool*)MmGetHostAddress(0x8328BB27); - ms_IsRenderHud = (bool*)MmGetHostAddress(0x8328BB26); - ms_IsRenderHudPause = (bool*)MmGetHostAddress(0x8328BB28); - ms_IsTitleStateMenu = (bool*)MmGetHostAddress(0x83367BC0); - ms_IsTriggerRender = (bool*)MmGetHostAddress(0x83367904); - ms_LightFieldDebug = (bool*)MmGetHostAddress(0x83367BCD); - ms_VisualizeLoadedLevel = (bool*)MmGetHostAddress(0x833678C1); - } - }; -} diff --git a/UnleashedRecomp/api/SWA/HUD/GeneralWindow/GeneralWindow.h b/UnleashedRecomp/api/SWA/HUD/GeneralWindow/GeneralWindow.h deleted file mode 100644 index f17d2e42..00000000 --- a/UnleashedRecomp/api/SWA/HUD/GeneralWindow/GeneralWindow.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - enum EWindowStatus : uint32_t - { - eWindowStatus_Closed, - eWindowStatus_OpeningMessage = 2, - eWindowStatus_DisplayingMessage, - eWindowStatus_OpeningControls, - eWindowStatus_DisplayingControls - }; - - class CGeneralWindow - { - public: - SWA_INSERT_PADDING(0xD0); - Chao::CSD::RCPtr m_rcGeneral; - Chao::CSD::RCPtr m_rcBg; - Chao::CSD::RCPtr m_rcWindow; - Chao::CSD::RCPtr m_rcWindow_2; - Chao::CSD::RCPtr m_rcWindowSelect; - Chao::CSD::RCPtr m_rcFooter; - SWA_INSERT_PADDING(0x58); - be m_Status; - be m_CursorIndex; - SWA_INSERT_PADDING(0x04); - be m_SelectedIndex; - }; - - SWA_ASSERT_OFFSETOF(CGeneralWindow, m_rcGeneral, 0xD0); - SWA_ASSERT_OFFSETOF(CGeneralWindow, m_rcBg, 0xD8); - SWA_ASSERT_OFFSETOF(CGeneralWindow, m_rcWindow, 0xE0); - SWA_ASSERT_OFFSETOF(CGeneralWindow, m_rcWindow_2, 0xE8); - SWA_ASSERT_OFFSETOF(CGeneralWindow, m_rcWindowSelect, 0xF0); - SWA_ASSERT_OFFSETOF(CGeneralWindow, m_rcFooter, 0xF8); - SWA_ASSERT_OFFSETOF(CGeneralWindow, m_Status, 0x158); - SWA_ASSERT_OFFSETOF(CGeneralWindow, m_CursorIndex, 0x15C); - SWA_ASSERT_OFFSETOF(CGeneralWindow, m_SelectedIndex, 0x164); -} diff --git a/UnleashedRecomp/api/SWA/HUD/Loading/Loading.h b/UnleashedRecomp/api/SWA/HUD/Loading/Loading.h deleted file mode 100644 index 66d88d81..00000000 --- a/UnleashedRecomp/api/SWA/HUD/Loading/Loading.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include - -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(0xD8); - be m_FieldD8; - SWA_INSERT_PADDING(0x3C); - Chao::CSD::RCPtr m_rcNightToDay; - SWA_INSERT_PADDING(0x0C); - be m_IsVisible; - SWA_INSERT_PADDING(0x0C); - be m_LoadingDisplayType; - SWA_INSERT_PADDING(0x61); - bool m_IsNightToDay; - }; - - SWA_ASSERT_OFFSETOF(CLoading, m_FieldD8, 0xD8); - SWA_ASSERT_OFFSETOF(CLoading, m_rcNightToDay, 0x118); - SWA_ASSERT_OFFSETOF(CLoading, m_IsVisible, 0x12C); - SWA_ASSERT_OFFSETOF(CLoading, m_LoadingDisplayType, 0x13C); - SWA_ASSERT_OFFSETOF(CLoading, m_IsNightToDay, 0x1A1); -} diff --git a/UnleashedRecomp/api/SWA/HUD/Pause/HudPause.h b/UnleashedRecomp/api/SWA/HUD/Pause/HudPause.h deleted file mode 100644 index 904e803b..00000000 --- a/UnleashedRecomp/api/SWA/HUD/Pause/HudPause.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include - -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: - SWA_INSERT_PADDING(0x30); - RCPtr m_rcPause; - RCPtr m_rcBg; - RCPtr m_rcBg1; - RCPtr m_rcBg1_2; - RCPtr m_rcBg1Select; - RCPtr m_rcBg1Select_2; - RCPtr m_rcStatusTitle; - RCPtr m_rcFooterA; - SWA_INSERT_PADDING(0x59); - bool m_IsVisible; - SWA_INSERT_PADDING(0x02); - be m_Action; - be m_Menu; - be m_Status; - be m_Transition; - SWA_INSERT_PADDING(0x04); - be m_Submenu; - SWA_INSERT_PADDING(0x18); - bool m_IsShown; - }; - - SWA_ASSERT_OFFSETOF(CHudPause, m_rcPause, 0xEC); - SWA_ASSERT_OFFSETOF(CHudPause, m_rcBg, 0xF4); - SWA_ASSERT_OFFSETOF(CHudPause, m_rcBg1, 0xFC); - SWA_ASSERT_OFFSETOF(CHudPause, m_rcBg1_2, 0x104); - SWA_ASSERT_OFFSETOF(CHudPause, m_rcBg1Select, 0x10C); - SWA_ASSERT_OFFSETOF(CHudPause, m_rcBg1Select_2, 0x114); - SWA_ASSERT_OFFSETOF(CHudPause, m_rcStatusTitle, 0x11C); - SWA_ASSERT_OFFSETOF(CHudPause, m_rcFooterA, 0x124); - SWA_ASSERT_OFFSETOF(CHudPause, m_IsVisible, 0x185); - SWA_ASSERT_OFFSETOF(CHudPause, m_Action, 0x188); - SWA_ASSERT_OFFSETOF(CHudPause, m_Menu, 0x18C); - SWA_ASSERT_OFFSETOF(CHudPause, m_Status, 0x190); - SWA_ASSERT_OFFSETOF(CHudPause, m_Transition, 0x194); - SWA_ASSERT_OFFSETOF(CHudPause, m_Submenu, 0x19C); - SWA_ASSERT_OFFSETOF(CHudPause, m_IsShown, 0x1B8); -} diff --git a/UnleashedRecomp/api/SWA/HUD/SaveIcon/SaveIcon.h b/UnleashedRecomp/api/SWA/HUD/SaveIcon/SaveIcon.h deleted file mode 100644 index 61d5ec77..00000000 --- a/UnleashedRecomp/api/SWA/HUD/SaveIcon/SaveIcon.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CSaveIcon : Hedgehog::Universe::CUpdateUnit - { - public: - SWA_INSERT_PADDING(0xD8); - bool m_IsVisible; - }; -} diff --git a/UnleashedRecomp/api/SWA/HUD/Sonic/HudSonicStage.h b/UnleashedRecomp/api/SWA/HUD/Sonic/HudSonicStage.h deleted file mode 100644 index 59e2d070..00000000 --- a/UnleashedRecomp/api/SWA/HUD/Sonic/HudSonicStage.h +++ /dev/null @@ -1,22 +0,0 @@ -#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/Inspire/InspireMovieOverlay.h b/UnleashedRecomp/api/SWA/Inspire/InspireMovieOverlay.h deleted file mode 100644 index 17536685..00000000 --- a/UnleashedRecomp/api/SWA/Inspire/InspireMovieOverlay.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include -#include - -namespace SWA::Inspire -{ - class CScene; - - class CMovieOverlay - { - public: - boost::shared_ptr m_spInfo; - xpointer m_pScene; - xpointer m_pTextureData; - }; -} diff --git a/UnleashedRecomp/api/SWA/Inspire/InspireMovieOverlayInfo.h b/UnleashedRecomp/api/SWA/Inspire/InspireMovieOverlayInfo.h deleted file mode 100644 index de5549a7..00000000 --- a/UnleashedRecomp/api/SWA/Inspire/InspireMovieOverlayInfo.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -namespace SWA::Inspire -{ - class CMovieOverlayInfo - { - public: - Hedgehog::Base::CSharedString m_MovieName; - be m_Prepare; - be m_InStart; - be m_InEnd; - be m_OutStart; - be m_OutEnd; - }; -} diff --git a/UnleashedRecomp/api/SWA/Inspire/InspireOpacityAnimationInfo.h b/UnleashedRecomp/api/SWA/Inspire/InspireOpacityAnimationInfo.h deleted file mode 100644 index e281e17c..00000000 --- a/UnleashedRecomp/api/SWA/Inspire/InspireOpacityAnimationInfo.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -namespace SWA::Inspire -{ - class COpacityAnimationInfo - { - public: - be m_Opacity; - be m_Frame; - }; -} diff --git a/UnleashedRecomp/api/SWA/Inspire/InspireScene.h b/UnleashedRecomp/api/SWA/Inspire/InspireScene.h deleted file mode 100644 index 780ed8cc..00000000 --- a/UnleashedRecomp/api/SWA/Inspire/InspireScene.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include - -namespace SWA::Inspire -{ - struct SSceneData - { - be Frame; - be Cut; - bool IsPlaying; - SWA_INSERT_PADDING(0x177); - }; - - class CScene - { - public: - SWA_INSERT_PADDING(0xC0); - xpointer m_pData; - }; -} diff --git a/UnleashedRecomp/api/SWA/Inspire/InspireSceneData.h b/UnleashedRecomp/api/SWA/Inspire/InspireSceneData.h deleted file mode 100644 index 88db2497..00000000 --- a/UnleashedRecomp/api/SWA/Inspire/InspireSceneData.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -namespace SWA::Inspire -{ - class CSceneData // : public Hedgehog::Database::CDatabaseData - { - public: - SWA_INSERT_PADDING(0x80); - Hedgehog::Base::CSharedString m_ResourceName; - }; -} diff --git a/UnleashedRecomp/api/SWA/Inspire/InspireSceneInfo.h b/UnleashedRecomp/api/SWA/Inspire/InspireSceneInfo.h deleted file mode 100644 index 617a7eb3..00000000 --- a/UnleashedRecomp/api/SWA/Inspire/InspireSceneInfo.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include - -namespace SWA::Inspire -{ - class CSceneInfo {}; -} diff --git a/UnleashedRecomp/api/SWA/Inspire/InspireTextureAnimationInfo.h b/UnleashedRecomp/api/SWA/Inspire/InspireTextureAnimationInfo.h deleted file mode 100644 index d500ae44..00000000 --- a/UnleashedRecomp/api/SWA/Inspire/InspireTextureAnimationInfo.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include - -namespace SWA::Inspire -{ - class CTextureAnimationInfo - { - public: - SWA_INSERT_PADDING(0x10); - Hedgehog::Base::CSharedString m_MovieTex; - Hedgehog::Base::CSharedString m_MovieSfd; - SWA_INSERT_PADDING(0x08); - be m_Prepare; - be m_Start; - be m_End; - be m_Width; - be m_Height; - }; -} diff --git a/UnleashedRecomp/api/SWA/Inspire/InspireTextureOverlay.h b/UnleashedRecomp/api/SWA/Inspire/InspireTextureOverlay.h deleted file mode 100644 index 8384c3c8..00000000 --- a/UnleashedRecomp/api/SWA/Inspire/InspireTextureOverlay.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include - -namespace SWA::Inspire -{ - class CScene; - - class CTextureOverlay - { - public: - xpointer m_pVftable; - boost::shared_ptr m_spInfo; - xpointer m_pScene; - boost::shared_ptr m_spTextureData; - }; -} diff --git a/UnleashedRecomp/api/SWA/Inspire/InspireTextureOverlayInfo.h b/UnleashedRecomp/api/SWA/Inspire/InspireTextureOverlayInfo.h deleted file mode 100644 index fd35d64a..00000000 --- a/UnleashedRecomp/api/SWA/Inspire/InspireTextureOverlayInfo.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -namespace SWA::Inspire -{ - class CTextureOverlayInfo - { - public: - Hedgehog::Base::CSharedString m_Picture; - be m_Start; - be m_End; - }; -} diff --git a/UnleashedRecomp/api/SWA/Menu/MenuWindowBase.h b/UnleashedRecomp/api/SWA/Menu/MenuWindowBase.h deleted file mode 100644 index ccab2f68..00000000 --- a/UnleashedRecomp/api/SWA/Menu/MenuWindowBase.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CMenuWindowBase - { - public: - SWA_INSERT_PADDING(0x10); - }; -} diff --git a/UnleashedRecomp/api/SWA/Message/MsgRequestHelp.h b/UnleashedRecomp/api/SWA/Message/MsgRequestHelp.h deleted file mode 100644 index 3b8ed1ca..00000000 --- a/UnleashedRecomp/api/SWA/Message/MsgRequestHelp.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -namespace SWA::Message -{ - class MsgRequestHelp - { - public: - SWA_INSERT_PADDING(0x1C); - Hedgehog::Base::CSharedString m_Name; - }; -} diff --git a/UnleashedRecomp/api/SWA/Movie/MovieDisplayer.h b/UnleashedRecomp/api/SWA/Movie/MovieDisplayer.h deleted file mode 100644 index 229d23ec..00000000 --- a/UnleashedRecomp/api/SWA/Movie/MovieDisplayer.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CMovieDisplayer : public Hedgehog::Universe::CUpdateUnit, public Hedgehog::Mirage::CRenderable - { - public: - struct SVertexData - { - be X; - be Y; - be Z; - be U; - be V; - }; - - SWA_INSERT_PADDING(0x04); - be m_MovieWidth; - be m_MovieHeight; - SWA_INSERT_PADDING(0x74); - SVertexData m_TopLeft; - SVertexData m_TopRight; - SVertexData m_BottomRight; - SVertexData m_BottomLeft; - SWA_INSERT_PADDING(0xF0); - }; -} diff --git a/UnleashedRecomp/api/SWA/Movie/MovieManager.h b/UnleashedRecomp/api/SWA/Movie/MovieManager.h deleted file mode 100644 index 4de3429e..00000000 --- a/UnleashedRecomp/api/SWA/Movie/MovieManager.h +++ /dev/null @@ -1,17 +0,0 @@ -#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 deleted file mode 100644 index e9412070..00000000 --- a/UnleashedRecomp/api/SWA/Movie/MovieManager.inl +++ /dev/null @@ -1,7 +0,0 @@ -namespace SWA -{ - inline CMovieManager* CMovieManager::GetInstance() - { - return *(xpointer*)MmGetHostAddress(0x8336758C); - } -} diff --git a/UnleashedRecomp/api/SWA/Object/Common/DashPanel/ObjDashPanel.h b/UnleashedRecomp/api/SWA/Object/Common/DashPanel/ObjDashPanel.h deleted file mode 100644 index 45c05a55..00000000 --- a/UnleashedRecomp/api/SWA/Object/Common/DashPanel/ObjDashPanel.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CObjDashPanel - { - public: - SWA_INSERT_PADDING(0xE8); - be m_FieldE8; - be m_Speed; - }; -} diff --git a/UnleashedRecomp/api/SWA/Object/SonicStage/EU/RollingBarrel/ObjRollingBarrel.h b/UnleashedRecomp/api/SWA/Object/SonicStage/EU/RollingBarrel/ObjRollingBarrel.h deleted file mode 100644 index 644b4534..00000000 --- a/UnleashedRecomp/api/SWA/Object/SonicStage/EU/RollingBarrel/ObjRollingBarrel.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CObjRollingBarrel - { - public: - class CElement - { - public: - SWA_INSERT_PADDING(0xEC); - xpointer m_FieldEC; - SWA_INSERT_PADDING(0x20); - be m_Roll; - }; - - SWA_INSERT_PADDING(0xE8); - be m_GenerationTime; - SWA_INSERT_PADDING(0x09); - bool m_FieldF5; - SWA_INSERT_PADDING(0x0A); - be m_RandomRange; - be m_Field104; - }; - - SWA_ASSERT_OFFSETOF(CObjRollingBarrel::CElement, m_FieldEC, 0xEC); - SWA_ASSERT_OFFSETOF(CObjRollingBarrel::CElement, m_Roll, 0x110); - - SWA_ASSERT_OFFSETOF(CObjRollingBarrel, m_GenerationTime, 0xE8); - SWA_ASSERT_OFFSETOF(CObjRollingBarrel, m_FieldF5, 0xF5); - SWA_ASSERT_OFFSETOF(CObjRollingBarrel, m_RandomRange, 0x100); - SWA_ASSERT_OFFSETOF(CObjRollingBarrel, m_Field104, 0x104); -} diff --git a/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/EvilSonic.h b/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/EvilSonic.h deleted file mode 100644 index bee25d07..00000000 --- a/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/EvilSonic.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "SWA/Player/Character/EvilSonic/EvilSonicContext.h" - -namespace SWA::Player -{ - class CEvilSonic // : public CPlayer - { - public: - SWA_INSERT_PADDING(0xC4); - xpointer m_spContext; - }; -} diff --git a/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/EvilSonicContext.h b/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/EvilSonicContext.h deleted file mode 100644 index d8f38ae3..00000000 --- a/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/EvilSonicContext.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h" - -namespace SWA::Player -{ - class CEvilSonicContext // : public CPlayerContext - { - public: - SWA_INSERT_PADDING(0x688); - be m_DarkGaiaEnergy; - SWA_INSERT_PADDING(0x138); - be m_AnimationID; - SWA_INSERT_PADDING(0x38); - be m_UnkHudGuideF32; - be m_UnkHudGuideU32; - SWA_INSERT_PADDING(0x18); - be m_GuideType; - SWA_INSERT_PADDING(0xA8); - be m_OutOfControlCount; - }; -} diff --git a/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h b/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h deleted file mode 100644 index d872fe48..00000000 --- a/UnleashedRecomp/api/SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace SWA::Player -{ - enum EGuideAction : uint32_t - { - eGuideAction_Single, - eGuideAction_Chain - }; - - enum EGuideType : uint32_t - { - eGuideType_A, - eGuideType_B, - eGuideType_X, - eGuideType_Y - }; - - class CEvilHudGuide : public CGameObject - { - public: - xpointer m_pVftable; - SWA_INSERT_PADDING(0x8D); - bool m_IsShown; - bool m_IsVisible; - be m_GuideType; - }; -} diff --git a/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitBase.h b/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitBase.h deleted file mode 100644 index d45387f2..00000000 --- a/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitBase.h +++ /dev/null @@ -1,13 +0,0 @@ -#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 deleted file mode 100644 index 285e678e..00000000 --- a/UnleashedRecomp/api/SWA/Sequence/Unit/SequenceUnitPlayMovie.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace SWA::Sequence::Unit -{ - class CPlayMovieUnit : public CUnitBase - { - public: - Hedgehog::Base::CSharedString m_SceneName; - }; -} diff --git a/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h b/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h deleted file mode 100644 index 47a3e361..00000000 --- a/UnleashedRecomp/api/SWA/Sequence/Utility/SequencePlayMovieWrapper.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "Hedgehog/MirageCore/Renderable/hhRenderable.h" - -namespace SWA::Sequence::Utility -{ - class CPlayMovieWrapper - { - public: - class CRender : public Hedgehog::Mirage::CRenderable - { - public: - struct SVertexData - { - be X; - be Y; - be Z; - be U; - be V; - }; - - be m_ScreenWidth; - be m_ScreenHeight; - be m_MovieWidth; - be m_MovieHeight; - SWA_INSERT_PADDING(0x74); - SVertexData m_TopLeft; - SVertexData m_TopRight; - SVertexData m_BottomRight; - SVertexData m_BottomLeft; - bool m_Field1A4; - SWA_INSERT_PADDING(0x18); - be m_TimeElapsed; - }; - - xpointer m_pVftable; - Hedgehog::Base::CSharedString m_SceneName; - SWA_INSERT_PADDING(0x10); - xpointer m_pRender; - SWA_INSERT_PADDING(0x04); - xpointer m_pResourceName; - }; -} diff --git a/UnleashedRecomp/api/SWA/Sound/Sound.h b/UnleashedRecomp/api/SWA/Sound/Sound.h deleted file mode 100644 index d43c43a7..00000000 --- a/UnleashedRecomp/api/SWA/Sound/Sound.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include -#include - -namespace SWA -{ - class CSoundAdministrator : public CGameObject - { - public: - class CSimplePlayer {}; - - class CBgm - { - public: - xpointer m_pThis; - boost::shared_ptr m_spSoundBGM; - be m_Volume1; - be m_Volume2; - be m_Volume3; - be m_Volume4; - SWA_INSERT_PADDING(0x10); - }; - - 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 m_pThis; - boost::shared_ptr m_spCommunicatorDevice; - }; - - class CMember - { - public: - boost::shared_ptr m_spSimplePlayer; - boost::shared_ptr m_spBgm; - boost::shared_ptr m_spCommunicator; - SWA_INSERT_PADDING(0x58); - }; - - xpointer m_pVftable; - SWA_INSERT_PADDING(0x04); - xpointer m_pMember; - }; -} diff --git a/UnleashedRecomp/api/SWA/Sound/SoundBGMActSonic.h b/UnleashedRecomp/api/SWA/Sound/SoundBGMActSonic.h deleted file mode 100644 index 5f3371ac..00000000 --- a/UnleashedRecomp/api/SWA/Sound/SoundBGMActSonic.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include -#include - -namespace SWA -{ - class CSoundBGMActSonic : public CSoundBGMBase - { - public: - class CMember - { - public: - SWA_INSERT_PADDING(0x58); - be m_Volume1; - be m_Volume2; - }; - - xpointer m_pMember; - }; -} diff --git a/UnleashedRecomp/api/SWA/Sound/SoundBGMBase.h b/UnleashedRecomp/api/SWA/Sound/SoundBGMBase.h deleted file mode 100644 index 3f8a7c2f..00000000 --- a/UnleashedRecomp/api/SWA/Sound/SoundBGMBase.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CSoundBGMBase : Hedgehog::Universe::CMessageActor - { - public: - SWA_INSERT_PADDING(0x04); // vftable ptr - SWA_INSERT_PADDING(0x04); - xpointer m_pGameDocument; - bool m_Unk; - }; -} diff --git a/UnleashedRecomp/api/SWA/System/Application.h b/UnleashedRecomp/api/SWA/System/Application.h deleted file mode 100644 index 5efd399a..00000000 --- a/UnleashedRecomp/api/SWA/System/Application.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include -#include - -namespace SWA -{ - class CApplication : public Hedgehog::Base::CObject - { - public: - class CMember - { - public: - xpointer m_pApplicationDocument; - }; - - xpointer m_pVftable; - xpointer m_pMember; - SWA_INSERT_PADDING(0x18); - }; -} diff --git a/UnleashedRecomp/api/SWA/System/ApplicationD3D9.h b/UnleashedRecomp/api/SWA/System/ApplicationD3D9.h deleted file mode 100644 index ef88f297..00000000 --- a/UnleashedRecomp/api/SWA/System/ApplicationD3D9.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CApplicationD3D9 : public CApplication {}; -} diff --git a/UnleashedRecomp/api/SWA/System/ApplicationDocument.h b/UnleashedRecomp/api/SWA/System/ApplicationDocument.h deleted file mode 100644 index 21949711..00000000 --- a/UnleashedRecomp/api/SWA/System/ApplicationDocument.h +++ /dev/null @@ -1,126 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace Hedgehog::Base -{ - class CCriticalSection; -} - -namespace Hedgehog::Database -{ - class CDatabase; -} - -namespace Hedgehog::Mirage -{ - class CMatrixNode; - class CRenderScene; -} - -namespace Hedgehog::Universe -{ - class CParallelJobManagerD3D9; -} - -namespace SWA -{ - class CApplication; - class CDatabaseTree; - - 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: - xpointer m_pApplication; - boost::shared_ptr m_spParallelJobManagerD3D9; - SWA_INSERT_PADDING(0x14); - boost::shared_ptr m_spGame; - SWA_INSERT_PADDING(0x14); - boost::shared_ptr m_spInspireDatabase; - SWA_INSERT_PADDING(0x30); - Hedgehog::Base::CSharedString m_Field74; - SWA_INSERT_PADDING(0x0C); - boost::shared_ptr m_spMatrixNodeRoot; - SWA_INSERT_PADDING(0x14); - CGammaController m_GammaController; - boost::shared_ptr m_spLoading; - SWA_INSERT_PADDING(0x14); - boost::shared_ptr m_spAchievementManager; - boost::shared_ptr m_spDatabaseTree; - Hedgehog::Base::CSharedString m_Field10C; - SWA_INSERT_PADDING(0x1C); - boost::shared_ptr m_spRenderScene; - SWA_INSERT_PADDING(0x04); - boost::shared_ptr m_spGameParameter; - SWA_INSERT_PADDING(0x78); - boost::shared_ptr m_spCriticalSection; - SWA_INSERT_PADDING(0x20); - }; - - // TODO: Hedgehog::Base::TSynchronizedPtr - static CApplicationDocument* GetInstance(); - - xpointer m_pMember; - be m_Language; - be m_VoiceLanguage; - SWA_INSERT_PADDING(0x08); - be m_Region; - bool m_InspireVoices; - bool m_InspireSubtitles; - SWA_INSERT_PADDING(0x28); - }; - - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_pApplication, 0x00); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spParallelJobManagerD3D9, 0x04); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spGame, 0x20); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spInspireDatabase, 0x3C); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_Field74, 0x74); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spMatrixNodeRoot, 0x84); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_GammaController, 0xA0); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spLoading, 0xE0); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spAchievementManager, 0xFC); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spDatabaseTree, 0x104); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_Field10C, 0x10C); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spRenderScene, 0x12C); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spGameParameter, 0x138); - SWA_ASSERT_OFFSETOF(CApplicationDocument::CMember, m_spCriticalSection, 0x1B8); - SWA_ASSERT_SIZEOF(CApplicationDocument::CMember, 0x1E0); - - SWA_ASSERT_OFFSETOF(CApplicationDocument, m_pMember, 0x04); - SWA_ASSERT_OFFSETOF(CApplicationDocument, m_Language, 0x08); - SWA_ASSERT_OFFSETOF(CApplicationDocument, m_VoiceLanguage, 0x0C); - SWA_ASSERT_OFFSETOF(CApplicationDocument, m_Region, 0x18); - SWA_ASSERT_OFFSETOF(CApplicationDocument, m_InspireVoices, 0x1C); - SWA_ASSERT_OFFSETOF(CApplicationDocument, m_InspireSubtitles, 0x1D); - SWA_ASSERT_SIZEOF(CApplicationDocument, 0x48); -} - -#include "ApplicationDocument.inl" diff --git a/UnleashedRecomp/api/SWA/System/ApplicationDocument.inl b/UnleashedRecomp/api/SWA/System/ApplicationDocument.inl deleted file mode 100644 index 4e1652de..00000000 --- a/UnleashedRecomp/api/SWA/System/ApplicationDocument.inl +++ /dev/null @@ -1,8 +0,0 @@ -namespace SWA -{ - // TODO: Hedgehog::Base::TSynchronizedPtr - inline CApplicationDocument* CApplicationDocument::GetInstance() - { - return *(xpointer*)MmGetHostAddress(0x833678A0); - } -} diff --git a/UnleashedRecomp/api/SWA/System/ApplicationXenon.h b/UnleashedRecomp/api/SWA/System/ApplicationXenon.h deleted file mode 100644 index ed5d6c1c..00000000 --- a/UnleashedRecomp/api/SWA/System/ApplicationXenon.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CApplicationXenon : public CApplicationD3D9 - { - public: - SWA_INSERT_PADDING(0x1B4); - }; -} diff --git a/UnleashedRecomp/api/SWA/System/Game.h b/UnleashedRecomp/api/SWA/System/Game.h deleted file mode 100644 index 9e0101ae..00000000 --- a/UnleashedRecomp/api/SWA/System/Game.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -namespace SWA -{ - class CGame // : Hedgehog::Universe::TStateMachine - { - public: - SWA_INSERT_PADDING(0xFC); - }; -} diff --git a/UnleashedRecomp/api/SWA/System/GameDocument.h b/UnleashedRecomp/api/SWA/System/GameDocument.h deleted file mode 100644 index d7013011..00000000 --- a/UnleashedRecomp/api/SWA/System/GameDocument.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -namespace Hedgehog::Database -{ - class CDatabase; -} - -namespace SWA -{ - class CGameDocument : public Hedgehog::Base::CSynchronizedObject - { - public: - class CMember - { - public: - struct SScoreInfo - { - be SRank; - be ARank; - be BRank; - be CRank; - be DRank; - SWA_INSERT_PADDING(0x0C); - be PointMarkerRecordSpeed; - SWA_INSERT_PADDING(0x0C); - be PointMarkerCount; - be EnemyScore; - be TrickScore; - SWA_INSERT_PADDING(0x10); - }; - - SWA_INSERT_PADDING(0x1C); - boost::shared_ptr m_spDatabase; - SWA_INSERT_PADDING(0x88); - Hedgehog::Base::CSharedString m_StageName; - xpointer m_pSoundAdministrator; - SWA_INSERT_PADDING(0x48); - xpointer m_pGeneralWindow; - SWA_INSERT_PADDING(0xD8); - SScoreInfo m_ScoreInfo; - SWA_INSERT_PADDING(0x0C); - }; - - // TODO: Hedgehog::Base::TSynchronizedPtr - static CGameDocument* GetInstance(); - - xpointer m_pVftable; - xpointer m_pMember; - }; - - SWA_ASSERT_OFFSETOF(CGameDocument::CMember::SScoreInfo, SRank, 0x00); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember::SScoreInfo, ARank, 0x04); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember::SScoreInfo, BRank, 0x08); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember::SScoreInfo, CRank, 0x0C); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember::SScoreInfo, DRank, 0x10); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember::SScoreInfo, PointMarkerRecordSpeed, 0x20); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember::SScoreInfo, PointMarkerCount, 0x30); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember::SScoreInfo, EnemyScore, 0x34); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember::SScoreInfo, TrickScore, 0x38); - SWA_ASSERT_SIZEOF(CGameDocument::CMember::SScoreInfo, 0x4C); - - SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_spDatabase, 0x1C); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_StageName, 0xAC); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_pSoundAdministrator, 0xB0); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_pGeneralWindow, 0xFC); - SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_ScoreInfo, 0x1D8); - SWA_ASSERT_SIZEOF(CGameDocument::CMember, 0x230); - - SWA_ASSERT_OFFSETOF(CGameDocument, m_pMember, 0x08); - SWA_ASSERT_SIZEOF(CGameDocument, 0x0C); -} - -#include "GameDocument.inl" diff --git a/UnleashedRecomp/api/SWA/System/GameDocument.inl b/UnleashedRecomp/api/SWA/System/GameDocument.inl deleted file mode 100644 index c973a5cd..00000000 --- a/UnleashedRecomp/api/SWA/System/GameDocument.inl +++ /dev/null @@ -1,8 +0,0 @@ -namespace SWA -{ - // TODO: Hedgehog::Base::TSynchronizedPtr - inline CGameDocument* CGameDocument::GetInstance() - { - return *(xpointer*)MmGetHostAddress(0x83367900); - } -} diff --git a/UnleashedRecomp/api/SWA/System/GameMode/GameMode.h b/UnleashedRecomp/api/SWA/System/GameMode/GameMode.h deleted file mode 100644 index 8c64abcf..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/GameMode.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CGameMode : public Hedgehog::Universe::CStateMachineBase::CStateBase - { - public: - SWA_INSERT_PADDING(0x08); - }; -} diff --git a/UnleashedRecomp/api/SWA/System/GameMode/GameModeStage.h b/UnleashedRecomp/api/SWA/System/GameMode/GameModeStage.h deleted file mode 100644 index eeba70c5..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/GameModeStage.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - 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 deleted file mode 100644 index e1a95df4..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/GameModeStageMovie.h +++ /dev/null @@ -1,20 +0,0 @@ -#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/api/SWA/System/GameMode/GameModeStageTitle.h b/UnleashedRecomp/api/SWA/System/GameMode/GameModeStageTitle.h deleted file mode 100644 index b2b6f845..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/GameModeStageTitle.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CGameModeStageTitle : public CGameModeStage - { - public: - SWA_INSERT_PADDING(0x0E); - bool m_IsPlayingAdvertiseMovie; - be m_AdvertiseMovieWaitTime; - }; -} diff --git a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleMenu.h b/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleMenu.h deleted file mode 100644 index bb195cea..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleMenu.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CTitleMenu : public CMenuWindowBase - { - public: - SWA_INSERT_PADDING(0x28); - be m_Field38; - bool m_Field3C; // Seems to be related to exit transition. - SWA_INSERT_PADDING(0x04); - be m_CursorIndex; - SWA_INSERT_PADDING(0x0C); - bool m_Field54; // Seems to be related to exit transition. - SWA_INSERT_PADDING(0x0B); - be m_Field60; - SWA_INSERT_PADDING(0x34); - bool m_Field98; - bool m_IsDeleteCheckMessageOpen; - bool m_Field9A; // Seems to be related to cursor selection. - SWA_INSERT_PADDING(0x04); - bool m_Field9F; - SWA_INSERT_PADDING(0x02); - bool m_IsDLCInfoMessageOpen; - }; - - SWA_ASSERT_OFFSETOF(CTitleMenu, m_Field38, 0x38); - SWA_ASSERT_OFFSETOF(CTitleMenu, m_Field3C, 0x3C); - SWA_ASSERT_OFFSETOF(CTitleMenu, m_CursorIndex, 0x44); - SWA_ASSERT_OFFSETOF(CTitleMenu, m_Field54, 0x54); - SWA_ASSERT_OFFSETOF(CTitleMenu, m_Field60, 0x60); - SWA_ASSERT_OFFSETOF(CTitleMenu, m_Field98, 0x98); - SWA_ASSERT_OFFSETOF(CTitleMenu, m_IsDeleteCheckMessageOpen, 0x99); - SWA_ASSERT_OFFSETOF(CTitleMenu, m_Field9A, 0x9A); - SWA_ASSERT_OFFSETOF(CTitleMenu, m_Field9F, 0x9F); - SWA_ASSERT_OFFSETOF(CTitleMenu, m_IsDLCInfoMessageOpen, 0xA2); -} diff --git a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateBase.h b/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateBase.h deleted file mode 100644 index b14bcebd..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateBase.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CTitleStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase {}; -} diff --git a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateIntro.h b/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateIntro.h deleted file mode 100644 index 618a0783..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateIntro.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CTitleStateIntro : public CTitleStateBase {}; -} diff --git a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateMenu.h b/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateMenu.h deleted file mode 100644 index b79a49e9..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateMenu.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CTitleStateMenu : public CTitleStateBase - { - public: - class CTitleStateMenuContext - { - public: - SWA_INSERT_PADDING(0x1E8); - xpointer m_pTitleMenu; - }; - }; -} diff --git a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateWorldMap.h b/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateWorldMap.h deleted file mode 100644 index 4934d740..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/Title/TitleStateWorldMap.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include -#include - -namespace SWA -{ - class CTitleStateWorldMap : public CTitleStateBase - { - public: - SWA_INSERT_PADDING(0x08); - xpointer m_pWorldMapCursor; - }; -} diff --git a/UnleashedRecomp/api/SWA/System/GameMode/WorldMap/WorldMapCamera.h b/UnleashedRecomp/api/SWA/System/GameMode/WorldMap/WorldMapCamera.h deleted file mode 100644 index 77c1ab3b..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/WorldMap/WorldMapCamera.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CWorldMapCamera : public CCameraController - { - public: - be m_Pitch; - be m_Yaw; - be m_Distance; - be m_RotationSpeed; - SWA_INSERT_PADDING(0x08); - bool m_CanMove; - SWA_INSERT_PADDING(0x34); - be m_TiltToEarthTransitionSpeed; - }; - - SWA_ASSERT_OFFSETOF(CWorldMapCamera, m_Pitch, 0xD0); - SWA_ASSERT_OFFSETOF(CWorldMapCamera, m_Yaw, 0xD4); - SWA_ASSERT_OFFSETOF(CWorldMapCamera, m_Distance, 0xD8); - SWA_ASSERT_OFFSETOF(CWorldMapCamera, m_RotationSpeed, 0xDC); - SWA_ASSERT_OFFSETOF(CWorldMapCamera, m_CanMove, 0xE8); - SWA_ASSERT_OFFSETOF(CWorldMapCamera, m_TiltToEarthTransitionSpeed, 0x120); -} diff --git a/UnleashedRecomp/api/SWA/System/GameMode/WorldMap/WorldMapCursor.h b/UnleashedRecomp/api/SWA/System/GameMode/WorldMap/WorldMapCursor.h deleted file mode 100644 index 03ceb730..00000000 --- a/UnleashedRecomp/api/SWA/System/GameMode/WorldMap/WorldMapCursor.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CWorldMapCursor : public CMenuWindowBase - { - public: - SWA_INSERT_PADDING(0x24); - be m_LeftStickVertical; - be m_LeftStickHorizontal; - bool m_IsCursorMoving; - SWA_INSERT_PADDING(0x07); - be m_CursorY; - be m_CursorX; - }; - - SWA_ASSERT_OFFSETOF(CWorldMapCursor, m_LeftStickVertical, 0x34); - SWA_ASSERT_OFFSETOF(CWorldMapCursor, m_LeftStickHorizontal, 0x38); - SWA_ASSERT_OFFSETOF(CWorldMapCursor, m_IsCursorMoving, 0x3C); - SWA_ASSERT_OFFSETOF(CWorldMapCursor, m_CursorY, 0x44); - SWA_ASSERT_OFFSETOF(CWorldMapCursor, m_CursorX, 0x48); -} diff --git a/UnleashedRecomp/api/SWA/System/GameObject.h b/UnleashedRecomp/api/SWA/System/GameObject.h deleted file mode 100644 index dd4f7fd1..00000000 --- a/UnleashedRecomp/api/SWA/System/GameObject.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "Hedgehog/Base/Thread/hhSynchronizedPtr.h" -#include "Hedgehog/Universe/Engine/hhMessageActor.h" -#include "Hedgehog/Universe/Engine/hhUpdateUnit.h" - -namespace SWA -{ - class CGameDocument; - class CWorld; - - class CGameObject : public Hedgehog::Universe::CUpdateUnit, public Hedgehog::Universe::CMessageActor - { - public: - class CMember - { - public: - Hedgehog::Base::TSynchronizedPtr m_pGameDocument; - Hedgehog::Base::TSynchronizedPtr m_pWorld; - SWA_INSERT_PADDING(0x70); - }; - - xpointer m_pVftable; - xpointer m_pMember; - }; -} diff --git a/UnleashedRecomp/api/SWA/System/GameParameter.h b/UnleashedRecomp/api/SWA/System/GameParameter.h deleted file mode 100644 index 95618144..00000000 --- a/UnleashedRecomp/api/SWA/System/GameParameter.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CGameParameter // : public Hedgehog::Universe::CMessageActor - { - public: - struct SSaveData; - struct SStageParameter; - - SWA_INSERT_PADDING(0x94); - xpointer m_pSaveData; - xpointer m_pStageParameter; - }; -} diff --git a/UnleashedRecomp/api/SWA/System/GammaController.h b/UnleashedRecomp/api/SWA/System/GammaController.h deleted file mode 100644 index d695acfa..00000000 --- a/UnleashedRecomp/api/SWA/System/GammaController.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include - -namespace SWA -{ - class CGammaController : public Hedgehog::Base::CObject - { - public: - SWA_INSERT_PADDING(0x10); - uint8_t m_Field10; - SWA_INSERT_PADDING(0x0F); - Hedgehog::Math::CVector4 m_Gamma; - Hedgehog::Math::CVector4 m_Field30; - }; - - SWA_ASSERT_OFFSETOF(CGammaController, m_Field10, 0x10); - SWA_ASSERT_OFFSETOF(CGammaController, m_Gamma, 0x20); - SWA_ASSERT_OFFSETOF(CGammaController, m_Field30, 0x30); - SWA_ASSERT_SIZEOF(CGammaController, 0x40); -} diff --git a/UnleashedRecomp/api/SWA/System/InputState.h b/UnleashedRecomp/api/SWA/System/InputState.h deleted file mode 100644 index b42c67eb..00000000 --- a/UnleashedRecomp/api/SWA/System/InputState.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "PadState.h" - -namespace SWA -{ - class CInputState : public Hedgehog::Base::CSynchronizedObject - { - public: - // TODO: Hedgehog::Base::TSynchronizedPtr - static CInputState* GetInstance(); - - SPadState m_PadStates[8]; - be m_CurrentPadStateIndex; - - const SPadState& GetPadState() const; - }; -} - -#include "InputState.inl" diff --git a/UnleashedRecomp/api/SWA/System/InputState.inl b/UnleashedRecomp/api/SWA/System/InputState.inl deleted file mode 100644 index 7b961c4d..00000000 --- a/UnleashedRecomp/api/SWA/System/InputState.inl +++ /dev/null @@ -1,13 +0,0 @@ -namespace SWA -{ - // TODO: Hedgehog::Base::TSynchronizedPtr - inline CInputState* CInputState::GetInstance() - { - return *(xpointer*)MmGetHostAddress(0x83361F5C); - } - - inline const SPadState& CInputState::GetPadState() const - { - return m_PadStates[m_CurrentPadStateIndex]; - } -} diff --git a/UnleashedRecomp/api/SWA/System/MatrixNodeTransform.h b/UnleashedRecomp/api/SWA/System/MatrixNodeTransform.h deleted file mode 100644 index 887c1617..00000000 --- a/UnleashedRecomp/api/SWA/System/MatrixNodeTransform.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -namespace SWA -{ - class CMatrixNodeTransform : public Hedgehog::Mirage::CMatrixNode - { - public: - Hedgehog::Mirage::CTransform m_Transform; - Hedgehog::Math::CMatrix m_WorldMatrix; - }; - - SWA_ASSERT_OFFSETOF(CMatrixNodeTransform, m_Transform, 0x60); - SWA_ASSERT_OFFSETOF(CMatrixNodeTransform, m_WorldMatrix, 0xC0); - SWA_ASSERT_SIZEOF(CMatrixNodeTransform, 0x100); -} diff --git a/UnleashedRecomp/api/SWA/System/PadState.h b/UnleashedRecomp/api/SWA/System/PadState.h deleted file mode 100644 index a27df47d..00000000 --- a/UnleashedRecomp/api/SWA/System/PadState.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -#include "SWA.inl" - -namespace SWA -{ - enum EKeyState : uint32_t - { - eKeyState_None = 0x0, - - eKeyState_A = 0x1, - eKeyState_B = 0x2, - eKeyState_X = 0x8, - eKeyState_Y = 0x10, - - eKeyState_DpadUp = 0x40, - eKeyState_DpadDown = 0x80, - eKeyState_DpadLeft = 0x100, - eKeyState_DpadRight = 0x200, - - eKeyState_Start = 0x400, - eKeyState_Select = 0x800, - - eKeyState_LeftBumper = 0x1000, - eKeyState_RightBumper = 0x2000, - - eKeyState_LeftTrigger = 0x4000, - eKeyState_RightTrigger = 0x8000, - - eKeyState_LeftStick = 0x10000, - eKeyState_RightStick = 0x20000, - - eKeyState_LeftStickUp = 0x40000, - eKeyState_LeftStickDown = 0x80000, - eKeyState_LeftStickLeft = 0x100000, - eKeyState_LeftStickRight = 0x200000, - - eKeyState_RightStickUp = 0x400000, - eKeyState_RightStickDown = 0x800000, - eKeyState_RightStickLeft = 0x1000000, - eKeyState_RightStickRight = 0x2000000 - }; - - struct SPadState - { - be DownState; - be UpState; - be TappedState; - be ReleasedState; - - be LeftStickHorizontal; - be LeftStickVertical; - - SWA_INSERT_PADDING(0x04); - - be RightStickHorizontal; - be RightStickVertical; - - SWA_INSERT_PADDING(0x04); - - be LeftTrigger; - be RightTrigger; - - SWA_INSERT_PADDING(0x08); - - bool IsDown(const EKeyState in_Keys) const; - bool IsUp(const EKeyState in_Keys) const; - bool IsTapped(const EKeyState in_Keys) const; - bool IsReleased(const EKeyState in_Keys) const; - }; -} - -#include "PadState.inl" diff --git a/UnleashedRecomp/api/SWA/System/PadState.inl b/UnleashedRecomp/api/SWA/System/PadState.inl deleted file mode 100644 index 483bcd13..00000000 --- a/UnleashedRecomp/api/SWA/System/PadState.inl +++ /dev/null @@ -1,22 +0,0 @@ -namespace SWA -{ - inline bool SPadState::IsDown(const EKeyState in_Keys) const - { - return (DownState & in_Keys) == in_Keys; - } - - inline bool SPadState::IsUp(const EKeyState in_Keys) const - { - return (UpState & in_Keys) == in_Keys; - } - - inline bool SPadState::IsTapped(const EKeyState in_Keys) const - { - return (TappedState & in_Keys) == in_Keys; - } - - inline bool SPadState::IsReleased(const EKeyState in_Keys) const - { - return (ReleasedState & in_Keys) == in_Keys; - } -} \ No newline at end of file diff --git a/UnleashedRecomp/api/SWA/System/World.h b/UnleashedRecomp/api/SWA/System/World.h deleted file mode 100644 index aafbcd2f..00000000 --- a/UnleashedRecomp/api/SWA/System/World.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "SWA.inl" -#include "Hedgehog/Base/Thread/hhSynchronizedObject.h" -#include "Hedgehog/Universe/Engine/hhMessageActor.h" - -namespace SWA -{ - class CWorld : public Hedgehog::Base::CSynchronizedObject, public Hedgehog::Universe::CMessageActor - { - public: - class CMember - { - public: - SWA_INSERT_PADDING(0x80); - }; - - xpointer m_pMember; - }; -} diff --git a/UnleashedRecomp/api/boost/smart_ptr/make_shared_object.h b/UnleashedRecomp/api/boost/smart_ptr/make_shared_object.h deleted file mode 100644 index 9bba6b4b..00000000 --- a/UnleashedRecomp/api/boost/smart_ptr/make_shared_object.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "boost/smart_ptr/shared_ptr.h" - -namespace boost -{ - template - shared_ptr make_shared(TArgs&&... args) - { - return shared_ptr(new T(std::forward(args)...)); - } -} diff --git a/UnleashedRecomp/api/boost/smart_ptr/shared_ptr.h b/UnleashedRecomp/api/boost/smart_ptr/shared_ptr.h deleted file mode 100644 index 4ff5625b..00000000 --- a/UnleashedRecomp/api/boost/smart_ptr/shared_ptr.h +++ /dev/null @@ -1,186 +0,0 @@ -#pragma once - -#include -#include - -namespace boost -{ - namespace detail - { - class sp_counted_base - { - protected: - struct vftable_t - { - be destructor; - be dispose; - be destroy; - be get_deleter; - }; - - xpointer vftable_; - be use_count_; - be weak_count_; - - public: - // TODO - sp_counted_base() = delete; - - void add_ref() - { - std::atomic_ref useCount(use_count_.value); - - be original, incremented; - do - { - original = use_count_; - incremented = original + 1; - } while (!useCount.compare_exchange_weak(original.value, incremented.value)); - } - - void release() - { - std::atomic_ref useCount(use_count_.value); - - be original, decremented; - do - { - original = use_count_; - decremented = original - 1; - } while (!useCount.compare_exchange_weak(original.value, decremented.value)); - - if (decremented == 0) - { - GuestToHostFunction(vftable_->dispose, this); - weak_release(); - } - } - - void weak_release() - { - std::atomic_ref weakCount(weak_count_.value); - - be original, decremented; - do - { - original = weak_count_; - decremented = original - 1; - } while (!weakCount.compare_exchange_weak(original.value, decremented.value)); - - if (decremented == 0) - { - GuestToHostFunction(vftable_->destroy, this); - } - } - - uint32_t use_count() const - { - return ByteSwap(static_cast(use_count_.value)); - } - - bool unique() const - { - return use_count() == 1; - } - }; - - template< class T > struct sp_dereference - { - typedef T& type; - }; - - template<> struct sp_dereference< void > - { - typedef void type; - }; - } - - template - class shared_ptr - { - private: - xpointer px; - xpointer pn; - - void add_ref() - { - if (pn) - pn->add_ref(); - } - - void release() - { - if (pn) - pn->release(); - } - - public: - shared_ptr() : px(), pn() {} - - // TODO - explicit shared_ptr(T* p) = delete; - - shared_ptr(const shared_ptr& other) : px(other.px), pn(other.pn) - { - add_ref(); - } - - shared_ptr(shared_ptr&& other) noexcept : px(std::exchange(other.px, nullptr)), - pn(std::exchange(other.pn, nullptr)) {} - - ~shared_ptr() - { - release(); - } - - shared_ptr& operator=(const shared_ptr& other) - { - if (this != &other) - { - release(); - - px = other.px; - pn = other.pn; - - add_ref(); - } - - return *this; - } - - shared_ptr& operator=(shared_ptr&& other) noexcept - { - if (this != &other) - { - release(); - - px = std::exchange(other.px, nullptr); - pn = std::exchange(other.pn, nullptr); - } - - return *this; - } - - shared_ptr& operator=(std::nullptr_t) - { - release(); - - px = NULL; - pn = NULL; - - return *this; - } - - T* get() const { return px; } - - detail::sp_dereference operator*() const { assert(px); return *px; } - T* operator->() const { assert(px); return px; } - - explicit operator bool() const { return px != nullptr; } - - size_t use_count() const { return pn ? pn->use_count() : 0; } - bool unique() const { return !pn || pn->unique(); } - }; - - using anonymous_shared_ptr = shared_ptr; -} diff --git a/UnleashedRecomp/apu/audio.h b/UnleashedRecomp/apu/audio.h index 1dbe9416..aaa0038f 100644 --- a/UnleashedRecomp/apu/audio.h +++ b/UnleashedRecomp/apu/audio.h @@ -10,7 +10,6 @@ void XAudioInitializeSystem(); void XAudioRegisterClient(PPCFunc* callback, uint32_t param); void XAudioSubmitFrame(void* samples); -void XAudioConfigValueChangedCallback(class IConfigDef* configDef); uint32_t XAudioRegisterRenderDriverClient(be* callback, be* driver); uint32_t XAudioUnregisterRenderDriverClient(uint32_t driver); diff --git a/UnleashedRecomp/apu/driver/sdl2_driver.cpp b/UnleashedRecomp/apu/driver/sdl2_driver.cpp index 787fab3d..d104e81f 100644 --- a/UnleashedRecomp/apu/driver/sdl2_driver.cpp +++ b/UnleashedRecomp/apu/driver/sdl2_driver.cpp @@ -150,18 +150,3 @@ void XAudioSubmitFrame(void* samples) SDL_QueueAudio(g_audioDevice, &audioFrames, sizeof(audioFrames)); } } - -void XAudioConfigValueChangedCallback(IConfigDef* configDef) -{ - if (configDef == &Config::ChannelConfiguration) - { - if (g_audioThread->joinable()) - { - g_audioThreadShouldExit = true; - g_audioThread->join(); - } - - CreateAudioDevice(); - CreateAudioThread(); - } -} diff --git a/UnleashedRecomp/gpu/rhi/plume_d3d12.cpp b/UnleashedRecomp/gpu/rhi/plume_d3d12.cpp index 395630c2..073ea68a 100644 --- a/UnleashedRecomp/gpu/rhi/plume_d3d12.cpp +++ b/UnleashedRecomp/gpu/rhi/plume_d3d12.cpp @@ -442,6 +442,8 @@ namespace plume { return D3D12_HEAP_TYPE_UPLOAD; case RenderHeapType::READBACK: return D3D12_HEAP_TYPE_READBACK; + case RenderHeapType::GPU_UPLOAD: + return D3D12_HEAP_TYPE_GPU_UPLOAD; default: assert(false && "Unknown heap type."); return D3D12_HEAP_TYPE_DEFAULT; @@ -2385,7 +2387,7 @@ namespace plume { range.End = readRange->end; } - void *outputData; + void *outputData = nullptr; d3d->Map(subresource, (readRange != nullptr) ? &range : nullptr, &outputData); return outputData; } @@ -2629,14 +2631,22 @@ namespace plume { // D3D12Pool - D3D12Pool::D3D12Pool(D3D12Device *device, const RenderPoolDesc &desc) { + D3D12Pool::D3D12Pool(D3D12Device *device, const RenderPoolDesc &desc, bool gpuUploadHeapFallback) { assert(device != nullptr); this->device = device; this->desc = desc; D3D12MA::POOL_DESC poolDesc = {}; - poolDesc.HeapProperties.Type = toD3D12(desc.heapType); + + // When using an UMA architecture without explicit support for GPU Upload heaps, we instead just make a custom heap with the same properties as Upload heaps. + if ((desc.heapType == RenderHeapType::GPU_UPLOAD) && gpuUploadHeapFallback) { + poolDesc.HeapProperties = device->d3d->GetCustomHeapProperties(0, D3D12_HEAP_TYPE_UPLOAD); + } + else { + poolDesc.HeapProperties.Type = toD3D12(desc.heapType); + } + poolDesc.MinBlockCount = desc.minBlockCount; poolDesc.MaxBlockCount = desc.maxBlockCount; poolDesc.Flags |= desc.useLinearAlgorithm ? D3D12MA::POOL_FLAG_ALGORITHM_LINEAR : D3D12MA::POOL_FLAG_NONE; @@ -3390,13 +3400,15 @@ namespace plume { if (SUCCEEDED(res)) { triangleFanSupportOption = d3d12Options15.TriangleFanSupported; } - - // Check if dynamic depth bias is supported. + + // Check if dynamic depth bias and GPU upload heap are supported. bool dynamicDepthBiasOption = false; + bool gpuUploadHeapOption = false; D3D12_FEATURE_DATA_D3D12_OPTIONS16 d3d12Options16 = {}; res = deviceOption->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS16, &d3d12Options16, sizeof(d3d12Options16)); if (SUCCEEDED(res)) { dynamicDepthBiasOption = d3d12Options16.DynamicDepthBiasSupported; + gpuUploadHeapOption = d3d12Options16.GPUUploadHeapSupported; } // Check if the architecture has UMA. @@ -3431,6 +3443,11 @@ namespace plume { capabilities.triangleFan = triangleFanSupportOption; capabilities.dynamicDepthBias = dynamicDepthBiasOption; capabilities.uma = uma; + + // Pretend GPU Upload heaps are supported if UMA is supported, as the backend has a workaround using a custom pool for it. + capabilities.gpuUploadHeap = uma || gpuUploadHeapOption; + gpuUploadHeapFallback = uma && !gpuUploadHeapOption; + description.name = deviceName; description.dedicatedVideoMemory = adapterDesc.DedicatedVideoMemory; description.vendor = RenderDeviceVendor(adapterDesc.VendorId); @@ -3528,6 +3545,13 @@ namespace plume { colorTargetHeapAllocator = std::make_unique(this, TargetDescriptorHeapSize, D3D12_DESCRIPTOR_HEAP_TYPE_RTV); depthTargetHeapAllocator = std::make_unique(this, TargetDescriptorHeapSize, D3D12_DESCRIPTOR_HEAP_TYPE_DSV); + // Create the custom upload pool that will be used as the fallback when using an UMA architecture without explicit support for GPU Upload heaps. + if (gpuUploadHeapFallback) { + RenderPoolDesc poolDesc; + poolDesc.heapType = RenderHeapType::GPU_UPLOAD; + customUploadPool = std::make_unique(this, poolDesc, true); + } + // Create a command queue only for retrieving the timestamp frequency. Delete it immediately afterwards. std::unique_ptr timestampCommandQueue = std::make_unique(this, RenderCommandListType::DIRECT); res = timestampCommandQueue->d3d->GetTimestampFrequency(×tampFrequency); @@ -3577,7 +3601,12 @@ namespace plume { } std::unique_ptr D3D12Device::createBuffer(const RenderBufferDesc &desc) { - return std::make_unique(this, nullptr, desc); + if ((desc.heapType == RenderHeapType::GPU_UPLOAD) && gpuUploadHeapFallback) { + return std::make_unique(this, customUploadPool.get(), desc); + } + else { + return std::make_unique(this, nullptr, desc); + } } std::unique_ptr D3D12Device::createTexture(const RenderTextureDesc &desc) { @@ -3589,7 +3618,7 @@ namespace plume { } std::unique_ptr D3D12Device::createPool(const RenderPoolDesc &desc) { - return std::make_unique(this, desc); + return std::make_unique(this, desc, gpuUploadHeapFallback); } std::unique_ptr D3D12Device::createPipelineLayout(const RenderPipelineLayoutDesc &desc) { diff --git a/UnleashedRecomp/gpu/rhi/plume_d3d12.h b/UnleashedRecomp/gpu/rhi/plume_d3d12.h index d4987fbc..34461c07 100644 --- a/UnleashedRecomp/gpu/rhi/plume_d3d12.h +++ b/UnleashedRecomp/gpu/rhi/plume_d3d12.h @@ -329,7 +329,7 @@ namespace plume { D3D12Device *device = nullptr; RenderPoolDesc desc; - D3D12Pool(D3D12Device *device, const RenderPoolDesc &desc); + D3D12Pool(D3D12Device *device, const RenderPoolDesc &desc, bool gpuUploadHeapFallback); ~D3D12Pool() override; std::unique_ptr createBuffer(const RenderBufferDesc &desc) override; std::unique_ptr createTexture(const RenderTextureDesc &desc) override; @@ -430,9 +430,11 @@ namespace plume { std::unique_ptr samplerHeapAllocator; std::unique_ptr colorTargetHeapAllocator; std::unique_ptr depthTargetHeapAllocator; + std::unique_ptr customUploadPool; RenderDeviceCapabilities capabilities; RenderDeviceDescription description; uint64_t timestampFrequency = 1; + bool gpuUploadHeapFallback = false; D3D12Device(D3D12Interface *renderInterface, const std::string &preferredDeviceName); ~D3D12Device() override; diff --git a/UnleashedRecomp/gpu/rhi/plume_render_interface_types.h b/UnleashedRecomp/gpu/rhi/plume_render_interface_types.h index b0be1592..568160a8 100644 --- a/UnleashedRecomp/gpu/rhi/plume_render_interface_types.h +++ b/UnleashedRecomp/gpu/rhi/plume_render_interface_types.h @@ -351,7 +351,8 @@ namespace plume { UNKNOWN, DEFAULT, UPLOAD, - READBACK + READBACK, + GPU_UPLOAD }; enum class RenderTextureArrangement { @@ -1807,6 +1808,9 @@ namespace plume { // UMA. bool uma = false; + + // GPU Upload heap. + bool gpuUploadHeap = false; }; struct RenderInterfaceCapabilities { diff --git a/UnleashedRecomp/gpu/rhi/plume_vulkan.cpp b/UnleashedRecomp/gpu/rhi/plume_vulkan.cpp index 477a431a..94f91faf 100644 --- a/UnleashedRecomp/gpu/rhi/plume_vulkan.cpp +++ b/UnleashedRecomp/gpu/rhi/plume_vulkan.cpp @@ -808,6 +808,12 @@ namespace plume { bufferInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; createInfo.flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT; break; + case RenderHeapType::GPU_UPLOAD: + bufferInfo.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; + bufferInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; + createInfo.flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT; + createInfo.requiredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + break; default: assert(false && "Unknown heap type."); break; @@ -833,7 +839,7 @@ namespace plume { } if (res != VK_SUCCESS) { - fprintf(stderr, "vkCreateBuffer failed with error code 0x%X.\n", res); + fprintf(stderr, "vmaCreateBuffer failed with error code 0x%X.\n", res); return; } } @@ -3887,6 +3893,15 @@ namespace plume { VkDeviceSize memoryHeapSize = 0; const VkPhysicalDeviceMemoryProperties *memoryProps = nullptr; vmaGetMemoryProperties(allocator, &memoryProps); + + constexpr VkMemoryPropertyFlags uploadHeapPropertyFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + bool hasHostVisibleDeviceLocalMemory = false; + for (uint32_t i = 0; i < memoryProps->memoryTypeCount; i++) { + if ((memoryProps->memoryTypes[i].propertyFlags & uploadHeapPropertyFlags) == uploadHeapPropertyFlags) { + hasHostVisibleDeviceLocalMemory = true; + } + } + for (uint32_t i = 0; i < memoryProps->memoryHeapCount; i++) { if (memoryProps->memoryHeaps[i].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) { memoryHeapSize = std::max(memoryProps->memoryHeaps[i].size, memoryHeapSize); @@ -3907,6 +3922,8 @@ namespace plume { capabilities.preferHDR = memoryHeapSize > (512 * 1024 * 1024); capabilities.triangleFan = true; capabilities.dynamicDepthBias = true; + capabilities.uma = (description.type == RenderDeviceType::INTEGRATED) && hasHostVisibleDeviceLocalMemory; + capabilities.gpuUploadHeap = capabilities.uma; // Fill Vulkan-only capabilities. loadStoreOpNoneSupported = supportedOptionalExtensions.find(VK_EXT_LOAD_STORE_OP_NONE_EXTENSION_NAME) != supportedOptionalExtensions.end(); diff --git a/UnleashedRecomp/gpu/shader/csd_no_tex_vs.hlsl b/UnleashedRecomp/gpu/shader/csd_no_tex_vs.hlsl index 48ec6af1..1654e734 100644 --- a/UnleashedRecomp/gpu/shader/csd_no_tex_vs.hlsl +++ b/UnleashedRecomp/gpu/shader/csd_no_tex_vs.hlsl @@ -43,7 +43,7 @@ void main( out float4 oColor0 : COLOR0, out float4 oColor1 : COLOR1) { - oPos.xy = (iPosition0.xy - 0.5) * g_ViewportSize.zw * float2(2.0, -2.0) + float2(-1.0, 1.0); + oPos.xy = iPosition0.xy * g_ViewportSize.zw * float2(2.0, -2.0) + float2(-1.0, 1.0); oPos.z = g_Z.x; oPos.w = 1.0; oTexCoord0 = iColor0.wxyz; diff --git a/UnleashedRecomp/gpu/shader/csd_vs.hlsl b/UnleashedRecomp/gpu/shader/csd_vs.hlsl index 11463684..90b561f5 100644 --- a/UnleashedRecomp/gpu/shader/csd_vs.hlsl +++ b/UnleashedRecomp/gpu/shader/csd_vs.hlsl @@ -44,7 +44,7 @@ void main( out float4 oColor0 : COLOR0, out float4 oColor1 : COLOR1) { - oPos.xy = (iPosition0.xy - 0.5) * g_ViewportSize.zw * float2(2.0, -2.0) + float2(-1.0, 1.0); + oPos.xy = iPosition0.xy * g_ViewportSize.zw * float2(2.0, -2.0) + float2(-1.0, 1.0); oPos.z = g_Z.x; oPos.w = 1.0; oTexCoord0 = iColor0.wxyz; diff --git a/UnleashedRecomp/gpu/shader/movie_vs.hlsl b/UnleashedRecomp/gpu/shader/movie_vs.hlsl index c4e47c1c..6d00919e 100644 --- a/UnleashedRecomp/gpu/shader/movie_vs.hlsl +++ b/UnleashedRecomp/gpu/shader/movie_vs.hlsl @@ -4,6 +4,7 @@ Interpolators main(in VertexShaderInput In) { Interpolators Out; Out.ProjPos = In.ObjPos; + Out.ProjPos.xy += g_HalfPixelOffset * Out.ProjPos.w; Out.UV = In.UV; return Out; } diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index e24ce4de..2333dfb7 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #if defined(ASYNC_PSO_DEBUG) || defined(PSO_CACHING) #include @@ -163,6 +164,8 @@ struct SharedConstants uint32_t samplerIndices[16]{}; uint32_t booleans{}; uint32_t swappedTexcoords{}; + float halfPixelOffsetX{}; + float halfPixelOffsetY{}; float alphaThreshold{}; }; @@ -320,6 +323,7 @@ static constexpr RenderFormat BACKBUFFER_FORMAT = RenderFormat::B8G8R8A8_UNORM; static std::unique_ptr g_acquireSemaphores[NUM_FRAMES]; static std::unique_ptr g_renderSemaphores[NUM_FRAMES]; static uint32_t g_backBufferIndex; +static std::unique_ptr g_backBufferHolder; static GuestSurface* g_backBuffer; static std::unique_ptr g_intermediaryBackBufferTexture; @@ -679,7 +683,10 @@ static void DestructTempResources() g_textureDescriptorAllocator.free(texture->descriptorIndex); if (texture->patchedTexture != nullptr) - g_textureDescriptorAllocator.free(texture->patchedTexture->descriptorIndex); + g_textureDescriptorAllocator.free(texture->patchedTexture->descriptorIndex); + + if (texture->recreatedCubeMapTexture != nullptr) + g_textureDescriptorAllocator.free(texture->recreatedCubeMapTexture->descriptorIndex); texture->~GuestTexture(); break; @@ -729,10 +736,13 @@ static void DestructTempResources() } static std::thread::id g_presentThreadId = std::this_thread::get_id(); +static std::atomic g_readyForCommands; PPC_FUNC_IMPL(__imp__sub_824ECA00); PPC_FUNC(sub_824ECA00) { + // Guard against thread ownership changes when between command lists. + g_readyForCommands.wait(false); g_presentThreadId = std::this_thread::get_id(); __imp__sub_824ECA00(ctx, base); } @@ -1617,6 +1627,9 @@ static void BeginCommandList() commandList->setGraphicsDescriptorSet(g_textureDescriptorSet.get(), 1); commandList->setGraphicsDescriptorSet(g_textureDescriptorSet.get(), 2); commandList->setGraphicsDescriptorSet(g_samplerDescriptorSet.get(), 3); + + g_readyForCommands = true; + g_readyForCommands.notify_one(); } template @@ -1646,7 +1659,7 @@ static void ApplyLowEndDefaults() } } -bool Video::CreateHostDevice(const char *sdlVideoDriver) +bool Video::CreateHostDevice(const char *sdlVideoDriver, bool graphicsApiRetry) { for (uint32_t i = 0; i < 16; i++) g_inputSlots[i].index = i; @@ -1666,17 +1679,39 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver) std::vector interfaceFunctions; #ifdef UNLEASHED_RECOMP_D3D12 + bool allowVulkanRedirection = true; + + if (graphicsApiRetry) + { + // If we are attempting to create again after a reboot due to a crash, swap the order. + g_vulkan = !g_vulkan; + + // Don't allow redirection to Vulkan if we are retrying after a crash, + // so the user can at least boot the game with D3D12 if Vulkan fails to work. + allowVulkanRedirection = false; + } + interfaceFunctions.push_back(g_vulkan ? CreateVulkanInterfaceWrapper : CreateD3D12Interface); interfaceFunctions.push_back(g_vulkan ? CreateD3D12Interface : CreateVulkanInterfaceWrapper); #else interfaceFunctions.push_back(CreateVulkanInterfaceWrapper); #endif - for (RenderInterfaceFunction *interfaceFunction : interfaceFunctions) + for (size_t i = 0; i < interfaceFunctions.size(); i++) { - g_interface = interfaceFunction(); - if (g_interface != nullptr) + RenderInterfaceFunction* interfaceFunction = interfaceFunctions[i]; + +#ifdef UNLEASHED_RECOMP_D3D12 + // Wrap the device creation in __try/__except to survive from driver crashes. + __try +#endif { + g_interface = interfaceFunction(); + if (g_interface == nullptr) + { + continue; + } + g_device = g_interface->createDevice(Config::GraphicsDevice); if (g_device != nullptr) { @@ -1685,16 +1720,40 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver) #ifdef UNLEASHED_RECOMP_D3D12 if (interfaceFunction == CreateD3D12Interface) { - if (deviceDescription.vendor == RenderDeviceVendor::AMD) + if (allowVulkanRedirection) { - // AMD Drivers before this version have a known issue where MSAA resolve targets will fail to work correctly. - // If no specific graphics API was selected, we silently destroy this one and move to the next option as it'll - // just work incorrectly otherwise and result in visual glitches and 3D rendering not working in general. - constexpr uint64_t MinimumAMDDriverVersion = 0x1F00005DC2005CULL; // 31.0.24002.92 - if ((Config::GraphicsAPI == EGraphicsAPI::Auto) && (deviceDescription.driverVersion < MinimumAMDDriverVersion)) + bool redirectToVulkan = false; + + if (deviceDescription.vendor == RenderDeviceVendor::AMD) + { + // AMD Drivers before this version have a known issue where MSAA resolve targets will fail to work correctly. + // If no specific graphics API was selected, we silently destroy this one and move to the next option as it'll + // just work incorrectly otherwise and result in visual glitches and 3D rendering not working in general. + constexpr uint64_t MinimumAMDDriverVersion = 0x1F00005DC2005CULL; // 31.0.24002.92 + if ((Config::GraphicsAPI == EGraphicsAPI::Auto) && (deviceDescription.driverVersion < MinimumAMDDriverVersion)) + redirectToVulkan = true; + } + else if (deviceDescription.vendor == RenderDeviceVendor::INTEL) + { + // Intel drivers on D3D12 are extremely buggy, introducing various graphical glitches. + // We will redirect users to Vulkan until a workaround can be found. + if (Config::GraphicsAPI == EGraphicsAPI::Auto) + redirectToVulkan = true; + } + + if (redirectToVulkan) { g_device.reset(); g_interface.reset(); + + // In case Vulkan fails to initialize, we will try D3D12 again afterwards, + // just to get the game to boot. This only really happens in very old Intel GPU drivers. + if (!g_vulkan) + { + interfaceFunctions.push_back(CreateD3D12Interface); + allowVulkanRedirection = false; + } + continue; } } @@ -1713,6 +1772,22 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver) break; } } +#ifdef UNLEASHED_RECOMP_D3D12 + __except (EXCEPTION_EXECUTE_HANDLER) + { + if (graphicsApiRetry) + { + // If we were retrying, and this also failed, then we'll show the user neither of the graphics APIs succeeded. + return false; + } + else + { + // If this is the first crash we ran into, reboot and try the other graphics API. + os::process::StartProcess(os::process::GetExecutablePath(), { "--graphics-api-retry" }); + std::_Exit(0); + } + } +#endif } if (g_device == nullptr) @@ -1720,6 +1795,14 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver) return false; } +#ifdef UNLEASHED_RECOMP_D3D12 + if (graphicsApiRetry) + { + // If we managed to create a device after retrying it in a reboot, remember the one we picked. + Config::GraphicsAPI = g_vulkan ? EGraphicsAPI::Vulkan : EGraphicsAPI::D3D12; + } +#endif + g_capabilities = g_device->getCapabilities(); LoadEmbeddedResources(); @@ -1736,6 +1819,21 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver) ApplyLowEndDefaults(); } + const RenderSampleCounts colourSampleCount = g_device->getSampleCountsSupported(RenderFormat::R16G16B16A16_FLOAT); + const RenderSampleCounts depthSampleCount = g_device->getSampleCountsSupported(RenderFormat::D32_FLOAT); + const RenderSampleCounts commonSampleCount = colourSampleCount & depthSampleCount; + + // Disable specific MSAA levels if they are not supported. + if ((commonSampleCount & RenderSampleCount::COUNT_2) == 0) + Config::AntiAliasing.InaccessibleValues.emplace(EAntiAliasing::MSAA2x); + if ((commonSampleCount & RenderSampleCount::COUNT_4) == 0) + Config::AntiAliasing.InaccessibleValues.emplace(EAntiAliasing::MSAA4x); + if ((commonSampleCount & RenderSampleCount::COUNT_8) == 0) + Config::AntiAliasing.InaccessibleValues.emplace(EAntiAliasing::MSAA8x); + + // Set Anti-Aliasing to nearest supported level. + Config::AntiAliasing.SnapToNearestAccessibleValue(false); + g_queue = g_device->createCommandQueue(RenderCommandListType::DIRECT); for (auto& commandList : g_commandLists) @@ -1948,7 +2046,10 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver) desc.renderTargetCount = 1; g_gammaCorrectionPipeline = g_device->createGraphicsPipeline(desc); - g_backBuffer = g_userHeap.AllocPhysical(ResourceType::RenderTarget); + // NOTE: We initially allocate this on host memory to make the installer work, even if the 4 GB memory allocation fails. + g_backBufferHolder = std::make_unique(ResourceType::RenderTarget); + + g_backBuffer = g_backBufferHolder.get(); g_backBuffer->width = 1280; g_backBuffer->height = 720; g_backBuffer->format = BACKBUFFER_FORMAT; @@ -2006,6 +2107,17 @@ static uint32_t CreateDevice(uint32_t a1, uint32_t a2, uint32_t a3, uint32_t a4, LoadTexture((uint8_t *)achievement.pImageBuffer, achievement.ImageBufferSize).release(); } + // Move backbuffer to guest memory. + assert(!g_memory.IsInMemoryRange(g_backBuffer) && g_backBufferHolder != nullptr); + g_backBuffer = g_userHeap.AllocPhysical(std::move(*g_backBufferHolder)); + + // Check for stale reference. BeginCommandList() gets called before CreateDevice() which is where the assignment happens. + if (g_renderTarget == g_backBufferHolder.get()) g_renderTarget = g_backBuffer; + if (g_depthStencil == g_backBufferHolder.get()) g_depthStencil = g_backBuffer; + + // Free the host backbuffer. + g_backBufferHolder = nullptr; + auto device = g_userHeap.AllocPhysical(); memset(device, 0, sizeof(*device)); @@ -2109,40 +2221,54 @@ static void* LockVertexBuffer(GuestBuffer* buffer, uint32_t, uint32_t, uint32_t return LockBuffer(buffer, flags); } +static std::atomic g_bufferUploadCount = 0; + template static void UnlockBuffer(GuestBuffer* buffer, bool useCopyQueue) { - auto uploadBuffer = g_device->createBuffer(RenderBufferDesc::UploadBuffer(buffer->dataSize)); + auto copyBuffer = [&](T* dest) + { + auto src = reinterpret_cast(buffer->mappedMemory); - auto dest = reinterpret_cast(uploadBuffer->map()); - auto src = reinterpret_cast(buffer->mappedMemory); - - for (size_t i = 0; i < buffer->dataSize; i += sizeof(T)) - { - *dest = ByteSwap(*src); - ++dest; - ++src; - } - - uploadBuffer->unmap(); - - if (useCopyQueue) - { - ExecuteCopyCommandList([&] + for (size_t i = 0; i < buffer->dataSize; i += sizeof(T)) { - g_copyCommandList->copyBufferRegion(buffer->buffer->at(0), uploadBuffer->at(0), buffer->dataSize); - }); + *dest = ByteSwap(*src); + ++dest; + ++src; + } + }; + + if (useCopyQueue && g_capabilities.gpuUploadHeap) + { + copyBuffer(reinterpret_cast(buffer->buffer->map())); + buffer->buffer->unmap(); } else { - auto& commandList = g_commandLists[g_frame]; + auto uploadBuffer = g_device->createBuffer(RenderBufferDesc::UploadBuffer(buffer->dataSize)); + copyBuffer(reinterpret_cast(uploadBuffer->map())); + uploadBuffer->unmap(); - commandList->barriers(RenderBarrierStage::COPY, RenderBufferBarrier(buffer->buffer.get(), RenderBufferAccess::WRITE)); - commandList->copyBufferRegion(buffer->buffer->at(0), uploadBuffer->at(0), buffer->dataSize); - commandList->barriers(RenderBarrierStage::GRAPHICS, RenderBufferBarrier(buffer->buffer.get(), RenderBufferAccess::READ)); + if (useCopyQueue) + { + ExecuteCopyCommandList([&] + { + g_copyCommandList->copyBufferRegion(buffer->buffer->at(0), uploadBuffer->at(0), buffer->dataSize); + }); + } + else + { + auto& commandList = g_commandLists[g_frame]; - g_tempBuffers[g_frame].emplace_back(std::move(uploadBuffer)); + commandList->barriers(RenderBarrierStage::COPY, RenderBufferBarrier(buffer->buffer.get(), RenderBufferAccess::WRITE)); + commandList->copyBufferRegion(buffer->buffer->at(0), uploadBuffer->at(0), buffer->dataSize); + commandList->barriers(RenderBarrierStage::GRAPHICS, RenderBufferBarrier(buffer->buffer.get(), RenderBufferAccess::READ)); + + g_tempBuffers[g_frame].emplace_back(std::move(uploadBuffer)); + } } + + g_bufferUploadCount++; } template @@ -2311,19 +2437,24 @@ static void DrawProfiler() ImGui::NewLine(); - O1HeapDiagnostics diagnostics, physicalDiagnostics; + if (g_userHeap.heap != nullptr && g_userHeap.physicalHeap != nullptr) { - std::lock_guard lock(g_userHeap.mutex); - diagnostics = o1heapGetDiagnostics(g_userHeap.heap); - } - { - std::lock_guard lock(g_userHeap.physicalMutex); - physicalDiagnostics = o1heapGetDiagnostics(g_userHeap.physicalHeap); + O1HeapDiagnostics diagnostics, physicalDiagnostics; + { + std::lock_guard lock(g_userHeap.mutex); + diagnostics = o1heapGetDiagnostics(g_userHeap.heap); + } + { + std::lock_guard lock(g_userHeap.physicalMutex); + physicalDiagnostics = o1heapGetDiagnostics(g_userHeap.physicalHeap); + } + + ImGui::Text("Heap Allocated: %d MB", int32_t(diagnostics.allocated / (1024 * 1024))); + ImGui::Text("Physical Heap Allocated: %d MB", int32_t(physicalDiagnostics.allocated / (1024 * 1024))); } - ImGui::Text("Heap Allocated: %d MB", int32_t(diagnostics.allocated / (1024 * 1024))); - ImGui::Text("Physical Heap Allocated: %d MB", int32_t(physicalDiagnostics.allocated / (1024 * 1024))); ImGui::Text("GPU Waits: %d", int32_t(g_waitForGPUCount)); + ImGui::Text("Buffer Uploads: %d", int32_t(g_bufferUploadCount)); ImGui::NewLine(); ImGui::Text("Present Wait: %s", g_capabilities.presentWait ? "Supported" : "Unsupported"); @@ -2339,6 +2470,7 @@ static void DrawProfiler() ImGui::Text("Device Type: %s", DeviceTypeName(g_device->getDescription().type)); ImGui::Text("VRAM: %.2f MiB", (double)(g_device->getDescription().dedicatedVideoMemory) / (1024.0 * 1024.0)); ImGui::Text("UMA: %s", g_capabilities.uma ? "Supported" : "Unsupported"); + ImGui::Text("GPU Upload Heap: %s", g_capabilities.gpuUploadHeap ? "Supported" : "Unsupported"); const char* sdlVideoDriver = SDL_GetCurrentVideoDriver(); if (sdlVideoDriver != nullptr) @@ -2659,6 +2791,8 @@ static std::atomic g_executedCommandList; void Video::Present() { + g_readyForCommands = false; + RenderCommand cmd; cmd.type = RenderCommandType::ExecutePendingStretchRectCommands; g_renderQueue.enqueue(cmd); @@ -3019,10 +3153,15 @@ static GuestTexture* CreateTexture(uint32_t width, uint32_t height, uint32_t dep return texture; } +static RenderHeapType GetBufferHeapType() +{ + return g_capabilities.gpuUploadHeap ? RenderHeapType::GPU_UPLOAD : RenderHeapType::DEFAULT; +} + static GuestBuffer* CreateVertexBuffer(uint32_t length) { auto buffer = g_userHeap.AllocPhysical(ResourceType::VertexBuffer); - buffer->buffer = g_device->createBuffer(RenderBufferDesc::VertexBuffer(length, RenderHeapType::DEFAULT, RenderBufferFlag::INDEX)); + buffer->buffer = g_device->createBuffer(RenderBufferDesc::VertexBuffer(length, GetBufferHeapType(), RenderBufferFlag::INDEX)); buffer->dataSize = length; #ifdef _DEBUG buffer->buffer->setName(fmt::format("Vertex Buffer {:X}", g_memory.MapVirtual(buffer))); @@ -3033,7 +3172,7 @@ static GuestBuffer* CreateVertexBuffer(uint32_t length) static GuestBuffer* CreateIndexBuffer(uint32_t length, uint32_t, uint32_t format) { auto buffer = g_userHeap.AllocPhysical(ResourceType::IndexBuffer); - buffer->buffer = g_device->createBuffer(RenderBufferDesc::IndexBuffer(length, RenderHeapType::DEFAULT)); + buffer->buffer = g_device->createBuffer(RenderBufferDesc::IndexBuffer(length, GetBufferHeapType())); buffer->dataSize = length; buffer->format = ConvertFormat(format); buffer->guestFormat = format; @@ -3089,8 +3228,6 @@ static void FlushViewport() if (g_dirtyStates.viewport) { auto viewport = g_viewport; - viewport.x += 0.5f; - viewport.y += 0.5f; if (viewport.minDepth > viewport.maxDepth) std::swap(viewport.minDepth, viewport.maxDepth); @@ -3514,6 +3651,12 @@ static void SetFramebuffer(GuestSurface* renderTarget, GuestSurface* depthStenci g_framebuffer = nullptr; } + if (g_framebuffer != nullptr) + { + SetDirtyValue(g_dirtyStates.sharedConstants, g_sharedConstants.halfPixelOffsetX, 1.0f / float(g_framebuffer->getWidth())); + SetDirtyValue(g_dirtyStates.sharedConstants, g_sharedConstants.halfPixelOffsetY, -1.0f / float(g_framebuffer->getHeight())); + } + g_dirtyStates.renderTargetAndDepthStencil = settingForClear; } } @@ -3641,6 +3784,14 @@ static void SetTextureInRenderThread(uint32_t index, GuestTexture* texture) SetDirtyValue(g_dirtyStates.sharedConstants, g_sharedConstants.texture3DIndices[index], texture != nullptr && viewDimension == RenderTextureViewDimension::TEXTURE_3D ? texture->descriptorIndex : TEXTURE_DESCRIPTOR_NULL_TEXTURE_3D); + // Check if there's a cubemap texture we recreated and assign it if it's valid. The shader will pick whichever is correct. + if (viewDimension == RenderTextureViewDimension::TEXTURE_2D && texture->recreatedCubeMapTexture != nullptr) + { + texture = texture->recreatedCubeMapTexture.get(); + AddBarrier(texture, RenderTextureLayout::SHADER_READ); + viewDimension = texture->viewDimension; + } + SetDirtyValue(g_dirtyStates.sharedConstants, g_sharedConstants.textureCubeIndices[index], texture != nullptr && viewDimension == RenderTextureViewDimension::TEXTURE_CUBE ? texture->descriptorIndex : TEXTURE_DESCRIPTOR_NULL_TEXTURE_CUBE); } @@ -5471,21 +5622,30 @@ static RenderFormat ConvertDXGIFormat(ddspp::DXGIFormat format) } } -static bool LoadTexture(GuestTexture& texture, const uint8_t* data, size_t dataSize, RenderComponentMapping componentMapping) +static bool LoadTexture(GuestTexture& texture, const uint8_t* data, size_t dataSize, RenderComponentMapping componentMapping, bool forceCubeMap = false) { ddspp::Descriptor ddsDesc; if (ddspp::decode_header((unsigned char *)(data), ddsDesc) != ddspp::Error) { + forceCubeMap &= (ddsDesc.type == ddspp::Texture2D) && (ddsDesc.arraySize == 1); + uint32_t arraySize = ddsDesc.type == ddspp::TextureType::Cubemap ? (ddsDesc.arraySize * 6) : ddsDesc.arraySize; + RenderTextureDesc desc; desc.dimension = ConvertTextureDimension(ddsDesc.type); desc.width = ddsDesc.width; desc.height = ddsDesc.height; desc.depth = ddsDesc.depth; desc.mipLevels = ddsDesc.numMips; - desc.arraySize = ddsDesc.type == ddspp::TextureType::Cubemap ? ddsDesc.arraySize * 6 : ddsDesc.arraySize; + desc.arraySize = arraySize; desc.format = ConvertDXGIFormat(ddsDesc.format); desc.flags = ddsDesc.type == ddspp::TextureType::Cubemap ? RenderTextureFlag::CUBE : RenderTextureFlag::NONE; + if (forceCubeMap) + { + desc.arraySize = 6; + desc.flags = RenderTextureFlag::CUBE; + } + texture.textureHolder = g_device->createTexture(desc); texture.texture = texture.textureHolder.get(); texture.layout = RenderTextureLayout::COPY_DEST; @@ -5495,6 +5655,10 @@ static bool LoadTexture(GuestTexture& texture, const uint8_t* data, size_t dataS viewDesc.dimension = ConvertTextureViewDimension(ddsDesc.type); viewDesc.mipLevels = ddsDesc.numMips; viewDesc.componentMapping = componentMapping; + + if (forceCubeMap) + viewDesc.dimension = RenderTextureViewDimension::TEXTURE_CUBE; + texture.textureView = texture.texture->createTextureView(viewDesc); texture.descriptorIndex = g_textureDescriptorAllocator.allocate(); g_textureDescriptorSet->setTexture(texture.descriptorIndex, texture.texture, RenderTextureLayout::SHADER_READ, texture.textureView.get()); @@ -5519,7 +5683,7 @@ static bool LoadTexture(GuestTexture& texture, const uint8_t* data, size_t dataS uint32_t curSrcOffset = 0; uint32_t curDstOffset = 0; - for (uint32_t arraySlice = 0; arraySlice < desc.arraySize; arraySlice++) + for (uint32_t arraySlice = 0; arraySlice < arraySize; arraySlice++) { for (uint32_t mipSlice = 0; mipSlice < ddsDesc.numMips; mipSlice++) { @@ -5569,13 +5733,24 @@ static bool LoadTexture(GuestTexture& texture, const uint8_t* data, size_t dataS { g_copyCommandList->barriers(RenderBarrierStage::COPY, RenderTextureBarrier(texture.texture, RenderTextureLayout::COPY_DEST)); - for (size_t i = 0; i < slices.size(); i++) - { - auto& slice = slices[i]; + auto copyTextureRegion = [&](Slice& slice, uint32_t subresourceIndex) + { + g_copyCommandList->copyTextureRegion( + RenderTextureCopyLocation::Subresource(texture.texture, subresourceIndex), + RenderTextureCopyLocation::PlacedFootprint(uploadBuffer.get(), desc.format, slice.width, slice.height, slice.depth, (slice.dstRowPitch * 8) / ddsDesc.bitsPerPixelOrBlock * ddsDesc.blockWidth, slice.dstOffset)); + }; - g_copyCommandList->copyTextureRegion( - RenderTextureCopyLocation::Subresource(texture.texture, i), - RenderTextureCopyLocation::PlacedFootprint(uploadBuffer.get(), desc.format, slice.width, slice.height, slice.depth, (slice.dstRowPitch * 8) / ddsDesc.bitsPerPixelOrBlock * ddsDesc.blockWidth, slice.dstOffset)); + for (size_t i = 0; i < slices.size(); i++) + copyTextureRegion(slices[i], i); + + // Duplicate the first face across the remaining 6 faces. + if (forceCubeMap) + { + for (size_t i = 1; i < 6; i++) + { + for (size_t j = 0; j < slices.size(); j++) + copyTextureRegion(slices[j], (slices.size() * i) + j); + } } }); @@ -5648,13 +5823,12 @@ std::unique_ptr LoadTexture(const uint8_t* data, size_t dataSize, return nullptr; } -static void DiffPatchTexture(GuestTexture& texture, uint8_t* data, uint32_t dataSize) +static void DiffPatchTexture(GuestTexture& texture, uint8_t* data, uint32_t dataSize, XXH64_hash_t hash) { auto header = reinterpret_cast(g_buttonBcDiff.get()); auto entries = reinterpret_cast(g_buttonBcDiff.get() + header->entriesOffset); auto end = entries + header->entryCount; - XXH64_hash_t hash = XXH3_64bits(data, dataSize); auto findResult = std::lower_bound(entries, end, hash, [](BlockCompressionDiffPatchEntry& lhs, XXH64_hash_t rhs) { return lhs.hash < rhs; @@ -5687,8 +5861,19 @@ static void MakePictureData(GuestPictureData* pictureData, uint8_t* data, uint32 #ifdef _DEBUG texture.texture->setName(reinterpret_cast(g_memory.Translate(pictureData->name + 2))); #endif + XXH64_hash_t hash = XXH3_64bits(data, dataSize); - DiffPatchTexture(texture, data, dataSize); + // The whale in Cool Edge has a 2D texture assigned as a cubemap which makes it not display in recomp. + // The hardware duplicates the first face to the remaining 6 faces, so to simulate that we'll recreate the asset. + bool forceCubeMap = (dataSize == 0xAB38) && (hash == 0x160E9E250FDE88A9); + if (forceCubeMap) + { + GuestTexture recreatedCubeMapTexture(ResourceType::Texture); + if (LoadTexture(recreatedCubeMapTexture, data, dataSize, {}, true)) + texture.recreatedCubeMapTexture = std::make_unique(std::move(recreatedCubeMapTexture)); + } + + DiffPatchTexture(texture, data, dataSize, hash); pictureData->texture = g_memory.MapVirtual(g_userHeap.AllocPhysical(std::move(texture))); pictureData->type = 0; diff --git a/UnleashedRecomp/gpu/video.h b/UnleashedRecomp/gpu/video.h index 9013c685..b07169b9 100644 --- a/UnleashedRecomp/gpu/video.h +++ b/UnleashedRecomp/gpu/video.h @@ -18,7 +18,7 @@ struct Video static inline uint32_t s_viewportWidth; static inline uint32_t s_viewportHeight; - static bool CreateHostDevice(const char *sdlVideoDriver); + static bool CreateHostDevice(const char *sdlVideoDriver, bool graphicsApiRetry); static void WaitOnSwapChain(); static void Present(); static void StartPipelinePrecompilation(); @@ -158,6 +158,7 @@ struct GuestTexture : GuestBaseTexture void* mappedMemory = nullptr; std::unique_ptr framebuffer; std::unique_ptr patchedTexture; + std::unique_ptr recreatedCubeMapTexture; struct GuestSurface* sourceSurface = nullptr; }; diff --git a/UnleashedRecomp/hid/driver/sdl_hid.cpp b/UnleashedRecomp/hid/driver/sdl_hid.cpp index 85e6793a..aa0e4779 100644 --- a/UnleashedRecomp/hid/driver/sdl_hid.cpp +++ b/UnleashedRecomp/hid/driver/sdl_hid.cpp @@ -38,7 +38,7 @@ public: SDL_GameControllerType GetControllerType() const { - return SDL_GameControllerTypeForIndex(index); + return SDL_GameControllerGetType(controller); } hid::EInputDevice GetInputDevice() const @@ -49,9 +49,22 @@ public: case SDL_CONTROLLER_TYPE_PS4: case SDL_CONTROLLER_TYPE_PS5: return hid::EInputDevice::PlayStation; + case SDL_CONTROLLER_TYPE_XBOX360: + case SDL_CONTROLLER_TYPE_XBOXONE: + return hid::EInputDevice::Xbox; + default: + return hid::EInputDevice::Unknown; } + } - return hid::EInputDevice::Xbox; + const char* GetControllerName() const + { + auto result = SDL_GameControllerName(controller); + + if (!result) + return "Unknown Device"; + + return result; } void Close() @@ -178,12 +191,21 @@ static void SetControllerInputDevice(Controller* controller) hid::g_inputDeviceController = hid::g_inputDevice; auto controllerType = (hid::EInputDeviceExplicit)controller->GetControllerType(); + auto controllerName = controller->GetControllerName(); + // Only proceed if the controller type changes. if (hid::g_inputDeviceExplicit != controllerType) { hid::g_inputDeviceExplicit = controllerType; - LOGFN("Detected controller: {}", hid::GetInputDeviceName()); + if (controllerType == hid::EInputDeviceExplicit::Unknown) + { + LOGFN("Detected controller: {} (Unknown Controller Type)", controllerName); + } + else + { + LOGFN("Detected controller: {}", controllerName); + } } } @@ -310,6 +332,8 @@ void hid::Init() SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_WII, "1"); SDL_SetHint(SDL_HINT_XINPUT_ENABLED, "1"); + + SDL_SetHint(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0"); // Uses Button Labels. This hint is disabled for Nintendo Controllers. SDL_InitSubSystem(SDL_INIT_EVENTS); SDL_AddEventWatch(HID_OnSDLEvent, nullptr); diff --git a/UnleashedRecomp/hid/hid.cpp b/UnleashedRecomp/hid/hid.cpp index 0a56224a..900de327 100644 --- a/UnleashedRecomp/hid/hid.cpp +++ b/UnleashedRecomp/hid/hid.cpp @@ -27,59 +27,3 @@ bool hid::IsInputDeviceController() return hid::g_inputDevice != hid::EInputDevice::Keyboard && hid::g_inputDevice != hid::EInputDevice::Mouse; } - -std::string hid::GetInputDeviceName() -{ - switch (g_inputDevice) - { - case EInputDevice::Keyboard: - return "Keyboard"; - - case EInputDevice::Mouse: - return "Mouse"; - } - - switch (g_inputDeviceExplicit) - { - case EInputDeviceExplicit::Xbox360: - return "Xbox 360"; - - case EInputDeviceExplicit::XboxOne: - return "Xbox One"; - - case EInputDeviceExplicit::DualShock3: - return "DualShock 3"; - - case EInputDeviceExplicit::DualShock4: - return "DualShock 4"; - - case EInputDeviceExplicit::SwitchPro: - return "Nintendo Switch Pro"; - - case EInputDeviceExplicit::Virtual: - return "Virtual"; - - case EInputDeviceExplicit::DualSense: - return "DualSense"; - - case EInputDeviceExplicit::Luna: - return "Amazon Luna"; - - case EInputDeviceExplicit::Stadia: - return "Google Stadia"; - - case EInputDeviceExplicit::NvShield: - return "NVIDIA Shield"; - - case EInputDeviceExplicit::SwitchJCLeft: - return "Nintendo Switch Joy-Con (Left)"; - - case EInputDeviceExplicit::SwitchJCRight: - return "Nintendo Switch Joy-Con (Right)"; - - case EInputDeviceExplicit::SwitchJCPair: - return "Nintendo Switch Joy-Con (Pair)"; - } - - return "Unknown"; -} diff --git a/UnleashedRecomp/hid/hid.h b/UnleashedRecomp/hid/hid.h index 730694a9..d61131fb 100644 --- a/UnleashedRecomp/hid/hid.h +++ b/UnleashedRecomp/hid/hid.h @@ -4,6 +4,7 @@ namespace hid { enum class EInputDevice { + Unknown, Keyboard, Mouse, Xbox, @@ -45,5 +46,4 @@ namespace hid void SetProhibitedInputs(uint16_t wButtons = 0, bool leftStick = false, bool rightStick = false); bool IsInputAllowed(); bool IsInputDeviceController(); - std::string GetInputDeviceName(); } diff --git a/UnleashedRecomp/install/installer.cpp b/UnleashedRecomp/install/installer.cpp index 9574c5d5..774a141e 100644 --- a/UnleashedRecomp/install/installer.cpp +++ b/UnleashedRecomp/install/installer.cpp @@ -67,6 +67,73 @@ static std::unique_ptr createFileSystemFromPath(const std::fi } } +static bool checkFile(const FilePair &pair, const uint64_t *fileHashes, const std::filesystem::path &targetDirectory, std::vector &fileData, Journal &journal, const std::function &progressCallback, bool checkSizeOnly) { + const std::string fileName(pair.first); + const uint32_t hashCount = pair.second; + const std::filesystem::path filePath = targetDirectory / fileName; + if (!std::filesystem::exists(filePath)) + { + journal.lastResult = Journal::Result::FileMissing; + journal.lastErrorMessage = fmt::format("File {} does not exist.", fileName); + return false; + } + + std::error_code ec; + size_t fileSize = std::filesystem::file_size(filePath, ec); + if (ec) + { + journal.lastResult = Journal::Result::FileReadFailed; + journal.lastErrorMessage = fmt::format("Failed to read file size for {}.", fileName); + return false; + } + + if (checkSizeOnly) + { + journal.progressTotal += fileSize; + } + else + { + std::ifstream fileStream(filePath, std::ios::binary); + if (fileStream.is_open()) + { + fileData.resize(fileSize); + fileStream.read((char *)(fileData.data()), fileSize); + } + + if (!fileStream.is_open() || fileStream.bad()) + { + journal.lastResult = Journal::Result::FileReadFailed; + journal.lastErrorMessage = fmt::format("Failed to read file {}.", fileName); + return false; + } + + uint64_t fileHash = XXH3_64bits(fileData.data(), fileSize); + bool fileHashFound = false; + for (uint32_t i = 0; i < hashCount && !fileHashFound; i++) + { + fileHashFound = fileHash == fileHashes[i]; + } + + if (!fileHashFound) + { + journal.lastResult = Journal::Result::FileHashFailed; + journal.lastErrorMessage = fmt::format("File {} did not match any of the known hashes.", fileName); + return false; + } + + journal.progressCounter += fileSize; + } + + if (!progressCallback()) + { + journal.lastResult = Journal::Result::Cancelled; + journal.lastErrorMessage = "Check was cancelled."; + return false; + } + + return true; +} + static bool copyFile(const FilePair &pair, const uint64_t *fileHashes, VirtualFileSystem &sourceVfs, const std::filesystem::path &targetDirectory, bool skipHashChecks, std::vector &fileData, Journal &journal, const std::function &progressCallback) { const std::string filename(pair.first); const uint32_t hashCount = pair.second; @@ -204,6 +271,45 @@ static DLC detectDLC(const std::filesystem::path &sourcePath, VirtualFileSystem } } +static bool fillDLCSource(DLC dlc, Installer::DLCSource &dlcSource) +{ + switch (dlc) + { + case DLC::Spagonia: + dlcSource.filePairs = { SpagoniaFiles, SpagoniaFilesSize }; + dlcSource.fileHashes = SpagoniaHashes; + dlcSource.targetSubDirectory = SpagoniaDirectory; + return true; + case DLC::Chunnan: + dlcSource.filePairs = { ChunnanFiles, ChunnanFilesSize }; + dlcSource.fileHashes = ChunnanHashes; + dlcSource.targetSubDirectory = ChunnanDirectory; + return true; + case DLC::Mazuri: + dlcSource.filePairs = { MazuriFiles, MazuriFilesSize }; + dlcSource.fileHashes = MazuriHashes; + dlcSource.targetSubDirectory = MazuriDirectory; + return true; + case DLC::Holoska: + dlcSource.filePairs = { HoloskaFiles, HoloskaFilesSize }; + dlcSource.fileHashes = HoloskaHashes; + dlcSource.targetSubDirectory = HoloskaDirectory; + return true; + case DLC::ApotosShamar: + dlcSource.filePairs = { ApotosShamarFiles, ApotosShamarFilesSize }; + dlcSource.fileHashes = ApotosShamarHashes; + dlcSource.targetSubDirectory = ApotosShamarDirectory; + return true; + case DLC::EmpireCityAdabat: + dlcSource.filePairs = { EmpireCityAdabatFiles, EmpireCityAdabatFilesSize }; + dlcSource.fileHashes = EmpireCityAdabatHashes; + dlcSource.targetSubDirectory = EmpireCityAdabatDirectory; + return true; + default: + return false; + } +} + bool Installer::checkGameInstall(const std::filesystem::path &baseDirectory, std::filesystem::path &modulePath) { modulePath = baseDirectory / PatchedDirectory / GameExecutableFile; @@ -254,6 +360,40 @@ bool Installer::checkAllDLC(const std::filesystem::path& baseDirectory) return result; } +bool Installer::checkInstallIntegrity(const std::filesystem::path &baseDirectory, Journal &journal, const std::function &progressCallback) +{ + // Run the file checks twice: once to fill out the progress counter and the file sizes, and another pass to do the hash integrity checks. + for (uint32_t checkPass = 0; checkPass < 2; checkPass++) + { + bool checkSizeOnly = (checkPass == 0); + if (!checkFiles({ GameFiles, GameFilesSize }, GameHashes, baseDirectory / GameDirectory, journal, progressCallback, checkSizeOnly)) + { + return false; + } + + if (!checkFiles({ UpdateFiles, UpdateFilesSize }, UpdateHashes, baseDirectory / UpdateDirectory, journal, progressCallback, checkSizeOnly)) + { + return false; + } + + for (int i = 1; i < (int)DLC::Count; i++) + { + if (checkDLCInstall(baseDirectory, (DLC)i)) + { + Installer::DLCSource dlcSource; + fillDLCSource((DLC)i, dlcSource); + + if (!checkFiles(dlcSource.filePairs, dlcSource.fileHashes, baseDirectory / dlcSource.targetSubDirectory, journal, progressCallback, checkSizeOnly)) + { + return false; + } + } + } + } + + return true; +} + bool Installer::computeTotalSize(std::span filePairs, const uint64_t *fileHashes, VirtualFileSystem &sourceVfs, Journal &journal, uint64_t &totalSize) { for (FilePair pair : filePairs) @@ -272,6 +412,27 @@ bool Installer::computeTotalSize(std::span filePairs, const uint return true; } +bool Installer::checkFiles(std::span filePairs, const uint64_t *fileHashes, const std::filesystem::path &targetDirectory, Journal &journal, const std::function &progressCallback, bool checkSizeOnly) +{ + FilePair validationPair = {}; + uint32_t validationHashIndex = 0; + uint32_t hashIndex = 0; + uint32_t hashCount = 0; + std::vector fileData; + for (FilePair pair : filePairs) + { + hashIndex = hashCount; + hashCount += pair.second; + + if (!checkFile(pair, &fileHashes[hashIndex], targetDirectory, fileData, journal, progressCallback, checkSizeOnly)) + { + return false; + } + } + + return true; +} + bool Installer::copyFiles(std::span filePairs, const uint64_t *fileHashes, VirtualFileSystem &sourceVfs, const std::filesystem::path &targetDirectory, const std::string &validationFile, bool skipHashChecks, Journal &journal, const std::function &progressCallback) { std::error_code ec; @@ -387,39 +548,8 @@ bool Installer::parseSources(const Input &input, Journal &journal, Sources &sour } DLC dlc = detectDLC(path, *dlcSource.sourceVfs, journal); - switch (dlc) + if (!fillDLCSource(dlc, dlcSource)) { - case DLC::Spagonia: - dlcSource.filePairs = { SpagoniaFiles, SpagoniaFilesSize }; - dlcSource.fileHashes = SpagoniaHashes; - dlcSource.targetSubDirectory = SpagoniaDirectory; - break; - case DLC::Chunnan: - dlcSource.filePairs = { ChunnanFiles, ChunnanFilesSize }; - dlcSource.fileHashes = ChunnanHashes; - dlcSource.targetSubDirectory = ChunnanDirectory; - break; - case DLC::Mazuri: - dlcSource.filePairs = { MazuriFiles, MazuriFilesSize }; - dlcSource.fileHashes = MazuriHashes; - dlcSource.targetSubDirectory = MazuriDirectory; - break; - case DLC::Holoska: - dlcSource.filePairs = { HoloskaFiles, HoloskaFilesSize }; - dlcSource.fileHashes = HoloskaHashes; - dlcSource.targetSubDirectory = HoloskaDirectory; - break; - case DLC::ApotosShamar: - dlcSource.filePairs = { ApotosShamarFiles, ApotosShamarFilesSize }; - dlcSource.fileHashes = ApotosShamarHashes; - dlcSource.targetSubDirectory = ApotosShamarDirectory; - break; - case DLC::EmpireCityAdabat: - dlcSource.filePairs = { EmpireCityAdabatFiles, EmpireCityAdabatFilesSize }; - dlcSource.fileHashes = EmpireCityAdabatHashes; - dlcSource.targetSubDirectory = EmpireCityAdabatDirectory; - break; - default: return false; } diff --git a/UnleashedRecomp/install/installer.h b/UnleashedRecomp/install/installer.h index 9f216a26..8bc04777 100644 --- a/UnleashedRecomp/install/installer.h +++ b/UnleashedRecomp/install/installer.h @@ -75,7 +75,9 @@ struct Installer static bool checkGameInstall(const std::filesystem::path &baseDirectory, std::filesystem::path &modulePath); static bool checkDLCInstall(const std::filesystem::path &baseDirectory, DLC dlc); static bool checkAllDLC(const std::filesystem::path &baseDirectory); + static bool checkInstallIntegrity(const std::filesystem::path &baseDirectory, Journal &journal, const std::function &progressCallback); static bool computeTotalSize(std::span filePairs, const uint64_t *fileHashes, VirtualFileSystem &sourceVfs, Journal &journal, uint64_t &totalSize); + static bool checkFiles(std::span filePairs, const uint64_t *fileHashes, const std::filesystem::path &targetDirectory, Journal &journal, const std::function &progressCallback, bool checkSizeOnly); static bool copyFiles(std::span filePairs, const uint64_t *fileHashes, VirtualFileSystem &sourceVfs, const std::filesystem::path &targetDirectory, const std::string &validationFile, bool skipHashChecks, Journal &journal, const std::function &progressCallback); static bool parseContent(const std::filesystem::path &sourcePath, std::unique_ptr &targetVfs, Journal &journal); static bool parseSources(const Input &input, Journal &journal, Sources &sources); diff --git a/UnleashedRecomp/kernel/io/file_system.cpp b/UnleashedRecomp/kernel/io/file_system.cpp index 8193364f..a765d12a 100644 --- a/UnleashedRecomp/kernel/io/file_system.cpp +++ b/UnleashedRecomp/kernel/io/file_system.cpp @@ -383,7 +383,17 @@ std::filesystem::path FileSystem::ResolvePath(const std::string_view& path, bool if (index != std::string::npos) { // rooted folder, handle direction - const std::string_view root = path.substr(0, index); + std::string_view root = path.substr(0, index); + + // HACK: The game tries to load work folder from the "game" root path for + // Application and shader archives, which does not work in Recomp because + // we don't support stacking the update and game files on top of each other. + // + // We can fix it by redirecting it to update instead as we know the original + // game files don't have a work folder. + if (path.starts_with("game:\\work\\")) + root = "update"; + const auto newRoot = XamGetRootPath(root); if (!newRoot.empty()) diff --git a/UnleashedRecomp/kernel/memory.cpp b/UnleashedRecomp/kernel/memory.cpp index c2aa18a2..a52b7e7a 100644 --- a/UnleashedRecomp/kernel/memory.cpp +++ b/UnleashedRecomp/kernel/memory.cpp @@ -9,6 +9,9 @@ Memory::Memory() if (base == nullptr) base = (uint8_t*)VirtualAlloc(nullptr, PPC_MEMORY_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (base == nullptr) + return; + DWORD oldProtect; VirtualProtect(base, 4096, PAGE_NOACCESS, &oldProtect); #else @@ -17,6 +20,9 @@ Memory::Memory() if (base == (uint8_t*)MAP_FAILED) base = (uint8_t*)mmap(NULL, PPC_MEMORY_SIZE, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); + if (base == nullptr) + return; + mprotect(base, 4096, PROT_NONE); #endif diff --git a/UnleashedRecomp/locale/config_locale.cpp b/UnleashedRecomp/locale/config_locale.cpp index 78a789cc..1242e4eb 100644 --- a/UnleashedRecomp/locale/config_locale.cpp +++ b/UnleashedRecomp/locale/config_locale.cpp @@ -142,7 +142,7 @@ CONFIG_DEFINE_LOCALE(ControlTutorial) { ELanguage::English, { "Control Tutorial", "Show controller hints during gameplay.\n\nThe Werehog Critical Attack prompt will be unaffected." } }, { ELanguage::Japanese, { "アクションナビ", "ゲーム[内:ない]に\u200Bアクションナビを\u200B[表示:ひょうじ]するか\u200B[選択:せんたく]できます\n\n「チャンスアタック」の\u200B[表示:ひょうじ]は\u200B[影響:えいきょう]されません" } }, { ELanguage::German, { "Steuerungsanleitung", "Zeige Steuerungshinweise während des Spiels.\n\nKritische Angriffe des Werehogs werden hiervon nicht beeinflusst." } }, - { ELanguage::French, { "Indication des commandes", "Affiche les indications des commandes pendant le jeu.\n\nCeci n'affecte pas les Coup critiques du Werehog." } }, + { ELanguage::French, { "Indication des commandes", "Affiche les indications des commandes pendant le jeu.\n\nCeci n'affecte pas les Coup critique du Werehog." } }, { ELanguage::Spanish, { "Tutorial de controles", "Muestra pistas de controles durante el juego.\n\nEl indicador de ataque crítico del Werehog no se verá afectado." } }, { ELanguage::Italian, { "Tutorial dei comandi", "Mostra i tutorial dei comandi durante il gioco.\n\nIl tutorial per l'attacco critico del Werehog non verrà influenzato da questa opzione." } } }; @@ -182,8 +182,8 @@ CONFIG_DEFINE_ENUM_LOCALE(ETimeOfDayTransition) { ELanguage::Japanese, { - { ETimeOfDayTransition::Xbox, { "XBOX", "Xbox: [変身:へんしん]シーンは\u200B[人工的:じんこうてき]な\u200B[読:よ]み[込:こ]み[時間:じかん]で\u200B[再生:さいせい]されます" } }, - { ETimeOfDayTransition::PlayStation, { "PLAYSTATION", "PlayStation: [回転:かいてん]するメダル\u200B[読:よ]み[込:こ]み[画面:がめん]が\u200B[使用:しよう]されます" } } + { ETimeOfDayTransition::Xbox, { "XBOX", "Xbox: [変身:へんしん]シーンが\u200B[人工的:じんこうてき]な\u200B[読:よ]み[込:こ]み[時間:じかん]で\u200B[再生:さいせい]されます" } }, + { ETimeOfDayTransition::PlayStation, { "PLAYSTATION", "PlayStation: [回転:かいてん]するメダルの\u200B[読:よ]み[込:こ]み[画面:がめん]が\u200B[使用:しよう]されます" } } } }, { @@ -196,8 +196,8 @@ CONFIG_DEFINE_ENUM_LOCALE(ETimeOfDayTransition) { ELanguage::French, { - { ETimeOfDayTransition::Xbox, { "XBOX", "Xbox: la scène de transformation sera jouée avec des temps de chargement artificiel." } }, - { ETimeOfDayTransition::PlayStation, { "PLAYSTATION", "PlayStation: un écran de chargement avec une médaille tournoyante sera utilisé à la place." } } + { ETimeOfDayTransition::Xbox, { "XBOX", "Xbox : la scène de transformation sera jouée avec des temps de chargement artificiels." } }, + { ETimeOfDayTransition::PlayStation, { "PLAYSTATION", "PlayStation : un écran de chargement avec une médaille tournoyante sera utilisé à la place." } } } }, { @@ -220,7 +220,7 @@ CONFIG_DEFINE_ENUM_LOCALE(ETimeOfDayTransition) CONFIG_DEFINE_LOCALE(ControllerIcons) { { ELanguage::English, { "Controller Icons", "Change the icons to match your controller." } }, - { ELanguage::Japanese, { "コントローライコン", "ゲーム[内:ない]の\u200Bコントローライコンを\u200B[変更:へんこう]できます" } }, + { ELanguage::Japanese, { "コントローラーアイコン", "ゲーム[内:ない]の\u200Bコントローラーアイコン\u200Bを[変更:へんこう]できます" } }, { ELanguage::German, { "Controllersymbole", "Ändere die Controllersymbole, um sie auf dein Modell anzupassen." } }, { ELanguage::French, { "Icône des boutons", "Modifie les icônes pour les faire correspondre à votre manette." } }, { ELanguage::Spanish, { "Iconos del mando", "Cambia los iconos para que coincidan con tu mando." } }, @@ -241,7 +241,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EControllerIcons) { ELanguage::Japanese, { - { EControllerIcons::Auto, { "自動検出", "[自動検出:じどうけんしゅつ]: ゲーム[内:ない]の\u200Bコントローライコンを\u200B[自動検出:じどうけんしゅつ]されます" } }, + { EControllerIcons::Auto, { "自動検出", "[\u2005自動検出\u2005:じどうけんしゅつ]: コントローラーアイコン\u200Bを[使用:しよう]している\u200B[\u2005入\u2005力\u2005:にゅうりょく]デバイスに\u200B[応:おう]じて\u200B[自動的:じどうてき]に\u200B[決定:けってい]します" } }, { EControllerIcons::Xbox, { "XBOX", "" } }, { EControllerIcons::PlayStation, { "PLAYSTATION", "" } } } @@ -257,7 +257,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EControllerIcons) { ELanguage::French, { - { EControllerIcons::Auto, { "AUTO", "Auto: le jeu déterminera automatiquement quelles icônes utiliser en fonction du périphérique d'entrée." } }, + { EControllerIcons::Auto, { "AUTO", "Auto : le jeu déterminera automatiquement quelles icônes utiliser en fonction du périphérique d'entrée." } }, { EControllerIcons::Xbox, { "XBOX", "" } }, { EControllerIcons::PlayStation, { "PLAYSTATION", "" } } } @@ -354,7 +354,7 @@ CONFIG_DEFINE_LOCALE(Vibration) { ELanguage::English, { "Vibration", "Toggle controller vibration." } }, { ELanguage::Japanese, { "[振動:しんどう]", "[振動:しんどう]の\u200B[有無:うむ]を\u200B[選択:せんたく]できます" } }, { ELanguage::German, { "Vibration", "Schalte die Controllervibration an oder aus." } }, - { ELanguage::French, { "Vibration", "Active les vibrations manette." } }, + { ELanguage::French, { "Vibration", "Active les vibrations de la manette." } }, { ELanguage::Spanish, { "Vibración", "Activa o desactiva la vibración del mando." } }, { ELanguage::Italian, { "Vibrazione", "Attiva/disattiva la vibrazione del controller." } } }; @@ -407,7 +407,7 @@ CONFIG_DEFINE_LOCALE(EffectsVolume) CONFIG_DEFINE_LOCALE(MusicAttenuation) { { ELanguage::English, { "Music Attenuation", "Fade out the game's music when external media is playing." } }, - { ELanguage::Japanese, { "BGM[減衰:げんすい]", "[外部:がいぶ]メディアを\u200B[再生:さいせい]すると\u200Bゲームの\u200B[音楽:おんがく]を\u200Bフェードアウトされます" } }, + { ELanguage::Japanese, { "BGM[減衰:げんすい]", "[外部:がいぶ]メディアを\u200B[再生:さいせい]すると\u200Bゲームの\u200B[音楽:おんがく]を\u200Bフェードアウト\u200Bします" } }, { ELanguage::German, { "Musikdämpfung", "Stelle die Musik des Spiels stumm während externe Medien abgespielt werden." } }, { ELanguage::French, { "Atténuation audio", "Abaisse le volume des musiques du jeu lorsqu'un média externe est en cours de lecture." } }, { ELanguage::Spanish, { "Atenuación de música", "Atenúa la música del juego cuando un reproductor multimedia se encuentra activo." } }, @@ -497,9 +497,9 @@ CONFIG_DEFINE_LOCALE(Subtitles) CONFIG_DEFINE_LOCALE(BattleTheme) { { ELanguage::English, { "Battle Theme", "Play the Werehog battle theme during combat.\n\nThis option will apply the next time you're in combat.\n\nExorcism missions and miniboss themes will be unaffected." } }, - { ELanguage::Japanese, { "バトルテーマ", "バトル[中:ちゅう]に\u200Bウェアホッグの\u200Bバトルテーマを\u200B[再生:さいせい]するか\u200B[選択:せんたく]できます\n\nこのオプションは\u200B[次回:じかい]のバトルに\u200B[適用:てきよう]されます\n\n[\u2005除\u2005霊\u2005:エクソシズム]ミッションと\u200Bミニボステーマは\u200B[影響:えいきょう]されません" } }, + { ELanguage::Japanese, { "バトルテーマ", "バトル[中:ちゅう]に\u200Bウェアホッグの\u200Bバトルテーマを\u200B[再生:さいせい]するか\u200B[選択:せんたく]できます\n\nこのオプションは\u200B[次回:じかい]のバトルから\u200B[適用:てきよう]されます\n\n[\u2005除\u2005霊\u2005:エクソシズム]ミッションと\u200Bミニボステーマには\u200B[\u2005影響\u2005:えいきょう]しません" } }, { ELanguage::German, { "Kampfmusik", "Spiele die Kampfmusik des Werehogs während dem Kämpfen ab.\n\nDiese Option tritt das nächste Mal, wenn du in einen Kampf gerätst, in Kraft.\n\nExorzismen und Mini-Bosse werden hiervon nicht beeinflusst." } }, - { ELanguage::French, { "Thème de combat", "Joue le thème de combat du Werehog pendant les combat.\n\nCette option s'appliquera la prochaine fois que vous serez en combat.\n\nLes missions d'exorcisme et les thèmes des miniboss ne seront pas affectés." } }, + { ELanguage::French, { "Thème de combat", "Joue le thème de combat du Werehog pendant ces derniers.\n\nCette option s'appliquera la prochaine fois que vous serez en combat.\n\nLes missions d'exorcisme et les thèmes des miniboss ne seront pas affectés." } }, { ELanguage::Spanish, { "Tema de batalla", "Reproduce el tema de batalla del Werehog durante el combate.\n\nEsta opción se aplicará la próxima vez que entres en combate.\n\nLas misiones de exorcismo y los temas de los minijefes no se verán afectados." } }, { ELanguage::Italian, { "Musica di combattimento", "Riproduci la musica di combattimento del Werehog quando inizi una battaglia.\n\nQuesta opzione verrà applicata la prossima volta che sei in battaglia.\n\nLa traccia musicale verrà riprodotta ugualmente nelle missioni di Esorcismo e i miniboss." } } }; @@ -508,7 +508,7 @@ CONFIG_DEFINE_LOCALE(BattleTheme) CONFIG_DEFINE_LOCALE(WindowSize) { { ELanguage::English, { "Window Size", "Adjust the size of the game window in windowed mode." } }, - { ELanguage::Japanese, { "ウィンドウサイズ", "ウィンドウモードで\u200Bゲームの\u200Bウィンドウサイズを\u200B[調整:ちょうせい]できます" } }, + { ELanguage::Japanese, { "ウィンドウサイズ", "ウィンドウ\u200Bモードでの\u200Bゲームの\u200Bウィンドウサイズを\u200B[調整:ちょうせい]できます" } }, { ELanguage::German, { "Fenstergröße", "Ändere die Größe des Spielfensters im Fenstermodus." } }, { ELanguage::French, { "Taille de la fenêtre", "Modifie la taille de la fenêtre de jeu en mode fenêtré." } }, { ELanguage::Spanish, { "Tamaño de ventana", "Ajusta el tamaño de la ventana de juego." } }, @@ -552,7 +552,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EAspectRatio) { ELanguage::Japanese, { - { EAspectRatio::Auto, { "自動検出", "[自動検出:じどうけんしゅつ]: ゲーム[内:ない]の\u200Bコントローライコンを\u200B[自動検出:じどうけんしゅつ]されます" } }, + { EAspectRatio::Auto, { "自動", "[自動:じどう]: アスペクト[比:ひ]は\u200Bウィンドウサイズに\u200B[合:あ]わせて\u200B[調整:ちょうせい]されます" } }, { EAspectRatio::Wide, { "16:9", "16:9: ワイドスクリーンの\u200Bアスペクト[比:ひ]に\u200B[固定:こてい]されます" } }, { EAspectRatio::Narrow, { "4:3", "4:3: ナローの\u200Bアスペクト[比:ひ]に\u200B[固定:こてい]されます" } }, { EAspectRatio::OriginalNarrow, { "オリジナル 4:3", "オリジナル 4:3: オリジナルの\u200Bアスペクト[比:ひ]に\u200B[固定:こてい]されます" } } @@ -570,10 +570,10 @@ CONFIG_DEFINE_ENUM_LOCALE(EAspectRatio) { ELanguage::French, { - { EAspectRatio::Auto, { "AUTO", "Auto: le format d'image s'adapte automatiquement à la taille de la fenêtre." } }, - { EAspectRatio::Wide, { "16:9", "16:9: force le jeu sur un format d'image large." } }, - { EAspectRatio::Narrow, { "4:3", "4:3: force le jeu sur un format d'image carré." } }, - { EAspectRatio::OriginalNarrow, { "4:3 ORIGINAL", "4:3 Original: force le jeu à un format d'image carré et conserve la parité avec l'implémentation d'origine du jeu." } } + { EAspectRatio::Auto, { "AUTO", "Auto : le format d'image s'adapte automatiquement à la taille de la fenêtre." } }, + { EAspectRatio::Wide, { "16:9", "16:9 : force le jeu sur un format d'image large." } }, + { EAspectRatio::Narrow, { "4:3", "4:3 : force le jeu sur un format d'image carré." } }, + { EAspectRatio::OriginalNarrow, { "4:3 ORIGINAL", "4:3 original : force le jeu à un format d'image carré et conserve la parité avec l'implémentation d'origine du jeu." } } } }, { @@ -613,7 +613,7 @@ CONFIG_DEFINE_LOCALE(Fullscreen) { ELanguage::English, { "Fullscreen", "Toggle between borderless fullscreen or windowed mode." } }, { ELanguage::Japanese, { "フルスクリーン", "ボーダーレス\u200Bフルスクリーンか\u200Bウィンドウモードを\u200B[選択:せんたく]できます" } }, { ELanguage::German, { "Vollbild", "Wechsle zwischen dem randlosen Vollbildmodus und dem Fenstermodus." } }, - { ELanguage::French, { "Plein écran", "Alterne entre le mode plein écran sans bordure et le mode fenêtré." } }, + { ELanguage::French, { "Plein écran", "Alterne entre le mode plein écran sans bordures et le mode fenêtré." } }, { ELanguage::Spanish, { "Pantalla completa", "Cambia entre modo de pantalla completa o ventana." } }, { ELanguage::Italian, { "Schermo pieno", "Attiva/disattiva tra modalità finestra senza cornice e modalità finestra." } } }; @@ -635,7 +635,7 @@ CONFIG_DEFINE_LOCALE(FPS) { ELanguage::English, { "FPS", "Set the max frame rate the game can run at.\n\nWARNING: this may introduce glitches at frame rates higher than 60 FPS." } }, { ELanguage::Japanese, { "フレームレート[上限:じょうげん]", "ゲームの\u200B[最大:さいだい]フレームレートを\u200B[設定:せってい]できます\n\n[警告:けいこく]: 60 FPSを\u200B[超:こ]えるフレームレートで\u200B[不具合:ふぐあい]が\u200B[発生:はっせい]する\u200B[可能性:かのうせい]が\u200Bあります" } }, { ELanguage::German, { "FPS", "Setze die maximale Anzahl der Bilder pro Sekunde, die das Spiel darstellen kann.\n\nWARNUNG: Das Spiel kann bei höheren FPS als 60 ungewolltes Verhalten aufweisen." } }, - { ELanguage::French, { "FPS", "Détermine la fréquence d'images maximale du jeu.\n\nATTENTION: cela peut entraîner des problèmes à des taux de rafraîchissement supérieurs à 60 FPS." } }, + { ELanguage::French, { "IPS", "Détermine la fréquence d'images maximale du jeu.\n\nATTENTION : cela peut entraîner des problèmes à des taux de rafraîchissement supérieurs à 60 IPS." } }, { ELanguage::Spanish, { "FPS", "Establece la tasa de fotogramas máxima a la que puede correr el juego.\n\nADVERTENCIA: esto puede introducir fallos en tasas mayores a 60 FPS." } }, { ELanguage::Italian, { "FPS", "Imposta il frame rate massimo del gioco.\n\nATTENZIONE: questa opzione può causare dei glitch a frame rate più alti di 60 FPS." } } }; @@ -644,9 +644,9 @@ CONFIG_DEFINE_LOCALE(FPS) CONFIG_DEFINE_LOCALE(Brightness) { { ELanguage::English, { "Brightness", "Adjust the brightness level until the symbol on the left is barely visible." } }, - { ELanguage::Japanese, { "[明:おか]るさの[設定:せってい]", "[画面:がめん]の\u200B[明:おか]るさを\u200B[調整:ちょうせい]できます" } }, + { ELanguage::Japanese, { "[明:あか]るさの[設定:せってい]", "[画面:がめん]の\u200B[明:あか]るさを\u200B[調整:ちょうせい]できます" } }, { ELanguage::German, { "Helligkeit", "Passe die Helligkeit des Spiels an bis das linke Symbol noch gerade so sichtbar ist." } }, - { ELanguage::French, { "Luminosité", "Règle le niveau de luminosité jusqu'à ce que le symbole à gauche soit à peine visible." } }, + { ELanguage::French, { "Luminosité", "Réglez le niveau de luminosité jusqu'à ce que le symbole à gauche soit à peine visible." } }, { ELanguage::Spanish, { "Brillo", "Ajusta el nivel de brillo hasta que el símbolo a la izquierda sea apenas visible." } }, { ELanguage::Italian, { "Luminosità", "Regola la luminosità dello schermo fino a quando il simbolo a sinistra diventa leggermente visibile." } } }; @@ -706,7 +706,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EAntiAliasing) CONFIG_DEFINE_LOCALE(TransparencyAntiAliasing) { { ELanguage::English, { "Transparency Anti-Aliasing", "Apply anti-aliasing to alpha transparent textures." } }, - { ELanguage::Japanese, { "アンチエイリアスのトランスペアレンシー", "アルファ[透明:とうめい]\u200Bテクスチャに\u200Bアンチエイリアシングを\u200B[適用:てきよう]されます" } }, + { ELanguage::Japanese, { "[透明度:とうめいど]のアンチエイリアス", "[透過:とうか]テクスチャに\u200Bアンチエイリアスを\u200B[適用:てきよう]します" } }, { ELanguage::German, { "Transparenz-Kantenglättung", "Wende Kantenglättung auf Alpha-Transparenz-Texturen an." } }, { ELanguage::French, { "Anticrénelage de transparence", "Applique l'anticrénelage sur les textures transparentes." } }, { ELanguage::Spanish, { "Anti-Aliasing de transparencias", "Aplica antialiasing a las texturas transparentes." } }, @@ -719,7 +719,7 @@ CONFIG_DEFINE_LOCALE(ShadowResolution) { ELanguage::English, { "Shadow Resolution", "Set the resolution of real-time shadows." } }, { ELanguage::Japanese, { "[影:かげ]の[解像度:かいぞうど]", "[影:かげ]の[解像度:かいぞうど]を\u200B[設定:せってい]できます" } }, { ELanguage::German, { "Schattenauflösung", "Stelle die Auflösung der Echtzeit-Schatten ein." } }, - { ELanguage::French, { "Résolution des ombres", "Défini la résolution des ombres en temps réel." } }, + { ELanguage::French, { "Résolution des ombres", "Définit la résolution des ombres en temps réel." } }, { ELanguage::Spanish, { "Resolución de sombras", "Establece la resolución de las sombras de tiempo real." } }, { ELanguage::Italian, { "Risoluzione ombre", "Imposta la risoluzioni delle ombre in tempo reale." } } }; @@ -736,7 +736,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EShadowResolution) { ELanguage::Japanese, { - { EShadowResolution::Original, { "オリジナル", "オリジナル: [影:かげ]の[解像度:かいぞうど]を\u200B[自動検出:じどうけんしゅつ]されます" } } + { EShadowResolution::Original, { "オリジナル", "オリジナル: [影:かげ]の[解像度:かいぞうど]が\u200B[自動的:じどうてき]に\u200B[決定:けってい]されます" } } } }, { @@ -748,7 +748,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EShadowResolution) { ELanguage::French, { - { EShadowResolution::Original, { "ORIGINALE", "Originale: le jeu déterminera automatiquement la résolution des ombres." } } + { EShadowResolution::Original, { "ORIGINALE", "Originale : le jeu déterminera automatiquement la résolution des ombres." } } } }, { @@ -849,7 +849,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EMotionBlur) { { EMotionBlur::Off, { "オフ", "" } }, { EMotionBlur::Original, { "オリジナル", "" } }, - { EMotionBlur::Enhanced, { "エンハンスド", "エンハンスド: パフォーマンスを\u200B[犠牲:ぎせい]にして\u200Bより[多:おお]くの\u200Bサンプルを\u200B[使用:しよう]してより\u200B[滑:なめ]らかな\u200Bモーションブラーを\u200B[実現:じつげん]されます" } } + { EMotionBlur::Enhanced, { "エンハンスド", "エンハンスド: パフォーマンスを\u200B[犠牲:ぎせい]にして\u200Bより[多:おお]くの\u200Bサンプルを\u200B[使用:しよう]してより\u200B[滑:なめ]らかな\u200Bモーションブラーを\u200B[実現:じつげん]します" } } } }, { @@ -865,7 +865,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EMotionBlur) { { EMotionBlur::Off, { "AUCUN", "" } }, { EMotionBlur::Original, { "ORIGINAL", "" } }, - { EMotionBlur::Enhanced, { "AMÉLIORÉ", "Amélioré: utilise plus d'échantillons pour un flou de mouvement plus lisse au détriment des performances." } } + { EMotionBlur::Enhanced, { "AMÉLIORÉ", "Amélioré : utilise plus d'échantillons pour un flou de mouvement plus lisse au détriment des performances." } } } }, { @@ -890,7 +890,7 @@ CONFIG_DEFINE_ENUM_LOCALE(EMotionBlur) CONFIG_DEFINE_LOCALE(XboxColorCorrection) { { ELanguage::English, { "Xbox Color Correction", "Use the warm tint from the Xbox version of the game." } }, - { ELanguage::Japanese, { "Xboxの[色補正:いろほせい]", "Xbox[版:ばん]のゲームの\u200B[暖色系:だんしょくけい]の[色合:いろあ]いを\u200B[使用:しよう]されます" } }, + { ELanguage::Japanese, { "Xboxの[色補正:いろほせい]", "Xbox[版:ばん]のゲームの\u200B[暖色系:だんしょくけい]の[色合:いろあ]いを\u200B[使用:しよう]します" } }, { ELanguage::German, { "Xbox Farbkorrektur", "Benutzt den warmen Farbstich aus der Xbox-Version des Spiels." } }, { ELanguage::French, { "Correction couleurs Xbox", "Utilise le filtre de couleur provenant de la version Xbox du jeu." } }, { ELanguage::Spanish, { "Corrección de color de Xbox", "Utiliza el tono cálido de la versión Xbox del juego." } }, @@ -921,8 +921,8 @@ CONFIG_DEFINE_ENUM_LOCALE(ECutsceneAspectRatio) { ELanguage::Japanese, { - { ECutsceneAspectRatio::Original, { "オリジナル", "オリジナル: カットシーンを\u200B[元:もと]の\u200B16:9の\u200Bアスペクト[比:ひ]に\u200B[固定:こてい]されます" } }, - { ECutsceneAspectRatio::Unlocked, { "解除", "[解除:かいじょ]: カットシーンの\u200Bアスペクト[比:ひ]を\u200Bウィンドウサイズに\u200B[合:あ]わせて\u200B[調整:ちょうせい]されます\n\n[警告:けいこく]: [元:もと]の\u200B16:9の\u200Bアスペクト[比:ひ]を\u200B[超:こ]えると\u200B[視覚的:しかくてき]な\u200B[異常:いじょう]が\u200B[発生:はっせい]します" } }, + { ECutsceneAspectRatio::Original, { "オリジナル", "オリジナル: カットシーンを\u200B[元:もと]の\u200B16:9の\u200Bアスペクト[比:ひ]に\u200B[固定:こてい]します" } }, + { ECutsceneAspectRatio::Unlocked, { "解除", "[解除:かいじょ]: カットシーンの\u200Bアスペクト[比:ひ]を\u200Bウィンドウサイズに\u200B[合:あ]わせて\u200B[調整:ちょうせい]します\n\n[警告:けいこく]: [元:もと]の\u200B16:9の\u200Bアスペクト[比:ひ]を\u200B[超:こ]えると\u200B[視覚的:しかくてき]な\u200B[異常:いじょう]が\u200B[発生:はっせい]します" } }, } }, { @@ -935,8 +935,8 @@ CONFIG_DEFINE_ENUM_LOCALE(ECutsceneAspectRatio) { ELanguage::French, { - { ECutsceneAspectRatio::Original, { "ORIGINAL", "Original: force les cinématiques dans leur format 16:9 d'origine." } }, - { ECutsceneAspectRatio::Unlocked, { "LIBRE", "Libre: permet aux cinématiques d'adapter leur format d'image à la taille de la fenêtre.\n\nAttention: au dela du format 16:9 d'origine, des bugs visuels apparaitront." } }, + { ECutsceneAspectRatio::Original, { "ORIGINAL", "Original : force les cinématiques dans leur format 16:9 d'origine." } }, + { ECutsceneAspectRatio::Unlocked, { "LIBRE", "Libre : permet aux cinématiques d'adapter leur format d'image à la taille de la fenêtre.\n\nATTENTION : au delà du format 16:9 d'origine, des bugs visuels apparaitront." } }, } }, { @@ -979,8 +979,8 @@ CONFIG_DEFINE_ENUM_LOCALE(EUIAlignmentMode) { ELanguage::Japanese, { - { EUIAlignmentMode::Edge, { "エッジ", "エッジ: UIはディスプレイの\u200B[端:はし]に\u200B[揃:そろ]います" } }, - { EUIAlignmentMode::Centre, { "センター", "センター: UIはディスプレイの\u200B[中央:ちゅうおう]に\u200B[揃:そろ]います" } }, + { EUIAlignmentMode::Edge, { "エッジ", "エッジ: UIがディスプレイの\u200B[端:はし]に\u200B[揃:そろ]います" } }, + { EUIAlignmentMode::Centre, { "センター", "センター: UIがディスプレイの\u200B[中央:ちゅうおう]に\u200B[揃:そろ]います" } }, } }, { @@ -993,8 +993,8 @@ CONFIG_DEFINE_ENUM_LOCALE(EUIAlignmentMode) { ELanguage::French, { - { EUIAlignmentMode::Edge, { "BORD", "Bord: l'interface utilisateur sera alignée sur les bords de l'écran." } }, - { EUIAlignmentMode::Centre, { "CENTRÉE", "Centrée: l'interface utilisateur sera alignée sur le centre de l'écran." } }, + { EUIAlignmentMode::Edge, { "BORD", "Bord : l'interface utilisateur sera alignée sur les bords de l'écran." } }, + { EUIAlignmentMode::Centre, { "CENTRÉE", "Centrée : l'interface utilisateur sera alignée sur le centre de l'écran." } }, } }, { diff --git a/UnleashedRecomp/locale/locale.cpp b/UnleashedRecomp/locale/locale.cpp index 138dc417..7544f31c 100644 --- a/UnleashedRecomp/locale/locale.cpp +++ b/UnleashedRecomp/locale/locale.cpp @@ -145,7 +145,7 @@ std::unordered_map> "Options_Desc_NotAvailable", { { ELanguage::English, "This option is not available at this location." }, - { ELanguage::Japanese, "この\u200Bオプションは\u200B[現在:げんざい]の\u200B[画面:がめん]で\u200B[変更:へんこう]\u200Bできません" }, + { ELanguage::Japanese, "この\u200Bオプションは\u200B[現在:げんざい]の\u200B[画面:がめん]では\u200B[変更:へんこう]\u200Bできません" }, { ELanguage::German, "Diese Option ist an dieser Stelle nicht verfügbar." }, { ELanguage::French, "Cette option n'est pas disponible pour l'instant." }, { ELanguage::Spanish, "Esta opción no está disponible en este momento." }, @@ -158,7 +158,7 @@ std::unordered_map> "Options_Desc_NotAvailableFullscreen", { { ELanguage::English, "This option is not available in fullscreen mode." }, - { ELanguage::Japanese, "この\u200Bオプションは\u200Bフルスクリーンモードで\u200B[変更:へんこう]\u200Bできません" }, + { ELanguage::Japanese, "この\u200Bオプションは\u200Bフルスクリーンモードでは\u200B[変更:へんこう]\u200Bできません" }, { ELanguage::German, "Diese Option ist im Vollbildmodus nicht verfügbar." }, { ELanguage::French, "Cette option n'est pas disponible en mode plein écran." }, { ELanguage::Spanish, "Esta opción no está disponible en modo pantalla completa." }, @@ -171,7 +171,7 @@ std::unordered_map> "Options_Desc_NotAvailableWindowed", { { ELanguage::English, "This option is not available in windowed mode." }, - { ELanguage::Japanese, "この\u200Bオプションは\u200Bウィンドウモードで\u200B[変更:へんこう]\u200Bできません" }, + { ELanguage::Japanese, "この\u200Bオプションは\u200Bウィンドウモードでは\u200B[変更:へんこう]\u200Bできません" }, { ELanguage::German, "Diese Option ist im Fenstermodus nicht verfügbar." }, { ELanguage::French, "Cette option n'est pas disponible en mode fenêtré." }, { ELanguage::Spanish, "Esta opción no está disponible en modo ventana." }, @@ -304,7 +304,7 @@ std::unordered_map> "Installer_Page_Introduction", { { ELanguage::English, "Welcome to\nUnleashed Recompiled!\n\nYou'll need an Xbox 360 copy\nof Sonic Unleashed in order to proceed with the installation." }, - { ELanguage::Japanese, "Unleashed Recompiledへようこそ!\nインストールにはXbox 360[版:ばん]の\n「ソニック ワールドアドベンチャー」\nが必要です" }, + { ELanguage::Japanese, "Unleashed Recompiledへようこそ!\nインストールには\n[北米版:ほくべいばん]またはEU[版:ばん]のXbox 360[用:よう]\n「SONIC UNLEASHED」が[必要:ひつよう]です" }, { ELanguage::German, "Willkommen zu\nUnleashed Recompiled!\nEs wird eine Xbox 360 Kopie von Sonic Unleashed benötigt um mit der Installation fortfahren zu können." }, { ELanguage::French, "Bienvenue sur\nUnleashed Recompiled !\n\nVous aurez besoin d'une copie de Sonic Unleashed pour Xbox\n360 pour procéder à l'installation." }, { ELanguage::Spanish, "¡Bienvenido a\nUnleashed Recompiled!\n\nNecesitas una copia de\nSonic Unleashed de Xbox 360\npara continuar con la instalación." }, @@ -366,7 +366,7 @@ std::unordered_map> { ELanguage::English, "Installation complete!\nThis project is brought to you by:" }, { ELanguage::Japanese, "インストール[完了:かんりょう]!\nプロジェクト[制作:せいさく]:" }, { ELanguage::German, "Installation abgeschlossen!\nDieses Projekt wird präsentiert von:" }, - { ELanguage::French, "Installation terminée !\nCe projet vous est présenté par:" }, + { ELanguage::French, "Installation terminée !\nCe projet vous est présenté\npar :" }, { ELanguage::Spanish, "¡Instalación completada!\nEste proyecto ha sido posible gracias a:" }, { ELanguage::Italian, "Installazione completata!\nQuesto progetto è stato creato da:" } } @@ -703,6 +703,39 @@ std::unordered_map> { ELanguage::Italian, "Impossibile trovare il modulo \"%s\".\n\nAssicurati che:\n\n- Hai estratto questa copia di Unleashed Recompiled correttamente e non solo il file *.exe.\n- Non stai eseguendo Unleashed Recompiled da un file *.zip." } } }, + { + "System_MemoryAllocationFailed", + { + { ELanguage::English, "Failed to allocate game memory.\n\nPlease make sure that:\n\n- You meet the minimum system requirements (8 GB).\n- Your page file is configured with at least 4-8 GB of virtual memory." }, + { ELanguage::Japanese, "ゲームメモリの割り当てに失敗しました\n\n次の点を確認してください:\n\n※最小システム要件(8 GB)を満たしていること。\n※ページファイルに少なくとも4~8 GBの仮想メモリが設定されていること" }, + { ELanguage::German, "Fehler beim Zuweisen des Spielspeichers.\n\nBitte stelle sicher, dass:\n\n- Die Mindestanforderungen für das System erfüllt sind (8 GB).\n- Die Auslagerungsdatei mit mindestens 4-8 GB virtuellem Speicher konfiguriert ist." }, + { ELanguage::French, "Échec d'allocation de la mémoire du jeu.\n\nVeuillez vous assurer que :\n\n- Vous disposez de la configuration minimale requise (8 Go).\n- Votre fichier d’échange est configuré avec au moins 4 à 8 Go de mémoire virtuelle." }, + { ELanguage::Spanish, "Fallo al asignar memoria del juego.\n\nPor favor, asegúrate de que:\n\n- Cumples los requisitos mínimos del sistema (8 GB).\n- Tu archivo de páginación está configurado con al menos 4 u 8 GB de memoria virtual." }, + { ELanguage::Italian, "Impossibile allocare la memoria per il gioco.\n\nAssicurati che:\n\n- Soddisfi i requisiti minimi di sistema (8 GB).\n- Il tuo file di paging sia configurato con almeno 4 o 8 GB di memoria virtuale." } + } + }, + { + "IntegrityCheck_Success", + { + { ELanguage::English, "Installation check has finished.\n\nAll files seem to be correct.\n\nThe game will now close. Remove the launch argument to play the game." }, + { ELanguage::Japanese, "インストールチェックが終了しました\n\nすべてのファイルは正しいようです\n\nゲームは終了します、ゲームをプレイするには起動引数を削除してください" }, + { ELanguage::German, "Die Installation wurde überprüft.\n\nAlle Dateien scheinen korrekt zu sein.\n\nDas Spiel wird nun geschlossen. Entferne die Startoption, um das Spiel zu spielen." }, + { ELanguage::French, "La vérification de l'installation est terminée.\n\nTous les fichiers semblent corrects.\n\nL'application va maintenant se fermer. Retirez l'argument de lancement pour pouvoir lancer le jeu." }, + { ELanguage::Spanish, "La verificación de la instalación ha terminado.\n\nTodos los archivos parecen correctos.\n\nEl juego se cerrará ahora. Elimina el argumento de lanzamiento para jugar al juego." }, + { ELanguage::Italian, "La verifica dei file d'installazione è terminata.\n\nTutti i file sembrano corretti.\n\nIl gioco si chiuderà. Rimuovi l'argomento di avvio per poter giocare." } + } + }, + { + "IntegrityCheck_Failed", + { + { ELanguage::English, "Installation check has failed.\n\nError: %s\n\nThe game will now close. Try reinstalling the game by using the --install launch argument." }, + { ELanguage::Japanese, "インストールチェックに失敗しました\n\nエラー:%s\n\nゲームは終了します、--install 起動引数を使用してゲームを再インストールしてください" }, + { ELanguage::German, "Die Installationsprüfung ist fehlgeschlagen.\n\nFehler: %s\n\nDas Spiel wird nun geschlossen. Versuche das Spiel durch Verwendung der Startoption --install neu zu installieren." }, + { ELanguage::French, "La vérification de l'installation a échoué.\n\nErreur : %s\n\nL'application va maintenant se fermer. Essayez de réinstaller le jeu en utilisant l'argument de lancement --install." }, + { ELanguage::Spanish, "La verificación de la instalación ha fallado.\n\nError: %s\n\nEl juego se cerrará ahora. Intenta reinstalar el juego utilizando el argumento de lanzamiento --install." }, + { ELanguage::Italian, "La verifica dei file d'installazione non è andata a buon fine.\n\nErrore: %s\n\nIl gioco si chiuderà. Prova a reinstallare il gioco utilizzando l'argomento di avvio --install." } + } + }, { "Common_On", { diff --git a/UnleashedRecomp/main.cpp b/UnleashedRecomp/main.cpp index a55c0181..e8123b38 100644 --- a/UnleashedRecomp/main.cpp +++ b/UnleashedRecomp/main.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -23,6 +24,7 @@ #include #include #include +#include #ifdef _WIN32 #include @@ -51,14 +53,20 @@ void HostStartup() CoInitializeEx(nullptr, COINIT_MULTITHREADED); #endif - g_userHeap.Init(); - hid::Init(); } // Name inspired from nt's entry point void KiSystemStartup() { + if (g_memory.base == nullptr) + { + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, GameWindow::GetTitle(), Localise("System_MemoryAllocationFailed").c_str(), GameWindow::s_pWindow); + std::_Exit(1); + } + + g_userHeap.Init(); + const auto gameContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Game"); const auto updateContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Update"); XamRegisterContent(gameContent, GAME_INSTALL_DIRECTORY "/game"); @@ -193,14 +201,23 @@ int main(int argc, char *argv[]) os::logger::Init(); + PreloadContext preloadContext; + preloadContext.PreloadExecutable(); + bool forceInstaller = false; bool forceDLCInstaller = false; + bool useDefaultWorkingDirectory = false; + bool forceInstallationCheck = false; + bool graphicsApiRetry = false; const char *sdlVideoDriver = nullptr; for (uint32_t i = 1; i < argc; i++) { forceInstaller = forceInstaller || (strcmp(argv[i], "--install") == 0); forceDLCInstaller = forceDLCInstaller || (strcmp(argv[i], "--install-dlc") == 0); + useDefaultWorkingDirectory = useDefaultWorkingDirectory || (strcmp(argv[i], "--use-cwd") == 0); + forceInstallationCheck = forceInstallationCheck || (strcmp(argv[i], "--install-check") == 0); + graphicsApiRetry = graphicsApiRetry || (strcmp(argv[i], "--graphics-api-retry") == 0); if (strcmp(argv[i], "--sdl-video-driver") == 0) { @@ -211,8 +228,68 @@ int main(int argc, char *argv[]) } } + if (!useDefaultWorkingDirectory) + { + // Set the current working directory to the executable's path. + std::error_code ec; + std::filesystem::current_path(os::process::GetExecutablePath().parent_path(), ec); + } + Config::Load(); + if (forceInstallationCheck) + { + // Create the console to show progress to the user, otherwise it will seem as if the game didn't boot at all. + os::process::ShowConsole(); + + Journal journal; + double lastProgressMiB = 0.0; + double lastTotalMib = 0.0; + Installer::checkInstallIntegrity(GAME_INSTALL_DIRECTORY, journal, [&]() + { + constexpr double MiBDivisor = 1024.0 * 1024.0; + constexpr double MiBProgressThreshold = 128.0; + double progressMiB = double(journal.progressCounter) / MiBDivisor; + double totalMiB = double(journal.progressTotal) / MiBDivisor; + if (journal.progressCounter > 0) + { + if ((progressMiB - lastProgressMiB) > MiBProgressThreshold) + { + fprintf(stdout, "Checking files: %0.2f MiB / %0.2f MiB\n", progressMiB, totalMiB); + lastProgressMiB = progressMiB; + } + } + else + { + if ((totalMiB - lastTotalMib) > MiBProgressThreshold) + { + fprintf(stdout, "Scanning files: %0.2f MiB\n", totalMiB); + lastTotalMib = totalMiB; + } + } + + return true; + }); + + char resultText[512]; + uint32_t messageBoxStyle; + if (journal.lastResult == Journal::Result::Success) + { + snprintf(resultText, sizeof(resultText), "%s", Localise("IntegrityCheck_Success").c_str()); + fprintf(stdout, "%s\n", resultText); + messageBoxStyle = SDL_MESSAGEBOX_INFORMATION; + } + else + { + snprintf(resultText, sizeof(resultText), Localise("IntegrityCheck_Failed").c_str(), journal.lastErrorMessage.c_str()); + fprintf(stderr, "%s\n", resultText); + messageBoxStyle = SDL_MESSAGEBOX_ERROR; + } + + SDL_ShowSimpleMessageBox(messageBoxStyle, GameWindow::GetTitle(), resultText, GameWindow::s_pWindow); + std::_Exit(int(journal.lastResult)); + } + #if defined(_WIN32) && defined(UNLEASHED_RECOMP_D3D12) for (auto& dll : g_D3D12RequiredModules) { @@ -248,7 +325,7 @@ int main(int argc, char *argv[]) bool runInstallerWizard = forceInstaller || forceDLCInstaller || !isGameInstalled; if (runInstallerWizard) { - if (!Video::CreateHostDevice(sdlVideoDriver)) + if (!Video::CreateHostDevice(sdlVideoDriver, graphicsApiRetry)) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, GameWindow::GetTitle(), Localise("Video_BackendError").c_str(), GameWindow::s_pWindow); std::_Exit(1); @@ -262,13 +339,16 @@ int main(int argc, char *argv[]) ModLoader::Init(); + if (!PersistentStorageManager::LoadBinary()) + LOGFN_ERROR("Failed to load persistent storage binary... (status code {})", (int)PersistentStorageManager::BinStatus); + KiSystemStartup(); uint32_t entry = LdrLoadModule(modulePath); if (!runInstallerWizard) { - if (!Video::CreateHostDevice(sdlVideoDriver)) + if (!Video::CreateHostDevice(sdlVideoDriver, graphicsApiRetry)) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, GameWindow::GetTitle(), Localise("Video_BackendError").c_str(), GameWindow::s_pWindow); std::_Exit(1); diff --git a/UnleashedRecomp/mod/mod_loader.cpp b/UnleashedRecomp/mod/mod_loader.cpp index dd33c56d..6fc3aec5 100644 --- a/UnleashedRecomp/mod/mod_loader.cpp +++ b/UnleashedRecomp/mod/mod_loader.cpp @@ -191,7 +191,10 @@ void ModLoader::Init() { std::string includeDirU8 = modIni.getString("Main", fmt::format("IncludeDir{}", j), ""); if (!includeDirU8.empty()) + { + std::replace(includeDirU8.begin(), includeDirU8.end(), '\\', '/'); mod.includeDirs.emplace_back(modDirectoryPath / std::u8string_view((const char8_t*)includeDirU8.c_str())); + } } if (!foundModSaveFilePath) diff --git a/UnleashedRecomp/patches/CTitleStateIntro_patches.cpp b/UnleashedRecomp/patches/CTitleStateIntro_patches.cpp index d4a05fc5..4affb80a 100644 --- a/UnleashedRecomp/patches/CTitleStateIntro_patches.cpp +++ b/UnleashedRecomp/patches/CTitleStateIntro_patches.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -64,16 +65,16 @@ static bool ProcessCorruptAchievementsMessage() if (!g_corruptAchievementsMessageOpen) return false; - auto message = AchievementManager::Status == EAchStatus::IOError + auto message = AchievementManager::BinStatus == EAchBinStatus::IOError ? Localise("Title_Message_AchievementDataIOError") : Localise("Title_Message_AchievementDataCorrupt"); if (MessageWindow::Open(message, &g_corruptAchievementsMessageResult) == MSG_CLOSED) { - // Allow user to proceed if the achievement data couldn't be loaded. - // Restarting may fix this error, so it isn't worth clearing the data for. - if (AchievementManager::Status != EAchStatus::IOError) - AchievementManager::Save(true); + // Create a new save file if the file was successfully loaded and failed validation. + // If the file couldn't be opened, restarting may fix this error, so it isn't worth clearing the data for. + if (AchievementManager::BinStatus != EAchBinStatus::IOError) + AchievementManager::SaveBinary(true); g_corruptAchievementsMessageOpen = false; g_corruptAchievementsMessageOpen.notify_one(); @@ -135,9 +136,10 @@ void PressStartSaveLoadThreadMidAsmHook() g_faderBegun.wait(true); } - AchievementManager::Load(); + if (!AchievementManager::LoadBinary()) + LOGFN_ERROR("Failed to load achievement data... (status code {})", (int)AchievementManager::BinStatus); - if (AchievementManager::Status != EAchStatus::Success) + if (AchievementManager::BinStatus != EAchBinStatus::Success) { g_corruptAchievementsMessageOpen = true; g_corruptAchievementsMessageOpen.wait(true); diff --git a/UnleashedRecomp/patches/aspect_ratio_patches.cpp b/UnleashedRecomp/patches/aspect_ratio_patches.cpp index e42c5828..02f49ee0 100644 --- a/UnleashedRecomp/patches/aspect_ratio_patches.cpp +++ b/UnleashedRecomp/patches/aspect_ratio_patches.cpp @@ -711,8 +711,6 @@ static const xxHashMap g_modifiers = // ui_shop { HashStr("ui_shop/footer/shop_footer"), { ALIGN_BOTTOM } }, - { HashStr("ui_shop/header/ring"), { ALIGN_TOP } }, - { HashStr("ui_shop/header/shop_nametag"), { ALIGN_TOP } }, // ui_start { HashStr("ui_start/Clear/position/bg/bg_1"), { STRETCH } }, @@ -1652,3 +1650,39 @@ PPC_FUNC(sub_82E54950) __imp__sub_82E54950(ctx, base); } } + +// Credits while Sonic is running are offseted by 133 pixels at 16:9. +// We can make this dynamic by remembering the anchoring and shifting accordingly. +void EndingTextAllocMidAsmHook(PPCRegister& r3) +{ + r3.u32 += sizeof(uint32_t); +} + +static constexpr uint32_t ENDING_TEXT_SIZE = 0x164; + +void EndingTextCtorRightMidAsmHook(PPCRegister& r3) +{ + *reinterpret_cast(g_memory.base + r3.u32 + ENDING_TEXT_SIZE) = ALIGN_RIGHT; +} + +void EndingTextCtorLeftMidAsmHook(PPCRegister& r3) +{ + *reinterpret_cast(g_memory.base + r3.u32 + ENDING_TEXT_SIZE) = ALIGN_LEFT; +} + +void EndingTextCtorCenterMidAsmHook(PPCRegister& r3) +{ + *reinterpret_cast(g_memory.base + r3.u32 + ENDING_TEXT_SIZE) = ALIGN_CENTER; +} + +void EndingTextPositionMidAsmHook(PPCRegister& r31, PPCRegister& f13) +{ + uint32_t align = *reinterpret_cast(g_memory.base + r31.u32 + ENDING_TEXT_SIZE); + + // Since widescreen is always forced, 133 offset will always be part of the position. + if (align == ALIGN_RIGHT) + f13.f64 += -133.0 * (1.0 - g_aspectRatioNarrowScale); + + else if (align == ALIGN_LEFT) + f13.f64 += 133.0 * (1.0 - g_aspectRatioNarrowScale); +} diff --git a/UnleashedRecomp/patches/misc_patches.cpp b/UnleashedRecomp/patches/misc_patches.cpp index 9f318fb4..ec4e1a8b 100644 --- a/UnleashedRecomp/patches/misc_patches.cpp +++ b/UnleashedRecomp/patches/misc_patches.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include void AchievementManagerUnlockMidAsmHook(PPCRegister& id) @@ -53,6 +54,16 @@ void WerehogBattleMusicMidAsmHook(PPCRegister& r11) r11.u8 = 3; } +bool UseAlternateTitleMidAsmHook() +{ + auto isSWA = Config::Language == ELanguage::Japanese; + + if (Config::UseAlternateTitle) + isSWA = !isSWA; + + return isSWA; +} + /* Hook function that gets the game region and force result to zero for Japanese to display the correct logos. */ @@ -147,12 +158,38 @@ PPC_FUNC(sub_824C1E60) __imp__sub_824C1E60(ctx, base); } -// Remove boost filter -void DisableBoostFilterMidAsmHook(PPCRegister& r11) +// This function is called in various places but primarily for the boost filter +// when the second argument (r4) is set to "boost". Whilst boosting the third argument (f1) +// will go up to 1.0f and then down to 0.0f as the player lets off of the boost button. +// To avoid the boost filter from kicking in at all if the function is called with "boost" +// we set the third argument to zero no matter what (if the code is on). +PPC_FUNC_IMPL(__imp__sub_82B4DB48); +PPC_FUNC(sub_82B4DB48) { - if (Config::DisableBoostFilter) + if (Config::DisableBoostFilter && strcmp((const char*)(base + ctx.r4.u32), "boost") == 0) { - if (r11.u32 == 1) - r11.u32 = 0; + ctx.f1.f64 = 0.0; } + + __imp__sub_82B4DB48(ctx, base); +} + +// DLC save data flag check. +// +// The DLC checks are fundamentally broken in this game, resulting in this method always +// returning true and displaying the DLC info message when it shouldn't be. +// +// The original intent here seems to have been to display the message every time new DLC +// content is installed, but the flags in the save data never get written to properly, +// causing this function to always pass in some way. +// +// We bypass the save data completely and write to external persistent storage to store +// whether we've seen the DLC info message instead. This way we can retain the original +// broken game behaviour, whilst also providing a fix for this issue that is safe. +PPC_FUNC_IMPL(__imp__sub_824EE620); +PPC_FUNC(sub_824EE620) +{ + __imp__sub_824EE620(ctx, base); + + ctx.r3.u32 = PersistentStorageManager::ShouldDisplayDLCMessage(true); } diff --git a/UnleashedRecomp/patches/resident_patches.cpp b/UnleashedRecomp/patches/resident_patches.cpp index 64a220d7..2741d0e9 100644 --- a/UnleashedRecomp/patches/resident_patches.cpp +++ b/UnleashedRecomp/patches/resident_patches.cpp @@ -2,11 +2,10 @@ #include #include #include +#include #include #include -bool m_isSavedAchievementData = false; - // SWA::Message::MsgRequestStartLoading::Impl PPC_FUNC_IMPL(__imp__sub_824DCF38); PPC_FUNC(sub_824DCF38) @@ -99,20 +98,23 @@ PPC_FUNC(sub_824E5170) App::s_isSaving = pSaveIcon->m_IsVisible; + static bool isSavedExtraData = false; + if (pSaveIcon->m_IsVisible) { App::s_isSaveDataCorrupt = false; - if (!m_isSavedAchievementData) + if (!isSavedExtraData) { - AchievementManager::Save(); + AchievementManager::SaveBinary(); + PersistentStorageManager::SaveBinary(); - m_isSavedAchievementData = true; + isSavedExtraData = true; } } else { - m_isSavedAchievementData = false; + isSavedExtraData = false; } } diff --git a/UnleashedRecomp/preload_executable.cpp b/UnleashedRecomp/preload_executable.cpp new file mode 100644 index 00000000..6458abb9 --- /dev/null +++ b/UnleashedRecomp/preload_executable.cpp @@ -0,0 +1,104 @@ +#include "preload_executable.h" +#include + +// Code from Zelda 64: Recompiled +// https://github.com/Zelda64Recomp/Zelda64Recomp/blob/91db87632c2bfb6995ef1554ec71b11977c621f8/src/main/main.cpp#L440-L514 + +PreloadContext::~PreloadContext() +{ +#ifdef _WIN32 + if (preloaded) + { + VirtualUnlock(view, size); + CloseHandle(mappingHandle); + CloseHandle(handle); + } +#endif +} + +void PreloadContext::PreloadExecutable() +{ +#ifdef _WIN32 + wchar_t moduleName[MAX_PATH]; + GetModuleFileNameW(NULL, moduleName, MAX_PATH); + + handle = CreateFileW(moduleName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + if (handle == INVALID_HANDLE_VALUE) + { + LOG_ERROR("Failed to load executable into memory!"); + *this = {}; + return; + } + + LARGE_INTEGER moduleSize; + if (!GetFileSizeEx(handle, &moduleSize)) + { + LOG_ERROR("Failed to get size of executable!"); + CloseHandle(handle); + *this = {}; + return; + } + + size = moduleSize.QuadPart; + + mappingHandle = CreateFileMappingW(handle, nullptr, PAGE_READONLY, 0, 0, nullptr); + if (mappingHandle == nullptr) + { + LOG_ERROR("Failed to create file mapping of executable!"); + CloseHandle(handle); + *this = {}; + return; + } + + view = MapViewOfFile(mappingHandle, FILE_MAP_READ, 0, 0, 0); + if (view == nullptr) + { + LOG_ERROR("Failed to map view of of executable!"); + CloseHandle(mappingHandle); + CloseHandle(handle); + *this = {}; + return; + } + + DWORD pid = GetCurrentProcessId(); + HANDLE processHandle = OpenProcess(PROCESS_SET_QUOTA | PROCESS_QUERY_INFORMATION, FALSE, pid); + if (processHandle == nullptr) + { + LOG_ERROR("Failed to open own process!"); + CloseHandle(mappingHandle); + CloseHandle(handle); + *this = {}; + return; + } + + SIZE_T minimumSetSize, maximumSetSize; + if (!GetProcessWorkingSetSize(processHandle, &minimumSetSize, &maximumSetSize)) + { + LOG_ERROR("Failed to get working set size!"); + CloseHandle(mappingHandle); + CloseHandle(handle); + *this = {}; + return; + } + + if (!SetProcessWorkingSetSize(processHandle, minimumSetSize + size, maximumSetSize + size)) + { + LOG_ERROR("Failed to set working set size!"); + CloseHandle(mappingHandle); + CloseHandle(handle); + *this = {}; + return; + } + + if (VirtualLock(view, size) == 0) + { + LOGF_ERROR("Failed to lock view of executable! (Error: 0x{:X})\n", GetLastError()); + CloseHandle(mappingHandle); + CloseHandle(handle); + *this = {}; + return; + } + + preloaded = true; +#endif +} diff --git a/UnleashedRecomp/preload_executable.h b/UnleashedRecomp/preload_executable.h new file mode 100644 index 00000000..5afb2b4e --- /dev/null +++ b/UnleashedRecomp/preload_executable.h @@ -0,0 +1,15 @@ +#pragma once + +struct PreloadContext +{ +#ifdef _WIN32 + HANDLE handle{}; + HANDLE mappingHandle{}; + SIZE_T size{}; + PVOID view{}; + bool preloaded{}; +#endif + + ~PreloadContext(); + void PreloadExecutable(); +}; diff --git a/UnleashedRecomp/res/version.txt b/UnleashedRecomp/res/version.txt index a486ce09..d9130f4a 100644 --- a/UnleashedRecomp/res/version.txt +++ b/UnleashedRecomp/res/version.txt @@ -1,4 +1,4 @@ VERSION_MILESTONE="" VERSION_MAJOR=1 VERSION_MINOR=0 -VERSION_REVISION=2 +VERSION_REVISION=3 diff --git a/UnleashedRecomp/ui/game_window.cpp b/UnleashedRecomp/ui/game_window.cpp index 2bd5ad10..1bcdf336 100644 --- a/UnleashedRecomp/ui/game_window.cpp +++ b/UnleashedRecomp/ui/game_window.cpp @@ -282,7 +282,12 @@ const char* GameWindow::GetTitle() { if (Config::UseOfficialTitleOnTitleBar) { - return Config::Language == ELanguage::Japanese + auto isSWA = Config::Language == ELanguage::Japanese; + + if (Config::UseAlternateTitle) + isSWA = !isSWA; + + return isSWA ? "SONIC WORLD ADVENTURE" : "SONIC UNLEASHED"; } diff --git a/UnleashedRecomp/ui/imgui_utils.cpp b/UnleashedRecomp/ui/imgui_utils.cpp index be085b4c..31592bf9 100644 --- a/UnleashedRecomp/ui/imgui_utils.cpp +++ b/UnleashedRecomp/ui/imgui_utils.cpp @@ -510,6 +510,11 @@ std::vector Split(const char* strStart, const ImFont* font, float f if (*str == '\n') str++; + if (strncmp(str, "\u200B", 3) == 0) + { + str += 3; + } + lineStart = str; continue; } diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index a9955d23..33ac5c69 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -80,6 +80,7 @@ static double g_lockedOnTime; static double g_lastTappedTime; static double g_lastIncrementTime; static double g_lastIncrementSoundTime; +static double g_fastIncrementHoldTime; static constexpr size_t GRID_SIZE = 9; @@ -98,6 +99,7 @@ static bool g_isEnterKeyBuffered = false; static bool g_canReset = false; static bool g_isLanguageOptionChanged = false; static bool g_titleAnimBegin = true; +static EChannelConfiguration g_currentChannelConfig; static double g_appearTime = 0.0; @@ -802,7 +804,6 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef* conf config->Callback(config); VideoConfigValueChangedCallback(config); - XAudioConfigValueChangedCallback(config); Game_PlaySound("sys_worldmap_finaldecide"); } @@ -835,7 +836,6 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef* conf if (config->Value != s_oldValue) { VideoConfigValueChangedCallback(config); - XAudioConfigValueChangedCallback(config); if (config->ApplyCallback) config->ApplyCallback(config); @@ -864,7 +864,6 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef* conf config->MakeDefault(); VideoConfigValueChangedCallback(config); - XAudioConfigValueChangedCallback(config); if (config->Callback) config->Callback(config); @@ -1043,37 +1042,40 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef* conf } config->Value = it->first; + config->SnapToNearestAccessibleValue(rightTapped); if (increment || decrement) Game_PlaySound("sys_actstg_pausecursor"); } else if constexpr (std::is_same_v || std::is_same_v) { - float deltaTime = ImGui::GetIO().DeltaTime; + float deltaTime = std::fmin(ImGui::GetIO().DeltaTime, 1.0f / 15.0f); - bool fastIncrement = (time - g_lastTappedTime) > 0.5; + bool fastIncrement = isSlider && (leftIsHeld || rightIsHeld) && (time - g_lastTappedTime) > 0.5; bool isPlayIncrementSound = true; constexpr double INCREMENT_TIME = 1.0 / 120.0; constexpr double INCREMENT_SOUND_TIME = 1.0 / 7.5; - if (isSlider) + if (fastIncrement) + g_fastIncrementHoldTime += deltaTime; + else + g_fastIncrementHoldTime = 0; + + if (fastIncrement) { - if (fastIncrement) - { - isPlayIncrementSound = (time - g_lastIncrementSoundTime) > INCREMENT_SOUND_TIME; + isPlayIncrementSound = (time - g_lastIncrementSoundTime) > INCREMENT_SOUND_TIME; - if ((time - g_lastIncrementTime) < INCREMENT_TIME) - fastIncrement = false; - else - g_lastIncrementTime = time; - } + if (g_fastIncrementHoldTime < INCREMENT_TIME) + fastIncrement = false; + else + g_lastIncrementTime = time; + } - if (fastIncrement) - { - decrement = leftIsHeld; - increment = rightIsHeld; - } + if (fastIncrement) + { + decrement = leftIsHeld; + increment = rightIsHeld; } do @@ -1093,9 +1095,10 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef* conf config->Value += 0.01f; } - deltaTime -= INCREMENT_TIME; + if (fastIncrement) + g_fastIncrementHoldTime -= INCREMENT_TIME; } - while (fastIncrement && deltaTime > 0.0f); + while (fastIncrement && g_fastIncrementHoldTime >= INCREMENT_TIME); bool isConfigValueInBounds = config->Value >= valueMin && config->Value <= valueMax; @@ -1245,7 +1248,7 @@ static void DrawConfigOptions() DrawConfigOption(rowCount++, yOffset, &Config::MasterVolume, true); DrawConfigOption(rowCount++, yOffset, &Config::MusicVolume, true); DrawConfigOption(rowCount++, yOffset, &Config::EffectsVolume, true); - DrawConfigOption(rowCount++, yOffset, &Config::ChannelConfiguration, true); + DrawConfigOption(rowCount++, yOffset, &Config::ChannelConfiguration, !OptionsMenu::s_isPause, cmnReason); DrawConfigOption(rowCount++, yOffset, &Config::MusicAttenuation, AudioPatches::CanAttenuate(), &Localise("Options_Desc_OSNotSupported")); DrawConfigOption(rowCount++, yOffset, &Config::BattleTheme, true); break; @@ -1271,7 +1274,7 @@ static void DrawConfigOptions() DrawConfigOption(rowCount++, yOffset, &Config::VSync, true); DrawConfigOption(rowCount++, yOffset, &Config::FPS, true, nullptr, FPS_MIN, 120, FPS_MAX); DrawConfigOption(rowCount++, yOffset, &Config::Brightness, true); - DrawConfigOption(rowCount++, yOffset, &Config::AntiAliasing, true); + DrawConfigOption(rowCount++, yOffset, &Config::AntiAliasing, Config::AntiAliasing.InaccessibleValues.size() != 3, &Localise("Options_Desc_NotAvailableHardware")); DrawConfigOption(rowCount++, yOffset, &Config::TransparencyAntiAliasing, Config::AntiAliasing != EAntiAliasing::None, &Localise("Options_Desc_NotAvailableMSAA")); DrawConfigOption(rowCount++, yOffset, &Config::ShadowResolution, true); DrawConfigOption(rowCount++, yOffset, &Config::GITextureFiltering, true); @@ -1786,7 +1789,7 @@ void OptionsMenu::Draw() DrawFadeTransition(); } - s_isRestartRequired = Config::Language != App::s_language; + s_isRestartRequired = Config::Language != App::s_language || Config::ChannelConfiguration != g_currentChannelConfig; } void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType) @@ -1802,6 +1805,7 @@ void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType) g_categoryAnimMax = { 0.0f, 0.0f }; g_selectedItem = nullptr; g_titleAnimBegin = true; + g_currentChannelConfig = Config::ChannelConfiguration; /* Store button state so we can track it later and prevent the first item being selected. */ diff --git a/UnleashedRecomp/user/achievement_data.cpp b/UnleashedRecomp/user/achievement_data.cpp index 2369b0df..dd734659 100644 --- a/UnleashedRecomp/user/achievement_data.cpp +++ b/UnleashedRecomp/user/achievement_data.cpp @@ -11,7 +11,7 @@ bool AchievementData::VerifySignature() const bool AchievementData::VerifyVersion() const { - return Version == AchVersion ACH_VERSION; + return Version <= ACH_VERSION; } bool AchievementData::VerifyChecksum() diff --git a/UnleashedRecomp/user/achievement_data.h b/UnleashedRecomp/user/achievement_data.h index bd38d219..3c8c1a5a 100644 --- a/UnleashedRecomp/user/achievement_data.h +++ b/UnleashedRecomp/user/achievement_data.h @@ -4,27 +4,12 @@ #define ACH_FILENAME "ACH-DATA" #define ACH_SIGNATURE { 'A', 'C', 'H', ' ' } -#define ACH_VERSION { 1, 0, 0 } +#define ACH_VERSION 1 #define ACH_RECORDS 50 class AchievementData { public: - struct AchVersion - { - uint8_t Major; - uint8_t Minor; - uint8_t Revision; - uint8_t Reserved; - - bool operator==(const AchVersion& other) const - { - return Major == other.Major && - Minor == other.Minor && - Revision == other.Revision; - } - }; - #pragma pack(push, 1) struct AchRecord { @@ -35,10 +20,10 @@ public: #pragma pack(pop) char Signature[4] ACH_SIGNATURE; - AchVersion Version ACH_VERSION; - uint32_t Checksum; - uint32_t Reserved; - AchRecord Records[ACH_RECORDS]; + uint32_t Version{ ACH_VERSION }; + uint32_t Checksum{}; + uint32_t Reserved{}; + AchRecord Records[ACH_RECORDS]{}; bool VerifySignature() const; bool VerifyVersion() const; diff --git a/UnleashedRecomp/user/achievement_manager.cpp b/UnleashedRecomp/user/achievement_manager.cpp index 90759765..6d2a5772 100644 --- a/UnleashedRecomp/user/achievement_manager.cpp +++ b/UnleashedRecomp/user/achievement_manager.cpp @@ -1,5 +1,6 @@ #include "achievement_manager.h" #include +#include #include #include @@ -84,13 +85,31 @@ void AchievementManager::UnlockAll() void AchievementManager::Reset() { Data = {}; + + // The first usage of the shoe upgrades get stored within a session persistent boolean flag. + // This causes issues with popping the achievement for the use of these abilities when the player + // starts a new save file after they already used them in a session as these bools are never reset + // unless the game is exited. + // As a solution we reset these flags whenever the achievement data is being reset too. + + // Lay the Smackdown + *(bool*)g_memory.Translate(0x833647C5) = false; + + // Wall Crawler + *(bool*)g_memory.Translate(0x83363004) = false; + + // Airdevil + *(bool*)g_memory.Translate(0x833647BC) = false; + + // Hyperdrive + *(bool*)g_memory.Translate(0x833647C4) = false; } -void AchievementManager::Load() +bool AchievementManager::LoadBinary() { AchievementManager::Reset(); - Status = EAchStatus::Success; + BinStatus = EAchBinStatus::Success; auto dataPath = GetDataPath(true); @@ -100,7 +119,7 @@ void AchievementManager::Load() dataPath = GetDataPath(false); if (!std::filesystem::exists(dataPath)) - return; + return true; } std::error_code ec; @@ -109,16 +128,16 @@ void AchievementManager::Load() if (fileSize != dataSize) { - Status = EAchStatus::BadFileSize; - return; + BinStatus = EAchBinStatus::BadFileSize; + return false; } std::ifstream file(dataPath, std::ios::binary); if (!file) { - Status = EAchStatus::IOError; - return; + BinStatus = EAchBinStatus::IOError; + return false; } AchievementData data{}; @@ -127,19 +146,18 @@ void AchievementManager::Load() if (!data.VerifySignature()) { - Status = EAchStatus::BadSignature; + BinStatus = EAchBinStatus::BadSignature; file.close(); - return; + return false; } file.read((char*)&data.Version, sizeof(data.Version)); - // TODO: upgrade in future if the version changes. if (!data.VerifyVersion()) { - Status = EAchStatus::BadVersion; + BinStatus = EAchBinStatus::BadVersion; file.close(); - return; + return false; } file.seekg(0); @@ -147,22 +165,24 @@ void AchievementManager::Load() if (!data.VerifyChecksum()) { - Status = EAchStatus::BadChecksum; + BinStatus = EAchBinStatus::BadChecksum; file.close(); - return; + return false; } file.close(); memcpy(&Data, &data, dataSize); + + return true; } -void AchievementManager::Save(bool ignoreStatus) +bool AchievementManager::SaveBinary(bool ignoreStatus) { - if (!ignoreStatus && Status != EAchStatus::Success) + if (!ignoreStatus && BinStatus != EAchBinStatus::Success) { LOGN_WARNING("Achievement data will not be saved in this session!"); - return; + return false; } LOGN("Saving achievements..."); @@ -172,7 +192,7 @@ void AchievementManager::Save(bool ignoreStatus) if (!file) { LOGN_ERROR("Failed to write achievement data."); - return; + return false; } Data.Checksum = Data.CalculateChecksum(); @@ -180,5 +200,7 @@ void AchievementManager::Save(bool ignoreStatus) file.write((const char*)&Data, sizeof(AchievementData)); file.close(); - Status = EAchStatus::Success; + BinStatus = EAchBinStatus::Success; + + return true; } diff --git a/UnleashedRecomp/user/achievement_manager.h b/UnleashedRecomp/user/achievement_manager.h index eab9c829..4bff7577 100644 --- a/UnleashedRecomp/user/achievement_manager.h +++ b/UnleashedRecomp/user/achievement_manager.h @@ -2,7 +2,7 @@ #include -enum class EAchStatus +enum class EAchBinStatus { Success, IOError, @@ -16,7 +16,7 @@ class AchievementManager { public: static inline AchievementData Data{}; - static inline EAchStatus Status{}; + static inline EAchBinStatus BinStatus{ EAchBinStatus::Success }; static std::filesystem::path GetDataPath(bool checkForMods) { @@ -29,6 +29,6 @@ public: static void Unlock(uint16_t id); static void UnlockAll(); static void Reset(); - static void Load(); - static void Save(bool ignoreStatus = false); + static bool LoadBinary(); + static bool SaveBinary(bool ignoreStatus = false); }; diff --git a/UnleashedRecomp/user/config.cpp b/UnleashedRecomp/user/config.cpp index dddcf5a5..bd622b7f 100644 --- a/UnleashedRecomp/user/config.cpp +++ b/UnleashedRecomp/user/config.cpp @@ -494,6 +494,9 @@ template void ConfigDef::MakeDefault() { Value = DefaultValue; + + if constexpr (std::is_enum_v) + SnapToNearestAccessibleValue(false); } template @@ -696,6 +699,51 @@ void ConfigDef::GetLocaleStrings(std::vector& loc } } +template +void ConfigDef::SnapToNearestAccessibleValue(bool searchUp) +{ + if constexpr (std::is_enum_v) + { + if (EnumTemplateReverse.empty() || InaccessibleValues.empty()) + return; + + if (EnumTemplateReverse.size() == InaccessibleValues.size()) + { + assert(false && "All enum values are marked inaccessible and the nearest accessible value cannot be determined."); + return; + } + + auto it = EnumTemplateReverse.find(Value); + + if (it == EnumTemplateReverse.end()) + { + assert(false && "Enum value does not exist in the template."); + return; + } + + // Skip the enum value if it's marked as inaccessible. + while (InaccessibleValues.find(it->first) != InaccessibleValues.end()) + { + if (searchUp) + { + ++it; + + if (it == EnumTemplateReverse.end()) + it = EnumTemplateReverse.begin(); + } + else + { + if (it == EnumTemplateReverse.begin()) + it = EnumTemplateReverse.end(); + + --it; + } + } + + Value = it->first; + } +} + std::filesystem::path Config::GetConfigPath() { return GetUserPath() / "config.toml"; diff --git a/UnleashedRecomp/user/config.h b/UnleashedRecomp/user/config.h index 5cda9d9d..9e87d12e 100644 --- a/UnleashedRecomp/user/config.h +++ b/UnleashedRecomp/user/config.h @@ -20,6 +20,7 @@ public: virtual std::string GetDefinition(bool withSection = false) const = 0; virtual std::string ToString(bool strWithQuotes = true) const = 0; virtual void GetLocaleStrings(std::vector& localeStrings) const = 0; + virtual void SnapToNearestAccessibleValue(bool searchUp) = 0; }; #define CONFIG_LOCALE std::unordered_map> @@ -158,7 +159,8 @@ public: CONFIG_LOCALE* Locale{}; T DefaultValue{}; T Value{ DefaultValue }; - std::unordered_map* EnumTemplate; + std::set InaccessibleValues{}; + std::unordered_map* EnumTemplate{}; std::map EnumTemplateReverse{}; CONFIG_ENUM_LOCALE(T)* EnumLocale{}; std::function*)> Callback; @@ -183,25 +185,20 @@ public: ~ConfigDef(); bool IsHidden() override; - void ReadValue(toml::v3::ex::parse_result& toml) override; void MakeDefault() override; - std::string_view GetSection() const override; std::string_view GetName() const override; std::string GetNameLocalised(ELanguage language) const override; std::string GetDescription(ELanguage language) const override; - bool IsDefaultValue() const override; const void* GetValue() const override; - std::string GetValueLocalised(ELanguage language) const override; std::string GetValueDescription(ELanguage language) const override; - std::string GetDefinition(bool withSection = false) const override; std::string ToString(bool strWithQuotes = true) const override; - void GetLocaleStrings(std::vector& localeStrings) const override; + void SnapToNearestAccessibleValue(bool searchUp) override; operator T() const { diff --git a/UnleashedRecomp/user/config_def.h b/UnleashedRecomp/user/config_def.h index 37fd59c6..80eb29c9 100644 --- a/UnleashedRecomp/user/config_def.h +++ b/UnleashedRecomp/user/config_def.h @@ -92,6 +92,7 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, HomingAttackOnJump, false); CONFIG_DEFINE_HIDDEN("Codes", bool, HUDToggleKey, false); CONFIG_DEFINE_HIDDEN("Codes", bool, SaveScoreAtCheckpoints, false); CONFIG_DEFINE_HIDDEN("Codes", bool, SkipIntroLogos, false); +CONFIG_DEFINE_HIDDEN("Codes", bool, UseAlternateTitle, false); CONFIG_DEFINE_HIDDEN("Codes", bool, UseArrowsForTimeOfDayTransition, false); CONFIG_DEFINE_HIDDEN("Codes", bool, UseOfficialTitleOnTitleBar, false); diff --git a/UnleashedRecomp/user/persistent_data.cpp b/UnleashedRecomp/user/persistent_data.cpp new file mode 100644 index 00000000..f087f39e --- /dev/null +++ b/UnleashedRecomp/user/persistent_data.cpp @@ -0,0 +1,13 @@ +#include "persistent_data.h" + +bool PersistentData::VerifySignature() const +{ + char sig[4] = EXT_SIGNATURE; + + return memcmp(Signature, sig, sizeof(Signature)) == 0; +} + +bool PersistentData::VerifyVersion() const +{ + return Version <= EXT_VERSION; +} diff --git a/UnleashedRecomp/user/persistent_data.h b/UnleashedRecomp/user/persistent_data.h new file mode 100644 index 00000000..fec827fa --- /dev/null +++ b/UnleashedRecomp/user/persistent_data.h @@ -0,0 +1,30 @@ +#pragma once + +#include + +#define EXT_FILENAME "EXT-DATA" +#define EXT_SIGNATURE { 'E', 'X', 'T', ' ' } +#define EXT_VERSION 1 + +enum class EDLCFlag +{ + ApotosAndShamar, + Spagonia, + Chunnan, + Mazuri, + Holoska, + EmpireCityAndAdabat, + Count +}; + +class PersistentData +{ +public: + char Signature[4] EXT_SIGNATURE; + uint32_t Version{ EXT_VERSION }; + uint64_t Reserved{}; + bool DLCFlags[6]{}; + + bool VerifySignature() const; + bool VerifyVersion() const; +}; diff --git a/UnleashedRecomp/user/persistent_storage_manager.cpp b/UnleashedRecomp/user/persistent_storage_manager.cpp new file mode 100644 index 00000000..6b92d239 --- /dev/null +++ b/UnleashedRecomp/user/persistent_storage_manager.cpp @@ -0,0 +1,117 @@ +#include "persistent_storage_manager.h" +#include +#include +#include + +bool PersistentStorageManager::ShouldDisplayDLCMessage(bool setOffendingDLCFlag) +{ + if (BinStatus != EExtBinStatus::Success) + return true; + + static std::unordered_map flags = + { + { EDLCFlag::ApotosAndShamar, DLC::ApotosShamar }, + { EDLCFlag::Spagonia, DLC::Spagonia }, + { EDLCFlag::Chunnan, DLC::Chunnan }, + { EDLCFlag::Mazuri, DLC::Mazuri }, + { EDLCFlag::Holoska, DLC::Holoska }, + { EDLCFlag::EmpireCityAndAdabat, DLC::EmpireCityAdabat } + }; + + auto result = false; + + for (auto& pair : flags) + { + if (!Data.DLCFlags[(int)pair.first] && Installer::checkDLCInstall(GetGamePath(), pair.second)) + { + if (setOffendingDLCFlag) + Data.DLCFlags[(int)pair.first] = true; + + result = true; + } + } + + return result; +} + +bool PersistentStorageManager::LoadBinary() +{ + BinStatus = EExtBinStatus::Success; + + auto dataPath = GetDataPath(true); + + if (!std::filesystem::exists(dataPath)) + { + // Try loading base persistent data as fallback. + dataPath = GetDataPath(false); + + if (!std::filesystem::exists(dataPath)) + return true; + } + + std::error_code ec; + auto fileSize = std::filesystem::file_size(dataPath, ec); + auto dataSize = sizeof(PersistentData); + + if (fileSize != dataSize) + { + BinStatus = EExtBinStatus::BadFileSize; + return false; + } + + std::ifstream file(dataPath, std::ios::binary); + + if (!file) + { + BinStatus = EExtBinStatus::IOError; + return false; + } + + PersistentData data{}; + + file.read((char*)&data.Signature, sizeof(data.Signature)); + + if (!data.VerifySignature()) + { + BinStatus = EExtBinStatus::BadSignature; + file.close(); + return false; + } + + file.read((char*)&data.Version, sizeof(data.Version)); + + if (!data.VerifyVersion()) + { + BinStatus = EExtBinStatus::BadVersion; + file.close(); + return false; + } + + file.seekg(0); + file.read((char*)&data, sizeof(data)); + file.close(); + + memcpy(&Data, &data, dataSize); + + return true; +} + +bool PersistentStorageManager::SaveBinary() +{ + LOGN("Saving persistent storage binary..."); + + std::ofstream file(GetDataPath(true), std::ios::binary); + + if (!file) + { + LOGN_ERROR("Failed to write persistent storage binary."); + return false; + } + + file.write((const char*)&Data, sizeof(PersistentData)); + file.close(); + + BinStatus = EExtBinStatus::Success; + + return true; +} diff --git a/UnleashedRecomp/user/persistent_storage_manager.h b/UnleashedRecomp/user/persistent_storage_manager.h new file mode 100644 index 00000000..4cad7b88 --- /dev/null +++ b/UnleashedRecomp/user/persistent_storage_manager.h @@ -0,0 +1,28 @@ +#pragma once + +#include + +enum class EExtBinStatus +{ + Success, + IOError, + BadFileSize, + BadSignature, + BadVersion +}; + +class PersistentStorageManager +{ +public: + static inline PersistentData Data{}; + static inline EExtBinStatus BinStatus{ EExtBinStatus::Success }; + + static std::filesystem::path GetDataPath(bool checkForMods) + { + return GetSavePath(checkForMods) / EXT_FILENAME; + } + + static bool ShouldDisplayDLCMessage(bool setOffendingDLCFlag); + static bool LoadBinary(); + static bool SaveBinary(); +}; diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 2c0177ee..eb871b8a 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -1102,6 +1102,42 @@ address = 0x82614948 registers = ["r3"] [[midasm_hook]] -name = "DisableBoostFilterMidAsmHook" -address = 0x82B48C9C -registers = ["r11"] +name = "UseAlternateTitleMidAsmHook" +address = 0x82580F44 +jump_address_on_true = 0x82580F48 +jump_address_on_false = 0x82580FA0 + +[[midasm_hook]] +name = "EndingTextAllocMidAsmHook" +address = 0x8257E284 +registers = ["r3"] + +[[midasm_hook]] +name = "EndingTextAllocMidAsmHook" +address = 0x8257E45C +registers = ["r3"] + +[[midasm_hook]] +name = "EndingTextAllocMidAsmHook" +address = 0x8257EDD8 +registers = ["r3"] + +[[midasm_hook]] +name = "EndingTextCtorRightMidAsmHook" +address = 0x8257E304 +registers = ["r3"] + +[[midasm_hook]] +name = "EndingTextCtorLeftMidAsmHook" +address = 0x8257E4DC +registers = ["r3"] + +[[midasm_hook]] +name = "EndingTextCtorCenterMidAsmHook" +address = 0x8257EE40 +registers = ["r3"] + +[[midasm_hook]] +name = "EndingTextPositionMidAsmHook" +address = 0x82580168 +registers = ["r31", "f13"] diff --git a/UnleashedRecompResources b/UnleashedRecompResources index e5a4adcc..35322388 160000 --- a/UnleashedRecompResources +++ b/UnleashedRecompResources @@ -1 +1 @@ -Subproject commit e5a4adccb30734321ac17347090abeb6690dab70 +Subproject commit 35322388006365a648f75f4981a496b12a7f7478 diff --git a/thirdparty/ddspp b/thirdparty/ddspp index 1390499e..98ce1d38 160000 --- a/thirdparty/ddspp +++ b/thirdparty/ddspp @@ -1 +1 @@ -Subproject commit 1390499ec9f7b82e7a9cbdeb2e6191808e981f84 +Subproject commit 98ce1d384706c8d7121876742a786f4eb89a23ef diff --git a/tools/XenonRecomp b/tools/XenonRecomp index 7b8e37aa..c017eb63 160000 --- a/tools/XenonRecomp +++ b/tools/XenonRecomp @@ -1 +1 @@ -Subproject commit 7b8e37aa3758c3ce2361433965cb94f2a0505eb2 +Subproject commit c017eb630ab917bffd3bc6a0a46995b49e7d8049 diff --git a/tools/XenosRecomp b/tools/XenosRecomp index 855a5a8c..56738e58 160000 --- a/tools/XenosRecomp +++ b/tools/XenosRecomp @@ -1 +1 @@ -Subproject commit 855a5a8c51ea5f84baecbf4fc87c182795d482c9 +Subproject commit 56738e5893ed7c4dc108996590475c52726623e3