From 1d74321212e24b5709e20ca17710bc435882de45 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Mon, 23 Feb 2026 20:39:27 +0100 Subject: [PATCH] DiscIO: Move DecodeString to Volume.cpp This had to be in the header back when it was templated, but 083faa8b made it not templated. --- Source/Core/DiscIO/Volume.cpp | 9 +++++++++ Source/Core/DiscIO/Volume.h | 13 +------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Source/Core/DiscIO/Volume.cpp b/Source/Core/DiscIO/Volume.cpp index 15ce4fe088..7ef63f6950 100644 --- a/Source/Core/DiscIO/Volume.cpp +++ b/Source/Core/DiscIO/Volume.cpp @@ -3,10 +3,12 @@ #include "DiscIO/Volume.h" +#include #include #include #include #include +#include #include #include #include @@ -34,6 +36,13 @@ const IOS::ES::TicketReader Volume::INVALID_TICKET{}; const IOS::ES::TMDReader Volume::INVALID_TMD{}; const std::vector Volume::INVALID_CERT_CHAIN{}; +std::string Volume::DecodeString(std::span data) const +{ + // strnlen to trim null bytes + std::string string(data.data(), strnlen(data.data(), data.size())); + return GetRegion() == Region::NTSC_J ? SHIFTJISToUTF8(string) : CP1252ToUTF8(string); +} + template static void AddToSyncHash(Common::SHA1::Context* context, const T& data) { diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h index 32f8e8d71f..cdc9a940b0 100644 --- a/Source/Core/DiscIO/Volume.h +++ b/Source/Core/DiscIO/Volume.h @@ -3,7 +3,6 @@ #pragma once -#include #include #include #include @@ -14,7 +13,6 @@ #include "Common/CommonTypes.h" #include "Common/Crypto/SHA1.h" -#include "Common/StringUtil.h" #include "Common/Swap.h" #include "Core/IOS/ES/Formats.h" #include "DiscIO/Enums.h" @@ -144,16 +142,7 @@ public: virtual std::array GetSyncHash() const = 0; protected: - std::string DecodeString(std::span data) const - { - // strnlen to trim NULLs - std::string string(data.data(), strnlen(data.data(), data.size())); - - if (GetRegion() == Region::NTSC_J) - return SHIFTJISToUTF8(string); - - return CP1252ToUTF8(string); - } + std::string DecodeString(std::span data) const; void ReadAndAddToSyncHash(Common::SHA1::Context* context, u64 offset, u64 length, const Partition& partition) const;