cellGem: add setting to let the game actually set the device hues

This is not very useful at the moment since the tracker can't really
handle random hues yet.
This commit is contained in:
Megamouse 2024-12-20 00:23:14 +01:00
parent 67e8e373a7
commit c6a76eb9af
2 changed files with 17 additions and 12 deletions

View File

@ -899,12 +899,22 @@ public:
if (gem_num < 0 || gem_num >= CELL_GEM_MAX_NUM) continue;
const cfg_ps_move* config = ::at32(g_cfg_move.move, gem_num);
binding.device->color_override_active = true;
binding.device->color_override.r = config->r.get();
binding.device->color_override.g = config->g.get();
binding.device->color_override.b = config->b.get();
if (g_cfg.io.allow_move_hue_set_by_game)
{
const auto& controller = gem.controllers[gem_num];
binding.device->color_override.r = static_cast<u8>(std::clamp(controller.sphere_rgb.r * 255.0f, 0.0f, 255.0f));
binding.device->color_override.g = static_cast<u8>(std::clamp(controller.sphere_rgb.g * 255.0f, 0.0f, 255.0f));
binding.device->color_override.b = static_cast<u8>(std::clamp(controller.sphere_rgb.b * 255.0f, 0.0f, 255.0f));
}
else
{
const cfg_ps_move* config = ::at32(g_cfg_move.move, gem_num);
binding.device->color_override.r = config->r.get();
binding.device->color_override.g = config->g.get();
binding.device->color_override.b = config->b.get();
}
}
}
}
@ -916,7 +926,7 @@ public:
const cfg_ps_move* config = g_cfg_move.move[gem_num];
m_tracker.set_active(gem_num, controller.enabled_tracking && controller.status == CELL_GEM_STATUS_READY);
m_tracker.set_hue(gem_num, config->hue);
m_tracker.set_hue(gem_num, g_cfg.io.allow_move_hue_set_by_game ? controller.hue : config->hue);
m_tracker.set_hue_threshold(gem_num, config->hue_threshold);
m_tracker.set_saturation_threshold(gem_num, config->saturation_threshold);
}
@ -1822,8 +1832,6 @@ error_code cellGemForceRGB(u32 gem_num, f32 r, f32 g, f32 b)
const auto [h, s, v] = ps_move_tracker<false>::rgb_to_hsv(r, g, b);
gem.controllers[gem_num].hue = h;
// TODO: set hue of tracker
return CELL_OK;
}
@ -2833,8 +2841,6 @@ error_code cellGemTrackHues(vm::cptr<u32> req_hues, vm::ptr<u32> res_hues)
gem.controllers[i].enabled_LED = true;
gem.controllers[i].hue_set = true;
// TODO: set hue based on tracker data
switch (i)
{
default:
@ -2886,8 +2892,6 @@ error_code cellGemTrackHues(vm::cptr<u32> req_hues, vm::ptr<u32> res_hues)
const auto [r, g, b] = ps_move_tracker<false>::hsv_to_rgb(gem.controllers[i].hue, 1.0f, 1.0f);
gem.controllers[i].sphere_rgb = gem_config::gem_color(r / 255.0f, g / 255.0f, b / 255.0f);
// TODO: set hue of tracker
if (res_hues)
{
res_hues[i] = gem.controllers[i].hue;

View File

@ -280,6 +280,7 @@ struct cfg_root : cfg::node
cfg::_bool background_input_enabled{this, "Background input enabled", true, true};
cfg::_bool show_move_cursor{this, "Show move cursor", false, true};
cfg::_bool paint_move_spheres{this, "Paint move spheres", false, true};
cfg::_bool allow_move_hue_set_by_game{this, "Allow move hue set by game", false, true};
cfg::_bool lock_overlay_input_to_player_one{this, "Lock overlay input to player one", false, true};
cfg::string midi_devices{this, "Emulated Midi devices", "ßßß@@@ßßß@@@ßßß@@@"};
cfg::_bool load_sdl_mappings{ this, "Load SDL GameController Mappings", true };