mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 17:44:26 +01:00
Merge pull request #4726 from lioncash/applet
frontend/controller: Eliminate dependency on the global system instance
This commit is contained in:
commit
f7808f5658
@ -120,7 +120,7 @@ public:
|
|||||||
* Gets the instance of the System singleton class.
|
* Gets the instance of the System singleton class.
|
||||||
* @returns Reference to the instance of the System singleton class.
|
* @returns Reference to the instance of the System singleton class.
|
||||||
*/
|
*/
|
||||||
static System& GetInstance() {
|
[[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance() {
|
||||||
return s_instance;
|
return s_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/core.h"
|
|
||||||
#include "core/frontend/applets/controller.h"
|
#include "core/frontend/applets/controller.h"
|
||||||
#include "core/hle/service/hid/controllers/npad.h"
|
#include "core/hle/service/hid/controllers/npad.h"
|
||||||
#include "core/hle/service/hid/hid.h"
|
#include "core/hle/service/hid/hid.h"
|
||||||
@ -14,6 +13,9 @@ namespace Core::Frontend {
|
|||||||
|
|
||||||
ControllerApplet::~ControllerApplet() = default;
|
ControllerApplet::~ControllerApplet() = default;
|
||||||
|
|
||||||
|
DefaultControllerApplet::DefaultControllerApplet(Service::SM::ServiceManager& service_manager_)
|
||||||
|
: service_manager{service_manager_} {}
|
||||||
|
|
||||||
DefaultControllerApplet::~DefaultControllerApplet() = default;
|
DefaultControllerApplet::~DefaultControllerApplet() = default;
|
||||||
|
|
||||||
void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callback,
|
void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callback,
|
||||||
@ -21,9 +23,7 @@ void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callb
|
|||||||
LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!");
|
LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!");
|
||||||
|
|
||||||
auto& npad =
|
auto& npad =
|
||||||
Core::System::GetInstance()
|
service_manager.GetService<Service::HID::Hid>("hid")
|
||||||
.ServiceManager()
|
|
||||||
.GetService<Service::HID::Hid>("hid")
|
|
||||||
->GetAppletResource()
|
->GetAppletResource()
|
||||||
->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad);
|
->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad);
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
|
namespace Service::SM {
|
||||||
|
class ServiceManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Core::Frontend {
|
namespace Core::Frontend {
|
||||||
|
|
||||||
using BorderColor = std::array<u8, 4>;
|
using BorderColor = std::array<u8, 4>;
|
||||||
@ -39,10 +43,14 @@ public:
|
|||||||
|
|
||||||
class DefaultControllerApplet final : public ControllerApplet {
|
class DefaultControllerApplet final : public ControllerApplet {
|
||||||
public:
|
public:
|
||||||
|
explicit DefaultControllerApplet(Service::SM::ServiceManager& service_manager_);
|
||||||
~DefaultControllerApplet() override;
|
~DefaultControllerApplet() override;
|
||||||
|
|
||||||
void ReconfigureControllers(std::function<void()> callback,
|
void ReconfigureControllers(std::function<void()> callback,
|
||||||
ControllerParameters parameters) const override;
|
ControllerParameters parameters) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Service::SM::ServiceManager& service_manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
||||||
|
@ -206,7 +206,8 @@ void AppletManager::SetDefaultAppletFrontendSet() {
|
|||||||
|
|
||||||
void AppletManager::SetDefaultAppletsIfMissing() {
|
void AppletManager::SetDefaultAppletsIfMissing() {
|
||||||
if (frontend.controller == nullptr) {
|
if (frontend.controller == nullptr) {
|
||||||
frontend.controller = std::make_unique<Core::Frontend::DefaultControllerApplet>();
|
frontend.controller =
|
||||||
|
std::make_unique<Core::Frontend::DefaultControllerApplet>(system.ServiceManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frontend.e_commerce == nullptr) {
|
if (frontend.e_commerce == nullptr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user