sm: Relocate the service manager to the System class

Rather than have it live as a global variable, place it into the System class and make it instance-based.
This commit is contained in:
Lioncash 2018-04-12 23:06:21 -04:00
parent bfd1d963ba
commit a78920e60b
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
6 changed files with 69 additions and 41 deletions

View file

@ -19,6 +19,12 @@ namespace AudioCore {
class DspInterface;
}
namespace Service {
namespace SM {
class ServiceManager;
}
} // namespace Service
namespace Core {
class System {
@ -114,6 +120,18 @@ public:
return *dsp_core;
}
/**
* Gets a reference to the service manager.
* @returns A reference to the service manager.
*/
Service::SM::ServiceManager& ServiceManager();
/**
* Gets a const reference to the service manager.
* @returns A const reference to the service manager.
*/
const Service::SM::ServiceManager& ServiceManager() const;
PerfStats perf_stats;
FrameLimiter frame_limiter;
@ -147,10 +165,10 @@ private:
/// AppLoader used to load the current executing application
std::unique_ptr<Loader::AppLoader> app_loader;
///< ARM11 CPU core
/// ARM11 CPU core
std::unique_ptr<ARM_Interface> cpu_core;
///< DSP core
/// DSP core
std::unique_ptr<AudioCore::DspInterface> dsp_core;
/// When true, signals that a reschedule should happen
@ -159,6 +177,9 @@ private:
/// Telemetry session for this emulation session
std::unique_ptr<Core::TelemetrySession> telemetry_session;
/// Service manager
std::shared_ptr<Service::SM::ServiceManager> service_manager;
static System s_instance;
ResultStatus status = ResultStatus::Success;