mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-25 23:34:16 +01:00
Implement IApplicationDisplayService::ConvertScalingMode
Utilized by アイリス魔法学園
This commit is contained in:
parent
3f54b83f2d
commit
b43541c1a4
@ -1,5 +1,6 @@
|
|||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||||
|
// Copyright © 2019 Ryujinx Team and Contributors
|
||||||
|
|
||||||
#include <gpu.h>
|
#include <gpu.h>
|
||||||
#include <kernel/types/KProcess.h>
|
#include <kernel/types/KProcess.h>
|
||||||
@ -85,4 +86,27 @@ namespace skyline::service::visrv {
|
|||||||
response.copyHandles.push_back(handle);
|
response.copyHandles.push_back(handle);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result IApplicationDisplayService::ConvertScalingMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
u32 inScalingMode{request.Pop<u32>()};
|
||||||
|
|
||||||
|
std::array<ScalingMode, 5> scalingModeLut{
|
||||||
|
ScalingMode::None,
|
||||||
|
ScalingMode::Freeze,
|
||||||
|
ScalingMode::ScaleToLayer,
|
||||||
|
ScalingMode::ScaleAndCrop,
|
||||||
|
ScalingMode::PreserveAspectRatio,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (scalingModeLut.size() <= inScalingMode)
|
||||||
|
return result::InvalidArgument;
|
||||||
|
|
||||||
|
auto scalingMode{scalingModeLut[inScalingMode]};
|
||||||
|
if (scalingMode != ScalingMode::ScaleToLayer && scalingMode != ScalingMode::PreserveAspectRatio)
|
||||||
|
return result::IllegalOperation;
|
||||||
|
|
||||||
|
response.Push(scalingMode);
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,17 @@ namespace skyline::service::visrv {
|
|||||||
private:
|
private:
|
||||||
PrivilegeLevel level;
|
PrivilegeLevel level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Specifies the method to scale up the layer content to its bounds
|
||||||
|
*/
|
||||||
|
enum class ScalingMode {
|
||||||
|
Freeze = 0,
|
||||||
|
ScaleToLayer = 1,
|
||||||
|
ScaleAndCrop = 2,
|
||||||
|
None = 3,
|
||||||
|
PreserveAspectRatio = 4,
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IApplicationDisplayService(const DeviceState &state, ServiceManager &manager, PrivilegeLevel level);
|
IApplicationDisplayService(const DeviceState &state, ServiceManager &manager, PrivilegeLevel level);
|
||||||
|
|
||||||
@ -72,6 +83,11 @@ namespace skyline::service::visrv {
|
|||||||
*/
|
*/
|
||||||
Result SetLayerScalingMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
Result SetLayerScalingMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Converts an arbitrary scaling mode to a VI scaling mode
|
||||||
|
*/
|
||||||
|
Result ConvertScalingMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns a handle to a KEvent which is triggered every time a frame is drawn
|
* @brief Returns a handle to a KEvent which is triggered every time a frame is drawn
|
||||||
* @url https://switchbrew.org/wiki/Display_services#GetDisplayVsyncEvent
|
* @url https://switchbrew.org/wiki/Display_services#GetDisplayVsyncEvent
|
||||||
|
@ -6,5 +6,6 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
|
||||||
namespace skyline::service::visrv::result {
|
namespace skyline::service::visrv::result {
|
||||||
|
constexpr Result InvalidArgument(114, 1);
|
||||||
constexpr Result IllegalOperation(114, 6);
|
constexpr Result IllegalOperation(114, 6);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user