diff --git a/CommonLibF4/cmake/sourcelist.cmake b/CommonLibF4/cmake/sourcelist.cmake index 80666ec5..af05e208 100644 --- a/CommonLibF4/cmake/sourcelist.cmake +++ b/CommonLibF4/cmake/sourcelist.cmake @@ -207,6 +207,7 @@ set(SOURCES include/RE/Bethesda/PipboyMapData.h include/RE/Bethesda/PipboyPerksData.h include/RE/Bethesda/PipboyPlayerInfoData.h + include/RE/Bethesda/PipboyPrimitiveValue.h include/RE/Bethesda/PipboyQuestData.h include/RE/Bethesda/PipboyRadioData.h include/RE/Bethesda/PipboySpecialData.h diff --git a/CommonLibF4/include/RE/Bethesda/PipboyPrimitiveValue.h b/CommonLibF4/include/RE/Bethesda/PipboyPrimitiveValue.h new file mode 100644 index 00000000..eb13ccbb --- /dev/null +++ b/CommonLibF4/include/RE/Bethesda/PipboyPrimitiveValue.h @@ -0,0 +1,72 @@ +#pragma once + +#include "RE/Bethesda/PipboyValue.h" + +namespace RE +{ + template + class PipboyPrimitiveValue; // Forward declaration for specialization **only** + + template <> + class __declspec(novtable) PipboyPrimitiveValue : public PipboyValue + { + public: + virtual ~PipboyPrimitiveValue() {} // 00 + + // override + virtual void CleanDirtyToGame() override {} // 00 + virtual void Serialize(Json::Value* a_json) override {} // 01 + virtual void SerializeChanges(BSBinarySerializer& a_serializer, bool a_fullSerialization) override {} // 03 + virtual SERIALIZATION_DATA_TYPE GetType() override { return SERIALIZATION_DATA_TYPE::kUint32; } + + PipboyPrimitiveValue(std::uint32_t a_value, PipboyValue* a_parentValue) + : PipboyValue(a_parentValue), value(a_value) {} + + + void ctor(std::uint32_t a_value, PipboyValue* a_parentValue) + { + using func_t = decltype(&PipboyPrimitiveValue::ctor); + REL::Relocation func{ REL::ID(2225324) }; + func(this, a_value, a_parentValue); + } + + operator std::uint32_t() const { + return value; + } + + // members + std::uint32_t value; // 18 + }; + static_assert(sizeof(PipboyPrimitiveValue) == 0x20); + + template <> + class __declspec(novtable) PipboyPrimitiveValue : public PipboyValue + { + public: + virtual ~PipboyPrimitiveValue() {} // 00 + + // override + virtual void CleanDirtyToGame() override {} // 00 + virtual void Serialize(Json::Value* a_json) override {} // 01 + virtual void SerializeChanges(BSBinarySerializer& a_serializer, bool a_fullSerialization) override {} // 03 + virtual SERIALIZATION_DATA_TYPE GetType() override { return SERIALIZATION_DATA_TYPE::kBool; } + + PipboyPrimitiveValue(bool a_value, PipboyValue* a_parentValue) + : PipboyValue(a_parentValue), value(a_value) {} + + void ctor(bool a_value, PipboyValue* a_parentValue) + { + using func_t = decltype(&PipboyPrimitiveValue::ctor); + REL::Relocation func{ REL::ID(2225327) }; + func(this, a_value, a_parentValue); + } + + operator bool() const { + return value; + } + + // members + bool value; // 18 + }; + static_assert(sizeof(PipboyPrimitiveValue) == 0x20); +} diff --git a/CommonLibF4/include/RE/Bethesda/PipboyValue.h b/CommonLibF4/include/RE/Bethesda/PipboyValue.h index 4c1217e4..67f84532 100644 --- a/CommonLibF4/include/RE/Bethesda/PipboyValue.h +++ b/CommonLibF4/include/RE/Bethesda/PipboyValue.h @@ -33,7 +33,7 @@ namespace RE kObject = 0x8, }; - virtual ~PipboyValue(); // 00 + virtual ~PipboyValue() = default; // 00 // add virtual void CleanDirtyToGame(); // 01 @@ -41,6 +41,18 @@ namespace RE virtual void SerializeChanges(BSBinarySerializer& a_serializer, bool a_fullSerialize); // 03 virtual SERIALIZATION_DATA_TYPE GetType() = 0; // 04 + PipboyValue(PipboyValue* a_parentValue) + { + ctor(a_parentValue); + }; + + void ctor(PipboyValue* a_parentValue) + { + using func_t = decltype(&PipboyValue::ctor); + REL::Relocation func{ REL::ID(2225915) }; + return func(this, a_parentValue); + } + // members std::uint32_t id; // 08 bool isDirtyGame; // 0C diff --git a/CommonLibF4/include/RE/Fallout.h b/CommonLibF4/include/RE/Fallout.h index b52153d5..38a56600 100644 --- a/CommonLibF4/include/RE/Fallout.h +++ b/CommonLibF4/include/RE/Fallout.h @@ -202,6 +202,7 @@ #include "RE/Bethesda/PipboyMapData.h" #include "RE/Bethesda/PipboyPerksData.h" #include "RE/Bethesda/PipboyPlayerInfoData.h" +#include "RE/Bethesda/PipboyPrimitiveValue.h" #include "RE/Bethesda/PipboyQuestData.h" #include "RE/Bethesda/PipboyRadioData.h" #include "RE/Bethesda/PipboySpecialData.h"