summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/Volume.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2026-02-23 20:39:27 +0100
committerJosJuice <josjuice@gmail.com>2026-02-24 21:09:12 +0100
commit1d74321212e24b5709e20ca17710bc435882de45 (patch)
tree5cb7c49756c4a838925d1a2fdcfc6046265b57c7 /Source/Core/DiscIO/Volume.cpp
parentd58e7ca9325217574d84d961b824e0acbf2f67e9 (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.
Diffstat (limited to 'Source/Core/DiscIO/Volume.cpp')
-rw-r--r--Source/Core/DiscIO/Volume.cpp9
1 files changed, 9 insertions, 0 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)
{