diff options
| author | 2018-01-22 17:52:47 -0500 | |
|---|---|---|
| committer | 2018-01-22 17:52:47 -0500 | |
| commit | d8bd70d396597d652e8eb891175192ffaf728593 (patch) | |
| tree | 01062c3da533e1b1469fed9781c38aecb91ce3ba /src | |
| parent | Merge pull request #134 from gdkchan/audout_hid_fix (diff) | |
| parent | AppletOE: Stubbed CreateManagedDisplayLayer to create a new layer in the Defa... (diff) | |
| download | yuzu-d8bd70d396597d652e8eb891175192ffaf728593.tar.gz yuzu-d8bd70d396597d652e8eb891175192ffaf728593.tar.xz yuzu-d8bd70d396597d652e8eb891175192ffaf728593.zip | |
Merge pull request #133 from Subv/nvflinger2
AppletOE: Stubbed CreateManagedDisplayLayer to create a new layer in the default display.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 8 | ||||
| -rw-r--r-- | src/core/hle/service/am/applet_oe.cpp | 32 | ||||
| -rw-r--r-- | src/core/hle/service/am/applet_oe.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.h | 3 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi_m.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi_m.h | 2 |
9 files changed, 59 insertions, 17 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index a761bea65..b6896852e 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -8,8 +8,9 @@ | |||
| 8 | namespace Service { | 8 | namespace Service { |
| 9 | namespace AM { | 9 | namespace AM { |
| 10 | 10 | ||
| 11 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 11 | void InstallInterfaces(SM::ServiceManager& service_manager, |
| 12 | std::make_shared<AppletOE>()->InstallAsService(service_manager); | 12 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger) { |
| 13 | std::make_shared<AppletOE>(nvflinger)->InstallAsService(service_manager); | ||
| 13 | } | 14 | } |
| 14 | 15 | ||
| 15 | } // namespace AM | 16 | } // namespace AM |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 63d86cd41..3b8a06c1d 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -4,13 +4,19 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | ||
| 7 | #include "core/hle/service/service.h" | 8 | #include "core/hle/service/service.h" |
| 8 | 9 | ||
| 9 | namespace Service { | 10 | namespace Service { |
| 11 | namespace NVFlinger { | ||
| 12 | class NVFlinger; | ||
| 13 | } | ||
| 14 | |||
| 10 | namespace AM { | 15 | namespace AM { |
| 11 | 16 | ||
| 12 | /// Registers all AM services with the specified service manager. | 17 | /// Registers all AM services with the specified service manager. |
| 13 | void InstallInterfaces(SM::ServiceManager& service_manager); | 18 | void InstallInterfaces(SM::ServiceManager& service_manager, |
| 19 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger); | ||
| 14 | 20 | ||
| 15 | } // namespace AM | 21 | } // namespace AM |
| 16 | } // namespace Service | 22 | } // namespace Service |
diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp index b4a6ad232..7d16b45f3 100644 --- a/src/core/hle/service/am/applet_oe.cpp +++ b/src/core/hle/service/am/applet_oe.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "core/hle/kernel/event.h" | 7 | #include "core/hle/kernel/event.h" |
| 8 | #include "core/hle/service/am/applet_oe.h" | 8 | #include "core/hle/service/am/applet_oe.h" |
| 9 | #include "core/hle/service/apm/apm.h" | 9 | #include "core/hle/service/apm/apm.h" |
| 10 | #include "core/hle/service/nvflinger/nvflinger.h" | ||
| 10 | 11 | ||
| 11 | namespace Service { | 12 | namespace Service { |
| 12 | namespace AM { | 13 | namespace AM { |
| @@ -53,7 +54,8 @@ public: | |||
| 53 | 54 | ||
| 54 | class ISelfController final : public ServiceFramework<ISelfController> { | 55 | class ISelfController final : public ServiceFramework<ISelfController> { |
| 55 | public: | 56 | public: |
| 56 | ISelfController() : ServiceFramework("ISelfController") { | 57 | ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) |
| 58 | : ServiceFramework("ISelfController"), nvflinger(std::move(nvflinger)) { | ||
| 57 | static const FunctionInfo functions[] = { | 59 | static const FunctionInfo functions[] = { |
| 58 | {1, &ISelfController::LockExit, "LockExit"}, | 60 | {1, &ISelfController::LockExit, "LockExit"}, |
| 59 | {2, &ISelfController::UnlockExit, "UnlockExit"}, | 61 | {2, &ISelfController::UnlockExit, "UnlockExit"}, |
| @@ -65,6 +67,7 @@ public: | |||
| 65 | {14, &ISelfController::SetRestartMessageEnabled, "SetRestartMessageEnabled"}, | 67 | {14, &ISelfController::SetRestartMessageEnabled, "SetRestartMessageEnabled"}, |
| 66 | {16, &ISelfController::SetOutOfFocusSuspendingEnabled, | 68 | {16, &ISelfController::SetOutOfFocusSuspendingEnabled, |
| 67 | "SetOutOfFocusSuspendingEnabled"}, | 69 | "SetOutOfFocusSuspendingEnabled"}, |
| 70 | {40, &ISelfController::CreateManagedDisplayLayer, "CreateManagedDisplayLayer"}, | ||
| 68 | }; | 71 | }; |
| 69 | RegisterHandlers(functions); | 72 | RegisterHandlers(functions); |
| 70 | } | 73 | } |
| @@ -144,6 +147,21 @@ private: | |||
| 144 | 147 | ||
| 145 | LOG_WARNING(Service, "(STUBBED) called"); | 148 | LOG_WARNING(Service, "(STUBBED) called"); |
| 146 | } | 149 | } |
| 150 | |||
| 151 | void CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) { | ||
| 152 | // TODO(Subv): Find out how AM determines the display to use, for now just create the layer | ||
| 153 | // in the Default display. | ||
| 154 | u64 display_id = nvflinger->OpenDisplay("Default"); | ||
| 155 | u64 layer_id = nvflinger->CreateLayer(display_id); | ||
| 156 | |||
| 157 | IPC::RequestBuilder rb{ctx, 4}; | ||
| 158 | rb.Push(RESULT_SUCCESS); | ||
| 159 | rb.Push(layer_id); | ||
| 160 | |||
| 161 | LOG_WARNING(Service, "(STUBBED) called"); | ||
| 162 | } | ||
| 163 | |||
| 164 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger; | ||
| 147 | }; | 165 | }; |
| 148 | 166 | ||
| 149 | class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { | 167 | class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { |
| @@ -367,7 +385,8 @@ public: | |||
| 367 | 385 | ||
| 368 | class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { | 386 | class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { |
| 369 | public: | 387 | public: |
| 370 | IApplicationProxy() : ServiceFramework("IApplicationProxy") { | 388 | IApplicationProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) |
| 389 | : ServiceFramework("IApplicationProxy"), nvflinger(std::move(nvflinger)) { | ||
| 371 | static const FunctionInfo functions[] = { | 390 | static const FunctionInfo functions[] = { |
| 372 | {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, | 391 | {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, |
| 373 | {1, &IApplicationProxy::GetSelfController, "GetSelfController"}, | 392 | {1, &IApplicationProxy::GetSelfController, "GetSelfController"}, |
| @@ -413,7 +432,7 @@ private: | |||
| 413 | void GetSelfController(Kernel::HLERequestContext& ctx) { | 432 | void GetSelfController(Kernel::HLERequestContext& ctx) { |
| 414 | IPC::RequestBuilder rb{ctx, 2, 0, 0, 1}; | 433 | IPC::RequestBuilder rb{ctx, 2, 0, 0, 1}; |
| 415 | rb.Push(RESULT_SUCCESS); | 434 | rb.Push(RESULT_SUCCESS); |
| 416 | rb.PushIpcInterface<ISelfController>(); | 435 | rb.PushIpcInterface<ISelfController>(nvflinger); |
| 417 | LOG_DEBUG(Service, "called"); | 436 | LOG_DEBUG(Service, "called"); |
| 418 | } | 437 | } |
| 419 | 438 | ||
| @@ -437,16 +456,19 @@ private: | |||
| 437 | rb.PushIpcInterface<IApplicationFunctions>(); | 456 | rb.PushIpcInterface<IApplicationFunctions>(); |
| 438 | LOG_DEBUG(Service, "called"); | 457 | LOG_DEBUG(Service, "called"); |
| 439 | } | 458 | } |
| 459 | |||
| 460 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger; | ||
| 440 | }; | 461 | }; |
| 441 | 462 | ||
| 442 | void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { | 463 | void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { |
| 443 | IPC::RequestBuilder rb{ctx, 2, 0, 0, 1}; | 464 | IPC::RequestBuilder rb{ctx, 2, 0, 0, 1}; |
| 444 | rb.Push(RESULT_SUCCESS); | 465 | rb.Push(RESULT_SUCCESS); |
| 445 | rb.PushIpcInterface<IApplicationProxy>(); | 466 | rb.PushIpcInterface<IApplicationProxy>(nvflinger); |
| 446 | LOG_DEBUG(Service, "called"); | 467 | LOG_DEBUG(Service, "called"); |
| 447 | } | 468 | } |
| 448 | 469 | ||
| 449 | AppletOE::AppletOE() : ServiceFramework("appletOE") { | 470 | AppletOE::AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) |
| 471 | : ServiceFramework("appletOE"), nvflinger(std::move(nvflinger)) { | ||
| 450 | static const FunctionInfo functions[] = { | 472 | static const FunctionInfo functions[] = { |
| 451 | {0x00000000, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"}, | 473 | {0x00000000, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"}, |
| 452 | }; | 474 | }; |
diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h index 6ee5b0e9f..8083135c3 100644 --- a/src/core/hle/service/am/applet_oe.h +++ b/src/core/hle/service/am/applet_oe.h | |||
| @@ -4,10 +4,15 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | ||
| 7 | #include "core/hle/kernel/hle_ipc.h" | 8 | #include "core/hle/kernel/hle_ipc.h" |
| 8 | #include "core/hle/service/service.h" | 9 | #include "core/hle/service/service.h" |
| 9 | 10 | ||
| 10 | namespace Service { | 11 | namespace Service { |
| 12 | namespace NVFlinger { | ||
| 13 | class NVFlinger; | ||
| 14 | } | ||
| 15 | |||
| 11 | namespace AM { | 16 | namespace AM { |
| 12 | 17 | ||
| 13 | // TODO: Add more languages | 18 | // TODO: Add more languages |
| @@ -18,11 +23,13 @@ enum SystemLanguage { | |||
| 18 | 23 | ||
| 19 | class AppletOE final : public ServiceFramework<AppletOE> { | 24 | class AppletOE final : public ServiceFramework<AppletOE> { |
| 20 | public: | 25 | public: |
| 21 | AppletOE(); | 26 | AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); |
| 22 | ~AppletOE() = default; | 27 | ~AppletOE() = default; |
| 23 | 28 | ||
| 24 | private: | 29 | private: |
| 25 | void OpenApplicationProxy(Kernel::HLERequestContext& ctx); | 30 | void OpenApplicationProxy(Kernel::HLERequestContext& ctx); |
| 31 | |||
| 32 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger; | ||
| 26 | }; | 33 | }; |
| 27 | 34 | ||
| 28 | } // namespace AM | 35 | } // namespace AM |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 3f5ce56c6..1b8565351 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -165,11 +165,15 @@ void AddNamedPort(std::string name, SharedPtr<ClientPort> port) { | |||
| 165 | 165 | ||
| 166 | /// Initialize ServiceManager | 166 | /// Initialize ServiceManager |
| 167 | void Init() { | 167 | void Init() { |
| 168 | // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it | ||
| 169 | // here and pass it into the respective InstallInterfaces functions. | ||
| 170 | auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>(); | ||
| 171 | |||
| 168 | SM::g_service_manager = std::make_shared<SM::ServiceManager>(); | 172 | SM::g_service_manager = std::make_shared<SM::ServiceManager>(); |
| 169 | SM::ServiceManager::InstallInterfaces(SM::g_service_manager); | 173 | SM::ServiceManager::InstallInterfaces(SM::g_service_manager); |
| 170 | 174 | ||
| 171 | Account::InstallInterfaces(*SM::g_service_manager); | 175 | Account::InstallInterfaces(*SM::g_service_manager); |
| 172 | AM::InstallInterfaces(*SM::g_service_manager); | 176 | AM::InstallInterfaces(*SM::g_service_manager, nv_flinger); |
| 173 | AOC::InstallInterfaces(*SM::g_service_manager); | 177 | AOC::InstallInterfaces(*SM::g_service_manager); |
| 174 | APM::InstallInterfaces(*SM::g_service_manager); | 178 | APM::InstallInterfaces(*SM::g_service_manager); |
| 175 | Audio::InstallInterfaces(*SM::g_service_manager); | 179 | Audio::InstallInterfaces(*SM::g_service_manager); |
| @@ -180,7 +184,7 @@ void Init() { | |||
| 180 | PCTL::InstallInterfaces(*SM::g_service_manager); | 184 | PCTL::InstallInterfaces(*SM::g_service_manager); |
| 181 | Sockets::InstallInterfaces(*SM::g_service_manager); | 185 | Sockets::InstallInterfaces(*SM::g_service_manager); |
| 182 | Time::InstallInterfaces(*SM::g_service_manager); | 186 | Time::InstallInterfaces(*SM::g_service_manager); |
| 183 | VI::InstallInterfaces(*SM::g_service_manager); | 187 | VI::InstallInterfaces(*SM::g_service_manager, nv_flinger); |
| 184 | Set::InstallInterfaces(*SM::g_service_manager); | 188 | Set::InstallInterfaces(*SM::g_service_manager); |
| 185 | 189 | ||
| 186 | LOG_DEBUG(Service, "initialized OK"); | 190 | LOG_DEBUG(Service, "initialized OK"); |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index e0bfad290..6576f81db 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -753,8 +753,9 @@ IApplicationDisplayService::IApplicationDisplayService( | |||
| 753 | RegisterHandlers(functions); | 753 | RegisterHandlers(functions); |
| 754 | } | 754 | } |
| 755 | 755 | ||
| 756 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 756 | void InstallInterfaces(SM::ServiceManager& service_manager, |
| 757 | std::make_shared<VI_M>()->InstallAsService(service_manager); | 757 | std::shared_ptr<NVFlinger::NVFlinger> nv_flinger) { |
| 758 | std::make_shared<VI_M>(nv_flinger)->InstallAsService(service_manager); | ||
| 758 | } | 759 | } |
| 759 | 760 | ||
| 760 | } // namespace VI | 761 | } // namespace VI |
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h index 5e9b7e6cf..a6e084f87 100644 --- a/src/core/hle/service/vi/vi.h +++ b/src/core/hle/service/vi/vi.h | |||
| @@ -39,7 +39,8 @@ private: | |||
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | /// Registers all VI services with the specified service manager. | 41 | /// Registers all VI services with the specified service manager. |
| 42 | void InstallInterfaces(SM::ServiceManager& service_manager); | 42 | void InstallInterfaces(SM::ServiceManager& service_manager, |
| 43 | std::shared_ptr<NVFlinger::NVFlinger> nv_flinger); | ||
| 43 | 44 | ||
| 44 | } // namespace VI | 45 | } // namespace VI |
| 45 | } // namespace Service | 46 | } // namespace Service |
diff --git a/src/core/hle/service/vi/vi_m.cpp b/src/core/hle/service/vi/vi_m.cpp index 6deedf842..20b24658e 100644 --- a/src/core/hle/service/vi/vi_m.cpp +++ b/src/core/hle/service/vi/vi_m.cpp | |||
| @@ -17,13 +17,13 @@ void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) { | |||
| 17 | rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger); | 17 | rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | VI_M::VI_M() : ServiceFramework("vi:m") { | 20 | VI_M::VI_M(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger) |
| 21 | : ServiceFramework("vi:m"), nv_flinger(std::move(nv_flinger)) { | ||
| 21 | static const FunctionInfo functions[] = { | 22 | static const FunctionInfo functions[] = { |
| 22 | {2, &VI_M::GetDisplayService, "GetDisplayService"}, | 23 | {2, &VI_M::GetDisplayService, "GetDisplayService"}, |
| 23 | {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, | 24 | {3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, |
| 24 | }; | 25 | }; |
| 25 | RegisterHandlers(functions); | 26 | RegisterHandlers(functions); |
| 26 | nv_flinger = std::make_shared<NVFlinger::NVFlinger>(); | ||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | } // namespace VI | 29 | } // namespace VI |
diff --git a/src/core/hle/service/vi/vi_m.h b/src/core/hle/service/vi/vi_m.h index ebe79d5c7..e5319b1e7 100644 --- a/src/core/hle/service/vi/vi_m.h +++ b/src/core/hle/service/vi/vi_m.h | |||
| @@ -16,7 +16,7 @@ namespace VI { | |||
| 16 | 16 | ||
| 17 | class VI_M final : public ServiceFramework<VI_M> { | 17 | class VI_M final : public ServiceFramework<VI_M> { |
| 18 | public: | 18 | public: |
| 19 | VI_M(); | 19 | VI_M(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger); |
| 20 | ~VI_M() = default; | 20 | ~VI_M() = default; |
| 21 | 21 | ||
| 22 | private: | 22 | private: |