mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-08-03 20:24:14 +02:00
DiscIO: Move DecodeString to Volume.cpp
This had to be in the header back when it was templated, but 083faa8b
made it not templated.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user