summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/Volume.cpp
diff options
context:
space:
mode:
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)
{