diff options
author | Lioncash <mathew1800@gmail.com> | 2019-01-05 01:55:01 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-01-05 03:45:18 +0100 |
commit | 56e51da1d90010ee5cc9f3c278d278d42f438a88 (patch) | |
tree | e6b501e4b73a7b42418db5684d7d55c6c8429809 /src/core/hle/service | |
parent | service/vi: Unstub IApplicationDisplayService' SetLayerScalingMode() (diff) | |
download | yuzu-56e51da1d90010ee5cc9f3c278d278d42f438a88.tar yuzu-56e51da1d90010ee5cc9f3c278d278d42f438a88.tar.gz yuzu-56e51da1d90010ee5cc9f3c278d278d42f438a88.tar.bz2 yuzu-56e51da1d90010ee5cc9f3c278d278d42f438a88.tar.lz yuzu-56e51da1d90010ee5cc9f3c278d278d42f438a88.tar.xz yuzu-56e51da1d90010ee5cc9f3c278d278d42f438a88.tar.zst yuzu-56e51da1d90010ee5cc9f3c278d278d42f438a88.zip |
Diffstat (limited to 'src/core/hle/service')
-rw-r--r-- | src/core/hle/service/vi/vi.cpp | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 266909ba4..b0ae074c9 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -1003,7 +1003,7 @@ private: const u64 unknown = rp.Pop<u64>(); LOG_DEBUG(Service_VI, "called. scaling_mode=0x{:08X}, unknown=0x{:016X}", - static_cast<u32>(scaling_mode), unknown); + static_cast<u32>(scaling_mode), unknown); IPC::ResponseBuilder rb{ctx, 2}; @@ -1102,31 +1102,35 @@ private: void ConvertScalingMode(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - auto mode = rp.PopEnum<NintendoScaleMode>(); + const auto mode = rp.PopEnum<NintendoScaleMode>(); LOG_DEBUG(Service_VI, "called mode={}", static_cast<u32>(mode)); - IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(RESULT_SUCCESS); + const auto converted_mode = ConvertScalingModeImpl(mode); + + if (converted_mode.Succeeded()) { + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(RESULT_SUCCESS); + rb.PushEnum(*converted_mode); + } else { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(converted_mode.Code()); + } + } + + static ResultVal<ConvertedScaleMode> ConvertScalingModeImpl(NintendoScaleMode mode) { switch (mode) { case NintendoScaleMode::None: - rb.PushEnum(ConvertedScaleMode::None); - break; + return MakeResult(ConvertedScaleMode::None); case NintendoScaleMode::Freeze: - rb.PushEnum(ConvertedScaleMode::Freeze); - break; + return MakeResult(ConvertedScaleMode::Freeze); case NintendoScaleMode::ScaleToWindow: - rb.PushEnum(ConvertedScaleMode::ScaleToWindow); - break; + return MakeResult(ConvertedScaleMode::ScaleToWindow); case NintendoScaleMode::Crop: - rb.PushEnum(ConvertedScaleMode::Crop); - break; + return MakeResult(ConvertedScaleMode::Crop); case NintendoScaleMode::NoCrop: - rb.PushEnum(ConvertedScaleMode::NoCrop); - break; + return MakeResult(ConvertedScaleMode::NoCrop); default: - UNIMPLEMENTED_MSG("Unknown scaling mode {}", static_cast<u32>(mode)); - rb.PushEnum(ConvertedScaleMode::None); - break; + return ERR_OPERATION_FAILED; } } |