Просмотр исходного кода

Use the shared dialogue constants

The cue validator uses kAbsentDefinitionHash instead of its literal, and
the dialogue list reader uses format::kDialogueGroupArrayClass instead of
a second copy of the class id.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
stan 4 дней назад
Родитель
Сommit
b73744a321

+ 5 - 2
Sunrise/src/client/content/activity/activity_sdk_dialogue_list.cpp

@@ -5,15 +5,17 @@
 #include <cstring>
 #include <limits>
 
+#include "../../../state/activity_sdk/format.h"
 #include "activity_sdk_dialogue_group_index.h"
 
 namespace sunrise::client::content::activity::sdk_generation::dialogue_list {
 namespace {
 
+namespace format = state::activity_sdk::format;
+
 // The cue definitions come in cue order; the content trees that follow are sorted by hash.
 constexpr std::size_t kTreeField = 0x18;
 constexpr std::size_t kTreeStride = 16;
-constexpr std::uint32_t kTreeArrayClass = 0x80808D19U;
 // Every tree object repeats the definition hash it belongs to, after a per-object id.
 constexpr std::size_t kObjectHashOffset = 4;
 // A sequence plays its children in order through an array of relative object pointers.
@@ -207,7 +209,8 @@ bool read(std::span<const std::byte> list, Snapshot& output) {
     std::size_t treeRows = 0;
     std::size_t treeCount = 0;
     if (!dialogue_group_index::definitions(list, definitions)
-        || !read_array(list, kTreeField, kTreeStride, kTreeArrayClass, treeRows, treeCount)) {
+        || !read_array(
+            list, kTreeField, kTreeStride, format::kDialogueGroupArrayClass, treeRows, treeCount)) {
         return false;
     }
     std::vector<Tree> trees(treeCount);

+ 0 - 1
Sunrise/src/client/content/activity/activity_sdk_native_pack_text.cpp

@@ -1,6 +1,5 @@
 #include <algorithm>
 #include <array>
-#include <cmath>
 #include <cstddef>
 #include <cstdint>
 #include <cstdio>

+ 2 - 1
Sunrise/src/state/activity_sdk/activity_sdk_relation_validation.cpp

@@ -117,7 +117,8 @@ constexpr std::uint32_t kAbilityTargetComponentClass = 0x80807D9BU;
     for (std::size_t index = 0; index < cues.size(); ++index) {
         const format::DialogueCue& row = cues[index];
         if (row.slotIndex >= slots.size() || (row.flags & ~format::kDialogueCueFlagMask) != 0
-            || row.reserved != 0 || row.definitionHash == 0 || row.definitionHash == 0x811C9DC5U
+            || row.reserved != 0 || row.definitionHash == 0
+            || row.definitionHash == kAbsentDefinitionHash
             || !std::isfinite(row.authoredWindowSeconds) || row.authoredWindowSeconds < 0.0F
             || row.listTag == 0 || row.listTag == format::kAbsentIndex
             || (row.lineCount != 0 && (row.flags & format::kDialogueCueLinesExact) == 0)) {