mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-09 00:12:45 +01:00
service/am: Remove usages of global system accessors
Avoids the use of global accessors, removing the reliance on global state. This also makes dependencies explicit in the interface, as opposed to being hidden
This commit is contained in:
parent
a956d0b0eb
commit
d1abe8e92a
17 changed files with 143 additions and 97 deletions
|
@ -104,7 +104,8 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
|
||||||
return vfs->OpenFile(path, FileSys::Mode::Read);
|
return vfs->OpenFile(path, FileSys::Mode::Read);
|
||||||
}
|
}
|
||||||
struct System::Impl {
|
struct System::Impl {
|
||||||
explicit Impl(System& system) : kernel{system}, cpu_core_manager{system}, reporter{system} {}
|
explicit Impl(System& system)
|
||||||
|
: kernel{system}, cpu_core_manager{system}, applet_manager{system}, reporter{system} {}
|
||||||
|
|
||||||
Cpu& CurrentCpuCore() {
|
Cpu& CurrentCpuCore() {
|
||||||
return cpu_core_manager.GetCurrentCore();
|
return cpu_core_manager.GetCurrentCore();
|
||||||
|
|
|
@ -56,7 +56,8 @@ struct LaunchParameters {
|
||||||
};
|
};
|
||||||
static_assert(sizeof(LaunchParameters) == 0x88);
|
static_assert(sizeof(LaunchParameters) == 0x88);
|
||||||
|
|
||||||
IWindowController::IWindowController() : ServiceFramework("IWindowController") {
|
IWindowController::IWindowController(Core::System& system_)
|
||||||
|
: ServiceFramework("IWindowController"), system{system_} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, nullptr, "CreateWindow"},
|
{0, nullptr, "CreateWindow"},
|
||||||
|
@ -75,7 +76,7 @@ IWindowController::IWindowController() : ServiceFramework("IWindowController") {
|
||||||
IWindowController::~IWindowController() = default;
|
IWindowController::~IWindowController() = default;
|
||||||
|
|
||||||
void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) {
|
void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) {
|
||||||
const u64 process_id = Core::System::GetInstance().Kernel().CurrentProcess()->GetProcessID();
|
const u64 process_id = system.CurrentProcess()->GetProcessID();
|
||||||
|
|
||||||
LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id);
|
LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id);
|
||||||
|
|
||||||
|
@ -231,8 +232,9 @@ IDebugFunctions::IDebugFunctions() : ServiceFramework{"IDebugFunctions"} {
|
||||||
|
|
||||||
IDebugFunctions::~IDebugFunctions() = default;
|
IDebugFunctions::~IDebugFunctions() = default;
|
||||||
|
|
||||||
ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
|
ISelfController::ISelfController(Core::System& system_,
|
||||||
: ServiceFramework("ISelfController"), nvflinger(std::move(nvflinger)) {
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger_)
|
||||||
|
: ServiceFramework("ISelfController"), nvflinger(std::move(nvflinger_)) {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, nullptr, "Exit"},
|
{0, nullptr, "Exit"},
|
||||||
|
@ -280,7 +282,7 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger
|
||||||
|
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
|
|
||||||
auto& kernel = Core::System::GetInstance().Kernel();
|
auto& kernel = system_.Kernel();
|
||||||
launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual,
|
launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual,
|
||||||
"ISelfController:LaunchableEvent");
|
"ISelfController:LaunchableEvent");
|
||||||
|
|
||||||
|
@ -501,8 +503,7 @@ void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequest
|
||||||
rb.PushCopyObjects(accumulated_suspended_tick_changed_event.readable);
|
rb.PushCopyObjects(accumulated_suspended_tick_changed_event.readable);
|
||||||
}
|
}
|
||||||
|
|
||||||
AppletMessageQueue::AppletMessageQueue() {
|
AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel) {
|
||||||
auto& kernel = Core::System::GetInstance().Kernel();
|
|
||||||
on_new_message = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual,
|
on_new_message = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual,
|
||||||
"AMMessageQueue:OnMessageRecieved");
|
"AMMessageQueue:OnMessageRecieved");
|
||||||
on_operation_mode_changed = Kernel::WritableEvent::CreateEventPair(
|
on_operation_mode_changed = Kernel::WritableEvent::CreateEventPair(
|
||||||
|
@ -937,9 +938,8 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
ILibraryAppletCreator::ILibraryAppletCreator(u64 current_process_title_id)
|
ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_)
|
||||||
: ServiceFramework("ILibraryAppletCreator"),
|
: ServiceFramework("ILibraryAppletCreator"), system{system_} {
|
||||||
current_process_title_id(current_process_title_id) {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"},
|
{0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"},
|
||||||
{1, nullptr, "TerminateAllLibraryApplets"},
|
{1, nullptr, "TerminateAllLibraryApplets"},
|
||||||
|
@ -961,8 +961,8 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx)
|
||||||
LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}",
|
LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}",
|
||||||
static_cast<u32>(applet_id), applet_mode);
|
static_cast<u32>(applet_id), applet_mode);
|
||||||
|
|
||||||
const auto& applet_manager{Core::System::GetInstance().GetAppletManager()};
|
const auto& applet_manager{system.GetAppletManager()};
|
||||||
const auto applet = applet_manager.GetApplet(applet_id, current_process_title_id);
|
const auto applet = applet_manager.GetApplet(applet_id);
|
||||||
|
|
||||||
if (applet == nullptr) {
|
if (applet == nullptr) {
|
||||||
LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", static_cast<u32>(applet_id));
|
LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", static_cast<u32>(applet_id));
|
||||||
|
@ -999,8 +999,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
|
||||||
const auto handle{rp.Pop<Kernel::Handle>()};
|
const auto handle{rp.Pop<Kernel::Handle>()};
|
||||||
|
|
||||||
const auto transfer_mem =
|
const auto transfer_mem =
|
||||||
Core::System::GetInstance().CurrentProcess()->GetHandleTable().Get<Kernel::TransferMemory>(
|
system.CurrentProcess()->GetHandleTable().Get<Kernel::TransferMemory>(handle);
|
||||||
handle);
|
|
||||||
|
|
||||||
if (transfer_mem == nullptr) {
|
if (transfer_mem == nullptr) {
|
||||||
LOG_ERROR(Service_AM, "shared_mem is a nullpr for handle={:08X}", handle);
|
LOG_ERROR(Service_AM, "shared_mem is a nullpr for handle={:08X}", handle);
|
||||||
|
@ -1018,7 +1017,8 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
|
||||||
rb.PushIpcInterface(std::make_shared<IStorage>(std::move(memory)));
|
rb.PushIpcInterface(std::make_shared<IStorage>(std::move(memory)));
|
||||||
}
|
}
|
||||||
|
|
||||||
IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationFunctions") {
|
IApplicationFunctions::IApplicationFunctions(Core::System& system_)
|
||||||
|
: ServiceFramework("IApplicationFunctions"), system{system_} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{1, &IApplicationFunctions::PopLaunchParameter, "PopLaunchParameter"},
|
{1, &IApplicationFunctions::PopLaunchParameter, "PopLaunchParameter"},
|
||||||
|
@ -1180,7 +1180,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
|
||||||
// Get supported languages from NACP, if possible
|
// Get supported languages from NACP, if possible
|
||||||
// Default to 0 (all languages supported)
|
// Default to 0 (all languages supported)
|
||||||
u32 supported_languages = 0;
|
u32 supported_languages = 0;
|
||||||
FileSys::PatchManager pm{Core::System::GetInstance().CurrentProcess()->GetTitleID()};
|
FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()};
|
||||||
|
|
||||||
const auto res = pm.GetControlMetadata();
|
const auto res = pm.GetControlMetadata();
|
||||||
if (res.first != nullptr) {
|
if (res.first != nullptr) {
|
||||||
|
@ -1188,8 +1188,8 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call IApplicationManagerInterface implementation.
|
// Call IApplicationManagerInterface implementation.
|
||||||
auto& service_manager = Core::System::GetInstance().ServiceManager();
|
auto& service_manager = system.ServiceManager();
|
||||||
auto ns_am2 = service_manager.GetService<Service::NS::NS>("ns:am2");
|
auto ns_am2 = service_manager.GetService<NS::NS>("ns:am2");
|
||||||
auto app_man = ns_am2->GetApplicationManagerInterface();
|
auto app_man = ns_am2->GetApplicationManagerInterface();
|
||||||
|
|
||||||
// Get desired application language
|
// Get desired application language
|
||||||
|
@ -1261,8 +1261,8 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) {
|
||||||
"new_journal={:016X}",
|
"new_journal={:016X}",
|
||||||
static_cast<u8>(type), user_id[1], user_id[0], new_normal_size, new_journal_size);
|
static_cast<u8>(type), user_id[1], user_id[0], new_normal_size, new_journal_size);
|
||||||
|
|
||||||
FileSystem::WriteSaveDataSize(type, Core::CurrentProcess()->GetTitleID(), user_id,
|
const auto title_id = system.CurrentProcess()->GetTitleID();
|
||||||
{new_normal_size, new_journal_size});
|
FileSystem::WriteSaveDataSize(type, title_id, user_id, {new_normal_size, new_journal_size});
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -1281,8 +1281,8 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_AM, "called with type={:02X}, user_id={:016X}{:016X}", static_cast<u8>(type),
|
LOG_DEBUG(Service_AM, "called with type={:02X}, user_id={:016X}{:016X}", static_cast<u8>(type),
|
||||||
user_id[1], user_id[0]);
|
user_id[1], user_id[0]);
|
||||||
|
|
||||||
const auto size =
|
const auto title_id = system.CurrentProcess()->GetTitleID();
|
||||||
FileSystem::ReadSaveDataSize(type, Core::CurrentProcess()->GetTitleID(), user_id);
|
const auto size = FileSystem::ReadSaveDataSize(type, title_id, user_id);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 6};
|
IPC::ResponseBuilder rb{ctx, 6};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -1300,9 +1300,9 @@ void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(Kernel::HLERequestCon
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager,
|
void InstallInterfaces(SM::ServiceManager& service_manager,
|
||||||
std::shared_ptr<NVFlinger::NVFlinger> nvflinger, Core::System& system) {
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger, Core::System& system) {
|
||||||
auto message_queue = std::make_shared<AppletMessageQueue>();
|
auto message_queue = std::make_shared<AppletMessageQueue>(system.Kernel());
|
||||||
message_queue->PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); // Needed on
|
// Needed on game boot
|
||||||
// game boot
|
message_queue->PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged);
|
||||||
|
|
||||||
std::make_shared<AppletAE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
|
std::make_shared<AppletAE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
|
||||||
std::make_shared<AppletOE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
|
std::make_shared<AppletOE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
|
||||||
|
|
|
@ -10,12 +10,15 @@
|
||||||
#include "core/hle/kernel/writable_event.h"
|
#include "core/hle/kernel/writable_event.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Kernel {
|
||||||
namespace NVFlinger {
|
class KernelCore;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::NVFlinger {
|
||||||
class NVFlinger;
|
class NVFlinger;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
enum SystemLanguage {
|
enum SystemLanguage {
|
||||||
Japanese = 0,
|
Japanese = 0,
|
||||||
|
@ -47,7 +50,7 @@ public:
|
||||||
PerformanceModeChanged = 31,
|
PerformanceModeChanged = 31,
|
||||||
};
|
};
|
||||||
|
|
||||||
AppletMessageQueue();
|
explicit AppletMessageQueue(Kernel::KernelCore& kernel);
|
||||||
~AppletMessageQueue();
|
~AppletMessageQueue();
|
||||||
|
|
||||||
const Kernel::SharedPtr<Kernel::ReadableEvent>& GetMesssageRecieveEvent() const;
|
const Kernel::SharedPtr<Kernel::ReadableEvent>& GetMesssageRecieveEvent() const;
|
||||||
|
@ -65,12 +68,14 @@ private:
|
||||||
|
|
||||||
class IWindowController final : public ServiceFramework<IWindowController> {
|
class IWindowController final : public ServiceFramework<IWindowController> {
|
||||||
public:
|
public:
|
||||||
IWindowController();
|
explicit IWindowController(Core::System& system_);
|
||||||
~IWindowController() override;
|
~IWindowController() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void GetAppletResourceUserId(Kernel::HLERequestContext& ctx);
|
void GetAppletResourceUserId(Kernel::HLERequestContext& ctx);
|
||||||
void AcquireForegroundRights(Kernel::HLERequestContext& ctx);
|
void AcquireForegroundRights(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IAudioController final : public ServiceFramework<IAudioController> {
|
class IAudioController final : public ServiceFramework<IAudioController> {
|
||||||
|
@ -113,7 +118,8 @@ public:
|
||||||
|
|
||||||
class ISelfController final : public ServiceFramework<ISelfController> {
|
class ISelfController final : public ServiceFramework<ISelfController> {
|
||||||
public:
|
public:
|
||||||
explicit ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger);
|
explicit ISelfController(Core::System& system_,
|
||||||
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger_);
|
||||||
~ISelfController() override;
|
~ISelfController() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -208,7 +214,7 @@ private:
|
||||||
|
|
||||||
class ILibraryAppletCreator final : public ServiceFramework<ILibraryAppletCreator> {
|
class ILibraryAppletCreator final : public ServiceFramework<ILibraryAppletCreator> {
|
||||||
public:
|
public:
|
||||||
ILibraryAppletCreator(u64 current_process_title_id);
|
explicit ILibraryAppletCreator(Core::System& system_);
|
||||||
~ILibraryAppletCreator() override;
|
~ILibraryAppletCreator() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -216,12 +222,12 @@ private:
|
||||||
void CreateStorage(Kernel::HLERequestContext& ctx);
|
void CreateStorage(Kernel::HLERequestContext& ctx);
|
||||||
void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx);
|
void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
u64 current_process_title_id;
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {
|
class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {
|
||||||
public:
|
public:
|
||||||
IApplicationFunctions();
|
explicit IApplicationFunctions(Core::System& system_);
|
||||||
~IApplicationFunctions() override;
|
~IApplicationFunctions() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -245,6 +251,7 @@ private:
|
||||||
void GetGpuErrorDetectedSystemEvent(Kernel::HLERequestContext& ctx);
|
void GetGpuErrorDetectedSystemEvent(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
Kernel::EventPair gpu_error_detected_event;
|
Kernel::EventPair gpu_error_detected_event;
|
||||||
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> {
|
class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> {
|
||||||
|
@ -278,5 +285,4 @@ public:
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager,
|
void InstallInterfaces(SM::ServiceManager& service_manager,
|
||||||
std::shared_ptr<NVFlinger::NVFlinger> nvflinger, Core::System& system);
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger, Core::System& system);
|
||||||
|
|
||||||
} // namespace AM
|
} // namespace Service::AM
|
||||||
} // namespace Service
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<ISelfController>(nvflinger);
|
rb.PushIpcInterface<ISelfController>(system, nvflinger);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetWindowController(Kernel::HLERequestContext& ctx) {
|
void GetWindowController(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -58,7 +58,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<IWindowController>();
|
rb.PushIpcInterface<IWindowController>(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetAudioController(Kernel::HLERequestContext& ctx) {
|
void GetAudioController(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -98,7 +98,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<ILibraryAppletCreator>(system.CurrentProcess()->GetTitleID());
|
rb.PushIpcInterface<ILibraryAppletCreator>(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
|
void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -106,7 +106,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<IApplicationFunctions>();
|
rb.PushIpcInterface<IApplicationFunctions>(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
|
||||||
|
@ -154,7 +154,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<ISelfController>(nvflinger);
|
rb.PushIpcInterface<ISelfController>(system, nvflinger);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetWindowController(Kernel::HLERequestContext& ctx) {
|
void GetWindowController(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -162,7 +162,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<IWindowController>();
|
rb.PushIpcInterface<IWindowController>(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetAudioController(Kernel::HLERequestContext& ctx) {
|
void GetAudioController(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -194,7 +194,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<ILibraryAppletCreator>(system.CurrentProcess()->GetTitleID());
|
rb.PushIpcInterface<ILibraryAppletCreator>(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) {
|
void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/process.h"
|
|
||||||
#include "core/hle/service/am/am.h"
|
#include "core/hle/service/am/am.h"
|
||||||
#include "core/hle/service/am/applet_oe.h"
|
#include "core/hle/service/am/applet_oe.h"
|
||||||
#include "core/hle/service/nvflinger/nvflinger.h"
|
#include "core/hle/service/nvflinger/nvflinger.h"
|
||||||
|
@ -64,7 +63,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<IWindowController>();
|
rb.PushIpcInterface<IWindowController>(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetSelfController(Kernel::HLERequestContext& ctx) {
|
void GetSelfController(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -72,7 +71,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<ISelfController>(nvflinger);
|
rb.PushIpcInterface<ISelfController>(system, nvflinger);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
|
void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -88,7 +87,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<ILibraryAppletCreator>(system.CurrentProcess()->GetTitleID());
|
rb.PushIpcInterface<ILibraryAppletCreator>(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
|
void GetApplicationFunctions(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -96,7 +95,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<IApplicationFunctions>();
|
rb.PushIpcInterface<IApplicationFunctions>(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
|
std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
|
|
||||||
namespace Service::AM::Applets {
|
namespace Service::AM::Applets {
|
||||||
|
|
||||||
AppletDataBroker::AppletDataBroker() {
|
AppletDataBroker::AppletDataBroker(Kernel::KernelCore& kernel) {
|
||||||
auto& kernel = Core::System::GetInstance().Kernel();
|
|
||||||
state_changed_event = Kernel::WritableEvent::CreateEventPair(
|
state_changed_event = Kernel::WritableEvent::CreateEventPair(
|
||||||
kernel, Kernel::ResetType::Manual, "ILibraryAppletAccessor:StateChangedEvent");
|
kernel, Kernel::ResetType::Manual, "ILibraryAppletAccessor:StateChangedEvent");
|
||||||
pop_out_data_event = Kernel::WritableEvent::CreateEventPair(
|
pop_out_data_event = Kernel::WritableEvent::CreateEventPair(
|
||||||
|
@ -121,7 +120,7 @@ Kernel::SharedPtr<Kernel::ReadableEvent> AppletDataBroker::GetStateChangedEvent(
|
||||||
return state_changed_event.readable;
|
return state_changed_event.readable;
|
||||||
}
|
}
|
||||||
|
|
||||||
Applet::Applet() = default;
|
Applet::Applet(Kernel::KernelCore& kernel_) : broker{kernel_} {}
|
||||||
|
|
||||||
Applet::~Applet() = default;
|
Applet::~Applet() = default;
|
||||||
|
|
||||||
|
@ -154,7 +153,7 @@ AppletFrontendSet::AppletFrontendSet(AppletFrontendSet&&) noexcept = default;
|
||||||
|
|
||||||
AppletFrontendSet& AppletFrontendSet::operator=(AppletFrontendSet&&) noexcept = default;
|
AppletFrontendSet& AppletFrontendSet::operator=(AppletFrontendSet&&) noexcept = default;
|
||||||
|
|
||||||
AppletManager::AppletManager() = default;
|
AppletManager::AppletManager(Core::System& system_) : system{system_} {}
|
||||||
|
|
||||||
AppletManager::~AppletManager() = default;
|
AppletManager::~AppletManager() = default;
|
||||||
|
|
||||||
|
@ -216,28 +215,28 @@ void AppletManager::ClearAll() {
|
||||||
frontend = {};
|
frontend = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id, u64 current_process_title_id) const {
|
std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id) const {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case AppletId::Auth:
|
case AppletId::Auth:
|
||||||
return std::make_shared<Auth>(*frontend.parental_controls);
|
return std::make_shared<Auth>(system, *frontend.parental_controls);
|
||||||
case AppletId::Error:
|
case AppletId::Error:
|
||||||
return std::make_shared<Error>(*frontend.error);
|
return std::make_shared<Error>(system, *frontend.error);
|
||||||
case AppletId::ProfileSelect:
|
case AppletId::ProfileSelect:
|
||||||
return std::make_shared<ProfileSelect>(*frontend.profile_select);
|
return std::make_shared<ProfileSelect>(system, *frontend.profile_select);
|
||||||
case AppletId::SoftwareKeyboard:
|
case AppletId::SoftwareKeyboard:
|
||||||
return std::make_shared<SoftwareKeyboard>(*frontend.software_keyboard);
|
return std::make_shared<SoftwareKeyboard>(system, *frontend.software_keyboard);
|
||||||
case AppletId::PhotoViewer:
|
case AppletId::PhotoViewer:
|
||||||
return std::make_shared<PhotoViewer>(*frontend.photo_viewer);
|
return std::make_shared<PhotoViewer>(system, *frontend.photo_viewer);
|
||||||
case AppletId::LibAppletShop:
|
case AppletId::LibAppletShop:
|
||||||
return std::make_shared<WebBrowser>(*frontend.web_browser, current_process_title_id,
|
return std::make_shared<WebBrowser>(system, *frontend.web_browser,
|
||||||
frontend.e_commerce.get());
|
frontend.e_commerce.get());
|
||||||
case AppletId::LibAppletOff:
|
case AppletId::LibAppletOff:
|
||||||
return std::make_shared<WebBrowser>(*frontend.web_browser, current_process_title_id);
|
return std::make_shared<WebBrowser>(system, *frontend.web_browser);
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED_MSG(
|
UNIMPLEMENTED_MSG(
|
||||||
"No backend implementation exists for applet_id={:02X}! Falling back to stub applet.",
|
"No backend implementation exists for applet_id={:02X}! Falling back to stub applet.",
|
||||||
static_cast<u8>(id));
|
static_cast<u8>(id));
|
||||||
return std::make_shared<StubApplet>(id);
|
return std::make_shared<StubApplet>(system, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
|
|
||||||
union ResultCode;
|
union ResultCode;
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Core::Frontend {
|
namespace Core::Frontend {
|
||||||
class ECommerceApplet;
|
class ECommerceApplet;
|
||||||
class ErrorApplet;
|
class ErrorApplet;
|
||||||
|
@ -22,6 +26,10 @@ class SoftwareKeyboardApplet;
|
||||||
class WebBrowserApplet;
|
class WebBrowserApplet;
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
class KernelCore;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
class IStorage;
|
class IStorage;
|
||||||
|
@ -53,7 +61,7 @@ enum class AppletId : u32 {
|
||||||
|
|
||||||
class AppletDataBroker final {
|
class AppletDataBroker final {
|
||||||
public:
|
public:
|
||||||
AppletDataBroker();
|
explicit AppletDataBroker(Kernel::KernelCore& kernel_);
|
||||||
~AppletDataBroker();
|
~AppletDataBroker();
|
||||||
|
|
||||||
struct RawChannelData {
|
struct RawChannelData {
|
||||||
|
@ -108,7 +116,7 @@ private:
|
||||||
|
|
||||||
class Applet {
|
class Applet {
|
||||||
public:
|
public:
|
||||||
Applet();
|
explicit Applet(Kernel::KernelCore& kernel_);
|
||||||
virtual ~Applet();
|
virtual ~Applet();
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
|
@ -179,7 +187,7 @@ struct AppletFrontendSet {
|
||||||
|
|
||||||
class AppletManager {
|
class AppletManager {
|
||||||
public:
|
public:
|
||||||
AppletManager();
|
explicit AppletManager(Core::System& system_);
|
||||||
~AppletManager();
|
~AppletManager();
|
||||||
|
|
||||||
void SetAppletFrontendSet(AppletFrontendSet set);
|
void SetAppletFrontendSet(AppletFrontendSet set);
|
||||||
|
@ -187,10 +195,11 @@ public:
|
||||||
void SetDefaultAppletsIfMissing();
|
void SetDefaultAppletsIfMissing();
|
||||||
void ClearAll();
|
void ClearAll();
|
||||||
|
|
||||||
std::shared_ptr<Applet> GetApplet(AppletId id, u64 current_process_title_id) const;
|
std::shared_ptr<Applet> GetApplet(AppletId id) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AppletFrontendSet frontend;
|
AppletFrontendSet frontend;
|
||||||
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Applets
|
} // namespace Applets
|
||||||
|
|
|
@ -85,7 +85,8 @@ ResultCode Decode64BitError(u64 error) {
|
||||||
|
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
Error::Error(const Core::Frontend::ErrorApplet& frontend) : frontend(frontend) {}
|
Error::Error(Core::System& system_, const Core::Frontend::ErrorApplet& frontend_)
|
||||||
|
: Applet{system_.Kernel()}, frontend(frontend_), system{system_} {}
|
||||||
|
|
||||||
Error::~Error() = default;
|
Error::~Error() = default;
|
||||||
|
|
||||||
|
@ -145,8 +146,8 @@ void Error::Execute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto callback = [this] { DisplayCompleted(); };
|
const auto callback = [this] { DisplayCompleted(); };
|
||||||
const auto title_id = Core::CurrentProcess()->GetTitleID();
|
const auto title_id = system.CurrentProcess()->GetTitleID();
|
||||||
const auto& reporter{Core::System::GetInstance().GetReporter()};
|
const auto& reporter{system.GetReporter()};
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case ErrorAppletMode::ShowError:
|
case ErrorAppletMode::ShowError:
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "core/hle/service/am/applets/applets.h"
|
#include "core/hle/service/am/applets/applets.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service::AM::Applets {
|
namespace Service::AM::Applets {
|
||||||
|
|
||||||
enum class ErrorAppletMode : u8 {
|
enum class ErrorAppletMode : u8 {
|
||||||
|
@ -21,7 +25,7 @@ enum class ErrorAppletMode : u8 {
|
||||||
|
|
||||||
class Error final : public Applet {
|
class Error final : public Applet {
|
||||||
public:
|
public:
|
||||||
explicit Error(const Core::Frontend::ErrorApplet& frontend);
|
explicit Error(Core::System& system_, const Core::Frontend::ErrorApplet& frontend_);
|
||||||
~Error() override;
|
~Error() override;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
|
@ -42,6 +46,7 @@ private:
|
||||||
std::unique_ptr<ErrorArguments> args;
|
std::unique_ptr<ErrorArguments> args;
|
||||||
|
|
||||||
bool complete = false;
|
bool complete = false;
|
||||||
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::AM::Applets
|
} // namespace Service::AM::Applets
|
||||||
|
|
|
@ -37,7 +37,8 @@ static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Auth::Auth(Core::Frontend::ParentalControlsApplet& frontend) : frontend(frontend) {}
|
Auth::Auth(Core::System& system_, Core::Frontend::ParentalControlsApplet& frontend_)
|
||||||
|
: Applet{system_.Kernel()}, frontend(frontend_) {}
|
||||||
|
|
||||||
Auth::~Auth() = default;
|
Auth::~Auth() = default;
|
||||||
|
|
||||||
|
@ -151,7 +152,8 @@ void Auth::AuthFinished(bool successful) {
|
||||||
broker.SignalStateChanged();
|
broker.SignalStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
PhotoViewer::PhotoViewer(const Core::Frontend::PhotoViewerApplet& frontend) : frontend(frontend) {}
|
PhotoViewer::PhotoViewer(Core::System& system_, const Core::Frontend::PhotoViewerApplet& frontend_)
|
||||||
|
: Applet{system_.Kernel()}, frontend(frontend_), system{system_} {}
|
||||||
|
|
||||||
PhotoViewer::~PhotoViewer() = default;
|
PhotoViewer::~PhotoViewer() = default;
|
||||||
|
|
||||||
|
@ -185,7 +187,7 @@ void PhotoViewer::Execute() {
|
||||||
const auto callback = [this] { ViewFinished(); };
|
const auto callback = [this] { ViewFinished(); };
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case PhotoViewerAppletMode::CurrentApp:
|
case PhotoViewerAppletMode::CurrentApp:
|
||||||
frontend.ShowPhotosForApplication(Core::CurrentProcess()->GetTitleID(), callback);
|
frontend.ShowPhotosForApplication(system.CurrentProcess()->GetTitleID(), callback);
|
||||||
break;
|
break;
|
||||||
case PhotoViewerAppletMode::AllApps:
|
case PhotoViewerAppletMode::AllApps:
|
||||||
frontend.ShowAllPhotos(callback);
|
frontend.ShowAllPhotos(callback);
|
||||||
|
@ -200,7 +202,8 @@ void PhotoViewer::ViewFinished() {
|
||||||
broker.SignalStateChanged();
|
broker.SignalStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
StubApplet::StubApplet(AppletId id) : id(id) {}
|
StubApplet::StubApplet(Core::System& system_, AppletId id_)
|
||||||
|
: Applet{system_.Kernel()}, id(id_), system{system_} {}
|
||||||
|
|
||||||
StubApplet::~StubApplet() = default;
|
StubApplet::~StubApplet() = default;
|
||||||
|
|
||||||
|
@ -209,7 +212,7 @@ void StubApplet::Initialize() {
|
||||||
Applet::Initialize();
|
Applet::Initialize();
|
||||||
|
|
||||||
const auto data = broker.PeekDataToAppletForDebug();
|
const auto data = broker.PeekDataToAppletForDebug();
|
||||||
Core::System::GetInstance().GetReporter().SaveUnimplementedAppletReport(
|
system.GetReporter().SaveUnimplementedAppletReport(
|
||||||
static_cast<u32>(id), common_args.arguments_version, common_args.library_version,
|
static_cast<u32>(id), common_args.arguments_version, common_args.library_version,
|
||||||
common_args.theme_color, common_args.play_startup_sound, common_args.system_tick,
|
common_args.theme_color, common_args.play_startup_sound, common_args.system_tick,
|
||||||
data.normal, data.interactive);
|
data.normal, data.interactive);
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
|
|
||||||
#include "core/hle/service/am/applets/applets.h"
|
#include "core/hle/service/am/applets/applets.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service::AM::Applets {
|
namespace Service::AM::Applets {
|
||||||
|
|
||||||
enum class AuthAppletType : u32 {
|
enum class AuthAppletType : u32 {
|
||||||
|
@ -16,7 +20,7 @@ enum class AuthAppletType : u32 {
|
||||||
|
|
||||||
class Auth final : public Applet {
|
class Auth final : public Applet {
|
||||||
public:
|
public:
|
||||||
explicit Auth(Core::Frontend::ParentalControlsApplet& frontend);
|
explicit Auth(Core::System& system_, Core::Frontend::ParentalControlsApplet& frontend_);
|
||||||
~Auth() override;
|
~Auth() override;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
|
@ -45,7 +49,7 @@ enum class PhotoViewerAppletMode : u8 {
|
||||||
|
|
||||||
class PhotoViewer final : public Applet {
|
class PhotoViewer final : public Applet {
|
||||||
public:
|
public:
|
||||||
explicit PhotoViewer(const Core::Frontend::PhotoViewerApplet& frontend);
|
explicit PhotoViewer(Core::System& system_, const Core::Frontend::PhotoViewerApplet& frontend_);
|
||||||
~PhotoViewer() override;
|
~PhotoViewer() override;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
|
@ -60,11 +64,12 @@ private:
|
||||||
const Core::Frontend::PhotoViewerApplet& frontend;
|
const Core::Frontend::PhotoViewerApplet& frontend;
|
||||||
bool complete = false;
|
bool complete = false;
|
||||||
PhotoViewerAppletMode mode = PhotoViewerAppletMode::CurrentApp;
|
PhotoViewerAppletMode mode = PhotoViewerAppletMode::CurrentApp;
|
||||||
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
class StubApplet final : public Applet {
|
class StubApplet final : public Applet {
|
||||||
public:
|
public:
|
||||||
explicit StubApplet(AppletId id);
|
explicit StubApplet(Core::System& system_, AppletId id_);
|
||||||
~StubApplet() override;
|
~StubApplet() override;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
|
@ -76,6 +81,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AppletId id;
|
AppletId id;
|
||||||
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::AM::Applets
|
} // namespace Service::AM::Applets
|
||||||
|
|
|
@ -15,8 +15,9 @@ namespace Service::AM::Applets {
|
||||||
|
|
||||||
constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
|
constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
|
||||||
|
|
||||||
ProfileSelect::ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend)
|
ProfileSelect::ProfileSelect(Core::System& system_,
|
||||||
: frontend(frontend) {}
|
const Core::Frontend::ProfileSelectApplet& frontend_)
|
||||||
|
: Applet{system_.Kernel()}, frontend(frontend_) {}
|
||||||
|
|
||||||
ProfileSelect::~ProfileSelect() = default;
|
ProfileSelect::~ProfileSelect() = default;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "core/hle/service/am/applets/applets.h"
|
#include "core/hle/service/am/applets/applets.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service::AM::Applets {
|
namespace Service::AM::Applets {
|
||||||
|
|
||||||
struct UserSelectionConfig {
|
struct UserSelectionConfig {
|
||||||
|
@ -29,7 +33,8 @@ static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has inco
|
||||||
|
|
||||||
class ProfileSelect final : public Applet {
|
class ProfileSelect final : public Applet {
|
||||||
public:
|
public:
|
||||||
explicit ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend);
|
explicit ProfileSelect(Core::System& system_,
|
||||||
|
const Core::Frontend::ProfileSelectApplet& frontend_);
|
||||||
~ProfileSelect() override;
|
~ProfileSelect() override;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
|
|
|
@ -39,8 +39,9 @@ static Core::Frontend::SoftwareKeyboardParameters ConvertToFrontendParameters(
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
SoftwareKeyboard::SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend)
|
SoftwareKeyboard::SoftwareKeyboard(Core::System& system_,
|
||||||
: frontend(frontend) {}
|
const Core::Frontend::SoftwareKeyboardApplet& frontend_)
|
||||||
|
: Applet{system_.Kernel()}, frontend(frontend_) {}
|
||||||
|
|
||||||
SoftwareKeyboard::~SoftwareKeyboard() = default;
|
SoftwareKeyboard::~SoftwareKeyboard() = default;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
|
|
||||||
union ResultCode;
|
union ResultCode;
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service::AM::Applets {
|
namespace Service::AM::Applets {
|
||||||
|
|
||||||
enum class KeysetDisable : u32 {
|
enum class KeysetDisable : u32 {
|
||||||
|
@ -55,7 +59,8 @@ static_assert(sizeof(KeyboardConfig) == 0x3E0, "KeyboardConfig has incorrect siz
|
||||||
|
|
||||||
class SoftwareKeyboard final : public Applet {
|
class SoftwareKeyboard final : public Applet {
|
||||||
public:
|
public:
|
||||||
explicit SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend);
|
explicit SoftwareKeyboard(Core::System& system_,
|
||||||
|
const Core::Frontend::SoftwareKeyboardApplet& frontend_);
|
||||||
~SoftwareKeyboard() override;
|
~SoftwareKeyboard() override;
|
||||||
|
|
||||||
void Initialize() override;
|
void Initialize() override;
|
||||||
|
|
|
@ -190,8 +190,9 @@ std::map<WebArgTLVType, std::vector<u8>> GetWebArguments(const std::vector<u8>&
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSys::VirtualFile GetApplicationRomFS(u64 title_id, FileSys::ContentRecordType type) {
|
FileSys::VirtualFile GetApplicationRomFS(const Core::System& system, u64 title_id,
|
||||||
const auto& installed{Core::System::GetInstance().GetContentProvider()};
|
FileSys::ContentRecordType type) {
|
||||||
|
const auto& installed{system.GetContentProvider()};
|
||||||
const auto res = installed.GetEntry(title_id, type);
|
const auto res = installed.GetEntry(title_id, type);
|
||||||
|
|
||||||
if (res != nullptr) {
|
if (res != nullptr) {
|
||||||
|
@ -207,10 +208,10 @@ FileSys::VirtualFile GetApplicationRomFS(u64 title_id, FileSys::ContentRecordTyp
|
||||||
|
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
WebBrowser::WebBrowser(Core::Frontend::WebBrowserApplet& frontend, u64 current_process_title_id,
|
WebBrowser::WebBrowser(Core::System& system_, Core::Frontend::WebBrowserApplet& frontend_,
|
||||||
Core::Frontend::ECommerceApplet* frontend_e_commerce)
|
Core::Frontend::ECommerceApplet* frontend_e_commerce_)
|
||||||
: frontend(frontend), frontend_e_commerce(frontend_e_commerce),
|
: Applet{system_.Kernel()}, frontend(frontend_),
|
||||||
current_process_title_id(current_process_title_id) {}
|
frontend_e_commerce(frontend_e_commerce_), system{system_} {}
|
||||||
|
|
||||||
WebBrowser::~WebBrowser() = default;
|
WebBrowser::~WebBrowser() = default;
|
||||||
|
|
||||||
|
@ -266,7 +267,7 @@ void WebBrowser::UnpackRomFS() {
|
||||||
ASSERT(offline_romfs != nullptr);
|
ASSERT(offline_romfs != nullptr);
|
||||||
const auto dir =
|
const auto dir =
|
||||||
FileSys::ExtractRomFS(offline_romfs, FileSys::RomFSExtractionType::SingleDiscard);
|
FileSys::ExtractRomFS(offline_romfs, FileSys::RomFSExtractionType::SingleDiscard);
|
||||||
const auto& vfs{Core::System::GetInstance().GetFilesystem()};
|
const auto& vfs{system.GetFilesystem()};
|
||||||
const auto temp_dir = vfs->CreateDirectory(temporary_dir, FileSys::Mode::ReadWrite);
|
const auto temp_dir = vfs->CreateDirectory(temporary_dir, FileSys::Mode::ReadWrite);
|
||||||
FileSys::VfsRawCopyD(dir, temp_dir);
|
FileSys::VfsRawCopyD(dir, temp_dir);
|
||||||
|
|
||||||
|
@ -470,10 +471,10 @@ void WebBrowser::InitializeOffline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title_id == 0) {
|
if (title_id == 0) {
|
||||||
title_id = current_process_title_id;
|
title_id = system.CurrentProcess()->GetTitleID();
|
||||||
}
|
}
|
||||||
|
|
||||||
offline_romfs = GetApplicationRomFS(title_id, type);
|
offline_romfs = GetApplicationRomFS(system, title_id, type);
|
||||||
if (offline_romfs == nullptr) {
|
if (offline_romfs == nullptr) {
|
||||||
status = ResultCode(-1);
|
status = ResultCode(-1);
|
||||||
LOG_ERROR(Service_AM, "Failed to find offline data for request!");
|
LOG_ERROR(Service_AM, "Failed to find offline data for request!");
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
#include "core/hle/service/am/am.h"
|
#include "core/hle/service/am/am.h"
|
||||||
#include "core/hle/service/am/applets/applets.h"
|
#include "core/hle/service/am/applets/applets.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service::AM::Applets {
|
namespace Service::AM::Applets {
|
||||||
|
|
||||||
enum class ShimKind : u32;
|
enum class ShimKind : u32;
|
||||||
|
@ -17,8 +21,8 @@ enum class WebArgTLVType : u16;
|
||||||
|
|
||||||
class WebBrowser final : public Applet {
|
class WebBrowser final : public Applet {
|
||||||
public:
|
public:
|
||||||
WebBrowser(Core::Frontend::WebBrowserApplet& frontend, u64 current_process_title_id,
|
WebBrowser(Core::System& system_, Core::Frontend::WebBrowserApplet& frontend_,
|
||||||
Core::Frontend::ECommerceApplet* frontend_e_commerce = nullptr);
|
Core::Frontend::ECommerceApplet* frontend_e_commerce_ = nullptr);
|
||||||
|
|
||||||
~WebBrowser() override;
|
~WebBrowser() override;
|
||||||
|
|
||||||
|
@ -59,8 +63,6 @@ private:
|
||||||
bool unpacked = false;
|
bool unpacked = false;
|
||||||
ResultCode status = RESULT_SUCCESS;
|
ResultCode status = RESULT_SUCCESS;
|
||||||
|
|
||||||
u64 current_process_title_id;
|
|
||||||
|
|
||||||
ShimKind kind;
|
ShimKind kind;
|
||||||
std::map<WebArgTLVType, std::vector<u8>> args;
|
std::map<WebArgTLVType, std::vector<u8>> args;
|
||||||
|
|
||||||
|
@ -74,6 +76,8 @@ private:
|
||||||
std::optional<u128> user_id;
|
std::optional<u128> user_id;
|
||||||
std::optional<bool> shop_full_display;
|
std::optional<bool> shop_full_display;
|
||||||
std::string shop_extra_parameter;
|
std::string shop_extra_parameter;
|
||||||
|
|
||||||
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::AM::Applets
|
} // namespace Service::AM::Applets
|
||||||
|
|
Loading…
Reference in a new issue