diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/frontend/framebuffer_layout.cpp | 21 | ||||
-rw-r--r-- | src/core/frontend/framebuffer_layout.h | 15 | ||||
-rw-r--r-- | src/core/hle/service/ldn/ldn.cpp | 10 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | 12 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_gpu.h | 8 | ||||
-rw-r--r-- | src/core/settings.h | 1 |
6 files changed, 63 insertions, 4 deletions
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index d6d2cf3f0..2dc795d56 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -27,9 +27,9 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) { // so just calculate them both even if the other isn't showing. FramebufferLayout res{width, height}; - const float emulation_aspect_ratio{static_cast<float>(ScreenUndocked::Height) / - ScreenUndocked::Width}; - const auto window_aspect_ratio = static_cast<float>(height) / width; + const float window_aspect_ratio = static_cast<float>(height) / width; + const float emulation_aspect_ratio = EmulationAspectRatio( + static_cast<AspectRatio>(Settings::values.aspect_ratio), window_aspect_ratio); const Common::Rectangle<u32> screen_window_area{0, 0, width, height}; Common::Rectangle<u32> screen = MaxRectangle(screen_window_area, emulation_aspect_ratio); @@ -58,4 +58,19 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale) { return DefaultFrameLayout(width, height); } +float EmulationAspectRatio(AspectRatio aspect, float window_aspect_ratio) { + switch (aspect) { + case AspectRatio::Default: + return static_cast<float>(ScreenUndocked::Height) / ScreenUndocked::Width; + case AspectRatio::R4_3: + return 3.0f / 4.0f; + case AspectRatio::R21_9: + return 9.0f / 21.0f; + case AspectRatio::StretchToWindow: + return window_aspect_ratio; + default: + return static_cast<float>(ScreenUndocked::Height) / ScreenUndocked::Width; + } +} + } // namespace Layout diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index d2370adde..1d39c1faf 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h @@ -18,6 +18,13 @@ enum ScreenDocked : u32 { HeightDocked = 1080, }; +enum class AspectRatio { + Default, + R4_3, + R21_9, + StretchToWindow, +}; + /// Describes the layout of the window framebuffer struct FramebufferLayout { u32 width{ScreenUndocked::Width}; @@ -48,4 +55,12 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height); */ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale); +/** + * Convenience method to determine emulation aspect ratio + * @param aspect Represents the index of aspect ratio stored in Settings::values.aspect_ratio + * @param window_aspect_ratio Current window aspect ratio + * @return Emulation render window aspect ratio + */ +float EmulationAspectRatio(AspectRatio aspect, float window_aspect_ratio); + } // namespace Layout diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp index ed5059047..92adde6d4 100644 --- a/src/core/hle/service/ldn/ldn.cpp +++ b/src/core/hle/service/ldn/ldn.cpp @@ -129,12 +129,20 @@ public: {304, nullptr, "Disconnect"}, {400, nullptr, "Initialize"}, {401, nullptr, "Finalize"}, - {402, nullptr, "SetOperationMode"}, + {402, &IUserLocalCommunicationService::Initialize2, "Initialize2"}, // 7.0.0+ }; // clang-format on RegisterHandlers(functions); } + + void Initialize2(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_LDN, "(STUBBED) called"); + // Result success seem make this services start network and continue. + // If we just pass result error then it will stop and maybe try again and again. + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_UNKNOWN); + } }; class LDNS final : public ServiceFramework<LDNS> { diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 6d8bca8bb..f1966ac0e 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp @@ -44,6 +44,8 @@ u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, const std::ve return GetWaitbase(input, output); case IoctlCommand::IocChannelSetTimeoutCommand: return ChannelSetTimeout(input, output); + case IoctlCommand::IocChannelSetTimeslice: + return ChannelSetTimeslice(input, output); default: break; } @@ -228,4 +230,14 @@ u32 nvhost_gpu::ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& return 0; } +u32 nvhost_gpu::ChannelSetTimeslice(const std::vector<u8>& input, std::vector<u8>& output) { + IoctlSetTimeslice params{}; + std::memcpy(¶ms, input.data(), sizeof(IoctlSetTimeslice)); + LOG_INFO(Service_NVDRV, "called, timeslice=0x{:X}", params.timeslice); + + channel_timeslice = params.timeslice; + + return 0; +} + } // namespace Service::Nvidia::Devices diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index d056dd046..2ac74743f 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h @@ -48,6 +48,7 @@ private: IocAllocObjCtxCommand = 0xC0104809, IocChannelGetWaitbaseCommand = 0xC0080003, IocChannelSetTimeoutCommand = 0x40044803, + IocChannelSetTimeslice = 0xC004481D, }; enum class CtxObjects : u32_le { @@ -101,6 +102,11 @@ private: static_assert(sizeof(IoctlChannelSetPriority) == 4, "IoctlChannelSetPriority is incorrect size"); + struct IoctlSetTimeslice { + u32_le timeslice; + }; + static_assert(sizeof(IoctlSetTimeslice) == 4, "IoctlSetTimeslice is incorrect size"); + struct IoctlEventIdControl { u32_le cmd; // 0=disable, 1=enable, 2=clear u32_le id; @@ -174,6 +180,7 @@ private: u64_le user_data{}; IoctlZCullBind zcull_params{}; u32_le channel_priority{}; + u32_le channel_timeslice{}; u32 SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output); u32 SetClientData(const std::vector<u8>& input, std::vector<u8>& output); @@ -188,6 +195,7 @@ private: const std::vector<u8>& input2, IoctlVersion version); u32 GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output); u32 ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output); + u32 ChannelSetTimeslice(const std::vector<u8>& input, std::vector<u8>& output); std::shared_ptr<nvmap> nvmap_dev; u32 assigned_syncpoints{}; diff --git a/src/core/settings.h b/src/core/settings.h index e1a9a0ffa..f837d3fbc 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -429,6 +429,7 @@ struct Values { int vulkan_device; float resolution_factor; + int aspect_ratio; bool use_frame_limit; u16 frame_limit; bool use_disk_shader_cache; |