Maintenance: Centralize EncryptedName: delete 44 per-unit copies (incl. GameModeEncryptedName) and 4 EncryptedSource copies; units in

Batch #16852 by ragnarok-clanker: no function's compiled code changes; checked with 44 compiled unit(s), including every includer of Source/Utility/Cipher/LocalEncryptedName.h.
This commit is contained in:
ragnarok-clanker 2026-11-11 10:05:15 +00:00
commit d074dedcd7
45 changed files with 125 additions and 1528 deletions

View file

@ -6,6 +6,7 @@
#include "Utility/Hash/XxHash32.h"
#include "Utility/Random/RandomBytes.h"
#include "Utility/Hash/XxHash3.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <algorithm>
#include <atomic>
@ -21,36 +22,6 @@
#include <zlib.h>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
// INLINED
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
#pragma pack(push, 1)

View file

@ -98,6 +98,7 @@
#include "UI/Login/UINewSelectCharWnd.h"
#include "Network/TextEncoding.h"
#include "Resource/MSGSTRINGID.h"
#include "Utility/Cipher/LocalEncryptedName.h"
extern "C" long long _Xtime_get_ticks();
@ -5565,40 +5566,10 @@ void CPingLiveSchedule::Process(const std::uint64_t& now) {
namespace {
template <std::size_t Length, std::uint64_t Key>
class GameModeEncryptedName {
public:
// INLINED
explicit GameModeEncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~GameModeEncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptGameModeName(const char (&source)[Length]) {
thread_local GameModeEncryptedName<Length, Key> name(source);
thread_local EncryptedName<Length, Key> name(source);
return name.Text();
}
@ -5638,7 +5609,7 @@ int CGameMode::Run() {
if (!message.empty()) {
const char source[] = {'\x53', '\x11', '\xF9', '\xA6', '\x8D', '\x7E', '\xA6', '\xD9', '\x1D', '\x06',
'\xEA', '\xA4', '\x9C', '\x5C', '\xB0', '\xCC', '\x4F', '\x25', '\x8B'};
thread_local GameModeEncryptedName<sizeof(source), 0xADC51BF9C98B413DULL> name(source);
thread_local EncryptedName<sizeof(source), 0xADC51BF9C98B413DULL> name(source);
MessageBoxA(hWnd, message.c_str(), name.Text(), 0);
}
}
@ -6758,7 +6729,6 @@ void CGameMode::End() {
g_session.SetPlayerSkillMode(0);
}
// OFFSET: 0x00CE8DE0
// FUNCTION: fn_21342
void CGameMode::ReloadScene() {
@ -7210,8 +7180,6 @@ void CGameMode::PlayItemUseEffect(int itemId, std::uint32_t aid) {
#include <list>
#include <windows.h>
// GLOBAL: gl_24776
int g_visibleMinX;
@ -8003,7 +7971,6 @@ void CGameMode::Initialize(const char* name) {
this->isInitializing[0] = 0;
}
// OFFSET: 0x00D07030
// FUNCTION: fn_21580
void CGameMode::ReceiveSkillList(int packetType, const std::vector<SkillListEntry>& skills) {
@ -8136,7 +8103,6 @@ void CGameMode::ShowActorNameBalloon(std::uint32_t id) {
this->PlaceWindowAtActor(this->nameBalloon, reinterpret_cast<CGameActor*>(item));
}
// OFFSET: 0x00CE18A0
// FUNCTION: fn_21332
void CGameMode::ProcessActorClick(int& handled, ActorPickInfo* pick, CGameActor* actor) {
@ -8453,7 +8419,6 @@ int CGameMode::ProcessMousePick(int result, ActorPickInfo* pick) {
#include "Contents/World/WorldModelView.h"
#include "Contents/World/WorldTerrainPicking.h"
// OFFSET: 0x00CE0210
// FUNCTION: fn_21329
int CGameMode::ProcessGroundClick(int result) {
@ -8733,7 +8698,6 @@ int CGameMode::ProcessGroundClick(int result) {
#include "UI/Dialogs/UIMenuWnd.h"
#include "UI/Window/InputFocus.h"
#include "Client/Application/ApplicationMessages.h"
#include "Client/Mode/ModeFade.h"
#include "Contents/Actors/ActorNameCard.h"

View file

@ -24,6 +24,7 @@
#include "Utility/Math/AffineMatrix.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdint>
#include <cstdio>
@ -31,40 +32,8 @@
#include <timeapi.h>
#include <windows.h>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
// INLINED
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
__forceinline const char* TimeFontActionName() {
const char source[] = {'\xB1', '\x4F', '\xAD', '\xDA', '\xD7', '\xA1', '\x01', '\x29', '\x18', '\xEE', '\x0E', '\x4D', '\x7E', '\x61', '\x29', '\x53', '\x10', '\xE0', '\x1F', '\x0B'};
@ -86,7 +55,6 @@ __forceinline const char* TimeFontSpriteName() {
// GLOBAL: gl_25107
CFile g_whisperFile;
// OFFSET: 0x00CCFCE0
// FUNCTION: fn_21246
void MiniMapNoOp() {
@ -581,7 +549,6 @@ int g_minimapCoordinateDigits;
// GLOBAL: gl_25046
int g_minimapCoordinateDigitValues[4];
// OFFSET: 0x00CD2A10
// FUNCTION: fn_21261
void CGameMode::DrawMiniMapNumber() {

View file

@ -8,6 +8,7 @@
#include "Network/Connection/Connection.h"
#include "UI/Window/UIWindowMgr.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Resource/MSGSTRINGID.h"
#include <array>
@ -19,41 +20,6 @@
#include <timeapi.h>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
explicit EncryptedName(const std::array<std::uint8_t, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
#pragma pack(push, 1)
struct BillingInfoPacket {
@ -72,7 +38,6 @@ namespace {
static_assert(sizeof(NotifyBanPacket) == 3);
}
// OFFSET: 0x00D9A350
// FUNCTION: fn_22311
void CLoginMode::ReceiveBillingInfo(const unsigned char* data) {

View file

@ -3,6 +3,7 @@
#include "Script/NLuaState.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
extern "C" {
#include <lauxlib.h>
@ -205,40 +206,6 @@ bool CAchievementMgr::FindTab(int id, int& group, int& index) {
return false;
}
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
// OFFSET: 0x0066EAA0
// FUNCTION: fn_05322
bool CAchievementMgr::LoadAchievementInfo() {

View file

@ -72,10 +72,10 @@
#include <windows.h>
#include <timeapi.h>
#include "Contents/Guild/GuildInfo.h"
#include "Utility/Cipher/LocalEncryptedName.h"
extern template void std::list<CRenderObject*>::push_back(CRenderObject*&&);
// GLOBAL: gl_25173
int g_playerPoisoned;
@ -93,43 +93,9 @@ struct CharacterRenderDrawItem {
RenderCommand* command;
};
// GLOBAL: gl_24798
int g_multiHitInterval = 200;
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
class CGrannyCorpse3d : public CGameObject {
public:
explicit CGrannyCorpse3d(const char* name);
@ -702,7 +668,6 @@ void CRenderObject::SetAnimationSpeed(float speed) {
}
}
// OFFSET: 0x00CC2810
// FUNCTION: fn_21142
void CGameActor::SetHealthState(int value) {
@ -4816,7 +4781,6 @@ CCharacterNpc::~CCharacterNpc() {
}
}
// OFFSET: 0x00CBFC40
// FUNCTION: fn_21120
void CGameActor::SetStatusStates(int bodyState, std::uint32_t stateFlags, int effectState, bool notify) {

View file

@ -66,6 +66,7 @@
#include "Contents/Effects/Skills/TriangleShotArrow.h"
#include "Contents/Effects/Skills/ViolentQuakeEffect.h"
#include "Contents/Effects/Skills/WindEffect.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Session/Session.h"
@ -436,35 +437,6 @@ void DestroyEffectMgr() {
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
/* 0000 */ std::uint8_t m_text[Length];
/* 0044 */ bool m_encrypted;
};
template <class T>
struct CEffectAllocator : CAllocator {
CEffectAllocator() {}

View file

@ -1,4 +1,5 @@
#include "Contents/Effects/Particles/CharacterParticleBundle.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/ModeMgr.h"
@ -21,36 +22,6 @@
#include <vector>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// GLOBAL: gl_24870
std::unordered_map<int, std::vector<RadialGridPoint>> g_clawMarkRings;

View file

@ -1,5 +1,6 @@
#include "Contents/Effects/Core/EffectTypes.h"
#include "Contents/Effects/Particles/SpriteEffect.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/ModeMgr.h"
@ -14,36 +15,6 @@
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const char (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <stdio.h>
#include <windows.h>
@ -19,35 +20,6 @@ namespace {
return AsyncDiagnostic(&success, &message, sourceFile, &line);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cctype>
#include <windows.h>
@ -20,35 +21,6 @@ namespace {
target.MoveFrom(diagnostic);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "UI/Window/UIWindowMgr.h"
#include "Utility/Async/AsyncDiagnostic.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Resource/MSGSTRINGID.h"
#include <json/reader.h>
@ -20,37 +21,6 @@ namespace {
#pragma pack(pop)
static_assert(sizeof(EmblemVersionPacket) == 10);
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
// INLINED
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Render/Renderer.h"
#include "Resource/Bitmap/BitmapResource.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstddef>
#include <cstdint>
@ -12,40 +13,6 @@
#include <string>
#include <vector>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
// OFFSET: 0x00DE8740
// FUNCTION: fn_23498
bool CSession::LoadMapNameTable() {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdio>
#include <windows.h>
@ -26,35 +27,6 @@ namespace {
target.MoveFrom(diagnostic);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdio>
#include <windows.h>
@ -26,38 +27,6 @@ namespace {
target.MoveFrom(diagnostic);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
// INLINED
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdio>
#include <windows.h>
@ -19,35 +20,6 @@ namespace {
return AsyncDiagnostic(&success, &message, sourceFile, &line);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdio>
#include <windows.h>
@ -19,35 +20,6 @@ namespace {
return AsyncDiagnostic(&success, &message, sourceFile, &line);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -6,6 +6,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdio>
#include <windows.h>
@ -14,35 +15,6 @@
namespace {
constexpr char sourceFile[] = "C:\\repositories\\RagnarokClient\\RagnarokClient\\Contents\\AdventurerAgency\\CRegisterPartyAsyncWork.cpp";
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdio>
#include <windows.h>
@ -26,35 +27,6 @@ namespace {
target.MoveFrom(diagnostic);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -1,42 +1,13 @@
#include "Contents/Jobs/JobId.h"
#include "Client/Session/Session.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstddef>
#include <cstdint>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const char (&source)[Length]) {

View file

@ -15,6 +15,7 @@
#include "Contents/Skills/SkillInfo.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Math/Vector3d.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <algorithm>
#include <array>
@ -24,49 +25,6 @@
#include <string>
#include <string_view>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
template <typename Byte>
explicit EncryptedName(const std::array<Byte, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
class CSkillAction_AnimalForm : public CSkillAction {
public:
bool CanUse(CGameActor* actor);
@ -2039,7 +1997,6 @@ void __stdcall OnSkillObjectCreate(int a, int b, int c) {
void __stdcall OnSkillObjectRemove(int a) {
}
// OFFSET: 0x005AF4E0
// FUNCTION: fn_03326
int CSkillAction_AT_PRIMAL_CLAW::GetSkillAttackMotion() {

View file

@ -15,6 +15,7 @@
#include "Contents/Skills/SkillInfo.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Math/Vector3d.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <array>
#include <cstddef>
@ -22,49 +23,6 @@
#include <format>
#include <string>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
template <typename Byte>
explicit EncryptedName(const std::array<Byte, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
class CSkillAction_AnimalForm : public CSkillAction {
public:
bool CanUse(CGameActor* actor);

View file

@ -15,6 +15,7 @@
#include "Contents/Skills/SkillInfo.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Math/Vector3d.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <algorithm>
#include <array>
@ -25,49 +26,6 @@
#include <string>
#include <windows.h>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
template <typename Byte>
explicit EncryptedName(const std::array<Byte, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
class CSkillAction_AnimalForm : public CSkillAction {
public:
bool CanUse(CGameActor* actor);

View file

@ -6,6 +6,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <array>
#include <cstdio>
@ -24,42 +25,6 @@ namespace {
return AsyncDiagnostic(&success, &message, file, &line);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
explicit EncryptedName(const std::array<std::uint8_t, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -6,6 +6,7 @@
#include "Resource/Bitmap/TextureNames.h"
#include "Script/NLuaState.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Cipher/LocalEncryptedName.h"
extern "C" {
#include <lauxlib.h>
@ -26,35 +27,6 @@ extern "C" {
CTipBoxMgr* g_itemTagOwner = nullptr;
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>

View file

@ -14,6 +14,7 @@
#include "UI/Window/UIWindowMgr.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <algorithm>
#include <cstddef>
@ -31,36 +32,6 @@ int g_serviceMode;
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const char (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <array>
#include <cstdio>
@ -22,42 +23,6 @@ namespace {
return AsyncDiagnostic(&success, &message, sourceFile, &line);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
explicit EncryptedName(const std::array<std::uint8_t, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdio>
#include <windows.h>
@ -28,35 +29,6 @@ namespace {
target.MoveFrom(diagnostic);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdio>
#include <windows.h>
@ -21,35 +22,6 @@ namespace {
return AsyncDiagnostic(&success, &message, sourceFile, &line);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -5,6 +5,7 @@
#include "Network/TextEncoding.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstdio>
#include <windows.h>
@ -28,35 +29,6 @@ namespace {
target.MoveFrom(diagnostic);
}
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const std::uint8_t (&source)[Length]) {

View file

@ -7,6 +7,7 @@
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Threading/NSyncObject.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Resource/MSGSTRINGID.h"
#include <array>
@ -46,42 +47,6 @@ public:
};
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
explicit EncryptedName(const std::array<char, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>

View file

@ -23,6 +23,7 @@
#include "Contents/Items/ItemDescription.h"
#include "UI/Window/UIRegisterMgr.h"
#include "Resource/MSGSTRINGID.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstring>
#include <format>
#include <list>
@ -38,61 +39,6 @@ extern template void std::_List_node<AdventureGuide::CItemData, void*>::_Free_no
extern template void std::_List_node<AdventureGuide::CQuestInfo, void*>::_Free_non_head(
std::allocator<std::_List_node<AdventureGuide::CQuestInfo, void*>>&, std::_List_node<AdventureGuide::CQuestInfo, void*>*) noexcept;
namespace {
template <std::size_t Length>
class EncryptedSource {
public:
// INLINED
template <typename Byte>
constexpr explicit EncryptedSource(const Byte (&source)[Length]) : data{} {
for (std::size_t index = 0; index < Length; ++index) {
this->data[index] = static_cast<char>(source[index]);
}
}
char data[Length];
};
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const EncryptedSource<Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = static_cast<std::uint8_t>(source.data[index]);
}
}
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
template void CUIListBoxEx<AdventureGuide::CUIMonsterInfo, AdventureGuide::CMonsterData>::UpdateScrollBar();
template void CUIListBox<AdventureGuide::CUITab>::UpdateScrollBar();
template void CUIListBox<AdventureGuide::CUISubTab>::UpdateScrollBar();
@ -2516,7 +2462,6 @@ void CUIIntro::OnCreate(int width, int height) {
this->AddChild(this->contents);
}
// OFFSET: 0x009C6F50
// FUNCTION: fn_14002
void CUIItem::OnCreate(int width, int height) {
@ -2716,7 +2661,6 @@ void CUIItem::OnCreate(int width, int height) {
this->AddChild(this->navigationButton);
}
// OFFSET: 0x009CDD40
// FUNCTION: fn_14006
void CUIQuest::OnCreate(int width, int height) {
@ -2916,7 +2860,6 @@ void CUIQuest::OnCreate(int width, int height) {
this->AddChild(this->navigationButton);
}
// OFFSET: 0x009CAE30
// FUNCTION: fn_14004
void CUIMonster::OnCreate(int width, int height) {

View file

@ -1,55 +1,13 @@
#include "UI/Lists/UIListBoxTemplate.h"
#include "UI/Text/UIStaticTextControl.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <array>
#include <cstddef>
#include <cstdint>
#include <string>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
template <typename Byte>
explicit EncryptedName(const std::array<Byte, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
}
namespace AdventureGuide {
// OFFSET: 0x009D1830

View file

@ -98,6 +98,7 @@
#include "Resource/Sprites/ImfResource.h"
#include "Resource/Bitmap/PaletteResource.h"
#include "Contents/Jobs/JobInheritance.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Resource/MSGSTRINGID.h"
// GLOBAL: gl_25153
@ -109,36 +110,6 @@ static const std::string s_messageBoxItemLinkClosing = "</ITEML>";
namespace {
constexpr char prefix[] = "유저인터페이스\\";
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
int TileCount(int length, int tile) {
const std::div_t tiles = std::div(length, tile);

View file

@ -9,6 +9,7 @@
#include "UI/Text/UIStaticTextControl.h"
#include "Utility/Cipher/XorBytes.h"
#include "UI/Window/UIRegisterMgr.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <algorithm>
#include <cstddef>
#include <cstdint>
@ -19,60 +20,6 @@
extern template char* std::_UIntegral_to_buff<char, unsigned int>(char*, unsigned int);
namespace {
template <std::size_t Length>
class EncryptedSource {
public:
// INLINED
template <typename Byte>
constexpr explicit EncryptedSource(const Byte (&source)[Length]) : data{} {
for (std::size_t index = 0; index < Length; ++index) {
this->data[index] = static_cast<char>(source[index]);
}
}
char data[Length];
};
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const EncryptedSource<Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = static_cast<std::uint8_t>(source.data[index]);
}
}
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
// GLOBAL: gl_24882
template <>
CEnchantMgr* Singleton<CEnchantMgr>::s_instance = nullptr;

View file

@ -2,6 +2,7 @@
#include "UI/Window/WindowId.h"
#include "UI/Exchange/UIExchangeUI.h"
#include "UI/Window/UIEnums.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Client/Session/Session.h"
#include "Client/Mode/CGameMode.h"
@ -52,8 +53,6 @@ void CUIListBoxEx<ExchangeUI::CUIItem, ExchangeUI::CItemData>::AddNewItem();
template <>
void CUIListBoxEx<ExchangeUI::CUIItem, ExchangeUI::CItemData>::LoadSkin(bool resolveSkin);
// INLINED
template <std::uint64_t Key, std::size_t Length>
static const char* DecryptName(const char (&source)[Length]) {
@ -600,40 +599,6 @@ void CUIExchangeUI::FreezeItems(bool mine) {
list->Invalidate();
}
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
// OFFSET: 0x00A149B0
// FUNCTION: fn_15192
void ExchangeUI::CUIItem::OnCreate(int width, int height) {

View file

@ -36,6 +36,7 @@
#include "Utility/Text/StringUtil.h"
#include "UI/Window/UIRegisterMgr.h"
#include "Resource/MSGSTRINGID.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <algorithm>
#include <cstdint>
#include <cstring>
@ -45,51 +46,6 @@
#include <string>
#include <vector>
namespace {
template <std::size_t Length>
class EncryptedSource {
public:
// INLINED
constexpr explicit EncryptedSource(const std::uint8_t (&source)[Length]) : data{} {
for (std::size_t index = 0; index < Length; ++index) {
this->data[index] = static_cast<char>(source[index]);
}
}
char data[Length];
};
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const EncryptedSource<Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = static_cast<std::uint8_t>(source.data[index]);
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
namespace {
struct RodexSpamOptionPacket {
/* 0000 */ std::int16_t id;
@ -102,7 +58,6 @@ namespace {
// GLOBAL: gl_24768
int g_configuredRenderBackend;
// GLOBAL: gl_24509
int g_textureFiltering;

View file

@ -1,6 +1,7 @@
#include "UI/Window/UIEnums.h"
#include "UI/Window/WindowId.h"
#include "UI/Items/UIEquipmentPropertiesWnd.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Contents/Tables/MessageTable.h"
#include "Contents/Messenger/ClientMessenger.h"
@ -268,47 +269,6 @@ void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::s
this->AddChild(this->scrollBar);
}
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
explicit EncryptedName(const std::array<char, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
// OFFSET: 0x00A09130
// FUNCTION: fn_15035
void CUIEquipmentPropertiesWnd::OnCreate(int width, int height) {

View file

@ -1,5 +1,6 @@
#include "UI/Login/UIWaitDBSaveWnd.h"
#include "UI/Window/WindowId.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Render/Textures/SpritePixels.h"
#include "Resource/Bitmap/BitmapResource.h"
@ -19,37 +20,6 @@
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
__forceinline const char* WaitSpriteName() {
const char spriteSource[] = {'\x1A', '\x44', '\xF0', '\x3D', '\x17', '\x01', '\xD2', '\x66', '\x3B', '\x40', '\xC5', '\x07', '\x3C',

View file

@ -14,6 +14,7 @@
#include "UI/Window/WindowManagerWindows.h"
#include "Utility/Cipher/XorBytes.h"
#include "UI/Window/UIRegisterMgr.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <cstddef>
#include <cstdint>
@ -23,37 +24,6 @@
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const char (&source)[Length]) {

View file

@ -1,5 +1,6 @@
#include "UI/Window/WindowId.h"
#include "UI/ProbabilityTable/UIProbabilityTable.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Network/TextEncoding.h"
#include "UI/Edit/UIEditBoxEx.h"
@ -31,37 +32,6 @@ static const std::string g_probabilityHighlightEnd = "^000000</B>";
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const char (&source)[Length]) {

View file

@ -18,6 +18,7 @@
#include "Utility/Text/FormatString.h"
#include "UI/Window/UIRegisterMgr.h"
#include "Resource/MSGSTRINGID.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include <algorithm>
#include <cstdint>
#include <cstdlib>
@ -691,58 +692,6 @@ void CUISelectPackageItemBox::OnSelectTab(SelectPackageItemBox::CUITabInfo*, con
namespace {
template <std::size_t Length>
class EncryptedSource {
public:
// INLINED
template <typename Byte>
constexpr explicit EncryptedSource(const Byte (&source)[Length]) : data{} {
for (std::size_t index = 0; index < Length; ++index) {
this->data[index] = static_cast<char>(source[index]);
}
}
char data[Length];
};
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const EncryptedSource<Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = static_cast<std::uint8_t>(source.data[index]);
}
}
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length, typename Byte>
const char* DecryptName(const Byte (&source)[Length]) {

View file

@ -44,6 +44,7 @@
#include "Resource/Sprites/ActionResource.h"
#include "Resource/Sprites/SpriteResource.h"
#include "Client/Mode/CMode.h"
#include "Utility/Cipher/LocalEncryptedName.h"
#include "Resource/MSGSTRINGID.h"
#include <cstdio>
@ -53,37 +54,6 @@
#include <windows.h>
#include <timeapi.h>
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
}
// INLINED
static int SkillTabOf(int skillId) {
if (skillId >= NV_BASIC && skillId <= ALL_RESURRECTION) {

View file

@ -20,6 +20,7 @@
#include <string>
#include <vector>
#include "Resource/MSGSTRINGID.h"
#include "Utility/Cipher/LocalEncryptedName.h"
extern template std::string std::operator+(std::string&&, const char* const);
@ -38,37 +39,6 @@ void CUIListBoxEx<SkillDelayInfo::CUIDelayItem, SkillDelayInfo::CDelayItemData>:
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
private:
std::uint8_t m_text[Length];
bool m_encrypted;
};
// INLINED
template <std::uint64_t Key, std::size_t Length>
const char* DecryptName(const char (&source)[Length]) {

View file

@ -0,0 +1,79 @@
#ifndef RAGNAROK_SOURCE_UTILITY_CIPHER_LOCALENCRYPTEDNAME_H
#define RAGNAROK_SOURCE_UTILITY_CIPHER_LOCALENCRYPTEDNAME_H
#include "Utility/Cipher/XorBytes.h"
#include <array>
#include <cstddef>
#include <cstdint>
template <std::size_t Length>
class EncryptedSource {
public:
// INLINED
template <typename Byte>
constexpr explicit EncryptedSource(const Byte (&source)[Length]) : data{} {
for (std::size_t index = 0; index < Length; ++index) {
this->data[index] = static_cast<char>(source[index]);
}
}
char data[Length];
};
namespace {
template <std::size_t Length, std::uint64_t Key>
class EncryptedName {
public:
// INLINED
explicit EncryptedName(const char (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
template <typename Byte>
explicit EncryptedName(const Byte (&source)[Length]) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
template <typename Byte>
explicit EncryptedName(const std::array<Byte, Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = source[index];
}
}
// INLINED
explicit EncryptedName(const EncryptedSource<Length>& source) : m_encrypted(true) {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = static_cast<std::uint8_t>(source.data[index]);
}
}
~EncryptedName() {
for (std::uint64_t index = 0; index < Length; ++index) {
this->m_text[index] = 0;
}
}
// INLINED
const char* Text() {
if (this->m_encrypted) {
utility::XorBytes(this->m_text, Length, Key);
this->m_encrypted = false;
}
return reinterpret_cast<const char*>(this->m_text);
}
/* 0000 */ std::uint8_t m_text[Length];
bool m_encrypted;
};
}
#endif