gitadora: various fixes for wailing (#513)

## Link to GitHub Issue, if one exists
Fixes #512

## Description of change
Fix digital wailing not being recognized consistently.

Also address the fact that wailing was completely broken when lefty mode
was on. This requires a new option that the user needs to check off in
the configurator since we can't magically guess if the user is holding
the guitar in lefty mode.

- [x] fix downward wail
- [x] digital lefty mode
- [x] implement all of this for arena model i/o
- [x] test dx cab 2p
- [x] lefty toggle in overlay
- [x] fix analog not working for 2p guitar
- [ ] analog lefty mode?

## Testing
Checked GW and GW Delta
This commit is contained in:
bicarus
2026-01-12 21:52:48 -08:00
committed by GitHub
parent a3a59e689e
commit a0a04ab62f
18 changed files with 346 additions and 66 deletions
+6
View File
@@ -11,6 +11,7 @@
#include "util/libutils.h"
#include "util/logging.h"
#include "util/sigscan.h"
#include "util/socd_cleaner.h"
#include "hooks/setupapihook.h"
namespace games::gitadora {
@@ -18,6 +19,8 @@ namespace games::gitadora {
// settings
bool TWOCHANNEL = false;
std::optional<unsigned int> CAB_TYPE = std::nullopt;
bool P1_LEFTY = false;
bool P2_LEFTY = false;
/*
* Prevent GitaDora from creating folders on F drive
@@ -220,6 +223,9 @@ namespace games::gitadora {
GRAPHICS_WINDOWED && !cfg::CONFIGURATOR_STANDALONE) {
overlay::UI_SCALE_PERCENT = 250;
}
// for guitar wail SOCD cleaning
socd::ALGORITHM = socd::SocdAlgorithm::PreferRecent;
}
}
+10
View File
@@ -10,6 +10,8 @@ namespace games::gitadora {
// settings
extern bool TWOCHANNEL;
extern std::optional<unsigned int> CAB_TYPE;
extern bool P1_LEFTY;
extern bool P2_LEFTY;
class GitaDoraGame : public games::Game {
public:
@@ -38,4 +40,12 @@ namespace games::gitadora {
);
}
static inline bool is_player_lefty(size_t player) {
if (player == 0) {
return P1_LEFTY;
} else if (player == 1) {
return P2_LEFTY;
}
return false;
}
}
+32 -3
View File
@@ -107,9 +107,18 @@ std::string games::gitadora::get_buttons_help() {
// keep to max 100 characters wide
return
"guitar:\n"
"\n"
" < R G B Y P --- Pick ] \n"
"\n"
" If you hold your guitar left-handed (frets on the right hand):\n"
" * bind the buttons here as righty and use the in-game option\n"
" to turn on LEFT mode to flip the order of buttons.\n"
" * turn on GitaDora Lefty Guitar option in Options tab so that\n"
" wailing is recognized correctly.\n"
"\n"
"\n"
"drums:\n"
"\n"
" LeftCymbal RightCymbal\n"
" HiHat HiTom LowTom \n"
" Snare FloorTom \n"
@@ -117,10 +126,30 @@ std::string games::gitadora::get_buttons_help() {
" Left Bass\n"
" Pedal Pedal\n"
"\n"
"Drums are NOT velocity-sensitive!\n"
" Drums are NOT velocity-sensitive!\n"
"\n"
"For MIDI drums with Open/Closed HiHat configurations, bind variations below. "
"v2_drum algorithm might work better for those drums."
" For MIDI drums with Open/Closed HiHat configurations or pads with\n"
" multiple hit zones, ensure you bind all variation using the Pages\n"
" button at the bottom."
;
}
std::string games::gitadora::get_analogs_help() {
// keep to max 100 characters wide
return
"guitar:\n"
"\n"
"X axis: 0% when body is held facing monitor, 50% when facing flat on a table\n"
"Y axis: 50% when held horizontal, 0% when neck is raised, 100% pointing down\n"
"Z axis: 50% at rest, 100% when swinging neck toward monitor (only used in XG series)\n"
"\n"
"You need both X and Y axis for up/down wail to work correctly in-game.\n"
"If you only have Y axis, consider using digital wailing instead.\n"
"\n"
"Ensure you clear all analog bindings if you want to use digital wailing.\n"
"\n"
"If you hold your guitar left-handed (frets on the right hand),\n"
"analog bindings will likely not work as intended.\n"
"Consider using digital wailing in Buttons tab."
;
}
+1
View File
@@ -209,6 +209,7 @@ namespace games::gitadora {
// getters
std::vector<Button> &get_buttons();
std::string get_buttons_help();
std::string get_analogs_help();
std::vector<Analog> &get_analogs();
std::vector<Light> &get_lights();
}
+30 -9
View File
@@ -1,11 +1,12 @@
#include "misc/eamuse.h"
#include "util/utils.h"
#include "games/gitadora/gitadora.h"
#include "util/socd_cleaner.h"
#include "util/time.h"
#include "util/utils.h"
#include "io.h"
#include "j33i.h"
#define GUITAR_BTN_R 0x7
#define GUITAR_BTN_G 0x6
#define GUITAR_BTN_B 0x5
@@ -111,8 +112,8 @@ bool games::gitadora::J33ISerialDevice::parse_msg(
auto &analogs = get_analogs();
// get x,y,z analog values [-0.5f, 0.5f], centered at 0.f
float x = 0.f;
// get x,y,z analog values [-0.5f, 0.5f]
float x = is_player_lefty(0) ? 0.3f : -0.5f;
auto x_analog = analogs[Analogs::GuitarP1WailX];
if (x_analog.isSet()) {
x = GameAPI::Analogs::getState(RI_MGR, x_analog) - 0.5f;
@@ -123,11 +124,6 @@ bool games::gitadora::J33ISerialDevice::parse_msg(
if (y_analog.isSet()) {
y = GameAPI::Analogs::getState(RI_MGR, y_analog) - 0.5f;
}
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::GuitarP1WailUp])) {
y = -0.5f;
} else if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::GuitarP1WailDown])) {
y = 0.5f;
}
float z = 0.f;
auto z_analog = analogs[Analogs::GuitarP1WailZ];
@@ -135,6 +131,31 @@ bool games::gitadora::J33ISerialDevice::parse_msg(
z = GameAPI::Analogs::getState(RI_MGR, z_analog) - 0.5f;
}
// handle digital wail up/down
const auto wail_up = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::GuitarP1WailUp]);
const auto wail_down = GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::GuitarP1WailDown]);
const auto wail_result =
socd::get_guitar_wail(0, wail_up, wail_down, get_performance_milliseconds());
if (!is_player_lefty(0)) {
// righty
if (wail_result == socd::TiltUp) {
x = 0;
y = -0.5f;
} else if (wail_result == socd::TiltDown) {
x = -0.5f;
y = 0.5f;
}
} else {
// lefty
if (wail_result == socd::TiltUp) {
x = 0.f;
y = 0.f;
} else if (wail_result == socd::TiltDown) {
x = 0.5f;
y = 0.f;
}
}
// convert x,y,z to unsigned integer values that the game expects
const uint16_t x_int = x * ARENA_MODEL_WAIL_MAX * 2;
const uint16_t y_int = y * ARENA_MODEL_WAIL_MAX * 2;