From 13861707e3a5e2b50870460f50769b9056e871ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 15 Oct 2026 22:56:21 +0100 Subject: [PATCH] ksys/act: make calcHash a free function in actAwarenessMiscUtils calcHash is linked between AwarenessInstance's sinit and the next one, together with two AwarenessSourcePool helpers and the job queue functions of Awareness::Unk1, so it's a shared helper rather than an Awareness member, declared in the new file's own header. actAwareness.cpp calls this 4-byte function out of line, so it's likely not defined there. The file name sorts between actAwarenessInstance and the sensor files, which is where it is linked. (AI assisted using Claude Opus 5.5) --- data/uking_functions.csv | 2 +- src/KingSystem/ActorSystem/Awareness/actAwareness.cpp | 4 ---- src/KingSystem/ActorSystem/Awareness/actAwareness.h | 2 -- .../ActorSystem/Awareness/actAwarenessDefs.cpp | 6 +++--- .../ActorSystem/Awareness/actAwarenessMiscUtils.cpp | 10 ++++++++++ .../ActorSystem/Awareness/actAwarenessMiscUtils.h | 10 ++++++++++ src/KingSystem/ActorSystem/CMakeLists.txt | 2 ++ 7 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 src/KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.cpp create mode 100644 src/KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.h diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 1374716d..895c5109 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -75237,7 +75237,7 @@ Address,Quality,Size,Name 0x0000007100d7ee8c,U,000076, 0x0000007100d7eed8,U,000016, 0x0000007100d7eee8,U,000128, -0x0000007100d7ef68,O,000004,_ZN4ksys3act9Awareness8calcHashERKN4sead14SafeStringBaseIcEE +0x0000007100d7ef68,O,000004,_ZN4ksys3act17calcAwarenessHashERKN4sead14SafeStringBaseIcEE 0x0000007100d7ef6c,U,000116, 0x0000007100d7efe0,U,000036,_ZN4ksys3act9Awareness4Unk18finalizeEv 0x0000007100d7f004,U,000040, diff --git a/src/KingSystem/ActorSystem/Awareness/actAwareness.cpp b/src/KingSystem/ActorSystem/Awareness/actAwareness.cpp index a06e3e67..4d4e8d67 100644 --- a/src/KingSystem/ActorSystem/Awareness/actAwareness.cpp +++ b/src/KingSystem/ActorSystem/Awareness/actAwareness.cpp @@ -231,10 +231,6 @@ void Awareness::calc() { resetFlag(Flag::_0); } -u32 Awareness::calcHash(const sead::SafeString& key) { - return agl::utl::ParameterBase::calcHash(key); -} - void Awareness::Links2::calc() { count = 0; } diff --git a/src/KingSystem/ActorSystem/Awareness/actAwareness.h b/src/KingSystem/ActorSystem/Awareness/actAwareness.h index 5b13c5ef..970ec635 100644 --- a/src/KingSystem/ActorSystem/Awareness/actAwareness.h +++ b/src/KingSystem/ActorSystem/Awareness/actAwareness.h @@ -35,8 +35,6 @@ public: void setEventActive(bool active); void calc(); - static u32 calcHash(const sead::SafeString& key); - private: friend class AwarenessInstance; diff --git a/src/KingSystem/ActorSystem/Awareness/actAwarenessDefs.cpp b/src/KingSystem/ActorSystem/Awareness/actAwarenessDefs.cpp index 8c13c6fc..d3f969c8 100644 --- a/src/KingSystem/ActorSystem/Awareness/actAwarenessDefs.cpp +++ b/src/KingSystem/ActorSystem/Awareness/actAwarenessDefs.cpp @@ -1,7 +1,7 @@ #include "KingSystem/ActorSystem/Awareness/actAwarenessDefs.h" #include #include -#include "KingSystem/ActorSystem/Awareness/actAwareness.h" +#include "KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.h" namespace ksys::act { @@ -29,7 +29,7 @@ sead::SafeArray sAwarenessSensorTypes = sead::toArray({ u32 getAwarenessTerrorFlags(u32 hash) { for (u32 i = 0; i < u32(sAwarenessTerrorTypes.size()); ++i) { - if (Awareness::calcHash(sAwarenessTerrorTypes(i)) == hash) + if (calcAwarenessHash(sAwarenessTerrorTypes(i)) == hash) return 1 << i; } @@ -39,7 +39,7 @@ u32 getAwarenessTerrorFlags(u32 hash) { u32 getAwarenessSensorFlags(u32 hash) { for (u32 i = 0; i < u32(sAwarenessSensorTypes.size()); ++i) { - if (Awareness::calcHash(sAwarenessSensorTypes(i)) == hash) + if (calcAwarenessHash(sAwarenessSensorTypes(i)) == hash) return 1 << i; } return 0xffffffff; diff --git a/src/KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.cpp b/src/KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.cpp new file mode 100644 index 00000000..b4be0548 --- /dev/null +++ b/src/KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.cpp @@ -0,0 +1,10 @@ +#include "KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.h" +#include + +namespace ksys::act { + +u32 calcAwarenessHash(const sead::SafeString& key) { + return agl::utl::ParameterBase::calcHash(key); +} + +} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.h b/src/KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.h new file mode 100644 index 00000000..486bb8c0 --- /dev/null +++ b/src/KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include + +namespace ksys::act { + +u32 calcAwarenessHash(const sead::SafeString& key); + +} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt index 71080f19..5d9be875 100644 --- a/src/KingSystem/ActorSystem/CMakeLists.txt +++ b/src/KingSystem/ActorSystem/CMakeLists.txt @@ -11,6 +11,8 @@ target_sources(uking PRIVATE Awareness/actAwarenessDefs.h Awareness/actAwarenessInstance.cpp Awareness/actAwarenessInstance.h + Awareness/actAwarenessMiscUtils.cpp + Awareness/actAwarenessMiscUtils.h Profiles/actRopeBase.cpp