Compare commits

..

1 Commits

Author SHA1 Message Date
Levi Behunin
2c6104f11b Update gc_adapter.cpp
GCC11.2 complains cannot find 'libusb.h' during a fresh build
2022-05-02 00:06:19 -06:00
9 changed files with 17 additions and 90 deletions

View File

@@ -327,7 +327,7 @@ void SanitizeStick(Common::Input::AnalogStatus& analog_x, Common::Input::AnalogS
raw_y += properties_y.offset;
// Apply X scale correction from offset
if (std::abs(properties_x.offset) < 0.75f) {
if (std::abs(properties_x.offset) < 0.5f) {
if (raw_x > 0) {
raw_x /= 1 + properties_x.offset;
} else {
@@ -336,7 +336,7 @@ void SanitizeStick(Common::Input::AnalogStatus& analog_x, Common::Input::AnalogS
}
// Apply Y scale correction from offset
if (std::abs(properties_y.offset) < 0.75f) {
if (std::abs(properties_y.offset) < 0.5f) {
if (raw_y > 0) {
raw_y /= 1 + properties_y.offset;
} else {

View File

@@ -153,48 +153,6 @@ constexpr ResultCode ResultSuccess(0);
*/
constexpr ResultCode ResultUnknown(UINT32_MAX);
/**
* A ResultRange defines an inclusive range of error descriptions within an error module.
* This can be used to check whether the description of a given ResultCode falls within the range.
* The conversion function returns a ResultCode with its description set to description_start.
*
* An example of how it could be used:
* \code
* constexpr ResultRange ResultCommonError{ErrorModule::Common, 0, 9999};
*
* ResultCode Example(int value) {
* const ResultCode result = OtherExample(value);
*
* // This will only evaluate to true if result.module is ErrorModule::Common and
* // result.description is in between 0 and 9999 inclusive.
* if (ResultCommonError.Includes(result)) {
* // This returns ResultCode{ErrorModule::Common, 0};
* return ResultCommonError;
* }
*
* return ResultSuccess;
* }
* \endcode
*/
class ResultRange {
public:
consteval ResultRange(ErrorModule module, u32 description_start, u32 description_end_)
: code{module, description_start}, description_end{description_end_} {}
[[nodiscard]] constexpr operator ResultCode() const {
return code;
}
[[nodiscard]] constexpr bool Includes(ResultCode other) const {
return code.module == other.module && code.description <= other.description &&
other.description <= description_end;
}
private:
ResultCode code;
u32 description_end;
};
/**
* This is an optional value type. It holds a `ResultCode` and, if that code is ResultSuccess, it
* also holds a result of type `T`. If the code is an error code (not ResultSuccess), then trying
@@ -232,8 +190,6 @@ public:
constexpr ResultVal(ResultCode code) : expected{Common::Unexpected(code)} {}
constexpr ResultVal(ResultRange range) : expected{Common::Unexpected(range)} {}
template <typename U>
constexpr ResultVal(U&& val) : expected{std::forward<U>(val)} {}
@@ -319,7 +275,7 @@ public:
}
private:
// TODO (Morph): Replace this with C++23 std::expected.
// TODO: Replace this with std::expected once it is standardized in the STL.
Common::Expected<T, ResultCode> expected;
};

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <fmt/format.h>
#include <libusb.h>
#include <libusb-1.0/libusb.h>
#include "common/logging/log.h"
#include "common/param_package.h"

View File

@@ -732,7 +732,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateHatButtonDevice(
std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateStickDevice(
const Common::ParamPackage& params) {
const auto deadzone = std::clamp(params.Get("deadzone", 0.15f), 0.0f, 1.0f);
const auto range = std::clamp(params.Get("range", 0.95f), 0.25f, 1.50f);
const auto range = std::clamp(params.Get("range", 1.0f), 0.25f, 1.50f);
const auto threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f);
const PadIdentifier identifier = {
.guid = Common::UUID{params.Get("guid", "")},

View File

@@ -563,11 +563,12 @@ void RasterizerOpenGL::SyncViewport() {
flags[Dirty::FrontFace] = false;
GLenum mode = MaxwellToGL::FrontFace(regs.front_face);
bool flip_faces = true;
if (regs.screen_y_control.triangle_rast_flip != 0) {
bool flip_faces = false;
if (regs.screen_y_control.triangle_rast_flip != 0 &&
regs.viewport_transform[0].scale_y < 0.0f) {
flip_faces = !flip_faces;
}
if (regs.viewport_transform[0].scale_y < 0.0f) {
if (regs.viewport_transform[0].scale_z < 0.0f) {
flip_faces = !flip_faces;
}
if (flip_faces) {

View File

@@ -520,28 +520,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
QMenu context_menu;
Common::ParamPackage param = emulated_controller->GetStickParam(analog_id);
context_menu.addAction(tr("Clear"), [&] {
if (param.Get("engine", "") != "analog_from_button") {
emulated_controller->SetStickParam(analog_id, {});
for (auto button : analog_map_buttons[analog_id]) {
button->setText(tr("[not set]"));
}
return;
}
switch (sub_button_id) {
case 0:
param.Erase("up");
break;
case 1:
param.Erase("down");
break;
case 2:
param.Erase("left");
break;
case 3:
param.Erase("right");
break;
}
emulated_controller->SetStickParam(analog_id, param);
emulated_controller->SetStickParam(analog_id, {});
analog_map_buttons[analog_id][sub_button_id]->setText(tr("[not set]"));
});
context_menu.addAction(tr("Center axis"), [&] {
@@ -1009,7 +988,7 @@ void ConfigureInputPlayer::UpdateUI() {
slider_value = static_cast<int>(param.Get("deadzone", 0.15f) * 100);
deadzone_label->setText(tr("Deadzone: %1%").arg(slider_value));
deadzone_slider->setValue(slider_value);
range_spinbox->setValue(static_cast<int>(param.Get("range", 0.95f) * 100));
range_spinbox->setValue(static_cast<int>(param.Get("range", 1.0f) * 100));
} else {
slider_value = static_cast<int>(param.Get("modifier_scale", 0.5f) * 100);
modifier_label->setText(tr("Modifier Range: %1%").arg(slider_value));

View File

@@ -754,13 +754,13 @@
<string>%</string>
</property>
<property name="minimum">
<number>25</number>
<number>50</number>
</property>
<property name="maximum">
<number>150</number>
</property>
<property name="value">
<number>95</number>
<number>100</number>
</property>
</widget>
</item>
@@ -2985,13 +2985,13 @@
<string>%</string>
</property>
<property name="minimum">
<number>25</number>
<number>50</number>
</property>
<property name="maximum">
<number>150</number>
</property>
<property name="value">
<number>95</number>
<number>100</number>
</property>
</widget>
</item>

View File

@@ -26,15 +26,7 @@ void ConfigureNetwork::ApplyConfiguration() {
Settings::values.network_interface = ui->network_interface->currentText().toStdString();
}
void ConfigureNetwork::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureNetwork::RetranslateUI() {
void ConfigureNetwork::RetranslateUi() {
ui->retranslateUi(this);
}

View File

@@ -18,10 +18,9 @@ public:
~ConfigureNetwork() override;
void ApplyConfiguration();
void RetranslateUi();
private:
void changeEvent(QEvent*) override;
void RetranslateUI();
void SetConfiguration();
std::unique_ptr<Ui::ConfigureNetwork> ui;