diff options
author | bunnei <bunneidev@gmail.com> | 2023-08-10 06:24:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-10 06:24:31 +0200 |
commit | 9d3a293a4ea17b60146c10e7561c0fd1219fd6c1 (patch) | |
tree | b69936f3e53ee675de0ca21a1dffabd7e71acae0 /src/core/hle/service/vi | |
parent | Merge pull request #11247 from german77/pctl (diff) | |
parent | fs: return result on null outputs (diff) | |
download | yuzu-9d3a293a4ea17b60146c10e7561c0fd1219fd6c1.tar yuzu-9d3a293a4ea17b60146c10e7561c0fd1219fd6c1.tar.gz yuzu-9d3a293a4ea17b60146c10e7561c0fd1219fd6c1.tar.bz2 yuzu-9d3a293a4ea17b60146c10e7561c0fd1219fd6c1.tar.lz yuzu-9d3a293a4ea17b60146c10e7561c0fd1219fd6c1.tar.xz yuzu-9d3a293a4ea17b60146c10e7561c0fd1219fd6c1.tar.zst yuzu-9d3a293a4ea17b60146c10e7561c0fd1219fd6c1.zip |
Diffstat (limited to 'src/core/hle/service/vi')
-rw-r--r-- | src/core/hle/service/vi/display/vi_display.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/service/vi/display/vi_display.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/vi/vi.cpp | 35 |
3 files changed, 25 insertions, 17 deletions
diff --git a/src/core/hle/service/vi/display/vi_display.cpp b/src/core/hle/service/vi/display/vi_display.cpp index 69af2868a..f0b5eff8a 100644 --- a/src/core/hle/service/vi/display/vi_display.cpp +++ b/src/core/hle/service/vi/display/vi_display.cpp @@ -58,14 +58,15 @@ const Layer& Display::GetLayer(std::size_t index) const { return *layers.at(index); } -ResultVal<Kernel::KReadableEvent*> Display::GetVSyncEvent() { +Result Display::GetVSyncEvent(Kernel::KReadableEvent** out_vsync_event) { if (got_vsync_event) { return ResultPermissionDenied; } got_vsync_event = true; - return GetVSyncEventUnchecked(); + *out_vsync_event = GetVSyncEventUnchecked(); + return ResultSuccess; } Kernel::KReadableEvent* Display::GetVSyncEventUnchecked() { diff --git a/src/core/hle/service/vi/display/vi_display.h b/src/core/hle/service/vi/display/vi_display.h index 3f31d1f32..101cbce20 100644 --- a/src/core/hle/service/vi/display/vi_display.h +++ b/src/core/hle/service/vi/display/vi_display.h @@ -85,7 +85,7 @@ public: * @returns The internal Vsync event if it has not yet been retrieved, * VI::ResultPermissionDenied otherwise. */ - [[nodiscard]] ResultVal<Kernel::KReadableEvent*> GetVSyncEvent(); + [[nodiscard]] Result GetVSyncEvent(Kernel::KReadableEvent** out_vsync_event); /// Gets the internal vsync event. Kernel::KReadableEvent* GetVSyncEventUnchecked(); diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 1b193f00c..6bb02393c 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -683,9 +683,9 @@ private: LOG_DEBUG(Service_VI, "called. display_id={}", display_id); - const auto vsync_event = nv_flinger.FindVsyncEvent(display_id); - if (vsync_event.Failed()) { - const auto result = vsync_event.Code(); + Kernel::KReadableEvent* vsync_event{}; + const auto result = nv_flinger.FindVsyncEvent(&vsync_event, display_id); + if (result != ResultSuccess) { if (result == ResultNotFound) { LOG_ERROR(Service_VI, "Vsync event was not found for display_id={}", display_id); } @@ -697,7 +697,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); - rb.PushCopyObjects(*vsync_event); + rb.PushCopyObjects(vsync_event); } void ConvertScalingMode(HLERequestContext& ctx) { @@ -705,15 +705,16 @@ private: const auto mode = rp.PopEnum<NintendoScaleMode>(); LOG_DEBUG(Service_VI, "called mode={}", mode); - const auto converted_mode = ConvertScalingModeImpl(mode); + ConvertedScaleMode converted_mode{}; + const auto result = ConvertScalingModeImpl(&converted_mode, mode); - if (converted_mode.Succeeded()) { + if (result == ResultSuccess) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); - rb.PushEnum(*converted_mode); + rb.PushEnum(converted_mode); } else { IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(converted_mode.Code()); + rb.Push(result); } } @@ -760,18 +761,24 @@ private: rb.Push(alignment); } - static ResultVal<ConvertedScaleMode> ConvertScalingModeImpl(NintendoScaleMode mode) { + static Result ConvertScalingModeImpl(ConvertedScaleMode* out_scaling_mode, + NintendoScaleMode mode) { switch (mode) { case NintendoScaleMode::None: - return ConvertedScaleMode::None; + *out_scaling_mode = ConvertedScaleMode::None; + return ResultSuccess; case NintendoScaleMode::Freeze: - return ConvertedScaleMode::Freeze; + *out_scaling_mode = ConvertedScaleMode::Freeze; + return ResultSuccess; case NintendoScaleMode::ScaleToWindow: - return ConvertedScaleMode::ScaleToWindow; + *out_scaling_mode = ConvertedScaleMode::ScaleToWindow; + return ResultSuccess; case NintendoScaleMode::ScaleAndCrop: - return ConvertedScaleMode::ScaleAndCrop; + *out_scaling_mode = ConvertedScaleMode::ScaleAndCrop; + return ResultSuccess; case NintendoScaleMode::PreserveAspectRatio: - return ConvertedScaleMode::PreserveAspectRatio; + *out_scaling_mode = ConvertedScaleMode::PreserveAspectRatio; + return ResultSuccess; default: LOG_ERROR(Service_VI, "Invalid scaling mode specified, mode={}", mode); return ResultOperationFailed; |