Code cleanup: moving poly/ into xenia/base/

This commit is contained in:
Ben Vanik
2015-05-02 03:42:51 -07:00
parent 99816056be
commit e3220f7ae6
223 changed files with 1758 additions and 1881 deletions

View File

@@ -9,10 +9,10 @@
#include "xenia/kernel/fs/devices/disc_image_device.h"
#include "poly/math.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/kernel/fs/gdfx.h"
#include "xenia/kernel/fs/devices/disc_image_entry.h"
#include "xenia/logging.h"
namespace xe {
namespace kernel {
@@ -25,8 +25,7 @@ DiscImageDevice::DiscImageDevice(const std::string& path,
DiscImageDevice::~DiscImageDevice() { delete gdfx_; }
int DiscImageDevice::Init() {
mmap_ =
poly::MappedMemory::Open(local_path_, poly::MappedMemory::Mode::kRead);
mmap_ = MappedMemory::Open(local_path_, MappedMemory::Mode::kRead);
if (!mmap_) {
XELOGE("Disc image could not be mapped");
return 1;
@@ -54,7 +53,7 @@ std::unique_ptr<Entry> DiscImageDevice::ResolvePath(const char* path) {
GDFXEntry* gdfx_entry = gdfx_->root_entry();
// Walk the path, one separator at a time.
auto path_parts = poly::split_path(path);
auto path_parts = xe::split_path(path);
for (auto& part : path_parts) {
gdfx_entry = gdfx_entry->GetChild(part.c_str());
if (!gdfx_entry) {

View File

@@ -13,7 +13,7 @@
#include <memory>
#include <string>
#include "poly/mapped_memory.h"
#include "xenia/base/mapped_memory.h"
#include "xenia/kernel/fs/device.h"
namespace xe {
@@ -33,7 +33,7 @@ class DiscImageDevice : public Device {
private:
std::wstring local_path_;
std::unique_ptr<poly::MappedMemory> mmap_;
std::unique_ptr<MappedMemory> mmap_;
GDFX* gdfx_;
};

View File

@@ -26,7 +26,7 @@ class DiscImageMemoryMapping : public MemoryMapping {
};
DiscImageEntry::DiscImageEntry(Device* device, const char* path,
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry)
MappedMemory* mmap, GDFXEntry* gdfx_entry)
: Entry(device, path),
mmap_(mmap),
gdfx_entry_(gdfx_entry),

View File

@@ -12,9 +12,9 @@
#include <vector>
#include "poly/mapped_memory.h"
#include "xenia/base/fs.h"
#include "xenia/base/mapped_memory.h"
#include "xenia/kernel/fs/entry.h"
#include "poly/fs.h"
#include "xenia/kernel/fs/gdfx.h"
namespace xe {
@@ -23,11 +23,11 @@ namespace fs {
class DiscImageEntry : public Entry {
public:
DiscImageEntry(Device* device, const char* path, poly::MappedMemory* mmap,
DiscImageEntry(Device* device, const char* path, MappedMemory* mmap,
GDFXEntry* gdfx_entry);
~DiscImageEntry() override;
poly::MappedMemory* mmap() const { return mmap_; }
MappedMemory* mmap() const { return mmap_; }
GDFXEntry* gdfx_entry() const { return gdfx_entry_; }
X_STATUS QueryInfo(XFileInfo* out_info) override;
@@ -42,10 +42,10 @@ class DiscImageEntry : public Entry {
XFile** out_file) override;
private:
poly::MappedMemory* mmap_;
MappedMemory* mmap_;
GDFXEntry* gdfx_entry_;
poly::fs::WildcardEngine find_engine_;
xe::fs::WildcardEngine find_engine_;
GDFXEntry::child_it_t it_;
};

View File

@@ -9,10 +9,10 @@
#include "xenia/kernel/fs/devices/host_path_device.h"
#include "poly/fs.h"
#include "xenia/base/logging.h"
#include "xenia/base/fs.h"
#include "xenia/kernel/fs/devices/host_path_entry.h"
#include "xenia/kernel/objects/xfile.h"
#include "xenia/logging.h"
namespace xe {
namespace kernel {
@@ -31,13 +31,13 @@ std::unique_ptr<Entry> HostPathDevice::ResolvePath(const char* path) {
XELOGFS("HostPathDevice::ResolvePath(%s)", path);
auto rel_path = poly::to_wstring(path);
auto full_path = poly::join_paths(local_path_, rel_path);
full_path = poly::fix_path_separators(full_path);
auto rel_path = xe::to_wstring(path);
auto full_path = xe::join_paths(local_path_, rel_path);
full_path = xe::fix_path_separators(full_path);
// Only check the file exists when the device is read-only
if (read_only_) {
if (!poly::fs::PathExists(full_path)) {
if (!xe::fs::PathExists(full_path)) {
return nullptr;
}
}

View File

@@ -9,8 +9,8 @@
#include "xenia/kernel/fs/devices/host_path_entry.h"
#include "poly/mapped_memory.h"
#include "poly/string.h"
#include "xenia/base/mapped_memory.h"
#include "xenia/base/string.h"
#include "xenia/kernel/fs/devices/host_path_file.h"
namespace xe {
@@ -19,11 +19,11 @@ namespace fs {
class HostPathMemoryMapping : public MemoryMapping {
public:
HostPathMemoryMapping(std::unique_ptr<poly::MappedMemory> mmap)
HostPathMemoryMapping(std::unique_ptr<MappedMemory> mmap)
: MemoryMapping(mmap->data(), mmap->size()), mmap_(std::move(mmap)) {}
private:
std::unique_ptr<poly::MappedMemory> mmap_;
std::unique_ptr<MappedMemory> mmap_;
};
HostPathEntry::HostPathEntry(Device* device, const char* path,
@@ -75,9 +75,9 @@ X_STATUS HostPathEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length,
if (handle == INVALID_HANDLE_VALUE) {
std::wstring target_path = local_path_;
if (!file_name) {
target_path = poly::join_paths(target_path, L"*");
target_path = xe::join_paths(target_path, L"*");
} else {
target_path = poly::join_paths(target_path, poly::to_wstring(file_name));
target_path = xe::join_paths(target_path, xe::to_wstring(file_name));
}
handle = find_file_ = FindFirstFile(target_path.c_str(), &ffd);
if (handle == INVALID_HANDLE_VALUE) {
@@ -124,10 +124,9 @@ X_STATUS HostPathEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length,
std::unique_ptr<MemoryMapping> HostPathEntry::CreateMemoryMapping(
Mode map_mode, const size_t offset, const size_t length) {
auto mmap = poly::MappedMemory::Open(
local_path_,
map_mode == Mode::READ ? poly::MappedMemory::Mode::kRead
: poly::MappedMemory::Mode::kReadWrite,
auto mmap = MappedMemory::Open(
local_path_, map_mode == Mode::READ ? MappedMemory::Mode::kRead
: MappedMemory::Mode::kReadWrite,
offset, length);
if (!mmap) {
return nullptr;

View File

@@ -9,11 +9,11 @@
#include "xenia/kernel/fs/devices/stfs_container_device.h"
#include "poly/math.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/kernel/fs/stfs.h"
#include "xenia/kernel/fs/devices/stfs_container_entry.h"
#include "xenia/kernel/objects/xfile.h"
#include "xenia/logging.h"
namespace xe {
namespace kernel {
@@ -26,8 +26,7 @@ STFSContainerDevice::STFSContainerDevice(const std::string& path,
STFSContainerDevice::~STFSContainerDevice() { delete stfs_; }
int STFSContainerDevice::Init() {
mmap_ =
poly::MappedMemory::Open(local_path_, poly::MappedMemory::Mode::kRead);
mmap_ = MappedMemory::Open(local_path_, MappedMemory::Mode::kRead);
if (!mmap_) {
XELOGE("STFS container could not be mapped");
return 1;
@@ -55,7 +54,7 @@ std::unique_ptr<Entry> STFSContainerDevice::ResolvePath(const char* path) {
STFSEntry* stfs_entry = stfs_->root_entry();
// Walk the path, one separator at a time.
auto path_parts = poly::split_path(path);
auto path_parts = xe::split_path(path);
for (auto& part : path_parts) {
stfs_entry = stfs_entry->GetChild(part.c_str());
if (!stfs_entry) {

View File

@@ -13,7 +13,7 @@
#include <memory>
#include <string>
#include "poly/mapped_memory.h"
#include "xenia/base/mapped_memory.h"
#include "xenia/kernel/fs/device.h"
namespace xe {
@@ -33,7 +33,7 @@ class STFSContainerDevice : public Device {
private:
std::wstring local_path_;
std::unique_ptr<poly::MappedMemory> mmap_;
std::unique_ptr<MappedMemory> mmap_;
STFS* stfs_;
};

View File

@@ -16,13 +16,12 @@ namespace kernel {
namespace fs {
STFSContainerEntry::STFSContainerEntry(Device* device, const char* path,
poly::MappedMemory* mmap,
MappedMemory* mmap,
STFSEntry* stfs_entry)
: Entry(device, path),
mmap_(mmap),
stfs_entry_(stfs_entry),
it_(stfs_entry_->children.end())
{ }
it_(stfs_entry_->children.end()) {}
STFSContainerEntry::~STFSContainerEntry() = default;

View File

@@ -13,9 +13,9 @@
#include <vector>
#include <iterator>
#include "poly/mapped_memory.h"
#include "xenia/base/fs.h"
#include "xenia/base/mapped_memory.h"
#include "xenia/kernel/fs/entry.h"
#include "poly/fs.h"
#include "xenia/kernel/fs/stfs.h"
namespace xe {
@@ -24,11 +24,11 @@ namespace fs {
class STFSContainerEntry : public Entry {
public:
STFSContainerEntry(Device* device, const char* path, poly::MappedMemory* mmap,
STFSContainerEntry(Device* device, const char* path, MappedMemory* mmap,
STFSEntry* stfs_entry);
~STFSContainerEntry() override;
poly::MappedMemory* mmap() const { return mmap_; }
MappedMemory* mmap() const { return mmap_; }
STFSEntry* stfs_entry() const { return stfs_entry_; }
X_STATUS QueryInfo(XFileInfo* out_info) override;
@@ -39,10 +39,10 @@ class STFSContainerEntry : public Entry {
XFile** out_file) override;
private:
poly::MappedMemory* mmap_;
MappedMemory* mmap_;
STFSEntry* stfs_entry_;
poly::fs::WildcardEngine find_engine_;
xe::fs::WildcardEngine find_engine_;
STFSEntry::child_it_t it_;
};

View File

@@ -9,7 +9,7 @@
#include "xenia/kernel/fs/entry.h"
#include "poly/string.h"
#include "xenia/base/string.h"
#include "xenia/kernel/fs/device.h"
namespace xe {
@@ -25,7 +25,7 @@ Entry::Entry(Device* device, const std::string& path)
: device_(device), path_(path) {
assert_not_null(device);
absolute_path_ = device->path() + path;
name_ = poly::find_name_from_path(path);
name_ = xe::find_name_from_path(path);
}
Entry::~Entry() = default;

View File

@@ -9,12 +9,12 @@
#include "xenia/kernel/fs/filesystem.h"
#include "poly/fs.h"
#include "poly/string.h"
#include "xenia/base/fs.h"
#include "xenia/base/logging.h"
#include "xenia/base/string.h"
#include "xenia/kernel/fs/devices/disc_image_device.h"
#include "xenia/kernel/fs/devices/host_path_device.h"
#include "xenia/kernel/fs/devices/stfs_container_device.h"
#include "xenia/logging.h"
namespace xe {
namespace kernel {
@@ -34,7 +34,7 @@ FileSystem::~FileSystem() {
}
fs::FileSystemType FileSystem::InferType(const std::wstring& local_path) {
auto last_slash = local_path.find_last_of(poly::path_separator);
auto last_slash = local_path.find_last_of(xe::path_separator);
auto last_dot = local_path.find_last_of('.');
if (last_dot < last_slash) {
last_dot = std::wstring::npos;
@@ -71,7 +71,7 @@ int FileSystem::InitializeFromPath(fs::FileSystemType type,
}
case FileSystemType::XEX_FILE: {
// Get the parent path of the file.
auto last_slash = local_path.find_last_of(poly::path_separator);
auto last_slash = local_path.find_last_of(xe::path_separator);
std::wstring parent_path = local_path.substr(0, last_slash);
// Register the local directory in the virtual filesystem.
@@ -151,7 +151,7 @@ int FileSystem::DeleteSymbolicLink(const std::string& path) {
std::unique_ptr<Entry> FileSystem::ResolvePath(const std::string& path) {
// Resolve relative paths
std::string normalized_path(poly::fs::CanonicalizePath(path));
std::string normalized_path(xe::fs::CanonicalizePath(path));
// If no path (starts with a slash) do it module-relative.
// Which for now, we just make game:.
@@ -164,7 +164,7 @@ std::unique_ptr<Entry> FileSystem::ResolvePath(const std::string& path) {
// drive path -> device mappings with nothing nested.
std::string full_path = normalized_path;
for (const auto& it : symlinks_) {
if (poly::find_first_of_case(normalized_path, it.first) == 0) {
if (xe::find_first_of_case(normalized_path, it.first) == 0) {
// Found symlink, fixup by replacing the prefix.
full_path = it.second + full_path.substr(it.first.size());
break;
@@ -173,7 +173,7 @@ std::unique_ptr<Entry> FileSystem::ResolvePath(const std::string& path) {
// Scan all devices.
for (auto& device : devices_) {
if (poly::find_first_of_case(full_path, device->path()) == 0) {
if (xe::find_first_of_case(full_path, device->path()) == 0) {
// Found! Trim the device prefix off and pass down.
auto device_path = full_path.substr(device->path().size());
return device->ResolvePath(device_path.c_str());

View File

@@ -11,7 +11,7 @@
#include "xenia/kernel/fs/gdfx.h"
#include "poly/math.h"
#include "xenia/base/math.h"
namespace xe {
namespace kernel {
@@ -29,8 +29,8 @@ GDFXEntry::~GDFXEntry() {
}
}
GDFXEntry* GDFXEntry::GetChild(const poly::fs::WildcardEngine& engine, child_it_t& ref_it)
{
GDFXEntry* GDFXEntry::GetChild(const xe::fs::WildcardEngine& engine,
child_it_t& ref_it) {
GDFXEntry* child_entry(nullptr);
while (ref_it != children.end()) {
if (engine.Match((*ref_it)->name)) {
@@ -64,7 +64,7 @@ void GDFXEntry::Dump(int indent) {
}
}
GDFX::GDFX(poly::MappedMemory* mmap) : mmap_(mmap) { root_entry_ = nullptr; }
GDFX::GDFX(MappedMemory* mmap) : mmap_(mmap) { root_entry_ = nullptr; }
GDFX::~GDFX() { delete root_entry_; }
@@ -101,7 +101,7 @@ GDFX::Error GDFX::Verify(ParseState& state) {
0x00000000, 0x0000FB20, 0x00020600, 0x0FD90000,
};
bool magic_found = false;
for (size_t n = 0; n < poly::countof(likely_offsets); n++) {
for (size_t n = 0; n < xe::countof(likely_offsets); n++) {
state.game_offset = likely_offsets[n];
if (VerifyMagic(state, state.game_offset + (32 * kXESectorSize))) {
magic_found = true;
@@ -118,8 +118,8 @@ GDFX::Error GDFX::Verify(ParseState& state) {
return kErrorReadError;
}
uint8_t* fs_ptr = state.ptr + state.game_offset + (32 * kXESectorSize);
state.root_sector = poly::load<uint32_t>(fs_ptr + 20);
state.root_size = poly::load<uint32_t>(fs_ptr + 24);
state.root_sector = xe::load<uint32_t>(fs_ptr + 20);
state.root_size = xe::load<uint32_t>(fs_ptr + 24);
state.root_offset = state.game_offset + (state.root_sector * kXESectorSize);
if (state.root_size < 13 || state.root_size > 32 * 1024 * 1024) {
return kErrorDamagedFile;
@@ -152,12 +152,12 @@ bool GDFX::ReadEntry(ParseState& state, const uint8_t* buffer,
uint16_t entry_ordinal, GDFXEntry* parent) {
const uint8_t* p = buffer + (entry_ordinal * 4);
uint16_t node_l = poly::load<uint16_t>(p + 0);
uint16_t node_r = poly::load<uint16_t>(p + 2);
size_t sector = poly::load<uint32_t>(p + 4);
size_t length = poly::load<uint32_t>(p + 8);
uint8_t attributes = poly::load<uint8_t>(p + 12);
uint8_t name_length = poly::load<uint8_t>(p + 13);
uint16_t node_l = xe::load<uint16_t>(p + 0);
uint16_t node_r = xe::load<uint16_t>(p + 2);
size_t sector = xe::load<uint32_t>(p + 4);
size_t length = xe::load<uint32_t>(p + 8);
uint8_t attributes = xe::load<uint8_t>(p + 12);
uint8_t name_length = xe::load<uint8_t>(p + 13);
char* name = (char*)(p + 14);
if (node_l && !ReadEntry(state, buffer, node_l, parent)) {

View File

@@ -12,10 +12,10 @@
#include <vector>
#include "poly/mapped_memory.h"
#include "xenia/xbox.h"
#include "xenia/base/fs.h"
#include "xenia/base/mapped_memory.h"
#include "xenia/kernel/fs/entry.h"
#include "poly/fs.h"
#include "xenia/xbox.h"
namespace xe {
namespace kernel {
@@ -31,7 +31,7 @@ class GDFXEntry {
typedef std::vector<GDFXEntry*> child_t;
typedef child_t::iterator child_it_t;
GDFXEntry* GetChild(const poly::fs::WildcardEngine& engine, child_it_t& ref_it);
GDFXEntry* GetChild(const xe::fs::WildcardEngine& engine, child_it_t& ref_it);
GDFXEntry* GetChild(const char* name);
void Dump(int indent);
@@ -53,7 +53,7 @@ class GDFX {
kErrorDamagedFile = -31,
};
GDFX(poly::MappedMemory* mmap);
GDFX(MappedMemory* mmap);
virtual ~GDFX();
GDFXEntry* root_entry();
@@ -85,7 +85,7 @@ class GDFX {
bool ReadEntry(ParseState& state, const uint8_t* buffer,
uint16_t entry_ordinal, GDFXEntry* parent);
poly::MappedMemory* mmap_;
MappedMemory* mmap_;
GDFXEntry* root_entry_;
};

View File

@@ -13,64 +13,64 @@
#include <algorithm>
#include "xenia/logging.h"
#include "xenia/base/logging.h"
namespace xe {
namespace kernel {
namespace fs {
#define XEGETUINT24BE(p) \
(((uint32_t)poly::load_and_swap<uint8_t>((p)+0) << 16) | \
((uint32_t)poly::load_and_swap<uint8_t>((p)+1) << 8) | \
(uint32_t)poly::load_and_swap<uint8_t>((p)+2))
#define XEGETUINT24LE(p) \
(((uint32_t)poly::load<uint8_t>((p)+2) << 16) | \
((uint32_t)poly::load<uint8_t>((p)+1) << 8) | \
(uint32_t)poly::load<uint8_t>((p)+0))
#define XEGETUINT24BE(p) \
(((uint32_t)xe::load_and_swap<uint8_t>((p)+0) << 16) | \
((uint32_t)xe::load_and_swap<uint8_t>((p)+1) << 8) | \
(uint32_t)xe::load_and_swap<uint8_t>((p)+2))
#define XEGETUINT24LE(p) \
(((uint32_t)xe::load<uint8_t>((p)+2) << 16) | \
((uint32_t)xe::load<uint8_t>((p)+1) << 8) | \
(uint32_t)xe::load<uint8_t>((p)+0))
bool STFSVolumeDescriptor::Read(const uint8_t* p) {
descriptor_size = poly::load_and_swap<uint8_t>(p + 0x00);
descriptor_size = xe::load_and_swap<uint8_t>(p + 0x00);
if (descriptor_size != 0x24) {
XELOGE("STFS volume descriptor size mismatch, expected 0x24 but got 0x%X",
descriptor_size);
return false;
}
reserved = poly::load_and_swap<uint8_t>(p + 0x01);
block_separation = poly::load_and_swap<uint8_t>(p + 0x02);
file_table_block_count = poly::load_and_swap<uint16_t>(p + 0x03);
reserved = xe::load_and_swap<uint8_t>(p + 0x01);
block_separation = xe::load_and_swap<uint8_t>(p + 0x02);
file_table_block_count = xe::load_and_swap<uint16_t>(p + 0x03);
file_table_block_number = XEGETUINT24BE(p + 0x05);
memcpy(top_hash_table_hash, p + 0x08, 0x14);
total_allocated_block_count = poly::load_and_swap<uint32_t>(p + 0x1C);
total_unallocated_block_count = poly::load_and_swap<uint32_t>(p + 0x20);
total_allocated_block_count = xe::load_and_swap<uint32_t>(p + 0x1C);
total_unallocated_block_count = xe::load_and_swap<uint32_t>(p + 0x20);
return true;
};
bool STFSHeader::Read(const uint8_t* p) {
memcpy(license_entries, p + 0x22C, 0x100);
memcpy(header_hash, p + 0x32C, 0x14);
header_size = poly::load_and_swap<uint32_t>(p + 0x340);
content_type = (STFSContentType)poly::load_and_swap<uint32_t>(p + 0x344);
metadata_version = poly::load_and_swap<uint32_t>(p + 0x348);
header_size = xe::load_and_swap<uint32_t>(p + 0x340);
content_type = (STFSContentType)xe::load_and_swap<uint32_t>(p + 0x344);
metadata_version = xe::load_and_swap<uint32_t>(p + 0x348);
if (metadata_version > 1) {
// This is a variant of thumbnail data/etc.
// Can just ignore it for now (until we parse thumbnails).
XELOGW("STFSContainer doesn't support version %d yet", metadata_version);
}
content_size = poly::load_and_swap<uint32_t>(p + 0x34C);
media_id = poly::load_and_swap<uint32_t>(p + 0x354);
version = poly::load_and_swap<uint32_t>(p + 0x358);
base_version = poly::load_and_swap<uint32_t>(p + 0x35C);
title_id = poly::load_and_swap<uint32_t>(p + 0x360);
platform = (STFSPlatform)poly::load_and_swap<uint8_t>(p + 0x364);
executable_type = poly::load_and_swap<uint8_t>(p + 0x365);
disc_number = poly::load_and_swap<uint8_t>(p + 0x366);
disc_in_set = poly::load_and_swap<uint8_t>(p + 0x367);
save_game_id = poly::load_and_swap<uint32_t>(p + 0x368);
content_size = xe::load_and_swap<uint32_t>(p + 0x34C);
media_id = xe::load_and_swap<uint32_t>(p + 0x354);
version = xe::load_and_swap<uint32_t>(p + 0x358);
base_version = xe::load_and_swap<uint32_t>(p + 0x35C);
title_id = xe::load_and_swap<uint32_t>(p + 0x360);
platform = (STFSPlatform)xe::load_and_swap<uint8_t>(p + 0x364);
executable_type = xe::load_and_swap<uint8_t>(p + 0x365);
disc_number = xe::load_and_swap<uint8_t>(p + 0x366);
disc_in_set = xe::load_and_swap<uint8_t>(p + 0x367);
save_game_id = xe::load_and_swap<uint32_t>(p + 0x368);
memcpy(console_id, p + 0x36C, 0x5);
memcpy(profile_id, p + 0x371, 0x8);
data_file_count = poly::load_and_swap<uint32_t>(p + 0x39D);
data_file_combined_size = poly::load_and_swap<uint64_t>(p + 0x3A1);
descriptor_type = (STFSDescriptorType)poly::load_and_swap<uint8_t>(p + 0x3A9);
data_file_count = xe::load_and_swap<uint32_t>(p + 0x39D);
data_file_combined_size = xe::load_and_swap<uint64_t>(p + 0x3A1);
descriptor_type = (STFSDescriptorType)xe::load_and_swap<uint8_t>(p + 0x3A9);
if (descriptor_type != STFS_DESCRIPTOR_STFS) {
XELOGE("STFS descriptor format not supported: %d", descriptor_type);
return false;
@@ -80,16 +80,16 @@ bool STFSHeader::Read(const uint8_t* p) {
}
memcpy(device_id, p + 0x3FD, 0x14);
for (size_t n = 0; n < 0x900 / 2; n++) {
display_names[n] = poly::load_and_swap<uint16_t>(p + 0x411 + n * 2);
display_descs[n] = poly::load_and_swap<uint16_t>(p + 0xD11 + n * 2);
display_names[n] = xe::load_and_swap<uint16_t>(p + 0x411 + n * 2);
display_descs[n] = xe::load_and_swap<uint16_t>(p + 0xD11 + n * 2);
}
for (size_t n = 0; n < 0x80 / 2; n++) {
publisher_name[n] = poly::load_and_swap<uint16_t>(p + 0x1611 + n * 2);
title_name[n] = poly::load_and_swap<uint16_t>(p + 0x1691 + n * 2);
publisher_name[n] = xe::load_and_swap<uint16_t>(p + 0x1611 + n * 2);
title_name[n] = xe::load_and_swap<uint16_t>(p + 0x1691 + n * 2);
}
transfer_flags = poly::load_and_swap<uint8_t>(p + 0x1711);
thumbnail_image_size = poly::load_and_swap<uint32_t>(p + 0x1712);
title_thumbnail_image_size = poly::load_and_swap<uint32_t>(p + 0x1716);
transfer_flags = xe::load_and_swap<uint8_t>(p + 0x1711);
thumbnail_image_size = xe::load_and_swap<uint32_t>(p + 0x1712);
title_thumbnail_image_size = xe::load_and_swap<uint32_t>(p + 0x1716);
memcpy(thumbnail_image, p + 0x171A, 0x4000);
memcpy(title_thumbnail_image, p + 0x571A, 0x4000);
return true;
@@ -102,8 +102,8 @@ STFSEntry::STFSEntry()
update_timestamp(0),
access_timestamp(0) {}
STFSEntry* STFSEntry::GetChild(const poly::fs::WildcardEngine& engine, child_it_t& ref_it)
{
STFSEntry* STFSEntry::GetChild(const xe::fs::WildcardEngine& engine,
child_it_t& ref_it) {
STFSEntry* child_entry(nullptr);
while (ref_it != children.end()) {
if (engine.Match((*ref_it)->name)) {
@@ -133,7 +133,7 @@ void STFSEntry::Dump(int indent) {
}
}
STFS::STFS(poly::MappedMemory* mmap) : mmap_(mmap) {}
STFS::STFS(MappedMemory* mmap) : mmap_(mmap) {}
STFS::~STFS() {}
@@ -204,13 +204,13 @@ STFS::Error STFS::ReadAllEntries(const uint8_t* map_ptr) {
// Done.
break;
}
uint8_t filename_length_flags = poly::load_and_swap<uint8_t>(p + 0x28);
uint8_t filename_length_flags = xe::load_and_swap<uint8_t>(p + 0x28);
uint32_t allocated_block_count = XEGETUINT24LE(p + 0x29);
uint32_t start_block_index = XEGETUINT24LE(p + 0x2F);
uint16_t path_indicator = poly::load_and_swap<uint16_t>(p + 0x32);
uint32_t file_size = poly::load_and_swap<uint32_t>(p + 0x34);
uint32_t update_timestamp = poly::load_and_swap<uint32_t>(p + 0x38);
uint32_t access_timestamp = poly::load_and_swap<uint32_t>(p + 0x3C);
uint16_t path_indicator = xe::load_and_swap<uint16_t>(p + 0x32);
uint32_t file_size = xe::load_and_swap<uint32_t>(p + 0x34);
uint32_t update_timestamp = xe::load_and_swap<uint32_t>(p + 0x38);
uint32_t access_timestamp = xe::load_and_swap<uint32_t>(p + 0x3C);
p += 0x40;
auto entry = std::make_unique<STFSEntry>();
@@ -335,7 +335,7 @@ STFS::BlockHash_t STFS::GetBlockHash(const uint8_t* map_ptr,
// table_index += table_offset - (1 << table_size_shift_);
const uint8_t* hash_data = map_ptr + BlockToOffset(table_index);
const uint8_t* record_data = hash_data + record * 0x18;
uint32_t info = poly::load_and_swap<uint8_t>(record_data + 0x14);
uint32_t info = xe::load_and_swap<uint8_t>(record_data + 0x14);
uint32_t next_block_index = XEGETUINT24BE(record_data + 0x15);
return {next_block_index, info};
}

View File

@@ -13,10 +13,10 @@
#include <memory>
#include <vector>
#include "poly/mapped_memory.h"
#include "xenia/xbox.h"
#include "xenia/base/fs.h"
#include "xenia/base/mapped_memory.h"
#include "xenia/kernel/fs/entry.h"
#include "poly/fs.h"
#include "xenia/xbox.h"
namespace xe {
namespace kernel {
@@ -134,7 +134,7 @@ class STFSEntry {
typedef std::vector<std::unique_ptr<STFSEntry>> child_t;
typedef child_t::iterator child_it_t;
STFSEntry* GetChild(const poly::fs::WildcardEngine& engine, child_it_t& ref_it);
STFSEntry* GetChild(const xe::fs::WildcardEngine& engine, child_it_t& ref_it);
STFSEntry* GetChild(const char* name);
void Dump(int indent);
@@ -164,7 +164,7 @@ class STFS {
kErrorDamagedFile = -31,
};
STFS(poly::MappedMemory* mmap);
STFS(MappedMemory* mmap);
virtual ~STFS();
const STFSHeader* header() const { return &header_; }
@@ -186,7 +186,7 @@ class STFS {
BlockHash_t GetBlockHash(const uint8_t* map_ptr, uint32_t block_index,
uint32_t table_offset);
poly::MappedMemory* mmap_;
MappedMemory* mmap_;
STFSPackageType package_type_;
STFSHeader header_;