1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

sys_usbd: Allow 'Moving' figure to same slot on Dimensions Toypad (#15850)

This commit is contained in:
Joshua de Reeper 2024-07-29 16:50:20 +01:00 committed by GitHub
parent 02aac2c52e
commit 12fbff22b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 16 deletions

View File

@ -403,7 +403,20 @@ bool dimensions_toypad::remove_figure(u8 pad, u8 index, bool save)
bool dimensions_toypad::move_figure(u8 pad, u8 index, u8 old_pad, u8 old_index) bool dimensions_toypad::move_figure(u8 pad, u8 index, u8 old_pad, u8 old_index)
{ {
// When moving figures between spaces on the portal, remove any figure from the space they are moving to, if (old_index == index)
{
// Don't bother removing and loading again, just send response to the game
const dimensions_figure& figure = get_figure_by_index(old_index);
std::array<u8, 32> figure_remove_response = {0x56, 0x0b, pad, 0x00, figure.index, 0x01};
figure_remove_response[13] = generate_checksum(figure_remove_response, 13);
std::array<u8, 32> figure_add_response = {0x56, 0x0b, pad, 0x00, figure.index, 0x00};
figure_add_response[13] = generate_checksum(figure_add_response, 13);
m_figure_added_removed_responses.push(std::move(figure_remove_response));
m_figure_added_removed_responses.push(std::move(figure_add_response));
return true;
}
// When moving figures between spaces on the toypad, remove any figure from the space they are moving to,
// then remove them from their current space, then load them to the space they are moving to // then remove them from their current space, then load them to the space they are moving to
remove_figure(pad, index, true); remove_figure(pad, index, true);

View File

@ -543,19 +543,20 @@ void minifig_move_dialog::add_minifig_position(QGridLayout* grid_panel, u8 index
{ {
vbox_panel->addWidget(new QLabel(tr("None"))); vbox_panel->addWidget(new QLabel(tr("None")));
} }
if (old_index != index) auto* btn_move = new QPushButton(tr("Move Here"), this);
if (old_index == index)
{ {
auto* btn_move = new QPushButton(tr("Move Here"), this); btn_move->setText(tr("Pick up and Place"));
vbox_panel->addWidget(btn_move);
connect(btn_move, &QAbstractButton::clicked, this, [this, index]
{
m_index = index;
m_pad = index == 1 ? 1 :
index == 0 || index == 3 || index == 4 ? 2 :
3;
accept();
});
} }
vbox_panel->addWidget(btn_move);
connect(btn_move, &QAbstractButton::clicked, this, [this, index]
{
m_index = index;
m_pad = index == 1 ? 1 :
index == 0 || index == 3 || index == 4 ? 2 :
3;
accept();
});
grid_panel->addLayout(vbox_panel, row, column); grid_panel->addLayout(vbox_panel, row, column);
} }
@ -726,10 +727,13 @@ void dimensions_dialog::move_figure(u8 pad, u8 index)
if (move_dlg.exec() == Accepted) if (move_dlg.exec() == Accepted)
{ {
g_dimensionstoypad.move_figure(move_dlg.get_new_pad(), move_dlg.get_new_index(), pad, index); g_dimensionstoypad.move_figure(move_dlg.get_new_pad(), move_dlg.get_new_index(), pad, index);
figure_slots[move_dlg.get_new_index()] = figure_slots[index]; if (index != move_dlg.get_new_index())
m_edit_figures[move_dlg.get_new_index()]->setText(m_edit_figures[index]->text()); {
figure_slots[index] = std::nullopt; figure_slots[move_dlg.get_new_index()] = figure_slots[index];
m_edit_figures[index]->setText(tr("None")); m_edit_figures[move_dlg.get_new_index()]->setText(m_edit_figures[index]->text());
figure_slots[index] = std::nullopt;
m_edit_figures[index]->setText(tr("None"));
}
} }
} }