From 78400d137cedca6938bbb4e7f410c39e000e09a1 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 6 Nov 2026 22:56:52 +0000 Subject: [PATCH] Maintenance: Forced (maintainer policy, as 13484/13494: small score loss accepted for correct behaviour). JsonCppLoader had no constr Batch #13820 by ragnarok-clanker: forced by an admin (2 lower score(s), 9 changed function(s)); checked with 6 compiled unit(s), including every includer of Source/Utility/JsonCppLoader.h. --- Source/Utility/JsonCppLoader.cpp | 66 +++++++++++++++++++------------- Source/Utility/JsonCppLoader.h | 9 ++++- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/Source/Utility/JsonCppLoader.cpp b/Source/Utility/JsonCppLoader.cpp index ac111ed03..f604fb6b7 100644 --- a/Source/Utility/JsonCppLoader.cpp +++ b/Source/Utility/JsonCppLoader.cpp @@ -57,14 +57,14 @@ struct JsonCppLoaderJsonOptions { unsigned char storage[248]; }; -extern "C" void fn_00198(); +extern "C" void JsonDefaultParsingHandler(); struct JsonCppLoaderJsonHandler { unsigned char storage[40]; // INLINED JsonCppLoaderJsonHandler() { - reinterpret_cast(fn_00198)(this, this); + reinterpret_cast(JsonDefaultParsingHandler)(this, this); } JsonCppLoaderJsonHandler(const JsonCppLoaderJsonHandler&) = delete; @@ -75,16 +75,18 @@ struct JsonCppLoaderJsonHandler { }; extern "C" { -void fn_00349(); -void fn_00321(); -void fn_00368(); -void fn_00198(); -void* __cdecl fn_00272(JsonValue* out, std::ifstream* file, JsonCppLoaderBsonOptions* options); -void* __cdecl fn_00273(JsonValue* out, const std::vector* buffer, JsonCppLoaderBsonOptions* options); -void* __cdecl fn_00733(JsonValue* out, std::ifstream* file, JsonCppLoaderJsonOptions* options, JsonCppLoaderJsonHandler handler); -void* __cdecl fn_00734(JsonValue* out, const unsigned char* data, JsonCppLoaderJsonOptions* options, JsonCppLoaderJsonHandler handler); -void fn_00769(); -void fn_00367(); +void BsonDecodeOptionsConstruct(); +void JsonDecodeOptionsConstruct(); +void JsonOptionsCommonDestroy(); +void JsonDefaultParsingHandler(); +void* __cdecl JsonDecodeBsonStream(JsonValue* out, std::ifstream* file, JsonCppLoaderBsonOptions* options); +void* __cdecl JsonDecodeBsonBuffer(JsonValue* out, const std::vector* buffer, JsonCppLoaderBsonOptions* options); +void* __cdecl JsonParseStream(JsonValue* out, std::ifstream* file, JsonCppLoaderJsonOptions* options, JsonCppLoaderJsonHandler handler); +void* __cdecl JsonParseString(JsonValue* out, const unsigned char* data, JsonCppLoaderJsonOptions* options, JsonCppLoaderJsonHandler handler); +void JsonSwap(); +void JsonDestroy(); +void JsonCopyConstruct(); +void* __cdecl JsonNull(); } struct JsonCppLoaderParsedValue { @@ -92,7 +94,7 @@ struct JsonCppLoaderParsedValue { // INLINED ~JsonCppLoaderParsedValue() { - reinterpret_cast(fn_00367)(&this->value); + reinterpret_cast(JsonDestroy)(&this->value); } }; @@ -101,7 +103,7 @@ struct JsonCppLoaderJsonOptionsGuard { // INLINED ~JsonCppLoaderJsonOptionsGuard() { - reinterpret_cast(fn_00368)(reinterpret_cast(reinterpret_cast(this->options) + 8)); + reinterpret_cast(JsonOptionsCommonDestroy)(reinterpret_cast(reinterpret_cast(this->options) + 8)); } }; @@ -115,12 +117,12 @@ bool JsonCppLoader::LoadBson(const std::string& path) { } JsonCppLoaderBsonOptions optionStorage; - JsonCppLoaderBsonOptions* options = reinterpret_cast(fn_00349)(&optionStorage, 1); + JsonCppLoaderBsonOptions* options = reinterpret_cast(BsonDecodeOptionsConstruct)(&optionStorage, 1); { JsonCppLoaderParsedValue parsed; - JsonValue* result = static_cast(fn_00272(&parsed.value, &file, options)); + JsonValue* result = static_cast(JsonDecodeBsonStream(&parsed.value, &file, options)); if (&this->document != result) { - reinterpret_cast(fn_00769)(&this->document, result); + reinterpret_cast(JsonSwap)(&this->document, result); } } file.close(); @@ -142,12 +144,12 @@ bool JsonCppLoader::LoadJson(const std::string& path) { } JsonCppLoaderJsonOptions optionStorage; - JsonCppLoaderJsonOptionsGuard options{reinterpret_cast(fn_00321)(&optionStorage, 1)}; + JsonCppLoaderJsonOptionsGuard options{reinterpret_cast(JsonDecodeOptionsConstruct)(&optionStorage, 1)}; { JsonCppLoaderParsedValue parsed; - JsonValue* result = static_cast(fn_00733(&parsed.value, &file, options.options, JsonCppLoaderJsonHandler{})); + JsonValue* result = static_cast(JsonParseStream(&parsed.value, &file, options.options, JsonCppLoaderJsonHandler{})); if (&this->document != result) { - reinterpret_cast(fn_00769)(&this->document, result); + reinterpret_cast(JsonSwap)(&this->document, result); } } file.close(); @@ -192,11 +194,11 @@ __declspec(noinline) bool JsonCppLoader::LoadBson(std::vector& bu try { JsonCppLoaderBsonOptions optionStorage; - JsonCppLoaderBsonOptions* options = reinterpret_cast(fn_00349)(&optionStorage, 1); + JsonCppLoaderBsonOptions* options = reinterpret_cast(BsonDecodeOptionsConstruct)(&optionStorage, 1); JsonCppLoaderParsedValue parsed; - JsonValue* result = static_cast(fn_00273(&parsed.value, &buffer, options)); + JsonValue* result = static_cast(JsonDecodeBsonBuffer(&parsed.value, &buffer, options)); if (&this->document != result) { - reinterpret_cast(fn_00769)(&this->document, result); + reinterpret_cast(JsonSwap)(&this->document, result); } } catch (const std::exception& exception) { this->Fail("error : JsonCppLoader::LoadBson failed (reason : %s)", exception.what()); @@ -221,11 +223,11 @@ __declspec(noinline) bool JsonCppLoader::LoadJson(std::vector& bu try { JsonCppLoaderJsonOptions optionStorage; - JsonCppLoaderJsonOptionsGuard options{reinterpret_cast(fn_00321)(&optionStorage, 1)}; + JsonCppLoaderJsonOptionsGuard options{reinterpret_cast(JsonDecodeOptionsConstruct)(&optionStorage, 1)}; JsonCppLoaderParsedValue parsed; - JsonValue* result = static_cast(fn_00734(&parsed.value, buffer.data(), options.options, JsonCppLoaderJsonHandler{})); + JsonValue* result = static_cast(JsonParseString(&parsed.value, buffer.data(), options.options, JsonCppLoaderJsonHandler{})); if (&this->document != result) { - reinterpret_cast(fn_00769)(&this->document, result); + reinterpret_cast(JsonSwap)(&this->document, result); } } catch (const std::exception& exception) { this->Fail("error : JsonCppLoader::LoadJson failed (reason : %s)", exception.what()); @@ -235,6 +237,18 @@ __declspec(noinline) bool JsonCppLoader::LoadJson(std::vector& bu return true; } +// OFFSET: 0x004EEC60 +// FUNCTION: fn_00337 +JsonCppLoader::JsonCppLoader() : loaded(false), succeeded(true) { + reinterpret_cast(JsonCopyConstruct)(&this->document, static_cast(JsonNull())); +} + +// OFFSET: 0x004F2840 +// FUNCTION: fn_00446 +JsonCppLoader::~JsonCppLoader() { + reinterpret_cast(JsonDestroy)(&this->document); +} + // OFFSET: 0x004F4180 // FUNCTION: fn_00491 void JsonCppLoader::Fail(const char* format, ...) { diff --git a/Source/Utility/JsonCppLoader.h b/Source/Utility/JsonCppLoader.h index 81110d018..ea255fb51 100644 --- a/Source/Utility/JsonCppLoader.h +++ b/Source/Utility/JsonCppLoader.h @@ -204,6 +204,9 @@ inline const JsonObject* JsonValue::ObjectRange() const { class JsonCppLoader { public: + JsonCppLoader(); + virtual ~JsonCppLoader(); + JsonValue& GetValue(JsonValue& out, const std::string& key, const JsonValue& node, int expectedType); void Fail(const char* format, ...); bool LoadBson(const std::string& path); @@ -224,7 +227,10 @@ public: bool GetReputeGroupData(std::map* out); bool GetReputeInfoData(std::map* out); - /* 0000 */ unsigned char unknown_0000[0x08]; +private: + JsonCppLoader(const JsonCppLoader&) = delete; + +public: /* 0008 */ JsonValue document; /* 0018 */ std::string error; /* 0030 */ bool loaded; @@ -265,6 +271,7 @@ static_assert(offsetof(JsonCppLoader, document) == 0x08); static_assert(offsetof(JsonCppLoader, error) == 0x18); static_assert(offsetof(JsonCppLoader, loaded) == 0x30); static_assert(offsetof(JsonCppLoader, succeeded) == 0x31); +static_assert(sizeof(JsonCppLoader) == 0x38); #endif #endif