Update to spice2x-25-04-25 (pre-apply)
> broken commit
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "launcher/options.h"
|
||||
#include "io.h"
|
||||
#include "iidx.h"
|
||||
#include "util/tapeled.h"
|
||||
|
||||
namespace games::iidx {
|
||||
constexpr bool BI2X_PASSTHROUGH = false;
|
||||
@@ -416,12 +417,9 @@ namespace games::iidx {
|
||||
static struct TapeLedMapping {
|
||||
size_t data_size;
|
||||
int index_r, index_g, index_b;
|
||||
float avg_mult;
|
||||
|
||||
TapeLedMapping(size_t data_size, int index_r, int index_g, int index_b)
|
||||
: data_size(data_size), index_r(index_r), index_g(index_g), index_b(index_b) {
|
||||
avg_mult = 1.f / (data_size * 255);
|
||||
}
|
||||
: data_size(data_size), index_r(index_r), index_g(index_g), index_b(index_b) {}
|
||||
|
||||
} mapping[] = {
|
||||
{ 19, Lights::StageLeftAvgR, Lights::StageLeftAvgG, Lights::StageLeftAvgB },
|
||||
@@ -444,32 +442,20 @@ namespace games::iidx {
|
||||
};
|
||||
|
||||
// check index bounds
|
||||
if (index < std::size(mapping)) {
|
||||
if (tapeledutils::is_enabled() && index < std::size(mapping)) {
|
||||
auto &map = mapping[index];
|
||||
|
||||
// calculate average color
|
||||
size_t avg_ri = 0;
|
||||
size_t avg_gi = 0;
|
||||
size_t avg_bi = 0;
|
||||
for (size_t i = 0; i < map.data_size; i++) {
|
||||
auto color = &data[i * 3];
|
||||
avg_ri += color[0];
|
||||
avg_gi += color[1];
|
||||
avg_bi += color[2];
|
||||
}
|
||||
float avg_r = avg_ri * map.avg_mult;
|
||||
float avg_g = avg_gi * map.avg_mult;
|
||||
float avg_b = avg_bi * map.avg_mult;
|
||||
// pick a color to use
|
||||
const auto rgb = tapeledutils::pick_color_from_led_tape(data, map.data_size);
|
||||
|
||||
// set average color
|
||||
// program the lights into API
|
||||
auto &lights = get_lights();
|
||||
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_r], avg_r);
|
||||
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_g], avg_g);
|
||||
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_b], avg_b);
|
||||
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_r], rgb.r);
|
||||
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_g], rgb.g);
|
||||
GameAPI::Lights::writeLight(RI_MGR, lights[map.index_b], rgb.b);
|
||||
}
|
||||
|
||||
if (This != custom_node) {
|
||||
|
||||
// send tape data to real device
|
||||
return AIO_IOB2_BI2X_TDJ__SetTapeLedData_orig(This, index, data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user