From 072e906eaf3028516c566af039ad54de12e4d60f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sat, 5 Sep 2020 10:35:22 +0200 Subject: [PATCH] ksys/res: Add Lod --- CMakeLists.txt | 3 ++ data/uking_functions.csv | 51 +++++++++++----------- lib/agl | 2 +- lib/sead | 2 +- src/KingSystem/Resource/resResourceLod.cpp | 26 +++++++++++ src/KingSystem/Resource/resResourceLod.h | 37 ++++++++++++++++ src/KingSystem/Utils/ParamIO.h | 22 ++++++++++ 7 files changed, 116 insertions(+), 27 deletions(-) create mode 100644 src/KingSystem/Resource/resResourceLod.cpp create mode 100644 src/KingSystem/Resource/resResourceLod.h create mode 100644 src/KingSystem/Utils/ParamIO.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ceaf5d6..5401a437 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(uking src/KingSystem/Resource/resEntryFactory.h src/KingSystem/Resource/resResource.cpp src/KingSystem/Resource/resResource.h + src/KingSystem/Resource/resResourceLod.cpp + src/KingSystem/Resource/resResourceLod.h src/KingSystem/Terrain/teraSystem.h @@ -65,6 +67,7 @@ add_executable(uking src/KingSystem/Utils/Debug.h src/KingSystem/Utils/HeapUtil.cpp src/KingSystem/Utils/HeapUtil.h + src/KingSystem/Utils/ParamIO.h src/KingSystem/Utils/StrTreeMap.h src/KingSystem/Utils/Types.h ) diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 042f27bf..16601956 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -63077,8 +63077,8 @@ 0x0000007100b3e380,_ZN3agl3env9EnvObjSetC2Ev,312, 0x0000007100b3e4b8,sub_7100B3E4B8,324, 0x0000007100b3e5fc,_ZN3agl3env9EnvObjSet4bindEPNS0_9EnvObjMgrE,88, -0x0000007100b3e654,sub_7100B3E654,20, -0x0000007100b3e668,_ZN3agl3utl13ParameterListD2Ev,20, +0x0000007100b3e654,sub_7100B3E654,20,_ZN3agl3utl12ParameterObjD2Ev +0x0000007100b3e668,_ZN3agl3utl13ParameterListD2Ev,20,_ZN3agl3utl13ParameterListD2Ev 0x0000007100b3e67c,sub_7100B3E67C,20, 0x0000007100b3e690,sub_7100B3E690,8, 0x0000007100b3e698,sub_7100B3E698,36, @@ -63099,8 +63099,8 @@ 0x0000007100b3f864,_ZN3agl3env9EnvObjSet3RefD0Ev,84, 0x0000007100b3f8b8,nullsub_3277,4, 0x0000007100b3f8bc,nullsub_3278,4, -0x0000007100b3f8c0,_ZN3agl3utl13ParameterListD0Ev,4, -0x0000007100b3f8c4,j__ZdlPv_628,4, +0x0000007100b3f8c0,_ZN3agl3utl13ParameterListD0Ev,4,_ZN3agl3utl13ParameterListD0Ev +0x0000007100b3f8c4,j__ZdlPv_628,4,_ZN3agl3utl12ParameterObjD0Ev 0x0000007100b3f8c8,j__ZdlPv_629,4, 0x0000007100b3f8cc,_ZNK3agl3utl9ParameterIN4sead15FixedSafeStringILi32EEEE16getParameterTypeEv,8, 0x0000007100b3f8d4,_ZNK3agl3utl9ParameterIN4sead15FixedSafeStringILi32EEEE3ptrEv_0,48, @@ -85562,9 +85562,9 @@ 0x0000007101089bcc,sub_7101089BCC,8, 0x0000007101089bd4,sub_7101089BD4,184, 0x0000007101089c8c,sub_7101089C8C,172, -0x0000007101089d38,sub_7101089D38,20, -0x0000007101089d4c,j__ZdlPv_1140,4, -0x0000007101089d50,sub_7101089D50,8, +0x0000007101089d38,sub_7101089D38,20,_ZN4ksys7ParamIOD2Ev +0x0000007101089d4c,j__ZdlPv_1140,4,_ZN4ksys7ParamIOD0Ev +0x0000007101089d50,sub_7101089D50,8,_ZN4ksys7ParamIO10ParamIO_m0Ev 0x0000007101089d58,sub_7101089D58,48, 0x0000007101089d88,j__ZdlPv_1141,4, 0x0000007101089d8c,sub_7101089D8C,64, @@ -88968,7 +88968,7 @@ 0x0000007101183ec4,sub_7101183EC4,432, 0x0000007101184074,sub_7101184074,8, 0x000000710118407c,sub_710118407C,8, -0x0000007101184084,sub_7101184084,372, +0x0000007101184084,sub_7101184084,372,_ZN4ksys3res3LodC1Ev 0x00000071011841f8,sub_71011841F8,184, 0x00000071011842b0,sub_71011842B0,192, 0x0000007101184370,sub_7101184370,132, @@ -94326,23 +94326,24 @@ 0x00000071012fa7ac,sub_71012FA7AC,8, 0x00000071012fa7b4,sub_71012FA7B4,100, 0x00000071012fa818,sub_71012FA818,88, -0x00000071012fa9e4,nullsub_4839,4, -0x00000071012fa9e8,nullsub_4840,4, -0x00000071012fa9ec,sub_71012FA9EC,492, -0x00000071012fabd8,sub_71012FABD8,28, -0x00000071012fabf4,sub_71012FABF4,148, -0x00000071012fac88,sub_71012FAC88,136, -0x00000071012fad10,sub_71012FAD10,8, -0x00000071012fad18,sub_71012FAD18,8, -0x00000071012fad20,sub_71012FAD20,92, -0x00000071012fad7c,sub_71012FAD7C,8, -0x00000071012fad84,sub_71012FAD84,8, -0x00000071012fad8c,sub_71012FAD8C,92, -0x00000071012fade8,sub_71012FADE8,144, -0x00000071012fae78,sub_71012FAE78,132, -0x00000071012faefc,sub_71012FAEFC,8, -0x00000071012faf04,sub_71012FAF04,152, -0x00000071012faf9c,sub_71012FAF9C,140, +0x00000071012fa9e4,nullsub_4839,4,_ZN4ksys3res3Lod9doCreate_EPhjPN4sead4HeapE +0x00000071012fa9e8,nullsub_4840,4,_ZThn632_N4ksys3res3Lod9doCreate_EPhjPN4sead4HeapE +0x00000071012fa9ec,sub_71012FA9EC,492,_ZN4ksys3res3Lod6parse_EPhmPN4sead4HeapE +0x00000071012fabd8,sub_71012FABD8,28,_ZThn632_N4ksys3res3Lod6parse_EPhmPN4sead4HeapE +0x00000071012fabf4,sub_71012FABF4,148,_ZN4ksys3res3LodD1Ev +0x00000071012fac88,sub_71012FAC88,136,_ZN4ksys3res3LodD0Ev +0x00000071012fad10,sub_71012FAD10,8,_ZN4ksys3res3Lod10ParamIO_m0Ev +0x00000071012fad18,sub_71012FAD18,8,_ZNK4ksys3res3Lod27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE? +0x00000071012fad20,sub_71012FAD20,92,_ZNK4ksys3res3Lod18getRuntimeTypeInfoEv +0x00000071012fad7c,sub_71012FAD7C,8,_ZNK4ksys3res3Lod10needsParseEv +0x00000071012fad84,sub_71012FAD84,8,_ZThn632_NK4ksys3res3Lod27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE? +0x00000071012fad8c,sub_71012FAD8C,92,_ZThn632_NK4ksys3res3Lod18getRuntimeTypeInfoEv +0x00000071012fade8,sub_71012FADE8,144,_ZThn632_N4ksys3res3LodD1Ev +0x00000071012fae78,sub_71012FAE78,132,_ZThn632_N4ksys3res3LodD0Ev +0x00000071012faefc,sub_71012FAEFC,8,_ZThn632_NK4ksys3res3Lod10needsParseEv +0x00000071012faf04,sub_71012FAF04,152,_ZThn664_N4ksys3res3LodD1Ev +0x00000071012faf9c,sub_71012FAF9C,140,_ZThn664_N4ksys3res3LodD0Ev +0x00000071012fb028,_ZN4ksys3res3Lod33checkDerivedRuntimeTypeInfoStaticEPKN4sead15RuntimeTypeInfo9InterfaceE,0x174,_ZN4ksys3res3Lod33checkDerivedRuntimeTypeInfoStaticEPKN4sead15RuntimeTypeInfo9InterfaceE? 0x00000071012fb19c,sub_71012FB19C,492, 0x00000071012fb388,sub_71012FB388,324, 0x00000071012fb4cc,sub_71012FB4CC,8, diff --git a/lib/agl b/lib/agl index 0d619f6c..292b10a2 160000 --- a/lib/agl +++ b/lib/agl @@ -1 +1 @@ -Subproject commit 0d619f6c23ebe7b50f1b0044e7ba563c205fa0e7 +Subproject commit 292b10a27dac9c59241bd54b87e1772c47ef444e diff --git a/lib/sead b/lib/sead index d823497e..ef9b0368 160000 --- a/lib/sead +++ b/lib/sead @@ -1 +1 @@ -Subproject commit d823497e44528cf8d9127b1e38ddc38e9616d789 +Subproject commit ef9b03681383c64b99861ac5e65ad71fc4b90988 diff --git a/src/KingSystem/Resource/resResourceLod.cpp b/src/KingSystem/Resource/resResourceLod.cpp new file mode 100644 index 00000000..6ed71226 --- /dev/null +++ b/src/KingSystem/Resource/resResourceLod.cpp @@ -0,0 +1,26 @@ +#include "KingSystem/Resource/resResourceLod.h" + +namespace ksys::res { + +Lod::Lod() : ParamIO("lod", 0) {} + +Lod::~Lod() = default; + +bool Lod::parse_(u8* data, size_t, sead::Heap*) { + mDisableOutScreenCalcStop.init(false, "DisableOutScreenCalcStop", "", &mHeader); + mDisableXLinkSkip.init(false, "DisableXLinkSkip", "", &mHeader); + mDisableCalcSkipFrame.init(4, "DisableCalcSkipFrame", "", &mHeader); + mDisableConstActor.init(false, "DisableConstActor", "", &mHeader); + mDistanceScale.init(1.0, "DistanceScale", "", &mHeader); + mDisableBehaviorSkip.init(false, "DisableBehaviorSkip", "", &mHeader); + mDisableCalcRescueDistLimit.init(false, "DisableCalcRescueDistLimit", "", &mHeader); + + addObj(&mHeader, "Header"); + + if (data) + applyResParameterArchive(agl::utl::ResParameterArchive{data}); + + return true; +} + +} // namespace ksys::res diff --git a/src/KingSystem/Resource/resResourceLod.h b/src/KingSystem/Resource/resResourceLod.h new file mode 100644 index 00000000..ca933f5c --- /dev/null +++ b/src/KingSystem/Resource/resResourceLod.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include +#include "KingSystem/Resource/resResource.h" +#include "KingSystem/Utils/ParamIO.h" + +namespace ksys::res { + +class Lod : public ParamIO, public Resource { + SEAD_RTTI_OVERRIDE(Lod, Resource) +public: + Lod(); + ~Lod() override; + + bool ParamIO_m0() override { return true; } + void doCreate_(u8*, u32, sead::Heap*) override {} + bool needsParse() const override { return true; } + +protected: + bool parse_(u8* data, size_t size, sead::Heap* heap) override; + + agl::utl::ParameterObj mHeader; + +public: + agl::utl::Parameter mDisableOutScreenCalcStop; + agl::utl::Parameter mDisableXLinkSkip; + agl::utl::Parameter mDisableCalcSkipFrame; + agl::utl::Parameter mDisableConstActor; + agl::utl::Parameter mDistanceScale; + agl::utl::Parameter mDisableBehaviorSkip; + agl::utl::Parameter mDisableCalcRescueDistLimit; +}; +KSYS_CHECK_SIZE_NX150(Lod, 0x3c0); + +} // namespace ksys::res diff --git a/src/KingSystem/Utils/ParamIO.h b/src/KingSystem/Utils/ParamIO.h new file mode 100644 index 00000000..29907c37 --- /dev/null +++ b/src/KingSystem/Utils/ParamIO.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include +#include "KingSystem/Utils/Types.h" + +namespace ksys { + +class ParamIO : public agl::utl::IParameterIO, public sead::hostio::Node { +public: + using agl::utl::IParameterIO::IParameterIO; + + virtual bool ParamIO_m0() { return false; } + +protected: + u32 _1d8 = 0x1c; + sead::FixedSafeString<128> _1e0; +}; +KSYS_CHECK_SIZE_NX150(ParamIO, 0x278); + +} // namespace ksys