mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 23:00:42 -07:00
iidx, sdvx: SOCD cleaner for knobs and turntables (#497)
## Link to GitHub Issue, if one exists n/a ## Description of change Apply SOCD cleaner algorithm to deal with the case where both counter-clockwise and clockwise buttons are pressed at the same time. In SDVX, default algorithm is to prefer the most recently pressed direction. This is better for dealing with slams in rapid succession, for example, as you don't have to completely let go of one direction to hit the other now. In IIDX, default algorithm is neutral (same behavior as before). Using last or first algorithm results in double scratches which means you'll likely end up with an excessive poor after hitting a scratch, so neutral is actually beneficial. Besides, if you are serious about playing on the keyboard, you should be using `TT +/-` and `TT +/- Alternate`. ## Testing Tested SDVX 3, EG (old cab), EG valk cab modes, IIDX 24, 27, 33 (tdj/ldj)
This commit is contained in:
@@ -12,9 +12,20 @@
|
||||
#include "launcher/options.h"
|
||||
#include "io.h"
|
||||
#include "games/sdvx/sdvx.h"
|
||||
#include "util/socd_cleaner.h"
|
||||
#include "util/tapeled.h"
|
||||
#include "util/time.h"
|
||||
#include "acioemu/icca.h"
|
||||
|
||||
#define DEBUG_VERBOSE 0
|
||||
|
||||
#if DEBUG_VERBOSE
|
||||
#define log_debug(module, format_str, ...) logger::push( \
|
||||
LOG_FORMAT("M", module, format_str, ## __VA_ARGS__), logger::Style::GREY)
|
||||
#else
|
||||
#define log_debug(module, format_str, ...)
|
||||
#endif
|
||||
|
||||
namespace games::sdvx {
|
||||
constexpr bool BI2X_PASSTHROUGH = false;
|
||||
|
||||
@@ -176,19 +187,27 @@ namespace games::sdvx {
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::Headphone]))
|
||||
status->buffer[22] = 0x01;
|
||||
|
||||
const auto now = get_performance_milliseconds();
|
||||
|
||||
// volume left
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::VOL_L_Left])) {
|
||||
const auto vol_l_state = socd::socd_clean(0,
|
||||
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::VOL_L_Left]),
|
||||
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::VOL_L_Right]),
|
||||
now);
|
||||
if (vol_l_state == socd::SocdCCW) {
|
||||
VOL_L -= ((uint16_t)DIGITAL_KNOB_SENS * 4);
|
||||
}
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::VOL_L_Right])) {
|
||||
} else if (vol_l_state == socd::SocdCW) {
|
||||
VOL_L += ((uint16_t)DIGITAL_KNOB_SENS * 4);
|
||||
}
|
||||
|
||||
// volume right
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::VOL_R_Left])) {
|
||||
const auto vol_r_state = socd::socd_clean(1,
|
||||
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::VOL_R_Left]),
|
||||
GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::VOL_R_Right]),
|
||||
now);
|
||||
if (vol_r_state == socd::SocdCCW) {
|
||||
VOL_R -= ((uint16_t)DIGITAL_KNOB_SENS * 4);
|
||||
}
|
||||
if (GameAPI::Buttons::getState(RI_MGR, buttons[Buttons::VOL_R_Right])) {
|
||||
} else if (vol_r_state == socd::SocdCW) {
|
||||
VOL_R += ((uint16_t)DIGITAL_KNOB_SENS * 4);
|
||||
}
|
||||
|
||||
@@ -203,6 +222,12 @@ namespace games::sdvx {
|
||||
|
||||
*((uint16_t*) &status->buffer[312]) = vol_left;
|
||||
*((uint16_t*) &status->buffer[314]) = vol_right;
|
||||
|
||||
log_debug(
|
||||
"bi2x_hook",
|
||||
"knobs = {} {}",
|
||||
*((uint16_t*) &status->buffer[312]),
|
||||
*((uint16_t*) &status->buffer[314]));
|
||||
}
|
||||
|
||||
static void __fastcall AIO_IOB2_BI2X_UFC__IoReset(AIO_IOB2_BI2X_UFC *This,
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "util/detour.h"
|
||||
#include "util/logging.h"
|
||||
#include "util/sigscan.h"
|
||||
#include "util/socd_cleaner.h"
|
||||
#include "util/time.h"
|
||||
#include "util/libutils.h"
|
||||
#include "misc/wintouchemu.h"
|
||||
#include "misc/eamuse.h"
|
||||
@@ -360,6 +362,16 @@ namespace games::sdvx {
|
||||
this->detect_sound_output_device();
|
||||
#endif
|
||||
|
||||
// SOCD
|
||||
auto options = games::get_options(eamuse_get_game());
|
||||
socd::ALGORITHM = socd::SocdAlgorithm::PreferRecent;
|
||||
if (options->at(launcher::Options::SDVXDigitalKnobSocd).is_active()) {
|
||||
if (options->at(launcher::Options::SDVXDigitalKnobSocd).value_text() == "neutral") {
|
||||
socd::ALGORITHM = socd::SocdAlgorithm::Neutral;
|
||||
} else if (options->at(launcher::Options::SDVXDigitalKnobSocd).value_text() == "last") {
|
||||
socd::ALGORITHM = socd::SocdAlgorithm::PreferRecent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SDVXGame::attach() {
|
||||
|
||||
Reference in New Issue
Block a user