Compare commits

...

12 Commits

Author SHA1 Message Date
Narr the Reg c54b12181d clang format 2024-02-12 18:02:43 -06:00
german77 26c0ba122f service: news: Stub remaining functions 2024-02-11 21:05:28 -06:00
german77 905356ccfc launch 2024-02-11 21:05:28 -06:00
german77 09ababeaad display titles 2024-02-11 21:05:28 -06:00
Narr the Reg e58881cb9c fix user creation 2024-02-11 21:05:28 -06:00
Narr the Reg f5bf73069d fix changing theme 2024-02-11 21:05:28 -06:00
Narr the Reg 8e3cd0a5b0 stubbs 2024-02-11 21:05:28 -06:00
Narr the Reg 10e54243e3 service: am: Implement remaining am functions needed by Qlaunch 2024-02-11 21:05:24 -06:00
german77 9052a9b8ee fix settings 2024-02-11 21:04:25 -06:00
german77 e2fe0c49b2 moar stubs 2024-02-11 21:04:25 -06:00
german77 39af5495f4 service: Add even more stubs for Qlaunch 2024-02-11 21:04:25 -06:00
german77 c3db1c4681 service: Add stubs for Qlaunch 2024-02-11 21:04:25 -06:00
47 changed files with 1445 additions and 117 deletions

View File

