diff --git a/src/xenia/kernel/content_manager.cc b/src/xenia/kernel/content_manager.cc index 9fca09e7f..5ad2532bd 100644 --- a/src/xenia/kernel/content_manager.cc +++ b/src/xenia/kernel/content_manager.cc @@ -33,6 +33,7 @@ ContentPackage::ContentPackage(KernelState* kernel_state, std::string root_name, auto fs = kernel_state_->file_system(); auto device = std::make_unique(device_path_, package_path, false); + device->Initialize(); fs->RegisterDevice(std::move(device)); fs->RegisterSymbolicLink(root_name_ + ":", device_path_); } diff --git a/src/xenia/kernel/objects/xuser_module.cc b/src/xenia/kernel/objects/xuser_module.cc index 91b8ffe0a..8bfe1d36a 100644 --- a/src/xenia/kernel/objects/xuser_module.cc +++ b/src/xenia/kernel/objects/xuser_module.cc @@ -177,8 +177,7 @@ X_STATUS XUserModule::GetOptHeader(uint8_t* membase, const xex2_header* header, break; default: // Data stored at offset to header. - field_value = uint32_t((uint8_t*)header - membase) + - opt_header.offset; + field_value = uint32_t((uint8_t*)header - membase) + opt_header.offset; break; } break; diff --git a/src/xenia/kernel/xam_content.cc b/src/xenia/kernel/xam_content.cc index f15215220..bec942911 100644 --- a/src/xenia/kernel/xam_content.cc +++ b/src/xenia/kernel/xam_content.cc @@ -310,8 +310,8 @@ void XamContentCreateCore(PPCContext* ppc_context, KernelState* kernel_state, } if (overlapped_ptr) { - kernel_state->CompleteOverlappedImmediateEx(overlapped_ptr, disposition, - result, 0); + kernel_state->CompleteOverlappedImmediateEx(overlapped_ptr, result, + disposition, 0); SHIM_SET_RETURN_32(X_ERROR_IO_PENDING); } else { SHIM_SET_RETURN_32(result); diff --git a/src/xenia/kernel/xam_info.cc b/src/xenia/kernel/xam_info.cc index d503ea7d1..980e565d4 100644 --- a/src/xenia/kernel/xam_info.cc +++ b/src/xenia/kernel/xam_info.cc @@ -182,8 +182,8 @@ SHIM_CALL XamEnumerate_shim(PPCContext* ppc_context, auto e = kernel_state->object_table()->LookupObject(handle); if (!e) { if (overlapped_ptr) { - kernel_state->CompleteOverlappedImmediateEx(overlapped_ptr, 0, - X_ERROR_INVALID_HANDLE, 0); + kernel_state->CompleteOverlappedImmediateEx( + overlapped_ptr, X_ERROR_INVALID_HANDLE, X_ERROR_INVALID_HANDLE, 0); SHIM_SET_RETURN_32(X_ERROR_IO_PENDING); } else { SHIM_SET_RETURN_32(X_ERROR_INVALID_HANDLE); diff --git a/src/xenia/vfs/device.cc b/src/xenia/vfs/device.cc index 1d843828b..e2f7eab65 100644 --- a/src/xenia/vfs/device.cc +++ b/src/xenia/vfs/device.cc @@ -19,9 +19,8 @@ Device::Device(const std::string& mount_path) : mount_path_(mount_path) {} Device::~Device() = default; 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) { @@ -31,11 +30,6 @@ Entry* Device::ResolvePath(const char* path) { XELOGFS("Device::ResolvePath(%s)", path); - if (!root_entry_) { - // No content at all. - return nullptr; - } - // Walk the path, one separator at a time. auto entry = root_entry_.get(); auto path_parts = xe::split_path(path); diff --git a/src/xenia/vfs/devices/host_path_device.cc b/src/xenia/vfs/devices/host_path_device.cc index e7d81e741..d042e0327 100644 --- a/src/xenia/vfs/devices/host_path_device.cc +++ b/src/xenia/vfs/devices/host_path_device.cc @@ -25,9 +25,14 @@ HostPathDevice::HostPathDevice(const std::string& mount_path, HostPathDevice::~HostPathDevice() = default; bool HostPathDevice::Initialize() { - if (!filesystem::PathExists(local_path_)) { - XELOGE("Host path does not exist"); - return false; + if (!xe::filesystem::PathExists(local_path_)) { + if (!read_only_) { + // 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_); @@ -39,7 +44,7 @@ bool HostPathDevice::Initialize() { } 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) { auto child = 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->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; } else { child->attributes_ = kFileAttributeNormal; @@ -62,7 +67,7 @@ void HostPathDevice::PopulateEntry(HostPathEntry* entry) { entry->children_.push_back(std::unique_ptr(child)); - if (child_info.type == filesystem::FileInfo::Type::kDirectory) { + if (child_info.type == xe::filesystem::FileInfo::Type::kDirectory) { PopulateEntry(child); } }