early-access version 2942
This commit is contained in:
parent
d18eefc8d2
commit
c1583b346c
6 changed files with 39 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 2940.
|
This is the source code for early-access 2942.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,8 @@ struct AnalogProperties {
|
||||||
float offset{};
|
float offset{};
|
||||||
// Invert direction of the sensor data
|
// Invert direction of the sensor data
|
||||||
bool inverted{};
|
bool inverted{};
|
||||||
|
// Press once to activate, press again to release
|
||||||
|
bool toggle{};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Single analog sensor data
|
// Single analog sensor data
|
||||||
|
@ -115,8 +117,11 @@ struct AnalogStatus {
|
||||||
struct ButtonStatus {
|
struct ButtonStatus {
|
||||||
Common::UUID uuid{};
|
Common::UUID uuid{};
|
||||||
bool value{};
|
bool value{};
|
||||||
|
// Invert value of the button
|
||||||
bool inverted{};
|
bool inverted{};
|
||||||
|
// Press once to activate, press again to release
|
||||||
bool toggle{};
|
bool toggle{};
|
||||||
|
// Internal lock for the toggle status
|
||||||
bool locked{};
|
bool locked{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -562,6 +562,16 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GC controllers have triggers not buttons
|
||||||
|
if (npad_type == NpadStyleIndex::GameCube) {
|
||||||
|
if (index == Settings::NativeButton::ZR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == Settings::NativeButton::ZL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case Settings::NativeButton::A:
|
case Settings::NativeButton::A:
|
||||||
controller.npad_button_state.a.Assign(current_status.value);
|
controller.npad_button_state.a.Assign(current_status.value);
|
||||||
|
@ -738,6 +748,11 @@ void EmulatedController::SetTrigger(const Common::Input::CallbackStatus& callbac
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only GC controllers have analog triggers
|
||||||
|
if (npad_type != NpadStyleIndex::GameCube) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto& trigger = controller.trigger_values[index];
|
const auto& trigger = controller.trigger_values[index];
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
|
|
|
@ -52,6 +52,9 @@ Common::Input::ButtonStatus TransformToButton(const Common::Input::CallbackStatu
|
||||||
Common::Input::ButtonStatus status{};
|
Common::Input::ButtonStatus status{};
|
||||||
switch (callback.type) {
|
switch (callback.type) {
|
||||||
case Common::Input::InputType::Analog:
|
case Common::Input::InputType::Analog:
|
||||||
|
status.value = TransformToTrigger(callback).pressed.value;
|
||||||
|
status.toggle = callback.analog_status.properties.toggle;
|
||||||
|
break;
|
||||||
case Common::Input::InputType::Trigger:
|
case Common::Input::InputType::Trigger:
|
||||||
status.value = TransformToTrigger(callback).pressed.value;
|
status.value = TransformToTrigger(callback).pressed.value;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -824,6 +824,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateAnalogDevice(
|
||||||
.threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f),
|
.threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f),
|
||||||
.offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f),
|
.offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f),
|
||||||
.inverted = params.Get("invert", "+") == "-",
|
.inverted = params.Get("invert", "+") == "-",
|
||||||
|
.toggle = static_cast<bool>(params.Get("toggle", false)),
|
||||||
};
|
};
|
||||||
input_engine->PreSetController(identifier);
|
input_engine->PreSetController(identifier);
|
||||||
input_engine->PreSetAxis(identifier, axis);
|
input_engine->PreSetAxis(identifier, axis);
|
||||||
|
|
|
@ -161,6 +161,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
|
||||||
|
|
||||||
const QString toggle = QString::fromStdString(param.Get("toggle", false) ? "~" : "");
|
const QString toggle = QString::fromStdString(param.Get("toggle", false) ? "~" : "");
|
||||||
const QString inverted = QString::fromStdString(param.Get("inverted", false) ? "!" : "");
|
const QString inverted = QString::fromStdString(param.Get("inverted", false) ? "!" : "");
|
||||||
|
const QString invert = QString::fromStdString(param.Get("invert", "+") == "-" ? "-" : "");
|
||||||
const auto common_button_name = input_subsystem->GetButtonName(param);
|
const auto common_button_name = input_subsystem->GetButtonName(param);
|
||||||
|
|
||||||
// Retrieve the names from Qt
|
// Retrieve the names from Qt
|
||||||
|
@ -184,7 +185,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
|
||||||
}
|
}
|
||||||
if (param.Has("axis")) {
|
if (param.Has("axis")) {
|
||||||
const QString axis = QString::fromStdString(param.Get("axis", ""));
|
const QString axis = QString::fromStdString(param.Get("axis", ""));
|
||||||
return QObject::tr("%1%2Axis %3").arg(toggle, inverted, axis);
|
return QObject::tr("%1%2Axis %3").arg(toggle, invert, axis);
|
||||||
}
|
}
|
||||||
if (param.Has("axis_x") && param.Has("axis_y") && param.Has("axis_z")) {
|
if (param.Has("axis_x") && param.Has("axis_y") && param.Has("axis_z")) {
|
||||||
const QString axis_x = QString::fromStdString(param.Get("axis_x", ""));
|
const QString axis_x = QString::fromStdString(param.Get("axis_x", ""));
|
||||||
|
@ -362,18 +363,18 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
button_map[button_id]->setText(tr("[not set]"));
|
button_map[button_id]->setText(tr("[not set]"));
|
||||||
});
|
});
|
||||||
if (param.Has("code") || param.Has("button") || param.Has("hat")) {
|
if (param.Has("code") || param.Has("button") || param.Has("hat")) {
|
||||||
context_menu.addAction(tr("Toggle button"), [&] {
|
|
||||||
const bool toggle_value = !param.Get("toggle", false);
|
|
||||||
param.Set("toggle", toggle_value);
|
|
||||||
button_map[button_id]->setText(ButtonToText(param));
|
|
||||||
emulated_controller->SetButtonParam(button_id, param);
|
|
||||||
});
|
|
||||||
context_menu.addAction(tr("Invert button"), [&] {
|
context_menu.addAction(tr("Invert button"), [&] {
|
||||||
const bool invert_value = !param.Get("inverted", false);
|
const bool invert_value = !param.Get("inverted", false);
|
||||||
param.Set("inverted", invert_value);
|
param.Set("inverted", invert_value);
|
||||||
button_map[button_id]->setText(ButtonToText(param));
|
button_map[button_id]->setText(ButtonToText(param));
|
||||||
emulated_controller->SetButtonParam(button_id, param);
|
emulated_controller->SetButtonParam(button_id, param);
|
||||||
});
|
});
|
||||||
|
context_menu.addAction(tr("Toggle button"), [&] {
|
||||||
|
const bool toggle_value = !param.Get("toggle", false);
|
||||||
|
param.Set("toggle", toggle_value);
|
||||||
|
button_map[button_id]->setText(ButtonToText(param));
|
||||||
|
emulated_controller->SetButtonParam(button_id, param);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (param.Has("axis")) {
|
if (param.Has("axis")) {
|
||||||
context_menu.addAction(tr("Invert axis"), [&] {
|
context_menu.addAction(tr("Invert axis"), [&] {
|
||||||
|
@ -398,6 +399,12 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
}
|
}
|
||||||
emulated_controller->SetButtonParam(button_id, param);
|
emulated_controller->SetButtonParam(button_id, param);
|
||||||
});
|
});
|
||||||
|
context_menu.addAction(tr("Toggle axis"), [&] {
|
||||||
|
const bool toggle_value = !param.Get("toggle", false);
|
||||||
|
param.Set("toggle", toggle_value);
|
||||||
|
button_map[button_id]->setText(ButtonToText(param));
|
||||||
|
emulated_controller->SetButtonParam(button_id, param);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
|
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue