kernel: Update to use atmosphere macros and correct Result (#7242)
* kernel: Switch to atmosphere style macros * code: Rename ResultCode to Result * code: Result constants are lower case * Address review comments * core: Remove CASCADE_CODE * R_TRY replaces completely * core: Run clang format
This commit is contained in:
@@ -261,7 +261,7 @@ void AppletManager::CancelAndSendParameter(const MessageParameter& parameter) {
|
||||
}
|
||||
}
|
||||
|
||||
ResultCode AppletManager::SendParameter(const MessageParameter& parameter) {
|
||||
Result AppletManager::SendParameter(const MessageParameter& parameter) {
|
||||
// A new parameter can not be sent if the previous one hasn't been consumed yet
|
||||
if (next_parameter) {
|
||||
LOG_WARNING(Service_APT, "Parameter from {:03X} to {:03X} blocked by pending parameter.",
|
||||
@@ -271,18 +271,18 @@ ResultCode AppletManager::SendParameter(const MessageParameter& parameter) {
|
||||
}
|
||||
|
||||
CancelAndSendParameter(parameter);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<MessageParameter> AppletManager::GlanceParameter(AppletId app_id) {
|
||||
if (!next_parameter) {
|
||||
return ResultCode(ErrorDescription::NoData, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status);
|
||||
return Result(ErrorDescription::NoData, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
||||
if (next_parameter->destination_id != app_id) {
|
||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
||||
auto parameter = *next_parameter;
|
||||
@@ -348,8 +348,8 @@ ResultVal<AppletManager::InitializeResult> AppletManager::Initialize(AppletId ap
|
||||
auto slot_data = GetAppletSlot(slot);
|
||||
if (slot_data->registered) {
|
||||
LOG_WARNING(Service_APT, "Applet attempted to register in occupied slot {:02X}", slot);
|
||||
return ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
return Result(ErrorDescription::AlreadyExists, ErrorModule::Applet,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
}
|
||||
|
||||
LOG_DEBUG(Service_APT, "Initializing applet with ID {:03X} and attributes {:08X}.", app_id,
|
||||
@@ -377,7 +377,7 @@ ResultVal<AppletManager::InitializeResult> AppletManager::Initialize(AppletId ap
|
||||
return InitializeResult{slot_data->notification_event, slot_data->parameter_event};
|
||||
}
|
||||
|
||||
ResultCode AppletManager::Enable(AppletAttributes attributes) {
|
||||
Result AppletManager::Enable(AppletAttributes attributes) {
|
||||
auto slot = GetAppletSlotFromAttributes(attributes);
|
||||
if (slot == AppletSlot::Error) {
|
||||
LOG_WARNING(Service_APT,
|
||||
@@ -406,10 +406,10 @@ ResultCode AppletManager::Enable(AppletAttributes attributes) {
|
||||
delayed_parameter.reset();
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::Finalize(AppletId app_id) {
|
||||
Result AppletManager::Finalize(AppletId app_id) {
|
||||
auto slot = GetAppletSlotFromId(app_id);
|
||||
if (slot == AppletSlot::Error) {
|
||||
return {ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
@@ -430,7 +430,7 @@ ResultCode AppletManager::Finalize(AppletId app_id) {
|
||||
active_slot = GetAppletSlotFromPos(AppletPos::System);
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
u32 AppletManager::CountRegisteredApplet() {
|
||||
@@ -446,14 +446,14 @@ bool AppletManager::IsRegistered(AppletId app_id) {
|
||||
ResultVal<AppletAttributes> AppletManager::GetAttribute(AppletId app_id) {
|
||||
auto slot = GetAppletSlotFromId(app_id);
|
||||
if (slot == AppletSlot::Error) {
|
||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
||||
auto slot_data = GetAppletSlot(slot);
|
||||
if (!slot_data->registered) {
|
||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
||||
return slot_data->attributes;
|
||||
@@ -470,17 +470,17 @@ ResultVal<Notification> AppletManager::InquireNotification(AppletId app_id) {
|
||||
}
|
||||
}
|
||||
|
||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
||||
ResultCode AppletManager::SendNotification(Notification notification) {
|
||||
Result AppletManager::SendNotification(Notification notification) {
|
||||
if (active_slot != AppletSlot::Error) {
|
||||
const auto slot_data = GetAppletSlot(active_slot);
|
||||
if (slot_data->registered) {
|
||||
slot_data->notification = notification;
|
||||
slot_data->notification_event->Signal();
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ void AppletManager::SendNotificationToAll(Notification notification) {
|
||||
}
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
|
||||
Result AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
|
||||
// The real APT service returns an error if there's a pending APT parameter when this function
|
||||
// is called.
|
||||
if (next_parameter) {
|
||||
@@ -519,14 +519,14 @@ ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
|
||||
auto process =
|
||||
NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
|
||||
if (process) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.
|
||||
auto applet = HLE::Applets::Applet::Get(applet_id);
|
||||
if (applet) {
|
||||
LOG_WARNING(Service_APT, "applet has already been started id={:03X}", applet_id);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
} else {
|
||||
auto parent = GetAppletSlotId(last_library_launcher_slot);
|
||||
LOG_DEBUG(Service_APT, "Creating HLE applet {:03X} with parent {:03X}", applet_id, parent);
|
||||
@@ -534,7 +534,7 @@ ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
|
||||
}
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
|
||||
Result AppletManager::PreloadLibraryApplet(AppletId applet_id) {
|
||||
if (GetAppletSlot(AppletSlot::LibraryApplet)->registered) {
|
||||
return {ErrorDescription::AlreadyExists, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@@ -547,14 +547,14 @@ ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
|
||||
auto process =
|
||||
NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue()));
|
||||
if (process) {
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
// If we weren't able to load the native applet title, try to fallback to an HLE implementation.
|
||||
auto applet = HLE::Applets::Applet::Get(applet_id);
|
||||
if (applet) {
|
||||
LOG_WARNING(Service_APT, "applet has already been started id={:08X}", applet_id);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
} else {
|
||||
auto parent = GetAppletSlotId(last_library_launcher_slot);
|
||||
LOG_DEBUG(Service_APT, "Creating HLE applet {:03X} with parent {:03X}", applet_id, parent);
|
||||
@@ -562,15 +562,14 @@ ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
|
||||
}
|
||||
}
|
||||
|
||||
ResultCode AppletManager::FinishPreloadingLibraryApplet(AppletId applet_id) {
|
||||
Result AppletManager::FinishPreloadingLibraryApplet(AppletId applet_id) {
|
||||
// TODO(Subv): This function should fail depending on the applet preparation state.
|
||||
GetAppletSlot(AppletSlot::LibraryApplet)->loaded = true;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::StartLibraryApplet(AppletId applet_id,
|
||||
std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
Result AppletManager::StartLibraryApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
active_slot = AppletSlot::LibraryApplet;
|
||||
|
||||
auto send_res = SendParameter({
|
||||
@@ -585,11 +584,10 @@ ResultCode AppletManager::StartLibraryApplet(AppletId applet_id,
|
||||
return send_res;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiting,
|
||||
bool jump_home) {
|
||||
Result AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiting, bool jump_home) {
|
||||
if (next_parameter) {
|
||||
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@@ -604,11 +602,11 @@ ResultCode AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiti
|
||||
else
|
||||
library_applet_closing_command = SignalType::WakeupByExit;
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
Result AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
auto slot = GetAppletSlot(AppletSlot::LibraryApplet);
|
||||
auto destination_id = GetAppletSlotId(last_library_launcher_slot);
|
||||
|
||||
@@ -630,10 +628,10 @@ ResultCode AppletManager::CloseLibraryApplet(std::shared_ptr<Kernel::Object> obj
|
||||
SendParameter(param);
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::CancelLibraryApplet(bool app_exiting) {
|
||||
Result AppletManager::CancelLibraryApplet(bool app_exiting) {
|
||||
if (next_parameter) {
|
||||
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@@ -652,8 +650,8 @@ ResultCode AppletManager::CancelLibraryApplet(bool app_exiting) {
|
||||
});
|
||||
}
|
||||
|
||||
ResultCode AppletManager::SendDspSleep(AppletId from_applet_id,
|
||||
std::shared_ptr<Kernel::Object> object) {
|
||||
Result AppletManager::SendDspSleep(AppletId from_applet_id,
|
||||
std::shared_ptr<Kernel::Object> object) {
|
||||
auto lib_slot = GetAppletSlotFromPos(AppletPos::Library);
|
||||
auto lib_app_id =
|
||||
lib_slot != AppletSlot::Error ? GetAppletSlot(lib_slot)->applet_id : AppletId::None;
|
||||
@@ -681,11 +679,11 @@ ResultCode AppletManager::SendDspSleep(AppletId from_applet_id,
|
||||
});
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::SendDspWakeUp(AppletId from_applet_id,
|
||||
std::shared_ptr<Kernel::Object> object) {
|
||||
Result AppletManager::SendDspWakeUp(AppletId from_applet_id,
|
||||
std::shared_ptr<Kernel::Object> object) {
|
||||
auto lib_slot = GetAppletSlotFromPos(AppletPos::Library);
|
||||
auto lib_app_id =
|
||||
lib_slot != AppletSlot::Error ? GetAppletSlot(lib_slot)->applet_id : AppletId::None;
|
||||
@@ -714,10 +712,10 @@ ResultCode AppletManager::SendDspWakeUp(AppletId from_applet_id,
|
||||
}
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToStartSystemApplet(AppletId applet_id) {
|
||||
Result AppletManager::PrepareToStartSystemApplet(AppletId applet_id) {
|
||||
// The real APT service returns an error if there's a pending APT parameter when this function
|
||||
// is called.
|
||||
if (next_parameter) {
|
||||
@@ -726,12 +724,11 @@ ResultCode AppletManager::PrepareToStartSystemApplet(AppletId applet_id) {
|
||||
}
|
||||
|
||||
last_system_launcher_slot = active_slot;
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::StartSystemApplet(AppletId applet_id,
|
||||
std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
Result AppletManager::StartSystemApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
auto source_applet_id = AppletId::None;
|
||||
if (last_system_launcher_slot != AppletSlot::Error) {
|
||||
const auto slot_data = GetAppletSlot(last_system_launcher_slot);
|
||||
@@ -769,20 +766,20 @@ ResultCode AppletManager::StartSystemApplet(AppletId applet_id,
|
||||
.buffer = buffer,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToCloseSystemApplet() {
|
||||
Result AppletManager::PrepareToCloseSystemApplet() {
|
||||
if (next_parameter) {
|
||||
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
Result AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
ASSERT_MSG(active_slot == AppletSlot::HomeMenu || active_slot == AppletSlot::SystemApplet,
|
||||
"Attempting to close a system applet from a non-system applet.");
|
||||
|
||||
@@ -806,10 +803,10 @@ ResultCode AppletManager::CloseSystemApplet(std::shared_ptr<Kernel::Object> obje
|
||||
}
|
||||
|
||||
// TODO: Terminate the running applet title
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::OrderToCloseSystemApplet() {
|
||||
Result AppletManager::OrderToCloseSystemApplet() {
|
||||
if (active_slot == AppletSlot::Error) {
|
||||
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@@ -843,10 +840,10 @@ ResultCode AppletManager::OrderToCloseSystemApplet() {
|
||||
.signal = SignalType::WakeupByCancel,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToJumpToHomeMenu() {
|
||||
Result AppletManager::PrepareToJumpToHomeMenu() {
|
||||
if (next_parameter) {
|
||||
return {ErrCodes::ParameterPresent, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@@ -860,11 +857,11 @@ ResultCode AppletManager::PrepareToJumpToHomeMenu() {
|
||||
EnsureHomeMenuLoaded();
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
Result AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
if (last_jump_to_home_slot != AppletSlot::Error) {
|
||||
auto slot_data = GetAppletSlot(last_jump_to_home_slot);
|
||||
if (slot_data->applet_id != AppletId::None) {
|
||||
@@ -910,10 +907,10 @@ ResultCode AppletManager::JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
|
||||
}
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToLeaveHomeMenu() {
|
||||
Result AppletManager::PrepareToLeaveHomeMenu() {
|
||||
if (!GetAppletSlot(AppletSlot::Application)->registered) {
|
||||
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@@ -924,11 +921,11 @@ ResultCode AppletManager::PrepareToLeaveHomeMenu() {
|
||||
ErrorLevel::Status};
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
Result AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
active_slot = AppletSlot::Application;
|
||||
|
||||
SendParameter({
|
||||
@@ -939,10 +936,10 @@ ResultCode AppletManager::LeaveHomeMenu(std::shared_ptr<Kernel::Object> object,
|
||||
.buffer = buffer,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::OrderToCloseApplication() {
|
||||
Result AppletManager::OrderToCloseApplication() {
|
||||
if (active_slot == AppletSlot::Error) {
|
||||
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@@ -964,10 +961,10 @@ ResultCode AppletManager::OrderToCloseApplication() {
|
||||
.signal = SignalType::WakeupByCancel,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToCloseApplication(bool return_to_sys) {
|
||||
Result AppletManager::PrepareToCloseApplication(bool return_to_sys) {
|
||||
if (active_slot == AppletSlot::Error) {
|
||||
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status};
|
||||
@@ -1015,11 +1012,11 @@ ResultCode AppletManager::PrepareToCloseApplication(bool return_to_sys) {
|
||||
// EnsureHomeMenuLoaded();
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::CloseApplication(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
Result AppletManager::CloseApplication(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
ordered_to_close_application = false;
|
||||
application_cancelled = false;
|
||||
|
||||
@@ -1044,7 +1041,7 @@ ResultCode AppletManager::CloseApplication(std::shared_ptr<Kernel::Object> objec
|
||||
}
|
||||
|
||||
// TODO: Terminate the application process.
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultVal<AppletManager::AppletManInfo> AppletManager::GetAppletManInfo(
|
||||
@@ -1079,14 +1076,14 @@ ResultVal<AppletManager::AppletManInfo> AppletManager::GetAppletManInfo(
|
||||
ResultVal<AppletManager::AppletInfo> AppletManager::GetAppletInfo(AppletId app_id) {
|
||||
auto slot = GetAppletSlotFromId(app_id);
|
||||
if (slot == AppletSlot::Error) {
|
||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
||||
auto slot_data = GetAppletSlot(slot);
|
||||
if (!slot_data->registered) {
|
||||
return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
return Result(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotFound,
|
||||
ErrorLevel::Status);
|
||||
}
|
||||
|
||||
auto media_type = Service::AM::GetTitleMediaType(slot_data->title_id);
|
||||
@@ -1102,14 +1099,13 @@ ResultVal<AppletManager::AppletInfo> AppletManager::GetAppletInfo(AppletId app_i
|
||||
ResultVal<Service::FS::MediaType> AppletManager::Unknown54(u32 in_param) {
|
||||
auto slot_data = GetAppletSlot(AppletSlot::Application);
|
||||
if (slot_data->applet_id == AppletId::None) {
|
||||
return ResultCode{ErrCodes::AppNotRunning, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Permanent};
|
||||
return Result{ErrCodes::AppNotRunning, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Permanent};
|
||||
}
|
||||
|
||||
if (in_param >= 0x80) {
|
||||
// TODO: Add error description name when the parameter is known.
|
||||
return ResultCode{10, ErrorModule::Applet, ErrorSummary::InvalidArgument,
|
||||
ErrorLevel::Usage};
|
||||
return Result{10, ErrorModule::Applet, ErrorSummary::InvalidArgument, ErrorLevel::Usage};
|
||||
}
|
||||
|
||||
// TODO: Figure out what this logic is actually for.
|
||||
@@ -1154,8 +1150,8 @@ ApplicationRunningMode AppletManager::GetApplicationRunningMode() {
|
||||
}
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToDoApplicationJump(u64 title_id, FS::MediaType media_type,
|
||||
ApplicationJumpFlags flags) {
|
||||
Result AppletManager::PrepareToDoApplicationJump(u64 title_id, FS::MediaType media_type,
|
||||
ApplicationJumpFlags flags) {
|
||||
// A running application can not launch another application directly because the applet state
|
||||
// for the Application slot is already in use. The way this is implemented in hardware is to
|
||||
// launch the Home Menu and tell it to launch our desired application.
|
||||
@@ -1180,10 +1176,10 @@ ResultCode AppletManager::PrepareToDoApplicationJump(u64 title_id, FS::MediaType
|
||||
// Note: The real console uses the Home Menu to perform the application jump, therefore the menu
|
||||
// needs to be running. The real APT module starts the Home Menu here if it's not already
|
||||
// running, we don't have to do this. See `EnsureHomeMenuLoaded` for launching the Home Menu.
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::DoApplicationJump(const DeliverArg& arg) {
|
||||
Result AppletManager::DoApplicationJump(const DeliverArg& arg) {
|
||||
// Note: The real console uses the Home Menu to perform the application jump, it goes
|
||||
// OldApplication->Home Menu->NewApplication. We do not need to use the Home Menu to do this so
|
||||
// we launch the new application directly. In the real APT service, the Home Menu must be
|
||||
@@ -1212,7 +1208,7 @@ ResultCode AppletManager::DoApplicationJump(const DeliverArg& arg) {
|
||||
});
|
||||
|
||||
// TODO: APT terminates the application here, usually it will exit itself properly though.
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
} else {
|
||||
// Otherwise, work around the missing home menu by launching the title directly.
|
||||
|
||||
@@ -1227,16 +1223,16 @@ ResultCode AppletManager::DoApplicationJump(const DeliverArg& arg) {
|
||||
LOG_CRITICAL(Service_APT, "Failed to launch title during application jump, exiting.");
|
||||
system.RequestShutdown();
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
*/
|
||||
|
||||
NS::RebootToTitle(system, app_jump_parameters.next_media_type,
|
||||
app_jump_parameters.next_title_id);
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
ResultCode AppletManager::PrepareToStartApplication(u64 title_id, FS::MediaType media_type) {
|
||||
Result AppletManager::PrepareToStartApplication(u64 title_id, FS::MediaType media_type) {
|
||||
if (active_slot == AppletSlot::Error ||
|
||||
GetAppletSlot(active_slot)->attributes.applet_pos != AppletPos::System) {
|
||||
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
@@ -1259,11 +1255,11 @@ ResultCode AppletManager::PrepareToStartApplication(u64 title_id, FS::MediaType
|
||||
|
||||
capture_buffer_info.reset();
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::StartApplication(const std::vector<u8>& parameter,
|
||||
const std::vector<u8>& hmac, bool paused) {
|
||||
Result AppletManager::StartApplication(const std::vector<u8>& parameter,
|
||||
const std::vector<u8>& hmac, bool paused) {
|
||||
// The delivery argument is always unconditionally set.
|
||||
deliver_arg.emplace(DeliverArg{parameter, hmac});
|
||||
|
||||
@@ -1295,11 +1291,11 @@ ResultCode AppletManager::StartApplication(const std::vector<u8>& parameter,
|
||||
return WakeupApplication(nullptr, {});
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
Result AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer) {
|
||||
// Send a Wakeup signal via the apt parameter to the application once it registers itself.
|
||||
// The real APT service does this by spin waiting on another thread until the application is
|
||||
// registered.
|
||||
@@ -1311,10 +1307,10 @@ ResultCode AppletManager::WakeupApplication(std::shared_ptr<Kernel::Object> obje
|
||||
.buffer = buffer,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ResultCode AppletManager::CancelApplication() {
|
||||
Result AppletManager::CancelApplication() {
|
||||
auto application_slot_data = GetAppletSlot(AppletSlot::Application);
|
||||
if (application_slot_data->applet_id == AppletId::None) {
|
||||
return {ErrCodes::InvalidAppletSlot, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
@@ -1330,7 +1326,7 @@ ResultCode AppletManager::CancelApplication() {
|
||||
.signal = SignalType::WakeupByCancel,
|
||||
});
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
void AppletManager::SendApplicationParameterAfterRegistration(const MessageParameter& parameter) {
|
||||
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
*/
|
||||
void CancelAndSendParameter(const MessageParameter& parameter);
|
||||
|
||||
ResultCode SendParameter(const MessageParameter& parameter);
|
||||
Result SendParameter(const MessageParameter& parameter);
|
||||
ResultVal<MessageParameter> GlanceParameter(AppletId app_id);
|
||||
ResultVal<MessageParameter> ReceiveParameter(AppletId app_id);
|
||||
bool CancelParameter(bool check_sender, AppletId sender_appid, bool check_receiver,
|
||||
@@ -283,51 +283,48 @@ public:
|
||||
};
|
||||
ResultVal<InitializeResult> Initialize(AppletId app_id, AppletAttributes attributes);
|
||||
|
||||
ResultCode Enable(AppletAttributes attributes);
|
||||
ResultCode Finalize(AppletId app_id);
|
||||
Result Enable(AppletAttributes attributes);
|
||||
Result Finalize(AppletId app_id);
|
||||
u32 CountRegisteredApplet();
|
||||
bool IsRegistered(AppletId app_id);
|
||||
ResultVal<AppletAttributes> GetAttribute(AppletId app_id);
|
||||
|
||||
ResultVal<Notification> InquireNotification(AppletId app_id);
|
||||
ResultCode SendNotification(Notification notification);
|
||||
Result SendNotification(Notification notification);
|
||||
void SendNotificationToAll(Notification notification);
|
||||
|
||||
ResultCode PrepareToStartLibraryApplet(AppletId applet_id);
|
||||
ResultCode PreloadLibraryApplet(AppletId applet_id);
|
||||
ResultCode FinishPreloadingLibraryApplet(AppletId applet_id);
|
||||
ResultCode StartLibraryApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer);
|
||||
ResultCode PrepareToCloseLibraryApplet(bool not_pause, bool exiting, bool jump_home);
|
||||
ResultCode CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer);
|
||||
ResultCode CancelLibraryApplet(bool app_exiting);
|
||||
|
||||
ResultCode SendDspSleep(AppletId from_applet_id, std::shared_ptr<Kernel::Object> object);
|
||||
ResultCode SendDspWakeUp(AppletId from_applet_id, std::shared_ptr<Kernel::Object> object);
|
||||
|
||||
ResultCode PrepareToStartSystemApplet(AppletId applet_id);
|
||||
ResultCode StartSystemApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer);
|
||||
ResultCode PrepareToCloseSystemApplet();
|
||||
ResultCode CloseSystemApplet(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer);
|
||||
ResultCode OrderToCloseSystemApplet();
|
||||
|
||||
ResultCode PrepareToJumpToHomeMenu();
|
||||
ResultCode JumpToHomeMenu(std::shared_ptr<Kernel::Object> object,
|
||||
Result PrepareToStartLibraryApplet(AppletId applet_id);
|
||||
Result PreloadLibraryApplet(AppletId applet_id);
|
||||
Result FinishPreloadingLibraryApplet(AppletId applet_id);
|
||||
Result StartLibraryApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer);
|
||||
ResultCode PrepareToLeaveHomeMenu();
|
||||
ResultCode LeaveHomeMenu(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
|
||||
Result PrepareToCloseLibraryApplet(bool not_pause, bool exiting, bool jump_home);
|
||||
Result CloseLibraryApplet(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer);
|
||||
Result CancelLibraryApplet(bool app_exiting);
|
||||
|
||||
ResultCode OrderToCloseApplication();
|
||||
ResultCode PrepareToCloseApplication(bool return_to_sys);
|
||||
ResultCode CloseApplication(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer);
|
||||
Result SendDspSleep(AppletId from_applet_id, std::shared_ptr<Kernel::Object> object);
|
||||
Result SendDspWakeUp(AppletId from_applet_id, std::shared_ptr<Kernel::Object> object);
|
||||
|
||||
ResultCode PrepareToDoApplicationJump(u64 title_id, FS::MediaType media_type,
|
||||
ApplicationJumpFlags flags);
|
||||
ResultCode DoApplicationJump(const DeliverArg& arg);
|
||||
Result PrepareToStartSystemApplet(AppletId applet_id);
|
||||
Result StartSystemApplet(AppletId applet_id, std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer);
|
||||
Result PrepareToCloseSystemApplet();
|
||||
Result CloseSystemApplet(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
|
||||
Result OrderToCloseSystemApplet();
|
||||
|
||||
Result PrepareToJumpToHomeMenu();
|
||||
Result JumpToHomeMenu(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
|
||||
Result PrepareToLeaveHomeMenu();
|
||||
Result LeaveHomeMenu(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
|
||||
|
||||
Result OrderToCloseApplication();
|
||||
Result PrepareToCloseApplication(bool return_to_sys);
|
||||
Result CloseApplication(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
|
||||
|
||||
Result PrepareToDoApplicationJump(u64 title_id, FS::MediaType media_type,
|
||||
ApplicationJumpFlags flags);
|
||||
Result DoApplicationJump(const DeliverArg& arg);
|
||||
|
||||
boost::optional<DeliverArg> ReceiveDeliverArg() {
|
||||
auto arg = deliver_arg;
|
||||
@@ -369,12 +366,11 @@ public:
|
||||
std::memcpy(&capture_buffer_info.get(), buffer.data(), sizeof(CaptureBufferInfo));
|
||||
}
|
||||
|
||||
ResultCode PrepareToStartApplication(u64 title_id, FS::MediaType media_type);
|
||||
ResultCode StartApplication(const std::vector<u8>& parameter, const std::vector<u8>& hmac,
|
||||
bool paused);
|
||||
ResultCode WakeupApplication(std::shared_ptr<Kernel::Object> object,
|
||||
const std::vector<u8>& buffer);
|
||||
ResultCode CancelApplication();
|
||||
Result PrepareToStartApplication(u64 title_id, FS::MediaType media_type);
|
||||
Result StartApplication(const std::vector<u8>& parameter, const std::vector<u8>& hmac,
|
||||
bool paused);
|
||||
Result WakeupApplication(std::shared_ptr<Kernel::Object> object, const std::vector<u8>& buffer);
|
||||
Result CancelApplication();
|
||||
|
||||
struct AppletManInfo {
|
||||
AppletPos active_applet_pos;
|
||||
|
||||
@@ -70,7 +70,7 @@ void Module::NSInterface::SetWirelessRebootInfo(Kernel::HLERequestContext& ctx)
|
||||
apt->wireless_reboot_info = std::move(buffer);
|
||||
|
||||
auto rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
LOG_WARNING(Service_APT, "called size={}", size);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ void Module::NSInterface::ShutdownAsync(Kernel::HLERequestContext& ctx) {
|
||||
apt->system.RequestShutdown();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::NSInterface::RebootSystem(Kernel::HLERequestContext& ctx) {
|
||||
@@ -107,7 +107,7 @@ void Module::NSInterface::RebootSystem(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::NSInterface::RebootSystemClean(Kernel::HLERequestContext& ctx) {
|
||||
@@ -118,7 +118,7 @@ void Module::NSInterface::RebootSystemClean(Kernel::HLERequestContext& ctx) {
|
||||
apt->system.RequestReset();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
@@ -134,7 +134,7 @@ void Module::APTInterface::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(result.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 3);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushCopyObjects(result->notification_event, result->parameter_event);
|
||||
}
|
||||
}
|
||||
@@ -314,7 +314,7 @@ void Module::APTInterface::GetSharedFont(Kernel::HLERequestContext& ctx) {
|
||||
apt->shared_font_relocated = true;
|
||||
}
|
||||
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
// Since the SharedMemory interface doesn't provide the address at which the memory was
|
||||
// allocated, the real APT service calculates this address by scanning the entire address space
|
||||
// (using svcQueryMemory) and searches for an allocation of the same size as the Shared Font.
|
||||
@@ -329,7 +329,7 @@ void Module::APTInterface::GetWirelessRebootInfo(Kernel::HLERequestContext& ctx)
|
||||
LOG_WARNING(Service_APT, "called size={:08X}", size);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(apt->wireless_reboot_info, 0);
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ void Module::APTInterface::NotifyToWait(Kernel::HLERequestContext& ctx) {
|
||||
const auto app_id = rp.Pop<u32>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
|
||||
LOG_WARNING(Service_APT, "(STUBBED) app_id={}", app_id);
|
||||
}
|
||||
@@ -359,7 +359,7 @@ void Module::APTInterface::GetLockHandle(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(result.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushRaw(result->corrected_attributes);
|
||||
rb.Push<u32>(result->state);
|
||||
rb.PushCopyObjects(result->lock);
|
||||
@@ -398,7 +398,7 @@ void Module::APTInterface::GetAppletManInfo(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(info.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(info->active_applet_pos);
|
||||
rb.PushEnum(info->requested_applet_id);
|
||||
rb.PushEnum(info->home_menu_applet_id);
|
||||
@@ -412,7 +412,7 @@ void Module::APTInterface::CountRegisteredApplet(Kernel::HLERequestContext& ctx)
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(apt->applet_manager->CountRegisteredApplet());
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ void Module::APTInterface::IsRegistered(Kernel::HLERequestContext& ctx) {
|
||||
const auto app_id = rp.PopEnum<AppletId>();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(apt->applet_manager->IsRegistered(app_id));
|
||||
|
||||
LOG_DEBUG(Service_APT, "called app_id={:#010X}", app_id);
|
||||
@@ -439,7 +439,7 @@ void Module::APTInterface::GetAttribute(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(applet_attr.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(applet_attr.Unwrap().raw);
|
||||
}
|
||||
}
|
||||
@@ -456,7 +456,7 @@ void Module::APTInterface::InquireNotification(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(notification.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(static_cast<u32>(notification.Unwrap()));
|
||||
}
|
||||
}
|
||||
@@ -502,7 +502,7 @@ void Module::APTInterface::ReceiveParameter(Kernel::HLERequestContext& ctx) {
|
||||
buffer_size); // APT always push a buffer with the maximum size
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.PushEnum(next_parameter->sender_id);
|
||||
rb.PushEnum(next_parameter->signal); // Signal type
|
||||
rb.Push(size); // Parameter buffer size
|
||||
@@ -528,7 +528,7 @@ void Module::APTInterface::GlanceParameter(Kernel::HLERequestContext& ctx) {
|
||||
buffer_size); // APT always push a buffer with the maximum size
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.PushEnum(next_parameter->sender_id);
|
||||
rb.PushEnum(next_parameter->signal); // Signal type
|
||||
rb.Push(size); // Parameter buffer size
|
||||
@@ -550,7 +550,7 @@ void Module::APTInterface::CancelParameter(Kernel::HLERequestContext& ctx) {
|
||||
check_sender, sender_appid, check_receiver, receiver_appid);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(apt->applet_manager->CancelParameter(check_sender, sender_appid, check_receiver,
|
||||
receiver_appid));
|
||||
}
|
||||
@@ -564,7 +564,7 @@ void Module::APTInterface::PrepareToDoApplicationJump(Kernel::HLERequestContext&
|
||||
LOG_INFO(Service_APT, "called title_id={:016X}, media_type={:#01X}, flags={:#08X}", title_id,
|
||||
media_type, flags);
|
||||
|
||||
ResultCode result = apt->applet_manager->PrepareToDoApplicationJump(
|
||||
Result result = apt->applet_manager->PrepareToDoApplicationJump(
|
||||
title_id, static_cast<FS::MediaType>(media_type), flags);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
@@ -592,7 +592,7 @@ void Module::APTInterface::GetProgramIdOnApplicationJump(Kernel::HLERequestConte
|
||||
const auto parameters = apt->applet_manager->GetApplicationJumpParameters();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(7, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<u64>(parameters.current_title_id);
|
||||
rb.Push(static_cast<u8>(parameters.current_media_type));
|
||||
rb.Push<u64>(parameters.next_title_id);
|
||||
@@ -611,7 +611,7 @@ void Module::APTInterface::SendDeliverArg(Kernel::HLERequestContext& ctx) {
|
||||
apt->applet_manager->SetDeliverArg(DeliverArg{param, hmac});
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::ReceiveDeliverArg(Kernel::HLERequestContext& ctx) {
|
||||
@@ -626,7 +626,7 @@ void Module::APTInterface::ReceiveDeliverArg(Kernel::HLERequestContext& ctx) {
|
||||
arg.hmac.resize(std::min<std::size_t>(hmac_size, 0x20));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(4, 4);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(arg.source_program_id);
|
||||
rb.Push<u8>(1);
|
||||
rb.PushStaticBuffer(std::move(arg.param), 0);
|
||||
@@ -702,8 +702,8 @@ void Module::APTInterface::AppletUtility(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(RESULT_SUCCESS); // Utility function result
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(ResultSuccess); // Utility function result
|
||||
rb.PushStaticBuffer(out, 0);
|
||||
}
|
||||
|
||||
@@ -720,7 +720,7 @@ void Module::APTInterface::SetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
||||
apt->cpu_percent = value;
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
}
|
||||
|
||||
void Module::APTInterface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
||||
@@ -733,7 +733,7 @@ void Module::APTInterface::GetAppCpuTimeLimit(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(apt->cpu_percent);
|
||||
}
|
||||
|
||||
@@ -767,8 +767,8 @@ void Module::APTInterface::PrepareToStartNewestHomeMenu(Kernel::HLERequestContex
|
||||
|
||||
// This command must return an error when called, otherwise the Home Menu will try to reboot the
|
||||
// system.
|
||||
rb.Push(ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
|
||||
ErrorSummary::InvalidState, ErrorLevel::Status));
|
||||
rb.Push(Result(ErrorDescription::AlreadyExists, ErrorModule::Applet, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status));
|
||||
}
|
||||
|
||||
void Module::APTInterface::PreloadLibraryApplet(Kernel::HLERequestContext& ctx) {
|
||||
@@ -944,7 +944,7 @@ void Module::APTInterface::ReplySleepQuery(Kernel::HLERequestContext& ctx) {
|
||||
from_app_id, reply_value);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::ReplySleepNotificationComplete(Kernel::HLERequestContext& ctx) {
|
||||
@@ -954,7 +954,7 @@ void Module::APTInterface::ReplySleepNotificationComplete(Kernel::HLERequestCont
|
||||
LOG_WARNING(Service_APT, "(STUBBED) called, from_app_id={:08X}", from_app_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::PrepareToJumpToHomeMenu(Kernel::HLERequestContext& ctx) {
|
||||
@@ -1010,7 +1010,7 @@ void Module::APTInterface::LoadSysMenuArg(Kernel::HLERequestContext& ctx) {
|
||||
std::copy_n(apt->sys_menu_arg_buffer.cbegin(), size, buffer.begin());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushStaticBuffer(std::move(buffer), 0);
|
||||
}
|
||||
|
||||
@@ -1025,7 +1025,7 @@ void Module::APTInterface::StoreSysMenuArg(Kernel::HLERequestContext& ctx) {
|
||||
std::copy_n(buffer.cbegin(), size, apt->sys_menu_arg_buffer.begin());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
|
||||
@@ -1038,7 +1038,7 @@ void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx)
|
||||
apt->applet_manager->SendCaptureBufferInfo(buffer);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
|
||||
@@ -1052,7 +1052,7 @@ void Module::APTInterface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& c
|
||||
screen_capture_buffer.resize(size);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(real_size);
|
||||
rb.PushStaticBuffer(std::move(screen_capture_buffer), 0);
|
||||
}
|
||||
@@ -1068,7 +1068,7 @@ void Module::APTInterface::GetCaptureInfo(Kernel::HLERequestContext& ctx) {
|
||||
screen_capture_buffer.resize(size);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(real_size);
|
||||
rb.PushStaticBuffer(std::move(screen_capture_buffer), 0);
|
||||
}
|
||||
@@ -1085,7 +1085,7 @@ void Module::APTInterface::Unknown54(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(media_type.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(media_type.Unwrap());
|
||||
}
|
||||
}
|
||||
@@ -1099,7 +1099,7 @@ void Module::APTInterface::SetScreenCapturePostPermission(Kernel::HLERequestCont
|
||||
apt->screen_capture_post_permission = static_cast<ScreencapPostPermission>(permission & 0xF);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
}
|
||||
|
||||
void Module::APTInterface::GetScreenCapturePostPermission(Kernel::HLERequestContext& ctx) {
|
||||
@@ -1108,7 +1108,7 @@ void Module::APTInterface::GetScreenCapturePostPermission(Kernel::HLERequestCont
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS); // No error
|
||||
rb.Push(ResultSuccess); // No error
|
||||
rb.Push(static_cast<u32>(apt->screen_capture_post_permission));
|
||||
}
|
||||
|
||||
@@ -1131,7 +1131,7 @@ void Module::APTInterface::GetProgramId(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_APT, "called process_id={}", process_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
auto fs_user =
|
||||
Core::System::GetInstance().ServiceManager().GetService<Service::FS::FS_USER>("fs:USER");
|
||||
@@ -1161,7 +1161,7 @@ void Module::APTInterface::GetProgramInfo(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// TODO: Proper error code
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_UNKNOWN);
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1171,7 +1171,7 @@ void Module::APTInterface::GetProgramInfo(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// TODO: Proper error code
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_UNKNOWN);
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1181,12 +1181,12 @@ void Module::APTInterface::GetProgramInfo(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// TODO: Proper error code
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_UNKNOWN);
|
||||
rb.Push(ResultUnknown);
|
||||
return;
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(static_cast<u8>(memory_mode.first.value()));
|
||||
rb.Push(core_version.first.value());
|
||||
}
|
||||
@@ -1203,7 +1203,7 @@ void Module::APTInterface::GetAppletInfo(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(info.Code());
|
||||
} else {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(7, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(info->title_id);
|
||||
rb.Push(static_cast<u8>(info->media_type));
|
||||
rb.Push(info->registered);
|
||||
@@ -1248,7 +1248,7 @@ void Module::APTInterface::GetStartupArgument(Kernel::HLERequestContext& ctx) {
|
||||
param.resize(std::min(parameter_size, max_parameter_size));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(exists);
|
||||
rb.PushStaticBuffer(std::move(param), 0);
|
||||
}
|
||||
@@ -1292,7 +1292,7 @@ void Module::APTInterface::Wrap(Kernel::HLERequestContext& ctx) {
|
||||
output.Write(cipher.data(), nonce_size, cipher.size());
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 4);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
// Unmap buffer
|
||||
rb.PushMappedBuffer(input);
|
||||
rb.PushMappedBuffer(output);
|
||||
@@ -1338,11 +1338,11 @@ void Module::APTInterface::Unwrap(Kernel::HLERequestContext& ctx) {
|
||||
output.Write(nonce.data(), nonce_offset, nonce_size);
|
||||
output.Write(pdata.data() + nonce_offset, nonce_offset + nonce_size,
|
||||
pdata.size() - nonce_offset);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
LOG_ERROR(Service_APT, "Failed to decrypt data");
|
||||
rb.Push(ResultCode(static_cast<ErrorDescription>(1), ErrorModule::PS,
|
||||
ErrorSummary::WrongArgument, ErrorLevel::Status));
|
||||
rb.Push(Result(static_cast<ErrorDescription>(1), ErrorModule::PS,
|
||||
ErrorSummary::WrongArgument, ErrorLevel::Status));
|
||||
}
|
||||
|
||||
// Unmap buffer
|
||||
@@ -1366,7 +1366,7 @@ void Module::APTInterface::Reboot(Kernel::HLERequestContext& ctx) {
|
||||
NS::RebootToTitle(apt->system, media_type, title_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::HardwareResetAsync(Kernel::HLERequestContext& ctx) {
|
||||
@@ -1377,7 +1377,7 @@ void Module::APTInterface::HardwareResetAsync(Kernel::HLERequestContext& ctx) {
|
||||
apt->system.RequestReset();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void Module::APTInterface::GetTargetPlatform(Kernel::HLERequestContext& ctx) {
|
||||
@@ -1386,7 +1386,7 @@ void Module::APTInterface::GetTargetPlatform(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(apt->applet_manager->GetTargetPlatform());
|
||||
}
|
||||
|
||||
@@ -1405,7 +1405,7 @@ void Module::APTInterface::GetApplicationRunningMode(Kernel::HLERequestContext&
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushEnum(apt->applet_manager->GetApplicationRunningMode());
|
||||
}
|
||||
|
||||
@@ -1425,7 +1425,7 @@ void Module::APTInterface::IsStandardMemoryLayout(Kernel::HLERequestContext& ctx
|
||||
}
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(is_standard);
|
||||
}
|
||||
|
||||
@@ -1439,7 +1439,7 @@ void Module::APTInterface::IsTitleAllowed(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// We allow all titles to be launched, so this function is a no-op
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user