mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-03-21 17:49:58 -05:00
DiscIO: Make Volume::DecodeString take a std::span so it can work with std::array.
This commit is contained in:
parent
2c62214875
commit
083faa8b21
|
|
@ -8,6 +8,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
@ -143,16 +144,15 @@ public:
|
||||||
virtual std::array<u8, 20> GetSyncHash() const = 0;
|
virtual std::array<u8, 20> GetSyncHash() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <u32 N>
|
std::string DecodeString(std::span<const char> data) const
|
||||||
std::string DecodeString(const char (&data)[N]) const
|
|
||||||
{
|
{
|
||||||
// strnlen to trim NULLs
|
// strnlen to trim NULLs
|
||||||
std::string string(data, strnlen(data, sizeof(data)));
|
std::string string(data.data(), strnlen(data.data(), data.size()));
|
||||||
|
|
||||||
if (GetRegion() == Region::NTSC_J)
|
if (GetRegion() == Region::NTSC_J)
|
||||||
return SHIFTJISToUTF8(string);
|
return SHIFTJISToUTF8(string);
|
||||||
else
|
|
||||||
return CP1252ToUTF8(string);
|
return CP1252ToUTF8(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadAndAddToSyncHash(Common::SHA1::Context* context, u64 offset, u64 length,
|
void ReadAndAddToSyncHash(Common::SHA1::Context* context, u64 offset, u64 length,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user