summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2019-01-04 19:31:14 -0500
committerGravatar Lioncash2019-01-04 21:45:14 -0500
commit40aa1ea9f983130c407fda20da14c5399d6bb12b (patch)
treedb1f9d21eb1228bb840365a517e1c7f1ea336097 /src
parentMerge pull request #1984 from ogniK5377/remove-pulse (diff)
downloadyuzu-40aa1ea9f983130c407fda20da14c5399d6bb12b.tar.gz
yuzu-40aa1ea9f983130c407fda20da14c5399d6bb12b.tar.xz
yuzu-40aa1ea9f983130c407fda20da14c5399d6bb12b.zip
service/vi: Unstub IApplicationDisplayService' SetLayerScalingMode()
This appears to only check if the scaling mode can actually be handled, rather than actually setting the scaling mode for the layer. This implements the same error handling performed on the passed in values.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/vi/vi.cpp59
1 files changed, 38 insertions, 21 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 8528925ec..266909ba4 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -32,6 +32,9 @@
32 32
33namespace Service::VI { 33namespace Service::VI {
34 34
35constexpr ResultCode ERR_OPERATION_FAILED{ErrorModule::VI, 1};
36constexpr ResultCode ERR_UNSUPPORTED{ErrorModule::VI, 6};
37
35struct DisplayInfo { 38struct DisplayInfo {
36 /// The name of this particular display. 39 /// The name of this particular display.
37 char display_name[0x40]{"Default"}; 40 char display_name[0x40]{"Default"};
@@ -874,6 +877,24 @@ public:
874 ~IApplicationDisplayService() = default; 877 ~IApplicationDisplayService() = default;
875 878
876private: 879private:
880 enum class ConvertedScaleMode : u64 {
881 None = 0, // VI seems to name this as "Unknown" but lots of games pass it, assume it's no
882 // scaling/default
883 Freeze = 1,
884 ScaleToWindow = 2,
885 Crop = 3,
886 NoCrop = 4,
887 };
888
889 // This struct is different, currently it's 1:1 but this might change in the future.
890 enum class NintendoScaleMode : u32 {
891 None = 0,
892 Freeze = 1,
893 ScaleToWindow = 2,
894 Crop = 3,
895 NoCrop = 4,
896 };
897
877 void GetRelayService(Kernel::HLERequestContext& ctx) { 898 void GetRelayService(Kernel::HLERequestContext& ctx) {
878 LOG_WARNING(Service_VI, "(STUBBED) called"); 899 LOG_WARNING(Service_VI, "(STUBBED) called");
879 900
@@ -978,13 +999,27 @@ private:
978 999
979 void SetLayerScalingMode(Kernel::HLERequestContext& ctx) { 1000 void SetLayerScalingMode(Kernel::HLERequestContext& ctx) {
980 IPC::RequestParser rp{ctx}; 1001 IPC::RequestParser rp{ctx};
981 const u32 scaling_mode = rp.Pop<u32>(); 1002 const auto scaling_mode = rp.PopEnum<NintendoScaleMode>();
982 const u64 unknown = rp.Pop<u64>(); 1003 const u64 unknown = rp.Pop<u64>();
983 1004
984 LOG_WARNING(Service_VI, "(STUBBED) called. scaling_mode=0x{:08X}, unknown=0x{:016X}", 1005 LOG_DEBUG(Service_VI, "called. scaling_mode=0x{:08X}, unknown=0x{:016X}",
985 scaling_mode, unknown); 1006 static_cast<u32>(scaling_mode), unknown);
986 1007
987 IPC::ResponseBuilder rb{ctx, 2}; 1008 IPC::ResponseBuilder rb{ctx, 2};
1009
1010 if (scaling_mode > NintendoScaleMode::NoCrop) {
1011 LOG_ERROR(Service_VI, "Invalid scaling mode provided.");
1012 rb.Push(ERR_OPERATION_FAILED);
1013 return;
1014 }
1015
1016 if (scaling_mode != NintendoScaleMode::ScaleToWindow &&
1017 scaling_mode != NintendoScaleMode::NoCrop) {
1018 LOG_ERROR(Service_VI, "Unsupported scaling mode supplied.");
1019 rb.Push(ERR_UNSUPPORTED);
1020 return;
1021 }
1022
988 rb.Push(RESULT_SUCCESS); 1023 rb.Push(RESULT_SUCCESS);
989 } 1024 }
990 1025
@@ -1065,24 +1100,6 @@ private:
1065 rb.PushCopyObjects(vsync_event); 1100 rb.PushCopyObjects(vsync_event);
1066 } 1101 }
1067 1102
1068 enum class ConvertedScaleMode : u64 {
1069 None = 0, // VI seems to name this as "Unknown" but lots of games pass it, assume it's no
1070 // scaling/default
1071 Freeze = 1,
1072 ScaleToWindow = 2,
1073 Crop = 3,
1074 NoCrop = 4,
1075 };
1076
1077 // This struct is different, currently it's 1:1 but this might change in the future.
1078 enum class NintendoScaleMode : u32 {
1079 None = 0,
1080 Freeze = 1,
1081 ScaleToWindow = 2,
1082 Crop = 3,
1083 NoCrop = 4,
1084 };
1085
1086 void ConvertScalingMode(Kernel::HLERequestContext& ctx) { 1103 void ConvertScalingMode(Kernel::HLERequestContext& ctx) {
1087 IPC::RequestParser rp{ctx}; 1104 IPC::RequestParser rp{ctx};
1088 auto mode = rp.PopEnum<NintendoScaleMode>(); 1105 auto mode = rp.PopEnum<NintendoScaleMode>();