mirror of
https://github.com/azahar-emu/azahar.git
synced 2025-04-28 13:47:59 +03:00
Overhaul turbo speed implementation to use temporary_frame_limit
This commit is contained in:
parent
eba3c2c08f
commit
dcbf79df14
19 changed files with 112 additions and 123 deletions
|
@ -186,6 +186,10 @@ object NativeLibrary {
|
|||
|
||||
external fun unlinkConsole()
|
||||
|
||||
external fun setTemporaryFrameLimit(speed: Double)
|
||||
|
||||
external fun disableTemporaryFrameLimit()
|
||||
|
||||
private var coreErrorAlertResult = false
|
||||
private val coreErrorAlertLock = Object()
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.citra.citra_emu.contracts.OpenFileResultContract
|
|||
import org.citra.citra_emu.databinding.ActivityEmulationBinding
|
||||
import org.citra.citra_emu.display.ScreenAdjustmentUtil
|
||||
import org.citra.citra_emu.features.hotkeys.HotkeyUtility
|
||||
import org.citra.citra_emu.features.hotkeys.HotkeyFunctions
|
||||
import org.citra.citra_emu.features.settings.model.BooleanSetting
|
||||
import org.citra.citra_emu.features.settings.model.IntSetting
|
||||
import org.citra.citra_emu.features.settings.model.SettingsViewModel
|
||||
|
@ -46,6 +45,7 @@ import org.citra.citra_emu.utils.FileBrowserHelper
|
|||
import org.citra.citra_emu.utils.EmulationLifecycleUtil
|
||||
import org.citra.citra_emu.utils.EmulationMenuSettings
|
||||
import org.citra.citra_emu.utils.ThemeUtil
|
||||
import org.citra.citra_emu.utils.TurboHelper
|
||||
import org.citra.citra_emu.viewmodel.EmulationViewModel
|
||||
|
||||
class EmulationActivity : AppCompatActivity() {
|
||||
|
@ -57,7 +57,6 @@ class EmulationActivity : AppCompatActivity() {
|
|||
|
||||
private lateinit var binding: ActivityEmulationBinding
|
||||
private lateinit var screenAdjustmentUtil: ScreenAdjustmentUtil
|
||||
private lateinit var hotkeyFunctions: HotkeyFunctions
|
||||
private lateinit var hotkeyUtility: HotkeyUtility
|
||||
|
||||
private val emulationFragment: EmulationFragment
|
||||
|
@ -80,8 +79,7 @@ class EmulationActivity : AppCompatActivity() {
|
|||
|
||||
binding = ActivityEmulationBinding.inflate(layoutInflater)
|
||||
screenAdjustmentUtil = ScreenAdjustmentUtil(this, windowManager, settingsViewModel.settings)
|
||||
hotkeyFunctions = HotkeyFunctions(settingsViewModel.settings)
|
||||
hotkeyUtility = HotkeyUtility(screenAdjustmentUtil, hotkeyFunctions, this)
|
||||
hotkeyUtility = HotkeyUtility(screenAdjustmentUtil, this)
|
||||
setContentView(binding.root)
|
||||
|
||||
val navHostFragment =
|
||||
|
@ -144,7 +142,6 @@ class EmulationActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
hotkeyFunctions.resetTurboSpeed()
|
||||
EmulationLifecycleUtil.clear()
|
||||
isEmulationRunning = false
|
||||
instance = null
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
package org.citra.citra_emu.features.hotkeys
|
||||
|
||||
import android.widget.Toast
|
||||
import org.citra.citra_emu.CitraApplication
|
||||
import org.citra.citra_emu.NativeLibrary
|
||||
import org.citra.citra_emu.features.settings.model.IntSetting
|
||||
import org.citra.citra_emu.features.settings.model.Settings
|
||||
import org.citra.citra_emu.features.settings.utils.SettingsFile
|
||||
|
||||
|
||||
class HotkeyFunctions (
|
||||
private val settings: Settings
|
||||
) {
|
||||
private var normalSpeed = IntSetting.FRAME_LIMIT.int
|
||||
var isTurboSpeedEnabled = false
|
||||
|
||||
// Turbo Speed
|
||||
fun setTurboSpeed(enabled: Boolean) {
|
||||
isTurboSpeedEnabled = enabled
|
||||
toggleTurboSpeed()
|
||||
}
|
||||
|
||||
fun toggleTurboSpeed() {
|
||||
if (isTurboSpeedEnabled) {
|
||||
IntSetting.FRAME_LIMIT.int = IntSetting.TURBO_SPEED.int
|
||||
} else {
|
||||
IntSetting.FRAME_LIMIT.int = normalSpeed
|
||||
}
|
||||
|
||||
settings.saveSetting(IntSetting.FRAME_LIMIT, SettingsFile.FILE_NAME_CONFIG)
|
||||
NativeLibrary.reloadSettings()
|
||||
|
||||
val context = CitraApplication.appContext
|
||||
Toast.makeText(context,
|
||||
"Changed Emulation Speed to: ${IntSetting.FRAME_LIMIT.int}%", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
fun resetTurboSpeed() {
|
||||
isTurboSpeedEnabled = false
|
||||
IntSetting.FRAME_LIMIT.int = normalSpeed
|
||||
|
||||
settings.saveSetting(IntSetting.FRAME_LIMIT, SettingsFile.FILE_NAME_CONFIG)
|
||||
NativeLibrary.reloadSettings()
|
||||
}
|
||||
}
|
|
@ -9,11 +9,11 @@ import android.widget.Toast
|
|||
import org.citra.citra_emu.NativeLibrary
|
||||
import org.citra.citra_emu.R
|
||||
import org.citra.citra_emu.utils.EmulationLifecycleUtil
|
||||
import org.citra.citra_emu.utils.TurboHelper
|
||||
import org.citra.citra_emu.display.ScreenAdjustmentUtil
|
||||
|
||||
class HotkeyUtility(
|
||||
private val screenAdjustmentUtil: ScreenAdjustmentUtil,
|
||||
private val hotkeyFunctions: HotkeyFunctions,
|
||||
private val context: Context) {
|
||||
|
||||
private val hotkeyButtons = Hotkey.entries.map { it.button }
|
||||
|
@ -25,7 +25,7 @@ class HotkeyUtility(
|
|||
Hotkey.CYCLE_LAYOUT.button -> screenAdjustmentUtil.cycleLayouts()
|
||||
Hotkey.CLOSE_GAME.button -> EmulationLifecycleUtil.closeGame()
|
||||
Hotkey.PAUSE_OR_RESUME.button -> EmulationLifecycleUtil.pauseOrResume()
|
||||
Hotkey.TURBO_SPEED.button -> hotkeyFunctions.setTurboSpeed(!hotkeyFunctions.isTurboSpeedEnabled)
|
||||
Hotkey.TURBO_SPEED.button -> TurboHelper.setTurboEnabled(!TurboHelper.isTurboSpeedEnabled())
|
||||
Hotkey.QUICKSAVE.button -> {
|
||||
NativeLibrary.saveState(NativeLibrary.QUICKSAVE_SLOT)
|
||||
Toast.makeText(context,
|
||||
|
|
|
@ -97,8 +97,7 @@ enum class IntSetting(
|
|||
ASYNC_CUSTOM_LOADING,
|
||||
AUDIO_INPUT_TYPE,
|
||||
USE_ARTIC_BASE_CONTROLLER,
|
||||
SHADERS_ACCURATE_MUL,
|
||||
FRAME_LIMIT
|
||||
SHADERS_ACCURATE_MUL
|
||||
)
|
||||
|
||||
fun from(key: String): IntSetting? = IntSetting.values().firstOrNull { it.key == key }
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.citra.citra_emu.features.settings.model.Settings
|
|||
import org.citra.citra_emu.utils.SystemSaveGame
|
||||
import org.citra.citra_emu.utils.DirectoryInitialization
|
||||
import org.citra.citra_emu.utils.Log
|
||||
import org.citra.citra_emu.utils.TurboHelper
|
||||
|
||||
class SettingsActivityPresenter(private val activityView: SettingsActivityView) {
|
||||
val settings: Settings get() = activityView.settings
|
||||
|
@ -66,6 +67,7 @@ class SettingsActivityPresenter(private val activityView: SettingsActivityView)
|
|||
//added to ensure that layout changes take effect as soon as settings window closes
|
||||
NativeLibrary.reloadSettings()
|
||||
NativeLibrary.updateFramebuffer(NativeLibrary.isPortraitMode)
|
||||
TurboHelper.reloadTurbo() // TODO: Can this go someone else? -OS
|
||||
}
|
||||
NativeLibrary.reloadSettings()
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import androidx.preference.PreferenceManager
|
|||
import org.citra.citra_emu.CitraApplication
|
||||
import org.citra.citra_emu.NativeLibrary
|
||||
import org.citra.citra_emu.R
|
||||
import org.citra.citra_emu.features.hotkeys.HotkeyFunctions
|
||||
import org.citra.citra_emu.utils.EmulationMenuSettings
|
||||
import org.citra.citra_emu.utils.TurboHelper
|
||||
import java.lang.NullPointerException
|
||||
import kotlin.math.min
|
||||
|
||||
|
@ -46,7 +46,6 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex
|
|||
private var dpadBeingConfigured: InputOverlayDrawableDpad? = null
|
||||
private var joystickBeingConfigured: InputOverlayDrawableJoystick? = null
|
||||
private val settingsViewModel = NativeLibrary.sEmulationActivity.get()!!.settingsViewModel
|
||||
private val hotkeyFunctions = HotkeyFunctions(settingsViewModel.settings)
|
||||
|
||||
// Stores the ID of the pointer that interacted with the 3DS touchscreen.
|
||||
private var touchscreenPointerId = -1
|
||||
|
@ -108,8 +107,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex
|
|||
}
|
||||
|
||||
if (button.id == NativeLibrary.ButtonType.BUTTON_TURBO && button.status == NativeLibrary.ButtonState.PRESSED) {
|
||||
|
||||
hotkeyFunctions.setTurboSpeed((!hotkeyFunctions.isTurboSpeedEnabled))
|
||||
TurboHelper.setTurboEnabled((!TurboHelper.isTurboSpeedEnabled()))
|
||||
}
|
||||
|
||||
NativeLibrary.onGamePadEvent(NativeLibrary.TouchScreenDevice, button.id, button.status)
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
package org.citra.citra_emu.utils
|
||||
|
||||
import android.widget.Toast
|
||||
import org.citra.citra_emu.CitraApplication
|
||||
import org.citra.citra_emu.NativeLibrary
|
||||
import org.citra.citra_emu.R
|
||||
import org.citra.citra_emu.features.settings.model.IntSetting
|
||||
|
||||
object TurboHelper {
|
||||
private var turboSpeedEnabled = false
|
||||
|
||||
fun isTurboSpeedEnabled(): Boolean {
|
||||
return turboSpeedEnabled
|
||||
}
|
||||
|
||||
fun setTurboEnabled(state: Boolean) {
|
||||
turboSpeedEnabled = state
|
||||
reloadTurbo()
|
||||
}
|
||||
|
||||
fun reloadTurbo() {
|
||||
val context = CitraApplication.appContext
|
||||
val toastMessage: String
|
||||
|
||||
if (turboSpeedEnabled) {
|
||||
NativeLibrary.setTemporaryFrameLimit(IntSetting.TURBO_SPEED.int.toDouble())
|
||||
toastMessage = context.getString(R.string.turbo_enabled_toast)
|
||||
} else {
|
||||
NativeLibrary.disableTemporaryFrameLimit()
|
||||
toastMessage = context.getString(R.string.turbo_disabled_toast)
|
||||
}
|
||||
|
||||
Toast.makeText(context, toastMessage, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
|
@ -156,6 +156,10 @@ use_frame_limit =
|
|||
# 1 - 9999: Speed limit as a percentage of target game speed. 100 (default)
|
||||
frame_limit =
|
||||
|
||||
# Alternative frame limit which can be triggered by the user
|
||||
# 1 - 9999: Speed limit as a percentage of target game speed. 100 (default)
|
||||
turbo_speed =
|
||||
|
||||
# The clear color for the renderer. What shows up on the sides of the bottom screen.
|
||||
# Must be in range of 0.0-1.0. Defaults to 0.0 for all.
|
||||
bg_red =
|
||||
|
|
|
@ -781,4 +781,14 @@ void Java_org_citra_citra_1emu_NativeLibrary_unlinkConsole(JNIEnv* env, jobject
|
|||
HW::UniqueData::UnlinkConsole();
|
||||
}
|
||||
|
||||
void Java_org_citra_citra_1emu_NativeLibrary_setTemporaryFrameLimit(JNIEnv* env, jobject obj,
|
||||
jdouble speed) {
|
||||
Settings::temporary_frame_limit = speed;
|
||||
Settings::is_temporary_frame_limit = true;
|
||||
}
|
||||
|
||||
void Java_org_citra_citra_1emu_NativeLibrary_disableTemporaryFrameLimit(JNIEnv* env, jobject obj) {
|
||||
Settings::is_temporary_frame_limit = false;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
|
|
@ -146,6 +146,8 @@
|
|||
<string name="button_zr" translatable="false">ZR</string>
|
||||
<string name="input_message_analog_only">This control must be bound to a gamepad analog stick or D-pad axis!</string>
|
||||
<string name="input_message_button_only">This control must be bound to a gamepad button!</string>
|
||||
<string name="turbo_enabled_toast">Turbo Speed Enabled</string>
|
||||
<string name="turbo_disabled_toast">Turbo Speed Disabled</string>
|
||||
|
||||
<!-- System files strings -->
|
||||
<string name="setup_system_files">System Files</string>
|
||||
|
|
|
@ -813,10 +813,10 @@ void GMainWindow::InitializeHotkeys() {
|
|||
connect_shortcut(QStringLiteral("Toggle Custom Textures"),
|
||||
[&] { Settings::values.custom_textures = !Settings::values.custom_textures; });
|
||||
|
||||
connect_shortcut(QStringLiteral("Toggle Turbo Mode"), &GMainWindow::ToggleEmulationSpeed);
|
||||
connect_shortcut(QStringLiteral("Toggle Turbo Mode"),
|
||||
[&] { GMainWindow::SetTurboEnabled(!GMainWindow::IsTurboEnabled()); });
|
||||
|
||||
connect_shortcut(QStringLiteral("Increase Speed Limit"), [&] { AdjustSpeedLimit(true); });
|
||||
|
||||
connect_shortcut(QStringLiteral("Decrease Speed Limit"), [&] { AdjustSpeedLimit(false); });
|
||||
|
||||
connect_shortcut(QStringLiteral("Audio Mute/Unmute"), &GMainWindow::OnMute);
|
||||
|
@ -2380,7 +2380,6 @@ void GMainWindow::OnMenuRecentFile() {
|
|||
}
|
||||
|
||||
void GMainWindow::OnStartGame() {
|
||||
GetInitialFrameLimit();
|
||||
qt_cameras->ResumeCameras();
|
||||
|
||||
PreventOSSleep();
|
||||
|
@ -2440,11 +2439,7 @@ void GMainWindow::OnPauseContinueGame() {
|
|||
}
|
||||
|
||||
void GMainWindow::OnStopGame() {
|
||||
if (turbo_mode_active) {
|
||||
turbo_mode_active = false;
|
||||
Settings::values.frame_limit.SetValue(initial_frame_limit);
|
||||
UpdateStatusBar();
|
||||
}
|
||||
SetTurboEnabled(false);
|
||||
|
||||
play_time_manager->Stop();
|
||||
// Update game list to show new play time
|
||||
|
@ -2597,52 +2592,48 @@ void GMainWindow::ChangeSmallScreenPosition() {
|
|||
UpdateSecondaryWindowVisibility();
|
||||
}
|
||||
|
||||
void GMainWindow::GetInitialFrameLimit() {
|
||||
initial_frame_limit = Settings::values.frame_limit.GetValue();
|
||||
turbo_mode_active = false;
|
||||
bool GMainWindow::IsTurboEnabled() {
|
||||
return turbo_mode_active;
|
||||
}
|
||||
|
||||
void GMainWindow::ToggleEmulationSpeed() {
|
||||
static bool key_pressed = false; // Prevent spam on hold
|
||||
void GMainWindow::SetTurboEnabled(bool state) {
|
||||
turbo_mode_active = state;
|
||||
GMainWindow::ReloadTurbo();
|
||||
}
|
||||
|
||||
if (!key_pressed) {
|
||||
key_pressed = true;
|
||||
turbo_mode_active = !turbo_mode_active;
|
||||
|
||||
if (turbo_mode_active) {
|
||||
Settings::values.frame_limit.SetValue(Settings::values.turbo_speed.GetValue());
|
||||
} else {
|
||||
Settings::values.frame_limit.SetValue(initial_frame_limit);
|
||||
}
|
||||
|
||||
UpdateStatusBar();
|
||||
QTimer::singleShot(200, [] { key_pressed = false; });
|
||||
void GMainWindow::ReloadTurbo() {
|
||||
if (IsTurboEnabled()) {
|
||||
Settings::temporary_frame_limit = Settings::values.turbo_speed.GetValue();
|
||||
Settings::is_temporary_frame_limit = true;
|
||||
} else {
|
||||
Settings::is_temporary_frame_limit = false;
|
||||
}
|
||||
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
||||
// TODO: This should probably take in something more descriptive than a bool. -OS
|
||||
void GMainWindow::AdjustSpeedLimit(bool increase) {
|
||||
if (!turbo_mode_active) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int SPEED_LIMIT_STEP = 5;
|
||||
int turbo_speed = Settings::values.turbo_speed.GetValue();
|
||||
auto active_limit =
|
||||
IsTurboEnabled() ? &Settings::values.turbo_speed : &Settings::values.frame_limit;
|
||||
const auto active_limit_value = active_limit->GetValue();
|
||||
|
||||
if (increase) {
|
||||
if (turbo_speed < 995) {
|
||||
Settings::values.turbo_speed.SetValue(turbo_speed + SPEED_LIMIT_STEP);
|
||||
Settings::values.frame_limit.SetValue(turbo_speed + SPEED_LIMIT_STEP);
|
||||
if (active_limit_value < 995) {
|
||||
active_limit->SetValue(active_limit_value + SPEED_LIMIT_STEP);
|
||||
}
|
||||
} else {
|
||||
if (turbo_speed > SPEED_LIMIT_STEP) {
|
||||
Settings::values.turbo_speed.SetValue(turbo_speed - SPEED_LIMIT_STEP);
|
||||
Settings::values.frame_limit.SetValue(turbo_speed - SPEED_LIMIT_STEP);
|
||||
if (active_limit_value > SPEED_LIMIT_STEP) {
|
||||
active_limit->SetValue(active_limit_value - SPEED_LIMIT_STEP);
|
||||
}
|
||||
}
|
||||
|
||||
if (turbo_mode_active) {
|
||||
UpdateStatusBar();
|
||||
if (IsTurboEnabled()) {
|
||||
ReloadTurbo();
|
||||
}
|
||||
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
||||
void GMainWindow::ToggleScreenLayout() {
|
||||
|
@ -2762,6 +2753,7 @@ void GMainWindow::OnConfigure() {
|
|||
} else {
|
||||
setMouseTracking(false);
|
||||
}
|
||||
ReloadTurbo();
|
||||
UpdateSecondaryWindowVisibility();
|
||||
UpdateBootHomeMenuState();
|
||||
UpdateStatusButtons();
|
||||
|
|
|
@ -222,7 +222,6 @@ private:
|
|||
|
||||
private slots:
|
||||
void OnStartGame();
|
||||
void GetInitialFrameLimit();
|
||||
void OnRestartGame();
|
||||
void OnPauseGame();
|
||||
void OnPauseContinueGame();
|
||||
|
@ -261,7 +260,9 @@ private slots:
|
|||
void ToggleSecondaryFullscreen();
|
||||
void ChangeScreenLayout();
|
||||
void ChangeSmallScreenPosition();
|
||||
void ToggleEmulationSpeed();
|
||||
bool IsTurboEnabled();
|
||||
void SetTurboEnabled(bool);
|
||||
void ReloadTurbo();
|
||||
void AdjustSpeedLimit(bool increase);
|
||||
void UpdateSecondaryWindowVisibility();
|
||||
void ToggleScreenLayout();
|
||||
|
@ -411,8 +412,6 @@ private:
|
|||
u32 newest_slot;
|
||||
u64 newest_slot_time;
|
||||
|
||||
int initial_frame_limit;
|
||||
|
||||
// Secondary window actions
|
||||
QAction* action_secondary_fullscreen;
|
||||
QAction* action_secondary_toggle_screen;
|
||||
|
|
|
@ -685,6 +685,7 @@ void QtConfig::ReadRendererValues() {
|
|||
ReadGlobalSetting(Settings::values.use_vsync_new);
|
||||
ReadGlobalSetting(Settings::values.resolution_factor);
|
||||
ReadGlobalSetting(Settings::values.frame_limit);
|
||||
ReadGlobalSetting(Settings::values.turbo_speed);
|
||||
|
||||
ReadGlobalSetting(Settings::values.bg_red);
|
||||
ReadGlobalSetting(Settings::values.bg_green);
|
||||
|
@ -811,7 +812,6 @@ void QtConfig::ReadUIValues() {
|
|||
ReadBasicSetting(UISettings::values.display_titlebar);
|
||||
ReadBasicSetting(UISettings::values.show_filter_bar);
|
||||
ReadBasicSetting(UISettings::values.show_status_bar);
|
||||
ReadBasicSetting(Settings::values.turbo_speed);
|
||||
ReadBasicSetting(UISettings::values.confirm_before_closing);
|
||||
ReadBasicSetting(UISettings::values.save_state_warning);
|
||||
ReadBasicSetting(UISettings::values.first_start);
|
||||
|
@ -1212,6 +1212,7 @@ void QtConfig::SaveRendererValues() {
|
|||
WriteGlobalSetting(Settings::values.use_vsync_new);
|
||||
WriteGlobalSetting(Settings::values.resolution_factor);
|
||||
WriteGlobalSetting(Settings::values.frame_limit);
|
||||
WriteGlobalSetting(Settings::values.turbo_speed);
|
||||
|
||||
WriteGlobalSetting(Settings::values.bg_red);
|
||||
WriteGlobalSetting(Settings::values.bg_green);
|
||||
|
@ -1322,7 +1323,6 @@ void QtConfig::SaveUIValues() {
|
|||
WriteBasicSetting(UISettings::values.show_filter_bar);
|
||||
WriteBasicSetting(UISettings::values.show_status_bar);
|
||||
WriteBasicSetting(UISettings::values.confirm_before_closing);
|
||||
WriteBasicSetting(Settings::values.turbo_speed);
|
||||
WriteBasicSetting(UISettings::values.save_state_warning);
|
||||
WriteBasicSetting(UISettings::values.first_start);
|
||||
WriteBasicSetting(UISettings::values.callout_flags);
|
||||
|
|
|
@ -28,7 +28,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, Cor
|
|||
bool enable_web_config)
|
||||
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()}, registry{registry_},
|
||||
system{system_}, is_powered_on{system.IsPoweredOn()},
|
||||
general_tab{std::make_unique<ConfigureGeneral>(is_powered_on, this)},
|
||||
general_tab{std::make_unique<ConfigureGeneral>(this)},
|
||||
system_tab{std::make_unique<ConfigureSystem>(system, this)},
|
||||
input_tab{std::make_unique<ConfigureInput>(system, this)},
|
||||
hotkeys_tab{std::make_unique<ConfigureHotkeys>(this)},
|
||||
|
|
|
@ -24,11 +24,11 @@ static constexpr int SettingsToSlider(int value) {
|
|||
return (value - 5) / 5;
|
||||
}
|
||||
|
||||
ConfigureGeneral::ConfigureGeneral(bool is_powered_on, QWidget* parent)
|
||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigureGeneral>()), is_powered_on{is_powered_on} {
|
||||
ConfigureGeneral::ConfigureGeneral(QWidget* parent)
|
||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigureGeneral>()) {
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->turbo_speed, &QSlider::valueChanged, this, [&](int value) {
|
||||
connect(ui->turbo_speed, &QSlider::valueChanged, this, [&](double value) {
|
||||
Settings::values.turbo_speed.SetValue(SliderToSettings(value));
|
||||
ui->turbo_speed_display_label->setText(
|
||||
QStringLiteral("%1%").arg(Settings::values.turbo_speed.GetValue()));
|
||||
|
@ -112,10 +112,7 @@ void ConfigureGeneral::SetConfiguration() {
|
|||
}
|
||||
|
||||
if (!Settings::IsConfiguringGlobal()) {
|
||||
if (is_powered_on) {
|
||||
ui->emulation_speed_combo->setEnabled(false);
|
||||
ui->frame_limit->setEnabled(false);
|
||||
} else if (Settings::values.frame_limit.UsingGlobal()) {
|
||||
if (Settings::values.frame_limit.UsingGlobal()) {
|
||||
ui->emulation_speed_combo->setCurrentIndex(0);
|
||||
ui->frame_limit->setEnabled(false);
|
||||
} else {
|
||||
|
@ -194,11 +191,7 @@ void ConfigureGeneral::RetranslateUI() {
|
|||
|
||||
void ConfigureGeneral::SetupPerGameUI() {
|
||||
if (Settings::IsConfiguringGlobal()) {
|
||||
if (is_powered_on) {
|
||||
ui->frame_limit->setEnabled(false);
|
||||
} else {
|
||||
ui->frame_limit->setEnabled(Settings::values.frame_limit.UsingGlobal());
|
||||
}
|
||||
ui->frame_limit->setEnabled(Settings::values.frame_limit.UsingGlobal());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class ConfigureGeneral : public QWidget {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConfigureGeneral(bool is_powered_on, QWidget* parent = nullptr);
|
||||
explicit ConfigureGeneral(QWidget* parent = nullptr);
|
||||
~ConfigureGeneral() override;
|
||||
|
||||
void ResetDefaults();
|
||||
|
@ -29,5 +29,4 @@ public:
|
|||
|
||||
private:
|
||||
std::unique_ptr<Ui::ConfigureGeneral> ui;
|
||||
bool is_powered_on;
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString
|
|||
|
||||
const bool is_powered_on = system.IsPoweredOn();
|
||||
audio_tab = std::make_unique<ConfigureAudio>(is_powered_on, this);
|
||||
general_tab = std::make_unique<ConfigureGeneral>(is_powered_on, this);
|
||||
general_tab = std::make_unique<ConfigureGeneral>(this);
|
||||
enhancements_tab = std::make_unique<ConfigureEnhancements>(this);
|
||||
layout_tab = std::make_unique<ConfigureLayout>(this);
|
||||
graphics_tab =
|
||||
|
|
|
@ -498,7 +498,7 @@ struct Values {
|
|||
Setting<bool> use_shader_jit{true, "use_shader_jit"};
|
||||
SwitchableSetting<u32, true> resolution_factor{1, 0, 10, "resolution_factor"};
|
||||
SwitchableSetting<double, true> frame_limit{100, 0, 1000, "frame_limit"};
|
||||
SwitchableSetting<int, true> turbo_speed{200, 0, 1000, "turbo_speed"};
|
||||
SwitchableSetting<double, true> turbo_speed{200, 0, 1000, "turbo_speed"};
|
||||
SwitchableSetting<TextureFilter> texture_filter{TextureFilter::NoFilter, "texture_filter"};
|
||||
SwitchableSetting<TextureSampling> texture_sampling{TextureSampling::GameControlled,
|
||||
"texture_sampling"};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue