core: Remove specific applets in favor of AppletManager

This commit is contained in:
Zach Hilman 2019-03-11 19:33:49 -04:00
parent 6cea62b756
commit ec0bc3061e
2 changed files with 32 additions and 47 deletions

View File

@ -20,13 +20,18 @@
#include "core/file_sys/registered_cache.h" #include "core/file_sys/registered_cache.h"
#include "core/file_sys/vfs_concat.h" #include "core/file_sys/vfs_concat.h"
#include "core/file_sys/vfs_real.h" #include "core/file_sys/vfs_real.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/gdbstub/gdbstub.h" #include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/scheduler.h" #include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/service/am/applets/software_keyboard.h" #include "core/hle/service/am/applets/applets.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
#include "core/hle/service/sm/sm.h" #include "core/hle/service/sm/sm.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
@ -113,12 +118,7 @@ struct System::Impl {
content_provider = std::make_unique<FileSys::ContentProviderUnion>(); content_provider = std::make_unique<FileSys::ContentProviderUnion>();
/// Create default implementations of applets if one is not provided. /// Create default implementations of applets if one is not provided.
if (profile_selector == nullptr) applet_manager.SetDefaultAppletsIfMissing();
profile_selector = std::make_unique<Core::Frontend::DefaultProfileSelectApplet>();
if (software_keyboard == nullptr)
software_keyboard = std::make_unique<Core::Frontend::DefaultSoftwareKeyboardApplet>();
if (web_browser == nullptr)
web_browser = std::make_unique<Core::Frontend::DefaultWebBrowserApplet>();
auto main_process = Kernel::Process::Create(system, "main"); auto main_process = Kernel::Process::Create(system, "main");
kernel.MakeCurrentProcess(main_process.get()); kernel.MakeCurrentProcess(main_process.get());
@ -224,9 +224,7 @@ struct System::Impl {
app_loader.reset(); app_loader.reset();
// Clear all applets // Clear all applets
profile_selector.reset(); applet_manager.ClearAll();
software_keyboard.reset();
web_browser.reset();
LOG_DEBUG(Core, "Shutdown OK"); LOG_DEBUG(Core, "Shutdown OK");
} }
@ -265,9 +263,7 @@ struct System::Impl {
std::unique_ptr<FileSys::CheatEngine> cheat_engine; std::unique_ptr<FileSys::CheatEngine> cheat_engine;
/// Frontend applets /// Frontend applets
std::unique_ptr<Core::Frontend::ProfileSelectApplet> profile_selector; Service::AM::Applets::AppletManager applet_manager;
std::unique_ptr<Core::Frontend::SoftwareKeyboardApplet> software_keyboard;
std::unique_ptr<Core::Frontend::WebBrowserApplet> web_browser;
/// Service manager /// Service manager
std::shared_ptr<Service::SM::ServiceManager> service_manager; std::shared_ptr<Service::SM::ServiceManager> service_manager;
@ -477,20 +473,20 @@ std::shared_ptr<FileSys::VfsFilesystem> System::GetFilesystem() const {
return impl->virtual_filesystem; return impl->virtual_filesystem;
} }
void System::SetProfileSelector(std::unique_ptr<Frontend::ProfileSelectApplet> applet) { void System::SetAppletFrontendSet(Service::AM::Applets::AppletFrontendSet&& set) {
impl->profile_selector = std::move(applet); impl->applet_manager.SetAppletFrontendSet(std::move(set));
} }
const Frontend::ProfileSelectApplet& System::GetProfileSelector() const { void System::SetDefaultAppletFrontendSet() {
return *impl->profile_selector; impl->applet_manager.SetDefaultAppletFrontendSet();
} }
void System::SetSoftwareKeyboard(std::unique_ptr<Frontend::SoftwareKeyboardApplet> applet) { Service::AM::Applets::AppletManager& System::GetAppletManager() {
impl->software_keyboard = std::move(applet); return impl->applet_manager;
} }
const Frontend::SoftwareKeyboardApplet& System::GetSoftwareKeyboard() const { const Service::AM::Applets::AppletManager& System::GetAppletManager() const {
return *impl->software_keyboard; return impl->applet_manager;
} }
void System::SetContentProvider(std::unique_ptr<FileSys::ContentProviderUnion> provider) { void System::SetContentProvider(std::unique_ptr<FileSys::ContentProviderUnion> provider) {
@ -514,18 +510,6 @@ void System::ClearContentProvider(FileSys::ContentProviderUnionSlot slot) {
impl->content_provider->ClearSlot(slot); impl->content_provider->ClearSlot(slot);
} }
void System::SetWebBrowser(std::unique_ptr<Frontend::WebBrowserApplet> applet) {
impl->web_browser = std::move(applet);
}
Frontend::WebBrowserApplet& System::GetWebBrowser() {
return *impl->web_browser;
}
const Frontend::WebBrowserApplet& System::GetWebBrowser() const {
return *impl->web_browser;
}
System::ResultStatus System::Init(Frontend::EmuWindow& emu_window) { System::ResultStatus System::Init(Frontend::EmuWindow& emu_window) {
return impl->Init(*this, emu_window); return impl->Init(*this, emu_window);
} }

View File

@ -14,9 +14,6 @@
namespace Core::Frontend { namespace Core::Frontend {
class EmuWindow; class EmuWindow;
class ProfileSelectApplet;
class SoftwareKeyboardApplet;
class WebBrowserApplet;
} // namespace Core::Frontend } // namespace Core::Frontend
namespace FileSys { namespace FileSys {
@ -38,9 +35,18 @@ class AppLoader;
enum class ResultStatus : u16; enum class ResultStatus : u16;
} // namespace Loader } // namespace Loader
namespace Service::SM { namespace Service {
namespace AM::Applets {
struct AppletFrontendSet;
class AppletManager;
} // namespace AM::Applets
namespace SM {
class ServiceManager; class ServiceManager;
} // namespace Service::SM } // namespace SM
} // namespace Service
namespace Tegra { namespace Tegra {
class DebugContext; class DebugContext;
@ -260,18 +266,13 @@ public:
void RegisterCheatList(const std::vector<FileSys::CheatList>& list, const std::string& build_id, void RegisterCheatList(const std::vector<FileSys::CheatList>& list, const std::string& build_id,
VAddr code_region_start, VAddr code_region_end); VAddr code_region_start, VAddr code_region_end);
void SetProfileSelector(std::unique_ptr<Frontend::ProfileSelectApplet> applet); void SetAppletFrontendSet(Service::AM::Applets::AppletFrontendSet&& set);
const Frontend::ProfileSelectApplet& GetProfileSelector() const; void SetDefaultAppletFrontendSet();
void SetSoftwareKeyboard(std::unique_ptr<Frontend::SoftwareKeyboardApplet> applet); Service::AM::Applets::AppletManager& GetAppletManager();
const Frontend::SoftwareKeyboardApplet& GetSoftwareKeyboard() const; const Service::AM::Applets::AppletManager& GetAppletManager() const;
void SetWebBrowser(std::unique_ptr<Frontend::WebBrowserApplet> applet);
Frontend::WebBrowserApplet& GetWebBrowser();
const Frontend::WebBrowserApplet& GetWebBrowser() const;
void SetContentProvider(std::unique_ptr<FileSys::ContentProviderUnion> provider); void SetContentProvider(std::unique_ptr<FileSys::ContentProviderUnion> provider);