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.
This commit is contained in:
parent
7aa8e144c3
commit
78400d137c
2 changed files with 48 additions and 27 deletions
|
|
@ -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<void(__thiscall*)(JsonCppLoaderJsonHandler*, JsonCppLoaderJsonHandler*)>(fn_00198)(this, this);
|
||||
reinterpret_cast<void(__thiscall*)(JsonCppLoaderJsonHandler*, JsonCppLoaderJsonHandler*)>(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<unsigned char>* 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<unsigned char>* 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<void(__thiscall*)(JsonValue*)>(fn_00367)(&this->value);
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*)>(JsonDestroy)(&this->value);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -101,7 +103,7 @@ struct JsonCppLoaderJsonOptionsGuard {
|
|||
|
||||
// INLINED
|
||||
~JsonCppLoaderJsonOptionsGuard() {
|
||||
reinterpret_cast<void(__thiscall*)(JsonCppLoaderJsonOptions*)>(fn_00368)(reinterpret_cast<JsonCppLoaderJsonOptions*>(reinterpret_cast<unsigned char*>(this->options) + 8));
|
||||
reinterpret_cast<void(__thiscall*)(JsonCppLoaderJsonOptions*)>(JsonOptionsCommonDestroy)(reinterpret_cast<JsonCppLoaderJsonOptions*>(reinterpret_cast<unsigned char*>(this->options) + 8));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -115,12 +117,12 @@ bool JsonCppLoader::LoadBson(const std::string& path) {
|
|||
}
|
||||
|
||||
JsonCppLoaderBsonOptions optionStorage;
|
||||
JsonCppLoaderBsonOptions* options = reinterpret_cast<JsonCppLoaderBsonOptions*(__thiscall*)(JsonCppLoaderBsonOptions*, int)>(fn_00349)(&optionStorage, 1);
|
||||
JsonCppLoaderBsonOptions* options = reinterpret_cast<JsonCppLoaderBsonOptions*(__thiscall*)(JsonCppLoaderBsonOptions*, int)>(BsonDecodeOptionsConstruct)(&optionStorage, 1);
|
||||
{
|
||||
JsonCppLoaderParsedValue parsed;
|
||||
JsonValue* result = static_cast<JsonValue*>(fn_00272(&parsed.value, &file, options));
|
||||
JsonValue* result = static_cast<JsonValue*>(JsonDecodeBsonStream(&parsed.value, &file, options));
|
||||
if (&this->document != result) {
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*, JsonValue*)>(fn_00769)(&this->document, result);
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*, JsonValue*)>(JsonSwap)(&this->document, result);
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
|
|
@ -142,12 +144,12 @@ bool JsonCppLoader::LoadJson(const std::string& path) {
|
|||
}
|
||||
|
||||
JsonCppLoaderJsonOptions optionStorage;
|
||||
JsonCppLoaderJsonOptionsGuard options{reinterpret_cast<JsonCppLoaderJsonOptions*(__thiscall*)(JsonCppLoaderJsonOptions*, int)>(fn_00321)(&optionStorage, 1)};
|
||||
JsonCppLoaderJsonOptionsGuard options{reinterpret_cast<JsonCppLoaderJsonOptions*(__thiscall*)(JsonCppLoaderJsonOptions*, int)>(JsonDecodeOptionsConstruct)(&optionStorage, 1)};
|
||||
{
|
||||
JsonCppLoaderParsedValue parsed;
|
||||
JsonValue* result = static_cast<JsonValue*>(fn_00733(&parsed.value, &file, options.options, JsonCppLoaderJsonHandler{}));
|
||||
JsonValue* result = static_cast<JsonValue*>(JsonParseStream(&parsed.value, &file, options.options, JsonCppLoaderJsonHandler{}));
|
||||
if (&this->document != result) {
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*, JsonValue*)>(fn_00769)(&this->document, result);
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*, JsonValue*)>(JsonSwap)(&this->document, result);
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
|
|
@ -192,11 +194,11 @@ __declspec(noinline) bool JsonCppLoader::LoadBson(std::vector<unsigned char>& bu
|
|||
|
||||
try {
|
||||
JsonCppLoaderBsonOptions optionStorage;
|
||||
JsonCppLoaderBsonOptions* options = reinterpret_cast<JsonCppLoaderBsonOptions*(__thiscall*)(JsonCppLoaderBsonOptions*, int)>(fn_00349)(&optionStorage, 1);
|
||||
JsonCppLoaderBsonOptions* options = reinterpret_cast<JsonCppLoaderBsonOptions*(__thiscall*)(JsonCppLoaderBsonOptions*, int)>(BsonDecodeOptionsConstruct)(&optionStorage, 1);
|
||||
JsonCppLoaderParsedValue parsed;
|
||||
JsonValue* result = static_cast<JsonValue*>(fn_00273(&parsed.value, &buffer, options));
|
||||
JsonValue* result = static_cast<JsonValue*>(JsonDecodeBsonBuffer(&parsed.value, &buffer, options));
|
||||
if (&this->document != result) {
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*, JsonValue*)>(fn_00769)(&this->document, result);
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*, JsonValue*)>(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<unsigned char>& bu
|
|||
|
||||
try {
|
||||
JsonCppLoaderJsonOptions optionStorage;
|
||||
JsonCppLoaderJsonOptionsGuard options{reinterpret_cast<JsonCppLoaderJsonOptions*(__thiscall*)(JsonCppLoaderJsonOptions*, int)>(fn_00321)(&optionStorage, 1)};
|
||||
JsonCppLoaderJsonOptionsGuard options{reinterpret_cast<JsonCppLoaderJsonOptions*(__thiscall*)(JsonCppLoaderJsonOptions*, int)>(JsonDecodeOptionsConstruct)(&optionStorage, 1)};
|
||||
JsonCppLoaderParsedValue parsed;
|
||||
JsonValue* result = static_cast<JsonValue*>(fn_00734(&parsed.value, buffer.data(), options.options, JsonCppLoaderJsonHandler{}));
|
||||
JsonValue* result = static_cast<JsonValue*>(JsonParseString(&parsed.value, buffer.data(), options.options, JsonCppLoaderJsonHandler{}));
|
||||
if (&this->document != result) {
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*, JsonValue*)>(fn_00769)(&this->document, result);
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*, JsonValue*)>(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<unsigned char>& bu
|
|||
return true;
|
||||
}
|
||||
|
||||
// OFFSET: 0x004EEC60
|
||||
// FUNCTION: fn_00337
|
||||
JsonCppLoader::JsonCppLoader() : loaded(false), succeeded(true) {
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*, const JsonValue*)>(JsonCopyConstruct)(&this->document, static_cast<const JsonValue*>(JsonNull()));
|
||||
}
|
||||
|
||||
// OFFSET: 0x004F2840
|
||||
// FUNCTION: fn_00446
|
||||
JsonCppLoader::~JsonCppLoader() {
|
||||
reinterpret_cast<void(__thiscall*)(JsonValue*)>(JsonDestroy)(&this->document);
|
||||
}
|
||||
|
||||
// OFFSET: 0x004F4180
|
||||
// FUNCTION: fn_00491
|
||||
void JsonCppLoader::Fail(const char* format, ...) {
|
||||
|
|
|
|||
|
|
@ -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<int, ReputeGroupRecord>* out);
|
||||
bool GetReputeInfoData(std::map<int, ReputeInfoRecord>* 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue