From 409290768726c5864eb2c5283ebd41cfeb2fa8d7 Mon Sep 17 00:00:00 2001
From: raven02 <jacky.kktsui@yahoo.com.hk>
Date: Mon, 17 Sep 2018 23:19:31 +0800
Subject: [PATCH] Implement ISystemDisplayService::GetDisplayMode

---
 src/core/hle/service/vi/vi.cpp | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index cf94b00e6..015b42cfd 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -609,7 +609,7 @@ public:
             {3000, nullptr, "ListDisplayModes"},
             {3001, nullptr, "ListDisplayRgbRanges"},
             {3002, nullptr, "ListDisplayContentTypes"},
-            {3200, nullptr, "GetDisplayMode"},
+            {3200, &ISystemDisplayService::GetDisplayMode, "GetDisplayMode"},
             {3201, nullptr, "SetDisplayMode"},
             {3202, nullptr, "GetDisplayUnderscan"},
             {3203, nullptr, "SetDisplayUnderscan"},
@@ -660,6 +660,24 @@ private:
         LOG_WARNING(Service_VI, "(STUBBED) called, layer_id=0x{:08X}, visibility={}", layer_id,
                     visibility);
     }
+
+    void GetDisplayMode(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 6};
+        rb.Push(RESULT_SUCCESS);
+
+        if (Settings::values.use_docked_mode) {
+            rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth));
+            rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight));
+        } else {
+            rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth));
+            rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight));
+        }
+
+        rb.PushRaw<float>(60.0f);
+        rb.Push<u32>(0);
+
+        LOG_DEBUG(Service_VI, "called");
+    }
 };
 
 class IManagerDisplayService final : public ServiceFramework<IManagerDisplayService> {