forked from eden-emu/eden
A temporary solution until we fix the applets on FW20.
This commit is contained in:
parent
eadefce244
commit
71297b6507
2 changed files with 19 additions and 15 deletions
|
@ -60,24 +60,29 @@ std::unique_ptr<Process> CreateProcessImpl(std::unique_ptr<Loader::AppLoader>& o
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
std::unique_ptr<Process> CreateProcess(Core::System& system, u64 program_id,
|
std::unique_ptr<Process> CreateProcess(Core::System& system, u64 program_id,
|
||||||
u8 minimum_key_generation, u8 maximum_key_generation) {
|
u8 minimum_key_generation) {
|
||||||
FileSys::VirtualFile nca_raw = system.GetContentProviderUnion()
|
// Attempt to load program NCA.
|
||||||
.GetEntryRaw(program_id, FileSys::ContentRecordType::Program);
|
FileSys::VirtualFile nca_raw{};
|
||||||
|
|
||||||
|
// Get the program NCA from storage.
|
||||||
|
auto& storage = system.GetContentProviderUnion();
|
||||||
|
nca_raw = storage.GetEntryRaw(program_id, FileSys::ContentRecordType::Program);
|
||||||
|
|
||||||
|
// Ensure we retrieved a program NCA.
|
||||||
if (!nca_raw) {
|
if (!nca_raw) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSys::NCA nca(nca_raw);
|
// Ensure we have a suitable version.
|
||||||
if (nca.GetStatus() != Loader::ResultStatus::Success) {
|
if (minimum_key_generation > 0) {
|
||||||
return nullptr;
|
FileSys::NCA nca(nca_raw);
|
||||||
}
|
if (nca.GetStatus() == Loader::ResultStatus::Success &&
|
||||||
|
(nca.GetKeyGeneration() < minimum_key_generation ||
|
||||||
u8 current_gen = nca.GetKeyGeneration();
|
nca.GetKeyGeneration() > 19)) {
|
||||||
if (minimum_key_generation > 0 && (current_gen < minimum_key_generation ||
|
LOG_WARNING(Service_LDR, "Skipping program {:016X} with generation {}", program_id,
|
||||||
current_gen > maximum_key_generation)) {
|
nca.GetKeyGeneration());
|
||||||
LOG_WARNING(Service_LDR, "Program {:016X} has unsupported generation {}. "
|
return nullptr;
|
||||||
"Attempting to load anyway...", program_id, current_gen);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Loader::AppLoader> loader;
|
std::unique_ptr<Loader::AppLoader> loader;
|
||||||
|
@ -101,7 +106,6 @@ std::unique_ptr<Process> CreateApplicationProcess(std::vector<u8>& out_control,
|
||||||
out_control = nacp.GetRawBytes();
|
out_control = nacp.GetRawBytes();
|
||||||
} else {
|
} else {
|
||||||
out_control.resize(sizeof(FileSys::RawNACP));
|
out_control.resize(sizeof(FileSys::RawNACP));
|
||||||
std::fill(out_control.begin(), out_control.end(), (u8) 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& storage = system.GetContentProviderUnion();
|
auto& storage = system.GetContentProviderUnion();
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Process;
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
std::unique_ptr<Process> CreateProcess(Core::System& system, u64 program_id,
|
std::unique_ptr<Process> CreateProcess(Core::System& system, u64 program_id,
|
||||||
u8 minimum_key_generation, u8 maximum_key_generation);
|
u8 minimum_key_generation);
|
||||||
std::unique_ptr<Process> CreateApplicationProcess(std::vector<u8>& out_control,
|
std::unique_ptr<Process> CreateApplicationProcess(std::vector<u8>& out_control,
|
||||||
std::unique_ptr<Loader::AppLoader>& out_loader,
|
std::unique_ptr<Loader::AppLoader>& out_loader,
|
||||||
Loader::ResultStatus& out_load_result,
|
Loader::ResultStatus& out_load_result,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue