mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-07-10 06:47:53 -05:00
input_common/tas: Fallback to simple update
This commit is contained in:
@ -175,6 +175,9 @@ void PlayerControlPreview::ResetInputs() {
|
||||
}
|
||||
|
||||
void PlayerControlPreview::UpdateInput() {
|
||||
if (controller_callback.update != nullptr) {
|
||||
controller_callback.update(std::move(true));
|
||||
}
|
||||
if (!is_enabled && !mapping_active) {
|
||||
return;
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ void ControllerDialog::refreshConfiguration() {
|
||||
constexpr std::size_t player = 0;
|
||||
widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs);
|
||||
widget->SetControllerType(players[player].controller_type);
|
||||
ControllerCallback callback{[this](ControllerInput input) { InputController(input); }};
|
||||
ControllerCallback callback{[this](ControllerInput input) { InputController(input); },
|
||||
[this](bool update) { UpdateController(update); }};
|
||||
widget->SetCallBack(callback);
|
||||
widget->repaint();
|
||||
widget->SetConnectedStatus(players[player].connected);
|
||||
@ -74,10 +75,6 @@ void ControllerDialog::hideEvent(QHideEvent* ev) {
|
||||
QWidget::hideEvent(ev);
|
||||
}
|
||||
|
||||
void ControllerDialog::RefreshTasFile() {
|
||||
input_subsystem->GetTas()->RefreshTasFile();
|
||||
}
|
||||
|
||||
void ControllerDialog::InputController(ControllerInput input) {
|
||||
u32 buttons = 0;
|
||||
int index = 0;
|
||||
@ -86,4 +83,11 @@ void ControllerDialog::InputController(ControllerInput input) {
|
||||
index++;
|
||||
}
|
||||
input_subsystem->GetTas()->RecordInput(buttons, input.axis_values);
|
||||
}
|
||||
}
|
||||
|
||||
void ControllerDialog::UpdateController(bool update) {
|
||||
if (!update) {
|
||||
return;
|
||||
}
|
||||
input_subsystem->GetTas()->UpdateThread();
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ struct ControllerInput {
|
||||
|
||||
struct ControllerCallback {
|
||||
std::function<void(ControllerInput)> input;
|
||||
std::function<void(bool)> update;
|
||||
};
|
||||
|
||||
class ControllerDialog : public QWidget {
|
||||
@ -43,8 +44,8 @@ protected:
|
||||
void hideEvent(QHideEvent* ev) override;
|
||||
|
||||
private:
|
||||
void RefreshTasFile();
|
||||
void InputController(ControllerInput input);
|
||||
void UpdateController(bool update);
|
||||
QAction* toggle_view_action = nullptr;
|
||||
QFileSystemWatcher* watcher = nullptr;
|
||||
PlayerControlPreview* widget;
|
||||
|
@ -196,7 +196,6 @@ GMainWindow::GMainWindow()
|
||||
config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
|
||||
provider{std::make_unique<FileSys::ManualContentProvider>()} {
|
||||
Common::Log::Initialize();
|
||||
Settings::values.inputSubsystem = input_subsystem;
|
||||
LoadTranslation();
|
||||
|
||||
setAcceptDrops(true);
|
||||
@ -2903,16 +2902,17 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie
|
||||
}
|
||||
}
|
||||
|
||||
static std::string GetTasStateDescription(TasInput::TasState state) {
|
||||
switch (state) {
|
||||
QString GMainWindow::GetTasStateDescription() const {
|
||||
auto [tas_status, current_tas_frame, total_tas_frames] = input_subsystem->GetTas()->GetStatus();
|
||||
switch (tas_status) {
|
||||
case TasInput::TasState::Running:
|
||||
return "Running";
|
||||
return tr("TAS state: Running %1/%2").arg(current_tas_frame).arg(total_tas_frames);
|
||||
case TasInput::TasState::Recording:
|
||||
return "Recording";
|
||||
return tr("TAS state: Recording %1").arg(total_tas_frames);
|
||||
case TasInput::TasState::Stopped:
|
||||
return "Stopped";
|
||||
return tr("TAS state: Idle %1/%2").arg(current_tas_frame).arg(total_tas_frames);
|
||||
default:
|
||||
return "INVALID STATE";
|
||||
return tr("INVALID TAS STATE");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2923,12 +2923,7 @@ void GMainWindow::UpdateStatusBar() {
|
||||
}
|
||||
|
||||
if (Settings::values.tas_enable) {
|
||||
auto [tas_status, current_tas_frame, total_tas_frames] =
|
||||
input_subsystem->GetTas()->GetStatus();
|
||||
tas_label->setText(tr("%1 TAS %2/%3")
|
||||
.arg(tr(GetTasStateDescription(tas_status).c_str()))
|
||||
.arg(current_tas_frame)
|
||||
.arg(total_tas_frames));
|
||||
tas_label->setText(GetTasStateDescription());
|
||||
} else {
|
||||
tas_label->clear();
|
||||
}
|
||||
|
@ -301,6 +301,7 @@ private:
|
||||
void OpenURL(const QUrl& url);
|
||||
void LoadTranslation();
|
||||
void OpenPerGameConfiguration(u64 title_id, const std::string& file_name);
|
||||
QString GetTasStateDescription() const;
|
||||
|
||||
Ui::MainWindow ui;
|
||||
|
||||
|
Reference in New Issue
Block a user