early-access version 2258

This commit is contained in:
pineappleEA
2021-11-30 05:49:07 +01:00
parent eeba1aa6f2
commit 3c5094eec0
24 changed files with 387 additions and 136 deletions
+4 -19
View File
@@ -139,7 +139,6 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
DisableUnsupportedPlayers();
for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) {
system.HIDCore().GetEmulatedControllerByIndex(player_index)->EnableConfiguration();
SetEmulatedControllers(player_index);
}
@@ -201,23 +200,10 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
connect(ui->buttonBox, &QDialogButtonBox::accepted, this,
&QtControllerSelectorDialog::ApplyConfiguration);
controller_navigation = new ControllerNavigation(system.HIDCore(), this);
connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent,
[this](Qt::Key key) {
if (!this->isActiveWindow()) {
return;
}
QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier);
QCoreApplication::postEvent(this, event);
});
// Enhancement: Check if the parameters have already been met before disconnecting controllers.
// If all the parameters are met AND only allows a single player,
// stop the constructor here as we do not need to continue.
if (CheckIfParametersMet() && parameters.enable_single_mode) {
for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) {
system.HIDCore().GetEmulatedControllerByIndex(player_index)->DisableConfiguration();
}
return;
}
@@ -232,8 +218,8 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
}
QtControllerSelectorDialog::~QtControllerSelectorDialog() {
controller_navigation->UnloadController();
};
system.HIDCore().DisableAllControllerConfiguration();
}
int QtControllerSelectorDialog::exec() {
if (parameters_met && parameters.enable_single_mode) {
@@ -249,12 +235,11 @@ void QtControllerSelectorDialog::ApplyConfiguration() {
Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked());
Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked());
for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) {
system.HIDCore().GetEmulatedControllerByIndex(player_index)->DisableConfiguration();
}
}
void QtControllerSelectorDialog::LoadConfiguration() {
system.HIDCore().EnableAllControllerConfiguration();
const auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
for (std::size_t index = 0; index < NUM_PLAYERS; ++index) {
const auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index);
+2 -6
View File
@@ -7,9 +7,7 @@
#include <array>
#include <memory>
#include <QDialog>
#include "core/core.h"
#include "core/frontend/applets/controller.h"
#include "yuzu/controller_navigation.h"
class GMainWindow;
class QCheckBox;
@@ -33,8 +31,9 @@ class System;
}
namespace Core::HID {
class HIDCore;
enum class NpadStyleIndex : u8;
}
} // namespace Core::HID
class QtControllerSelectorDialog final : public QDialog {
Q_OBJECT
@@ -149,9 +148,6 @@ private:
// Checkboxes representing the "Connected Controllers".
std::array<QCheckBox*, NUM_PLAYERS> connected_controller_checkboxes;
// QObject for navigating the UI with a controller
ControllerNavigation* controller_navigation = nullptr;
};
class QtControllerSelector final : public QObject, public Core::Frontend::ControllerApplet {
+1
View File
@@ -17,6 +17,7 @@
#include "core/hle/lock.h"
#include "yuzu/applets/qt_profile_select.h"
#include "yuzu/main.h"
#include "yuzu/util/controller_navigation.h"
namespace {
QString FormatUserEntryText(const QString& username, Common::UUID uuid) {
+5 -1
View File
@@ -10,8 +10,8 @@
#include <QTreeView>
#include "core/frontend/applets/profile_select.h"
#include "core/hle/service/acc/profile_manager.h"
#include "yuzu/controller_navigation.h"
class ControllerNavigation;
class GMainWindow;
class QDialogButtonBox;
class QGraphicsScene;
@@ -21,6 +21,10 @@ class QStandardItem;
class QStandardItemModel;
class QVBoxLayout;
namespace Core::HID {
class HIDCore;
} // namespace Core::HID
class QtProfileSelectionDialog final : public QDialog {
Q_OBJECT