Maintenance: [forced, user-approved] Family G27 (resubmit of 10254 rebased on e235d90a; only conflict was the AsyncWorkMgr.h forward

Batch #10259 by ragnarok-clanker: forced by an admin (1 lower score(s), 11 changed function(s)); checked with 508 compiled unit(s), including every includer of Source/Contents/Async/AsyncWorkMgr.h, Source/Contents/Skills/SkillLevelRegistry.h, Source/Contents/UserData/CharacterLinkedUserDataLoadAsyncWork.h, Source/Contents/UserData/CharacterLinkedUserDataMgr.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl, Source/Contents/Skills/SkillLevelConfig.h, Source/Contents/UserData/CharacterConfigLoad.h, Source/UI/Shortcuts/NormalItemSlotLoad.h.
Deletes: Source/Contents/Skills/SkillLevelConfig.h, Source/Contents/UserData/CharacterConfigLoad.h, Source/UI/Shortcuts/NormalItemSlotLoad.h
This commit is contained in:
ragnarok-clanker 2026-11-03 13:32:00 +00:00
commit bd0ade90cd
16 changed files with 63 additions and 124 deletions

View file

@ -112,12 +112,12 @@ void CAsyncWorkMgr::ChangePartyMaster(
// OFFSET: 0x00574190
// FUNCTION: fn_02502
void CAsyncWorkMgr::LoadCharacter(
std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, CharacterConfigLoad& context
std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token
) {
NAsyncWorkPtr work(this->m_pools, "CharacterLinkedUserData_Load");
if (work.Get()) {
static_cast<CCharacterLinkedUserDataLoadAsyncWork*>(work.Get())->Bind(accountId, characterId, world, url, token, context);
static_cast<CCharacterLinkedUserDataLoadAsyncWork*>(work.Get())->Bind(accountId, characterId, world, url, token);
this->Submit(work);
}
}

View file

@ -9,7 +9,6 @@ class CConnection;
class CEmblemDataMgr;
#include "UI/Window/WindowManagerWindows.h"
struct AccountConfigLoad;
struct CharacterConfigLoad;
class CAsyncWorkMgr : public NAsyncWorkMgr {
public:
@ -25,7 +24,7 @@ public:
std::uint32_t accountId, std::uint32_t characterId, std::string characterName, std::uint32_t targetAccountId, std::uint32_t targetCharacterId,
std::string targetName, std::string world, std::string url, std::string token, WindowManagerWindows& windows
);
void LoadCharacter(std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, CharacterConfigLoad& context);
void LoadCharacter(std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token);
void SaveCharacter(std::uint32_t accountId, std::uint32_t characterId, std::string world, std::string url, std::string token, std::string data);
void DownloadEmblem(
std::string url, std::uint32_t accountId, std::string token, std::string world, std::uint32_t guildId, std::uint32_t version, CConnection& connection

View file

@ -1,10 +1,13 @@
#include "Contents/Skills/SkillLevelConfig.h"
#include "Client/Session.h"
#include "Contents/UserData/CharacterLinkedUserDataMgr.h"
#include <json/value.h>
#include <cstdint>
// OFFSET: 0x005E6A10
// FUNCTION: fn_03930
void LoadUseSkillLevels(Json::Value& data, int* levels) {
void CCharacterLinkedUserDataMgr::LoadUseSkillLevels(Json::Value& data) {
Json::Value values = data["UseSkillInfo"];
if (!values.isNull()) {
for (auto it = values.begin(); it != values.end(); ++it) {
@ -12,9 +15,7 @@ void LoadUseSkillLevels(Json::Value& data, int* levels) {
if (value.isObject()) {
int id = value.get("SKID", 0).asInt();
int level = value.get("SKLv", 0).asInt();
if (static_cast<std::uint32_t>(id) - 1 <= 0x1F3D) {
levels[id] = level;
}
g_session.m_skillBundle.SetUnknownValue(id, level);
}
}
}
@ -22,7 +23,7 @@ void LoadUseSkillLevels(Json::Value& data, int* levels) {
// OFFSET: 0x005E63B0
// FUNCTION: fn_03928
void LoadHomunculusSkillLevels(Json::Value& data, int* levels) {
void CCharacterLinkedUserDataMgr::LoadHomunculusSkillLevels(Json::Value& data) {
Json::Value values = data["HomunSkillInfo"];
if (!values.isNull()) {
for (auto it = values.begin(); it != values.end(); ++it) {
@ -31,10 +32,7 @@ void LoadHomunculusSkillLevels(Json::Value& data, int* levels) {
int id = value.get("HomunSKID", 0).asInt();
int level = value.get("HomunSKLv", 0).asInt();
std::uint32_t index = static_cast<std::uint32_t>(id) - 8000;
if (static_cast<std::int32_t>(index) > -1) {
levels[index] = level;
}
g_session.SetHomunSkillLevel(id, level);
}
}
}

View file

@ -1,9 +0,0 @@
#ifndef RAGNAROK_SOURCE_CONTENTS_SKILLS_SKILLLEVELCONFIG_H
#define RAGNAROK_SOURCE_CONTENTS_SKILLS_SKILLLEVELCONFIG_H
#include <json/value.h>
void LoadUseSkillLevels(Json::Value& data, int* levels);
void LoadHomunculusSkillLevels(Json::Value& data, int* levels);
#endif

View file

@ -1,4 +1,6 @@
#include "Contents/Skills/SkillInfo.h"
#include "Client/Registry.h"
#include "Client/Session.h"
#include "Contents/Skills/SkillLevelRegistry.h"
#include "Script/LuaScript.h"
@ -9,9 +11,9 @@
// OFFSET: 0x00A92370
// FUNCTION: fn_17177
void SkillLevelRegistry::Load() {
void LoadSkillUseLevelRegistry() {
char key[512];
std::strcpy(key, this->baseKey);
std::strcpy(key, g_subKey);
std::strcat(key, "\\SkillUseLevelInfo");
HKEY handle;
@ -30,11 +32,11 @@ void SkillLevelRegistry::Load() {
DWORD size = sizeof(int);
int value;
char name[100] = {};
const int character = this->character;
const char* skill = CSkillInfo::IdName(this->script, id);
const int character = g_session.unknown_0F50;
const char* skill = CSkillInfo::IdName(*g_luaScript, id);
std::sprintf(name, "%s%d", skill, character);
if (RegQueryValueExA(handle, name, nullptr, &type, reinterpret_cast<BYTE*>(&value), &size) != ERROR_SUCCESS || !CSkillInfo::UsesLevel(this->script, id)) {
if (RegQueryValueExA(handle, name, nullptr, &type, reinterpret_cast<BYTE*>(&value), &size) != ERROR_SUCCESS || !CSkillInfo::UsesLevel(*g_luaScript, id)) {
return 0;
}
@ -42,15 +44,15 @@ void SkillLevelRegistry::Load() {
};
for (int id = 1; id < 7999; ++id) {
this->useLevels[id] = read(id);
g_session.m_skillBundle.SetUnknownValue(id, read(id));
}
for (int id = 8000; id < 8061; ++id) {
this->homunculusLevels[id - 8000] = read(id);
g_session.SetHomunSkillLevel(id, read(id));
}
for (int id = 8200; id < 8458; ++id) {
this->otherLevels[id - 8200] = read(id);
g_session.SetMercSkillLevel(id, read(id));
}
RegCloseKey(handle);

View file

@ -1,17 +1,6 @@
#ifndef RAGNAROK_SOURCE_CONTENTS_SKILLS_SKILLLEVELREGISTRY_H
#define RAGNAROK_SOURCE_CONTENTS_SKILLS_SKILLLEVELREGISTRY_H
class LuaScript;
struct SkillLevelRegistry {
LuaScript& script;
const char* baseKey;
const int& character;
int* useLevels;
int* homunculusLevels;
int* otherLevels;
void Load();
};
void LoadSkillUseLevelRegistry();
#endif

View file

@ -1,11 +1,9 @@
#include "Client/Session.h"
#include "Contents/Async/AsyncWorkMgr.h"
#include "Contents/UserData/CharacterConfigLoad.h"
#include "Contents/UserData/CharacterLinkedUserDataMgr.h"
#include "Contents/Configuration/ServiceOptions.h"
#include "Contents/Skills/SkillLevelConfig.h"
#include "Contents/Skills/SkillLevelRegistry.h"
#include "UI/Shortcuts/NormalItemSlotLoad.h"
#include "UI/Window/UIWindowMgr.h"
#include "Utility/Async/AsyncDiagnostic.h"
#include <json/reader.h>
@ -14,7 +12,7 @@
// OFFSET: 0x005E6090
// FUNCTION: fn_03927
void CCharacterLinkedUserDataMgr::CompleteLoad(
AsyncDiagnostic diagnostic, std::uint32_t accountId, std::uint32_t characterId, std::string accountName, std::string response, CharacterConfigLoad& context
AsyncDiagnostic diagnostic, std::uint32_t accountId, std::uint32_t characterId, std::string accountName, std::string response
) {
if (!diagnostic.success) {
return;
@ -31,22 +29,21 @@ void CCharacterLinkedUserDataMgr::CompleteLoad(
const int type = root["Type"].asInt();
if (type == 4) {
context.registry.Load();
LoadSkillUseLevelRegistry();
g_session.SetOption(7, 1, 0);
g_session.SetOption(8, 1, 0);
this->m_loaded = true;
} else if (type == 1) {
Json::Value& data = root["data"];
LoadUseSkillLevels(data, context.useLevels);
LoadHomunculusSkillLevels(data, context.homunculusLevels);
this->LoadUseSkillLevels(root["data"]);
this->LoadHomunculusSkillLevels(root["data"]);
const Json::Value comparison = data["ItemComparison"];
context.serviceOptions.Set(264, comparison.isNull() ? true : comparison.asBool());
const Json::Value comparison = root["data"]["ItemComparison"];
g_serviceOptions.Set(264, comparison.isNull() ? true : comparison.asBool());
const Json::Value sorting = data["SortPrivateTab"];
context.sortPrivate = sorting.isNull() ? false : sorting.asBool();
const Json::Value sorting = root["data"]["SortPrivateTab"];
g_sortPrivateTab = sorting.isNull() ? false : sorting.asBool();
LoadNormalItemSlots(data, context.items, context.saved, context.itemSlotActive, context.windows);
this->LoadNormalItemSlots(root["data"]);
this->m_loaded = true;
}
@ -57,14 +54,12 @@ void CCharacterLinkedUserDataMgr::CompleteLoad(
// OFFSET: 0x005E6E20
// FUNCTION: fn_03932
void CCharacterLinkedUserDataMgr::Load(
std::uint32_t accountId, std::uint32_t characterId, std::string accountName, const char* token16, CAsyncWorkMgr& workManager, CharacterConfigLoad& context
) {
void CCharacterLinkedUserDataMgr::Load(std::uint32_t accountId, std::uint32_t characterId, std::string accountName) {
if (accountId == 0 || characterId == 0) {
return;
}
const std::string token(token16, 16);
const std::string token(reinterpret_cast<const char*>(&g_session.unknown_807C[0x08]), 16);
const std::string url = this->LoadUrl();
workManager.LoadCharacter(accountId, characterId, accountName, url, token, context);
g_asyncWorkMgr->LoadCharacter(accountId, characterId, accountName, url, token);
}

View file

@ -1,22 +0,0 @@
#ifndef RAGNAROK_SOURCE_CONTENTS_USERDATA_CHARACTERCONFIGLOAD_H
#define RAGNAROK_SOURCE_CONTENTS_USERDATA_CHARACTERCONFIGLOAD_H
struct NormalItemSlot;
struct NormalItemSlotWindow;
struct ServiceOptions;
struct SkillLevelRegistry;
#include "UI/Window/WindowManagerWindows.h"
struct CharacterConfigLoad {
int* useLevels;
int* homunculusLevels;
ServiceOptions& serviceOptions;
SkillLevelRegistry& registry;
bool& sortPrivate;
NormalItemSlot* items;
NormalItemSlotWindow& saved;
bool& itemSlotActive;
WindowManagerWindows& windows;
};
#endif

View file

@ -22,7 +22,7 @@ namespace {
// OFFSET: 0x005E4A50
// FUNCTION: fn_03916
CCharacterLinkedUserDataLoadAsyncWork::CCharacterLinkedUserDataLoadAsyncWork()
: NAsyncWork("CharacterLinkedUserData_Load"), m_accountId(0), m_characterId(0), m_diagnostic(Diagnostic(false, "unknwon", 29)), m_context(nullptr) {
: NAsyncWork("CharacterLinkedUserData_Load"), m_accountId(0), m_characterId(0), m_diagnostic(Diagnostic(false, "unknwon", 29)) {
}
// INLINED
@ -36,7 +36,7 @@ void CCharacterLinkedUserDataLoadAsyncWork::Reset() {
// OFFSET: 0x005E4F10
// FUNCTION: fn_03918
void CCharacterLinkedUserDataLoadAsyncWork::Bind(
std::uint32_t accountId, std::uint32_t characterId, std::string accountName, std::string url, std::string token, CharacterConfigLoad& context
std::uint32_t accountId, std::uint32_t characterId, std::string accountName, std::string url, std::string token
) {
this->m_group = timeGetTime();
this->m_accountId = accountId;
@ -46,7 +46,6 @@ void CCharacterLinkedUserDataLoadAsyncWork::Bind(
this->m_url = url;
this->m_token = token;
this->m_response.clear();
this->m_context = &context;
AsyncDiagnostic diagnostic = Diagnostic(false, "unknwon", 55);
this->m_diagnostic.MoveFrom(diagnostic);
@ -80,6 +79,6 @@ bool CCharacterLinkedUserDataLoadAsyncWork::Execute() {
// FUNCTION: fn_03920
void CCharacterLinkedUserDataLoadAsyncWork::Complete() {
g_characterLinkedUserDataMgr->CompleteLoad(
this->m_diagnostic, this->m_accountId, this->m_characterId, this->m_accountName, this->m_response, *this->m_context
this->m_diagnostic, this->m_accountId, this->m_characterId, this->m_accountName, this->m_response
);
}

View file

@ -4,8 +4,6 @@
#include "Utility/Async/AsyncDiagnostic.h"
#include "Utility/Async/NAsyncWork.h"
struct CharacterConfigLoad;
class CCharacterLinkedUserDataLoadAsyncWork : public NAsyncWork {
public:
CCharacterLinkedUserDataLoadAsyncWork();
@ -13,7 +11,7 @@ public:
void Reset() override;
bool Execute() override;
void Complete() override;
void Bind(std::uint32_t accountId, std::uint32_t characterId, std::string accountName, std::string url, std::string token, CharacterConfigLoad& context);
void Bind(std::uint32_t accountId, std::uint32_t characterId, std::string accountName, std::string url, std::string token);
protected:
/* 0028 */ std::uint32_t m_accountId;
@ -23,12 +21,10 @@ protected:
/* 0060 */ std::string m_token;
/* 0078 */ std::string m_response;
/* 0090 */ AsyncDiagnostic m_diagnostic;
CharacterConfigLoad* m_context;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CCharacterLinkedUserDataLoadAsyncWork) == 204);
static_assert(sizeof(CCharacterLinkedUserDataLoadAsyncWork) == 200);
#endif
#endif

View file

@ -6,7 +6,9 @@
class LuaScript;
struct AsyncDiagnostic;
struct CharacterConfigLoad;
namespace Json {
class Value;
}
struct CharacterConfigSave;
class CAsyncWorkMgr;
@ -19,12 +21,11 @@ public:
std::string LoadUrl() const;
std::string SaveUrl() const;
void CompleteSave();
void CompleteLoad(
AsyncDiagnostic diagnostic, std::uint32_t accountId, std::uint32_t characterId, std::string accountName, std::string response, CharacterConfigLoad& context
);
void Load(
std::uint32_t accountId, std::uint32_t characterId, std::string accountName, const char* token16, CAsyncWorkMgr& workManager, CharacterConfigLoad& context
);
void CompleteLoad(AsyncDiagnostic diagnostic, std::uint32_t accountId, std::uint32_t characterId, std::string accountName, std::string response);
void Load(std::uint32_t accountId, std::uint32_t characterId, std::string accountName);
void LoadUseSkillLevels(Json::Value& data);
void LoadHomunculusSkillLevels(Json::Value& data);
void LoadNormalItemSlots(Json::Value& data);
void Save(CharacterConfigSave& context, const char* token16, CAsyncWorkMgr& workManager);
void RefreshUrls(LuaScript& script, const char* host, const char* port, const char* overrideKey);
void Reset(LuaScript& script, const char* host, const char* port, const char* overrideKey);
@ -41,6 +42,7 @@ protected:
};
extern CCharacterLinkedUserDataMgr* g_characterLinkedUserDataMgr;
extern bool g_sortPrivateTab;
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CCharacterLinkedUserDataMgr) == 96);

View file

@ -1,23 +1,25 @@
#include "UI/Shortcuts/NormalItemSlotLoad.h"
#include "Client/Session.h"
#include "Contents/UserData/CharacterLinkedUserDataMgr.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/UIWindowMgr.inl"
#include "UI/Window/UIWindow.h"
#include "UI/Window/WindowManagerWindows.h"
#include <cstring>
#include <json/value.h>
// OFFSET: 0x005E65E0
// FUNCTION: fn_03929
void LoadNormalItemSlots(
Json::Value& data, NormalItemSlot* slots, NormalItemSlotWindow& saved, bool& itemSlotActive, WindowManagerWindows& windows
) {
void CCharacterLinkedUserDataMgr::LoadNormalItemSlots(Json::Value& data) {
NormalItemSlotWindow& saved = g_windowMgr.m_normalItemSlotWindow;
bool& itemSlotActive = g_session.ItemSlotActive();
Json::Value& values = data["NormalItemSlot"];
if (values.isNull()) {
return;
}
std::memset(slots, 0, 9 * sizeof(NormalItemSlot));
g_session.ClearNormalItemSlots();
for (auto entry = values.begin(); entry != values.end(); ++entry) {
Json::Value& value = *entry;
@ -28,7 +30,7 @@ void LoadNormalItemSlots(
const int item = value.get("ItemID", 0).asInt();
const int index = value.get("SlotNum", 0).asInt();
slots[index].itemId = static_cast<std::uint32_t>(item);
g_session.m_normalItemSlots[index].itemId = static_cast<std::uint32_t>(item);
}
Json::Value& info = data["SlotInfo"];
@ -52,7 +54,7 @@ void LoadNormalItemSlots(
Json::Value& active = data["ItemSlotActive"];
itemSlotActive = active.isNull() ? true : active.asBool();
UIWindow* window = windows.LookupWindow(36);
UIWindow* window = g_windowMgr.LookupWindow(36);
if (!window) {
return;

View file

@ -1,12 +0,0 @@
#ifndef RAGNAROK_SOURCE_UI_SHORTCUTS_NORMALITEMSLOTLOAD_H
#define RAGNAROK_SOURCE_UI_SHORTCUTS_NORMALITEMSLOTLOAD_H
#include "Contents/UserData/NormalItemSlots.h"
#include "UI/Window/WindowManagerWindows.h"
void LoadNormalItemSlots(
Json::Value& data, NormalItemSlot* slots, NormalItemSlotWindow& saved, bool& itemSlotActive, WindowManagerWindows& windows
);
#endif

View file

@ -1299,7 +1299,7 @@ void UIWindowMgr::ApplyReplayOptions(const ReplayOptions& options) {
this->unknown_077C = 0;
this->unknown_05BC = 0;
this->unknown_05D0 = 0;
this->unknown_0758 = options.unknown_0007;
this->m_normalItemSlotWindow.show = options.unknown_0007;
this->unknown_003C = options.recordRestricted;
}

View file

@ -354,8 +354,8 @@ public:
/* 05D0 */ int unknown_05D0;
/* 05D4 */ unsigned char unknown_05D4[0x168];
/* 073C */ int unknown_073C;
/* 0740 */ unsigned char unknown_0740[0x18];
/* 0758 */ int unknown_0758;
/* 0740 */ unsigned char unknown_0740[0x08];
/* 0748 */ NormalItemSlotWindow m_normalItemSlotWindow;
/* 075C */ unsigned char unknown_075C[0x20];
/* 077C */ int unknown_077C;
/* 0780 */ unsigned char unknown_0780[0x10];

View file

@ -12,7 +12,7 @@ inline bool UIWindowMgr::ShowShortcutWindow(int value) {
return false;
}
this->unknown_0758 = value;
this->m_normalItemSlotWindow.show = value;
g_windowMgr.EnsureWindow(36);
this->window_01E8->Show(value);