Update to spice2x-25-04-25 (pre-apply)
> broken commit
This commit is contained in:
+16
-23
@@ -10,6 +10,8 @@
|
||||
#include "launcher/options.h"
|
||||
#include "io.h"
|
||||
#include "games/sdvx/sdvx.h"
|
||||
#include "util/tapeled.h"
|
||||
#include "acioemu/icca.h"
|
||||
|
||||
namespace games::sdvx {
|
||||
constexpr bool BI2X_PASSTHROUGH = false;
|
||||
@@ -293,12 +295,9 @@ namespace games::sdvx {
|
||||
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[] = {
|
||||
{ 74, Lights::TITLE_AVG_R, Lights::TITLE_AVG_G, Lights::TITLE_AVG_B },
|
||||
@@ -314,32 +313,20 @@ namespace games::sdvx {
|
||||
};
|
||||
|
||||
// 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_UFC__SetTapeLedData_orig(This, index, data);
|
||||
}
|
||||
@@ -366,6 +353,12 @@ namespace games::sdvx {
|
||||
}
|
||||
log_info("bi2x_hook", "aioNMgrIob2_Create");
|
||||
BI2X_INITIALIZED = true;
|
||||
|
||||
// enable hack to make PIN pad work for KFC in BI2X mode
|
||||
// this explicit check in the I/O init path is necessary
|
||||
// (as opposed to just doing a check for "isValkyrieCabMode?")
|
||||
// because there are hex edits that allow you to use legacy (KFC/BIO2) IO while in Valk mode
|
||||
acioemu::ICCA_DEVICE_HACK = true;
|
||||
return &aioNmgrIob2;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user