1
0
Fork 0
forked from suyu/suyu

service: vi: Move VI results into its own file

This commit is contained in:
Morph 2022-09-25 20:33:25 -04:00
parent 8d4458ef24
commit acc887cc34
2 changed files with 25 additions and 16 deletions

View file

@ -29,16 +29,12 @@
#include "core/hle/service/service.h"
#include "core/hle/service/vi/vi.h"
#include "core/hle/service/vi/vi_m.h"
#include "core/hle/service/vi/vi_results.h"
#include "core/hle/service/vi/vi_s.h"
#include "core/hle/service/vi/vi_u.h"
namespace Service::VI {
constexpr Result ERR_OPERATION_FAILED{ErrorModule::VI, 1};
constexpr Result ERR_PERMISSION_DENIED{ErrorModule::VI, 5};
constexpr Result ERR_UNSUPPORTED{ErrorModule::VI, 6};
constexpr Result ERR_NOT_FOUND{ErrorModule::VI, 7};
struct DisplayInfo {
/// The name of this particular display.
char display_name[0x40]{"Default"};
@ -348,7 +344,7 @@ private:
if (!layer_id) {
LOG_ERROR(Service_VI, "Layer not found! display=0x{:016X}", display);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERR_NOT_FOUND);
rb.Push(ResultNotFound);
return;
}
@ -498,7 +494,7 @@ private:
if (!display_id) {
LOG_ERROR(Service_VI, "Display not found! display_name={}", name);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERR_NOT_FOUND);
rb.Push(ResultNotFound);
return;
}
@ -554,14 +550,14 @@ private:
if (scaling_mode > NintendoScaleMode::PreserveAspectRatio) {
LOG_ERROR(Service_VI, "Invalid scaling mode provided.");
rb.Push(ERR_OPERATION_FAILED);
rb.Push(ResultOperationFailed);
return;
}
if (scaling_mode != NintendoScaleMode::ScaleToWindow &&
scaling_mode != NintendoScaleMode::PreserveAspectRatio) {
LOG_ERROR(Service_VI, "Unsupported scaling mode supplied.");
rb.Push(ERR_UNSUPPORTED);
rb.Push(ResultNotSupported);
return;
}
@ -594,7 +590,7 @@ private:
if (!display_id) {
LOG_ERROR(Service_VI, "Layer not found! layer_id={}", layer_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERR_NOT_FOUND);
rb.Push(ResultNotFound);
return;
}
@ -602,7 +598,7 @@ private:
if (!buffer_queue_id) {
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", *display_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERR_NOT_FOUND);
rb.Push(ResultNotFound);
return;
}
@ -640,7 +636,7 @@ private:
if (!layer_id) {
LOG_ERROR(Service_VI, "Layer not found! display_id={}", display_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERR_NOT_FOUND);
rb.Push(ResultNotFound);
return;
}
@ -648,7 +644,7 @@ private:
if (!buffer_queue_id) {
LOG_ERROR(Service_VI, "Buffer queue id not found! display_id={}", display_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERR_NOT_FOUND);
rb.Push(ResultNotFound);
return;
}
@ -681,7 +677,7 @@ private:
if (!vsync_event) {
LOG_ERROR(Service_VI, "Vsync event was not found for display_id={}", display_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERR_NOT_FOUND);
rb.Push(ResultNotFound);
return;
}
@ -764,7 +760,7 @@ private:
return ConvertedScaleMode::PreserveAspectRatio;
default:
LOG_ERROR(Service_VI, "Invalid scaling mode specified, mode={}", mode);
return ERR_OPERATION_FAILED;
return ResultOperationFailed;
}
}
@ -794,7 +790,7 @@ void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx, Core::System&
if (!IsValidServiceAccess(permission, policy)) {
LOG_ERROR(Service_VI, "Permission denied for policy {}", policy);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ERR_PERMISSION_DENIED);
rb.Push(ResultPermissionDenied);
return;
}

View file

@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/result.h"
namespace Service::VI {
constexpr Result ResultOperationFailed{ErrorModule::VI, 1};
constexpr Result ResultPermissionDenied{ErrorModule::VI, 5};
constexpr Result ResultNotSupported{ErrorModule::VI, 6};
constexpr Result ResultNotFound{ErrorModule::VI, 7};
} // namespace Service::VI