From 02d760984cf02495d59463648435201d4906fc39 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 26 Oct 2026 21:49:45 +0000 Subject: [PATCH] Decompile fn_18244 (DecodeTextEscapes) Batch #835 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_18244 DecodeTextEscapes: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/Utility/TextEscapes.cpp --- Source/Utility/TextEscapes.cpp | 16 ++++++++++++++++ Source/Utility/TextEscapes.h | 8 ++++++++ compile.json | 1 + 3 files changed, 25 insertions(+) create mode 100644 Source/Utility/TextEscapes.cpp create mode 100644 Source/Utility/TextEscapes.h diff --git a/Source/Utility/TextEscapes.cpp b/Source/Utility/TextEscapes.cpp new file mode 100644 index 0000000..af53144 --- /dev/null +++ b/Source/Utility/TextEscapes.cpp @@ -0,0 +1,16 @@ +#include "Utility/TextEscapes.h" + +// FUNCTION: fn_18244 +void DecodeTextEscapes(std::string& text) { + for (std::size_t position = text.find("\\r"); position != std::string::npos; position = text.find("\\r")) { + text.replace(position, 2, "\r", 1); + } + + for (std::size_t position = text.find("\\n"); position != std::string::npos; position = text.find("\\n")) { + text.replace(position, 2, "\n", 1); + } + + for (std::size_t position = text.find("\\\""); position != std::string::npos; position = text.find("\\\"")) { + text.replace(position, 2, "\"", 1); + } +} diff --git a/Source/Utility/TextEscapes.h b/Source/Utility/TextEscapes.h new file mode 100644 index 0000000..4607d8f --- /dev/null +++ b/Source/Utility/TextEscapes.h @@ -0,0 +1,8 @@ +#ifndef RAGNAROK_SOURCE_UTILITY_TEXTESCAPES_H +#define RAGNAROK_SOURCE_UTILITY_TEXTESCAPES_H + +#include + +void DecodeTextEscapes(std::string& text); + +#endif diff --git a/compile.json b/compile.json index 25040fc..32a4073 100644 --- a/compile.json +++ b/compile.json @@ -593,6 +593,7 @@ "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/Threading/NSyncObject.cpp": 0, "Source/Utility/Threading/NThread.cpp": 0, "Source/Utility/Timestamp.cpp": 0,