Ver código fonte

Bring the merged tree back to the lint contract

The tooling and its tests live outside this repository, so the contract
could not be checked on the contributor's side.

- reformat one file to the clang-format policy
- add the missing Doxygen blocks on five functions over ten lines
- state the family-4 change-record size and offsets as field-size sums
  instead of raw numbers
- shorten three comments to one line
stan 3 semanas atrás
pai
commit
bd115ec008

+ 22 - 0
Sunrise/src/client/content/items/packages/package_material_requirement_build.cpp

@@ -12,6 +12,13 @@
 namespace sunrise::client::content::items::packages {
 namespace {
 
+/**
+ * Reports the requirement-set extraction result once per build.
+ * @param sets Sets read from the table.
+ * @param conditionalRows Rows carrying a condition, counted for the same line.
+ * @param valid True when the table passed its checks.
+ * @param published True when the table reached the catalog, which sets the level.
+ */
 void report_material_requirements(std::size_t sets,
                                   std::size_t conditionalRows,
                                   bool valid,
@@ -32,6 +39,12 @@ void report_material_requirements(std::size_t sets,
     }
 }
 
+/**
+ * Names the row that stopped the requirement-set build.
+ * @param reason Short key naming the failing step.
+ * @param set Requirement set being read, or zero before one was picked.
+ * @param row Requirement row being read, or zero before one was picked.
+ */
 void report_material_requirement_failure(const char* reason,
                                          std::size_t set,
                                          std::size_t row) noexcept {
@@ -52,6 +65,15 @@ void report_material_requirement_failure(const char* reason,
 
 } // namespace
 
+/**
+ * Extracts the material requirement sets from the installed packages and publishes them.
+ * The build is skipped when the catalog already holds the domain.
+ * @param source Borrowed package reader.
+ * @param storage Caller-owned scratch and definition buffers.
+ * @param root Borrowed root table bytes.
+ * @param itemDefinitionCount Item count the requirement rows are checked against.
+ * @return True when the domain is ready, either already or after this build.
+ */
 bool build_material_requirements(const reader::Source& source,
                                  Storage& storage,
                                  std::span<const std::byte> root,

+ 3 - 2
Sunrise/src/client/hooks/queuez/svc123_null_payload_guard.cpp

@@ -55,8 +55,9 @@ std::atomic_bool g_reported{false};
  * @param message Borrowed message record, or null.
  * @return The handler's own result, or the not-handled verdict for a skipped message.
  */
-__declspec(noinline) char __fastcall
-handler(void* self, void* context, std::byte* message) noexcept {
+__declspec(noinline) char __fastcall handler(void* self,
+                                             void* context,
+                                             std::byte* message) noexcept {
     std::uintptr_t payload = 0;
     if (message != nullptr) {
         std::memcpy(&payload, message + MessageLayout::payload, sizeof payload);

+ 1 - 2
Sunrise/src/core/settings/settings_runtime.cpp

@@ -221,8 +221,7 @@ bool initialize(void* module) noexcept {
         return fail("too_large");
     }
 
-    // Two banks this size would overflow the boot thread's stack, so they are static. Settings load
-    // once, on one thread, before any other runtime layer starts.
+    // Static because two 1 MiB banks overflow the stack. Settings load once, on one thread.
     static std::array<char, kConfigCapacity> buffer{};
     DWORD read = 0;
     const bool readOk =

+ 1 - 2
Sunrise/src/core/settings/settings_upgrade.cpp

@@ -214,8 +214,7 @@ bool apply(std::string_view document,
 
     const std::uint32_t from = document_version(document);
     for (const ReplacedMember& member : kReplacedMembers) {
-        // A file at or past that version keeps its own value, so an upgrade never overwrites a
-        // choice the user made against the current layout.
+        // A file at or past that version keeps its own value, so a user choice is never lost.
         if (from >= member.version) {
             continue;
         }

+ 5 - 2
Sunrise/src/middleware/datagen/family4/account/layout.h

@@ -179,9 +179,12 @@ static_assert(offsetof(Object, characterUnlocks) == kCharacterUnlocksOffset);
 static_assert(offsetof(Object, profileUnlockFlags) == kProfileUnlockFlagsOffset);
 static_assert(sizeof(CharacterUnlockBlock)
               == kCharacterFlagCapacity + kCharacterValueCapacity * sizeof(std::int32_t));
-static_assert(sizeof(ProfileInventoryChangeRecord) == 12);
+static_assert(sizeof(ProfileInventoryChangeRecord)
+              == 3 * sizeof(std::uint16_t) + sizeof(std::int32_t) + 2 * sizeof(std::uint8_t));
 static_assert(sizeof(ProfileInventoryChangeList)
-              == 4 + kProfileInventoryChangeRecordCapacity * sizeof(ProfileInventoryChangeRecord));
+              == 2 * sizeof(std::uint16_t)
+                     + kProfileInventoryChangeRecordCapacity
+                           * sizeof(ProfileInventoryChangeRecord));
 static_assert(std::is_standard_layout_v<Object>);
 static_assert(std::is_trivially_copyable_v<Object>);
 

+ 9 - 7
Sunrise/src/middleware/datagen/family4/character/layout.h

@@ -185,15 +185,17 @@ static_assert(sizeof(EquipmentSummary)
               == kSummaryArrayCount * kEquipmentCapacity * sizeof(EquipmentSummaryEntry)
                      + kSummaryIntegerCount * sizeof(std::int32_t)
                      + kSummaryScalarCount * sizeof(float));
-static_assert(sizeof(InventoryChangeRecord) == 12);
-static_assert(offsetof(InventoryChangeRecord, sequence) == 0);
-static_assert(offsetof(InventoryChangeRecord, mutationSerial) == 4);
-static_assert(offsetof(InventoryChangeRecord, kind) == 8);
-static_assert(offsetof(InventoryChangeRecord, flags) == 10);
+static_assert(sizeof(InventoryChangeRecord)
+              == 3 * sizeof(std::uint16_t) + sizeof(std::int32_t) + 2 * sizeof(std::uint8_t));
+static_assert(offsetof(InventoryChangeRecord, mutationSerial) == 2 * sizeof(std::uint16_t));
+static_assert(offsetof(InventoryChangeRecord, kind)
+              == 2 * sizeof(std::uint16_t) + sizeof(std::int32_t));
+static_assert(offsetof(InventoryChangeRecord, flags)
+              == 2 * sizeof(std::uint16_t) + sizeof(std::int32_t) + 2 * sizeof(std::uint8_t));
 static_assert(sizeof(InventoryChangeList)
-              == sizeof(std::uint32_t)
+              == 2 * sizeof(std::uint16_t)
                      + kInventoryChangeRecordCapacity * sizeof(InventoryChangeRecord));
-static_assert(offsetof(InventoryChangeList, records) == 4);
+static_assert(offsetof(InventoryChangeList, records) == 2 * sizeof(std::uint16_t));
 static_assert(sizeof(Object) == kObjectSize);
 static_assert(std::is_trivially_copyable_v<Object>);
 

+ 3 - 7
Sunrise/src/server/web_service/web_service_runtime.cpp

@@ -52,13 +52,9 @@ constexpr std::size_t kNoMutation = 0;
 constexpr std::int32_t kRefusedStatus = 1;
 
 /**
- * Logs which Web Service opcode arrived and a bounded payload trace. One svc-10 frame looks like
- *
- * any other in the log, and the opcodes and bit descriptors the Client sends drive its queuez
- *
- * state machine. The bounded hex is diagnostic protocol evidence, not a second parser.
- * @param
- * message Parsed request envelope and borrowed payload.
+ * Logs the Web Service opcode and a bounded payload trace.
+ * One svc-10 frame looks like any other, and the opcode drives the client's queuez state machine.
+ * @param message Parsed request envelope and borrowed payload.
  */
 void report_request(const middleware::web_service::Message& message) noexcept {
     std::array<char, core::log::kLineCapacity> line{};

+ 11 - 0
Sunrise/src/state/build_data/material_requirements/material_requirement_catalog.cpp

@@ -17,6 +17,12 @@ void clear() noexcept {
     g_definitions.clear();
 }
 
+/**
+ * Checks one complete requirement-set table before it is published.
+ * A set owns its index, so a duplicate or out-of-range index rejects the whole table.
+ * @param definitions Candidate rows, indexed by requirement-set index.
+ * @return True when every set is unique and in range, and its unused rows are clear.
+ */
 bool valid(std::span<const Definition> definitions) noexcept {
     if (definitions.empty() || definitions.size() > kDefinitionCapacity) {
         return false;
@@ -53,6 +59,11 @@ bool valid(std::span<const Definition> definitions) noexcept {
     return true;
 }
 
+/**
+ * Validates one table and publishes it, placing each set at its own index.
+ * @param definitions Candidate rows, rejected as a whole when any row is invalid.
+ * @return True when the table replaced the published one.
+ */
 bool replace(std::span<const Definition> definitions) noexcept {
     if (!valid(definitions)) {
         return false;