From bf6a44c1179ceaabaa68600b29e3d9ba2c810b77 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 26 Oct 2026 23:41:07 +0100 Subject: [PATCH] Group Utility units into subsystem folders and require OFFSET provenance Move Lexicon*, Text (TextTokens, TextEscapes, Base64), Math/RadialGrid, Hash (MD5, XxHash32) and Cipher (Rijndael, XorBytes) into Source/Utility subfolders; update includes, guards, compile.json and CMakeLists.txt. Backfill // OFFSET: above every standalone // FUNCTION: block (89 IDs, addresses from the symbol database) and make it mandatory in CODING_RULES.md and AGENTS.md. Remove the MatchLexicon cast chain. --- AGENTS.md | 8 ++++--- CMakeLists.txt | 6 ++--- CODING_RULES.md | 15 ++++++++----- Source/Archive/PakRegistry.cpp | 1 + Source/Client/Input/TraditionalKeyInput.cpp | 1 + Source/Client/Mode/ActiveGameMode.cpp | 1 + Source/Contents/ActorGeometry.cpp | 4 ++++ Source/Contents/ActorNameCard.cpp | 6 +++++ Source/Contents/Effects/AttachedEffect.cpp | 1 + Source/Contents/Effects/EffectAttachments.cpp | 1 + Source/Contents/GuildEmblemState.cpp | 4 ++++ Source/Contents/GuildMgr.cpp | 2 ++ Source/Contents/Items/ItemDescription.cpp | 2 ++ Source/Contents/Jobs/JobInheritance.cpp | 1 + Source/Contents/MessageTable.cpp | 2 +- Source/Contents/Models/ModelNode.cpp | 2 ++ Source/Contents/Models/ModelOcclusion.cpp | 1 + .../Contents/MovementRouteInterpolation.cpp | 2 ++ Source/Contents/World/WorldModelLoading.cpp | 1 + Source/Contents/World/WorldOcclusion.cpp | 1 + Source/Render/DX7/SurfaceDX7.cpp | 12 ++++++++++ Source/Render/DX9/DeviceOwnerDX9.cpp | 1 + Source/Render/DeviceContext/DCSurface.cpp | 11 ++++++++++ Source/Render/DeviceContext/DCSurface.h | 1 + Source/Render/Primitives/RenderPrimitive.cpp | 1 + Source/Render/Textures/BitmapPixels.cpp | 1 + Source/Render/Textures/Texture.cpp | 1 + Source/Render/ViewportProjection.cpp | 2 ++ Source/Resource/Resource.cpp | 1 + Source/Resource/Sprites/ActionResource.cpp | 1 + Source/Resource/Sprites/SpriteResource.cpp | 1 + Source/UI/Layout/SnapMgr.cpp | 1 + Source/Utility/{ => Cipher}/Rijndael.cpp | 2 +- Source/Utility/{ => Cipher}/Rijndael.h | 4 ++-- Source/Utility/{ => Cipher}/XorBytes.cpp | 2 +- Source/Utility/{ => Cipher}/XorBytes.h | 4 ++-- Source/Utility/{ => Hash}/MD5.cpp | 3 ++- Source/Utility/{ => Hash}/MD5.h | 4 ++-- Source/Utility/{ => Hash}/XxHash32.cpp | 4 +++- Source/Utility/{ => Hash}/XxHash32.h | 4 ++-- .../Utility/{ => Lexicon}/LexiconBoundary.cpp | 3 ++- .../Utility/{ => Lexicon}/LexiconBoundary.h | 4 ++-- .../Utility/{ => Lexicon}/LexiconMatcher.cpp | 14 +++++------- Source/Utility/{ => Lexicon}/LexiconMatcher.h | 4 ++-- .../{ => Lexicon}/LexiconSerializer.cpp | 4 +++- .../Utility/{ => Lexicon}/LexiconSerializer.h | 4 ++-- Source/Utility/{ => Math}/RadialGrid.cpp | 3 ++- Source/Utility/{ => Math}/RadialGrid.h | 4 ++-- Source/Utility/{ => Text}/Base64.cpp | 2 +- Source/Utility/{ => Text}/Base64.h | 4 ++-- Source/Utility/Text/FormatString.cpp | 1 + Source/Utility/{ => Text}/TextEscapes.cpp | 3 ++- Source/Utility/Text/TextEscapes.h | 8 +++++++ Source/Utility/{ => Text}/TextTokens.cpp | 5 ++++- Source/Utility/{ => Text}/TextTokens.h | 4 ++-- Source/Utility/TextEscapes.h | 8 ------- Source/Utility/Timestamp.cpp | 11 ++++++++++ compile.json | 22 +++++++++---------- 58 files changed, 161 insertions(+), 70 deletions(-) rename Source/Utility/{ => Cipher}/Rijndael.cpp (99%) rename Source/Utility/{ => Cipher}/Rijndael.h (95%) rename Source/Utility/{ => Cipher}/XorBytes.cpp (88%) rename Source/Utility/{ => Cipher}/XorBytes.h (56%) rename Source/Utility/{ => Hash}/MD5.cpp (94%) rename Source/Utility/{ => Hash}/MD5.h (92%) rename Source/Utility/{ => Hash}/XxHash32.cpp (96%) rename Source/Utility/{ => Hash}/XxHash32.h (69%) rename Source/Utility/{ => Lexicon}/LexiconBoundary.cpp (93%) rename Source/Utility/{ => Lexicon}/LexiconBoundary.h (66%) rename Source/Utility/{ => Lexicon}/LexiconMatcher.cpp (76%) rename Source/Utility/{ => Lexicon}/LexiconMatcher.h (55%) rename Source/Utility/{ => Lexicon}/LexiconSerializer.cpp (95%) rename Source/Utility/{ => Lexicon}/LexiconSerializer.h (82%) rename Source/Utility/{ => Math}/RadialGrid.cpp (89%) rename Source/Utility/{ => Math}/RadialGrid.h (65%) rename Source/Utility/{ => Text}/Base64.cpp (98%) rename Source/Utility/{ => Text}/Base64.h (65%) rename Source/Utility/{ => Text}/TextEscapes.cpp (89%) create mode 100644 Source/Utility/Text/TextEscapes.h rename Source/Utility/{ => Text}/TextTokens.cpp (95%) rename Source/Utility/{ => Text}/TextTokens.h (75%) delete mode 100644 Source/Utility/TextEscapes.h diff --git a/AGENTS.md b/AGENTS.md index 4974111..1c9cf88 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -48,6 +48,7 @@ td sync (imported IDA pseudocode where available, a starting point only). 4. **Write each function** in its file, directly preceded by its annotation: ```cpp + // OFFSET: 0x00AE97D0 // FUNCTION: fn_00123 void Player::Update(float dt) { @@ -115,8 +116,9 @@ other contributors' agents: a function merges once "same" leads ## Rules -- **Annotations contain stable IDs, never addresses.** Addresses live in the - symbol database, so the source survives new versions of the executable. +- **Stable-ID annotations contain IDs, never addresses.** The symbol database is + authoritative for addresses. Every standalone function additionally carries + `// OFFSET: 0x...` above its `// FUNCTION:` line, copied from `td symbol `. If you need a new global, vtable or string, call `td_new_symbol` and use the returned annotation (`// GLOBAL: gl_00045`). - **Globals have one real definition.** Put a global's stable data annotation on its owning @@ -138,7 +140,7 @@ other contributors' agents: a function merges once "same" leads - Prefer real names and struct members over raw offsets and casts. Use `// TODO:` comments for things you are unsure about. - **No comments, no invented strings.** A submission may not add comments other - than annotations (`// FUNCTION: fn_00123`), offset markers (`/* 0010 */`) and + than annotations (`// OFFSET: 0x00AE97D0`, `// FUNCTION: fn_00123`), offset markers (`/* 0010 */`) and `// INLINED` markers, and may only use string literals that exist in the original executable. Everything else is rejected before compiling. Names of functions, variables and types are the only free text. diff --git a/CMakeLists.txt b/CMakeLists.txt index f29dcdc..cd64c47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,15 +8,15 @@ endif() add_subdirectory(ThirdParty) add_library(RagnarokUtility STATIC - Source/Utility/XorBytes.cpp - Source/Utility/Base64.cpp + Source/Utility/Cipher/XorBytes.cpp + Source/Utility/Text/Base64.cpp Source/Utility/Text/GroupedInteger.cpp Source/Utility/Text/LanguageCharset.cpp Source/Utility/Math/ClientAngles.cpp Source/Utility/Math/AffineMatrix.cpp Source/Utility/Math/AffineLookAt.cpp Source/Utility/Math/RayTriangle.cpp - Source/Utility/Rijndael.cpp + Source/Utility/Cipher/Rijndael.cpp ) target_include_directories(RagnarokUtility PUBLIC diff --git a/CODING_RULES.md b/CODING_RULES.md index 0d73977..1281939 100644 --- a/CODING_RULES.md +++ b/CODING_RULES.md @@ -7,7 +7,7 @@ These apply to rodecomp: Ragnarok Online Ragexe 2026-02-19 (x86), built with MSV Code carries no explanatory comments: none inside functions, none above them, no file headers, no commented-out code. Allowed comments are Clank stable-ID annotations (`// FUNCTION:`, `// GLOBAL:`, -`// STRING:`, `// VTABLE:`), existing `// OFFSET:` / `// STATIC:` provenance where permitted below, +`// STRING:`, `// VTABLE:`), `// OFFSET:` provenance on standalone functions, existing `// STATIC:` provenance, exact bare `// INLINED` markers, and field-offset markers (`/* XXXX */`). Use only string literals evidenced in the original executable. Put explanations in submission notes rather than adding source comments or creating documentation by default. @@ -17,19 +17,22 @@ or disabling the gate. This document does not change the server's accepted synta ## 2. Stable IDs identify implementations and data -Every reconstructed standalone function gets its existing stable ID directly above its definition: +Every reconstructed standalone function gets its `// OFFSET:` address and its existing stable ID directly above its definition: ```cpp +// OFFSET: 0x00AE97D0 // FUNCTION: fn_00123 void Player::Update(float dt) { ... } ``` -- Stable-ID annotations contain IDs, never addresses. Addresses live in the symbol database. -- Preserve existing `// OFFSET: 0x...` provenance for standalone functions and `// STATIC: 0x...` provenance - for data. Inline-only functions must not carry `OFFSET` provenance. Do not invent addresses or require - new address comments as a substitute for stable IDs. +- `// OFFSET: 0x...` is mandatory on every standalone `// FUNCTION:` definition: one line per stacked ID, placed above + the `FUNCTION` lines, with the address `td symbol ` reports (eight uppercase hex digits). Never type an address + from memory or a decompiler listing that disagrees with the symbol database. +- `FUNCTION`/`GLOBAL`/`STRING`/`VTABLE` annotations contain IDs, never addresses; the symbol database stays + authoritative. Preserve existing `// STATIC: 0x...` provenance for data. Inline-only functions must not carry + `OFFSET` provenance. - Use the existing ID of the actual original function. Do not annotate an ordinary destructor with a scalar-deleting destructor's ID, or stack a thunk's ID onto its target. - For symbols missing from the database, use `td_new_symbol` and its returned annotation. diff --git a/Source/Archive/PakRegistry.cpp b/Source/Archive/PakRegistry.cpp index 0a0abeb..afd27d4 100644 --- a/Source/Archive/PakRegistry.cpp +++ b/Source/Archive/PakRegistry.cpp @@ -85,6 +85,7 @@ bool PakRegistry::Exists(const char* filename, bool looseOnly) const { return true; } +// OFFSET: 0x00AEA1F0 // FUNCTION: fn_18116 void PakRegistry::ApplyAuxiliary(const void*, std::uint32_t) { } diff --git a/Source/Client/Input/TraditionalKeyInput.cpp b/Source/Client/Input/TraditionalKeyInput.cpp index 65807de..9ba242a 100644 --- a/Source/Client/Input/TraditionalKeyInput.cpp +++ b/Source/Client/Input/TraditionalKeyInput.cpp @@ -114,6 +114,7 @@ const char* TraditionalKeyInput::NextCharArabic(const char* current, int) { return CharNextExA(static_cast(g_textCodePage), current, 0); } +// OFFSET: 0x00ACD7D0 // FUNCTION: fn_17768 void TraditionalKeyInputNoop() {} diff --git a/Source/Client/Mode/ActiveGameMode.cpp b/Source/Client/Mode/ActiveGameMode.cpp index 44181ef..4a4f7ea 100644 --- a/Source/Client/Mode/ActiveGameMode.cpp +++ b/Source/Client/Mode/ActiveGameMode.cpp @@ -4,6 +4,7 @@ // GLOBAL: gl_24475 CWorld g_world = {1}; +// OFFSET: 0x00AD6450 // FUNCTION: fn_17831 CGameMode* CWorld::ActiveGameMode() { return this->state == 1 ? this->gameMode : nullptr; diff --git a/Source/Contents/ActorGeometry.cpp b/Source/Contents/ActorGeometry.cpp index dd7717a..51e53b1 100644 --- a/Source/Contents/ActorGeometry.cpp +++ b/Source/Contents/ActorGeometry.cpp @@ -3,6 +3,7 @@ #include +// OFFSET: 0x00CA9580 // FUNCTION: fn_21007 float __stdcall CRenderObject::Heading(float x, float z, float targetX, float targetZ) { const float deltaX = targetX - x; @@ -19,6 +20,7 @@ float __stdcall CRenderObject::Heading(float x, float z, float targetX, float ta return angle; } +// OFFSET: 0x00CA9610 // FUNCTION: fn_21008 void CRenderObject::Face(float x, float z) { const float deltaX = x - this->render.position[0]; @@ -37,6 +39,7 @@ void CRenderObject::Face(float x, float z) { } } +// OFFSET: 0x00CA96C0 // FUNCTION: fn_21009 float CRenderObject::HorizontalDistance(float x, float z) const { const float deltaX = x - this->render.position[0]; @@ -44,6 +47,7 @@ float CRenderObject::HorizontalDistance(float x, float z) const { return SquareRoot(deltaZ * deltaZ + deltaX * deltaX); } +// OFFSET: 0x00CA9700 // FUNCTION: fn_21010 float CRenderObject::Distance(float x, float y, float z) const { const float deltaX = x - this->render.position[0]; diff --git a/Source/Contents/ActorNameCard.cpp b/Source/Contents/ActorNameCard.cpp index 170bd53..7724be7 100644 --- a/Source/Contents/ActorNameCard.cpp +++ b/Source/Contents/ActorNameCard.cpp @@ -2,6 +2,7 @@ +// OFFSET: 0x005BEC80 // FUNCTION: fn_03487 void CActorNameCard::Reset() { this->name.clear(); @@ -13,15 +14,18 @@ void CActorNameCard::Reset() { this->unknown_0094 = 0; } +// OFFSET: 0x005BF080 // FUNCTION: fn_03491 CActorNameCardHolder::CActorNameCardHolder() = default; +// OFFSET: 0x005BFEF0 // FUNCTION: fn_03501 std::string CActorNameCardHolder::Name(std::uint32_t id) { return this->cards[id].name; } +// OFFSET: 0x005C0050 // FUNCTION: fn_03502 void CActorNameCardHolder::Clear() { this->cards.clear(); @@ -29,6 +33,7 @@ void CActorNameCardHolder::Clear() { this->requests.clear(); } +// OFFSET: 0x005C03B0 // FUNCTION: fn_03505 void CActorNameCardHolder::Set(std::uint32_t id, std::string name, std::string value1, std::string value2, std::string value3, std::string value4, std::string value5, std::uint32_t value) { @@ -61,6 +66,7 @@ void CActorNameCardHolder::Set(std::uint32_t id, std::string name, std::string v card.received = 1; } +// OFFSET: 0x005C0E60 // FUNCTION: fn_03507 void CActorNameCardHolder::SetName(std::uint32_t id, std::string name) { CActorNameCard& card = this->cards[id]; diff --git a/Source/Contents/Effects/AttachedEffect.cpp b/Source/Contents/Effects/AttachedEffect.cpp index 0563d3f..436805f 100644 --- a/Source/Contents/Effects/AttachedEffect.cpp +++ b/Source/Contents/Effects/AttachedEffect.cpp @@ -41,6 +41,7 @@ inline RagEffectState::~RagEffectState() { } } +// OFFSET: 0x00BF84B0 // FUNCTION: fn_20007 AttachedEffect::AttachedEffect(ResourceMgr& resources, JobNames& names) : CRenderObject(resources, names) { } diff --git a/Source/Contents/Effects/EffectAttachments.cpp b/Source/Contents/Effects/EffectAttachments.cpp index dffe5e3..5433894 100644 --- a/Source/Contents/Effects/EffectAttachments.cpp +++ b/Source/Contents/Effects/EffectAttachments.cpp @@ -60,6 +60,7 @@ void EffectAttachments::DetachAll() { this->second = nullptr; } +// OFFSET: 0x00CADC20 // FUNCTION: fn_21063 bool EffectActor::EffectVisible() const { return this->render.visible != 0 && this->render.enabled != 0; diff --git a/Source/Contents/GuildEmblemState.cpp b/Source/Contents/GuildEmblemState.cpp index 4fb9dc6..8f74383 100644 --- a/Source/Contents/GuildEmblemState.cpp +++ b/Source/Contents/GuildEmblemState.cpp @@ -1,12 +1,15 @@ #include "Contents/GuildMgr.h" +// OFFSET: 0x0065C440 // FUNCTION: fn_05147 CGuild::CGuild() : m_emblemVersion(0) { } +// OFFSET: 0x0065C450 // FUNCTION: fn_05148 CGuild::~CGuild() = default; +// OFFSET: 0x0065E640 // FUNCTION: fn_05175 int CGuildMgr::GetEmblemVersion(std::uint32_t guildId) const { const auto it = this->m_guilds.find(guildId); @@ -16,6 +19,7 @@ int CGuildMgr::GetEmblemVersion(std::uint32_t guildId) const { return 0; } +// OFFSET: 0x0065EEA0 // FUNCTION: fn_05181 void CGuildMgr::SetEmblemVersion(std::uint32_t guildId, int version) { this->m_guilds[guildId].m_emblemVersion = version; diff --git a/Source/Contents/GuildMgr.cpp b/Source/Contents/GuildMgr.cpp index a597281..a24342a 100644 --- a/Source/Contents/GuildMgr.cpp +++ b/Source/Contents/GuildMgr.cpp @@ -23,6 +23,7 @@ CGuildMgr::~CGuildMgr() { } } +// OFFSET: 0x0065E290 // FUNCTION: fn_05172 bool CGuildMgr::Create() { if (g_guildMgr) { @@ -43,6 +44,7 @@ bool CGuildMgr::Create() { return true; } +// OFFSET: 0x0065E430 // FUNCTION: fn_05173 void CGuildMgr::Destroy() { if (g_guildMgr) { diff --git a/Source/Contents/Items/ItemDescription.cpp b/Source/Contents/Items/ItemDescription.cpp index 870a840..fa417a0 100644 --- a/Source/Contents/Items/ItemDescription.cpp +++ b/Source/Contents/Items/ItemDescription.cpp @@ -49,6 +49,7 @@ ITEM_DESC& ItemDescriptions::Find(int id) { return entry == this->values.end() ? missing : entry->second; } +// OFFSET: 0x006D3AE0 // FUNCTION: fn_06546 ItemCardName& EnsureItemCardName(int id, std::map& values) { const auto entry = values.find(id); @@ -59,6 +60,7 @@ ItemCardName& EnsureItemCardName(int id, std::map& values) { return values[id]; } +// OFFSET: 0x006D3C10 // FUNCTION: fn_06547 std::vector& EnsureItemDescriptionLines(int id, std::map>& values) { const auto entry = values.find(id); diff --git a/Source/Contents/Jobs/JobInheritance.cpp b/Source/Contents/Jobs/JobInheritance.cpp index a055e28..af3dd15 100644 --- a/Source/Contents/Jobs/JobInheritance.cpp +++ b/Source/Contents/Jobs/JobInheritance.cpp @@ -116,6 +116,7 @@ void JobInheritance::InitializeSkillTree(CPlayerSkillBundle& bundle, int job) { } } +// OFFSET: 0x00DE0830 // FUNCTION: fn_23461 int __stdcall GetRealWeaponId(int weapon) { int real = 0; diff --git a/Source/Contents/MessageTable.cpp b/Source/Contents/MessageTable.cpp index 62bed5b..5b9abb1 100644 --- a/Source/Contents/MessageTable.cpp +++ b/Source/Contents/MessageTable.cpp @@ -1,6 +1,6 @@ #include "Contents/MessageTable.h" #include "Network/TextEncoding.h" -#include "Utility/Base64.h" +#include "Utility/Text/Base64.h" #include "Utility/Text/LanguageCharset.h" #include diff --git a/Source/Contents/Models/ModelNode.cpp b/Source/Contents/Models/ModelNode.cpp index 68715c2..539542b 100644 --- a/Source/Contents/Models/ModelNode.cpp +++ b/Source/Contents/Models/ModelNode.cpp @@ -30,10 +30,12 @@ C3dNodeV2::C3dNodeV2() = default; // OFFSET: 0x00AB6C50 C3dNodeV2::~C3dNodeV2() = default; +// OFFSET: 0x00AB7040 // FUNCTION: fn_17481 void C3dNode::Initialize(const ModelNode&) { } +// OFFSET: 0x00AB9110 // FUNCTION: fn_17506 void C3dNode::Animate(double) { } diff --git a/Source/Contents/Models/ModelOcclusion.cpp b/Source/Contents/Models/ModelOcclusion.cpp index 4f55229..5669d3c 100644 --- a/Source/Contents/Models/ModelOcclusion.cpp +++ b/Source/Contents/Models/ModelOcclusion.cpp @@ -8,6 +8,7 @@ namespace { return std::fabs(value); } + // OFFSET: 0x00553850 // FUNCTION: fn_02019 bool Intersects(const float* ray, const OrientedBounds& bounds) { const float delta[3] = {bounds.center[0] - ray[0], bounds.center[1] - ray[1], bounds.center[2] - ray[2]}; diff --git a/Source/Contents/MovementRouteInterpolation.cpp b/Source/Contents/MovementRouteInterpolation.cpp index 6156973..6f99f84 100644 --- a/Source/Contents/MovementRouteInterpolation.cpp +++ b/Source/Contents/MovementRouteInterpolation.cpp @@ -1,5 +1,6 @@ #include "Contents/MovementRouteInterpolation.h" +// OFFSET: 0x00AD92C0 // FUNCTION: fn_17876 int MovementRouteInterpolation::Sample(std::uint32_t tick, float* x, float* y, int* metadata) { if (this->points.empty()) { @@ -57,6 +58,7 @@ int MovementRouteInterpolation::Sample(std::uint32_t tick, float* x, float* y, i return static_cast(index); } +// OFFSET: 0x00AD9500 // FUNCTION: fn_17877 std::uint32_t MovementRouteInterpolation::Segment() const { return this->segment; diff --git a/Source/Contents/World/WorldModelLoading.cpp b/Source/Contents/World/WorldModelLoading.cpp index dfb1f26..cf617da 100644 --- a/Source/Contents/World/WorldModelLoading.cpp +++ b/Source/Contents/World/WorldModelLoading.cpp @@ -87,6 +87,7 @@ void WorldModelLoading::Schedule(const WorldModelRecord& placement, const Terrai } } +// OFFSET: 0x00AC8BF0 // FUNCTION: fn_17680 DWORD WINAPI WorldModelLoading::ThreadEntry(void* context) { static_cast(context)->Run(); diff --git a/Source/Contents/World/WorldOcclusion.cpp b/Source/Contents/World/WorldOcclusion.cpp index 6957c48..af2cf46 100644 --- a/Source/Contents/World/WorldOcclusion.cpp +++ b/Source/Contents/World/WorldOcclusion.cpp @@ -40,6 +40,7 @@ void MarkWorldOcclusionRay(const float* ray, float actorLimit, float groundLimit } } +// OFFSET: 0x00CD5AD0 // FUNCTION: fn_21286 void MarkScreenWorldOcclusion( const RenderProjection& projection, int screenX, int screenY, float rendererScale, const float* origin, const float* cameraMatrix, float playerHeight, diff --git a/Source/Render/DX7/SurfaceDX7.cpp b/Source/Render/DX7/SurfaceDX7.cpp index 75df5d7..f2456cd 100644 --- a/Source/Render/DX7/SurfaceDX7.cpp +++ b/Source/Render/DX7/SurfaceDX7.cpp @@ -31,6 +31,7 @@ namespace { return static_cast((value >> (channel.expansion & 31)) << (channel.shift & 31)); } + // OFFSET: 0x00543220 // FUNCTION: fn_01787 std::uint16_t Color(DeviceOwnerDX7& owner, unsigned red, unsigned green, unsigned blue) { return static_cast(Channel(red, owner.red) + Channel(green, owner.green) + Channel(blue, owner.blue)); @@ -228,56 +229,67 @@ void CSurfaceDX7::Stretch(int, int, int width, int height) { this->m_owner->renderTarget->Blt(&destination, this->m_surface, nullptr, DDBLT_WAIT, nullptr); } +// OFFSET: 0x00543270 // FUNCTION: fn_01788 DWORD DeviceOwnerDX7::BlueMask() { return this->blueMask; } +// OFFSET: 0x00543280 // FUNCTION: fn_01789 DWORD DeviceOwnerDX7::BlueExpansion() { return this->blue.expansion; } +// OFFSET: 0x00543290 // FUNCTION: fn_01790 DWORD DeviceOwnerDX7::BlueShift() { return this->blue.shift; } +// OFFSET: 0x005432D0 // FUNCTION: fn_01792 IDirectDraw7* DeviceOwnerDX7::DirectDraw() { return this->draw; } +// OFFSET: 0x005432E0 // FUNCTION: fn_01793 DWORD DeviceOwnerDX7::GreenMask() { return this->greenMask; } +// OFFSET: 0x005432F0 // FUNCTION: fn_01794 DWORD DeviceOwnerDX7::GreenExpansion() { return this->green.expansion; } +// OFFSET: 0x00543300 // FUNCTION: fn_01795 DWORD DeviceOwnerDX7::GreenShift() { return this->green.shift; } +// OFFSET: 0x00543320 // FUNCTION: fn_01797 DWORD DeviceOwnerDX7::RedMask() { return this->redMask; } +// OFFSET: 0x00543330 // FUNCTION: fn_01798 DWORD DeviceOwnerDX7::RedExpansion() { return this->red.expansion; } +// OFFSET: 0x00543340 // FUNCTION: fn_01799 DWORD DeviceOwnerDX7::RedShift() { return this->red.shift; } +// OFFSET: 0x00543350 // FUNCTION: fn_01800 IDirectDrawSurface7* DeviceOwnerDX7::RenderTarget() { return this->renderTarget; diff --git a/Source/Render/DX9/DeviceOwnerDX9.cpp b/Source/Render/DX9/DeviceOwnerDX9.cpp index f2882f7..b3fa12d 100644 --- a/Source/Render/DX9/DeviceOwnerDX9.cpp +++ b/Source/Render/DX9/DeviceOwnerDX9.cpp @@ -31,6 +31,7 @@ DeviceOwnerDX9::DeviceOwnerDX9() { this->lastPresent = 0; } +// OFFSET: 0x0054B830 // FUNCTION: fn_01907 void DeviceOwnerDX9Noop() {} diff --git a/Source/Render/DeviceContext/DCSurface.cpp b/Source/Render/DeviceContext/DCSurface.cpp index c6e4dd6..8078988 100644 --- a/Source/Render/DeviceContext/DCSurface.cpp +++ b/Source/Render/DeviceContext/DCSurface.cpp @@ -10,16 +10,19 @@ std::shared_ptr AcquireBackBufferSurface(CRenderSystemBase* system) { return system ? system->BackBufferSurface() : std::shared_ptr{}; } +// OFFSET: 0x00569F10 // FUNCTION: fn_02274 CRenderer* RenderSystemHolder::CreateRenderer() { return this->system ? this->system->CreateRenderer() : nullptr; } +// OFFSET: 0x00569F80 // FUNCTION: fn_02278 HRESULT RenderSystemHolder::Close() { return this->system ? this->system->Close() : E_ILLEGAL_METHOD_CALL; } +// OFFSET: 0x00569FC0 // FUNCTION: fn_02280 void RenderSystemHolder::UpdateOption() { if (this->system) { @@ -27,6 +30,7 @@ void RenderSystemHolder::UpdateOption() { } } +// OFFSET: 0x00569FD0 // FUNCTION: fn_02281 void RenderSystemHolder::RestoreDisplayMode() { if (this->system) { @@ -34,6 +38,7 @@ void RenderSystemHolder::RestoreDisplayMode() { } } +// OFFSET: 0x00569FE0 // FUNCTION: fn_02282 void RenderSystemHolder::PrepareErrorDialog() { if (this->system) { @@ -41,31 +46,37 @@ void RenderSystemHolder::PrepareErrorDialog() { } } +// OFFSET: 0x0056A230 // FUNCTION: fn_02285 std::int32_t RenderSystemHolder::Backend() const { return this->system ? this->system->Backend() : -1; } +// OFFSET: 0x0056A280 // FUNCTION: fn_02287 CTexture* RenderSystemHolder::BackBufferTexture() const { return this->system ? this->system->BackBufferTexture() : nullptr; } +// OFFSET: 0x0056A290 // FUNCTION: fn_02288 std::uint32_t RenderSystemHolder::Height() const { return this->system ? this->system->Height() : 0; } +// OFFSET: 0x0056A690 // FUNCTION: fn_02292 std::uint32_t RenderSystemHolder::Width() const { return this->system ? this->system->Width() : 0; } +// OFFSET: 0x0056A790 // FUNCTION: fn_02294 bool RenderSystemHolder::IsWindowed() const { return this->system ? this->system->IsWindowed() : false; } +// OFFSET: 0x0056A7A0 // FUNCTION: fn_02295 HRESULT RenderSystemHolder::TestDevice() const { return this->system ? this->system->TestDevice() : E_ILLEGAL_METHOD_CALL; diff --git a/Source/Render/DeviceContext/DCSurface.h b/Source/Render/DeviceContext/DCSurface.h index 8888269..b936fbe 100644 --- a/Source/Render/DeviceContext/DCSurface.h +++ b/Source/Render/DeviceContext/DCSurface.h @@ -38,6 +38,7 @@ struct RenderSystemHolder { HRESULT Present(bool option) const; }; +// OFFSET: 0x0055D340 // FUNCTION: fn_02102 __declspec(noinline) inline RenderSystemHolder* GetRenderSystemHolder() { static RenderSystemHolder holder; diff --git a/Source/Render/Primitives/RenderPrimitive.cpp b/Source/Render/Primitives/RenderPrimitive.cpp index 96c858f..43ca397 100644 --- a/Source/Render/Primitives/RenderPrimitive.cpp +++ b/Source/Render/Primitives/RenderPrimitive.cpp @@ -8,6 +8,7 @@ // GLOBAL: gl_24481 CRenderer* g_renderer; +// OFFSET: 0x00569270 // FUNCTION: fn_02251 RenderVertex* RenderVertex::Reset() { this->x = 0; diff --git a/Source/Render/Textures/BitmapPixels.cpp b/Source/Render/Textures/BitmapPixels.cpp index 3de846b..221f5a2 100644 --- a/Source/Render/Textures/BitmapPixels.cpp +++ b/Source/Render/Textures/BitmapPixels.cpp @@ -68,6 +68,7 @@ void BitmapPixels::Create(int newWidth, int newHeight) { this->previous = SelectObject(this->dc, this->bitmap); } +// OFFSET: 0x00547A80 // FUNCTION: fn_01845 HGDIOBJ CDCBitmap::Create(int width, int height) { this->m_bitmap.width = width; diff --git a/Source/Render/Textures/Texture.cpp b/Source/Render/Textures/Texture.cpp index d50515d..214b884 100644 --- a/Source/Render/Textures/Texture.cpp +++ b/Source/Render/Textures/Texture.cpp @@ -68,6 +68,7 @@ std::uint32_t CTexture::SetImageSize(std::uint32_t width, std::uint32_t height) return width; } +// OFFSET: 0x00572480 // FUNCTION: fn_02470 int CTexture::SetName(const char* name) { return strncpy_s(this->m_name, sizeof(this->m_name), name, _TRUNCATE); diff --git a/Source/Render/ViewportProjection.cpp b/Source/Render/ViewportProjection.cpp index 9b7d882..44cb9ca 100644 --- a/Source/Render/ViewportProjection.cpp +++ b/Source/Render/ViewportProjection.cpp @@ -1,5 +1,6 @@ #include "Render/Renderer.h" +// OFFSET: 0x0055D480 // FUNCTION: fn_02104 float* CRenderer::ProjectViewport(const float* position, const float* matrix, float* x, float* y, float* reciprocalDepth) { const float inverse = 1.0f / (((matrix[2] * position[0] + matrix[5] * position[1]) + matrix[8] * position[2]) + matrix[11]); @@ -11,6 +12,7 @@ float* CRenderer::ProjectViewport(const float* position, const float* matrix, fl return y; } +// OFFSET: 0x0055D560 // FUNCTION: fn_02105 float* CRenderer::ProjectViewportCentered( const float* position, const float* matrix, float* x, float* y, float* reciprocalDepth, float width, float height diff --git a/Source/Resource/Resource.cpp b/Source/Resource/Resource.cpp index 19d0f59..d7367f3 100644 --- a/Source/Resource/Resource.cpp +++ b/Source/Resource/Resource.cpp @@ -53,6 +53,7 @@ void CRes::MissingFile(CRenderSystemBase* system, const char* name) { ShowErrorDialog(system, text, 0); } +// OFFSET: 0x00AEFAD0 // FUNCTION: fn_18183 std::uint32_t CRes::AddRef() { return ++this->references; diff --git a/Source/Resource/Sprites/ActionResource.cpp b/Source/Resource/Sprites/ActionResource.cpp index 86dd9d6..2f342d1 100644 --- a/Source/Resource/Sprites/ActionResource.cpp +++ b/Source/Resource/Sprites/ActionResource.cpp @@ -28,6 +28,7 @@ CActRes::CActRes(ActionResourceContext& context) : maximumCells(0), m_context(&c // INLINED CActRes::~CActRes() = default; +// OFFSET: 0x007436B0 // FUNCTION: fn_07749 CActRes* CActRes::Create() { return new CActRes(*this->m_context); diff --git a/Source/Resource/Sprites/SpriteResource.cpp b/Source/Resource/Sprites/SpriteResource.cpp index 9af064e..2e663d5 100644 --- a/Source/Resource/Sprites/SpriteResource.cpp +++ b/Source/Resource/Sprites/SpriteResource.cpp @@ -18,6 +18,7 @@ CSprRes::CSprRes(SpriteResourceContext& context) : indexedCount(0), m_context(&c // INLINED CSprRes::~CSprRes() = default; +// OFFSET: 0x0075FE90 // FUNCTION: fn_08053 CSprRes* CSprRes::Create() { return new CSprRes(*this->m_context); diff --git a/Source/UI/Layout/SnapMgr.cpp b/Source/UI/Layout/SnapMgr.cpp index b86c3aa..c96cc49 100644 --- a/Source/UI/Layout/SnapMgr.cpp +++ b/Source/UI/Layout/SnapMgr.cpp @@ -22,6 +22,7 @@ namespace { return value < 0 ? (0 - value) : value; } + // OFFSET: 0x007E2DB0 // FUNCTION: fn_09714 bool ContainsUpward(SnapObject* object, SnapObject* target) { if (object == target) { diff --git a/Source/Utility/Rijndael.cpp b/Source/Utility/Cipher/Rijndael.cpp similarity index 99% rename from Source/Utility/Rijndael.cpp rename to Source/Utility/Cipher/Rijndael.cpp index 8a1b842..3698649 100644 --- a/Source/Utility/Rijndael.cpp +++ b/Source/Utility/Cipher/Rijndael.cpp @@ -1,4 +1,4 @@ -#include "Utility/Rijndael.h" +#include "Utility/Cipher/Rijndael.h" #include #include diff --git a/Source/Utility/Rijndael.h b/Source/Utility/Cipher/Rijndael.h similarity index 95% rename from Source/Utility/Rijndael.h rename to Source/Utility/Cipher/Rijndael.h index 9c2b794..14d782f 100644 --- a/Source/Utility/Rijndael.h +++ b/Source/Utility/Cipher/Rijndael.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_RIJNDAEL_H -#define RAGNAROK_SOURCE_UTILITY_RIJNDAEL_H +#ifndef RAGNAROK_SOURCE_UTILITY_CIPHER_RIJNDAEL_H +#define RAGNAROK_SOURCE_UTILITY_CIPHER_RIJNDAEL_H #include #include diff --git a/Source/Utility/XorBytes.cpp b/Source/Utility/Cipher/XorBytes.cpp similarity index 88% rename from Source/Utility/XorBytes.cpp rename to Source/Utility/Cipher/XorBytes.cpp index 9cc5a4d..47bffd3 100644 --- a/Source/Utility/XorBytes.cpp +++ b/Source/Utility/Cipher/XorBytes.cpp @@ -1,4 +1,4 @@ -#include "Utility/XorBytes.h" +#include "Utility/Cipher/XorBytes.h" namespace utility { // OFFSET: 0x005A45E0 diff --git a/Source/Utility/XorBytes.h b/Source/Utility/Cipher/XorBytes.h similarity index 56% rename from Source/Utility/XorBytes.h rename to Source/Utility/Cipher/XorBytes.h index f6c70de..37283d2 100644 --- a/Source/Utility/XorBytes.h +++ b/Source/Utility/Cipher/XorBytes.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_XORBYTES_H -#define RAGNAROK_SOURCE_UTILITY_XORBYTES_H +#ifndef RAGNAROK_SOURCE_UTILITY_CIPHER_XORBYTES_H +#define RAGNAROK_SOURCE_UTILITY_CIPHER_XORBYTES_H #include diff --git a/Source/Utility/MD5.cpp b/Source/Utility/Hash/MD5.cpp similarity index 94% rename from Source/Utility/MD5.cpp rename to Source/Utility/Hash/MD5.cpp index a8efa61..308ffa5 100644 --- a/Source/Utility/MD5.cpp +++ b/Source/Utility/Hash/MD5.cpp @@ -1,4 +1,4 @@ -#include "Utility/MD5.h" +#include "Utility/Hash/MD5.h" #include #include @@ -14,6 +14,7 @@ namespace { } } +// OFFSET: 0x00401C40 // FUNCTION: fn_00121 MD5::MD5() { } diff --git a/Source/Utility/MD5.h b/Source/Utility/Hash/MD5.h similarity index 92% rename from Source/Utility/MD5.h rename to Source/Utility/Hash/MD5.h index 116701b..57bd8c5 100644 --- a/Source/Utility/MD5.h +++ b/Source/Utility/Hash/MD5.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_MD5_H -#define RAGNAROK_SOURCE_UTILITY_MD5_H +#ifndef RAGNAROK_SOURCE_UTILITY_HASH_MD5_H +#define RAGNAROK_SOURCE_UTILITY_HASH_MD5_H #include diff --git a/Source/Utility/XxHash32.cpp b/Source/Utility/Hash/XxHash32.cpp similarity index 96% rename from Source/Utility/XxHash32.cpp rename to Source/Utility/Hash/XxHash32.cpp index 774878d..3a77cd2 100644 --- a/Source/Utility/XxHash32.cpp +++ b/Source/Utility/Hash/XxHash32.cpp @@ -1,4 +1,4 @@ -#include "Utility/XxHash32.h" +#include "Utility/Hash/XxHash32.h" #include #include @@ -12,6 +12,7 @@ namespace { } } +// OFFSET: 0x004D3490 // FUNCTION: fn_00163 std::uint32_t FinalizeXxHash32(std::uint32_t hash, const void* data, std::uint32_t remaining, int) { const auto* current = static_cast(data); @@ -38,6 +39,7 @@ std::uint32_t FinalizeXxHash32(std::uint32_t hash, const void* data, std::uint32 return hash; } +// OFFSET: 0x004D3320 // FUNCTION: fn_00162 std::uint32_t XxHash32(const void* data, std::uint32_t length, std::uint32_t seed) { const auto* current = static_cast(data); diff --git a/Source/Utility/XxHash32.h b/Source/Utility/Hash/XxHash32.h similarity index 69% rename from Source/Utility/XxHash32.h rename to Source/Utility/Hash/XxHash32.h index 57b5d04..a813f28 100644 --- a/Source/Utility/XxHash32.h +++ b/Source/Utility/Hash/XxHash32.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_XXHASH32_H -#define RAGNAROK_SOURCE_UTILITY_XXHASH32_H +#ifndef RAGNAROK_SOURCE_UTILITY_HASH_XXHASH32_H +#define RAGNAROK_SOURCE_UTILITY_HASH_XXHASH32_H #include diff --git a/Source/Utility/LexiconBoundary.cpp b/Source/Utility/Lexicon/LexiconBoundary.cpp similarity index 93% rename from Source/Utility/LexiconBoundary.cpp rename to Source/Utility/Lexicon/LexiconBoundary.cpp index 9d5b746..77f3184 100644 --- a/Source/Utility/LexiconBoundary.cpp +++ b/Source/Utility/Lexicon/LexiconBoundary.cpp @@ -1,5 +1,6 @@ -#include "Utility/LexiconBoundary.h" +#include "Utility/Lexicon/LexiconBoundary.h" +// OFFSET: 0x00AC4EA0 // FUNCTION: fn_17634 bool LexiconBoundary::Matches(unsigned char previous, unsigned char current, unsigned char options) const { if (previous == 0xDD) { diff --git a/Source/Utility/LexiconBoundary.h b/Source/Utility/Lexicon/LexiconBoundary.h similarity index 66% rename from Source/Utility/LexiconBoundary.h rename to Source/Utility/Lexicon/LexiconBoundary.h index fd56eac..5a0ce79 100644 --- a/Source/Utility/LexiconBoundary.h +++ b/Source/Utility/Lexicon/LexiconBoundary.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_LEXICONBOUNDARY_H -#define RAGNAROK_SOURCE_UTILITY_LEXICONBOUNDARY_H +#ifndef RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONBOUNDARY_H +#define RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONBOUNDARY_H #include diff --git a/Source/Utility/LexiconMatcher.cpp b/Source/Utility/Lexicon/LexiconMatcher.cpp similarity index 76% rename from Source/Utility/LexiconMatcher.cpp rename to Source/Utility/Lexicon/LexiconMatcher.cpp index fe7cb18..fd5ecdc 100644 --- a/Source/Utility/LexiconMatcher.cpp +++ b/Source/Utility/Lexicon/LexiconMatcher.cpp @@ -1,7 +1,6 @@ -#include "Utility/LexiconMatcher.h" - -#include +#include "Utility/Lexicon/LexiconMatcher.h" +// OFFSET: 0x00AC48E0 // FUNCTION: fn_17631 int __stdcall MatchLexicon(const unsigned char* data, int, const unsigned char* text, const unsigned char* end, int) { if (*text == 0) { @@ -17,14 +16,13 @@ int __stdcall MatchLexicon(const unsigned char* data, int, const unsigned char* return matched; } - std::uint32_t offset = (static_cast(entry[0] & 0x3F) << 16) | - (static_cast(entry[1]) << 8) | entry[2]; + int offset = ((entry[0] & 0x3F) << 16) | (entry[1] << 8) | entry[2]; entry += 3; const unsigned char* candidate = data + offset; - const unsigned int count = *candidate; + const int count = *candidate; if (count < 0x20 && candidate[1] == *text) { ++offset; - for (unsigned int index = 0; index < count; ++index) { + for (int index = 0; index < count; ++index) { if (data[offset++] != *text) { failed = true; break; @@ -54,7 +52,7 @@ int __stdcall MatchLexicon(const unsigned char* data, int, const unsigned char* ++matched; entry = candidate + 1; ++text; - if (static_cast(*entry) < 0) { + if ((*entry & 0x80) != 0) { accepted = matched; } } diff --git a/Source/Utility/LexiconMatcher.h b/Source/Utility/Lexicon/LexiconMatcher.h similarity index 55% rename from Source/Utility/LexiconMatcher.h rename to Source/Utility/Lexicon/LexiconMatcher.h index 963a7a2..70d2ccb 100644 --- a/Source/Utility/LexiconMatcher.h +++ b/Source/Utility/Lexicon/LexiconMatcher.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_LEXICONMATCHER_H -#define RAGNAROK_SOURCE_UTILITY_LEXICONMATCHER_H +#ifndef RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONMATCHER_H +#define RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONMATCHER_H int __stdcall MatchLexicon(const unsigned char* data, int mode, const unsigned char* text, const unsigned char* end, int options); diff --git a/Source/Utility/LexiconSerializer.cpp b/Source/Utility/Lexicon/LexiconSerializer.cpp similarity index 95% rename from Source/Utility/LexiconSerializer.cpp rename to Source/Utility/Lexicon/LexiconSerializer.cpp index 457a33d..8c3107c 100644 --- a/Source/Utility/LexiconSerializer.cpp +++ b/Source/Utility/Lexicon/LexiconSerializer.cpp @@ -1,5 +1,6 @@ -#include "Utility/LexiconSerializer.h" +#include "Utility/Lexicon/LexiconSerializer.h" +// OFFSET: 0x00AC3FF0 // FUNCTION: fn_17630 void LexiconSerializer::Destroy(LexiconNode* node) { if (node != nullptr) { @@ -9,6 +10,7 @@ void LexiconSerializer::Destroy(LexiconNode* node) { } } +// OFFSET: 0x00AC4D40 // FUNCTION: fn_17633 std::uint32_t LexiconSerializer::Serialize(LexiconNode* node, std::uint32_t offset, unsigned char terminal) { int siblings = 0; diff --git a/Source/Utility/LexiconSerializer.h b/Source/Utility/Lexicon/LexiconSerializer.h similarity index 82% rename from Source/Utility/LexiconSerializer.h rename to Source/Utility/Lexicon/LexiconSerializer.h index 41bcb00..c425560 100644 --- a/Source/Utility/LexiconSerializer.h +++ b/Source/Utility/Lexicon/LexiconSerializer.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_LEXICONSERIALIZER_H -#define RAGNAROK_SOURCE_UTILITY_LEXICONSERIALIZER_H +#ifndef RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONSERIALIZER_H +#define RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONSERIALIZER_H #include diff --git a/Source/Utility/RadialGrid.cpp b/Source/Utility/Math/RadialGrid.cpp similarity index 89% rename from Source/Utility/RadialGrid.cpp rename to Source/Utility/Math/RadialGrid.cpp index be9fcc3..b51d7c6 100644 --- a/Source/Utility/RadialGrid.cpp +++ b/Source/Utility/Math/RadialGrid.cpp @@ -1,7 +1,8 @@ -#include "Utility/RadialGrid.h" +#include "Utility/Math/RadialGrid.h" #include +// OFFSET: 0x00AF61A0 // FUNCTION: fn_18251 std::vector GenerateRadialGrid(const RadialGridPoint& center, int radius) { std::vector points; diff --git a/Source/Utility/RadialGrid.h b/Source/Utility/Math/RadialGrid.h similarity index 65% rename from Source/Utility/RadialGrid.h rename to Source/Utility/Math/RadialGrid.h index da24116..83f1c96 100644 --- a/Source/Utility/RadialGrid.h +++ b/Source/Utility/Math/RadialGrid.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_RADIALGRID_H -#define RAGNAROK_SOURCE_UTILITY_RADIALGRID_H +#ifndef RAGNAROK_SOURCE_UTILITY_MATH_RADIALGRID_H +#define RAGNAROK_SOURCE_UTILITY_MATH_RADIALGRID_H #include diff --git a/Source/Utility/Base64.cpp b/Source/Utility/Text/Base64.cpp similarity index 98% rename from Source/Utility/Base64.cpp rename to Source/Utility/Text/Base64.cpp index 84db0dd..9ce7e65 100644 --- a/Source/Utility/Base64.cpp +++ b/Source/Utility/Text/Base64.cpp @@ -1,4 +1,4 @@ -#include "Utility/Base64.h" +#include "Utility/Text/Base64.h" #include diff --git a/Source/Utility/Base64.h b/Source/Utility/Text/Base64.h similarity index 65% rename from Source/Utility/Base64.h rename to Source/Utility/Text/Base64.h index b5f41f6..c20b724 100644 --- a/Source/Utility/Base64.h +++ b/Source/Utility/Text/Base64.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_BASE64_H -#define RAGNAROK_SOURCE_UTILITY_BASE64_H +#ifndef RAGNAROK_SOURCE_UTILITY_TEXT_BASE64_H +#define RAGNAROK_SOURCE_UTILITY_TEXT_BASE64_H #include diff --git a/Source/Utility/Text/FormatString.cpp b/Source/Utility/Text/FormatString.cpp index a180eba..23b32f9 100644 --- a/Source/Utility/Text/FormatString.cpp +++ b/Source/Utility/Text/FormatString.cpp @@ -26,6 +26,7 @@ int StringFormat(char* buffer, std::size_t sizeInBytes, std::size_t count, const namespace { class ThreadSafeBuffer { public: + // OFFSET: 0x00733F00 // FUNCTION: fn_07592 ThreadSafeBuffer() { InitializeCriticalSection(&this->m_criticalSection); diff --git a/Source/Utility/TextEscapes.cpp b/Source/Utility/Text/TextEscapes.cpp similarity index 89% rename from Source/Utility/TextEscapes.cpp rename to Source/Utility/Text/TextEscapes.cpp index af53144..0a18a4b 100644 --- a/Source/Utility/TextEscapes.cpp +++ b/Source/Utility/Text/TextEscapes.cpp @@ -1,5 +1,6 @@ -#include "Utility/TextEscapes.h" +#include "Utility/Text/TextEscapes.h" +// OFFSET: 0x00AF41D0 // FUNCTION: fn_18244 void DecodeTextEscapes(std::string& text) { for (std::size_t position = text.find("\\r"); position != std::string::npos; position = text.find("\\r")) { diff --git a/Source/Utility/Text/TextEscapes.h b/Source/Utility/Text/TextEscapes.h new file mode 100644 index 0000000..e557f10 --- /dev/null +++ b/Source/Utility/Text/TextEscapes.h @@ -0,0 +1,8 @@ +#ifndef RAGNAROK_SOURCE_UTILITY_TEXT_TEXTESCAPES_H +#define RAGNAROK_SOURCE_UTILITY_TEXT_TEXTESCAPES_H + +#include + +void DecodeTextEscapes(std::string& text); + +#endif diff --git a/Source/Utility/TextTokens.cpp b/Source/Utility/Text/TextTokens.cpp similarity index 95% rename from Source/Utility/TextTokens.cpp rename to Source/Utility/Text/TextTokens.cpp index 20d9698..f34e732 100644 --- a/Source/Utility/TextTokens.cpp +++ b/Source/Utility/Text/TextTokens.cpp @@ -1,4 +1,4 @@ -#include "Utility/TextTokens.h" +#include "Utility/Text/TextTokens.h" #include @@ -17,12 +17,14 @@ const unsigned char g_colorHexDigit[256] = { // GLOBAL: gl_24543 unsigned char g_inlineCharset = 0xFF; +// OFFSET: 0x0054FF10 // FUNCTION: fn_01963 bool IsPipeColorToken(const char* text) { return g_inlineCharset == 0 && std::strlen(text) >= 3 && *text == '|' && g_colorHexDigit[static_cast(text[1])] != 0 && g_colorHexDigit[static_cast(text[2])] != 0; } +// OFFSET: 0x0054FF60 // FUNCTION: fn_01964 bool IsHexColorToken(const char* text, const char* end) { if (*text != '^' || end - text <= 6) { @@ -38,6 +40,7 @@ bool IsHexColorToken(const char* text, const char* end) { return true; } +// OFFSET: 0x009BA740 // FUNCTION: fn_13883 std::string __stdcall StripColorTokens(const char* text, std::uint32_t length) { std::string result; diff --git a/Source/Utility/TextTokens.h b/Source/Utility/Text/TextTokens.h similarity index 75% rename from Source/Utility/TextTokens.h rename to Source/Utility/Text/TextTokens.h index 94b9d95..858ec07 100644 --- a/Source/Utility/TextTokens.h +++ b/Source/Utility/Text/TextTokens.h @@ -1,5 +1,5 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_TEXTTOKENS_H -#define RAGNAROK_SOURCE_UTILITY_TEXTTOKENS_H +#ifndef RAGNAROK_SOURCE_UTILITY_TEXT_TEXTTOKENS_H +#define RAGNAROK_SOURCE_UTILITY_TEXT_TEXTTOKENS_H #include #include diff --git a/Source/Utility/TextEscapes.h b/Source/Utility/TextEscapes.h deleted file mode 100644 index 4607d8f..0000000 --- a/Source/Utility/TextEscapes.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef RAGNAROK_SOURCE_UTILITY_TEXTESCAPES_H -#define RAGNAROK_SOURCE_UTILITY_TEXTESCAPES_H - -#include - -void DecodeTextEscapes(std::string& text); - -#endif diff --git a/Source/Utility/Timestamp.cpp b/Source/Utility/Timestamp.cpp index bc4afc7..5508aa3 100644 --- a/Source/Utility/Timestamp.cpp +++ b/Source/Utility/Timestamp.cpp @@ -1,9 +1,11 @@ #include "Utility/Timestamp.h" +// OFFSET: 0x00AE81A0 // FUNCTION: fn_18084 Timestamp::~Timestamp() { } +// OFFSET: 0x00AE81B0 // FUNCTION: fn_18085 TIMESTAMP_STRUCT Timestamp::ToSqlTimestamp() { TIMESTAMP_STRUCT result{}; @@ -22,11 +24,13 @@ TIMESTAMP_STRUCT Timestamp::ToSqlTimestamp() { return result; } +// OFFSET: 0x00AE8280 // FUNCTION: fn_18086 int Timestamp::IsBefore(__time32_t other) const { return _difftime32(this->seconds, other) < 0.0; } +// OFFSET: 0x00AE82B0 // FUNCTION: fn_18087 int Timestamp::IsBeforeNow() const { __time32_t now; @@ -34,36 +38,43 @@ int Timestamp::IsBeforeNow() const { return _difftime32(this->seconds, now) < 0.0; } +// OFFSET: 0x00AE82F0 // FUNCTION: fn_18088 int Timestamp::Day() const { return _localtime32(&this->seconds)->tm_mday; } +// OFFSET: 0x00AE8300 // FUNCTION: fn_18089 int Timestamp::Hour() const { return _localtime32(&this->seconds)->tm_hour; } +// OFFSET: 0x00AE8310 // FUNCTION: fn_18090 int Timestamp::Minute() const { return _localtime32(&this->seconds)->tm_min; } +// OFFSET: 0x00AE8320 // FUNCTION: fn_18091 int Timestamp::Month() const { return _localtime32(&this->seconds)->tm_mon + 1; } +// OFFSET: 0x00AE8350 // FUNCTION: fn_18092 int Timestamp::Second() const { return _localtime32(&this->seconds)->tm_sec; } +// OFFSET: 0x00AE83B0 // FUNCTION: fn_18093 int Timestamp::Year() const { return _localtime32(&this->seconds)->tm_year + 1900; } +// OFFSET: 0x00AE83D0 // FUNCTION: fn_18094 __time32_t Timestamp::SetDate(short year, short month, short day, short hour) { std::tm local{}; diff --git a/compile.json b/compile.json index ccfaa0a..706219c 100644 --- a/compile.json +++ b/compile.json @@ -582,28 +582,28 @@ "Source/Utility/Async/NMessageQueue.cpp": 0, "Source/Utility/Async/NObject.cpp": 0, "Source/Utility/Async/NRecycleObjectPoolMgr.cpp": 0, - "Source/Utility/Base64.cpp": 0, + "Source/Utility/Text/Base64.cpp": 0, "Source/Utility/GuidParse.cpp": 0, - "Source/Utility/LexiconBoundary.cpp": 0, - "Source/Utility/LexiconMatcher.cpp": 0, - "Source/Utility/LexiconSerializer.cpp": 0, - "Source/Utility/MD5.cpp": 0, + "Source/Utility/Lexicon/LexiconBoundary.cpp": 0, + "Source/Utility/Lexicon/LexiconMatcher.cpp": 0, + "Source/Utility/Lexicon/LexiconSerializer.cpp": 0, + "Source/Utility/Hash/MD5.cpp": 0, "Source/Utility/Math/AffineLookAt.cpp": 0, "Source/Utility/Math/AffineMatrix.cpp": 0, "Source/Utility/Math/ClientAngles.cpp": 0, "Source/Utility/Math/RayTriangle.cpp": 0, - "Source/Utility/RadialGrid.cpp": 0, - "Source/Utility/Rijndael.cpp": 0, + "Source/Utility/Math/RadialGrid.cpp": 0, + "Source/Utility/Cipher/Rijndael.cpp": 0, "Source/Utility/Text/FormatString.cpp": 0, "Source/Utility/Text/GroupedInteger.cpp": 0, "Source/Utility/Text/LanguageCharset.cpp": 0, - "Source/Utility/TextEscapes.cpp": 0, - "Source/Utility/TextTokens.cpp": 0, + "Source/Utility/Text/TextEscapes.cpp": 0, + "Source/Utility/Text/TextTokens.cpp": 0, "Source/Utility/Threading/NSyncObject.cpp": 0, "Source/Utility/Threading/NThread.cpp": 0, "Source/Utility/Timestamp.cpp": 0, - "Source/Utility/XorBytes.cpp": 0, - "Source/Utility/XxHash32.cpp": 0, + "Source/Utility/Cipher/XorBytes.cpp": 0, + "Source/Utility/Hash/XxHash32.cpp": 0, "ThirdParty/jsoncpp/src/lib_json/json_reader.cpp": 8, "ThirdParty/jsoncpp/src/lib_json/json_value.cpp": 8, "ThirdParty/jsoncpp/src/lib_json/json_writer.cpp": 8,