mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-10-26 19:11:37 +01:00
display xcz as xcz, fix nsz unpacking (there was a regression in zstd)
This commit is contained in:
parent
ebc5cca77c
commit
653b26ece6
4 changed files with 38 additions and 12 deletions
|
|
@ -1448,10 +1448,11 @@ void ExternalContentProvider::ScanDirectory(const VirtualDir& dir) {
|
|||
}
|
||||
|
||||
const auto extension = Common::ToLower(filename.substr(dot_pos + 1));
|
||||
|
||||
if (extension == "nsp" || extension == "nsz") {
|
||||
// .xcz is an XCI container, but its updates only work through the NSP/PFS0 path
|
||||
// (DecompressNCZ), not ProcessXCI. So route .xcz here on purpose.
|
||||
if (extension == "nsp" || extension == "nsz" || extension == "xcz") {
|
||||
ProcessNSP(file);
|
||||
} else if (extension == "xci" || extension == "xcz") {
|
||||
} else if (extension == "xci") {
|
||||
ProcessXCI(file);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,16 +89,20 @@ std::shared_ptr<FileSys::NSP> OpenContainerAsNsp(FileSys::VirtualFile file, File
|
|||
|
||||
if (type == FileType::XCI || type == FileType::XCZ) {
|
||||
FileSys::XCI xci{file, program_id, program_index};
|
||||
if (xci.GetStatus() != ResultStatus::Success) {
|
||||
return nullptr;
|
||||
if (xci.GetStatus() == ResultStatus::Success) {
|
||||
auto secure_nsp = xci.GetSecurePartitionNSP();
|
||||
if (secure_nsp != nullptr && secure_nsp->GetStatus() == ResultStatus::Success) {
|
||||
return secure_nsp;
|
||||
}
|
||||
}
|
||||
|
||||
auto secure_nsp = xci.GetSecurePartitionNSP();
|
||||
if (secure_nsp == nullptr || secure_nsp->GetStatus() != ResultStatus::Success) {
|
||||
return nullptr;
|
||||
// PFS0-shaped .xcz (NSZ-style container) does not parse as XCI; fall back to NSP.
|
||||
if (type == FileType::XCZ) {
|
||||
auto nsp = std::make_shared<FileSys::NSP>(file, program_id, program_index);
|
||||
return nsp->GetStatus() == ResultStatus::Success ? nsp : nullptr;
|
||||
}
|
||||
|
||||
return secure_nsp;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
@ -331,11 +335,26 @@ static std::unique_ptr<AppLoader> GetFileLoader(Core::System& system, FileSys::V
|
|||
|
||||
// NX XCI (nX Card Image) file format.
|
||||
case FileType::XCI:
|
||||
case FileType::XCZ:
|
||||
return std::make_unique<AppLoader_XCI>(std::move(file), system.GetFileSystemController(),
|
||||
system.GetContentProvider(), program_id,
|
||||
program_index);
|
||||
|
||||
// NCZ-compressed XCI container. XCI-shaped .xcz goes to the XCI loader, while
|
||||
// PFS0-shaped (NSZ-style) .xcz containers fall back to the NSP loader.
|
||||
case FileType::XCZ: {
|
||||
FileSys::XCI probe{file, program_id, program_index};
|
||||
if (probe.GetStatus() == ResultStatus::Success &&
|
||||
probe.GetSecurePartitionNSP() != nullptr) {
|
||||
return std::make_unique<AppLoader_XCI>(std::move(file),
|
||||
system.GetFileSystemController(),
|
||||
system.GetContentProvider(), program_id,
|
||||
program_index);
|
||||
}
|
||||
return std::make_unique<AppLoader_NSP>(std::move(file), system.GetFileSystemController(),
|
||||
system.GetContentProvider(), program_id,
|
||||
program_index);
|
||||
}
|
||||
|
||||
// NX NAX (NintendoAesXts) file format.
|
||||
case FileType::NAX:
|
||||
return std::make_unique<AppLoader_NAX>(std::move(file));
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& nsp_file) {
|
|||
return FileType::NSZ;
|
||||
}
|
||||
|
||||
// PFS0-shaped .xcz containers are handled by this loader too; report XCZ so the game
|
||||
// list does not show them as NSP. XCI-shaped .xcz is identified by AppLoader_XCI.
|
||||
if (nsp_file->GetName().ends_with(".xcz")) {
|
||||
return FileType::XCZ;
|
||||
}
|
||||
|
||||
const FileSys::NSP nsp(nsp_file);
|
||||
|
||||
if (nsp.GetStatus() != ResultStatus::Success) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue