mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
Qt/input: limit some usb device configs to 2 players
This commit is contained in:
parent
07f458f991
commit
22916a7e8d
@ -26,9 +26,9 @@ struct cfg_buzzer final : public emulated_pad_config<buzz_btn>
|
|||||||
cfg_pad_btn<buzz_btn> blue{ this, "Blue", buzz_btn::blue, pad_button::triangle };
|
cfg_pad_btn<buzz_btn> blue{ this, "Blue", buzz_btn::blue, pad_button::triangle };
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cfg_buzz final : public emulated_pads_config<cfg_buzzer>
|
struct cfg_buzz final : public emulated_pads_config<cfg_buzzer, 7>
|
||||||
{
|
{
|
||||||
cfg_buzz() : emulated_pads_config<cfg_buzzer>("buzz") {};
|
cfg_buzz() : emulated_pads_config<cfg_buzzer, 7>("buzz") {};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cfg_buzz g_cfg_buzz;
|
extern cfg_buzz g_cfg_buzz;
|
||||||
|
@ -159,22 +159,19 @@ struct emulated_pad_config : cfg::node
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T, u32 Count>
|
||||||
struct emulated_pads_config : cfg::node
|
struct emulated_pads_config : cfg::node
|
||||||
{
|
{
|
||||||
emulated_pads_config(std::string id) : cfg_id(std::move(id)) {}
|
emulated_pads_config(std::string id) : cfg_id(std::move(id))
|
||||||
|
{
|
||||||
|
for (u32 i = 0; i < Count; i++)
|
||||||
|
{
|
||||||
|
players.at(i) = std::make_shared<T>(this, fmt::format("Player %d", i + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string cfg_id;
|
std::string cfg_id;
|
||||||
|
std::array<std::shared_ptr<T>, Count> players;
|
||||||
T player1{ this, "Player 1" };
|
|
||||||
T player2{ this, "Player 2" };
|
|
||||||
T player3{ this, "Player 3" };
|
|
||||||
T player4{ this, "Player 4" };
|
|
||||||
T player5{ this, "Player 5" };
|
|
||||||
T player6{ this, "Player 6" };
|
|
||||||
T player7{ this, "Player 7" };
|
|
||||||
|
|
||||||
std::array<T*, 7> players{ &player1, &player2, &player3, &player4, &player5, &player6, &player7 }; // Thanks gcc!
|
|
||||||
|
|
||||||
bool load()
|
bool load()
|
||||||
{
|
{
|
||||||
@ -184,7 +181,7 @@ struct emulated_pads_config : cfg::node
|
|||||||
|
|
||||||
from_default();
|
from_default();
|
||||||
|
|
||||||
for (T* player : players)
|
for (std::shared_ptr<T>& player : players)
|
||||||
{
|
{
|
||||||
player->buttons.clear();
|
player->buttons.clear();
|
||||||
}
|
}
|
||||||
@ -201,7 +198,7 @@ struct emulated_pads_config : cfg::node
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (T* player : players)
|
for (std::shared_ptr<T>& player : players)
|
||||||
{
|
{
|
||||||
player->init_buttons();
|
player->init_buttons();
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@ struct cfg_gem final : public emulated_pad_config<gem_btn>
|
|||||||
cfg_pad_btn<gem_btn> y_axis{ this, "Y-Axis", gem_btn::y_axis, pad_button::ls_y };
|
cfg_pad_btn<gem_btn> y_axis{ this, "Y-Axis", gem_btn::y_axis, pad_button::ls_y };
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cfg_gems final : public emulated_pads_config<cfg_gem>
|
struct cfg_gems final : public emulated_pads_config<cfg_gem, 7>
|
||||||
{
|
{
|
||||||
cfg_gems() : emulated_pads_config<cfg_gem>("gem") {};
|
cfg_gems() : emulated_pads_config<cfg_gem, 7>("gem") {};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cfg_gems g_cfg_gem;
|
extern cfg_gems g_cfg_gem;
|
||||||
|
@ -46,9 +46,9 @@ struct cfg_ghltar final : public emulated_pad_config<ghltar_btn>
|
|||||||
cfg_pad_btn<ghltar_btn> tilt{ this, "tilt", ghltar_btn::whammy, pad_button::rs_x };
|
cfg_pad_btn<ghltar_btn> tilt{ this, "tilt", ghltar_btn::whammy, pad_button::rs_x };
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cfg_ghltars final : public emulated_pads_config<cfg_ghltar>
|
struct cfg_ghltars final : public emulated_pads_config<cfg_ghltar, 2>
|
||||||
{
|
{
|
||||||
cfg_ghltars() : emulated_pads_config<cfg_ghltar>("ghltar") {};
|
cfg_ghltars() : emulated_pads_config<cfg_ghltar, 2>("ghltar") {};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cfg_ghltars g_cfg_ghltar;
|
extern cfg_ghltars g_cfg_ghltar;
|
||||||
|
@ -48,9 +48,9 @@ struct cfg_turntable final : public emulated_pad_config<turntable_btn>
|
|||||||
cfg_pad_btn<turntable_btn> effects_dial{ this, "Effects Dial", turntable_btn::effects_dial, pad_button::rs_x };
|
cfg_pad_btn<turntable_btn> effects_dial{ this, "Effects Dial", turntable_btn::effects_dial, pad_button::rs_x };
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cfg_turntables final : public emulated_pads_config<cfg_turntable>
|
struct cfg_turntables final : public emulated_pads_config<cfg_turntable, 2>
|
||||||
{
|
{
|
||||||
cfg_turntables() : emulated_pads_config<cfg_turntable>("turntable") {};
|
cfg_turntables() : emulated_pads_config<cfg_turntable, 2>("turntable") {};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cfg_turntables g_cfg_turntable;
|
extern cfg_turntables g_cfg_turntable;
|
||||||
|
@ -183,7 +183,7 @@ void usb_device_usio::translate_input()
|
|||||||
constexpr le_t<u16> c_big_hit = 0x1800;
|
constexpr le_t<u16> c_big_hit = 0x1800;
|
||||||
le_t<u16> test_keys = 0x0000;
|
le_t<u16> test_keys = 0x0000;
|
||||||
|
|
||||||
auto translate_from_pad = [&](u8 pad_number, u8 player)
|
auto translate_from_pad = [&](usz pad_number, usz player)
|
||||||
{
|
{
|
||||||
if (!is_input_allowed())
|
if (!is_input_allowed())
|
||||||
{
|
{
|
||||||
@ -277,8 +277,10 @@ void usb_device_usio::translate_input()
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
translate_from_pad(0, 0);
|
for (usz i = 0; i < g_cfg_usio.players.size(); i++)
|
||||||
translate_from_pad(1, 1);
|
{
|
||||||
|
translate_from_pad(i, i);
|
||||||
|
}
|
||||||
|
|
||||||
test_keys |= test_on ? 0x80 : 0x00;
|
test_keys |= test_on ? 0x80 : 0x00;
|
||||||
std::memcpy(input_buf.data(), &test_keys, sizeof(u16));
|
std::memcpy(input_buf.data(), &test_keys, sizeof(u16));
|
||||||
|
@ -44,9 +44,9 @@ struct cfg_usio final : public emulated_pad_config<usio_btn>
|
|||||||
cfg_pad_btn<usio_btn> small_hit_center_right{ this, "Small Hit Center Right", usio_btn::small_hit_center_right, pad_button::R1 };
|
cfg_pad_btn<usio_btn> small_hit_center_right{ this, "Small Hit Center Right", usio_btn::small_hit_center_right, pad_button::R1 };
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cfg_usios final : public emulated_pads_config<cfg_usio>
|
struct cfg_usios final : public emulated_pads_config<cfg_usio, 2>
|
||||||
{
|
{
|
||||||
cfg_usios() : emulated_pads_config<cfg_usio>("usio") {};
|
cfg_usios() : emulated_pads_config<cfg_usio, 2>("usio") {};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cfg_usios g_cfg_usio;
|
extern cfg_usios g_cfg_usio;
|
||||||
|
@ -103,7 +103,29 @@ void emulated_pad_settings_dialog::add_tabs(QTabWidget* tabs)
|
|||||||
rows = utils::aligned_div(static_cast<u32>(T::count), ++cols);
|
rows = utils::aligned_div(static_cast<u32>(T::count), ++cols);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int player = 0; player < 7; player++)
|
usz players = 0;
|
||||||
|
switch (m_type)
|
||||||
|
{
|
||||||
|
case pad_type::buzz:
|
||||||
|
players = g_cfg_buzz.players.size();
|
||||||
|
break;
|
||||||
|
case pad_type::turntable:
|
||||||
|
players = g_cfg_turntable.players.size();
|
||||||
|
break;
|
||||||
|
case pad_type::ghltar:
|
||||||
|
players = g_cfg_ghltar.players.size();
|
||||||
|
break;
|
||||||
|
case pad_type::usio:
|
||||||
|
players = g_cfg_usio.players.size();
|
||||||
|
break;
|
||||||
|
case pad_type::ds3gem:
|
||||||
|
players = g_cfg_gem.players.size();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_combos.resize(players);
|
||||||
|
|
||||||
|
for (usz player = 0; player < players; player++)
|
||||||
{
|
{
|
||||||
QWidget* widget = new QWidget(this);
|
QWidget* widget = new QWidget(this);
|
||||||
QGridLayout* grid_layout = new QGridLayout(this);
|
QGridLayout* grid_layout = new QGridLayout(this);
|
||||||
|
@ -34,5 +34,5 @@ private:
|
|||||||
|
|
||||||
pad_type m_type;
|
pad_type m_type;
|
||||||
|
|
||||||
std::array<std::vector<QComboBox*>, 7> m_combos{};
|
std::vector<std::vector<QComboBox*>> m_combos;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user