mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
DiscIO: Add a Volume::ReadSwappedAndShifted function
This is a fairly common operation, so let's make a utility function for it to cut down on code duplication.
This commit is contained in:
@ -51,6 +51,12 @@ public:
|
||||
return {};
|
||||
return Common::FromBigEndian(temp);
|
||||
}
|
||||
std::optional<u64> ReadSwappedAndShifted(u64 offset, const Partition& partition) const
|
||||
{
|
||||
const std::optional<u32> temp = ReadSwapped<u32>(offset, partition);
|
||||
return temp ? static_cast<u64>(*temp) << GetOffsetShift() : std::optional<u64>();
|
||||
}
|
||||
|
||||
virtual std::vector<Partition> GetPartitions() const { return {}; }
|
||||
virtual Partition GetGamePartition() const { return PARTITION_NONE; }
|
||||
virtual std::optional<u32> GetPartitionType(const Partition& partition) const { return {}; }
|
||||
@ -108,6 +114,7 @@ protected:
|
||||
return CP1252ToUTF8(string);
|
||||
}
|
||||
|
||||
virtual u32 GetOffsetShift() const { return 0; }
|
||||
static std::map<Language, std::string> ReadWiiNames(const std::vector<u8>& data);
|
||||
|
||||
static const size_t NUMBER_OF_LANGUAGES = 10;
|
||||
|
Reference in New Issue
Block a user