diff options
| author | JosJuice <josjuice@gmail.com> | 2026-02-23 20:39:27 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2026-02-24 21:09:12 +0100 |
| commit | 1d74321212e24b5709e20ca17710bc435882de45 (patch) | |
| tree | 5cb7c49756c4a838925d1a2fdcfc6046265b57c7 | |
| parent | d58e7ca9325217574d84d961b824e0acbf2f67e9 (diff) | |
DiscIO: Move DecodeString to Volume.cpp
This had to be in the header back when it was templated, but 083faa8b
made it not templated.
| -rw-r--r-- | Source/Core/DiscIO/Volume.cpp | 9 | ||||
| -rw-r--r-- | 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 <cstring> #include <functional> #include <map> #include <memory> #include <optional> +#include <span> #include <string> #include <type_traits> #include <utility> @@ -34,6 +36,13 @@ const IOS::ES::TicketReader Volume::INVALID_TICKET{}; const IOS::ES::TMDReader Volume::INVALID_TMD{}; const std::vector<u8> Volume::INVALID_CERT_CHAIN{}; +std::string Volume::DecodeString(std::span<const char> 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 <typename T> 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 <cstring> #include <limits> #include <map> #include <memory> @@ -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<u8, 20> GetSyncHash() const = 0; protected: - std::string DecodeString(std::span<const char> 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<const char> data) const; void ReadAndAddToSyncHash(Common::SHA1::Context* context, u64 offset, u64 length, const Partition& partition) const; |
