From 45cfaa8af690ffd1e35af155de438a846186d891 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 01:27:45 +0000 Subject: [PATCH] Decompile fn_24220 (EmotionHotkeys::Save) Batch #11569 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_24220 EmotionHotkeys::Save: logic confirmed by peer review Peer-reviewed-by: Yommy, KWDev, Tanke, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Hotkeys/EmotionHotkeys.cpp | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Source/Contents/Hotkeys/EmotionHotkeys.cpp b/Source/Contents/Hotkeys/EmotionHotkeys.cpp index 3c89b420..b52079f1 100644 --- a/Source/Contents/Hotkeys/EmotionHotkeys.cpp +++ b/Source/Contents/Hotkeys/EmotionHotkeys.cpp @@ -40,31 +40,30 @@ bool EmotionHotkeys::HasChanges() const { // OFFSET: 0x00E48460 // FUNCTION: fn_24220 -void EmotionHotkeys::Save(std::uint32_t accountId, CRenderSystemBase* renderSystem) const { +void EmotionHotkeys::Save(std::uint32_t accountId, CRenderSystemBase*) const { if (this->current.empty()) { return; } - std::string output = "tbl = \r\n{\r\n"; - + std::string output; + output += "tbl = \r\n"; + output += "{\r\n"; for (const std::string& entry : this->current) { - output += "\t[=["; - output += entry; - output += "]=],\r\n"; + output += std::format("\t[=[{}]=],\r\n", entry); } - output += "}\r\n"; - const char* directory = "savedata\\shortcutlist"; - if (_access_s(directory, 0) != 0) { - _mkdir(directory); - } + if (!output.empty()) { + const std::string directory = "savedata\\shortcutlist"; + if (_access_s(directory.c_str(), 0) != 0) { + _mkdir(directory.c_str()); + } - CFile file; - const std::string path = std::string(directory) + "\\" + ShortcutFilename(accountId) + ".lua"; - if (file.OpenWrite(path.c_str(), renderSystem)) { - file.Write(output.data(), static_cast(output.size())); - file.Close(); + CFile file; + if (file.Open(std::format("{}\\{}.lua", directory, ShortcutFilename(accountId)).c_str(), 0x1001, false, true)) { + file.Write(output.data(), static_cast(output.size())); + file.Close(); + } } }