diff --git a/Runtime/AutoMapper/CMapArea.cpp b/Runtime/AutoMapper/CMapArea.cpp index 24927e1d9..e36b833e6 100644 --- a/Runtime/AutoMapper/CMapArea.cpp +++ b/Runtime/AutoMapper/CMapArea.cpp @@ -44,11 +44,15 @@ void CMapArea::PostConstruct() (reinterpret_cast(x40_surfaceStart + j))->PostConstruct(x44_buf.get()); } + +void CMapArea::CMapAreaSurface::PostConstruct(const void *) +{ +} + CFactoryFnReturn FMapAreaFactory(const SObjectTag& objTag, CInputStream& in, const CVParamTransfer&) { u32 size = g_ResFactory->ResourceSize(objTag); - return TToken::GetIObjObjectFor(std::unique_ptr - (new CMapArea(in, size))); + return TToken::GetIObjObjectFor(std::make_unique(in, size)); } } diff --git a/Runtime/AutoMapper/CMapUniverse.cpp b/Runtime/AutoMapper/CMapUniverse.cpp index 1ab35d753..3336da418 100644 --- a/Runtime/AutoMapper/CMapUniverse.cpp +++ b/Runtime/AutoMapper/CMapUniverse.cpp @@ -53,7 +53,7 @@ CFactoryFnReturn FMapUniverseFactory(const SObjectTag&, CInputStream& in, const in.readUint32Big(); u32 version = in.readUint32Big(); - return TToken::GetIObjObjectFor(std::unique_ptr(new CMapUniverse(in, version))); + return TToken::GetIObjObjectFor(std::make_unique(in, version)); } } diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 91a5f7748..a3a58a4de 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -48,6 +48,7 @@ add_library(RuntimeCommon #CMemory.hpp CMemory.cpp ITweak.hpp CMemoryCardSys.hpp + CScannableObjectInfo.hpp CScannableObjectInfo.cpp CSaveWorld.hpp CSaveWorld.cpp IAllocator.hpp IAllocator.cpp CGameAllocator.hpp CGameAllocator.cpp diff --git a/Runtime/CScannableObjectInfo.cpp b/Runtime/CScannableObjectInfo.cpp new file mode 100644 index 000000000..cce5dad2f --- /dev/null +++ b/Runtime/CScannableObjectInfo.cpp @@ -0,0 +1,74 @@ +#include "CScannableObjectInfo.hpp" +#include "GameGlobalObjects.hpp" +#include "GuiSys/ITweakGui.hpp" + +namespace urde +{ +CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, ResId resId) + : x0_scannableObjectId(resId) +{ + u32 version = in.readUint32Big(); + Load(in, version); +} + +ResId CScannableObjectInfo::GetScannableObjectId() const +{ + return x0_scannableObjectId; +} + +ResId CScannableObjectInfo::GetStringTableId() const +{ + return x4_stringId; +} + +float CScannableObjectInfo::GetTotalDownloadTime() const +{ + return x8_totalDownloadTime; +} + +const CScannableObjectInfo::SBucket& CScannableObjectInfo::GetBucket(s32 idx) const +{ + return x14_buckets[idx]; +} + +void CScannableObjectInfo::Load(CInputStream& in, u32 version) +{ + in.readUint32Big(); + in.readUint32Big(); + x4_stringId = in.readUint32Big(); + if (version < 4) + x8_totalDownloadTime = in.readFloatBig(); + else + { + u32 scanSpeed = in.readUint32Big(); + x8_totalDownloadTime = g_tweakGui->GetScanSpeed(scanSpeed); + } + xc_category = in.readUint32Big(); + if (version > 4) + x10_important = in.readBool(); + + for (u32 i = 0 ; i<4 ; i++) + x14_buckets.emplace_back(in, version); +} + +CScannableObjectInfo::SBucket::SBucket(CInputStream& in, u32 version) +{ + x0_texture = in.readUint32Big(); + x4_appearanceRange = in.readFloatBig(); + x8_imagePos = in.readUint32Big(); + if (version > 1) + { + xc_size.x = in.readUint32Big(); + xc_size.y = in.readUint32Big(); + x14_interval = in.readFloatBig(); + if (version >= 3) + x18_fadeDuration = in.readFloatBig(); + } +} + +CFactoryFnReturn FScannableObjectInfoFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer &) +{ + return TToken::GetIObjObjectFor(std::make_unique(in, tag.id)); +} + +} diff --git a/Runtime/CScannableObjectInfo.hpp b/Runtime/CScannableObjectInfo.hpp new file mode 100644 index 000000000..f6fdfe383 --- /dev/null +++ b/Runtime/CScannableObjectInfo.hpp @@ -0,0 +1,44 @@ +#ifndef __URDE_CSCANNABLEOBJECTINFO_HPP__ +#define __URDE_CSCANNABLEOBJECTINFO_HPP__ + +#include "RetroTypes.hpp" +#include "IFactory.hpp" +#include "CToken.hpp" +#include "zeus/CVector2i.hpp" + +namespace urde +{ +class CScannableObjectInfo +{ +public: + struct SBucket + { + ResId x0_texture = -1; + float x4_appearanceRange = 0.f; + u32 x8_imagePos = 0; + zeus::CVector2i xc_size; + float x14_interval = 0.f; + float x18_fadeDuration = 0.f; + SBucket(CInputStream&, u32 version); + }; + +private: + void Load(CInputStream&, u32); + ResId x0_scannableObjectId; + u32 x4_stringId = -1; + float x8_totalDownloadTime = 0.f; + u32 xc_category = 0; + bool x10_important = false; + rstl::reserved_vector x14_buckets; +public: + CScannableObjectInfo(CInputStream&, ResId); + ResId GetStringTableId() const; + ResId GetScannableObjectId() const; + float GetTotalDownloadTime() const; + const SBucket& GetBucket(s32) const; + bool IsImportant() const; +}; + +CFactoryFnReturn FScannableObjectInfoFactory(const SObjectTag&, CInputStream&, const CVParamTransfer&); +} +#endif // __URDE_CSCANNABLEOBJECTINFO_HPP__ diff --git a/Runtime/GameGlobalObjects.hpp b/Runtime/GameGlobalObjects.hpp index 960664e81..8789c032c 100644 --- a/Runtime/GameGlobalObjects.hpp +++ b/Runtime/GameGlobalObjects.hpp @@ -4,6 +4,7 @@ #include "../DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp" #include "AutoMapper/ITweakAutoMapper.hpp" +#include "GuiSys/ITweakGui.hpp" namespace urde { @@ -21,6 +22,7 @@ extern DataSpec::ITweakGame* g_tweakGame; extern DataSpec::ITweakPlayer* g_tweakPlayer; extern DataSpec::ITweakPlayerControl* g_tweakPlayerControl; extern ITweakAutoMapper* g_tweakAutoMapper; +extern ITweakGui* g_tweakGui; } diff --git a/Runtime/GuiSys/CMakeLists.txt b/Runtime/GuiSys/CMakeLists.txt index 19178150c..667def348 100644 --- a/Runtime/GuiSys/CMakeLists.txt +++ b/Runtime/GuiSys/CMakeLists.txt @@ -92,6 +92,7 @@ set(GUISYS_SOURCES CWordBreakTables.cpp CWordBreakTables.hpp CFontImageDef.cpp - CFontImageDef.hpp) + CFontImageDef.hpp + ITweakGui.hpp) runtime_add_list(GuiSys GUISYS_SOURCES) diff --git a/Runtime/GuiSys/ITweakGui.hpp b/Runtime/GuiSys/ITweakGui.hpp new file mode 100644 index 000000000..349030bd3 --- /dev/null +++ b/Runtime/GuiSys/ITweakGui.hpp @@ -0,0 +1,18 @@ +#ifndef __URDE_ITWEAKGUI_HPP__ +#define __URDE_ITWEAKGUI_HPP__ + +#include "RetroTypes.hpp" +#include "ITweak.hpp" + +namespace urde +{ +class ITweakGui : public ITweak +{ +public: + virtual ~ITweakGui() {} + + virtual float GetScanSpeed(s32) const=0; +}; +} + +#endif // __URDE_ITWEAKGUI_HPP__ diff --git a/Runtime/MP1/CMakeLists.txt b/Runtime/MP1/CMakeLists.txt index a13495c5b..e638345de 100644 --- a/Runtime/MP1/CMakeLists.txt +++ b/Runtime/MP1/CMakeLists.txt @@ -4,6 +4,7 @@ set(MP1_SOURCES CInGameTweakManager.hpp CInGameTweakManager.cpp Tweaks/CTweakAutoMapper.hpp Tweaks/CTweakAutoMapper.cpp Tweaks/CTweakPlayer.hpp Tweaks/CTweakPlayer.cpp + Tweaks/CTweakGui.hpp Tweaks/CTweakGui.cpp CMainFlow.hpp CMainFlow.cpp CMFGame.hpp CMFGame.cpp CPlayMovie.hpp CPlayMovie.cpp diff --git a/Runtime/MP1/Tweaks/CTweakGui.cpp b/Runtime/MP1/Tweaks/CTweakGui.cpp new file mode 100644 index 000000000..897c066b4 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakGui.cpp @@ -0,0 +1,215 @@ +#include "CTweakGui.hpp" + +namespace urde +{ +u32 ReadUnknownValx27c(CInputStream& in) +{ + u32 tmp = in.readUint32Big(); + + if (tmp == 1) + return 2; + else if (tmp == 2) + return 4; + else if (tmp == 3) + return 5; + + return 0; +} +std::vector ReadScanSpeeds(CInputStream& in) +{ + u32 count = in.readUint32Big(); + std::vector ret; + ret.reserve(count); + for (u32 i = 0 ; i= x2c4_scanSpeeds.size()) + return 0.f; + return x2c4_scanSpeeds[idx]; +} + +} diff --git a/Runtime/MP1/Tweaks/CTweakGui.hpp b/Runtime/MP1/Tweaks/CTweakGui.hpp new file mode 100644 index 000000000..a2c65fb36 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakGui.hpp @@ -0,0 +1,198 @@ +#ifndef __URDE_MP1_CTWEAKGUI_HPP__ +#define __URDE_MP1_CTWEAKGUI_HPP__ + +#include "GuiSys/ITweakGui.hpp" +#include "zeus/CVector3f.hpp" +#include "zeus/CColor.hpp" + +namespace urde +{ +class CTweakGui : public ITweakGui +{ + bool x4_; + float x8_; + float xc_; + float x10_; + float x14_; + float x18_; + float x1c_; + float x20_; + float x24_; + float x28_; + u32 x2c_ = 0; + float x30_; + float x34_; + float x38_; + float x3c_; + bool x40_; + float x44_; + float x48_; + float x4c_; + float x50_; + float x54_; + float x58_; + float x5c_; + float x60_; + zeus::CVector3f x64_; + zeus::CVector3f x70_; + float x7c_; + float x80_; + float x84_; + float x88_; + float x8c_; + float x90_; + float x94_; + float x98_; + float x9c_; + float xa0_; + float xa4_; + u32 xa8_; + u32 xac_; + u32 xb0_; + float xb4_; + float xb8_; + float xbc_; + float xc0_; + float xc4_; + float xc8_; + float xcc_; + float xd0_; + u32 xd4_; + float xd8_; + float xdc_; + float xe0_; + float xe4_; + float xe8_; + float xec_; + float xf0_; + float xf4_; + u32 xf8_; + u32 xfc_; + u32 x100_; + u32 x104_; + u32 x108_; + u32 x10c_; + float x110_; + float x114_; + float x118_; + float x11c_; + float x120_; + float x124_; + float x128_; + float x12c_; + bool x130_; + float x134_; + float x138_; + float x13c_; + float x140_; + float x144_; + float x148_; + float x14c_; + std::string x150_; + std::string x160_; + std::string x170_; + std::string x180_; + std::string x190_; + float x1a0_; + float x1a4_; + float x1a8_; + float x1ac_; + float x1b0_; + float x1b4_; + float x1b8_; + float x1bc_; + float x1c0_; + float x1c4_; + float x1c8_; + bool x1cc_; + bool x1cd_; + float x1d0_; + float x1d4_; + float x1d8_; + float x1dc_; + float x1e0_; + float x1e4_; + float x1e8_; + float x1ec_; + float x1f0_; + float x1f4_; + float x1f8_; + float x1fc_; + zeus::CColor x200_; + float x204_ = 0.0014f; + float x208_ = 0.0000525f; + float x20c_; + float x210_; + float x214_; + float x218_; + float x21c_; + float x220_; + float x224_; + float x228_; + float x22c_; + float x230_; + float x234_; + float x238_; + float x23c_; + float x240_; + float x244_; + float x248_; + float x24c_; + float x250_; + float x254_; + float x258_; + float x25c_; + float x260_; + float x264_; + float x268_; + float x26c_; + float x270_; + bool x274_; + bool x275_ = true; + float x278_; + u32 x27c_; + float x280_; + float x284_; + zeus::CColor x288_; + float x28c_; + zeus::CColor x290_; + zeus::CColor x294_; + zeus::CColor x298_; + zeus::CColor x29c_; + zeus::CColor x2a0_; + zeus::CColor x2a4_; + zeus::CColor x2a8_; + zeus::CColor x2ac_; + zeus::CColor x2b0_; + zeus::CColor x2b4_; + float x2b8_; + float x2bc_; + float x2c0_; + std::vector x2c4_scanSpeeds; + std::string x2d0_; + std::string x2e0_; + std::string x2f0_; + zeus::CColor x300_; + zeus::CColor x304_; + float x308_; + float x30c_; + float x310_; + std::string x314_; + std::string x324_; + std::string x334_; + zeus::CColor x344_; + zeus::CColor x348_; + zeus::CColor x34c_; + zeus::CColor x350_; + zeus::CColor x354_; + zeus::CColor x358_; + float x35c_; + float x360_; + float x364_; +public: + CTweakGui(CInputStream&); + + float GetScanSpeed(s32) const; +}; +} +#endif // __URDE_MP1_CTWEAKGUI_HPP__