am: migrate global state to per-applet state structure

This commit is contained in:
Liam
2024-01-02 18:29:03 -05:00
parent 3155f4e96d
commit 182137a9a4
41 changed files with 692 additions and 753 deletions

View File

@@ -16,6 +16,7 @@
#include "core/hle/kernel/k_event.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/applet_ae.h"
#include "core/hle/service/am/applet_manager.h"
#include "core/hle/service/am/applet_message_queue.h"
#include "core/hle/service/am/applet_oe.h"
#include "core/hle/service/am/frontend/applet_cabinet.h"
@@ -122,21 +123,11 @@ void AppletDataBroker::PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&&
void AppletDataBroker::SignalStateChanged() {
state_changed_event->Signal();
// TODO proper window management
switch (applet_mode) {
case LibraryAppletMode::AllForeground:
case LibraryAppletMode::AllForegroundInitiallyHidden: {
auto applet_oe = system.ServiceManager().GetService<AppletOE>("appletOE");
auto applet_ae = system.ServiceManager().GetService<AppletAE>("appletAE");
if (applet_oe) {
applet_oe->GetMessageQueue()->FocusStateChanged();
break;
}
if (applet_ae) {
applet_ae->GetMessageQueue()->FocusStateChanged();
break;
}
system.GetAppletManager().FocusStateChanged();
break;
}
default:
@@ -255,11 +246,6 @@ void FrontendAppletHolder::SetCurrentAppletId(AppletId applet_id) {
current_applet_id = applet_id;
}
void FrontendAppletHolder::SetDefaultAppletFrontendSet() {
ClearAll();
SetDefaultAppletsIfMissing();
}
void FrontendAppletHolder::SetDefaultAppletsIfMissing() {
if (frontend.cabinet == nullptr) {
frontend.cabinet = std::make_unique<Core::Frontend::DefaultCabinetApplet>();

View File

@@ -188,7 +188,6 @@ public:
void SetFrontendAppletSet(FrontendAppletSet set);
void SetCabinetMode(NFP::CabinetMode mode);
void SetCurrentAppletId(AppletId applet_id);
void SetDefaultAppletFrontendSet();
void SetDefaultAppletsIfMissing();
void ClearAll();