libretro-dolphin/Source/Core/DolphinQt/TAS/TASInputWindow.h
JosJuice 1c4088e203 DolphinQt: Allow customizing TAS input turbo interval
As a side effect of 9c5c3c0, Dolphin's frame counter was changed
to run at 60/50 Hz even if the game is running at a lower framerate
such as 30 fps. Since the TAS input turbo button functionality
toggled the state of a button every other frame as reported by
the frame counter, this change made the turbo button functionality
not work with 30/25 fps games.

I believe it would be hard to change the frame counter back to
how it used to work without undermining the point of 9c5c3c0,
and I'm not sure if doing so would be desireable or not anyway,
so what I'm doing instead is letting the user determine how long
turbo button presses should last. This lets users avoid the 30/25
fps game problem while also granting additional flexibility.
Perhaps there is some game where it is useful to mash at a speed
which is slower than frame perfect.
2020-07-02 16:58:29 +02:00

54 lines
1.7 KiB
C++

// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <QDialog>
#include "Common/CommonTypes.h"
struct GCPadStatus;
class QBoxLayout;
class QCheckBox;
class QDialog;
class QGroupBox;
class QSpinBox;
class QString;
class TASCheckBox;
class TASInputWindow : public QDialog
{
Q_OBJECT
public:
explicit TASInputWindow(QWidget* parent);
int GetTurboPressFrames() const;
int GetTurboReleaseFrames() const;
protected:
TASCheckBox* CreateButton(const QString& name);
QGroupBox* CreateStickInputs(QString name, QSpinBox*& x_value, QSpinBox*& y_value, u16 max_x,
u16 max_y, Qt::Key x_shortcut_key, Qt::Key y_shortcut_key);
QBoxLayout* CreateSliderValuePairLayout(QString name, QSpinBox*& value, u16 max,
Qt::Key shortcut_key, QWidget* shortcut_widget,
bool invert = false);
QSpinBox* CreateSliderValuePair(QBoxLayout* layout, u16 max, QKeySequence shortcut_key_sequence,
Qt::Orientation orientation, QWidget* shortcut_widget,
bool invert = false);
template <typename UX>
void GetButton(TASCheckBox* button, UX& pad, UX mask);
void GetSpinBoxU8(QSpinBox* spin, u8& controller_value);
void GetSpinBoxU16(QSpinBox* spin, u16& controller_value);
QGroupBox* m_settings_box;
QCheckBox* m_use_controller;
QSpinBox* m_turbo_press_frames;
QSpinBox* m_turbo_release_frames;
private:
std::map<TASCheckBox*, bool> m_checkbox_set_by_controller;
std::map<QSpinBox*, u8> m_spinbox_most_recent_values_u8;
std::map<QSpinBox*, u8> m_spinbox_most_recent_values_u16;
};