ContentManager: add more checks for folder-packages

Fixes problems with folder packages not being created
This commit is contained in:
emoose 2018-11-02 01:08:34 +00:00 committed by illusion
parent ab41204a61
commit b7857d77c6
3 changed files with 19 additions and 15 deletions

View File

@ -151,22 +151,24 @@ X_STATUS UserModule::LoadFromFile(const std::string_view path) {
patch_entry = file_system->ResolvePath(path_ + "p"); patch_entry = file_system->ResolvePath(path_ + "p");
} }
auto patch_path = patch_entry->absolute_path(); if (patch_entry) {
XELOGI("Loading XEX patch from {}", patch_path); auto patch_path = patch_entry->absolute_path();
XELOGI("Loading XEX patch from {}", patch_path);
auto patch_module = object_ref<UserModule>(new UserModule(kernel_state_)); auto patch_module = object_ref<UserModule>(new UserModule(kernel_state_));
result = patch_module->LoadFromFile(patch_path); result = patch_module->LoadFromFile(patch_path);
if (!result) { if (!result) {
result = patch_module->xex_module()->ApplyPatch(xex_module()); result = patch_module->xex_module()->ApplyPatch(xex_module());
if (result) { if (result) {
XELOGE("Failed to apply XEX patch, code: {}", result); XELOGE("Failed to apply XEX patch, code: {}", result);
}
} else {
XELOGE("Failed to load XEX patch, code: {}", result);
} }
} else {
XELOGE("Failed to load XEX patch, code: {}", result);
}
if (result) { if (result) {
return X_STATUS_UNSUCCESSFUL; return X_STATUS_UNSUCCESSFUL;
}
} }
} }
return LoadXexContinue(); return LoadXexContinue();

View File

@ -67,6 +67,8 @@ std::filesystem::path ContentManager::ResolvePackagePath(
if (!std::filesystem::exists(package_path) || if (!std::filesystem::exists(package_path) ||
entry.type == filesystem::FileInfo::Type::kDirectory) { entry.type == filesystem::FileInfo::Type::kDirectory) {
// Add slash to end of path if this is a folder
// (or package doesn't exist, meaning we're creating a new folder)
package_path += xe::kPathSeparator; package_path += xe::kPathSeparator;
} }
return package_path; return package_path;

View File

@ -97,8 +97,8 @@ class ContentManager {
xe::global_critical_region global_critical_region_; xe::global_critical_region global_critical_region_;
std::vector<ContentPackage*> open_packages_; std::vector<ContentPackage*> open_packages_;
uint32_t title_id_override_; // can be used for games/apps that request uint32_t title_id_override_ =
// content for other IDs 0; // can be used for games/apps that request content for other IDs
}; };
} // namespace xam } // namespace xam