@ -439,6 +439,8 @@ add_library(core STATIC
hle/service/am/audio_controller.h
hle/service/am/common_state_getter.cpp
hle/service/am/common_state_getter.h
hle/service/am/cradle_firmware_updater.cpp
hle/service/am/cradle_firmware_updater.h
hle/service/am/debug_functions.cpp
hle/service/am/debug_functions.h
hle/service/am/display_controller.cpp

View File

@ -96,9 +96,10 @@ public:
{133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+
{134, nullptr, "RefreshNintendoAccountVerificationUrlCache"}, // 9.0.0+
{135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+
{140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+
{140, &IManagerForSystemService::GetNetworkServiceLicenseCache, "GetNetworkServiceLicenseCache"}, // 5.0.0+
{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+
{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+
{143, &IManagerForSystemService::Unknown143, "Unknown143"},
{150, nullptr, "CreateAuthorizationRequest"},
{160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"},
{161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"},
@ -114,6 +115,24 @@ private:
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void GetNetworkServiceLicenseCache(HLERequestContext& ctx) {
LOG_ERROR(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(ResultSuccess);
rb.Push<u64>(0);
rb.Push<u64>(0);
}
void Unknown143(HLERequestContext& ctx) {
LOG_ERROR(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(ResultSuccess);
rb.Push<u64>(0);
rb.Push<u64>(0);
}
};
// 3.0.0+

View File

@ -329,8 +329,8 @@ bool ProfileManager::GetProfileBaseAndData(const ProfileInfo& user, ProfileBase&
/// Returns if the system is allowing user registrations or not
bool ProfileManager::CanSystemRegisterUser() const {
return false; // TODO(ogniK): Games shouldn't have
// access to user registration, when we
return true; // TODO(ogniK): Games shouldn't have
// access to user registration, when we
// emulate qlaunch. Update this to dynamically change.
}

View File

@ -29,6 +29,7 @@ private:
void OpenSystemAppletProxy(HLERequestContext& ctx);
void OpenLibraryAppletProxy(HLERequestContext& ctx);
void OpenLibraryAppletProxyOld(HLERequestContext& ctx);
void OpenOverlayAppletProxy(HLERequestContext& ctx);
std::shared_ptr<Applet> GetAppletFromContext(HLERequestContext& ctx);

View File

@ -206,6 +206,41 @@ void PushInShowSoftwareKeyboard(Core::System& system, AppletStorageChannel& chan
channel.Push(std::make_shared<IStorage>(system, std::move(work_buffer)));
}
void PushInShowMyPageData(Core::System& system, AppletStorageChannel& channel) {
const CommonArguments arguments{
.arguments_version = CommonArgumentVersion::Version3,
.size = CommonArgumentSize::Version3,
.library_version = 0,
.theme_color = ThemeColor::BasicBlack,
.play_startup_sound = true,
.system_tick = system.CoreTiming().GetClockTicks(),
};
std::vector<u8> argument_data(sizeof(arguments));
std::vector<u8> settings_data{0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE,
0x9E, 0xF8, 0xAF, 0xB1, 0xE8, 0x95, 0x90, 0x33, 0x6C,
0x0B, 0x22, 0x70, 0x07, 0xF4, 0xBB, 0x00};
settings_data.resize(0x10a8);
std::memcpy(argument_data.data(), &arguments, sizeof(arguments));
channel.Push(std::make_shared<IStorage>(system, std::move(argument_data)));
channel.Push(std::make_shared<IStorage>(system, std::move(settings_data)));
}
void PushInShowQlaunch(Core::System& system, AppletStorageChannel& channel) {
const CommonArguments arguments{
.arguments_version = CommonArgumentVersion::Version3,
.size = CommonArgumentSize::Version3,
.library_version = 0,
.theme_color = ThemeColor::BasicBlack,
.play_startup_sound = true,
.system_tick = system.CoreTiming().GetClockTicks(),
};
std::vector<u8> argument_data(sizeof(arguments));
std::memcpy(argument_data.data(), &arguments, sizeof(arguments));
channel.Push(std::make_shared<IStorage>(system, std::move(argument_data)));
}
} // namespace
AppletManager::AppletManager(Core::System& system) : m_system(system) {}
@ -298,6 +333,12 @@ void AppletManager::CreateAndInsertByFrontendAppletParameters(
case AppletId::Controller:
PushInShowController(m_system, InitializeFakeCallerApplet(m_system, applet));
break;
case AppletId::MyPage:
PushInShowMyPageData(m_system, InitializeFakeCallerApplet(m_system, applet));
break;
case AppletId::QLaunch:
PushInShowQlaunch(m_system, InitializeFakeCallerApplet(m_system, applet));
break;
default:
break;
}

View File

@ -6,11 +6,49 @@
namespace Service::AM {
IApplicationAccessor::IApplicationAccessor(Core::System& system_, u64 application_id)
: ServiceFramework{system_, "IApplicationAccessor"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetAppletStateChangedEvent"},
{1, nullptr, "IsCompleted"},
{10, nullptr, "Start"},
{20, nullptr, "RequestExit"},
{25, nullptr, "Terminate"},
{30, nullptr, "GetResult"},
{101, nullptr, "RequestForApplicationToGetForeground"},
{110, nullptr, "TerminateAllLibraryApplets"},
{111, nullptr, "AreAnyLibraryAppletsLeft"},
{112, nullptr, "GetCurrentLibraryApplet"},
{120, nullptr, "GetApplicationId"},
{121, nullptr, "PushLaunchParameter"},
{122, nullptr, "GetApplicationControlProperty"},
{123, nullptr, "GetApplicationLaunchProperty"},
{124, nullptr, "GetApplicationLaunchRequestInfo"},
{130, nullptr, "SetUsers"},
{131, nullptr, "CheckRightsEnvironmentAvailable"},
{132, nullptr, "GetNsRightsEnvironmentHandle"},
{140, nullptr, "GetDesirableUids"},
{150, nullptr, "ReportApplicationExitTimeout"},
{160, nullptr, "SetApplicationAttribute"},
{170, nullptr, "HasSaveDataAccessPermission"},
{180, nullptr, "PushToFriendInvitationStorageChannel"},
{190, nullptr, "PushToNotificationStorageChannel"},
{200, nullptr, "RequestApplicationSoftReset"},
{201, nullptr, "RestartApplicationTimer"},
};
// clang-format on
RegisterHandlers(functions);
}
IApplicationAccessor::~IApplicationAccessor() = default;
IApplicationCreator::IApplicationCreator(Core::System& system_)
: ServiceFramework{system_, "IApplicationCreator"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "CreateApplication"},
{0, &IApplicationCreator::CreateApplication, "CreateApplication"},
{1, nullptr, "PopLaunchRequestedApplication"},
{10, nullptr, "CreateSystemApplication"},
{100, nullptr, "PopFloatingApplicationForDevelopment"},
@ -22,4 +60,15 @@ IApplicationCreator::IApplicationCreator(Core::System& system_)
IApplicationCreator::~IApplicationCreator() = default;
void IApplicationCreator::CreateApplication(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto application_id = rp.Pop<u64>();
LOG_ERROR(Service_NS, "called, application_id={:x}", application_id);
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<IApplicationAccessor>(system, application_id);
}
} // namespace Service::AM

View File

@ -7,10 +7,21 @@
namespace Service::AM {
class IApplicationAccessor final : public ServiceFramework<IApplicationAccessor> {
public:
explicit IApplicationAccessor(Core::System& system_, u64 application_id);
~IApplicationAccessor() override;
private:
};
class IApplicationCreator final : public ServiceFramework<IApplicationCreator> {
public:
explicit IApplicationCreator(Core::System& system_);
~IApplicationCreator() override;
private:
void CreateApplication(HLERequestContext& ctx);
};
} // namespace Service::AM

View File

@ -37,7 +37,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Ap
{20, nullptr, "PushToGeneralChannel"},
{30, nullptr, "GetHomeButtonReaderLockAccessor"},
{31, &ICommonStateGetter::GetReaderLockAccessorEx, "GetReaderLockAccessorEx"},
{32, nullptr, "GetWriterLockAccessorEx"},
{32, &ICommonStateGetter::GetWriterLockAccessorEx, "GetWriterLockAccessorEx"},
{40, nullptr, "GetCradleFwVersion"},
{50, &ICommonStateGetter::IsVrModeEnabled, "IsVrModeEnabled"},
{51, &ICommonStateGetter::SetVrModeEnabled, "SetVrModeEnabled"},
@ -61,7 +61,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Ap
{100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"},
{110, nullptr, "OpenMyGpuErrorHandler"},
{120, &ICommonStateGetter::GetAppletLaunchedHistory, "GetAppletLaunchedHistory"},
{200, nullptr, "GetOperationModeSystemInfo"},
{200, &ICommonStateGetter::GetOperationModeSystemInfo, "GetOperationModeSystemInfo"},
{300, &ICommonStateGetter::GetSettingsPlatformRegion, "GetSettingsPlatformRegion"},
{400, nullptr, "ActivateMigrationService"},
{401, nullptr, "DeactivateMigrationService"},
@ -160,6 +160,15 @@ void ICommonStateGetter::GetReaderLockAccessorEx(HLERequestContext& ctx) {
rb.PushIpcInterface<ILockAccessor>(system);
}
void ICommonStateGetter::GetWriterLockAccessorEx(HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<ILockAccessor>(system);
}
void ICommonStateGetter::GetAcquiredSleepLockEvent(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "called");
@ -271,6 +280,14 @@ void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(HLERequestContext&
rb.Push(ResultSuccess);
}
void ICommonStateGetter::GetOperationModeSystemInfo(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
void ICommonStateGetter::GetAppletLaunchedHistory(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");

View File

@ -54,6 +54,7 @@ private:
void RequestToAcquireSleepLock(HLERequestContext& ctx);
void GetAcquiredSleepLockEvent(HLERequestContext& ctx);
void GetReaderLockAccessorEx(HLERequestContext& ctx);
void GetWriterLockAccessorEx(HLERequestContext& ctx);
void GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx);
void GetOperationMode(HLERequestContext& ctx);
void GetPerformanceMode(HLERequestContext& ctx);
@ -68,6 +69,7 @@ private:
void GetBuiltInDisplayType(HLERequestContext& ctx);
void PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx);
void GetAppletLaunchedHistory(HLERequestContext& ctx);
void GetOperationModeSystemInfo(HLERequestContext& ctx);
void GetSettingsPlatformRegion(HLERequestContext& ctx);
void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(HLERequestContext& ctx);

View File

@ -0,0 +1,57 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/am/cradle_firmware_updater.h"
#include "core/hle/service/ipc_helpers.h"
namespace Service::AM {
ICradleFirmwareUpdater::ICradleFirmwareUpdater(Core::System& system_)
: ServiceFramework{system_, "ICradleFirmwareUpdater"}, service_context{system,
"IHomeMenuFunctions"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "StartUpdate"},
{1, &ICradleFirmwareUpdater::FinishUpdate, "FinishUpdate"},
{2, &ICradleFirmwareUpdater::GetCradleDeviceInfo, "GetCradleDeviceInfo"},
{3, &ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent, "GetCradleDeviceInfoChangeEvent"},
{4, nullptr, "GetUpdateProgressInfo"},
{5, nullptr, "GetLastInternalResult"},
};
// clang-format on
RegisterHandlers(functions);
cradle_device_info_event =
service_context.CreateEvent("IHomeMenuFunctions:PopFromGeneralChannelEvent");
}
ICradleFirmwareUpdater::~ICradleFirmwareUpdater() {
service_context.CloseEvent(cradle_device_info_event);
}
void ICradleFirmwareUpdater::FinishUpdate(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void ICradleFirmwareUpdater::GetCradleDeviceInfo(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 5};
rb.Push(ResultSuccess);
rb.Push<u64>(0);
rb.Push<u32>(0);
}
void ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(cradle_device_info_event->GetReadableEvent());
}
} // namespace Service::AM

View File

@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/service.h"
namespace Service::AM {
class ICradleFirmwareUpdater final : public ServiceFramework<ICradleFirmwareUpdater> {
public:
explicit ICradleFirmwareUpdater(Core::System& system_);
~ICradleFirmwareUpdater() override;
private:
void FinishUpdate(HLERequestContext& ctx);
void GetCradleDeviceInfo(HLERequestContext& ctx);
void GetCradleDeviceInfoChangeEvent(HLERequestContext& ctx);
Kernel::KEvent* cradle_device_info_event;
KernelHelpers::ServiceContext service_context;
};
} // namespace Service::AM

View File

@ -1,13 +1,15 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/am/cradle_firmware_updater.h"
#include "core/hle/service/am/global_state_controller.h"
#include "core/hle/service/ipc_helpers.h"
namespace Service::AM {
IGlobalStateController::IGlobalStateController(Core::System& system_)
: ServiceFramework{system_, "IGlobalStateController"} {
: ServiceFramework{system_, "IGlobalStateController"}, service_context{
system_, "IGlobalStateController"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "RequestToEnterSleep"},
@ -16,19 +18,53 @@ IGlobalStateController::IGlobalStateController(Core::System& system_)
{3, nullptr, "StartShutdownSequence"},
{4, nullptr, "StartRebootSequence"},
{9, nullptr, "IsAutoPowerDownRequested"},
{10, nullptr, "LoadAndApplyIdlePolicySettings"},
{10, &IGlobalStateController::LoadAndApplyIdlePolicySettings, "LoadAndApplyIdlePolicySettings"},
{11, nullptr, "NotifyCecSettingsChanged"},
{12, nullptr, "SetDefaultHomeButtonLongPressTime"},
{13, nullptr, "UpdateDefaultDisplayResolution"},
{14, nullptr, "ShouldSleepOnBoot"},
{15, nullptr, "GetHdcpAuthenticationFailedEvent"},
{30, nullptr, "OpenCradleFirmwareUpdater"},
{14, &IGlobalStateController::ShouldSleepOnBoot, "ShouldSleepOnBoot"},
{15, &IGlobalStateController::GetHdcpAuthenticationFailedEvent, "GetHdcpAuthenticationFailedEvent"},
{30, &IGlobalStateController::OpenCradleFirmwareUpdater, "OpenCradleFirmwareUpdater"},
};
// clang-format on
RegisterHandlers(functions);
hdcp_authentification_failed_event =
service_context.CreateEvent("IGlobalStateController::HdcpAuthenticationFailedEvent");
}
IGlobalStateController::~IGlobalStateController() = default;
void IGlobalStateController::LoadAndApplyIdlePolicySettings(HLERequestContext& ctx) {
LOG_ERROR(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IGlobalStateController::ShouldSleepOnBoot(HLERequestContext& ctx) {
LOG_ERROR(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
void IGlobalStateController::GetHdcpAuthenticationFailedEvent(HLERequestContext& ctx) {
LOG_ERROR(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(hdcp_authentification_failed_event->GetReadableEvent());
}
void IGlobalStateController::OpenCradleFirmwareUpdater(HLERequestContext& ctx) {
LOG_ERROR(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<ICradleFirmwareUpdater>(system);
}
} // namespace Service::AM

View File

@ -3,6 +3,7 @@
#pragma once
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/service.h"
namespace Service::AM {
@ -11,6 +12,15 @@ class IGlobalStateController final : public ServiceFramework<IGlobalStateControl
public:
explicit IGlobalStateController(Core::System& system_);
~IGlobalStateController() override;
private:
void LoadAndApplyIdlePolicySettings(HLERequestContext& ctx);
void ShouldSleepOnBoot(HLERequestContext& ctx);
void GetHdcpAuthenticationFailedEvent(HLERequestContext& ctx);
void OpenCradleFirmwareUpdater(HLERequestContext& ctx);
Kernel::KEvent* hdcp_authentification_failed_event;
KernelHelpers::ServiceContext service_context;
};
} // namespace Service::AM

View File

@ -12,14 +12,14 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
// clang-format off
static const FunctionInfo functions[] = {
{10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"},
{11, nullptr, "LockForeground"},
{12, nullptr, "UnlockForeground"},
{11, &IHomeMenuFunctions::LockForeground, "LockForeground"},
{12, &IHomeMenuFunctions::UnlockForeground, "UnlockForeground"},
{20, nullptr, "PopFromGeneralChannel"},
{21, &IHomeMenuFunctions::GetPopFromGeneralChannelEvent, "GetPopFromGeneralChannelEvent"},
{30, nullptr, "GetHomeButtonWriterLockAccessor"},
{31, nullptr, "GetWriterLockAccessorEx"},
{40, nullptr, "IsSleepEnabled"},
{41, nullptr, "IsRebootEnabled"},
{41, &IHomeMenuFunctions::IsRebootEnabled, "IsRebootEnabled"},
{50, nullptr, "LaunchSystemApplet"},
{51, nullptr, "LaunchStarter"},
{100, nullptr, "PopRequestLaunchApplicationForDebug"},
@ -46,6 +46,20 @@ void IHomeMenuFunctions::RequestToGetForeground(HLERequestContext& ctx) {
rb.Push(ResultSuccess);
}
void IHomeMenuFunctions::LockForeground(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IHomeMenuFunctions::UnlockForeground(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
@ -54,4 +68,12 @@ void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(HLERequestContext& ctx) {
rb.PushCopyObjects(pop_from_general_channel_event->GetReadableEvent());
}
void IHomeMenuFunctions::IsRebootEnabled(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u8>(true);
}
} // namespace Service::AM

View File

@ -15,7 +15,10 @@ public:
private:
void RequestToGetForeground(HLERequestContext& ctx);
void LockForeground(HLERequestContext& ctx);
void UnlockForeground(HLERequestContext& ctx);
void GetPopFromGeneralChannelEvent(HLERequestContext& ctx);
void IsRebootEnabled(HLERequestContext& ctx);
KernelHelpers::ServiceContext service_context;

View File

@ -302,20 +302,20 @@ void ILibraryAppletSelfAccessor::GetCurrentApplicationId(HLERequestContext& ctx)
void ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers(HLERequestContext& ctx) {
const Service::Account::ProfileManager manager{};
bool is_empty{true};
bool can_select_any_user{};
s32 user_count{-1};
LOG_INFO(Service_AM, "called");
if (manager.GetUserCount() > 0) {
is_empty = false;
can_select_any_user = true;
user_count = static_cast<s32>(manager.GetUserCount());
ctx.WriteBuffer(manager.GetAllUsers());
}
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
rb.Push<u8>(is_empty);
rb.Push<u8>(can_select_any_user);
rb.Push(user_count);
}

View File

@ -49,7 +49,7 @@ ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet>
{46, nullptr, "SetRecordingLayerCompositionEnabled"},
{50, &ISelfController::SetHandlesRequestToDisplay, "SetHandlesRequestToDisplay"},
{51, &ISelfController::ApproveToDisplay, "ApproveToDisplay"},
{60, nullptr, "OverrideAutoSleepTimeAndDimmingTime"},
{60, &ISelfController::OverrideAutoSleepTimeAndDimmingTime, "OverrideAutoSleepTimeAndDimmingTime"},
{61, &ISelfController::SetMediaPlaybackState, "SetMediaPlaybackState"},
{62, &ISelfController::SetIdleTimeDetectionExtension, "SetIdleTimeDetectionExtension"},
{63, &ISelfController::GetIdleTimeDetectionExtension, "GetIdleTimeDetectionExtension"},
@ -61,7 +61,7 @@ ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet>
{69, &ISelfController::IsAutoSleepDisabled, "IsAutoSleepDisabled"},
{70, nullptr, "ReportMultimediaError"},
{71, nullptr, "GetCurrentIlluminanceEx"},
{72, nullptr, "SetInputDetectionPolicy"},
{72, &ISelfController::SetInputDetectionPolicy, "SetInputDetectionPolicy"},
{80, nullptr, "SetWirelessPriorityMode"},
{90, &ISelfController::GetAccumulatedSuspendedTickValue, "GetAccumulatedSuspendedTickValue"},
{91, &ISelfController::GetAccumulatedSuspendedTickChangedEvent, "GetAccumulatedSuspendedTickChangedEvent"},
@ -327,6 +327,18 @@ void ISelfController::ApproveToDisplay(HLERequestContext& ctx) {
rb.Push(ResultSuccess);
}
void ISelfController::OverrideAutoSleepTimeAndDimmingTime(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto a = rp.Pop<u32>();
const auto b = rp.Pop<u32>();
const auto c = rp.Pop<u32>();
const auto d = rp.Pop<u32>();
LOG_WARNING(Service_AM, "(STUBBED) called, a={}, b={}, c={}, d={}", a, b, c, d);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void ISelfController::SetMediaPlaybackState(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u8 state = rp.Pop<u8>();
@ -399,6 +411,13 @@ void ISelfController::IsAutoSleepDisabled(HLERequestContext& ctx) {
rb.Push(applet->auto_sleep_disabled);
}
void ISelfController::SetInputDetectionPolicy(HLERequestContext& ctx) {
LOG_ERROR(Service_AM, "called.");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void ISelfController::GetAccumulatedSuspendedTickValue(HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called.");

View File

@ -39,12 +39,14 @@ private:
void CreateManagedDisplaySeparableLayer(HLERequestContext& ctx);
void SetHandlesRequestToDisplay(HLERequestContext& ctx);
void ApproveToDisplay(HLERequestContext& ctx);
void OverrideAutoSleepTimeAndDimmingTime(HLERequestContext& ctx);
void SetMediaPlaybackState(HLERequestContext& ctx);
void SetIdleTimeDetectionExtension(HLERequestContext& ctx);
void GetIdleTimeDetectionExtension(HLERequestContext& ctx);
void ReportUserIsActive(HLERequestContext& ctx);
void SetAutoSleepDisabled(HLERequestContext& ctx);
void IsAutoSleepDisabled(HLERequestContext& ctx);
void SetInputDetectionPolicy(HLERequestContext& ctx);
void GetAccumulatedSuspendedTickValue(HLERequestContext& ctx);
void GetAccumulatedSuspendedTickChangedEvent(HLERequestContext& ctx);
void SetAlbumImageTakenNotificationEnabled(HLERequestContext& ctx);

View File

@ -9,7 +9,8 @@
namespace Service::Audio {
AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
AudCtl::AudCtl(Core::System& system_)
: ServiceFramework{system_, "audctl"}, service_context{system, "audctl"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetTargetVolume"},
@ -46,7 +47,7 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
{31, &AudCtl::IsSpeakerAutoMuteEnabled, "IsSpeakerAutoMuteEnabled"},
{32, nullptr, "GetActiveOutputTarget"},
{33, nullptr, "GetTargetDeviceInfo"},
{34, nullptr, "AcquireTargetNotification"},
{34, &AudCtl::AcquireTargetNotification, "AcquireTargetNotification"},
{35, nullptr, "SetHearingProtectionSafeguardTimerRemainingTimeForDebug"},
{36, nullptr, "GetHearingProtectionSafeguardTimerRemainingTimeForDebug"},
{37, nullptr, "SetHearingProtectionSafeguardEnabled"},
@ -71,6 +72,8 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} {
RegisterHandlers(functions);
notification_event = service_context.CreateEvent("audctl:NotificationEvent");
m_set_sys =
system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true);
}
@ -198,4 +201,12 @@ void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
rb.Push<u8>(is_speaker_auto_mute_enabled);
}
void AudCtl::AcquireTargetNotification(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(notification_event->GetReadableEvent());
}
} // namespace Service::Audio

View File

@ -3,6 +3,7 @@
#pragma once
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/service.h"
namespace Core {
@ -44,6 +45,9 @@ private:
void IsSpeakerAutoMuteEnabled(HLERequestContext& ctx);
void AcquireTargetNotification(HLERequestContext& ctx);
KernelHelpers::ServiceContext service_context;
Kernel::KEvent* notification_event;
std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
};

View File

@ -93,7 +93,7 @@ public:
{31, nullptr, "EnableMcMode"},
{32, nullptr, "EnableLlrScan"},
{33, nullptr, "DisableLlrScan"},
{34, nullptr, "EnableRadio"},
{34, &BtDrv::EnableRadio, "EnableRadio"},
{35, nullptr, "SetVisibility"},
{36, nullptr, "EnableTbfcScan"},
{37, nullptr, "RegisterHidReportEvent"},
@ -195,6 +195,12 @@ public:
RegisterHandlers(functions);
}
private:
void EnableRadio(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
};
void LoopProcess(Core::System& system) {

View File

@ -154,8 +154,8 @@ public:
{11, nullptr, "RemoveDeviceInfo"},
{12, nullptr, "IncreaseDeviceInfoOrder"},
{13, nullptr, "LlrNotify"},
{14, nullptr, "EnableRadio"},
{15, nullptr, "DisableRadio"},
{14, &BTM::EnableRadio, "EnableRadio"},
{15, &BTM::DisableRadio, "DisableRadio"},
{16, nullptr, "HidDisconnect"},
{17, nullptr, "HidSetRetransmissionMode"},
{18, nullptr, "AcquireAwakeReqEvent"},
@ -230,6 +230,17 @@ public:
RegisterHandlers(functions);
}
private:
void EnableRadio(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void DisableRadio(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
};
class BTM_DBG final : public ServiceFramework<BTM_DBG> {
@ -260,24 +271,25 @@ public:
class IBtmSystemCore final : public ServiceFramework<IBtmSystemCore> {
public:
explicit IBtmSystemCore(Core::System& system_) : ServiceFramework{system_, "IBtmSystemCore"} {
explicit IBtmSystemCore(Core::System& system_)
: ServiceFramework{system_, "IBtmSystemCore"}, service_context{system_, "IBtmSystemCore"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &IBtmSystemCore::StartGamepadPairing, "StartGamepadPairing"},
{1, &IBtmSystemCore::CancelGamepadPairing, "CancelGamepadPairing"},
{2, nullptr, "ClearGamepadPairingDatabase"},
{3, nullptr, "GetPairedGamepadCount"},
{4, nullptr, "EnableRadio"},
{5, nullptr, "DisableRadio"},
{4, &IBtmSystemCore::EnableRadio, "EnableRadio"},
{5, &IBtmSystemCore::DisableRadio, "DisableRadio"},
{6, &IBtmSystemCore::IsRadioEnabled, "IsRadioEnabled"},
{7, nullptr, "AcquireRadioEvent"},
{7, &IBtmSystemCore::AcquireRadioEvent, "AcquireRadioEvent"},
{8, nullptr, "AcquireGamepadPairingEvent"},
{9, nullptr, "IsGamepadPairingStarted"},
{10, nullptr, "StartAudioDeviceDiscovery"},
{11, nullptr, "StopAudioDeviceDiscovery"},
{12, nullptr, "IsDiscoveryingAudioDevice"},
{13, nullptr, "GetDiscoveredAudioDevice"},
{14, nullptr, "AcquireAudioDeviceConnectionEvent"},
{14, &IBtmSystemCore::AcquireAudioDeviceConnectionEvent, "AcquireAudioDeviceConnectionEvent"},
{15, nullptr, "ConnectAudioDevice"},
{16, nullptr, "IsConnectingAudioDevice"},
{17, &IBtmSystemCore::GetConnectedAudioDevices, "GetConnectedAudioDevices"},
@ -291,9 +303,22 @@ public:
// clang-format on
RegisterHandlers(functions);
radio_event = service_context.CreateEvent("IBtmSystemCore::RadioEvent");
audio_device_connection_event =
service_context.CreateEvent("IBtmSystemCore::AudioDeviceConnectionEvent");
}
private:
void EnableRadio(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void DisableRadio(HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IsRadioEnabled(HLERequestContext& ctx) {
LOG_DEBUG(Service_BTM, "(STUBBED) called"); // Spams a lot when controller applet is running
@ -339,6 +364,29 @@ private:
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void AcquireRadioEvent(HLERequestContext& ctx) {
LOG_ERROR(Service_BTM, "called");
radio_event->Signal();
IPC::ResponseBuilder rb{ctx, 3, 1};
rb.Push(ResultSuccess);
rb.Push(true);
rb.PushCopyObjects(radio_event->GetReadableEvent());
}
void AcquireAudioDeviceConnectionEvent(HLERequestContext& ctx) {
LOG_ERROR(Service_BTM, "called");
IPC::ResponseBuilder rb{ctx, 3, 1};
rb.Push(ResultSuccess);
rb.Push(true);
rb.PushCopyObjects(audio_device_connection_event->GetReadableEvent());
}
Kernel::KEvent* radio_event;
Kernel::KEvent* audio_device_connection_event;
KernelHelpers::ServiceContext service_context;
};
class BTM_SYS final : public ServiceFramework<BTM_SYS> {

View File

@ -16,7 +16,7 @@ IAlbumAccessorService::IAlbumAccessorService(Core::System& system_,
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetAlbumFileCount"},
{1, nullptr, "GetAlbumFileList"},
{1, C<&IAlbumAccessorService::GetAlbumFileList>, "GetAlbumFileList"},
{2, nullptr, "LoadAlbumFile"},
{3, C<&IAlbumAccessorService::DeleteAlbumFile>, "DeleteAlbumFile"},
{4, nullptr, "StorageCopyAlbumFile"},
@ -62,6 +62,15 @@ IAlbumAccessorService::IAlbumAccessorService(Core::System& system_,
IAlbumAccessorService::~IAlbumAccessorService() = default;
Result IAlbumAccessorService::GetAlbumFileList(
Out<u64> out_count, AlbumStorage storage,
OutArray<AlbumEntry, BufferAttr_HipcMapAlias> out_entries) {
LOG_INFO(Service_Capture, "called, storage={}", storage);
const Result result = manager->GetAlbumFileList(out_entries, *out_count, storage, 0);
R_RETURN(TranslateResult(result));
}
Result IAlbumAccessorService::DeleteAlbumFile(AlbumFileId file_id) {
LOG_INFO(Service_Capture, "called, application_id=0x{:0x}, storage={}, type={}",
file_id.application_id, file_id.storage, file_id.type);

View File

@ -21,6 +21,8 @@ public:
~IAlbumAccessorService() override;
private:
Result GetAlbumFileList(Out<u64> out_count, AlbumStorage storage,
OutArray<AlbumEntry, BufferAttr_HipcMapAlias> out_entries);
Result DeleteAlbumFile(AlbumFileId file_id);
Result IsAlbumMounted(Out<bool> out_is_mounted, AlbumStorage storage);

View File

@ -4,6 +4,7 @@
#include <memory>
#include "core/hle/service/erpt/erpt.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/service.h"
#include "core/hle/service/sm/sm.h"
@ -15,7 +16,7 @@ public:
explicit ErrorReportContext(Core::System& system_) : ServiceFramework{system_, "erpt:c"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "SubmitContext"},
{0, &ErrorReportContext::SubmitContext, "SubmitContext"},
{1, nullptr, "CreateReportV0"},
{2, nullptr, "SetInitialLaunchSettingsCompletionTime"},
{3, nullptr, "ClearInitialLaunchSettingsCompletionTime"},
@ -36,6 +37,14 @@ public:
RegisterHandlers(functions);
}
private:
void SubmitContext(HLERequestContext& ctx) {
LOG_WARNING(Service_SET, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
};
class ErrorReportSession final : public ServiceFramework<ErrorReportSession> {

View File

@ -42,13 +42,13 @@ public:
{10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"},
{10702, nullptr, "AddPlayHistory"},
{11000, nullptr, "GetProfileImageUrl"},
{20100, nullptr, "GetFriendCount"},
{20101, nullptr, "GetNewlyFriendCount"},
{20100, &IFriendService::GetFriendCount, "GetFriendCount"},
{20101, &IFriendService::GetNewlyFriendCount, "GetNewlyFriendCount"},
{20102, nullptr, "GetFriendDetailedInfo"},
{20103, nullptr, "SyncFriendList"},
{20104, nullptr, "RequestSyncFriendList"},
{20110, nullptr, "LoadFriendSetting"},
{20200, nullptr, "GetReceivedFriendRequestCount"},
{20200, &IFriendService::GetReceivedFriendRequestCount, "GetReceivedFriendRequestCount"},
{20201, nullptr, "GetFriendRequestList"},
{20300, nullptr, "GetFriendCandidateList"},
{20301, nullptr, "GetNintendoNetworkIdInfo"},
@ -61,14 +61,14 @@ public:
{20501, nullptr, "GetRelationship"},
{20600, nullptr, "GetUserPresenceView"},
{20700, nullptr, "GetPlayHistoryList"},
{20701, nullptr, "GetPlayHistoryStatistics"},
{20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"},
{20800, nullptr, "LoadUserSetting"},
{20801, nullptr, "SyncUserSetting"},
{20900, nullptr, "RequestListSummaryOverlayNotification"},
{21000, nullptr, "GetExternalApplicationCatalog"},
{22000, nullptr, "GetReceivedFriendInvitationList"},
{22001, nullptr, "GetReceivedFriendInvitationDetailedInfo"},
{22010, nullptr, "GetReceivedFriendInvitationCountCache"},
{22010, &IFriendService::GetReceivedFriendInvitationCountCache, "GetReceivedFriendInvitationCountCache"},
{30100, nullptr, "DropFriendNewlyFlags"},
{30101, nullptr, "DeleteFriend"},
{30110, nullptr, "DropFriendNewlyFlag"},
@ -179,6 +179,30 @@ private:
rb.Push(ResultSuccess);
}
void GetFriendCount(HLERequestContext& ctx) {
LOG_DEBUG(Service_Friend, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
void GetNewlyFriendCount(HLERequestContext& ctx) {
LOG_DEBUG(Service_Friend, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
void GetReceivedFriendRequestCount(HLERequestContext& ctx) {
LOG_DEBUG(Service_Friend, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
void GetFriendList(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto friend_offset = rp.Pop<u32>();
@ -217,6 +241,21 @@ private:
rb.Push(true);
}
void GetPlayHistoryStatistics(HLERequestContext& ctx) {
LOG_ERROR(Service_Friend, "(STUBBED) called, check in out");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void GetReceivedFriendInvitationCountCache(HLERequestContext& ctx) {
LOG_DEBUG(Service_Friend, "(STUBBED) called, check in out");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
KernelHelpers::ServiceContext service_context;
Kernel::KEvent* completion_event;

View File

@ -37,7 +37,12 @@ Result ARPManager::GetControlProperty(std::vector<u8>* out_control_property, u64
const auto iter = entries.find(title_id);
if (iter == entries.end()) {
return Glue::ResultProcessIdNotRegistered;
if (entries.empty()) {
return Glue::ResultProcessIdNotRegistered;
}
*out_control_property = entries.begin()->second.control;
return ResultSuccess;
}
*out_control_property = iter->second.control;

View File

@ -18,8 +18,8 @@ public:
explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "SaveCurrentSetting"},
{1, nullptr, "LoadCurrentSetting"},
{0, &LBL::SaveCurrentSetting, "SaveCurrentSetting"},
{1, &LBL::LoadCurrentSetting, "LoadCurrentSetting"},
{2, &LBL::SetCurrentBrightnessSetting, "SetCurrentBrightnessSetting"},
{3, &LBL::GetCurrentBrightnessSetting, "GetCurrentBrightnessSetting"},
{4, nullptr, "ApplyCurrentBrightnessSettingToBacklight"},
@ -47,7 +47,7 @@ public:
{26, &LBL::EnableVrMode, "EnableVrMode"},
{27, &LBL::DisableVrMode, "DisableVrMode"},
{28, &LBL::IsVrModeEnabled, "IsVrModeEnabled"},
{29, nullptr, "IsAutoBrightnessControlSupported"},
{29, &LBL::IsAutoBrightnessControlSupported, "IsAutoBrightnessControlSupported"},
};
// clang-format on
@ -60,6 +60,20 @@ private:
On = 1,
};
void SaveCurrentSetting(HLERequestContext& ctx) {
LOG_WARNING(Service_LBL, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void LoadCurrentSetting(HLERequestContext& ctx) {
LOG_WARNING(Service_LBL, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void SetCurrentBrightnessSetting(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
auto brightness = rp.Pop<float>();
@ -310,6 +324,14 @@ private:
rb.Push(vr_mode_enabled);
}
void IsAutoBrightnessControlSupported(HLERequestContext& ctx) {
LOG_DEBUG(Service_LBL, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u8>(auto_brightness_supported);
}
bool vr_mode_enabled = false;
float current_brightness = 1.0f;
float ambient_light_value = 0.0f;
@ -318,6 +340,7 @@ private:
bool backlight_enabled = true;
bool update_instantly = false;
bool auto_brightness = false; // TODO(ogniK): Move to system settings
bool auto_brightness_supported = true;
};
void LoopProcess(Core::System& system) {

View File

@ -39,7 +39,7 @@ public:
private:
void GetStateForMonitor(HLERequestContext& ctx) {
LOG_INFO(Service_LDN, "called");
LOG_DEBUG(Service_LDN, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
@ -784,7 +784,7 @@ private:
}
void GetGroupInfo(HLERequestContext& ctx) {
LOG_WARNING(Service_LDN, "(STUBBED) called");
LOG_DEBUG(Service_LDN, "(STUBBED) called");
struct GroupInfo {
std::array<u8, 0x200> info;

View File

@ -57,7 +57,7 @@ public:
{1, &NfcInterface::Finalize, "FinalizeOld"},
{2, &NfcInterface::GetState, "GetStateOld"},
{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"},
{100, nullptr, "SetNfcEnabledOld"},
{100, &NfcInterface::SetNfcEnabled, "SetNfcEnabledOld"},
{400, &NfcInterface::Initialize, "Initialize"},
{401, &NfcInterface::Finalize, "Finalize"},
{402, &NfcInterface::GetState, "GetState"},
@ -71,7 +71,7 @@ public:
{410, &NfcInterface::GetTagInfo, "GetTagInfo"},
{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"},
{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"},
{500, nullptr, "SetNfcEnabled"},
{500, &NfcInterface::SetNfcEnabled, "SetNfcEnabled"},
{510, nullptr, "OutputTestWave"},
{1000, &NfcInterface::ReadMifare, "ReadMifare"},
{1001, &NfcInterface::WriteMifare, "WriteMifare"},

View File

@ -65,12 +65,9 @@ void NfcInterface::GetState(HLERequestContext& ctx) {
void NfcInterface::IsNfcEnabled(HLERequestContext& ctx) {
LOG_DEBUG(Service_NFC, "called");
// TODO: This calls nn::settings::detail::GetNfcEnableFlag
const bool is_enabled = true;
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(is_enabled);
rb.Push(true);
}
void NfcInterface::ListDevices(HLERequestContext& ctx) {
@ -212,6 +209,15 @@ void NfcInterface::AttachDeactivateEvent(HLERequestContext& ctx) {
rb.PushCopyObjects(out_event);
}
void NfcInterface::SetNfcEnabled(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto is_enabled{rp.Pop<bool>()};
LOG_DEBUG(Service_NFC, "called, is_enabled={}", is_enabled);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void NfcInterface::ReadMifare(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto device_handle{rp.Pop<u64>()};

View File

@ -28,6 +28,7 @@ public:
void GetTagInfo(HLERequestContext& ctx);
void AttachActivateEvent(HLERequestContext& ctx);
void AttachDeactivateEvent(HLERequestContext& ctx);
void SetNfcEnabled(HLERequestContext& ctx);
void ReadMifare(HLERequestContext& ctx);
void WriteMifare(HLERequestContext& ctx);
void SendCommandByPassThrough(HLERequestContext& ctx);

View File

@ -419,6 +419,22 @@ void IGeneralService::GetCurrentNetworkProfile(HLERequestContext& ctx) {
rb.Push(ResultSuccess);
}
void IGeneralService::EnumerateNetworkInterfaces(HLERequestContext& ctx) {
LOG_ERROR(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
void IGeneralService::EnumerateNetworkProfiles(HLERequestContext& ctx) {
LOG_ERROR(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
void IGeneralService::RemoveNetworkProfile(HLERequestContext& ctx) {
LOG_WARNING(Service_NIFM, "(STUBBED) called");
@ -506,16 +522,27 @@ void IGeneralService::GetCurrentIpConfigInfo(HLERequestContext& ctx) {
rb.PushRaw<IpConfigInfo>(ip_config_info);
}
void IGeneralService::SetWirelessCommunicationEnabled(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto is_enabled{rp.Pop<bool>()};
LOG_DEBUG(Service_NIFM, "called, is_enabled={}", is_enabled);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) {
LOG_WARNING(Service_NIFM, "(STUBBED) called");
const auto is_enabled = false;
LOG_DEBUG(Service_NIFM, "called, is_enabled={}", is_enabled);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u8>(1);
rb.Push<u8>(is_enabled);
}
void IGeneralService::GetInternetConnectionStatus(HLERequestContext& ctx) {
LOG_WARNING(Service_NIFM, "(STUBBED) called");
LOG_DEBUG(Service_NIFM, "(STUBBED) called");
struct Output {
u8 type{static_cast<u8>(NetworkInterfaceType::WiFi_Ieee80211)};
@ -565,6 +592,21 @@ void IGeneralService::IsAnyForegroundRequestAccepted(HLERequestContext& ctx) {
rb.Push<u8>(is_accepted);
}
void IGeneralService::ConfirmSystemAvailability(HLERequestContext& ctx) {
LOG_ERROR(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(false);
}
void IGeneralService::GetCurrentAccessPoint(HLERequestContext& ctx) {
LOG_ERROR(Service_NIFM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
IGeneralService::IGeneralService(Core::System& system_)
: ServiceFramework{system_, "IGeneralService"}, network{system_.GetRoomNetwork()} {
// clang-format off
@ -573,8 +615,8 @@ IGeneralService::IGeneralService(Core::System& system_)
{2, &IGeneralService::CreateScanRequest, "CreateScanRequest"},
{4, &IGeneralService::CreateRequest, "CreateRequest"},
{5, &IGeneralService::GetCurrentNetworkProfile, "GetCurrentNetworkProfile"},
{6, nullptr, "EnumerateNetworkInterfaces"},
{7, nullptr, "EnumerateNetworkProfiles"},
{6, &IGeneralService::EnumerateNetworkInterfaces, "EnumerateNetworkInterfaces"},
{7, &IGeneralService::EnumerateNetworkProfiles, "EnumerateNetworkProfiles"},
{8, nullptr, "GetNetworkProfile"},
{9, nullptr, "SetNetworkProfile"},
{10, &IGeneralService::RemoveNetworkProfile, "RemoveNetworkProfile"},
@ -583,7 +625,7 @@ IGeneralService::IGeneralService(Core::System& system_)
{13, nullptr, "GetCurrentAccessPointOld"},
{14, &IGeneralService::CreateTemporaryNetworkProfile, "CreateTemporaryNetworkProfile"},
{15, &IGeneralService::GetCurrentIpConfigInfo, "GetCurrentIpConfigInfo"},
{16, nullptr, "SetWirelessCommunicationEnabled"},
{16, &IGeneralService::SetWirelessCommunicationEnabled, "SetWirelessCommunicationEnabled"},
{17, &IGeneralService::IsWirelessCommunicationEnabled, "IsWirelessCommunicationEnabled"},
{18, &IGeneralService::GetInternetConnectionStatus, "GetInternetConnectionStatus"},
{19, nullptr, "SetEthernetCommunicationEnabled"},
@ -600,10 +642,10 @@ IGeneralService::IGeneralService(Core::System& system_)
{30, nullptr, "SetEthernetCommunicationEnabledForTest"},
{31, nullptr, "GetTelemetorySystemEventReadableHandle"},
{32, nullptr, "GetTelemetryInfo"},
{33, nullptr, "ConfirmSystemAvailability"},
{33, &IGeneralService::ConfirmSystemAvailability, "ConfirmSystemAvailability"},
{34, nullptr, "SetBackgroundRequestEnabled"},
{35, nullptr, "GetScanData"},
{36, nullptr, "GetCurrentAccessPoint"},
{36, &IGeneralService::GetCurrentAccessPoint, "GetCurrentAccessPoint"},
{37, nullptr, "Shutdown"},
{38, nullptr, "GetAllowedChannels"},
{39, nullptr, "NotifyApplicationSuspended"},

View File

@ -27,15 +27,20 @@ private:
void CreateScanRequest(HLERequestContext& ctx);
void CreateRequest(HLERequestContext& ctx);
void GetCurrentNetworkProfile(HLERequestContext& ctx);
void EnumerateNetworkInterfaces(HLERequestContext& ctx);
void EnumerateNetworkProfiles(HLERequestContext& ctx);
void RemoveNetworkProfile(HLERequestContext& ctx);
void GetCurrentIpAddress(HLERequestContext& ctx);
void CreateTemporaryNetworkProfile(HLERequestContext& ctx);
void GetCurrentIpConfigInfo(HLERequestContext& ctx);
void SetWirelessCommunicationEnabled(HLERequestContext& ctx);
void IsWirelessCommunicationEnabled(HLERequestContext& ctx);
void GetInternetConnectionStatus(HLERequestContext& ctx);
void IsEthernetCommunicationEnabled(HLERequestContext& ctx);
void IsAnyInternetRequestAccepted(HLERequestContext& ctx);
void IsAnyForegroundRequestAccepted(HLERequestContext& ctx);
void ConfirmSystemAvailability(HLERequestContext& ctx);
void GetCurrentAccessPoint(HLERequestContext& ctx);
Network::RoomNetwork& network;
};

View File

@ -3,6 +3,9 @@
#include <memory>
#include "core/hle/kernel/k_event.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/npns/npns.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/service.h"
@ -11,14 +14,15 @@ namespace Service::NPNS {
class NPNS_S final : public ServiceFramework<NPNS_S> {
public:
explicit NPNS_S(Core::System& system_) : ServiceFramework{system_, "npns:s"} {
explicit NPNS_S(Core::System& system_)
: ServiceFramework{system_, "npns:s"}, service_context{system, "npns:s"} {
// clang-format off
static const FunctionInfo functions[] = {
{1, nullptr, "ListenAll"},
{2, nullptr, "ListenTo"},
{2, &NPNS_S::ListenTo, "ListenTo"},
{3, nullptr, "Receive"},
{4, nullptr, "ReceiveRaw"},
{5, nullptr, "GetReceiveEvent"},
{5, &NPNS_S::GetReceiveEvent, "GetReceiveEvent"},
{6, nullptr, "ListenUndelivered"},
{7, nullptr, "GetStateChangeEVent"},
{11, nullptr, "SubscribeTopic"},
@ -59,7 +63,30 @@ public:
// clang-format on
RegisterHandlers(functions);
get_recieve_event = service_context.CreateEvent("npns:s:GetReceiveEvent");
}
private:
void ListenTo(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto progam_id = rp.Pop<u64>();
LOG_WARNING(Service_AM, "(STUBBED) called, progam_id={}", progam_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void GetReceiveEvent(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(get_recieve_event->GetReadableEvent());
}
KernelHelpers::ServiceContext service_context;
Kernel::KEvent* get_recieve_event;
};
class NPNS_U final : public ServiceFramework<NPNS_U> {

View File

@ -5,12 +5,18 @@
#include "common/settings.h"
#include "core/arm/debug.h"
#include "core/core.h"
#include "core/file_sys/content_archive.h"
#include "core/file_sys/control_metadata.h"
#include "core/file_sys/fs_filesystem.h"
#include "core/file_sys/nca_metadata.h"
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/registered_cache.h"
#include "core/file_sys/submission_package.h"
#include "core/file_sys/vfs/vfs.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/glue/glue_manager.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/ns/errors.h"
#include "core/hle/service/ns/iplatform_service_manager.h"
#include "core/hle/service/ns/language.h"
@ -35,12 +41,13 @@ IAccountProxyInterface::IAccountProxyInterface(Core::System& system_)
IAccountProxyInterface::~IAccountProxyInterface() = default;
IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_)
: ServiceFramework{system_, "IApplicationManagerInterface"} {
: ServiceFramework{system_, "IApplicationManagerInterface"},
service_context{system_, "IApplicationManagerInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "ListApplicationRecord"},
{0, &IApplicationManagerInterface::ListApplicationRecord, "ListApplicationRecord"},
{1, nullptr, "GenerateApplicationRecordCount"},
{2, nullptr, "GetApplicationRecordUpdateSystemEvent"},
{2, &IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent, "GetApplicationRecordUpdateSystemEvent"},
{3, nullptr, "GetApplicationViewDeprecated"},
{4, nullptr, "DeleteApplicationEntity"},
{5, nullptr, "DeleteApplicationCompletely"},
@ -69,14 +76,14 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
{40, nullptr, "GetApplicationLogoData"},
{41, nullptr, "CalculateApplicationDownloadRequiredSize"},
{42, nullptr, "CleanupSdCard"},
{43, nullptr, "CheckSdCardMountStatus"},
{44, nullptr, "GetSdCardMountStatusChangedEvent"},
{43, &IApplicationManagerInterface::CheckSdCardMountStatus, "CheckSdCardMountStatus"},
{44, &IApplicationManagerInterface::GetSdCardMountStatusChangedEvent, "GetSdCardMountStatusChangedEvent"},
{45, nullptr, "GetGameCardAttachmentEvent"},
{46, nullptr, "GetGameCardAttachmentInfo"},
{47, nullptr, "GetTotalSpaceSize"},
{48, nullptr, "GetFreeSpaceSize"},
{48, &IApplicationManagerInterface::GetFreeSpaceSize, "GetFreeSpaceSize"},
{49, nullptr, "GetSdCardRemovedEvent"},
{52, nullptr, "GetGameCardUpdateDetectionEvent"},
{52, &IApplicationManagerInterface::GetGameCardUpdateDetectionEvent, "GetGameCardUpdateDetectionEvent"},
{53, nullptr, "DisableApplicationAutoDelete"},
{54, nullptr, "EnableApplicationAutoDelete"},
{55, &IApplicationManagerInterface::GetApplicationDesiredLanguage, "GetApplicationDesiredLanguage"},
@ -94,7 +101,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
{67, nullptr, "CancelApplicationApplyDelta"},
{68, nullptr, "ResumeApplicationApplyDelta"},
{69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"},
{70, nullptr, "ResumeAll"},
{70, &IApplicationManagerInterface::ResumeAll, "ResumeAll"},
{71, nullptr, "GetStorageSize"},
{80, nullptr, "RequestDownloadApplication"},
{81, nullptr, "RequestDownloadAddOnContent"},
@ -147,7 +154,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
{502, nullptr, "RequestCheckGameCardRegistration"},
{503, nullptr, "RequestGameCardRegistrationGoldPoint"},
{504, nullptr, "RequestRegisterGameCard"},
{505, nullptr, "GetGameCardMountFailureEvent"},
{505, &IApplicationManagerInterface::GetGameCardMountFailureEvent, "GetGameCardMountFailureEvent"},
{506, nullptr, "IsGameCardInserted"},
{507, nullptr, "EnsureGameCardAccess"},
{508, nullptr, "GetLastGameCardMountFailureResult"},
@ -196,7 +203,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
{1003, nullptr, "RequestVerifyApplication"},
{1004, nullptr, "CorruptContentForDebug"},
{1200, nullptr, "NeedsUpdateVulnerability"},
{1300, nullptr, "IsAnyApplicationEntityInstalled"},
{1300, &IApplicationManagerInterface::IsAnyApplicationEntityInstalled, "IsAnyApplicationEntityInstalled"},
{1301, nullptr, "DeleteApplicationContentEntities"},
{1302, nullptr, "CleanupUnrecordedApplicationEntity"},
{1303, nullptr, "CleanupAddOnContentsWithNoRights"},
@ -221,10 +228,10 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
{1600, nullptr, "GetSystemSeedForPseudoDeviceId"},
{1601, nullptr, "ResetSystemSeedForPseudoDeviceId"},
{1700, nullptr, "ListApplicationDownloadingContentMeta"},
{1701, nullptr, "GetApplicationView"},
{1701, &IApplicationManagerInterface::GetApplicationView, "GetApplicationView"},
{1702, nullptr, "GetApplicationDownloadTaskStatus"},
{1703, nullptr, "GetApplicationViewDownloadErrorContext"},
{1704, nullptr, "GetApplicationViewWithPromotionInfo"},
{1704, &IApplicationManagerInterface::GetApplicationViewWithPromotionInfo, "GetApplicationViewWithPromotionInfo"},
{1705, nullptr, "IsPatchAutoDeletableApplication"},
{1800, nullptr, "IsNotificationSetupCompleted"},
{1801, nullptr, "GetLastNotificationInfoCount"},
@ -253,7 +260,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
{2016, nullptr, "ListNotCommittedContentMeta"},
{2017, nullptr, "CreateDownloadTask"},
{2018, nullptr, "GetApplicationDeliveryInfoHash"},
{2050, nullptr, "GetApplicationRightsOnClient"},
{2050, &IApplicationManagerInterface::GetApplicationRightsOnClient, "GetApplicationRightsOnClient"},
{2051, nullptr, "InvalidateRightsIdCache"},
{2100, nullptr, "GetApplicationTerminateResult"},
{2101, nullptr, "GetRawApplicationTerminateResult"},
@ -327,19 +334,83 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
// clang-format on
RegisterHandlers(functions);
record_update_system_event =
service_context.CreateEvent("IApplicationManagerInterface::RecordUpdateSystemEvent");
gamecard_update_detection_event =
service_context.CreateEvent("IApplicationManagerInterface::GamecardUpdateDetectionEvent");
gamecard_mount_status_event =
service_context.CreateEvent("IApplicationManagerInterface::GamecardMountStatusEvent");
gamecard_mount_failure_event =
service_context.CreateEvent("IApplicationManagerInterface::GamecardMountFailureEvent");
}
IApplicationManagerInterface::~IApplicationManagerInterface() = default;
IApplicationManagerInterface::~IApplicationManagerInterface() {
service_context.CloseEvent(record_update_system_event);
service_context.CloseEvent(gamecard_update_detection_event);
service_context.CloseEvent(gamecard_mount_status_event);
service_context.CloseEvent(gamecard_mount_failure_event);
};
void IApplicationManagerInterface::ListApplicationRecord(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
auto offset = rp.Pop<s32>();
const auto limit = ctx.GetWriteBufferNumElements<ApplicationRecord>();
LOG_ERROR(Service_NS, "(STUBBED) called");
const auto& cache = system.GetContentProviderUnion();
const auto installed_games = cache.ListEntriesFilterOrigin(
std::nullopt, FileSys::TitleType::Application, FileSys::ContentRecordType::Program);
std::vector<ApplicationRecord> application_records;
u8 ii{24};
for (const auto& [slot, game] : installed_games) {
if (application_records.size() >= limit) {
break;
}
if (game.title_id == 0 || game.title_id < 0x0100000000001FFFull) {
continue;
}
if (offset > 0) {
offset--;
continue;
}
application_records.push_back(ApplicationRecord{
.application_id = game.title_id,
.type = ApplicationRecordType::Installed,
.unknown = 0, // 2 = needs update
.unknown2 = ii++,
});
}
if (!application_records.empty()) {
ctx.WriteBuffer(application_records);
}
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(static_cast<u32>(application_records.size()));
}
void IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent(HLERequestContext& ctx) {
LOG_ERROR(Service_NS, "(STUBBED) called");
record_update_system_event->Signal();
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(record_update_system_event->GetReadableEvent());
}
void IApplicationManagerInterface::GetApplicationControlData(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto flag = rp.PopRaw<u64>();
LOG_DEBUG(Service_NS, "called with flag={:016X}", flag);
const auto title_id = rp.PopRaw<u64>();
const auto size = ctx.GetWriteBufferSize();
LOG_ERROR(Service_NS, "called with flag={:016X}, title_id={:016X}", flag, title_id);
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()};
const auto control = pm.GetControlMetadata();
@ -390,6 +461,150 @@ void IApplicationManagerInterface::GetApplicationControlData(HLERequestContext&
rb.Push<u32>(static_cast<u32>(out.size()));
}
void IApplicationManagerInterface::GetGameCardMountFailureEvent(HLERequestContext& ctx) {
LOG_ERROR(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(gamecard_mount_failure_event->GetReadableEvent());
}
void IApplicationManagerInterface::IsAnyApplicationEntityInstalled(HLERequestContext& ctx) {
LOG_ERROR(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u8>(true);
}
void IApplicationManagerInterface::GetApplicationView(HLERequestContext& ctx) {
std::vector<u64> application_id(ctx.GetReadBufferNumElements<u64>());
const auto app_buffer = ctx.ReadBuffer();
memcpy(application_id.data(), app_buffer.data(), app_buffer.size());
std::vector<ApplicationView> app_view;
LOG_ERROR(Service_NS, "(STUBBED) called, size={}", application_id.size());
for (const u64& data : application_id) {
app_view.push_back(ApplicationView{
.application_id = data,
.unk = 0x70000,
.flags = 0x401f17,
.unk_x10 = {},
.unk_x20 = {},
.unk_x24 = {},
.unk_x26 = {},
.unk_x28 = {},
.unk_x30 = {},
.unk_x40 = {},
.unk_x44 = {},
.unk_x45 = {},
});
}
ctx.WriteBuffer(app_view);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IApplicationManagerInterface::GetApplicationViewWithPromotionInfo(HLERequestContext& ctx) {
std::vector<u64> application_id(ctx.GetReadBufferNumElements<u64>());
const auto app_buffer = ctx.ReadBuffer();
memcpy(application_id.data(), app_buffer.data(), app_buffer.size());
std::vector<ApplicationViewWithPromotionInfo> app_view;
LOG_ERROR(Service_NS, "(STUBBED) called, size={}", application_id.size());
for (const u64& data : application_id) {
app_view.push_back(ApplicationViewWithPromotionInfo{
.view{
.application_id = data,
.unk = 0x70000,
.flags = 0x401f17,
.unk_x10 = {},
.unk_x20 = {},
.unk_x24 = {},
.unk_x26 = {},
.unk_x28 = {},
.unk_x30 = {},
.unk_x40 = {},
.unk_x44 = {},
.unk_x45 = {},
},
.promotion = {},
});
}
ctx.WriteBuffer(app_view);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IApplicationManagerInterface::GetApplicationRightsOnClient(HLERequestContext& ctx) {
struct ApplicationRightsOnClient {
u64 application_id;
Common::UUID uid;
u8 flags;
u8 flags2;
INSERT_PADDING_BYTES(0x6);
};
IPC::RequestParser rp{ctx};
const auto flags = rp.Pop<u32>();
const auto application_id = rp.Pop<u64>();
const auto uid = rp.PopRaw<Common::UUID>();
LOG_ERROR(Service_NS, "(STUBBED) called, flags={}, application_id={:x}, uid={}", flags,
application_id, uid.FormattedString());
ApplicationRightsOnClient rights{
.application_id = application_id,
.uid = uid,
.flags = 0,
.flags2 = 0,
};
ctx.WriteBuffer(rights);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(1);
}
void IApplicationManagerInterface::CheckSdCardMountStatus(HLERequestContext& ctx) {
LOG_ERROR(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IApplicationManagerInterface::GetSdCardMountStatusChangedEvent(HLERequestContext& ctx) {
LOG_ERROR(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(gamecard_mount_status_event->GetReadableEvent());
}
void IApplicationManagerInterface::GetFreeSpaceSize(HLERequestContext& ctx) {
LOG_ERROR(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
rb.Push<u64>(1024UL * 1024UL * 1024UL);
}
void IApplicationManagerInterface::GetGameCardUpdateDetectionEvent(HLERequestContext& ctx) {
LOG_ERROR(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(gamecard_update_detection_event->GetReadableEvent());
}
void IApplicationManagerInterface::GetApplicationDesiredLanguage(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto supported_languages = rp.Pop<u32>();
@ -408,7 +623,7 @@ void IApplicationManagerInterface::GetApplicationDesiredLanguage(HLERequestConte
Result IApplicationManagerInterface::GetApplicationDesiredLanguage(u8* out_desired_language,
const u32 supported_languages) {
LOG_DEBUG(Service_NS, "called with supported_languages={:08X}", supported_languages);
LOG_ERROR(Service_NS, "called with supported_languages={:08X}", supported_languages);
// Get language code from settings
const auto language_code =
@ -460,6 +675,13 @@ void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
}
}
void IApplicationManagerInterface::ResumeAll(HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
Result IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
u64* out_language_code, u8 application_language) {
const auto language_code =
@ -502,8 +724,8 @@ IContentManagementInterface::IContentManagementInterface(Core::System& system_)
: ServiceFramework{system_, "IContentManagementInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{11, nullptr, "CalculateApplicationOccupiedSize"},
{43, nullptr, "CheckSdCardMountStatus"},
{11, &IContentManagementInterface::CalculateApplicationOccupiedSize, "CalculateApplicationOccupiedSize"},
{43, &IContentManagementInterface::CheckSdCardMountStatus, "CheckSdCardMountStatus"},
{47, &IContentManagementInterface::GetTotalSpaceSize, "GetTotalSpaceSize"},
{48, &IContentManagementInterface::GetFreeSpaceSize, "GetFreeSpaceSize"},
{600, nullptr, "CountApplicationContentMeta"},
@ -518,6 +740,44 @@ IContentManagementInterface::IContentManagementInterface(Core::System& system_)
IContentManagementInterface::~IContentManagementInterface() = default;
void IContentManagementInterface::CalculateApplicationOccupiedSize(HLERequestContext& ctx) {
struct ApplicationOccupiedSizeEntity {
u8 storage;
INSERT_PADDING_BYTES(0x7);
u64 app_size;
u64 patch_size;
u64 aoc_size;
};
struct ApplicationOccupiedSize {
ApplicationOccupiedSizeEntity a;
ApplicationOccupiedSizeEntity b;
ApplicationOccupiedSizeEntity c;
ApplicationOccupiedSizeEntity d;
};
ApplicationOccupiedSizeEntity dat{
.storage = 5,
.app_size = 8ULL * 1024ULL * 1024ULL * 1024ULL,
.patch_size = 2ULL * 1024ULL * 1024ULL * 1024ULL,
.aoc_size = 12ULL * 1024ULL * 1024ULL,
};
ApplicationOccupiedSize oout{dat, dat, dat, dat};
LOG_ERROR(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 34};
rb.Push(ResultSuccess);
rb.PushRaw(oout);
}
void IContentManagementInterface::CheckSdCardMountStatus(HLERequestContext& ctx) {
LOG_ERROR(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IContentManagementInterface::GetTotalSpaceSize(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto storage{rp.PopEnum<FileSys::StorageId>()};
@ -540,6 +800,42 @@ void IContentManagementInterface::GetFreeSpaceSize(HLERequestContext& ctx) {
rb.Push<u64>(system.GetFileSystemController().GetFreeSpaceSize(storage));
}
DynamicRightsInterface::DynamicRightsInterface(Core::System& system_)
: ServiceFramework{system_, "DynamicRightsInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "RequestApplicationRightsOnServer"},
{1, nullptr, "RequestAssignRights"},
{4, nullptr, "DeprecatedRequestAssignRightsToResume"},
{5, nullptr, "VerifyActivatedRightsOwners"},
{6, nullptr, "DeprecatedGetApplicationRightsStatus"},
{7, nullptr, "RequestPrefetchForDynamicRights"},
{8, nullptr, "GetDynamicRightsState"},
{9, nullptr, "RequestApplicationRightsOnServerToResume"},
{10, nullptr, "RequestAssignRightsToResume"},
{11, nullptr, "GetActivatedRightsUsers"},
{12, nullptr, "GetApplicationRightsStatus"},
{13, nullptr, "GetRunningApplicationStatus"},
{14, nullptr, "SelectApplicationLicense"},
{15, nullptr, "RequestContentsAuthorizationToken"},
{16, nullptr, "QualifyUser"},
{17, nullptr, "QualifyUserWithProcessId"},
{18, nullptr, "NotifyApplicationRightsCheckStart"},
{19, nullptr, "UpdateUserList"},
{20, nullptr, "IsRightsLostUser"},
{21, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"},
{22, nullptr, "GetLimitedApplicationLicense"},
{23, nullptr, "GetLimitedApplicationLicenseUpgradableEvent"},
{24, nullptr, "NotifyLimitedApplicationLicenseUpgradableEventForDebug"},
{25, nullptr, "RequestProceedDynamicRightsState"},
};
// clang-format on
RegisterHandlers(functions);
}
DynamicRightsInterface::~DynamicRightsInterface() = default;
IDocumentInterface::IDocumentInterface(Core::System& system_)
: ServiceFramework{system_, "IDocumentInterface"} {
// clang-format off
@ -591,8 +887,8 @@ IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_)
{704, nullptr, "ListDownloadTaskStatus"},
{705, nullptr, "RequestDownloadTaskListData"},
{706, nullptr, "TryCommitCurrentApplicationDownloadTask"},
{707, nullptr, "EnableAutoCommit"},
{708, nullptr, "DisableAutoCommit"},
{707, &IDownloadTaskInterface::EnableAutoCommit, "EnableAutoCommit"},
{708, &IDownloadTaskInterface::DisableAutoCommit, "DisableAutoCommit"},
{709, nullptr, "TriggerDynamicCommitEvent"},
};
// clang-format on
@ -602,6 +898,17 @@ IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_)
IDownloadTaskInterface::~IDownloadTaskInterface() = default;
void IDownloadTaskInterface::EnableAutoCommit(HLERequestContext& ctx) {
LOG_ERROR(Service_SET, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IDownloadTaskInterface::DisableAutoCommit(HLERequestContext& ctx) {
LOG_ERROR(Service_SET, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
IECommerceInterface::IECommerceInterface(Core::System& system_)
: ServiceFramework{system_, "IECommerceInterface"} {
// clang-format off
@ -680,7 +987,7 @@ IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterfa
// clang-format off
static const FunctionInfo functions[] = {
{0, &IReadOnlyApplicationControlDataInterface::GetApplicationControlData, "GetApplicationControlData"},
{1, nullptr, "GetApplicationDesiredLanguage"},
{1, &IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage, "GetApplicationDesiredLanguage"},
{2, nullptr, "ConvertApplicationLanguageToLanguageCode"},
{3, nullptr, "ConvertLanguageCodeToApplicationLanguage"},
{4, nullptr, "SelectApplicationDesiredLanguage"},
@ -693,36 +1000,121 @@ IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterfa
IReadOnlyApplicationControlDataInterface::~IReadOnlyApplicationControlDataInterface() = default;
void IReadOnlyApplicationControlDataInterface::GetApplicationControlData(HLERequestContext& ctx) {
enum class ApplicationControlSource : u8 {
CacheOnly,
Storage,
StorageOnly,
};
struct RequestParameters {
ApplicationControlSource source;
u64 application_id;
};
static_assert(sizeof(RequestParameters) == 0x10, "RequestParameters has incorrect size.");
IPC::RequestParser rp{ctx};
std::vector<u8> nacp_data{};
const auto parameters{rp.PopRaw<RequestParameters>()};
const auto result =
system.GetARPManager().GetControlProperty(&nacp_data, parameters.application_id);
const auto flag = rp.PopRaw<u64>();
const auto title_id = rp.PopRaw<u64>();
const auto size = ctx.GetWriteBufferSize();
if (result == ResultSuccess) {
ctx.WriteBuffer(nacp_data.data(), nacp_data.size());
LOG_ERROR(Service_NS, "called with flag={:016X}, title_id={:016X}", flag, title_id);
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()};
const auto control = pm.GetControlMetadata();
std::vector<u8> out;
if (control.first != nullptr) {
if (size < 0x4000) {
LOG_ERROR(Service_NS,
"output buffer is too small! (actual={:016X}, expected_min=0x4000)", size);
IPC::ResponseBuilder rb{ctx, 2};
// TODO(DarkLordZach): Find a better error code for this.
rb.Push(ResultUnknown);
return;
}
out.resize(0x4000);
const auto bytes = control.first->GetRawBytes();
std::memcpy(out.data(), bytes.data(), bytes.size());
} else {
LOG_WARNING(Service_NS, "missing NACP data for title_id={:016X}, defaulting to zeros.",
title_id);
out.resize(std::min<u64>(0x4000, size));
}
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(result);
if (control.second != nullptr) {
if (size < 0x4000 + control.second->GetSize()) {
LOG_ERROR(Service_NS,
"output buffer is too small! (actual={:016X}, expected_min={:016X})", size,
0x4000 + control.second->GetSize());
IPC::ResponseBuilder rb{ctx, 2};
// TODO(DarkLordZach): Find a better error code for this.
rb.Push(ResultUnknown);
return;
}
out.resize(0x4000 + control.second->GetSize());
control.second->Read(out.data() + 0x4000, control.second->GetSize());
} else {
LOG_WARNING(Service_NS, "missing icon data for title_id={:016X}, defaulting to zeros.",
title_id);
}
ctx.WriteBuffer(out);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u32>(static_cast<u32>(out.size()));
}
void IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage(
HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto supported_languages = rp.Pop<u32>();
u8 desired_language{};
const auto res = GetApplicationDesiredLanguage(&desired_language, supported_languages);
if (res == ResultSuccess) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u32>(desired_language);
} else {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(res);
}
}
Result IReadOnlyApplicationControlDataInterface::GetApplicationDesiredLanguage(
u8* out_desired_language, const u32 supported_languages) {
LOG_ERROR(Service_NS, "called with supported_languages={:08X}", supported_languages);
// Get language code from settings
const auto language_code =
Set::GetLanguageCodeFromIndex(static_cast<s32>(Settings::values.language_index.GetValue()));
// Convert to application language, get priority list
const auto application_language = ConvertToApplicationLanguage(language_code);
if (application_language == std::nullopt) {
LOG_ERROR(Service_NS, "Could not convert application language! language_code={}",
language_code);
return Service::NS::ResultApplicationLanguageNotFound;
}
const auto priority_list = GetApplicationLanguagePriorityList(*application_language);
if (!priority_list) {
LOG_ERROR(Service_NS,
"Could not find application language priorities! application_language={}",
*application_language);
return Service::NS::ResultApplicationLanguageNotFound;
}
// Try to find a valid language.
for (const auto lang : *priority_list) {
const auto supported_flag = GetSupportedLanguageFlag(lang);
if (supported_languages == 0 || (supported_languages & supported_flag) == supported_flag) {
*out_desired_language = static_cast<u8>(lang);
return ResultSuccess;
}
}
LOG_ERROR(Service_NS, "Could not find a valid language! supported_languages={:08X}",
supported_languages);
return Service::NS::ResultApplicationLanguageNotFound;
}
NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} {
// clang-format off
static const FunctionInfo functions[] = {
{7988, nullptr, "GetDynamicRightsInterface"},
{7988, &NS::PushInterface<DynamicRightsInterface>, "GetDynamicRightsInterface"},
{7989, &NS::PushInterface<IReadOnlyApplicationControlDataInterface>, "GetReadOnlyApplicationControlDataInterface"},
{7991, &NS::PushInterface<IReadOnlyApplicationRecordInterface>, "GetReadOnlyApplicationRecordInterface"},
{7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"},
@ -814,17 +1206,18 @@ public:
class NS_SU final : public ServiceFramework<NS_SU> {
public:
explicit NS_SU(Core::System& system_) : ServiceFramework{system_, "ns:su"} {
explicit NS_SU(Core::System& system_)
: ServiceFramework{system_, "ns:su"}, service_context{system_, "ns:su"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetBackgroundNetworkUpdateState"},
{0, &NS_SU::GetBackgroundNetworkUpdateState, "GetBackgroundNetworkUpdateState"},
{1, &NS_SU::OpenSystemUpdateControl, "OpenSystemUpdateControl"},
{2, nullptr, "NotifyExFatDriverRequired"},
{3, nullptr, "ClearExFatDriverStatusForDebug"},
{4, nullptr, "RequestBackgroundNetworkUpdate"},
{5, nullptr, "NotifyBackgroundNetworkUpdate"},
{6, nullptr, "NotifyExFatDriverDownloadedForDebug"},
{9, nullptr, "GetSystemUpdateNotificationEventForContentDelivery"},
{9, &NS_SU::GetSystemUpdateNotificationEventForContentDelivery, "GetSystemUpdateNotificationEventForContentDelivery"},
{10, nullptr, "NotifySystemUpdateForContentDelivery"},
{11, nullptr, "PrepareShutdown"},
{12, nullptr, "Unknown12"},
@ -838,16 +1231,43 @@ public:
// clang-format on
RegisterHandlers(functions);
update_notification_event = service_context.CreateEvent("NS_SU::UpdateNotificationEvent");
}
private:
Kernel::KEvent* update_notification_event;
KernelHelpers::ServiceContext service_context;
enum class BackgroundNetworkUpdateState {
None,
InProgress,
Ready,
};
void GetBackgroundNetworkUpdateState(HLERequestContext& ctx) {
LOG_ERROR(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.PushEnum(BackgroundNetworkUpdateState::None);
}
void OpenSystemUpdateControl(HLERequestContext& ctx) {
LOG_DEBUG(Service_NS, "called");
LOG_ERROR(Service_NS, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<ISystemUpdateControl>(system);
}
void GetSystemUpdateNotificationEventForContentDelivery(HLERequestContext& ctx) {
LOG_ERROR(Service_AM, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(ResultSuccess);
rb.PushCopyObjects(update_notification_event->GetReadableEvent());
}
};
class NS_VM final : public ServiceFramework<NS_VM> {
@ -874,6 +1294,50 @@ private:
}
};
class Sender final : public ServiceFramework<Sender> {
public:
explicit Sender(Core::System& system_) : ServiceFramework{system_, "ISender"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &Sender::Send, "Send"},
{1, nullptr, "GetUnreceivedMessageCount"},
};
// clang-format on
RegisterHandlers(functions);
}
private:
void Send(HLERequestContext& ctx) {
LOG_WARNING(Service_NS, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
};
class ISenderService final : public ServiceFramework<ISenderService> {
public:
explicit ISenderService(Core::System& system_) : ServiceFramework{system_, "ovln:snd"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &ISenderService::OpenSender, "OpenSender"},
};
// clang-format on
RegisterHandlers(functions);
}
private:
void OpenSender(HLERequestContext& ctx) {
LOG_INFO(Service_NS, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<Sender>(system);
}
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
@ -893,6 +1357,9 @@ void LoopProcess(Core::System& system) {
std::make_shared<IPlatformServiceManager>(system, "pl:s"));
server_manager->RegisterNamedService("pl:u",
std::make_shared<IPlatformServiceManager>(system, "pl:u"));
server_manager->RegisterNamedService("ovln:snd", std::make_shared<ISenderService>(system));
ServerManager::RunServer(std::move(server_manager));
}

View File

@ -3,6 +3,7 @@
#pragma once
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/service.h"
namespace Core {
@ -33,9 +34,79 @@ public:
u8 application_language);
private:
enum class ApplicationRecordType : u8 {
Installing = 2,
Installed = 3,
GameCardNotInserted = 5,
Archived = 0xB,
GameCard = 0x10,
};
struct ApplicationRecord {
u64 application_id;
ApplicationRecordType type;
u8 unknown;
INSERT_PADDING_BYTES(0x6);
u8 unknown2;
INSERT_PADDING_BYTES(0x7);
};
static_assert(sizeof(ApplicationRecord) == 0x18, "ApplicationRecord is an invalid size");
/// ApplicationView
struct ApplicationView {
u64 application_id; ///< ApplicationId.
u32 unk; ///< Unknown.
u32 flags; ///< Flags.
u8 unk_x10[0x10]; ///< Unknown.
u32 unk_x20; ///< Unknown.
u16 unk_x24; ///< Unknown.
u8 unk_x26[0x2]; ///< Unknown.
u8 unk_x28[0x8]; ///< Unknown.
u8 unk_x30[0x10]; ///< Unknown.
u32 unk_x40; ///< Unknown.
u8 unk_x44; ///< Unknown.
u8 unk_x45[0xb]; ///< Unknown.
};
/// NsPromotionInfo
struct PromotionInfo {
u64 start_timestamp; ///< POSIX timestamp for the promotion start.
u64 end_timestamp; ///< POSIX timestamp for the promotion end.
s64 remaining_time; ///< Remaining time until the promotion ends, in nanoseconds
///< ({end_timestamp - current_time} converted to nanoseconds).
INSERT_PADDING_BYTES(0x4);
u8 flags; ///< Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear:
///< remaining_time is set.
INSERT_PADDING_BYTES(0x3);
};
/// NsApplicationViewWithPromotionInfo
struct ApplicationViewWithPromotionInfo {
ApplicationView view; ///< \ref NsApplicationView
PromotionInfo promotion; ///< \ref NsPromotionInfo
};
void ListApplicationRecord(HLERequestContext& ctx);
void GetApplicationRecordUpdateSystemEvent(HLERequestContext& ctx);
void GetApplicationControlData(HLERequestContext& ctx);
void GetGameCardMountFailureEvent(HLERequestContext& ctx);
void IsAnyApplicationEntityInstalled(HLERequestContext& ctx);
void GetApplicationView(HLERequestContext& ctx);
void GetApplicationViewWithPromotionInfo(HLERequestContext& ctx);
void GetApplicationRightsOnClient(HLERequestContext& ctx);
void CheckSdCardMountStatus(HLERequestContext& ctx);
void GetSdCardMountStatusChangedEvent(HLERequestContext& ctx);
void GetFreeSpaceSize(HLERequestContext& ctx);
void GetGameCardUpdateDetectionEvent(HLERequestContext& ctx);
void GetApplicationDesiredLanguage(HLERequestContext& ctx);
void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx);
void ResumeAll(HLERequestContext& ctx);
Kernel::KEvent* record_update_system_event;
Kernel::KEvent* gamecard_update_detection_event;
Kernel::KEvent* gamecard_mount_status_event;
Kernel::KEvent* gamecard_mount_failure_event;
KernelHelpers::ServiceContext service_context;
};
class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> {
@ -50,6 +121,8 @@ public:
~IContentManagementInterface() override;
private:
void CalculateApplicationOccupiedSize(HLERequestContext& ctx);
void CheckSdCardMountStatus(HLERequestContext& ctx);
void GetTotalSpaceSize(HLERequestContext& ctx);
void GetFreeSpaceSize(HLERequestContext& ctx);
};
@ -64,10 +137,20 @@ private:
void GetRunningApplicationProgramId(HLERequestContext& ctx);
};
class DynamicRightsInterface final : public ServiceFramework<DynamicRightsInterface> {
public:
explicit DynamicRightsInterface(Core::System& system_);
~DynamicRightsInterface() override;
};
class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> {
public:
explicit IDownloadTaskInterface(Core::System& system_);
~IDownloadTaskInterface() override;
private:
void EnableAutoCommit(HLERequestContext& ctx);
void DisableAutoCommit(HLERequestContext& ctx);
};
class IECommerceInterface final : public ServiceFramework<IECommerceInterface> {
@ -101,6 +184,8 @@ public:
private:
void GetApplicationControlData(HLERequestContext& ctx);
void GetApplicationDesiredLanguage(HLERequestContext& ctx);
Result GetApplicationDesiredLanguage(u8* out_desired_language, u32 supported_languages);
};
class NS final : public ServiceFramework<NS> {

View File

@ -79,12 +79,20 @@ public:
: ServiceFramework{system_, "INativeHandleHolder"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetNativeHandle"},
{0, &INativeHandleHolder::GetNativeHandle, "GetNativeHandle"},
};
// clang-format on
RegisterHandlers(functions);
}
void GetNativeHandle(HLERequestContext& ctx) {
LOG_ERROR(Service_OLSC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
};
class ITransferTaskListController final : public ServiceFramework<ITransferTaskListController> {
@ -135,6 +143,34 @@ private:
}
};
class IDaemonController final : public ServiceFramework<IDaemonController> {
public:
explicit IDaemonController(Core::System& system_)
: ServiceFramework{system_, "IDaemonController"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "Unknown0"},
{1, nullptr, "Unknown1"},
{2, nullptr, "Unknown2"},
{3, nullptr, "Unknown3"},
{4, nullptr, "Unknown4"},
{5, nullptr, "Unknown5"},
{6, nullptr, "Unknown6"},
{7, nullptr, "Unknown7"},
{8, nullptr, "Unknown8"},
{9, nullptr, "Unknown9"},
{10, nullptr, "Unknown10"},
{11, nullptr, "Unknown11"},
{12, nullptr, "Unknown12"},
};
// clang-format on
RegisterHandlers(functions);
}
private:
};
class IOlscServiceForSystemService final : public ServiceFramework<IOlscServiceForSystemService> {
public:
explicit IOlscServiceForSystemService(Core::System& system_)
@ -143,7 +179,7 @@ public:
static const FunctionInfo functions[] = {
{0, &IOlscServiceForSystemService::OpenTransferTaskListController, "OpenTransferTaskListController"},
{1, nullptr, "OpenRemoteStorageController"},
{2, nullptr, "OpenDaemonController"},
{2, &IOlscServiceForSystemService::OpenDaemonController, "OpenDaemonController"},
{10, nullptr, "Unknown10"},
{11, nullptr, "Unknown11"},
{12, nullptr, "Unknown12"},
@ -198,6 +234,7 @@ public:
{1122, nullptr, "RepairIssue2"},
{1123, nullptr, "RepairIssue3"},
{1124, nullptr, "Unknown1124"},
{10000, &IOlscServiceForSystemService::Unknown10000, "Unknown10000"},
};
// clang-format on
@ -212,6 +249,22 @@ private:
rb.Push(ResultSuccess);
rb.PushIpcInterface<ITransferTaskListController>(system);
}
void OpenDaemonController(HLERequestContext& ctx) {
LOG_INFO(Service_OLSC, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<IDaemonController>(system);
}
void Unknown10000(HLERequestContext& ctx) {
LOG_INFO(Service_OLSC, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<IOlscServiceForSystemService>(system);
}
};
void LoopProcess(Core::System& system) {

View File

@ -39,7 +39,7 @@ public:
{1007, nullptr, "RevertRestrictionTemporaryUnlocked"},
{1008, nullptr, "EnterRestrictedSystemSettings"},
{1009, nullptr, "LeaveRestrictedSystemSettings"},
{1010, nullptr, "IsRestrictedSystemSettingsEntered"},
{1010, &IParentalControlService::IsRestrictedSystemSettingsEntered, "IsRestrictedSystemSettingsEntered"},
{1011, nullptr, "RevertRestrictedSystemSettingsEntered"},
{1012, nullptr, "GetRestrictedFeatures"},
{1013, &IParentalControlService::ConfirmStereoVisionPermission, "ConfirmStereoVisionPermission"},
@ -75,7 +75,7 @@ public:
{1203, nullptr, "SetPinCode"},
{1204, nullptr, "GenerateInquiryCode"},
{1205, nullptr, "CheckMasterKey"},
{1206, nullptr, "GetPinCodeLength"},
{1206, &IParentalControlService::GetPinCodeLength, "GetPinCodeLength"},
{1207, nullptr, "GetPinCodeChangedEvent"},
{1208, nullptr, "GetPinCode"},
{1403, &IParentalControlService::IsPairingActive, "IsPairingActive"},
@ -87,11 +87,11 @@ public:
{1426, nullptr, "GetPostEventInterval"},
{1427, nullptr, "SetPostEventInterval"},
{1432, &IParentalControlService::GetSynchronizationEvent, "GetSynchronizationEvent"},
{1451, nullptr, "StartPlayTimer"},
{1452, nullptr, "StopPlayTimer"},
{1453, nullptr, "IsPlayTimerEnabled"},
{1451, &IParentalControlService::StartPlayTimer, "StartPlayTimer"},
{1452, &IParentalControlService::StopPlayTimer, "StopPlayTimer"},
{1453, &IParentalControlService::IsPlayTimerEnabled, "IsPlayTimerEnabled"},
{1454, nullptr, "GetPlayTimerRemainingTime"},
{1455, nullptr, "IsRestrictedByPlayTimer"},
{1455, &IParentalControlService::IsRestrictedByPlayTimer, "IsRestrictedByPlayTimer"},
{1456, &IParentalControlService::GetPlayTimerSettings, "GetPlayTimerSettings"},
{1457, &IParentalControlService::GetPlayTimerEventToRequestSuspension, "GetPlayTimerEventToRequestSuspension"},
{1458, &IParentalControlService::IsPlayTimerAlarmDisabled, "IsPlayTimerAlarmDisabled"},
@ -259,6 +259,16 @@ private:
rb.Push(ResultSuccess);
rb.Push<u8>(is_temporary_unlocked);
}
void IsRestrictedSystemSettingsEntered(HLERequestContext& ctx) {
const bool is_temporary_unlocked = false;
LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}",
is_temporary_unlocked);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u8>(is_temporary_unlocked);
}
void ConfirmStereoVisionPermission(HLERequestContext& ctx) {
LOG_DEBUG(Service_PCTL, "called");
@ -360,6 +370,16 @@ private:
}
}
void GetPinCodeLength(HLERequestContext& ctx) {
const bool is_pairing_active = false;
LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", is_pairing_active);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
void IsPairingActive(HLERequestContext& ctx) {
const bool is_pairing_active = false;
@ -378,6 +398,39 @@ private:
rb.PushCopyObjects(synchronization_event->GetReadableEvent());
}
void StartPlayTimer(HLERequestContext& ctx) {
LOG_WARNING(Service_PCTL, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void StopPlayTimer(HLERequestContext& ctx) {
LOG_WARNING(Service_PCTL, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IsPlayTimerEnabled(HLERequestContext& ctx) {
LOG_WARNING(Service_PCTL, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
void IsRestrictedByPlayTimer(HLERequestContext& ctx) {
const bool is_temporary_unlocked = false;
LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}",
is_temporary_unlocked);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push<u8>(is_temporary_unlocked);
}
void GetPlayTimerSettings(HLERequestContext& ctx) {
LOG_WARNING(Service_PCTL, "(STUBBED) called");

View File

@ -75,11 +75,51 @@ private:
}
};
class IReceiver final : public ServiceFramework<IReceiver> {
public:
explicit IReceiver(Core::System& system_) : ServiceFramework{system_, "IReceiver"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "AddSource"},
{1, nullptr, "RemoveSource"},
{2, nullptr, "GetReceiveEventHandle"},
{3, nullptr, "Receive"},
{4, nullptr, "ReceiveWithTick"},
};
// clang-format on
RegisterHandlers(functions);
}
};
class OvlnRcv final : public ServiceFramework<OvlnRcv> {
public:
explicit OvlnRcv(Core::System& system_) : ServiceFramework{system_, "ovln:rcv"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &OvlnRcv::OpenReceiver, "OpenReceiver"},
};
// clang-format on
RegisterHandlers(functions);
}
private:
void OpenReceiver(HLERequestContext& ctx) {
LOG_DEBUG(Service_PSC, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<IReceiver>(system);
}
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("psc:c", std::make_shared<IPmControl>(system));
server_manager->RegisterNamedService("psc:m", std::make_shared<IPmService>(system));
server_manager->RegisterNamedService("ovln:rcv", std::make_shared<OvlnRcv>(system));
auto time = std::make_shared<Time::TimeManager>(system);

View File

@ -158,9 +158,11 @@ void ISettingsServer::GetKeyCodeMap2(HLERequestContext& ctx) {
void ISettingsServer::GetDeviceNickName(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
ctx.WriteBuffer(Settings::values.device_name.GetValue());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
ctx.WriteBuffer(Settings::values.device_name.GetValue());
}
} // namespace Service::Set

View File

@ -305,6 +305,21 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
RegisterHandlers(functions);
SetupSettings();
PSC::Time::SteadyClockTimePoint timestamp{
.time_point = 1691079299,
.clock_source_id = Common::UUID::MakeRandom(),
};
EulaVersion eula_version{
.version = 65536,
.region_code = SystemRegionCode::Usa,
.clock_type = EulaVersionClockType::SteadyClock,
.posix_time = 4575657222473777152,
.timestamp = timestamp,
};
m_system_settings.eula_versions[0] = eula_version;
m_system_settings.eula_version_count = 1;
m_save_thread =
std::jthread([this](std::stop_token stop_token) { StoreSettingsThreadFunc(stop_token); });
}

View File

@ -154,7 +154,7 @@ public:
{2400, nullptr, "OpenIndirectLayer"},
{2401, nullptr, "CloseIndirectLayer"},
{2402, nullptr, "FlipIndirectLayer"},
{3000, nullptr, "ListDisplayModes"},
{3000, &ISystemDisplayService::ListDisplayModes, "ListDisplayModes"},
{3001, nullptr, "ListDisplayRgbRanges"},
{3002, nullptr, "ListDisplayContentTypes"},
{3200, &ISystemDisplayService::GetDisplayMode, "GetDisplayMode"},
@ -321,6 +321,18 @@ private:
rb.Push(ResultSuccess);
}
void ListDisplayModes(HLERequestContext& ctx) {
LOG_WARNING(Service_VI, "(STUBBED) called");
std::vector<DisplayInfo> display_modes(1);
ctx.WriteBuffer(display_modes);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(1);
}
void GetDisplayMode(HLERequestContext& ctx) {
LOG_WARNING(Service_VI, "(STUBBED) called");

View File

@ -22,6 +22,7 @@
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/registered_cache.h"
#include "core/file_sys/submission_package.h"
#include "core/hle/service/glue/glue_manager.h"
#include "core/loader/loader.h"
#include "yuzu/compatibility_list.h"
#include "yuzu/game_list.h"
@ -326,6 +327,21 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
const auto control = cache.GetEntry(game.title_id, ContentRecordType::Control);
if (control != nullptr) {
GetMetadataFromControlNCA(patch, *control, icon, name);
std::vector<u8> nacp_data;
FileSys::NACP nacp;
if (loader->ReadControlData(nacp) == Loader::ResultStatus::Success) {
nacp_data = nacp.GetRawBytes();
} else {
nacp_data.resize(sizeof(FileSys::RawNACP));
}
Service::Glue::ApplicationLaunchProperty launch{};
launch.title_id = program_id;
launch.version = patch.GetGameVersion().value_or(0);
launch.base_game_storage_id = FileSys::StorageId::NandUser;
launch.update_storage_id = FileSys::StorageId::NandSystem;
system.GetARPManager().Register(launch.title_id, launch, std::move(nacp_data));
}
auto entry = MakeGameListEntry(file->GetFullPath(), name, file->GetSize(), icon, *loader,

View File

@ -1593,6 +1593,7 @@ void GMainWindow::ConnectMenuEvents() {
[this]() { OnCabinet(Service::NFP::CabinetMode::StartRestorer); });
connect_menu(ui->action_Load_Cabinet_Formatter,
[this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); });
connect_menu(ui->action_Load_QLaunch, &GMainWindow::OnQlaunch);
connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit);
connect_menu(ui->action_Open_Controller_Menu, &GMainWindow::OnOpenControllerMenu);
connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot);
@ -1628,6 +1629,7 @@ void GMainWindow::UpdateMenuState() {
ui->action_Load_Cabinet_Restorer,
ui->action_Load_Cabinet_Formatter,
ui->action_Load_Mii_Edit,
ui->action_Load_QLaunch,
ui->action_Open_Controller_Menu};
for (QAction* action : running_actions) {
@ -4218,6 +4220,29 @@ void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) {
BootGame(filename, LibraryAppletParameters(CabinetId, Service::AM::AppletId::Cabinet));
}
void GMainWindow::OnQlaunch() {
constexpr u64 QlaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch);
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
if (!bis_system) {
QMessageBox::warning(this, tr("No firmware available"),
tr("Please install the firmware to use the Mii editor."));
return;
}
auto mii_applet_nca = bis_system->GetEntry(QlaunchId, FileSys::ContentRecordType::Program);
if (!mii_applet_nca) {
QMessageBox::warning(this, tr("Mii Edit Applet"),
tr("Mii editor is not available. Please reinstall firmware."));
return;
}
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::QLaunch);
const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath()));
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
BootGame(filename, LibraryAppletParameters(QlaunchId, Service::AM::AppletId::QLaunch));
}
void GMainWindow::OnMiiEdit() {
constexpr u64 MiiEditId = static_cast<u64>(Service::AM::AppletProgramId::MiiEdit);
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();

View File

@ -395,6 +395,7 @@ private slots:
void ResetWindowSize900();
void ResetWindowSize1080();
void OnAlbum();
void OnQlaunch();
void OnCabinet(Service::NFP::CabinetMode mode);
void OnMiiEdit();
void OnOpenControllerMenu();

View File

@ -159,6 +159,7 @@
<addaction name="action_Rederive"/>
<addaction name="action_Verify_installed_contents"/>
<addaction name="separator"/>
<addaction name="action_Load_QLaunch"/>
<addaction name="menu_cabinet_applet"/>
<addaction name="action_Load_Album"/>
<addaction name="action_Load_Mii_Edit"/>
@ -402,6 +403,11 @@
<string>&amp;Format Amiibo</string>
</property>
</action>
<action name="action_Load_QLaunch">
<property name="text">
<string>Open &amp;Home menu</string>
</property>
</action>
<action name="action_Load_Mii_Edit">
<property name="text">
<string>Open &amp;Mii Editor</string>