Update to spice2x-25-04-25 (pre-apply)
> broken commit
This commit is contained in:
+110
-9
@@ -6,6 +6,11 @@
|
||||
#include "util/logging.h"
|
||||
#include "avs/game.h"
|
||||
|
||||
// std::min
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
using namespace GameAPI;
|
||||
|
||||
// static stuff
|
||||
@@ -79,6 +84,32 @@ static bool __cdecl ac_io_panb_start_auto_input() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint8_t panb_get_button_velocity(Button button, Button button_soft, Button button_medium, Button button_hard) {
|
||||
const auto velocity = Buttons::getVelocity(RI_MGR, button);
|
||||
const auto velocity_soft = Buttons::getVelocity(RI_MGR, button_soft);
|
||||
const auto velocity_medium = Buttons::getVelocity(RI_MGR, button_medium);
|
||||
const auto velocity_hard = Buttons::getVelocity(RI_MGR, button_hard);
|
||||
|
||||
// note that the digital values have been obtained via trial-and-error in recital mode
|
||||
// based on Op3:
|
||||
// * soft presses glow blue, should trigger Elegant in blue sections
|
||||
// * hard presses glow red/orange, should trigger Elegant in yellow sections
|
||||
// * default (medium) presses glow green, triggers Elegant in both blue and yellow sections
|
||||
|
||||
// digital-only values
|
||||
if (velocity_hard > 0.f) {
|
||||
// do NOT use 15 here!! 14 properly registers as a hard press, but 15 does not
|
||||
return 14;
|
||||
} else if (velocity_medium > 0.f) {
|
||||
return 11;
|
||||
} else if (velocity_soft > 0.f) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// digital or midi (velocity-sensitive) values
|
||||
return std::min((uint8_t)(velocity * 15.999f), (uint8_t)14);
|
||||
}
|
||||
|
||||
static bool __cdecl ac_io_panb_update_control_status_buffer() {
|
||||
|
||||
// check freeze
|
||||
@@ -107,6 +138,7 @@ static bool __cdecl ac_io_panb_update_control_status_buffer() {
|
||||
auto &analogs = games::nost::get_analogs();
|
||||
|
||||
// mappings
|
||||
// "normal" buttons - these are velocity sensitive (digital or MIDI)
|
||||
static const size_t button_mapping[] = {
|
||||
games::nost::Buttons::Key1, games::nost::Buttons::Key2,
|
||||
games::nost::Buttons::Key3, games::nost::Buttons::Key4,
|
||||
@@ -123,6 +155,60 @@ static bool __cdecl ac_io_panb_update_control_status_buffer() {
|
||||
games::nost::Buttons::Key25, games::nost::Buttons::Key26,
|
||||
games::nost::Buttons::Key27, games::nost::Buttons::Key28,
|
||||
};
|
||||
|
||||
// soft (digital) button - always registers as soft press
|
||||
static const size_t soft_button_mapping[] = {
|
||||
games::nost::Buttons::Key1Soft, games::nost::Buttons::Key2Soft,
|
||||
games::nost::Buttons::Key3Soft, games::nost::Buttons::Key4Soft,
|
||||
games::nost::Buttons::Key5Soft, games::nost::Buttons::Key6Soft,
|
||||
games::nost::Buttons::Key7Soft, games::nost::Buttons::Key8Soft,
|
||||
games::nost::Buttons::Key9Soft, games::nost::Buttons::Key10Soft,
|
||||
games::nost::Buttons::Key11Soft, games::nost::Buttons::Key12Soft,
|
||||
games::nost::Buttons::Key13Soft, games::nost::Buttons::Key14Soft,
|
||||
games::nost::Buttons::Key15Soft, games::nost::Buttons::Key16Soft,
|
||||
games::nost::Buttons::Key17Soft, games::nost::Buttons::Key18Soft,
|
||||
games::nost::Buttons::Key19Soft, games::nost::Buttons::Key20Soft,
|
||||
games::nost::Buttons::Key21Soft, games::nost::Buttons::Key22Soft,
|
||||
games::nost::Buttons::Key23Soft, games::nost::Buttons::Key24Soft,
|
||||
games::nost::Buttons::Key25Soft, games::nost::Buttons::Key26Soft,
|
||||
games::nost::Buttons::Key27Soft, games::nost::Buttons::Key28Soft,
|
||||
};
|
||||
|
||||
// medium (digital) button - always registers as medium press
|
||||
static const size_t medium_button_mapping[] = {
|
||||
games::nost::Buttons::Key1Medium, games::nost::Buttons::Key2Medium,
|
||||
games::nost::Buttons::Key3Medium, games::nost::Buttons::Key4Medium,
|
||||
games::nost::Buttons::Key5Medium, games::nost::Buttons::Key6Medium,
|
||||
games::nost::Buttons::Key7Medium, games::nost::Buttons::Key8Medium,
|
||||
games::nost::Buttons::Key9Medium, games::nost::Buttons::Key10Medium,
|
||||
games::nost::Buttons::Key11Medium, games::nost::Buttons::Key12Medium,
|
||||
games::nost::Buttons::Key13Medium, games::nost::Buttons::Key14Medium,
|
||||
games::nost::Buttons::Key15Medium, games::nost::Buttons::Key16Medium,
|
||||
games::nost::Buttons::Key17Medium, games::nost::Buttons::Key18Medium,
|
||||
games::nost::Buttons::Key19Medium, games::nost::Buttons::Key20Medium,
|
||||
games::nost::Buttons::Key21Medium, games::nost::Buttons::Key22Medium,
|
||||
games::nost::Buttons::Key23Medium, games::nost::Buttons::Key24Medium,
|
||||
games::nost::Buttons::Key25Medium, games::nost::Buttons::Key26Medium,
|
||||
games::nost::Buttons::Key27Medium, games::nost::Buttons::Key28Medium,
|
||||
};
|
||||
|
||||
// hard (digital) button - always registers as hard press
|
||||
static const size_t hard_button_mapping[] = {
|
||||
games::nost::Buttons::Key1Hard, games::nost::Buttons::Key2Hard,
|
||||
games::nost::Buttons::Key3Hard, games::nost::Buttons::Key4Hard,
|
||||
games::nost::Buttons::Key5Hard, games::nost::Buttons::Key6Hard,
|
||||
games::nost::Buttons::Key7Hard, games::nost::Buttons::Key8Hard,
|
||||
games::nost::Buttons::Key9Hard, games::nost::Buttons::Key10Hard,
|
||||
games::nost::Buttons::Key11Hard, games::nost::Buttons::Key12Hard,
|
||||
games::nost::Buttons::Key13Hard, games::nost::Buttons::Key14Hard,
|
||||
games::nost::Buttons::Key15Hard, games::nost::Buttons::Key16Hard,
|
||||
games::nost::Buttons::Key17Hard, games::nost::Buttons::Key18Hard,
|
||||
games::nost::Buttons::Key19Hard, games::nost::Buttons::Key20Hard,
|
||||
games::nost::Buttons::Key21Hard, games::nost::Buttons::Key22Hard,
|
||||
games::nost::Buttons::Key23Hard, games::nost::Buttons::Key24Hard,
|
||||
games::nost::Buttons::Key25Hard, games::nost::Buttons::Key26Hard,
|
||||
games::nost::Buttons::Key27Hard, games::nost::Buttons::Key28Hard,
|
||||
};
|
||||
static const size_t analog_mapping[] = {
|
||||
games::nost::Analogs::Key1, games::nost::Analogs::Key2,
|
||||
games::nost::Analogs::Key3, games::nost::Analogs::Key4,
|
||||
@@ -148,23 +234,38 @@ static bool __cdecl ac_io_panb_update_control_status_buffer() {
|
||||
uint8_t state1 = 0;
|
||||
|
||||
// check analogs
|
||||
//
|
||||
// while 15 is technically allowed by the I/O board & is recognized correctly in test
|
||||
// menu, when you play recital mode, 15 fails to register Elegant in yellow sections.
|
||||
// therefore, cap the value at 14. tested with Nostroller.
|
||||
auto &analog0 = analogs.at(analog_mapping[key_pair * 2 + 0]);
|
||||
auto &analog1 = analogs.at(analog_mapping[key_pair * 2 + 1]);
|
||||
if (analog0.isSet()) {
|
||||
state0 = (uint8_t) (Analogs::getState(RI_MGR, analog0) * 15.999f);
|
||||
state0 = std::min((uint8_t)(Analogs::getState(RI_MGR, analog0) * 15.999f), (uint8_t)14);
|
||||
}
|
||||
if (analog1.isSet()) {
|
||||
state1 = (uint8_t) (Analogs::getState(RI_MGR, analog1) * 15.999f);
|
||||
state1 = std::min((uint8_t)(Analogs::getState(RI_MGR, analog1) * 15.999f), (uint8_t)14);
|
||||
}
|
||||
|
||||
// check buttons
|
||||
auto velocity0 = Buttons::getVelocity(RI_MGR, buttons.at(button_mapping[key_pair * 2 + 0]));
|
||||
auto velocity1 = Buttons::getVelocity(RI_MGR, buttons.at(button_mapping[key_pair * 2 + 1]));
|
||||
if (velocity0 > 0.f) {
|
||||
state0 = (uint8_t) (velocity0 * 15.999f);
|
||||
// check digital buttons
|
||||
const auto button0 = panb_get_button_velocity(
|
||||
buttons.at(button_mapping[key_pair * 2 + 0]),
|
||||
buttons.at(soft_button_mapping[key_pair * 2 + 0]),
|
||||
buttons.at(medium_button_mapping[key_pair * 2 + 0]),
|
||||
buttons.at(hard_button_mapping[key_pair * 2 + 0])
|
||||
);
|
||||
if (button0 > 0) {
|
||||
state0 = button0;
|
||||
}
|
||||
if (velocity1 > 0.f) {
|
||||
state1 = (uint8_t) (velocity1 * 15.999f);
|
||||
|
||||
const auto button1 = panb_get_button_velocity(
|
||||
buttons.at(button_mapping[key_pair * 2 + 1]),
|
||||
buttons.at(soft_button_mapping[key_pair * 2 + 1]),
|
||||
buttons.at(medium_button_mapping[key_pair * 2 + 1]),
|
||||
buttons.at(hard_button_mapping[key_pair * 2 + 1])
|
||||
);
|
||||
if (button1 > 0) {
|
||||
state1 = button1;
|
||||
}
|
||||
|
||||
// build value
|
||||
|
||||
Reference in New Issue
Block a user