mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 22:49:00 +01:00
DirectoryBlob: Make PadToAddress and Write32 static
This commit is contained in:
parent
ab4762c4c2
commit
953ca9cee1
@ -39,6 +39,9 @@ static const DiscContent& AddFileToContents(std::set<DiscContent>* contents,
|
|||||||
// Returns the number of bytes read.
|
// Returns the number of bytes read.
|
||||||
static size_t ReadFileToVector(const std::string& path, std::vector<u8>* vector);
|
static size_t ReadFileToVector(const std::string& path, std::vector<u8>* vector);
|
||||||
|
|
||||||
|
static void PadToAddress(u64 start_address, u64* address, u64* length, u8** buffer);
|
||||||
|
static void Write32(u32 data, u32 offset, std::vector<u8>* buffer);
|
||||||
|
|
||||||
static u32 ComputeNameSize(const File::FSTEntry& parent_entry);
|
static u32 ComputeNameSize(const File::FSTEntry& parent_entry);
|
||||||
static std::string ASCIIToUppercase(std::string str);
|
static std::string ASCIIToUppercase(std::string str);
|
||||||
static void ConvertUTF8NamesToSHIFTJIS(File::FSTEntry& parent_entry);
|
static void ConvertUTF8NamesToSHIFTJIS(File::FSTEntry& parent_entry);
|
||||||
@ -419,27 +422,6 @@ void DirectoryBlobReader::BuildFST(u64 fst_address)
|
|||||||
m_virtual_disc.emplace(fst_address, m_fst_data.size(), m_fst_data.data());
|
m_virtual_disc.emplace(fst_address, m_fst_data.size(), m_fst_data.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoryBlobReader::PadToAddress(u64 start_address, u64* address, u64* length,
|
|
||||||
u8** buffer) const
|
|
||||||
{
|
|
||||||
if (start_address > *address && *length > 0)
|
|
||||||
{
|
|
||||||
u64 padBytes = std::min(start_address - *address, *length);
|
|
||||||
memset(*buffer, 0, (size_t)padBytes);
|
|
||||||
*length -= padBytes;
|
|
||||||
*buffer += padBytes;
|
|
||||||
*address += padBytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DirectoryBlobReader::Write32(u32 data, u32 offset, std::vector<u8>* const buffer)
|
|
||||||
{
|
|
||||||
(*buffer)[offset++] = (data >> 24);
|
|
||||||
(*buffer)[offset++] = (data >> 16) & 0xff;
|
|
||||||
(*buffer)[offset++] = (data >> 8) & 0xff;
|
|
||||||
(*buffer)[offset] = (data)&0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DirectoryBlobReader::WriteEntryData(u32* entry_offset, u8 type, u32 name_offset,
|
void DirectoryBlobReader::WriteEntryData(u32* entry_offset, u8 type, u32 name_offset,
|
||||||
u64 data_offset, u64 length, u32 address_shift)
|
u64 data_offset, u64 length, u32 address_shift)
|
||||||
{
|
{
|
||||||
@ -520,6 +502,26 @@ static size_t ReadFileToVector(const std::string& path, std::vector<u8>* vector)
|
|||||||
return bytes_read;
|
return bytes_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PadToAddress(u64 start_address, u64* address, u64* length, u8** buffer)
|
||||||
|
{
|
||||||
|
if (start_address > *address && *length > 0)
|
||||||
|
{
|
||||||
|
u64 padBytes = std::min(start_address - *address, *length);
|
||||||
|
memset(*buffer, 0, (size_t)padBytes);
|
||||||
|
*length -= padBytes;
|
||||||
|
*buffer += padBytes;
|
||||||
|
*address += padBytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Write32(u32 data, u32 offset, std::vector<u8>* buffer)
|
||||||
|
{
|
||||||
|
(*buffer)[offset++] = (data >> 24);
|
||||||
|
(*buffer)[offset++] = (data >> 16) & 0xff;
|
||||||
|
(*buffer)[offset++] = (data >> 8) & 0xff;
|
||||||
|
(*buffer)[offset] = data & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
static u32 ComputeNameSize(const File::FSTEntry& parent_entry)
|
static u32 ComputeNameSize(const File::FSTEntry& parent_entry)
|
||||||
{
|
{
|
||||||
u32 name_size = 0;
|
u32 name_size = 0;
|
||||||
|
@ -89,10 +89,6 @@ private:
|
|||||||
|
|
||||||
void BuildFST(u64 fst_address);
|
void BuildFST(u64 fst_address);
|
||||||
|
|
||||||
void PadToAddress(u64 start_address, u64* address, u64* length, u8** buffer) const;
|
|
||||||
|
|
||||||
void Write32(u32 data, u32 offset, std::vector<u8>* const buffer);
|
|
||||||
|
|
||||||
// FST creation
|
// FST creation
|
||||||
void WriteEntryData(u32* entry_offset, u8 type, u32 name_offset, u64 data_offset, u64 length,
|
void WriteEntryData(u32* entry_offset, u8 type, u32 name_offset, u64 data_offset, u64 length,
|
||||||
u32 address_shift);
|
u32 address_shift);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user