From e1d9e25c292298d5211860bd111eafca90715be4 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 20:20:58 +0000 Subject: [PATCH] Decompile fn_06320 (GameSettings::ApplyScriptOption) Batch #1686 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_06320 GameSettings::ApplyScriptOption: logic confirmed by peer review Reviewed-by: ragnarok-clanker --- .../Contents/Configuration/ServiceOptions.cpp | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Source/Contents/Configuration/ServiceOptions.cpp b/Source/Contents/Configuration/ServiceOptions.cpp index e5b97809..7fb2f2bb 100644 --- a/Source/Contents/Configuration/ServiceOptions.cpp +++ b/Source/Contents/Configuration/ServiceOptions.cpp @@ -1,4 +1,28 @@ #include "Contents/Configuration/ServiceOptions.h" +#include "Contents/Configuration/ScriptOptions.h" + +#include +#include + +struct GameSettingsOption { + /* 0000 */ int id; + /* 0004 */ unsigned char unknown_0004[0x54]; + /* 0058 */ unsigned char defaultValue; + /* 0059 */ unsigned char unknown_0059[0xB]; +}; + +struct GameSettings { + /* 0000 */ unsigned char unknown_0000[0xC]; + /* 000C */ std::vector options; + + void ApplyScriptOption(int id, const char* key, ScriptOptions& script); +}; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(GameSettingsOption) == 0x64); +static_assert(offsetof(GameSettingsOption, defaultValue) == 0x58); +static_assert(offsetof(GameSettings, options) == 0x0C); +#endif // GLOBAL: gl_24579 ServiceOptions g_serviceOptions; @@ -37,3 +61,16 @@ bool ServiceOptions::Set(int id, unsigned char value) { entry->second = value; return true; } + +// OFFSET: 0x006C1900 +// FUNCTION: fn_06320 +void GameSettings::ApplyScriptOption(int id, const char* key, ScriptOptions& script) { + for (const GameSettingsOption& option : this->options) { + if (option.id != id) { + continue; + } + + g_serviceOptions.Set(id, script.Integer(key, option.defaultValue) != 0); + return; + } +}