Update to spice2x-25-04-25 (pre-apply)
> broken commit
This commit is contained in:
+288
-2
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "avs/game.h"
|
||||
#include "games/ddr/io.h"
|
||||
#include "games/ddr/ddr.h"
|
||||
#include "games/sdvx/sdvx.h"
|
||||
#include "games/sdvx/io.h"
|
||||
#include "games/drs/io.h"
|
||||
@@ -9,6 +10,7 @@
|
||||
#include "misc/eamuse.h"
|
||||
#include "util/logging.h"
|
||||
#include "util/utils.h"
|
||||
#include "util/tapeled.h"
|
||||
|
||||
using namespace GameAPI;
|
||||
|
||||
@@ -399,6 +401,148 @@ static long __cdecl ac_io_bi2a_control_led_bright(size_t index, uint8_t brightne
|
||||
if (light.light2 >= 0) {
|
||||
Lights::writeLight(RI_MGR, lights[light.light2], brightness / light.max);
|
||||
}
|
||||
|
||||
// DANCERUSH
|
||||
} else if (avs::game::is_model("REC")) {
|
||||
|
||||
/*
|
||||
* Control R G B
|
||||
* ==============================
|
||||
* CARD UNIT 13 14 15
|
||||
* TITLE PANEL 28 29 30
|
||||
* MONITOR SIDE LEFT (tape LED - see ac_io_bi2a_control_tapeled_bright)
|
||||
* MONITOR SIDE RIGHT (tape LED - see ac_io_bi2a_control_tapeled_bright)
|
||||
*
|
||||
* Values go up to 127.
|
||||
*
|
||||
* Control Index
|
||||
* ==================
|
||||
* 1P LEFT 11
|
||||
* 1P RIGHT 12
|
||||
* 1P UP 9
|
||||
* 1P DOWN 10
|
||||
* 1P START 8
|
||||
* 2P LEFT 19
|
||||
* 2P RIGHT 20
|
||||
* 2P UP 17
|
||||
* 2P DOWN 18
|
||||
* 2P START 16
|
||||
*
|
||||
* Values go up to 127.
|
||||
*/
|
||||
|
||||
static const struct {
|
||||
int light;
|
||||
float max;
|
||||
} mapping[] = {
|
||||
{ -1, 0 }, // 0
|
||||
{ -1, 0 }, // 1
|
||||
{ -1, 0 }, // 2
|
||||
{ -1, 0 }, // 3
|
||||
{ -1, 0 }, // 4
|
||||
{ -1, 0 }, // 5
|
||||
{ -1, 0 }, // 6
|
||||
{ -1, 0 }, // 7
|
||||
{ games::drs::Lights::P1_START, 127 }, // 8
|
||||
{ games::drs::Lights::P1_MENU_UP, 127 }, // 9
|
||||
{ games::drs::Lights::P1_MENU_DOWN, 127 }, // 10
|
||||
{ games::drs::Lights::P1_MENU_LEFT, 127 }, // 11
|
||||
{ games::drs::Lights::P1_MENU_RIGHT, 127 }, // 12
|
||||
{ games::drs::Lights::CARD_READER_R, 127 }, // 13
|
||||
{ games::drs::Lights::CARD_READER_G, 127 }, // 14
|
||||
{ games::drs::Lights::CARD_READER_B, 127 }, // 15
|
||||
{ games::drs::Lights::P2_START, 127 }, // 16
|
||||
{ games::drs::Lights::P2_MENU_UP, 127 }, // 17
|
||||
{ games::drs::Lights::P2_MENU_DOWN, 127 }, // 18
|
||||
{ games::drs::Lights::P2_MENU_LEFT, 127 }, // 19
|
||||
{ games::drs::Lights::P2_MENU_RIGHT, 127 }, // 20
|
||||
{ -1, 0 }, // 21
|
||||
{ -1, 0 }, // 22
|
||||
{ -1, 0 }, // 23
|
||||
{ -1, 0 }, // 24
|
||||
{ -1, 0 }, // 25
|
||||
{ -1, 0 }, // 26
|
||||
{ -1, 0 }, // 27
|
||||
{ games::drs::Lights::TITLE_PANEL_R, 127 }, // 28
|
||||
{ games::drs::Lights::TITLE_PANEL_G, 127 }, // 29
|
||||
{ games::drs::Lights::TITLE_PANEL_B, 127 }, // 30
|
||||
};
|
||||
|
||||
// ignore index out of range
|
||||
if (index > std::size(mapping)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// get lights
|
||||
auto &lights = games::drs::get_lights();
|
||||
|
||||
// get light from mapping
|
||||
auto light = mapping[index];
|
||||
|
||||
// write lights
|
||||
if (light.light >= 0) {
|
||||
Lights::writeLight(RI_MGR, lights[light.light], brightness / light.max);
|
||||
} else {
|
||||
log_warning("drs", "light unset {} {}", index, (int) brightness);
|
||||
}
|
||||
|
||||
// DanceDanceRevolution
|
||||
} else if (avs::game::is_model("MDX")) {
|
||||
|
||||
static const struct {
|
||||
int light;
|
||||
float max;
|
||||
} mapping[] = {
|
||||
{ -1, 0 }, // 0
|
||||
{ -1, 0 }, // 1
|
||||
{ -1, 0 }, // 2
|
||||
{ -1, 0 }, // 3
|
||||
{ -1, 0 }, // 4
|
||||
{ -1, 0 }, // 5
|
||||
{ -1, 0 }, // 6
|
||||
{ -1, 0 }, // 7
|
||||
{ games::ddr::Lights::GOLD_P1_MENU_START, 127 }, // 8
|
||||
{ games::ddr::Lights::GOLD_P1_MENU_UP, 127 }, // 9
|
||||
{ games::ddr::Lights::GOLD_P1_MENU_DOWN, 127 }, // 10
|
||||
{ games::ddr::Lights::GOLD_P1_MENU_LEFT, 127 }, // 11
|
||||
{ games::ddr::Lights::GOLD_P1_MENU_RIGHT, 127 }, // 12
|
||||
{ games::ddr::Lights::GOLD_P1_CARD_UNIT_R, 127 }, // 13
|
||||
{ games::ddr::Lights::GOLD_P1_CARD_UNIT_G, 127 }, // 14
|
||||
{ games::ddr::Lights::GOLD_P1_CARD_UNIT_B, 127 }, // 15
|
||||
{ games::ddr::Lights::GOLD_P2_MENU_START, 127 }, // 16
|
||||
{ games::ddr::Lights::GOLD_P2_MENU_UP, 127 }, // 17
|
||||
{ games::ddr::Lights::GOLD_P2_MENU_DOWN, 127 }, // 18
|
||||
{ games::ddr::Lights::GOLD_P2_MENU_LEFT, 127 }, // 19
|
||||
{ games::ddr::Lights::GOLD_P2_MENU_RIGHT, 127 }, // 20
|
||||
{ games::ddr::Lights::GOLD_P2_CARD_UNIT_R, 0 }, // 21
|
||||
{ games::ddr::Lights::GOLD_P2_CARD_UNIT_G, 0 }, // 22
|
||||
{ games::ddr::Lights::GOLD_P2_CARD_UNIT_B, 0 }, // 23
|
||||
{ -1, 0 }, // 24
|
||||
{ -1, 0 }, // 25
|
||||
{ -1, 0 }, // 26
|
||||
{ -1, 0 }, // 27
|
||||
{ games::ddr::Lights::GOLD_TITLE_PANEL_LEFT, 0 }, // 28
|
||||
{ games::ddr::Lights::GOLD_TITLE_PANEL_CENTER, 0 }, // 29
|
||||
{ games::ddr::Lights::GOLD_TITLE_PANEL_RIGHT, 0 }, // 30
|
||||
{ games::ddr::Lights::GOLD_P1_WOOFER_CORNER, 0 }, // 31
|
||||
{ games::ddr::Lights::GOLD_P2_WOOFER_CORNER, 0 } // 32
|
||||
};
|
||||
|
||||
// ignore index out of range
|
||||
if (index > std::size(mapping)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// get lights
|
||||
auto &lights = games::ddr::get_lights();
|
||||
|
||||
// get light from mapping
|
||||
auto light = mapping[index];
|
||||
|
||||
// write lights
|
||||
if (light.light >= 0) {
|
||||
Lights::writeLight(RI_MGR, lights[light.light], brightness / light.max);
|
||||
}
|
||||
}
|
||||
|
||||
// return success
|
||||
@@ -443,7 +587,7 @@ static bool __cdecl ac_io_bi2a_tapeled_init_is_finished() {
|
||||
static bool __cdecl ac_io_bi2a_control_tapeled_rec_set(uint8_t* data, size_t x_sz, size_t y_sz) {
|
||||
|
||||
// check dimensions
|
||||
if (x_sz != 38 || y_sz != 49) {
|
||||
if (x_sz != DRS_TAPELED_COLS || y_sz != DRS_TAPELED_ROWS) {
|
||||
log_fatal("drs", "DRS tapeled wrong dimensions");
|
||||
}
|
||||
|
||||
@@ -458,9 +602,151 @@ static bool __cdecl ac_io_bi2a_control_tapeled_rec_set(uint8_t* data, size_t x_s
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: this controls the upright RGB bars on the sides
|
||||
// TODO: DRS tape lights
|
||||
static bool __cdecl ac_io_bi2a_control_tapeled_bright(size_t off1, size_t off2,
|
||||
uint8_t r, uint8_t g, uint8_t b, uint8_t bank) {
|
||||
|
||||
if (!tapeledutils::is_enabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (avs::game::is_model("MDX")) {
|
||||
|
||||
/*
|
||||
* r, g, b values range from [0-255]
|
||||
* bank always seems to be [0]
|
||||
*
|
||||
* [off1.off2] [LEDs] [tape name]
|
||||
* 0.0 25 P1 Foot Up (0.0 to 0.24, inclusive)
|
||||
* 0.25 25 P1 Foot Right
|
||||
* 1.0 25 P1 Foot Left
|
||||
* 1.25 25 P1 Foot Down
|
||||
*
|
||||
* 2.0 25 P2 Foot Up
|
||||
* 2.25 25 P2 Foot Right
|
||||
* 3.0 25 P2 Foot Left
|
||||
* 3.25 25 P2 Foot Down
|
||||
*
|
||||
* 5.0 50 Top Panel
|
||||
* 6.0 50 Monitor side left
|
||||
* 7.0 50 Monitor side right
|
||||
*/
|
||||
|
||||
// In order to set the data that can be output via Spice API, we first
|
||||
// need to figure out which device in our buffers this data belongs to
|
||||
int device = -1;
|
||||
if (off1 == 0) {
|
||||
if (off2 < 25) device = 0; // P1 Foot Up
|
||||
else device = 1; // P1 Foot Right
|
||||
} else if (off1 == 1) {
|
||||
if (off2 < 25) device = 2; // P1 Foot Left
|
||||
else device = 3; // P1 Foot Down
|
||||
} else if (off1 == 2) {
|
||||
if (off2 < 25) device = 4; // P2 Foot Up
|
||||
else device = 5; // P2 Foot Right
|
||||
} else if (off1 == 3) {
|
||||
if (off2 < 25) device = 6; // P2 Foot Left
|
||||
else device = 7; // P2 Foot Down
|
||||
} else if (off1 >= 5 && off1 <= 7) {
|
||||
device = off1 + 3; // Top Panel / Monitor Side Left / Monitor Side Right
|
||||
}
|
||||
|
||||
if (device != -1) {
|
||||
// We subtract 25 from off2 to get the device's LED index, if it's for one of the
|
||||
// arrow panels that is on the latter half of the logical strip
|
||||
size_t subtractor = 0;
|
||||
if (off1 <= 3 && off2 >= 25) {
|
||||
subtractor = 25;
|
||||
}
|
||||
size_t led_index = off2 - subtractor;
|
||||
|
||||
games::ddr::DDR_TAPELEDS[device][led_index][0] = r;
|
||||
games::ddr::DDR_TAPELEDS[device][led_index][1] = g;
|
||||
games::ddr::DDR_TAPELEDS[device][led_index][2] = b;
|
||||
}
|
||||
|
||||
static struct TapeLedMapping {
|
||||
bool split; // true == 50 LEDs for one light, false == 25 for two lights
|
||||
uint8_t index_r0, index_g0, index_b0;
|
||||
uint8_t index_r1, index_g1, index_b1;
|
||||
size_t index_for_avg0 = UINT8_MAX;
|
||||
size_t index_for_avg1 = UINT8_MAX;
|
||||
|
||||
TapeLedMapping(
|
||||
uint8_t index_r0, uint8_t index_g0, uint8_t index_b0,
|
||||
uint8_t index_r1, uint8_t index_g1, uint8_t index_b1)
|
||||
: index_r0(index_r0), index_g0(index_g0), index_b0(index_b0),
|
||||
index_r1(index_r1), index_g1(index_g1), index_b1(index_b1) {
|
||||
|
||||
split = (index_r1 != UINT8_MAX);
|
||||
if (split) {
|
||||
index_for_avg0 = tapeledutils::get_led_index_using_avg_algo(25);
|
||||
index_for_avg1 = index_for_avg0 + 25;
|
||||
} else {
|
||||
index_for_avg0 = tapeledutils::get_led_index_using_avg_algo(50);
|
||||
index_for_avg1 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
} mapping[] = {
|
||||
{
|
||||
games::ddr::Lights::GOLD_P1_FOOT_UP_AVG_R, games::ddr::Lights::GOLD_P1_FOOT_UP_AVG_G, games::ddr::Lights::GOLD_P1_FOOT_UP_AVG_B,
|
||||
games::ddr::Lights::GOLD_P1_FOOT_RIGHT_AVG_R, games::ddr::Lights::GOLD_P1_FOOT_RIGHT_AVG_G, games::ddr::Lights::GOLD_P1_FOOT_RIGHT_AVG_B
|
||||
},
|
||||
{
|
||||
games::ddr::Lights::GOLD_P1_FOOT_LEFT_AVG_R, games::ddr::Lights::GOLD_P1_FOOT_LEFT_AVG_G, games::ddr::Lights::GOLD_P1_FOOT_LEFT_AVG_B,
|
||||
games::ddr::Lights::GOLD_P1_FOOT_DOWN_AVG_R, games::ddr::Lights::GOLD_P1_FOOT_DOWN_AVG_G, games::ddr::Lights::GOLD_P1_FOOT_DOWN_AVG_B
|
||||
},
|
||||
{
|
||||
games::ddr::Lights::GOLD_P2_FOOT_UP_AVG_R, games::ddr::Lights::GOLD_P2_FOOT_UP_AVG_G, games::ddr::Lights::GOLD_P2_FOOT_UP_AVG_B,
|
||||
games::ddr::Lights::GOLD_P2_FOOT_RIGHT_AVG_R, games::ddr::Lights::GOLD_P2_FOOT_RIGHT_AVG_G, games::ddr::Lights::GOLD_P2_FOOT_RIGHT_AVG_B
|
||||
},
|
||||
{
|
||||
games::ddr::Lights::GOLD_P2_FOOT_LEFT_AVG_R, games::ddr::Lights::GOLD_P2_FOOT_LEFT_AVG_G, games::ddr::Lights::GOLD_P2_FOOT_LEFT_AVG_B,
|
||||
games::ddr::Lights::GOLD_P2_FOOT_DOWN_AVG_R, games::ddr::Lights::GOLD_P2_FOOT_DOWN_AVG_G, games::ddr::Lights::GOLD_P2_FOOT_DOWN_AVG_B
|
||||
},
|
||||
{
|
||||
games::ddr::Lights::GOLD_TOP_PANEL_AVG_R, games::ddr::Lights::GOLD_TOP_PANEL_AVG_G, games::ddr::Lights::GOLD_TOP_PANEL_AVG_B,
|
||||
UINT8_MAX, UINT8_MAX, UINT8_MAX
|
||||
},
|
||||
{
|
||||
UINT8_MAX, UINT8_MAX, UINT8_MAX,
|
||||
UINT8_MAX, UINT8_MAX, UINT8_MAX
|
||||
},
|
||||
{
|
||||
games::ddr::Lights::GOLD_MONITOR_SIDE_LEFT_AVG_R, games::ddr::Lights::GOLD_MONITOR_SIDE_LEFT_AVG_G, games::ddr::Lights::GOLD_MONITOR_SIDE_LEFT_AVG_B,
|
||||
UINT8_MAX, UINT8_MAX, UINT8_MAX
|
||||
},
|
||||
{
|
||||
games::ddr::Lights::GOLD_MONITOR_SIDE_RIGHT_AVG_R, games::ddr::Lights::GOLD_MONITOR_SIDE_RIGHT_AVG_G, games::ddr::Lights::GOLD_MONITOR_SIDE_RIGHT_AVG_B,
|
||||
UINT8_MAX, UINT8_MAX, UINT8_MAX
|
||||
},
|
||||
};
|
||||
|
||||
if (off1 < std::size(mapping)) {
|
||||
auto &map = mapping[off1];
|
||||
|
||||
size_t off2_match = -1;
|
||||
if (!map.split || off2 < 25) {
|
||||
off2_match = map.index_for_avg0;
|
||||
} else {
|
||||
off2_match = map.index_for_avg1;
|
||||
}
|
||||
if (off2_match == off2 && map.index_r0 != UINT8_MAX) {
|
||||
auto &lights = games::ddr::get_lights();
|
||||
if (!map.split || off2 < 25) {
|
||||
Lights::writeLight(RI_MGR, lights[map.index_r0], r / 255.f);
|
||||
Lights::writeLight(RI_MGR, lights[map.index_g0], g / 255.f);
|
||||
Lights::writeLight(RI_MGR, lights[map.index_b0], b / 255.f);
|
||||
} else {
|
||||
Lights::writeLight(RI_MGR, lights[map.index_r1], r / 255.f);
|
||||
Lights::writeLight(RI_MGR, lights[map.index_g1], g / 255.f);
|
||||
Lights::writeLight(RI_MGR, lights[map.index_b1], b / 255.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user