early-access version 1942

This commit is contained in:
pineappleEA
2021-07-29 21:34:06 +02:00
parent 21ca602747
commit 80ad76aa9e
11 changed files with 44 additions and 49 deletions

View File

@@ -170,7 +170,7 @@ public:
float GetAxis(int axis, float range, float offset) const {
std::lock_guard lock{mutex};
const float value = static_cast<float>(state.axes.at(axis)) / 32767.0f;
return (value + offset) * range;
return (value + offset) / range;
}
bool RumblePlay(u16 amp_low, u16 amp_high) {
@@ -538,8 +538,8 @@ public:
}
std::tuple<float, float> GetRawStatus() const override {
const float x = joystick->GetAxis(axis_x, 1.0f, offset_x);
const float y = joystick->GetAxis(axis_y, 1.0f, offset_y);
const float x = joystick->GetAxis(axis_x, range, offset_x);
const float y = joystick->GetAxis(axis_y, range, offset_y);
return {x, -y};
}

View File

@@ -47,8 +47,7 @@ Tas::Tas() {
}
Tas::~Tas() {
SwapToStoredController();
is_running = false;
Stop();
};
void Tas::LoadTasFiles() {
@@ -189,8 +188,7 @@ std::string Tas::ButtonsToString(u32 button) const {
void Tas::UpdateThread() {
if (!Settings::values.tas_enable) {
if (is_running) {
SwapToStoredController();
is_running = false;
Stop();
}
return;
}
@@ -305,14 +303,19 @@ void Tas::StartStop() {
if (!Settings::values.tas_enable) {
return;
}
is_running = !is_running;
if (is_running) {
SwapToTasController();
Stop();
} else {
SwapToStoredController();
is_running = true;
SwapToTasController();
}
}
void Tas::Stop() {
is_running = false;
SwapToStoredController();
}
void Tas::SwapToTasController() {
if (!Settings::values.tas_swap_controllers) {
return;

View File

@@ -105,6 +105,9 @@ public:
// Sets the flag to start or stop the TAS command excecution and swaps controllers profiles
void StartStop();
// Stop the TAS and reverts any controller profile
void Stop();
// Sets the flag to reload the file and start from the begining in the next update
void Reset();