|
|
@ -5,11 +5,21 @@
|
|
|
|
#include <cstring>
|
|
|
|
#include <cstring>
|
|
|
|
#include "common/assert.h"
|
|
|
|
#include "common/assert.h"
|
|
|
|
#include "core/core.h"
|
|
|
|
#include "core/core.h"
|
|
|
|
|
|
|
|
#include "core/frontend/applets/error.h"
|
|
|
|
|
|
|
|
#include "core/frontend/applets/general_frontend.h"
|
|
|
|
|
|
|
|
#include "core/frontend/applets/profile_select.h"
|
|
|
|
|
|
|
|
#include "core/frontend/applets/software_keyboard.h"
|
|
|
|
|
|
|
|
#include "core/frontend/applets/web_browser.h"
|
|
|
|
#include "core/hle/kernel/readable_event.h"
|
|
|
|
#include "core/hle/kernel/readable_event.h"
|
|
|
|
#include "core/hle/kernel/server_session.h"
|
|
|
|
#include "core/hle/kernel/server_session.h"
|
|
|
|
#include "core/hle/kernel/writable_event.h"
|
|
|
|
#include "core/hle/kernel/writable_event.h"
|
|
|
|
#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"
|
|
|
|
|
|
|
|
#include "core/hle/service/am/applets/error.h"
|
|
|
|
|
|
|
|
#include "core/hle/service/am/applets/general_backend.h"
|
|
|
|
|
|
|
|
#include "core/hle/service/am/applets/profile_select.h"
|
|
|
|
|
|
|
|
#include "core/hle/service/am/applets/software_keyboard.h"
|
|
|
|
|
|
|
|
#include "core/hle/service/am/applets/web_browser.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Service::AM::Applets {
|
|
|
|
namespace Service::AM::Applets {
|
|
|
|
|
|
|
|
|
|
|
@ -111,4 +121,76 @@ void Applet::Initialize() {
|
|
|
|
initialized = true;
|
|
|
|
initialized = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppletManager::AppletManager() = default;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppletManager::~AppletManager() = default;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AppletManager::SetAppletFrontendSet(AppletFrontendSet set) {
|
|
|
|
|
|
|
|
if (set.error != nullptr)
|
|
|
|
|
|
|
|
frontend.error = std::move(set.error);
|
|
|
|
|
|
|
|
if (set.photo_viewer != nullptr)
|
|
|
|
|
|
|
|
frontend.photo_viewer = std::move(set.photo_viewer);
|
|
|
|
|
|
|
|
if (set.profile_select != nullptr)
|
|
|
|
|
|
|
|
frontend.profile_select = std::move(set.profile_select);
|
|
|
|
|
|
|
|
if (set.software_keyboard != nullptr)
|
|
|
|
|
|
|
|
frontend.software_keyboard = std::move(set.software_keyboard);
|
|
|
|
|
|
|
|
if (set.web_browser != nullptr)
|
|
|
|
|
|
|
|
frontend.web_browser = std::move(set.web_browser);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AppletManager::SetDefaultAppletFrontendSet() {
|
|
|
|
|
|
|
|
frontend.error = std::make_unique<Core::Frontend::DefaultErrorApplet>();
|
|
|
|
|
|
|
|
frontend.photo_viewer = std::make_unique<Core::Frontend::DefaultPhotoViewerApplet>();
|
|
|
|
|
|
|
|
frontend.profile_select = std::make_unique<Core::Frontend::DefaultProfileSelectApplet>();
|
|
|
|
|
|
|
|
frontend.software_keyboard = std::make_unique<Core::Frontend::DefaultSoftwareKeyboardApplet>();
|
|
|
|
|
|
|
|
frontend.web_browser = std::make_unique<Core::Frontend::DefaultWebBrowserApplet>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AppletManager::SetDefaultAppletsIfMissing() {
|
|
|
|
|
|
|
|
if (frontend.error == nullptr) {
|
|
|
|
|
|
|
|
frontend.error = std::make_unique<Core::Frontend::DefaultErrorApplet>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (frontend.photo_viewer == nullptr) {
|
|
|
|
|
|
|
|
frontend.photo_viewer = std::make_unique<Core::Frontend::DefaultPhotoViewerApplet>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (frontend.profile_select == nullptr) {
|
|
|
|
|
|
|
|
frontend.profile_select = std::make_unique<Core::Frontend::DefaultProfileSelectApplet>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (frontend.software_keyboard == nullptr) {
|
|
|
|
|
|
|
|
frontend.software_keyboard =
|
|
|
|
|
|
|
|
std::make_unique<Core::Frontend::DefaultSoftwareKeyboardApplet>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (frontend.web_browser == nullptr) {
|
|
|
|
|
|
|
|
frontend.web_browser = std::make_unique<Core::Frontend::DefaultWebBrowserApplet>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AppletManager::ClearAll() {
|
|
|
|
|
|
|
|
frontend = {};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id) const {
|
|
|
|
|
|
|
|
switch (id) {
|
|
|
|
|
|
|
|
case AppletId::Error:
|
|
|
|
|
|
|
|
return std::make_shared<Error>(*frontend.error);
|
|
|
|
|
|
|
|
case AppletId::ProfileSelect:
|
|
|
|
|
|
|
|
return std::make_shared<ProfileSelect>(*frontend.profile_select);
|
|
|
|
|
|
|
|
case AppletId::SoftwareKeyboard:
|
|
|
|
|
|
|
|
return std::make_shared<SoftwareKeyboard>(*frontend.software_keyboard);
|
|
|
|
|
|
|
|
case AppletId::PhotoViewer:
|
|
|
|
|
|
|
|
return std::make_shared<PhotoViewer>(*frontend.photo_viewer);
|
|
|
|
|
|
|
|
case AppletId::LibAppletOff:
|
|
|
|
|
|
|
|
return std::make_shared<WebBrowser>(*frontend.web_browser);
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
UNIMPLEMENTED_MSG(
|
|
|
|
|
|
|
|
"No backend implementation exists for applet_id={:02X}! Falling back to stub applet.",
|
|
|
|
|
|
|
|
static_cast<u8>(id));
|
|
|
|
|
|
|
|
return std::make_shared<StubApplet>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Service::AM::Applets
|
|
|
|
} // namespace Service::AM::Applets
|
|
|
|