diff options
| author | 2019-01-04 20:32:29 -0500 | |
|---|---|---|
| committer | 2019-01-04 21:45:18 -0500 | |
| commit | 9e8737b5355c63f55885db078a385cd3e0eb2628 (patch) | |
| tree | 68538b34b67861fc804723ffe70af81a76909795 /src | |
| parent | service/vi: Factor out scaling mode conversions from the IPC function itself (diff) | |
| download | yuzu-9e8737b5355c63f55885db078a385cd3e0eb2628.tar.gz yuzu-9e8737b5355c63f55885db078a385cd3e0eb2628.tar.xz yuzu-9e8737b5355c63f55885db078a385cd3e0eb2628.zip | |
service/vi: Correct scaling mode conversions
These values are not equivalent, based off RE. The internal value is put
into a lookup table with the following values:
[3, 0, 1, 2, 4]
So the values absolutely do not map 1:1 like the comment was indicating.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index b0ae074c9..a295a288b 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -878,21 +878,19 @@ public: | |||
| 878 | 878 | ||
| 879 | private: | 879 | private: |
| 880 | enum class ConvertedScaleMode : u64 { | 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 | 881 | Freeze = 0, |
| 882 | // scaling/default | 882 | ScaleToWindow = 1, |
| 883 | Freeze = 1, | 883 | ScaleAndCrop = 2, |
| 884 | ScaleToWindow = 2, | 884 | None = 3, |
| 885 | Crop = 3, | 885 | PreserveAspectRatio = 4, |
| 886 | NoCrop = 4, | ||
| 887 | }; | 886 | }; |
| 888 | 887 | ||
| 889 | // This struct is different, currently it's 1:1 but this might change in the future. | ||
| 890 | enum class NintendoScaleMode : u32 { | 888 | enum class NintendoScaleMode : u32 { |
| 891 | None = 0, | 889 | None = 0, |
| 892 | Freeze = 1, | 890 | Freeze = 1, |
| 893 | ScaleToWindow = 2, | 891 | ScaleToWindow = 2, |
| 894 | Crop = 3, | 892 | ScaleAndCrop = 3, |
| 895 | NoCrop = 4, | 893 | PreserveAspectRatio = 4, |
| 896 | }; | 894 | }; |
| 897 | 895 | ||
| 898 | void GetRelayService(Kernel::HLERequestContext& ctx) { | 896 | void GetRelayService(Kernel::HLERequestContext& ctx) { |
| @@ -1007,14 +1005,14 @@ private: | |||
| 1007 | 1005 | ||
| 1008 | IPC::ResponseBuilder rb{ctx, 2}; | 1006 | IPC::ResponseBuilder rb{ctx, 2}; |
| 1009 | 1007 | ||
| 1010 | if (scaling_mode > NintendoScaleMode::NoCrop) { | 1008 | if (scaling_mode > NintendoScaleMode::PreserveAspectRatio) { |
| 1011 | LOG_ERROR(Service_VI, "Invalid scaling mode provided."); | 1009 | LOG_ERROR(Service_VI, "Invalid scaling mode provided."); |
| 1012 | rb.Push(ERR_OPERATION_FAILED); | 1010 | rb.Push(ERR_OPERATION_FAILED); |
| 1013 | return; | 1011 | return; |
| 1014 | } | 1012 | } |
| 1015 | 1013 | ||
| 1016 | if (scaling_mode != NintendoScaleMode::ScaleToWindow && | 1014 | if (scaling_mode != NintendoScaleMode::ScaleToWindow && |
| 1017 | scaling_mode != NintendoScaleMode::NoCrop) { | 1015 | scaling_mode != NintendoScaleMode::PreserveAspectRatio) { |
| 1018 | LOG_ERROR(Service_VI, "Unsupported scaling mode supplied."); | 1016 | LOG_ERROR(Service_VI, "Unsupported scaling mode supplied."); |
| 1019 | rb.Push(ERR_UNSUPPORTED); | 1017 | rb.Push(ERR_UNSUPPORTED); |
| 1020 | return; | 1018 | return; |
| @@ -1125,10 +1123,10 @@ private: | |||
| 1125 | return MakeResult(ConvertedScaleMode::Freeze); | 1123 | return MakeResult(ConvertedScaleMode::Freeze); |
| 1126 | case NintendoScaleMode::ScaleToWindow: | 1124 | case NintendoScaleMode::ScaleToWindow: |
| 1127 | return MakeResult(ConvertedScaleMode::ScaleToWindow); | 1125 | return MakeResult(ConvertedScaleMode::ScaleToWindow); |
| 1128 | case NintendoScaleMode::Crop: | 1126 | case NintendoScaleMode::ScaleAndCrop: |
| 1129 | return MakeResult(ConvertedScaleMode::Crop); | 1127 | return MakeResult(ConvertedScaleMode::ScaleAndCrop); |
| 1130 | case NintendoScaleMode::NoCrop: | 1128 | case NintendoScaleMode::PreserveAspectRatio: |
| 1131 | return MakeResult(ConvertedScaleMode::NoCrop); | 1129 | return MakeResult(ConvertedScaleMode::PreserveAspectRatio); |
| 1132 | default: | 1130 | default: |
| 1133 | return ERR_OPERATION_FAILED; | 1131 | return ERR_OPERATION_FAILED; |
| 1134 | } | 1132 | } |