parent
1106029afc
commit
b663b615bf
|
@ -33,6 +33,7 @@ ContentPackage::ContentPackage(KernelState* kernel_state, std::string root_name,
|
||||||
auto fs = kernel_state_->file_system();
|
auto fs = kernel_state_->file_system();
|
||||||
auto device =
|
auto device =
|
||||||
std::make_unique<vfs::HostPathDevice>(device_path_, package_path, false);
|
std::make_unique<vfs::HostPathDevice>(device_path_, package_path, false);
|
||||||
|
device->Initialize();
|
||||||
fs->RegisterDevice(std::move(device));
|
fs->RegisterDevice(std::move(device));
|
||||||
fs->RegisterSymbolicLink(root_name_ + ":", device_path_);
|
fs->RegisterSymbolicLink(root_name_ + ":", device_path_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,8 +177,7 @@ X_STATUS XUserModule::GetOptHeader(uint8_t* membase, const xex2_header* header,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Data stored at offset to header.
|
// Data stored at offset to header.
|
||||||
field_value = uint32_t((uint8_t*)header - membase) +
|
field_value = uint32_t((uint8_t*)header - membase) + opt_header.offset;
|
||||||
opt_header.offset;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -310,8 +310,8 @@ void XamContentCreateCore(PPCContext* ppc_context, KernelState* kernel_state,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediateEx(overlapped_ptr, disposition,
|
kernel_state->CompleteOverlappedImmediateEx(overlapped_ptr, result,
|
||||||
result, 0);
|
disposition, 0);
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(result);
|
SHIM_SET_RETURN_32(result);
|
||||||
|
|
|
@ -182,8 +182,8 @@ SHIM_CALL XamEnumerate_shim(PPCContext* ppc_context,
|
||||||
auto e = kernel_state->object_table()->LookupObject<XEnumerator>(handle);
|
auto e = kernel_state->object_table()->LookupObject<XEnumerator>(handle);
|
||||||
if (!e) {
|
if (!e) {
|
||||||
if (overlapped_ptr) {
|
if (overlapped_ptr) {
|
||||||
kernel_state->CompleteOverlappedImmediateEx(overlapped_ptr, 0,
|
kernel_state->CompleteOverlappedImmediateEx(
|
||||||
X_ERROR_INVALID_HANDLE, 0);
|
overlapped_ptr, X_ERROR_INVALID_HANDLE, X_ERROR_INVALID_HANDLE, 0);
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
||||||
} else {
|
} else {
|
||||||
SHIM_SET_RETURN_32(X_ERROR_INVALID_HANDLE);
|
SHIM_SET_RETURN_32(X_ERROR_INVALID_HANDLE);
|
||||||
|
|
|
@ -19,9 +19,8 @@ Device::Device(const std::string& mount_path) : mount_path_(mount_path) {}
|
||||||
Device::~Device() = default;
|
Device::~Device() = default;
|
||||||
|
|
||||||
void Device::Dump(StringBuffer* string_buffer) {
|
void Device::Dump(StringBuffer* string_buffer) {
|
||||||
if (root_entry_) {
|
root_entry_->Dump(string_buffer, 0);
|
||||||
root_entry_->Dump(string_buffer, 0);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry* Device::ResolvePath(const char* path) {
|
Entry* Device::ResolvePath(const char* path) {
|
||||||
|
@ -31,11 +30,6 @@ Entry* Device::ResolvePath(const char* path) {
|
||||||
|
|
||||||
XELOGFS("Device::ResolvePath(%s)", path);
|
XELOGFS("Device::ResolvePath(%s)", path);
|
||||||
|
|
||||||
if (!root_entry_) {
|
|
||||||
// No content at all.
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Walk the path, one separator at a time.
|
// Walk the path, one separator at a time.
|
||||||
auto entry = root_entry_.get();
|
auto entry = root_entry_.get();
|
||||||
auto path_parts = xe::split_path(path);
|
auto path_parts = xe::split_path(path);
|
||||||
|
|
|
@ -25,9 +25,14 @@ HostPathDevice::HostPathDevice(const std::string& mount_path,
|
||||||
HostPathDevice::~HostPathDevice() = default;
|
HostPathDevice::~HostPathDevice() = default;
|
||||||
|
|
||||||
bool HostPathDevice::Initialize() {
|
bool HostPathDevice::Initialize() {
|
||||||
if (!filesystem::PathExists(local_path_)) {
|
if (!xe::filesystem::PathExists(local_path_)) {
|
||||||
XELOGE("Host path does not exist");
|
if (!read_only_) {
|
||||||
return false;
|
// Create the path.
|
||||||
|
xe::filesystem::CreateFolder(local_path_);
|
||||||
|
} else {
|
||||||
|
XELOGE("Host path does not exist");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto root_entry = new HostPathEntry(this, "", local_path_);
|
auto root_entry = new HostPathEntry(this, "", local_path_);
|
||||||
|
@ -39,7 +44,7 @@ bool HostPathDevice::Initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostPathDevice::PopulateEntry(HostPathEntry* entry) {
|
void HostPathDevice::PopulateEntry(HostPathEntry* entry) {
|
||||||
auto child_infos = filesystem::ListFiles(entry->local_path());
|
auto child_infos = xe::filesystem::ListFiles(entry->local_path());
|
||||||
for (auto& child_info : child_infos) {
|
for (auto& child_info : child_infos) {
|
||||||
auto child =
|
auto child =
|
||||||
new HostPathEntry(this, xe::to_string(child_info.name),
|
new HostPathEntry(this, xe::to_string(child_info.name),
|
||||||
|
@ -48,7 +53,7 @@ void HostPathDevice::PopulateEntry(HostPathEntry* entry) {
|
||||||
child->access_timestamp_ = child_info.access_timestamp;
|
child->access_timestamp_ = child_info.access_timestamp;
|
||||||
child->write_timestamp_ = child_info.write_timestamp;
|
child->write_timestamp_ = child_info.write_timestamp;
|
||||||
|
|
||||||
if (child_info.type == filesystem::FileInfo::Type::kDirectory) {
|
if (child_info.type == xe::filesystem::FileInfo::Type::kDirectory) {
|
||||||
child->attributes_ = kFileAttributeDirectory;
|
child->attributes_ = kFileAttributeDirectory;
|
||||||
} else {
|
} else {
|
||||||
child->attributes_ = kFileAttributeNormal;
|
child->attributes_ = kFileAttributeNormal;
|
||||||
|
@ -62,7 +67,7 @@ void HostPathDevice::PopulateEntry(HostPathEntry* entry) {
|
||||||
|
|
||||||
entry->children_.push_back(std::unique_ptr<Entry>(child));
|
entry->children_.push_back(std::unique_ptr<Entry>(child));
|
||||||
|
|
||||||
if (child_info.type == filesystem::FileInfo::Type::kDirectory) {
|
if (child_info.type == xe::filesystem::FileInfo::Type::kDirectory) {
|
||||||
PopulateEntry(child);
|
PopulateEntry(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue