early-access version 1401
This commit is contained in:
parent
38d692efe5
commit
92186f6808
@ -1,7 +1,7 @@
|
|||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 1400.
|
This is the source code for early-access 1401.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@ -20,15 +21,18 @@ public:
|
|||||||
: up(std::move(up_)), down(std::move(down_)), left(std::move(left_)),
|
: up(std::move(up_)), down(std::move(down_)), left(std::move(left_)),
|
||||||
right(std::move(right_)), modifier(std::move(modifier_)), modifier_scale(modifier_scale_),
|
right(std::move(right_)), modifier(std::move(modifier_)), modifier_scale(modifier_scale_),
|
||||||
modifier_angle(modifier_angle_) {
|
modifier_angle(modifier_angle_) {
|
||||||
|
update_thread_running.store(true);
|
||||||
update_thread = std::thread(&Analog::UpdateStatus, this);
|
update_thread = std::thread(&Analog::UpdateStatus, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
~Analog() override {
|
~Analog() override {
|
||||||
update_thread_running = false;
|
if (update_thread_running.load()) {
|
||||||
|
update_thread_running.store(false);
|
||||||
if (update_thread.joinable()) {
|
if (update_thread.joinable()) {
|
||||||
update_thread.join();
|
update_thread.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MoveToDirection(bool enable, float to_angle) {
|
void MoveToDirection(bool enable, float to_angle) {
|
||||||
if (!enable) {
|
if (!enable) {
|
||||||
@ -58,7 +62,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UpdateStatus() {
|
void UpdateStatus() {
|
||||||
while (update_thread_running) {
|
while (update_thread_running.load()) {
|
||||||
const float coef = modifier->GetStatus() ? modifier_scale : 1.0f;
|
const float coef = modifier->GetStatus() ? modifier_scale : 1.0f;
|
||||||
|
|
||||||
bool r = right->GetStatus();
|
bool r = right->GetStatus();
|
||||||
@ -160,7 +164,7 @@ private:
|
|||||||
float angle{};
|
float angle{};
|
||||||
float amplitude{};
|
float amplitude{};
|
||||||
std::thread update_thread;
|
std::thread update_thread;
|
||||||
bool update_thread_running{true};
|
std::atomic<bool> update_thread_running{};
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<Input::AnalogDevice> AnalogFromButton::Create(const Common::ParamPackage& params) {
|
std::unique_ptr<Input::AnalogDevice> AnalogFromButton::Create(const Common::ParamPackage& params) {
|
||||||
|
Loading…
Reference in New Issue
Block a user