summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp18
-rw-r--r--src/core/hle/service/hid/hidbus.cpp24
-rw-r--r--src/core/hle/service/hid/hidbus/ringcon.cpp8
-rw-r--r--src/core/hle/service/hid/hidbus/ringcon.h4
-rw-r--r--src/core/hle/service/hid/irs.cpp18
-rw-r--r--src/core/hle/service/nfc/nfc_device.cpp7
-rw-r--r--src/core/hle/service/nfp/nfp_device.cpp7
-rw-r--r--src/core/hle/service/nifm/nifm.cpp88
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp8
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.h2
10 files changed, 128 insertions, 56 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 713f8e0c6..84edc8839 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -272,6 +272,8 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
}
break;
case Core::HID::NpadStyleIndex::JoyconLeft:
+ shared_memory->fullkey_color.attribute = ColorAttribute::Ok;
+ shared_memory->fullkey_color.fullkey = body_colors.left;
shared_memory->joycon_color.attribute = ColorAttribute::Ok;
shared_memory->joycon_color.left = body_colors.left;
shared_memory->battery_level_dual = battery_level.left.battery_level;
@@ -285,6 +287,8 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
shared_memory->sixaxis_left_properties.is_newly_assigned.Assign(1);
break;
case Core::HID::NpadStyleIndex::JoyconRight:
+ shared_memory->fullkey_color.attribute = ColorAttribute::Ok;
+ shared_memory->fullkey_color.fullkey = body_colors.right;
shared_memory->joycon_color.attribute = ColorAttribute::Ok;
shared_memory->joycon_color.right = body_colors.right;
shared_memory->battery_level_right = battery_level.right.battery_level;
@@ -332,6 +336,20 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
controller.is_connected = true;
controller.device->Connect();
+ controller.device->SetLedPattern();
+ if (controller_type == Core::HID::NpadStyleIndex::JoyconDual) {
+ if (controller.is_dual_left_connected) {
+ controller.device->SetPollingMode(Core::HID::EmulatedDeviceIndex::LeftIndex,
+ Common::Input::PollingMode::Active);
+ }
+ if (controller.is_dual_right_connected) {
+ controller.device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::Active);
+ }
+ } else {
+ controller.device->SetPollingMode(Core::HID::EmulatedDeviceIndex::AllDevices,
+ Common::Input::PollingMode::Active);
+ }
SignalStyleSetChangedEvent(npad_id);
WriteEmptyEntry(controller.shared_memory);
}
diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp
index e5e50845f..17252a84a 100644
--- a/src/core/hle/service/hid/hidbus.cpp
+++ b/src/core/hle/service/hid/hidbus.cpp
@@ -297,13 +297,13 @@ void HidBus::EnableExternalDevice(Kernel::HLERequestContext& ctx) {
const auto parameters{rp.PopRaw<Parameters>()};
- LOG_INFO(Service_HID,
- "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
- "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}",
- parameters.enable, parameters.bus_handle.abstracted_pad_id,
- parameters.bus_handle.bus_type, parameters.bus_handle.internal_index,
- parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval,
- parameters.applet_resource_user_id);
+ LOG_DEBUG(Service_HID,
+ "called, enable={}, abstracted_pad_id={}, bus_type={}, internal_index={}, "
+ "player_number={}, is_valid={}, inval={}, applet_resource_user_id{}",
+ parameters.enable, parameters.bus_handle.abstracted_pad_id,
+ parameters.bus_handle.bus_type, parameters.bus_handle.internal_index,
+ parameters.bus_handle.player_number, parameters.bus_handle.is_valid, parameters.inval,
+ parameters.applet_resource_user_id);
const auto device_index = GetDeviceIndexFromHandle(parameters.bus_handle);
@@ -326,11 +326,11 @@ void HidBus::GetExternalDeviceId(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto bus_handle_{rp.PopRaw<BusHandle>()};
- LOG_INFO(Service_HID,
- "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
- "is_valid={}",
- bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
- bus_handle_.player_number, bus_handle_.is_valid);
+ LOG_DEBUG(Service_HID,
+ "called, abstracted_pad_id={}, bus_type={}, internal_index={}, player_number={}, "
+ "is_valid={}",
+ bus_handle_.abstracted_pad_id, bus_handle_.bus_type, bus_handle_.internal_index,
+ bus_handle_.player_number, bus_handle_.is_valid);
const auto device_index = GetDeviceIndexFromHandle(bus_handle_);
diff --git a/src/core/hle/service/hid/hidbus/ringcon.cpp b/src/core/hle/service/hid/hidbus/ringcon.cpp
index 7ab3903dc..35847cbdd 100644
--- a/src/core/hle/service/hid/hidbus/ringcon.cpp
+++ b/src/core/hle/service/hid/hidbus/ringcon.cpp
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "core/hid/emulated_devices.h"
+#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_readable_event.h"
@@ -12,16 +12,20 @@ namespace Service::HID {
RingController::RingController(Core::HID::HIDCore& hid_core_,
KernelHelpers::ServiceContext& service_context_)
: HidbusBase(service_context_) {
- input = hid_core_.GetEmulatedDevices();
+ input = hid_core_.GetEmulatedController(Core::HID::NpadIdType::Player1);
}
RingController::~RingController() = default;
void RingController::OnInit() {
+ input->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::Ring);
return;
}
void RingController::OnRelease() {
+ input->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::Active);
return;
};
diff --git a/src/core/hle/service/hid/hidbus/ringcon.h b/src/core/hle/service/hid/hidbus/ringcon.h
index 8e195ca79..c2fb386b1 100644
--- a/src/core/hle/service/hid/hidbus/ringcon.h
+++ b/src/core/hle/service/hid/hidbus/ringcon.h
@@ -10,7 +10,7 @@
#include "core/hle/service/hid/hidbus/hidbus_base.h"
namespace Core::HID {
-class EmulatedDevices;
+class EmulatedController;
} // namespace Core::HID
namespace Service::HID {
@@ -249,6 +249,6 @@ private:
.zero = {.value = idle_value, .crc = 225},
};
- Core::HID::EmulatedDevices* input;
+ Core::HID::EmulatedController* input;
};
} // namespace Service::HID
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp
index 6a3453457..52f402c56 100644
--- a/src/core/hle/service/hid/irs.cpp
+++ b/src/core/hle/service/hid/irs.cpp
@@ -108,6 +108,8 @@ void IRS::StopImageProcessor(Kernel::HLERequestContext& ctx) {
auto result = IsIrCameraHandleValid(parameters.camera_handle);
if (result.IsSuccess()) {
// TODO: Stop Image processor
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::Active);
result = ResultSuccess;
}
@@ -139,6 +141,8 @@ void IRS::RunMomentProcessor(Kernel::HLERequestContext& ctx) {
MakeProcessor<MomentProcessor>(parameters.camera_handle, device);
auto& image_transfer_processor = GetProcessor<MomentProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -170,6 +174,8 @@ void IRS::RunClusteringProcessor(Kernel::HLERequestContext& ctx) {
auto& image_transfer_processor =
GetProcessor<ClusteringProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -219,6 +225,8 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
GetProcessor<ImageTransferProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -294,6 +302,8 @@ void IRS::RunTeraPluginProcessor(Kernel::HLERequestContext& ctx) {
auto& image_transfer_processor =
GetProcessor<TeraPluginProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -343,6 +353,8 @@ void IRS::RunPointingProcessor(Kernel::HLERequestContext& ctx) {
MakeProcessor<PointingProcessor>(camera_handle, device);
auto& image_transfer_processor = GetProcessor<PointingProcessor>(camera_handle);
image_transfer_processor.SetConfig(processor_config);
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -453,6 +465,8 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
GetProcessor<ImageTransferProcessor>(parameters.camera_handle);
image_transfer_processor.SetConfig(parameters.processor_config);
image_transfer_processor.SetTransferMemoryPointer(transfer_memory);
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -479,6 +493,8 @@ void IRS::RunIrLedProcessor(Kernel::HLERequestContext& ctx) {
MakeProcessor<IrLedProcessor>(camera_handle, device);
auto& image_transfer_processor = GetProcessor<IrLedProcessor>(camera_handle);
image_transfer_processor.SetConfig(processor_config);
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::IR);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -504,6 +520,8 @@ void IRS::StopImageProcessorAsync(Kernel::HLERequestContext& ctx) {
auto result = IsIrCameraHandleValid(parameters.camera_handle);
if (result.IsSuccess()) {
// TODO: Stop image processor async
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::Active);
result = ResultSuccess;
}
diff --git a/src/core/hle/service/nfc/nfc_device.cpp b/src/core/hle/service/nfc/nfc_device.cpp
index 78578f723..9a3234e8c 100644
--- a/src/core/hle/service/nfc/nfc_device.cpp
+++ b/src/core/hle/service/nfc/nfc_device.cpp
@@ -130,7 +130,9 @@ Result NfcDevice::StartDetection(NFP::TagProtocol allowed_protocol) {
return WrongDeviceState;
}
- if (!npad_device->SetPollingMode(Common::Input::PollingMode::NFC)) {
+ if (npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::NFC) !=
+ Common::Input::DriverResult::Success) {
LOG_ERROR(Service_NFC, "Nfc not supported");
return NfcDisabled;
}
@@ -141,7 +143,8 @@ Result NfcDevice::StartDetection(NFP::TagProtocol allowed_protocol) {
}
Result NfcDevice::StopDetection() {
- npad_device->SetPollingMode(Common::Input::PollingMode::Active);
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::Active);
if (device_state == NFP::DeviceState::Initialized) {
return ResultSuccess;
diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp
index c860fd1a1..e67a76f55 100644
--- a/src/core/hle/service/nfp/nfp_device.cpp
+++ b/src/core/hle/service/nfp/nfp_device.cpp
@@ -152,7 +152,9 @@ Result NfpDevice::StartDetection(TagProtocol allowed_protocol) {
return WrongDeviceState;
}
- if (!npad_device->SetPollingMode(Common::Input::PollingMode::NFC)) {
+ if (npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::NFC) !=
+ Common::Input::DriverResult::Success) {
LOG_ERROR(Service_NFP, "Nfc not supported");
return NfcDisabled;
}
@@ -163,7 +165,8 @@ Result NfpDevice::StartDetection(TagProtocol allowed_protocol) {
}
Result NfpDevice::StopDetection() {
- npad_device->SetPollingMode(Common::Input::PollingMode::Active);
+ npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
+ Common::Input::PollingMode::Active);
if (device_state == DeviceState::Initialized) {
return ResultSuccess;
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index 4fa9f51a6..5d32adf64 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -22,15 +22,19 @@ namespace {
namespace Service::NIFM {
+// This is nn::nifm::RequestState
enum class RequestState : u32 {
NotSubmitted = 1,
- Error = 1, ///< The duplicate 1 is intentional; it means both not submitted and error on HW.
- Pending = 2,
- Connected = 3,
+ Invalid = 1, ///< The duplicate 1 is intentional; it means both not submitted and error on HW.
+ OnHold = 2,
+ Accepted = 3,
+ Blocking = 4,
};
-enum class InternetConnectionType : u8 {
- WiFi = 1,
+// This is nn::nifm::NetworkInterfaceType
+enum class NetworkInterfaceType : u32 {
+ Invalid = 0,
+ WiFi_Ieee80211 = 1,
Ethernet = 2,
};
@@ -42,14 +46,23 @@ enum class InternetConnectionStatus : u8 {
Connected,
};
+// This is nn::nifm::NetworkProfileType
+enum class NetworkProfileType : u32 {
+ User,
+ SsidList,
+ Temporary,
+};
+
+// This is nn::nifm::IpAddressSetting
struct IpAddressSetting {
bool is_automatic{};
- Network::IPv4Address current_address{};
+ Network::IPv4Address ip_address{};
Network::IPv4Address subnet_mask{};
- Network::IPv4Address gateway{};
+ Network::IPv4Address default_gateway{};
};
static_assert(sizeof(IpAddressSetting) == 0xD, "IpAddressSetting has incorrect size.");
+// This is nn::nifm::DnsSetting
struct DnsSetting {
bool is_automatic{};
Network::IPv4Address primary_dns{};
@@ -57,18 +70,26 @@ struct DnsSetting {
};
static_assert(sizeof(DnsSetting) == 0x9, "DnsSetting has incorrect size.");
+// This is nn::nifm::AuthenticationSetting
+struct AuthenticationSetting {
+ bool is_enabled{};
+ std::array<char, 0x20> user{};
+ std::array<char, 0x20> password{};
+};
+static_assert(sizeof(AuthenticationSetting) == 0x41, "AuthenticationSetting has incorrect size.");
+
+// This is nn::nifm::ProxySetting
struct ProxySetting {
- bool enabled{};
+ bool is_enabled{};
INSERT_PADDING_BYTES(1);
u16 port{};
std::array<char, 0x64> proxy_server{};
- bool automatic_auth_enabled{};
- std::array<char, 0x20> user{};
- std::array<char, 0x20> password{};
+ AuthenticationSetting authentication{};
INSERT_PADDING_BYTES(1);
};
static_assert(sizeof(ProxySetting) == 0xAA, "ProxySetting has incorrect size.");
+// This is nn::nifm::IpSettingData
struct IpSettingData {
IpAddressSetting ip_address_setting{};
DnsSetting dns_setting{};
@@ -101,6 +122,7 @@ static_assert(sizeof(NifmWirelessSettingData) == 0x70,
"NifmWirelessSettingData has incorrect size.");
#pragma pack(push, 1)
+// This is nn::nifm::detail::sf::NetworkProfileData
struct SfNetworkProfileData {
IpSettingData ip_setting_data{};
u128 uuid{};
@@ -114,13 +136,14 @@ struct SfNetworkProfileData {
};
static_assert(sizeof(SfNetworkProfileData) == 0x17C, "SfNetworkProfileData has incorrect size.");
+// This is nn::nifm::NetworkProfileData
struct NifmNetworkProfileData {
u128 uuid{};
std::array<char, 0x40> network_name{};
- u32 unknown_1{};
- u32 unknown_2{};
- u8 unknown_3{};
- u8 unknown_4{};
+ NetworkProfileType network_profile_type{};
+ NetworkInterfaceType network_interface_type{};
+ bool is_auto_connect{};
+ bool is_large_capacity{};
INSERT_PADDING_BYTES(2);
NifmWirelessSettingData wireless_setting_data{};
IpSettingData ip_setting_data{};
@@ -184,6 +207,7 @@ public:
event1 = CreateKEvent(service_context, "IRequest:Event1");
event2 = CreateKEvent(service_context, "IRequest:Event2");
+ state = RequestState::NotSubmitted;
}
~IRequest() override {
@@ -196,7 +220,7 @@ private:
LOG_WARNING(Service_NIFM, "(STUBBED) called");
if (state == RequestState::NotSubmitted) {
- UpdateState(RequestState::Pending);
+ UpdateState(RequestState::OnHold);
}
IPC::ResponseBuilder rb{ctx, 2};
@@ -219,14 +243,14 @@ private:
switch (state) {
case RequestState::NotSubmitted:
return has_connection ? ResultSuccess : ResultNetworkCommunicationDisabled;
- case RequestState::Pending:
+ case RequestState::OnHold:
if (has_connection) {
- UpdateState(RequestState::Connected);
+ UpdateState(RequestState::Accepted);
} else {
- UpdateState(RequestState::Error);
+ UpdateState(RequestState::Invalid);
}
return ResultPendingConnection;
- case RequestState::Connected:
+ case RequestState::Accepted:
default:
return ResultSuccess;
}
@@ -338,9 +362,9 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) {
.ip_setting_data{
.ip_address_setting{
.is_automatic{true},
- .current_address{Network::TranslateIPv4(net_iface->ip_address)},
+ .ip_address{Network::TranslateIPv4(net_iface->ip_address)},
.subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)},
- .gateway{Network::TranslateIPv4(net_iface->gateway)},
+ .default_gateway{Network::TranslateIPv4(net_iface->gateway)},
},
.dns_setting{
.is_automatic{true},
@@ -348,12 +372,14 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) {
.secondary_dns{1, 0, 0, 1},
},
.proxy_setting{
- .enabled{false},
+ .is_enabled{false},
.port{},
.proxy_server{},
- .automatic_auth_enabled{},
- .user{},
- .password{},
+ .authentication{
+ .is_enabled{},
+ .user{},
+ .password{},
+ },
},
.mtu{1500},
},
@@ -370,7 +396,7 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) {
// When we're connected to a room, spoof the hosts IP address
if (auto room_member = network.GetRoomMember().lock()) {
if (room_member->IsConnected()) {
- network_profile_data.ip_setting_data.ip_address_setting.current_address =
+ network_profile_data.ip_setting_data.ip_address_setting.ip_address =
room_member->GetFakeIpAddress();
}
}
@@ -444,9 +470,9 @@ void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) {
return IpConfigInfo{
.ip_address_setting{
.is_automatic{true},
- .current_address{Network::TranslateIPv4(net_iface->ip_address)},
+ .ip_address{Network::TranslateIPv4(net_iface->ip_address)},
.subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)},
- .gateway{Network::TranslateIPv4(net_iface->gateway)},
+ .default_gateway{Network::TranslateIPv4(net_iface->gateway)},
},
.dns_setting{
.is_automatic{true},
@@ -459,7 +485,7 @@ void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) {
// When we're connected to a room, spoof the hosts IP address
if (auto room_member = network.GetRoomMember().lock()) {
if (room_member->IsConnected()) {
- ip_config_info.ip_address_setting.current_address = room_member->GetFakeIpAddress();
+ ip_config_info.ip_address_setting.ip_address = room_member->GetFakeIpAddress();
}
}
@@ -480,7 +506,7 @@ void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx
LOG_WARNING(Service_NIFM, "(STUBBED) called");
struct Output {
- InternetConnectionType type{InternetConnectionType::WiFi};
+ u8 type{static_cast<u8>(NetworkInterfaceType::WiFi_Ieee80211)};
u8 wifi_strength{3};
InternetConnectionStatus state{InternetConnectionStatus::Connected};
};
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index d1cbadde4..f4416f5b2 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -312,8 +312,6 @@ void NVFlinger::Compose() {
}
s64 NVFlinger::GetNextTicks() const {
- static constexpr s64 max_hertz = 120LL;
-
const auto& settings = Settings::values;
auto speed_scale = 1.f;
if (settings.use_multi_core.GetValue()) {
@@ -327,9 +325,11 @@ s64 NVFlinger::GetNextTicks() const {
}
}
- const auto next_ticks = ((1000000000 * (1LL << swap_interval)) / max_hertz);
+ // As an extension, treat nonpositive swap interval as framerate multiplier.
+ const f32 effective_fps = swap_interval <= 0 ? 120.f * static_cast<f32>(1 - swap_interval)
+ : 60.f / static_cast<f32>(swap_interval);
- return static_cast<s64>(speed_scale * static_cast<float>(next_ticks));
+ return static_cast<s64>(speed_scale * (1000000000.f / effective_fps));
}
} // namespace Service::NVFlinger
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h
index 9b22397db..3828cf272 100644
--- a/src/core/hle/service/nvflinger/nvflinger.h
+++ b/src/core/hle/service/nvflinger/nvflinger.h
@@ -133,7 +133,7 @@ private:
/// layers.
u32 next_buffer_queue_id = 1;
- u32 swap_interval = 1;
+ s32 swap_interval = 1;
/// Event that handles screen composition.
std::shared_ptr<Core::Timing::EventType> multi_composition_event;