summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/DirectoryBlob.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-06-10 14:42:41 +0200
committerJosJuice <josjuice@gmail.com>2017-08-01 11:36:40 +0200
commit953ca9cee193a6459ae78e28b387d9f49f6be755 (patch)
treee92bf90495127354e0bc8107ce5f42943fbfe860 /Source/Core/DiscIO/DirectoryBlob.cpp
parentab4762c4c24626c06941ed8f5de6bec616e53095 (diff)
DirectoryBlob: Make PadToAddress and Write32 static
Diffstat (limited to 'Source/Core/DiscIO/DirectoryBlob.cpp')
-rw-r--r--Source/Core/DiscIO/DirectoryBlob.cpp44
1 files changed, 23 insertions, 21 deletions
diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp
index cf63309d45..3a5abeacd7 100644
--- a/Source/Core/DiscIO/DirectoryBlob.cpp
+++ b/Source/Core/DiscIO/DirectoryBlob.cpp
@@ -39,6 +39,9 @@ static const DiscContent& AddFileToContents(std::set<DiscContent>* contents,
// Returns the number of bytes read.
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 std::string ASCIIToUppercase(std::string str);
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());
}
-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,
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;
}
+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)
{
u32 name_size = 0;