early-access version 2239

This commit is contained in:
pineappleEA 2021-11-24 12:36:46 +01:00
parent c0b63fdde3
commit e464c06a80
20 changed files with 150 additions and 123 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 2238. This is the source code for early-access 2239.
## Legal Notice ## Legal Notice

View File

@ -183,6 +183,7 @@ void RestoreGlobalState(bool is_powered_on) {
values.max_anisotropy.SetGlobal(true); values.max_anisotropy.SetGlobal(true);
values.use_speed_limit.SetGlobal(true); values.use_speed_limit.SetGlobal(true);
values.speed_limit.SetGlobal(true); values.speed_limit.SetGlobal(true);
values.fps_cap.SetGlobal(true);
values.use_disk_shader_cache.SetGlobal(true); values.use_disk_shader_cache.SetGlobal(true);
values.gpu_accuracy.SetGlobal(true); values.gpu_accuracy.SetGlobal(true);
values.use_asynchronous_gpu_emulation.SetGlobal(true); values.use_asynchronous_gpu_emulation.SetGlobal(true);

View File

@ -524,7 +524,7 @@ struct Values {
Setting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; Setting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"};
Setting<bool> accelerate_astc{true, "accelerate_astc"}; Setting<bool> accelerate_astc{true, "accelerate_astc"};
Setting<bool> use_vsync{true, "use_vsync"}; Setting<bool> use_vsync{true, "use_vsync"};
BasicRangedSetting<u16> fps_cap{1000, 1, 1000, "fps_cap"}; RangedSetting<u16> fps_cap{1000, 1, 1000, "fps_cap"};
BasicSetting<bool> disable_fps_limit{false, "disable_fps_limit"}; BasicSetting<bool> disable_fps_limit{false, "disable_fps_limit"};
RangedSetting<ShaderBackend> shader_backend{ShaderBackend::GLASM, ShaderBackend::GLSL, RangedSetting<ShaderBackend> shader_backend{ShaderBackend::GLASM, ShaderBackend::GLSL,
ShaderBackend::SPIRV, "shader_backend"}; ShaderBackend::SPIRV, "shader_backend"};

View File

@ -723,7 +723,7 @@ void EmulatedController::SetBattery(Common::Input::CallbackStatus callback, std:
bool is_charging = false; bool is_charging = false;
bool is_powered = false; bool is_powered = false;
BatteryLevel battery_level = 0; NpadBatteryLevel battery_level = 0;
switch (controller.battery_values[index]) { switch (controller.battery_values[index]) {
case Common::Input::BatteryLevel::Charging: case Common::Input::BatteryLevel::Charging:
is_charging = true; is_charging = true;

View File

@ -346,15 +346,15 @@ struct NpadGcTriggerState {
static_assert(sizeof(NpadGcTriggerState) == 0x10, "NpadGcTriggerState is an invalid size"); static_assert(sizeof(NpadGcTriggerState) == 0x10, "NpadGcTriggerState is an invalid size");
// This is nn::hid::system::NpadBatteryLevel // This is nn::hid::system::NpadBatteryLevel
using BatteryLevel = u32; using NpadBatteryLevel = u32;
static_assert(sizeof(BatteryLevel) == 0x4, "BatteryLevel is an invalid size"); static_assert(sizeof(NpadBatteryLevel) == 0x4, "NpadBatteryLevel is an invalid size");
// This is nn::hid::system::NpadPowerInfo // This is nn::hid::system::NpadPowerInfo
struct NpadPowerInfo { struct NpadPowerInfo {
bool is_powered; bool is_powered;
bool is_charging; bool is_charging;
INSERT_PADDING_BYTES(0x6); INSERT_PADDING_BYTES(0x6);
BatteryLevel battery_level; NpadBatteryLevel battery_level;
}; };
static_assert(sizeof(NpadPowerInfo) == 0xC, "NpadPowerInfo is an invalid size"); static_assert(sizeof(NpadPowerInfo) == 0xC, "NpadPowerInfo is an invalid size");

View File

@ -24,34 +24,25 @@ void Controller_ConsoleSixAxis::OnRelease() {}
void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data,
std::size_t size) { std::size_t size) {
seven_six_axis.header.timestamp = core_timing.GetCPUTicks();
seven_six_axis.header.total_entry_count = 17;
if (!IsControllerActivated() || !is_transfer_memory_set) { if (!IsControllerActivated() || !is_transfer_memory_set) {
seven_six_axis.header.entry_count = 0; seven_sixaxis_lifo.buffer_count = 0;
seven_six_axis.header.last_entry_index = 0; seven_sixaxis_lifo.buffer_tail = 0;
return; return;
} }
seven_six_axis.header.entry_count = 16;
const auto& last_entry = const auto& last_entry = seven_sixaxis_lifo.ReadCurrentEntry().state;
seven_six_axis.sevensixaxis_states[seven_six_axis.header.last_entry_index]; next_seven_sixaxis_state.sampling_number = last_entry.sampling_number + 1;
seven_six_axis.header.last_entry_index = (seven_six_axis.header.last_entry_index + 1) % 17;
auto& cur_entry = seven_six_axis.sevensixaxis_states[seven_six_axis.header.last_entry_index];
cur_entry.sampling_number = last_entry.sampling_number + 1;
cur_entry.sampling_number2 = cur_entry.sampling_number;
// Try to read sixaxis sensor states // Try to read sixaxis sensor states
const auto motion_status = console->GetMotion(); const auto motion_status = console->GetMotion();
console_six_axis.is_seven_six_axis_sensor_at_rest = motion_status.is_at_rest; console_six_axis.is_seven_six_axis_sensor_at_rest = motion_status.is_at_rest;
cur_entry.accel = motion_status.accel; next_seven_sixaxis_state.accel = motion_status.accel;
// Zero gyro values as they just mess up with the camera // Zero gyro values as they just mess up with the camera
// Note: Probably a correct sensivity setting must be set // Note: Probably a correct sensivity setting must be set
cur_entry.gyro = {}; next_seven_sixaxis_state.gyro = {};
cur_entry.quaternion = { next_seven_sixaxis_state.quaternion = {
{ {
motion_status.quaternion.xyz.y, motion_status.quaternion.xyz.y,
motion_status.quaternion.xyz.x, motion_status.quaternion.xyz.x,
@ -68,7 +59,8 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti
// Update console six axis shared memory // Update console six axis shared memory
std::memcpy(data + SHARED_MEMORY_OFFSET, &console_six_axis, sizeof(console_six_axis)); std::memcpy(data + SHARED_MEMORY_OFFSET, &console_six_axis, sizeof(console_six_axis));
// Update seven six axis transfer memory // Update seven six axis transfer memory
std::memcpy(transfer_memory, &seven_six_axis, sizeof(seven_six_axis)); seven_sixaxis_lifo.WriteNextEntry(next_seven_sixaxis_state);
std::memcpy(transfer_memory, &seven_sixaxis_lifo, sizeof(seven_sixaxis_lifo));
} }
void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) { void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) {
@ -77,8 +69,7 @@ void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) {
} }
void Controller_ConsoleSixAxis::ResetTimestamp() { void Controller_ConsoleSixAxis::ResetTimestamp() {
auto& cur_entry = seven_six_axis.sevensixaxis_states[seven_six_axis.header.last_entry_index]; seven_sixaxis_lifo.buffer_count = 0;
cur_entry.sampling_number = 0; seven_sixaxis_lifo.buffer_tail = 0;
cur_entry.sampling_number2 = 0;
} }
} // namespace Service::HID } // namespace Service::HID

View File

@ -10,6 +10,7 @@
#include "common/quaternion.h" #include "common/quaternion.h"
#include "core/hid/hid_types.h" #include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h"
namespace Core::HID { namespace Core::HID {
class EmulatedConsole; class EmulatedConsole;
@ -40,50 +41,30 @@ private:
struct SevenSixAxisState { struct SevenSixAxisState {
INSERT_PADDING_WORDS(4); // unused INSERT_PADDING_WORDS(4); // unused
s64 sampling_number{}; s64 sampling_number{};
s64 sampling_number2{};
u64 unknown{}; u64 unknown{};
Common::Vec3f accel{}; Common::Vec3f accel{};
Common::Vec3f gyro{}; Common::Vec3f gyro{};
Common::Quaternion<f32> quaternion{}; Common::Quaternion<f32> quaternion{};
}; };
static_assert(sizeof(SevenSixAxisState) == 0x50, "SevenSixAxisState is an invalid size"); static_assert(sizeof(SevenSixAxisState) == 0x48, "SevenSixAxisState is an invalid size");
struct CommonHeader {
s64 timestamp;
s64 total_entry_count;
s64 last_entry_index;
s64 entry_count;
};
static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size");
// TODO(german77): SevenSixAxisMemory doesn't follow the standard lifo. Investigate
struct SevenSixAxisMemory {
CommonHeader header{};
std::array<SevenSixAxisState, 0x21> sevensixaxis_states{};
};
static_assert(sizeof(SevenSixAxisMemory) == 0xA70, "SevenSixAxisMemory is an invalid size");
// This is nn::hid::detail::ConsoleSixAxisSensorSharedMemoryFormat // This is nn::hid::detail::ConsoleSixAxisSensorSharedMemoryFormat
struct ConsoleSharedMemory { struct ConsoleSharedMemory {
u64 sampling_number{}; u64 sampling_number{};
bool is_seven_six_axis_sensor_at_rest{}; bool is_seven_six_axis_sensor_at_rest{};
INSERT_PADDING_BYTES(4); // padding
f32 verticalization_error{}; f32 verticalization_error{};
Common::Vec3f gyro_bias{}; Common::Vec3f gyro_bias{};
}; };
static_assert(sizeof(ConsoleSharedMemory) == 0x20, "ConsoleSharedMemory is an invalid size"); static_assert(sizeof(ConsoleSharedMemory) == 0x20, "ConsoleSharedMemory is an invalid size");
struct MotionDevice { Lifo<SevenSixAxisState, 0x21> seven_sixaxis_lifo{};
Common::Vec3f accel; static_assert(sizeof(seven_sixaxis_lifo) == 0xA70, "SevenSixAxisState is an invalid size");
Common::Vec3f gyro;
Common::Vec3f rotation;
std::array<Common::Vec3f, 3> orientation;
Common::Quaternion<f32> quaternion;
};
Core::HID::EmulatedConsole* console; Core::HID::EmulatedConsole* console;
u8* transfer_memory = nullptr; u8* transfer_memory = nullptr;
bool is_transfer_memory_set = false; bool is_transfer_memory_set = false;
ConsoleSharedMemory console_six_axis{}; ConsoleSharedMemory console_six_axis{};
SevenSixAxisMemory seven_six_axis{}; SevenSixAxisState next_seven_sixaxis_state{};
}; };
} // namespace Service::HID } // namespace Service::HID

View File

@ -41,6 +41,8 @@ public:
bool IsControllerActivated() const; bool IsControllerActivated() const;
static const std::size_t hid_entry_count = 17;
protected: protected:
bool is_activated{false}; bool is_activated{false};

View File

@ -54,7 +54,7 @@ private:
static_assert(sizeof(DebugPadState) == 0x20, "DebugPadState is an invalid state"); static_assert(sizeof(DebugPadState) == 0x20, "DebugPadState is an invalid state");
// This is nn::hid::detail::DebugPadLifo // This is nn::hid::detail::DebugPadLifo
Lifo<DebugPadState> debug_pad_lifo{}; Lifo<DebugPadState, hid_entry_count> debug_pad_lifo{};
static_assert(sizeof(debug_pad_lifo) == 0x2C8, "debug_pad_lifo is an invalid size"); static_assert(sizeof(debug_pad_lifo) == 0x2C8, "debug_pad_lifo is an invalid size");
DebugPadState next_state{}; DebugPadState next_state{};

View File

@ -136,7 +136,7 @@ private:
GestureProperties GetGestureProperties(); GestureProperties GetGestureProperties();
// This is nn::hid::detail::GestureLifo // This is nn::hid::detail::GestureLifo
Lifo<GestureState> gesture_lifo{}; Lifo<GestureState, hid_entry_count> gesture_lifo{};
static_assert(sizeof(gesture_lifo) == 0x708, "gesture_lifo is an invalid size"); static_assert(sizeof(gesture_lifo) == 0x708, "gesture_lifo is an invalid size");
GestureState next_state{}; GestureState next_state{};

View File

@ -44,7 +44,7 @@ private:
static_assert(sizeof(KeyboardState) == 0x30, "KeyboardState is an invalid size"); static_assert(sizeof(KeyboardState) == 0x30, "KeyboardState is an invalid size");
// This is nn::hid::detail::KeyboardLifo // This is nn::hid::detail::KeyboardLifo
Lifo<KeyboardState> keyboard_lifo{}; Lifo<KeyboardState, hid_entry_count> keyboard_lifo{};
static_assert(sizeof(keyboard_lifo) == 0x3D8, "keyboard_lifo is an invalid size"); static_assert(sizeof(keyboard_lifo) == 0x3D8, "keyboard_lifo is an invalid size");
KeyboardState next_state{}; KeyboardState next_state{};

View File

@ -34,7 +34,7 @@ public:
private: private:
// This is nn::hid::detail::MouseLifo // This is nn::hid::detail::MouseLifo
Lifo<Core::HID::MouseState> mouse_lifo{}; Lifo<Core::HID::MouseState, hid_entry_count> mouse_lifo{};
static_assert(sizeof(mouse_lifo) == 0x350, "mouse_lifo is an invalid size"); static_assert(sizeof(mouse_lifo) == 0x350, "mouse_lifo is an invalid size");
Core::HID::MouseState next_state{}; Core::HID::MouseState next_state{};

View File

@ -157,6 +157,7 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
shared_memory.system_properties.is_vertical.Assign(1); shared_memory.system_properties.is_vertical.Assign(1);
shared_memory.system_properties.use_plus.Assign(1); shared_memory.system_properties.use_plus.Assign(1);
shared_memory.system_properties.use_minus.Assign(1); shared_memory.system_properties.use_minus.Assign(1);
shared_memory.system_properties.use_directional_buttons.Assign(1);
shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual; shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual;
shared_memory.applet_footer.type = AppletFooterUiType::HandheldJoyConLeftJoyConRight; shared_memory.applet_footer.type = AppletFooterUiType::HandheldJoyConLeftJoyConRight;
break; break;
@ -167,6 +168,7 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
shared_memory.system_properties.is_vertical.Assign(1); shared_memory.system_properties.is_vertical.Assign(1);
shared_memory.system_properties.use_plus.Assign(1); shared_memory.system_properties.use_plus.Assign(1);
shared_memory.system_properties.use_minus.Assign(1); shared_memory.system_properties.use_minus.Assign(1);
shared_memory.system_properties.use_directional_buttons.Assign(1);
shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual; shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual;
shared_memory.applet_footer.type = AppletFooterUiType::JoyDual; shared_memory.applet_footer.type = AppletFooterUiType::JoyDual;
break; break;

View File

@ -339,26 +339,6 @@ private:
static_assert(sizeof(NfcXcdDeviceHandleStateImpl) == 0x18, static_assert(sizeof(NfcXcdDeviceHandleStateImpl) == 0x18,
"NfcXcdDeviceHandleStateImpl is an invalid size"); "NfcXcdDeviceHandleStateImpl is an invalid size");
// nn::hid::detail::NfcXcdDeviceHandleStateImplAtomicStorage
struct NfcXcdDeviceHandleStateImplAtomicStorage {
u64 sampling_number;
NfcXcdDeviceHandleStateImpl nfc_xcd_device_handle_state;
};
static_assert(sizeof(NfcXcdDeviceHandleStateImplAtomicStorage) == 0x20,
"NfcXcdDeviceHandleStateImplAtomicStorage is an invalid size");
// This is nn::hid::detail::NfcXcdDeviceHandleState
struct NfcXcdDeviceHandleState {
// TODO(german77): Make this struct a ring lifo object
INSERT_PADDING_BYTES(0x8); // Unused
s64 total_buffer_count = max_buffer_size;
s64 buffer_tail{};
s64 buffer_count{};
std::array<NfcXcdDeviceHandleStateImplAtomicStorage, 2> nfc_xcd_device_handle_storage;
};
static_assert(sizeof(NfcXcdDeviceHandleState) == 0x60,
"NfcXcdDeviceHandleState is an invalid size");
// This is nn::hid::system::AppletFooterUiAttributesSet // This is nn::hid::system::AppletFooterUiAttributesSet
struct AppletFooterUiAttributes { struct AppletFooterUiAttributes {
INSERT_PADDING_BYTES(0x4); INSERT_PADDING_BYTES(0x4);
@ -433,32 +413,32 @@ private:
NpadJoyAssignmentMode assignment_mode; NpadJoyAssignmentMode assignment_mode;
NpadFullKeyColorState fullkey_color; NpadFullKeyColorState fullkey_color;
NpadJoyColorState joycon_color; NpadJoyColorState joycon_color;
Lifo<NPadGenericState> fullkey_lifo; Lifo<NPadGenericState, hid_entry_count> fullkey_lifo;
Lifo<NPadGenericState> handheld_lifo; Lifo<NPadGenericState, hid_entry_count> handheld_lifo;
Lifo<NPadGenericState> joy_dual_lifo; Lifo<NPadGenericState, hid_entry_count> joy_dual_lifo;
Lifo<NPadGenericState> joy_left_lifo; Lifo<NPadGenericState, hid_entry_count> joy_left_lifo;
Lifo<NPadGenericState> joy_right_lifo; Lifo<NPadGenericState, hid_entry_count> joy_right_lifo;
Lifo<NPadGenericState> palma_lifo; Lifo<NPadGenericState, hid_entry_count> palma_lifo;
Lifo<NPadGenericState> system_ext_lifo; Lifo<NPadGenericState, hid_entry_count> system_ext_lifo;
Lifo<SixAxisSensorState> sixaxis_fullkey_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_fullkey_lifo;
Lifo<SixAxisSensorState> sixaxis_handheld_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_handheld_lifo;
Lifo<SixAxisSensorState> sixaxis_dual_left_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_dual_left_lifo;
Lifo<SixAxisSensorState> sixaxis_dual_right_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_dual_right_lifo;
Lifo<SixAxisSensorState> sixaxis_left_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_left_lifo;
Lifo<SixAxisSensorState> sixaxis_right_lifo; Lifo<SixAxisSensorState, hid_entry_count> sixaxis_right_lifo;
DeviceType device_type; DeviceType device_type;
INSERT_PADDING_BYTES(0x4); // Reserved INSERT_PADDING_BYTES(0x4); // Reserved
NPadSystemProperties system_properties; NPadSystemProperties system_properties;
NpadSystemButtonProperties button_properties; NpadSystemButtonProperties button_properties;
Core::HID::BatteryLevel battery_level_dual; Core::HID::NpadBatteryLevel battery_level_dual;
Core::HID::BatteryLevel battery_level_left; Core::HID::NpadBatteryLevel battery_level_left;
Core::HID::BatteryLevel battery_level_right; Core::HID::NpadBatteryLevel battery_level_right;
union { union {
NfcXcdDeviceHandleState nfc_xcd_device_handle; Lifo<NfcXcdDeviceHandleStateImpl, 0x2> nfc_xcd_device_lifo{};
AppletFooterUi applet_footer; AppletFooterUi applet_footer;
}; };
INSERT_PADDING_BYTES(0x20); // Unknown INSERT_PADDING_BYTES(0x20); // Unknown
Lifo<NpadGcTriggerState> gc_trigger_lifo; Lifo<NpadGcTriggerState, hid_entry_count> gc_trigger_lifo;
NpadLarkType lark_type_l_and_main; NpadLarkType lark_type_l_and_main;
NpadLarkType lark_type_r; NpadLarkType lark_type_r;
NpadLuciaType lucia_type; NpadLuciaType lucia_type;

View File

@ -61,7 +61,7 @@ private:
static_assert(sizeof(TouchScreenState) == 0x290, "TouchScreenState is an invalid size"); static_assert(sizeof(TouchScreenState) == 0x290, "TouchScreenState is an invalid size");
// This is nn::hid::detail::TouchScreenLifo // This is nn::hid::detail::TouchScreenLifo
Lifo<TouchScreenState> touch_screen_lifo{}; Lifo<TouchScreenState, hid_entry_count> touch_screen_lifo{};
static_assert(sizeof(touch_screen_lifo) == 0x2C38, "touch_screen_lifo is an invalid size"); static_assert(sizeof(touch_screen_lifo) == 0x2C38, "touch_screen_lifo is an invalid size");
TouchScreenState next_state{}; TouchScreenState next_state{};

View File

@ -102,7 +102,7 @@ private:
static_assert(sizeof(BasicXpadState) == 0x20, "BasicXpadState is an invalid size"); static_assert(sizeof(BasicXpadState) == 0x20, "BasicXpadState is an invalid size");
// This is nn::hid::detail::BasicXpadLifo // This is nn::hid::detail::BasicXpadLifo
Lifo<BasicXpadState> basic_xpad_lifo{}; Lifo<BasicXpadState, hid_entry_count> basic_xpad_lifo{};
static_assert(sizeof(basic_xpad_lifo) == 0x2C8, "basic_xpad_lifo is an invalid size"); static_assert(sizeof(basic_xpad_lifo) == 0x2C8, "basic_xpad_lifo is an invalid size");
BasicXpadState next_state{}; BasicXpadState next_state{};
}; };

View File

@ -9,7 +9,6 @@
#include "common/common_types.h" #include "common/common_types.h"
namespace Service::HID { namespace Service::HID {
constexpr std::size_t max_buffer_size = 17;
template <typename State> template <typename State>
struct AtomicStorage { struct AtomicStorage {
@ -17,7 +16,7 @@ struct AtomicStorage {
State state; State state;
}; };
template <typename State> template <typename State, std::size_t max_buffer_size>
struct Lifo { struct Lifo {
s64 timestamp{}; s64 timestamp{};
s64 total_buffer_count = static_cast<s64>(max_buffer_size); s64 total_buffer_count = static_cast<s64>(max_buffer_size);

View File

@ -645,6 +645,7 @@ void Config::ReadRendererValues() {
ReadGlobalSetting(Settings::values.max_anisotropy); ReadGlobalSetting(Settings::values.max_anisotropy);
ReadGlobalSetting(Settings::values.use_speed_limit); ReadGlobalSetting(Settings::values.use_speed_limit);
ReadGlobalSetting(Settings::values.speed_limit); ReadGlobalSetting(Settings::values.speed_limit);
ReadGlobalSetting(Settings::values.fps_cap);
ReadGlobalSetting(Settings::values.use_disk_shader_cache); ReadGlobalSetting(Settings::values.use_disk_shader_cache);
ReadGlobalSetting(Settings::values.gpu_accuracy); ReadGlobalSetting(Settings::values.gpu_accuracy);
ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation); ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation);
@ -659,7 +660,6 @@ void Config::ReadRendererValues() {
ReadGlobalSetting(Settings::values.bg_blue); ReadGlobalSetting(Settings::values.bg_blue);
if (global) { if (global) {
ReadBasicSetting(Settings::values.fps_cap);
ReadBasicSetting(Settings::values.renderer_debug); ReadBasicSetting(Settings::values.renderer_debug);
ReadBasicSetting(Settings::values.renderer_shader_feedback); ReadBasicSetting(Settings::values.renderer_shader_feedback);
ReadBasicSetting(Settings::values.enable_nsight_aftermath); ReadBasicSetting(Settings::values.enable_nsight_aftermath);
@ -1185,6 +1185,7 @@ void Config::SaveRendererValues() {
WriteGlobalSetting(Settings::values.max_anisotropy); WriteGlobalSetting(Settings::values.max_anisotropy);
WriteGlobalSetting(Settings::values.use_speed_limit); WriteGlobalSetting(Settings::values.use_speed_limit);
WriteGlobalSetting(Settings::values.speed_limit); WriteGlobalSetting(Settings::values.speed_limit);
WriteGlobalSetting(Settings::values.fps_cap);
WriteGlobalSetting(Settings::values.use_disk_shader_cache); WriteGlobalSetting(Settings::values.use_disk_shader_cache);
WriteSetting(QString::fromStdString(Settings::values.gpu_accuracy.GetLabel()), WriteSetting(QString::fromStdString(Settings::values.gpu_accuracy.GetLabel()),
static_cast<u32>(Settings::values.gpu_accuracy.GetValue(global)), static_cast<u32>(Settings::values.gpu_accuracy.GetValue(global)),
@ -1208,7 +1209,6 @@ void Config::SaveRendererValues() {
WriteGlobalSetting(Settings::values.bg_blue); WriteGlobalSetting(Settings::values.bg_blue);
if (global) { if (global) {
WriteBasicSetting(Settings::values.fps_cap);
WriteBasicSetting(Settings::values.renderer_debug); WriteBasicSetting(Settings::values.renderer_debug);
WriteBasicSetting(Settings::values.renderer_shader_feedback); WriteBasicSetting(Settings::values.renderer_shader_feedback);
WriteBasicSetting(Settings::values.enable_nsight_aftermath); WriteBasicSetting(Settings::values.enable_nsight_aftermath);

View File

@ -30,6 +30,9 @@ ConfigureGeneral::ConfigureGeneral(const Core::System& system_, QWidget* parent)
connect(ui->button_reset_defaults, &QPushButton::clicked, this, connect(ui->button_reset_defaults, &QPushButton::clicked, this,
&ConfigureGeneral::ResetDefaults); &ConfigureGeneral::ResetDefaults);
ui->fps_cap_label->setVisible(Settings::IsConfiguringGlobal());
ui->fps_cap_combobox->setVisible(!Settings::IsConfiguringGlobal());
} }
ConfigureGeneral::~ConfigureGeneral() = default; ConfigureGeneral::~ConfigureGeneral() = default;
@ -57,6 +60,11 @@ void ConfigureGeneral::SetConfiguration() {
} else { } else {
ui->speed_limit->setEnabled(Settings::values.use_speed_limit.GetValue() && ui->speed_limit->setEnabled(Settings::values.use_speed_limit.GetValue() &&
use_speed_limit != ConfigurationShared::CheckState::Global); use_speed_limit != ConfigurationShared::CheckState::Global);
ui->fps_cap_combobox->setCurrentIndex(Settings::values.fps_cap.UsingGlobal() ? 0 : 1);
ui->fps_cap->setEnabled(!Settings::values.fps_cap.UsingGlobal());
ConfigurationShared::SetHighlight(ui->fps_cap_layout,
!Settings::values.fps_cap.UsingGlobal());
} }
} }
@ -106,6 +114,13 @@ void ConfigureGeneral::ApplyConfiguration() {
Qt::Checked); Qt::Checked);
Settings::values.speed_limit.SetValue(ui->speed_limit->value()); Settings::values.speed_limit.SetValue(ui->speed_limit->value());
} }
if (ui->fps_cap_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
Settings::values.fps_cap.SetGlobal(true);
} else {
Settings::values.fps_cap.SetGlobal(false);
Settings::values.fps_cap.SetValue(ui->fps_cap->value());
}
} }
} }
@ -148,4 +163,9 @@ void ConfigureGeneral::SetupPerGameUI() {
ui->speed_limit->setEnabled(ui->toggle_speed_limit->isChecked() && ui->speed_limit->setEnabled(ui->toggle_speed_limit->isChecked() &&
(use_speed_limit != ConfigurationShared::CheckState::Global)); (use_speed_limit != ConfigurationShared::CheckState::Global));
}); });
connect(ui->fps_cap_combobox, qOverload<int>(&QComboBox::activated), this, [this](int index) {
ui->fps_cap->setEnabled(index == 1);
ConfigurationShared::SetHighlight(ui->fps_cap_layout, index == 1);
});
} }

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>329</width> <width>744</width>
<height>407</height> <height>568</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -28,17 +28,67 @@
<item> <item>
<layout class="QVBoxLayout" name="GeneralVerticalLayout"> <layout class="QVBoxLayout" name="GeneralVerticalLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QWidget" name="fps_cap_layout" native="true">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QComboBox" name="fps_cap_combobox">
<property name="currentText">
<string>Use global framerate cap</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Use global framerate cap</string>
</property>
</item>
<item>
<property name="text">
<string>Set framerate cap:</string>
</property>
</item>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="fps_cap_label"> <widget class="QLabel" name="fps_cap_label">
<property name="text">
<string>Framerate Cap</string>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Requires the use of the FPS Limiter Toggle hotkey to take effect.</string> <string>Requires the use of the FPS Limiter Toggle hotkey to take effect.</string>
</property> </property>
<property name="text">
<string>Framerate Cap</string>
</property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item> <item>
<widget class="QSpinBox" name="fps_cap"> <widget class="QSpinBox" name="fps_cap">
<property name="suffix"> <property name="suffix">
@ -56,6 +106,7 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">