diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.kt
index 4735b506dd..cb2b0f89c9 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.kt
@@ -80,7 +80,6 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
private var infinityFigureData = Figure(-1, "Position")
private var skylanderSlot = -1
private var infinityPosition = -1
- private var infinityListPosition = -1
private lateinit var skylandersBinding: DialogNfcFiguresManagerBinding
private lateinit var infinityBinding: DialogNfcFiguresManagerBinding
@@ -140,12 +139,14 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
if (infinityFigures.isEmpty()) {
infinityFigures.apply {
add(FigureSlot(getString(R.string.infinity_hexagon_label), 0))
- add(FigureSlot(getString(R.string.infinity_p1_label), 1))
- add(FigureSlot(getString(R.string.infinity_p1a1_label), 3))
+ add(FigureSlot(getString(R.string.infinity_power_hex_two_label), 1))
+ add(FigureSlot(getString(R.string.infinity_power_hex_three_label), 2))
+ add(FigureSlot(getString(R.string.infinity_p1_label), 3))
+ add(FigureSlot(getString(R.string.infinity_p1a1_label), 4))
add(FigureSlot(getString(R.string.infinity_p1a2_label), 5))
- add(FigureSlot(getString(R.string.infinity_p2_label), 2))
- add(FigureSlot(getString(R.string.infinity_p2a1_label), 4))
- add(FigureSlot(getString(R.string.infinity_p2a2_label), 6))
+ add(FigureSlot(getString(R.string.infinity_p2_label), 6))
+ add(FigureSlot(getString(R.string.infinity_p2a1_label), 7))
+ add(FigureSlot(getString(R.string.infinity_p2a2_label), 8))
}
}
}
@@ -164,7 +165,6 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
putInt(EXTRA_SKYLANDER_VAR, skylanderData.variant)
putString(EXTRA_SKYLANDER_NAME, skylanderData.name)
putInt(EXTRA_INFINITY_POSITION, infinityPosition)
- putInt(EXTRA_INFINITY_LIST_POSITION, infinityListPosition)
putLong(EXTRA_INFINITY_NUM, infinityFigureData.number)
putString(EXTRA_INFINITY_NAME, infinityFigureData.name)
}
@@ -183,7 +183,6 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
savedInstanceState.getString(EXTRA_SKYLANDER_NAME)!!
)
infinityPosition = savedInstanceState.getInt(EXTRA_INFINITY_POSITION)
- infinityListPosition = savedInstanceState.getInt(EXTRA_INFINITY_LIST_POSITION)
infinityFigureData = Figure(
savedInstanceState.getLong(EXTRA_INFINITY_NUM),
savedInstanceState.getString(EXTRA_INFINITY_NAME)!!
@@ -297,11 +296,10 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
} else if (requestCode == REQUEST_INFINITY_FIGURE_FILE) {
val label = InfinityConfig.loadFigure(infinityPosition, result!!.data.toString())
if (label != null && label != "Unknown Figure") {
- clearInfinityFigure(infinityListPosition)
- infinityFigures[infinityListPosition].label = label
- infinityBinding.figureManager.adapter?.notifyItemChanged(infinityListPosition)
+ clearInfinityFigure(infinityPosition)
+ infinityFigures[infinityPosition].label = label
+ infinityBinding.figureManager.adapter?.notifyItemChanged(infinityPosition)
infinityPosition = -1
- infinityListPosition = -1
infinityFigureData = Figure.BLANK_FIGURE
} else {
MaterialAlertDialogBuilder(this)
@@ -317,11 +315,10 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
result!!.data.toString(),
infinityPosition
)
- clearInfinityFigure(infinityListPosition)
- infinityFigures[infinityListPosition].label = label!!
- infinityBinding.figureManager.adapter?.notifyItemChanged(infinityListPosition)
+ clearInfinityFigure(infinityPosition)
+ infinityFigures[infinityPosition].label = label!!
+ infinityBinding.figureManager.adapter?.notifyItemChanged(infinityPosition)
infinityPosition = -1
- infinityListPosition = -1
infinityFigureData = Figure.BLANK_FIGURE
}
}
@@ -906,18 +903,19 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
fun setInfinityFigureData(num: Long, name: String, position: Int, listPosition: Int) {
infinityFigureData = Figure(num, name)
infinityPosition = position
- infinityListPosition = listPosition
}
fun clearInfinityFigure(position: Int) {
when (position) {
0 -> infinityFigures[position].label = getString(R.string.infinity_hexagon_label)
- 1 -> infinityFigures[position].label = getString(R.string.infinity_p1_label)
- 2 -> infinityFigures[position].label = getString(R.string.infinity_p1a1_label)
- 3 -> infinityFigures[position].label = getString(R.string.infinity_p1a2_label)
- 4 -> infinityFigures[position].label = getString(R.string.infinity_p2_label)
- 5 -> infinityFigures[position].label = getString(R.string.infinity_p2a1_label)
- 6 -> infinityFigures[position].label = getString(R.string.infinity_p2a2_label)
+ 1 -> infinityFigures[position].label = getString(R.string.infinity_power_hex_two_label)
+ 2 -> infinityFigures[position].label = getString(R.string.infinity_power_hex_three_label)
+ 3 -> infinityFigures[position].label = getString(R.string.infinity_p1_label)
+ 4 -> infinityFigures[position].label = getString(R.string.infinity_p1a1_label)
+ 5 -> infinityFigures[position].label = getString(R.string.infinity_p1a2_label)
+ 6 -> infinityFigures[position].label = getString(R.string.infinity_p2_label)
+ 7 -> infinityFigures[position].label = getString(R.string.infinity_p2a1_label)
+ 8 -> infinityFigures[position].label = getString(R.string.infinity_p2a2_label)
}
infinityBinding.figureManager.adapter?.notifyItemChanged(position)
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/infinitybase/ui/FigureSlotAdapter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/infinitybase/ui/FigureSlotAdapter.kt
index 8d88c37ccb..512019388c 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/infinitybase/ui/FigureSlotAdapter.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/infinitybase/ui/FigureSlotAdapter.kt
@@ -75,6 +75,11 @@ class FigureSlotAdapter(
}
1, 2 -> {
+ // Hexagon Power Discs
+ validFigures.filter { (_, value) -> value in 4000000..4999999 }
+ }
+
+ 3, 6 -> {
// Characters
validFigures.filter { (_, value) -> value in 1000000..1999999 }
}
diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml
index 360e5006a0..0726d9b40d 100644
--- a/Source/Android/app/src/main/res/values/strings.xml
+++ b/Source/Android/app/src/main/res/values/strings.xml
@@ -914,6 +914,8 @@ It can efficiently compress both junk data and encrypted Wii data.
Figure Number
Invalid Figure Selection
Power Disc/Play Set
+ Power Disc Two
+ Power Disc Three
Player One
Player Two
P1 Ability One
diff --git a/Source/Core/Core/IOS/USB/Emulated/Infinity.cpp b/Source/Core/Core/IOS/USB/Emulated/Infinity.cpp
index 89b5caafab..892eb21324 100644
--- a/Source/Core/Core/IOS/USB/Emulated/Infinity.cpp
+++ b/Source/Core/Core/IOS/USB/Emulated/Infinity.cpp
@@ -628,6 +628,11 @@ InfinityBase::LoadFigure(const std::array figure_change_response = {0xab, 0x04, position, 0x09, order_added, 0x00};
figure_change_response[6] = GenerateChecksum(figure_change_response, 6);
@@ -649,9 +654,14 @@ void InfinityBase::RemoveFigure(u8 position)
if (figure.present)
{
- figure.present = false;
-
position = DeriveFigurePosition(position);
+ if (position == 0)
+ {
+ ERROR_LOG_FMT(IOS_USB, "Invalid Position for Infinity Figure");
+ return;
+ }
+
+ figure.present = false;
std::array figure_change_response = {0xab, 0x04, position, 0x09, figure.order_added,
0x01};
@@ -744,14 +754,28 @@ std::string InfinityBase::FindFigure(u32 number) const
u8 InfinityBase::DeriveFigurePosition(u8 position)
{
// In the added/removed response, position needs to be 1 for the hexagon, 2 for Player 1 and
- // Player 1's abilities, and 3 for Player 2 and Player 2's abilities. Abilities are in positions
- // > 2 in the UI (3/5 for player 1, 4/6 for player 2) so decrement the position until < 2.
+ // Player 1's abilities, and 3 for Player 2 and Player 2's abilities. In the UI, positions 0, 1
+ // and 2 represent the hexagon slot, 3, 4 and 5 represent Player 1's slot and 6, 7 and 8 represent
+ // Player 2's slot.
- while (position > 2)
- position -= 2;
+ switch (position)
+ {
+ case 0:
+ case 1:
+ case 2:
+ return 1;
+ case 3:
+ case 4:
+ case 5:
+ return 2;
+ case 6:
+ case 7:
+ case 8:
+ return 3;
- position++;
- return position;
+ default:
+ return 0;
+ }
}
InfinityFigure& InfinityBase::GetFigureByOrder(u8 order_added)
diff --git a/Source/Core/Core/IOS/USB/Emulated/Infinity.h b/Source/Core/Core/IOS/USB/Emulated/Infinity.h
index 7d5ae4a8f7..d4f585ca40 100644
--- a/Source/Core/Core/IOS/USB/Emulated/Infinity.h
+++ b/Source/Core/Core/IOS/USB/Emulated/Infinity.h
@@ -89,7 +89,7 @@ public:
protected:
std::mutex m_infinity_mutex;
- std::array m_figures;
+ std::array m_figures;
private:
InfinityFigure& GetFigureByOrder(u8 order_added);
diff --git a/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.cpp b/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.cpp
index bba4b7d4f8..1519dd62f4 100644
--- a/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.cpp
+++ b/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.cpp
@@ -79,17 +79,21 @@ void InfinityBaseWindow::CreateMainWindow()
AddFigureSlot(vbox_group, tr("Play Set/Power Disc"), 0);
add_line(vbox_group);
- AddFigureSlot(vbox_group, tr("Player One"), 1);
+ AddFigureSlot(vbox_group, tr("Power Disc Two"), 1);
add_line(vbox_group);
- AddFigureSlot(vbox_group, tr("Player One Ability One"), 3);
+ AddFigureSlot(vbox_group, tr("Power Disc Three"), 2);
+ add_line(vbox_group);
+ AddFigureSlot(vbox_group, tr("Player One"), 3);
+ add_line(vbox_group);
+ AddFigureSlot(vbox_group, tr("Player One Ability One"), 4);
add_line(vbox_group);
AddFigureSlot(vbox_group, tr("Player One Ability Two"), 5);
add_line(vbox_group);
- AddFigureSlot(vbox_group, tr("Player Two"), 2);
+ AddFigureSlot(vbox_group, tr("Player Two"), 6);
add_line(vbox_group);
- AddFigureSlot(vbox_group, tr("Player Two Ability One"), 4);
+ AddFigureSlot(vbox_group, tr("Player Two Ability One"), 7);
add_line(vbox_group);
- AddFigureSlot(vbox_group, tr("Player Two Ability Two"), 6);
+ AddFigureSlot(vbox_group, tr("Player Two Ability Two"), 8);
m_group_figures->setLayout(vbox_group);
scroll_area->setWidget(m_group_figures);
@@ -203,8 +207,9 @@ CreateFigureDialog::CreateFigureDialog(QWidget* parent, u8 slot) : QDialog(paren
// Only display entry if it is a piece appropriate for the slot
if ((slot == 0 &&
((figure > 0x1E8480 && figure < 0x2DC6BF) || (figure > 0x3D0900 && figure < 0x4C4B3F))) ||
- ((slot == 1 || slot == 2) && figure < 0x1E847F) ||
- ((slot == 3 || slot == 4 || slot == 5 || slot == 6) &&
+ ((slot == 1 || slot == 2) && (figure > 0x3D0900 && figure < 0x4C4B3F)) ||
+ ((slot == 3 || slot == 6) && figure < 0x1E847F) ||
+ ((slot == 4 || slot == 5 || slot == 7 || slot == 8) &&
(figure > 0x2DC6C0 && figure < 0x3D08FF)))
{
const auto figure_name = QString::fromStdString(entry.first);
diff --git a/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.h b/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.h
index b66e17d0f6..e619e9b903 100644
--- a/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.h
+++ b/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.h
@@ -28,7 +28,7 @@ public:
~InfinityBaseWindow() override;
protected:
- std::array m_edit_figures;
+ std::array m_edit_figures;
private:
void CreateMainWindow();