yuzu-emu
/
yuzu
Archived
1
0
Fork 0

second commit lion review

This commit is contained in:
german77 2021-11-01 14:17:53 -06:00 committed by Narr the Reg
parent 730f078302
commit 77fa4d4bf6
28 changed files with 73 additions and 42 deletions

View File

@ -29,7 +29,7 @@ enum class InputType {
Ir,
};
enum class BatteryLevel {
enum class BatteryLevel : u32 {
None,
Empty,
Critical,

View File

@ -209,10 +209,11 @@ int EmulatedConsole::SetCallback(ConsoleUpdateCallback update_callback) {
void EmulatedConsole::DeleteCallback(int key) {
std::lock_guard lock{mutex};
if (!callback_list.contains(key)) {
const auto& iterator = callback_list.find(key);
if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
callback_list.erase(key);
callback_list.erase(iterator);
}
} // namespace Core::HID

View File

@ -993,10 +993,11 @@ int EmulatedController::SetCallback(ControllerUpdateCallback update_callback) {
void EmulatedController::DeleteCallback(int key) {
std::lock_guard lock{mutex};
if (!callback_list.contains(key)) {
const auto& iterator = callback_list.find(key);
if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
callback_list.erase(key);
callback_list.erase(iterator);
}
} // namespace Core::HID

View File

@ -362,10 +362,11 @@ int EmulatedDevices::SetCallback(InterfaceUpdateCallback update_callback) {
void EmulatedDevices::DeleteCallback(int key) {
std::lock_guard lock{mutex};
if (!callback_list.contains(key)) {
const auto& iterator = callback_list.find(key);
if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
callback_list.erase(key);
callback_list.erase(iterator);
}
} // namespace Core::HID

View File

@ -3,6 +3,9 @@
// Refer to the license.txt file included.
#include "common/assert.h"
#include "core/hid/emulated_console.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h"
namespace Core::HID {

View File

@ -6,9 +6,13 @@
#include <memory>
#include "core/hid/emulated_console.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/emulated_devices.h"
#include "core/hid/hid_types.h"
namespace Core::HID {
class EmulatedConsole;
class EmulatedController;
class EmulatedDevices;
} // namespace Core::HID
namespace Core::HID {

View File

@ -4,9 +4,17 @@
#pragma once
namespace Input {
namespace Common::Input {
struct CallbackStatus;
};
enum class BatteryLevel : u32;
using BatteryStatus = BatteryLevel;
struct AnalogStatus;
struct ButtonStatus;
struct MotionStatus;
struct StickStatus;
struct TouchStatus;
struct TriggerStatus;
}; // namespace Common::Input
namespace Core::HID {

View File

@ -10,6 +10,8 @@
#include "common/string_util.h"
#include "core/core.h"
#include "core/frontend/applets/controller.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hle/result.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/am/applets/applet_controller.h"

View File

@ -5,6 +5,7 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hid/emulated_console.h"
#include "core/hle/service/hid/controllers/console_sixaxis.h"
namespace Service::HID {

View File

@ -7,6 +7,7 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/debug_pad.h"

View File

@ -8,13 +8,10 @@
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/point.h"
#include "core/hid/emulated_console.h"
#include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h"
namespace Core::HID {
class EmulatedController;
} // namespace Core::HID
namespace Service::HID {
class Controller_Gesture final : public ControllerBase {
public:

View File

@ -7,6 +7,7 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/keyboard.h"

View File

@ -7,6 +7,7 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/frontend/emu_window.h"
#include "core/hid/emulated_devices.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/hid/controllers/mouse.h"

View File

@ -12,6 +12,8 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_readable_event.h"
#include "core/hle/kernel/k_writable_event.h"

View File

@ -12,11 +12,15 @@
#include "common/common_types.h"
#include "common/quaternion.h"
#include "common/settings.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/ring_lifo.h"
namespace Core::HID {
class EmulatedController;
enum class ControllerTriggerType;
} // namespace Core::HID
namespace Kernel {
class KEvent;
class KReadableEvent;

View File

@ -9,6 +9,7 @@
#include "common/common_types.h"
#include "common/point.h"
#include "common/swap.h"
#include "core/hid/emulated_console.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
#include "core/hle/service/hid/controllers/controller_base.h"

View File

@ -7,6 +7,12 @@
namespace InputCommon {
constexpr PadIdentifier identifier = {
.guid = Common::UUID{Common::INVALID_UUID},
.port = 0,
.pad = 0,
};
Keyboard::Keyboard(const std::string& input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
}

View File

@ -32,13 +32,6 @@ public:
/// Used for automapping features
std::vector<Common::ParamPackage> GetInputDevices() const override;
private:
const PadIdentifier identifier = {
.guid = Common::UUID{Common::INVALID_UUID},
.port = 0,
.pad = 0,
};
};
} // namespace InputCommon

View File

@ -14,6 +14,11 @@
namespace InputCommon {
constexpr int touch_axis_x = 10;
constexpr int touch_axis_y = 11;
constexpr PadIdentifier identifier = {
.guid = Common::UUID{Common::INVALID_UUID},
.port = 0,
.pad = 0,
};
Mouse::Mouse(const std::string input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);

View File

@ -62,11 +62,6 @@ private:
void UpdateThread(std::stop_token stop_token);
void StopPanning();
const PadIdentifier identifier = {
.guid = Common::UUID{Common::INVALID_UUID},
.port = 0,
.pad = 0,
};
Common::Vec2<int> mouse_origin;
Common::Vec2<int> last_mouse_position;
Common::Vec2<float> last_mouse_change;

View File

@ -7,6 +7,12 @@
namespace InputCommon {
constexpr PadIdentifier identifier = {
.guid = Common::UUID{Common::INVALID_UUID},
.port = 0,
.pad = 0,
};
TouchScreen::TouchScreen(const std::string input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
}

View File

@ -37,14 +37,8 @@ public:
*/
void TouchReleased(std::size_t finger);
/// Resets all inputs to their initial value
void ReleaseAllTouch();
private:
const PadIdentifier identifier = {
.guid = Common::UUID{Common::INVALID_UUID},
.port = 0,
.pad = 0,
};
};
} // namespace InputCommon

View File

@ -353,11 +353,12 @@ void InputEngine::SetMappingCallback(MappingCallback callback) {
void InputEngine::DeleteCallback(int key) {
std::lock_guard lock{mutex_callback};
if (!callback_list.contains(key)) {
const auto& iterator = callback_list.find(key);
if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
callback_list.erase(key);
callback_list.erase(iterator);
}
} // namespace InputCommon

View File

@ -10,6 +10,7 @@
#include "common/string_util.h"
#include "core/core.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"
#include "core/hle/lock.h"
#include "core/hle/service/hid/controllers/npad.h"

View File

@ -2594,9 +2594,8 @@ void PlayerControlPreview::DrawArrowButton(QPainter& p, const QPointF center,
arrow_button[point] = center + QPointF(up_arrow_x * size, -up_arrow_y * size);
break;
case Direction::Left:
// Compiler doesn't optimize this correctly
arrow_button[point] = center + QPointF(up_arrow_button[point * 2 + 1] * size,
up_arrow_button[point * 2 + 0] * size);
// Compiler doesn't optimize this correctly check why
arrow_button[point] = center + QPointF(up_arrow_y * size, up_arrow_x * size);
break;
case Direction::None:
break;

View File

@ -9,6 +9,7 @@
#include <QPointer>
#include "common/input.h"
#include "common/settings.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hid/hid_types.h"

View File

@ -21,7 +21,8 @@ class System;
namespace Core::HID {
class EmulatedController;
}
enum class ControllerTriggerType;
} // namespace Core::HID
class ControllerDialog : public QWidget {
Q_OBJECT

View File

@ -26,6 +26,7 @@
#include "core/frontend/applets/controller.h"
#include "core/frontend/applets/general_frontend.h"
#include "core/frontend/applets/software_keyboard.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/hid_core.h"
#include "core/hle/service/acc/profile_manager.h"
#include "core/hle/service/am/applet_ae.h"