Firmware 20.0.0 Initial Implementation & Android: Uninstall Firmware Button

Co-authored-by: Pavel Barabanov <pavelbarabanov94@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/89
Co-authored-by: crueter <crueter@noreply.localhost>
Co-committed-by: crueter <crueter@noreply.localhost>
This commit is contained in:
crueter 2025-05-07 20:15:25 +00:00 committed by edendev
parent 668bcb94db
commit 4661909f4c
18 changed files with 155 additions and 20 deletions

View file

@ -60,24 +60,29 @@ std::unique_ptr<Process> CreateProcessImpl(std::unique_ptr<Loader::AppLoader>& o
} // Anonymous namespace
std::unique_ptr<Process> CreateProcess(Core::System& system, u64 program_id,
u8 minimum_key_generation, u8 maximum_key_generation) {
FileSys::VirtualFile nca_raw = system.GetContentProviderUnion()
.GetEntryRaw(program_id, FileSys::ContentRecordType::Program);
u8 minimum_key_generation, u8 maximum_key_generation) {
// Attempt to load program NCA.
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) {
return nullptr;
}
FileSys::NCA nca(nca_raw);
if (nca.GetStatus() != Loader::ResultStatus::Success) {
return nullptr;
}
u8 current_gen = nca.GetKeyGeneration();
if (minimum_key_generation > 0 && (current_gen < minimum_key_generation ||
current_gen > maximum_key_generation)) {
LOG_WARNING(Service_LDR, "Program {:016X} has unsupported generation {}. "
"Attempting to load anyway...", program_id, current_gen);
// Ensure we have a suitable version.
if (minimum_key_generation > 0) {
FileSys::NCA nca(nca_raw);
if (nca.GetStatus() == Loader::ResultStatus::Success &&
(nca.GetKeyGeneration() < minimum_key_generation ||
nca.GetKeyGeneration() > maximum_key_generation)) {
LOG_WARNING(Service_LDR, "Skipping program {:016X} with generation {}", program_id,
nca.GetKeyGeneration());
return nullptr;
}
}
std::unique_ptr<Loader::AppLoader> loader;
@ -101,7 +106,7 @@ std::unique_ptr<Process> CreateApplicationProcess(std::vector<u8>& out_control,
out_control = nacp.GetRawBytes();
} else {
out_control.resize(sizeof(FileSys::RawNACP));
std::fill(out_control.begin(), out_control.end(), (u8) 0);
std::fill(out_control.begin(), out_control.end(), 0);
}
auto& storage = system.GetContentProviderUnion();

View file

@ -18,6 +18,7 @@ IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& sys
// clang-format off
static const FunctionInfo functions[] = {
{100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"},
{110, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxyForDebug>, "OpenSystemAppletProxyForDebug"},
{200, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxyOld>, "OpenLibraryAppletProxyOld"},
{201, D<&IAllSystemAppletProxiesService::OpenLibraryAppletProxy>, "OpenLibraryAppletProxy"},
{300, nullptr, "OpenOverlayAppletProxy"},
@ -25,6 +26,7 @@ IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& sys
{400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"},
{410, nullptr, "GetSystemAppletControllerForDebug"},
{450, D<&IAllSystemAppletProxiesService::GetSystemProcessCommonFunctions>, "GetSystemProcessCommonFunctions"}, // 19.0.0+
{460, nullptr, "Unknown460"},
{1000, nullptr, "GetDebugFunctions"},
};
// clang-format on
@ -49,6 +51,26 @@ Result IAllSystemAppletProxiesService::OpenSystemAppletProxy(
}
}
Result IAllSystemAppletProxiesService::OpenSystemAppletProxyForDebug(
Out<SharedPointer<ISystemAppletProxy>> out_proxy, ClientProcessId pid) {
LOG_DEBUG(Service_AM, "OpenSystemAppletProxyForDebug called");
auto process = system.ApplicationProcess();
if (!process) {
LOG_ERROR(Service_AM, "No application process available");
R_THROW(ResultUnknown);
}
if (const auto applet = GetAppletFromProcessId(pid)) {
*out_proxy = std::make_shared<ISystemAppletProxy>(
system, applet, process, m_window_system);
R_SUCCEED();
}
LOG_ERROR(Service_AM, "Applet not found for pid={}", pid.pid);
R_THROW(ResultUnknown);
}
Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy(
Out<SharedPointer<ILibraryAppletProxy>> out_library_applet_proxy, ClientProcessId pid,
InCopyHandle<Kernel::KProcess> process_handle,

View file

@ -27,6 +27,7 @@ private:
Result OpenSystemAppletProxy(Out<SharedPointer<ISystemAppletProxy>> out_system_applet_proxy,
ClientProcessId pid,
InCopyHandle<Kernel::KProcess> process_handle);
Result OpenSystemAppletProxyForDebug(Out<SharedPointer<ISystemAppletProxy>> out_proxy, ClientProcessId pid);
Result OpenLibraryAppletProxy(Out<SharedPointer<ILibraryAppletProxy>> out_library_applet_proxy,
ClientProcessId pid,
InCopyHandle<Kernel::KProcess> process_handle,

View file

@ -32,6 +32,11 @@ IAppletCommonFunctions::IAppletCommonFunctions(Core::System& system_,
{91, nullptr, "OpenNamedChannelAsChild"},
{100, nullptr, "SetApplicationCoreUsageMode"},
{300, D<&IAppletCommonFunctions::GetCurrentApplicationId>, "GetCurrentApplicationId"},
{310, nullptr, "IsSystemAppletHomeMenu"}, //19.0.0+
{311, nullptr, "Unknown311"},
{320, nullptr, "SetGpuTimeSliceBoost"}, //19.0.0+
{321, nullptr, "SetGpuTimeSliceBoostDueToApplication"}, //19.0.0+
{350, nullptr, "Unknown350"},
};
// clang-format on

View file

@ -111,9 +111,11 @@ std::shared_ptr<ILibraryAppletAccessor> CreateGuestApplet(Core::System& system,
Firmware1500 = 15,
Firmware1600 = 16,
Firmware1700 = 17,
Firmware1800 = 18,
Firmware1900 = 19,
};
auto process = CreateProcess(system, program_id, Firmware1400, Firmware1700);
auto process = CreateProcess(system, program_id, Firmware1400, Firmware1900);
if (!process) {
// Couldn't initialize the guest process
return {};

View file

@ -15,7 +15,7 @@ IProcessWindingController::IProcessWindingController(Core::System& system_,
static const FunctionInfo functions[] = {
{0, D<&IProcessWindingController::GetLaunchReason>, "GetLaunchReason"},
{11, D<&IProcessWindingController::OpenCallingLibraryApplet>, "OpenCallingLibraryApplet"},
{21, nullptr, "PushContext"},
{21, D<&IProcessWindingController::PushContext>, "PushContext"},
{22, nullptr, "PopContext"},
{23, nullptr, "CancelWindingReservation"},
{30, nullptr, "WindAndDoReserved"},
@ -51,4 +51,9 @@ Result IProcessWindingController::OpenCallingLibraryApplet(
R_SUCCEED();
}
Result IProcessWindingController::PushContext() {
LOG_WARNING(Service_AM, "(STUBBED) called");
R_SUCCEED();
}
} // namespace Service::AM

View file

@ -21,7 +21,7 @@ private:
Result GetLaunchReason(Out<AppletProcessLaunchReason> out_launch_reason);
Result OpenCallingLibraryApplet(
Out<SharedPointer<ILibraryAppletAccessor>> out_calling_library_applet);
Result PushContext();
const std::shared_ptr<Applet> m_applet;
};

View file

@ -67,6 +67,7 @@ ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet>
{110, nullptr, "SetApplicationAlbumUserData"},
{120, D<&ISelfController::SaveCurrentScreenshot>, "SaveCurrentScreenshot"},
{130, D<&ISelfController::SetRecordVolumeMuted>, "SetRecordVolumeMuted"},
{230, D<&ISelfController::Unknown230>, "Unknown230"},
{1000, nullptr, "GetDebugStorageChannel"},
};
// clang-format on
@ -394,6 +395,10 @@ Result ISelfController::SaveCurrentScreenshot(Capture::AlbumReportOption album_r
R_SUCCEED();
}
Result ISelfController::Unknown230() {
LOG_WARNING(Service_AM, "(STUBBED) called - function 230 (0xE6)");
R_SUCCEED();
}
Result ISelfController::SetRecordVolumeMuted(bool muted) {
LOG_WARNING(Service_AM, "(STUBBED) called. muted={}", muted);

View file

@ -62,6 +62,7 @@ private:
Result GetAccumulatedSuspendedTickChangedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result SetAlbumImageTakenNotificationEnabled(bool enabled);
Result SaveCurrentScreenshot(Capture::AlbumReportOption album_report_option);
Result Unknown230();
Result SetRecordVolumeMuted(bool muted);
Kernel::KProcess* const m_process;