mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 18:53:28 +01:00
Input: make move handler dynamic
This commit is contained in:
parent
2bf17f5d3c
commit
639b8112b6
@ -571,6 +571,9 @@ static bool mouse_input_to_pad(const u32 mouse_no, be_t<u16>& digital_buttons, b
|
||||
|
||||
std::scoped_lock lock(handler.mutex);
|
||||
|
||||
// Make sure that the mouse handler is initialized
|
||||
handler.Init(std::min<u32>(g_fxo->get<gem_config>().attribute.max_connect, CELL_GEM_MAX_NUM));
|
||||
|
||||
if (mouse_no >= handler.GetMice().size())
|
||||
{
|
||||
return false;
|
||||
@ -621,6 +624,9 @@ static void mouse_pos_to_gem_image_state(const u32 mouse_no, const gem_config::g
|
||||
|
||||
std::scoped_lock lock(handler.mutex);
|
||||
|
||||
// Make sure that the mouse handler is initialized
|
||||
handler.Init(std::min<u32>(g_fxo->get<gem_config>().attribute.max_connect, CELL_GEM_MAX_NUM));
|
||||
|
||||
if (mouse_no >= handler.GetMice().size())
|
||||
{
|
||||
return;
|
||||
@ -669,6 +675,9 @@ static void mouse_pos_to_gem_state(const u32 mouse_no, const gem_config::gem_con
|
||||
|
||||
std::scoped_lock lock(handler.mutex);
|
||||
|
||||
// Make sure that the mouse handler is initialized
|
||||
handler.Init(std::min<u32>(g_fxo->get<gem_config>().attribute.max_connect, CELL_GEM_MAX_NUM));
|
||||
|
||||
if (mouse_no >= handler.GetMice().size())
|
||||
{
|
||||
return;
|
||||
@ -741,11 +750,8 @@ error_code cellGemCalibrate(u32 gem_num)
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
if (g_cfg.io.move == move_handler::fake || g_cfg.io.move == move_handler::mouse)
|
||||
{
|
||||
gem.controllers[gem_num].is_calibrating = true;
|
||||
gem.controllers[gem_num].calibration_start_us = get_guest_system_time();
|
||||
}
|
||||
gem.controllers[gem_num].is_calibrating = true;
|
||||
gem.controllers[gem_num].calibration_start_us = get_guest_system_time();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -1507,14 +1513,6 @@ error_code cellGemInit(ppu_thread& ppu, vm::cptr<CellGemAttribute> attribute)
|
||||
gem.status_flags = 0;
|
||||
gem.attribute = *attribute;
|
||||
|
||||
if (g_cfg.io.move == move_handler::mouse)
|
||||
{
|
||||
// init mouse handler
|
||||
auto& handler = g_fxo->get<MouseHandlerBase>();
|
||||
|
||||
handler.Init(std::min<u32>(attribute->max_connect, CELL_GEM_MAX_NUM));
|
||||
}
|
||||
|
||||
for (int gem_num = 0; gem_num < CELL_GEM_MAX_NUM; gem_num++)
|
||||
{
|
||||
gem.reset_controller(gem_num);
|
||||
@ -1544,16 +1542,13 @@ error_code cellGemInvalidateCalibration(s32 gem_num)
|
||||
return CELL_GEM_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (g_cfg.io.move == move_handler::fake || g_cfg.io.move == move_handler::mouse)
|
||||
{
|
||||
gem.controllers[gem_num].calibrated_magnetometer = false;
|
||||
gem.controllers[gem_num].calibrated_magnetometer = false;
|
||||
|
||||
// TODO: does this really stop an ongoing calibration ?
|
||||
gem.controllers[gem_num].is_calibrating = false;
|
||||
gem.controllers[gem_num].calibration_start_us = 0;
|
||||
// TODO: does this really stop an ongoing calibration ?
|
||||
gem.controllers[gem_num].is_calibrating = false;
|
||||
gem.controllers[gem_num].calibration_start_us = 0;
|
||||
|
||||
// TODO: gem.status_flags (probably not changed)
|
||||
}
|
||||
// TODO: gem.status_flags (probably not changed)
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ struct cfg_root : cfg::node
|
||||
cfg::_enum<fake_camera_type> camera_type{ this, "Camera type", fake_camera_type::unknown };
|
||||
cfg::_enum<camera_flip> camera_flip_option{ this, "Camera flip", camera_flip::none, true };
|
||||
cfg::string camera_id{ this, "Camera ID", "Default", true };
|
||||
cfg::_enum<move_handler> move{ this, "Move", move_handler::null };
|
||||
cfg::_enum<move_handler> move{ this, "Move", move_handler::null, true };
|
||||
cfg::_enum<buzz_handler> buzz{ this, "Buzz emulated controller", buzz_handler::null };
|
||||
cfg::_enum<turntable_handler> turntable{this, "Turntable emulated controller", turntable_handler::null};
|
||||
cfg::_enum<ghltar_handler> ghltar{this, "GHLtar emulated controller", ghltar_handler::null};
|
||||
|
@ -12,8 +12,15 @@ LOG_CHANNEL(input_log, "Input");
|
||||
|
||||
void basic_mouse_handler::Init(const u32 max_connect)
|
||||
{
|
||||
if (m_info.max_connect > 0)
|
||||
{
|
||||
// Already initialized
|
||||
return;
|
||||
}
|
||||
|
||||
m_mice.clear();
|
||||
m_mice.emplace_back(Mouse());
|
||||
memset(&m_info, 0, sizeof(MouseInfo));
|
||||
m_info = {};
|
||||
m_info.max_connect = max_connect;
|
||||
m_info.now_connect = std::min(::size32(m_mice), max_connect);
|
||||
m_info.info = input::g_mice_intercepted ? CELL_MOUSE_INFO_INTERCEPTED : 0; // Ownership of mouse data: 0=Application, 1=System
|
||||
|
@ -81,7 +81,9 @@ EmuCallbacks main_application::CreateCallbacks()
|
||||
ret->SetTargetWindow(m_game_window);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_fxo->init<MouseHandlerBase, NullMouseHandler>(Emu.DeserialManager());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user