Metroid UI for GameCube

This commit is contained in:
SirMangler 2021-11-14 21:08:13 +00:00
parent 8a8f2f057d
commit 3eaa48d6a3
17 changed files with 389 additions and 38 deletions

View File

@ -505,7 +505,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
for (size_t i = 0; i < std::size(m_SIDevice); ++i)
{
core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i],
(i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
(i == 0) ? SerialInterface::SIDEVICE_GC_METROID : SerialInterface::SIDEVICE_NONE);
core->Get(fmt::format("AdapterRumble{}", i), &m_AdapterRumble[i], true);
core->Get(fmt::format("SimulateKonga{}", i), &m_AdapterKonga[i], false);
}

View File

@ -76,6 +76,13 @@ bool GetMicButton(const int pad_num)
return static_cast<GCPad*>(s_config.GetController(pad_num))->GetMicButton();
}
void ChangeUIPrimeHack(int number, bool useMetroidUI)
{
GCPad* gcpad = static_cast<GCPad*>(s_config.GetController(number));
gcpad->ChangeUIPrimeHack(useMetroidUI);
}
bool CheckPitchRecentre()
{
GCPad* gcpad = static_cast<GCPad*>(s_config.GetController(0));

View File

@ -31,6 +31,8 @@ void ResetRumble(int pad_num);
bool GetMicButton(int pad_num);
void ChangeUIPrimeHack(int number, bool useMetroidUI);
bool CheckPitchRecentre();
bool PrimeUseController();

View File

@ -37,6 +37,10 @@ static const u16 dpad_bitmasks[] = {PAD_BUTTON_UP, PAD_BUTTON_DOWN, PAD_BUTTON_L
PAD_BUTTON_RIGHT};
static const char* const named_buttons[] = {"A", "B", "X", "Y", "Z", "Start"};
static const char* const metroid_named_buttons[] = { "Shoot / Select", "Jump / Cancel", "Morph Ball", "Missile", "Map", "Menu / Hint" };
static const char* const prime_beams[] = { "Beam 1", "Beam 2", "Beam 3", "Beam 4" };
static const char* const prime_visors[] = { "Visor 1", "Visor 2", "Visor 3", "Visor 4" };
static const char* const named_triggers[] = {
// i18n: The left trigger button (labeled L on real controllers)
@ -102,32 +106,6 @@ GCPad::GCPad(const unsigned int index) : m_index(index)
"to the connection state of the real default device (if there is one).")},
false);
// Adding PrimeHack Buttons
//groups.emplace_back(m_primehack_beams = new ControllerEmu::ControlGroup(_trans("PrimeHack")));
//for (const char* prime_button : prime_beams)
//{
// const std::string& ui_name = prime_button;
// m_primehack_beams->controls.emplace_back(
// new ControllerEmu::Input(ControllerEmu::DoNotTranslate, prime_button, ui_name));
//}
//m_primehack_beams->controls.emplace_back(
// new ControllerEmu::Input(ControllerEmu::DoNotTranslate, _trans("Next Beam"), "Next Beam"));
//m_primehack_beams->controls.emplace_back(
// new ControllerEmu::Input(ControllerEmu::DoNotTranslate, _trans("Previous Beam"), "Previous Beam"));
//groups.emplace_back(m_primehack_visors = new ControllerEmu::ControlGroup(_trans("PrimeHack")));
//for (const char* prime_button : prime_visors)
//{
// const std::string& ui_name = prime_button;
// m_primehack_visors->controls.emplace_back(
// new ControllerEmu::Input(ControllerEmu::DoNotTranslate, prime_button, ui_name));
//}
//m_primehack_visors->controls.emplace_back(
// new ControllerEmu::Input(ControllerEmu::DoNotTranslate, _trans("Next Visor"), "Next Visor"));
//m_primehack_visors->controls.emplace_back(
// new ControllerEmu::Input(ControllerEmu::DoNotTranslate, _trans("Previous Visor"), "Previous Visor"));
groups.emplace_back(m_primehack_camera = new ControllerEmu::ControlGroup(_trans("PrimeHack")));
m_primehack_camera->AddSetting(
@ -254,7 +232,7 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
#ifdef _WIN32
m_buttons->SetControlExpression(5, "GRAVE"); // Start
#else
m_buttons->SetControlExpression(5, "GRAVE"); // Start
m_buttons->SetControlExpression(5, "GRAVE"); // Start
#endif
// stick modifiers to 50 %
@ -295,9 +273,12 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
m_c_stick->SetCalibrationFromGate(ControllerEmu::SquareStickGate(1.0));
m_main_stick->SetCalibrationFromGate(ControllerEmu::SquareStickGate(1.0));
// Triggers
m_triggers->SetControlExpression(0, "Shift"); // L
m_triggers->SetControlExpression(2, "Shift");
// Lock/Scan/Spider Ball
#ifdef HAVE_X11
m_triggers->SetControlExpression(0, "`Click 3`");
#else
m_triggers->SetControlExpression(0, "`Click 1`");
#endif
}
bool GCPad::GetMicButton() const
@ -306,12 +287,47 @@ bool GCPad::GetMicButton() const
return m_mic->controls.back()->GetState<bool>();
}
// May introduce Springball into MP1-GC at some point.
void GCPad::ChangeUIPrimeHack(bool useMetroidUI)
{
if (using_metroid_ui == useMetroidUI)
return;
for (int i = 0; i < 6; i++)
{
std::string_view ui_name = useMetroidUI ? metroid_named_buttons[i] : named_buttons[i];
m_buttons->controls[i]->ui_name = _trans(ui_name);
m_buttons->controls[i]->display_alt = useMetroidUI;
}
for (int i = 0; i < 4; i++)
{
std::string_view ui_name = useMetroidUI ? prime_beams[i] : named_directions[i];
m_c_stick->controls[i]->ui_name = _trans(ui_name);
m_c_stick->controls[i]->display_alt = useMetroidUI;
ui_name = useMetroidUI ? prime_visors[i] : named_directions[i];
m_dpad->controls[i]->ui_name = _trans(ui_name);
m_dpad->controls[i]->display_alt = useMetroidUI;
}
m_triggers->controls[0]->ui_name = useMetroidUI ? "Lock-On" : _trans("L");
m_triggers->controls[0]->display_alt = useMetroidUI;
using_metroid_ui = useMetroidUI;
m_buttons->use_metroid_ui = useMetroidUI;
}
// May introduce Springball into GC at some point.
bool GCPad::CheckSpringBallCtrl()
{
return false; //m_primehack_misc->controls[0].get()->control_ref->State() > 0.5;
}
std::tuple<double, double> GCPad::GetPrimeStickXY()
{
const auto stick_state = m_primehack_stick->GetState();

View File

@ -9,6 +9,7 @@
#include "InputCommon/ControllerEmu/ControllerEmu.h"
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
#include "InputCommon/ControllerEmu/ControlGroup/PrimeHackModes.h"
#include "InputCommon/ControllerEmu/Control/Control.h"
struct GCPadStatus;
@ -54,6 +55,8 @@ public:
void LoadDefaults(const ControllerInterface& ciface) override;
void ChangeUIPrimeHack(bool useMetroidUI);
bool CheckSpringBallCtrl();
bool PrimeControllerMode();
@ -69,6 +72,9 @@ public:
static constexpr ControlState C_STICK_GATE_RADIUS = 0.7221375;
private:
bool using_metroid_ui = false;
std::vector<std::unique_ptr<ControllerEmu::Control>> trigger_controls_temp;
ControllerEmu::Buttons* m_buttons;
ControllerEmu::AnalogStick* m_main_stick;
ControllerEmu::AnalogStick* m_c_stick;

View File

@ -85,6 +85,7 @@ enum SIDevices : int
SIDEVICE_N64_CONTROLLER,
SIDEVICE_GC_GBA,
SIDEVICE_GC_CONTROLLER,
SIDEVICE_GC_METROID,
SIDEVICE_GC_KEYBOARD,
SIDEVICE_GC_STEERING,
SIDEVICE_DANCEMAT,

View File

@ -214,7 +214,7 @@ void Nunchuk::LoadDefaults(const ControllerInterface& ciface)
m_buttons->SetControlExpression(0, "LCONTROL");
#endif
// Lock/Sacn/Spider Ball
// Lock/Scan/Spider Ball
#ifdef HAVE_X11
m_buttons->SetControlExpression(1, "`Click 3`");
#else

View File

@ -142,6 +142,8 @@ add_executable(dolphin-emu
Config/Mapping/GCMicrophone.h
Config/Mapping/GCPadEmu.cpp
Config/Mapping/GCPadEmu.h
Config/Mapping/GCPadEmuMetroid.cpp
Config/Mapping/GCPadEmuMetroid.h
Config/Mapping/GCPadWiiUConfigDialog.cpp
Config/Mapping/GCPadWiiUConfigDialog.h
Config/Mapping/Hotkey3D.cpp
@ -185,7 +187,7 @@ add_executable(dolphin-emu
Config/Mapping/WiimoteEmuExtensionMotionSimulation.h
Config/Mapping/WiimoteEmuGeneral.cpp
Config/Mapping/WiimoteEmuGeneral.h
Config/Mapping/WiimoteEmuMetroid.cpp
Config/Mapping/WiimoteEmuMetroid.cpp
Config/Mapping/WiimoteEmuMetroid.h
Config/Mapping/PrimeHackEmuWii.cpp
Config/Mapping/PrimeHackEmuWii.h

View File

@ -18,16 +18,19 @@
#include "Core/Core.h"
#include "Core/HW/SI/SI.h"
#include "Core/HW/SI/SI_Device.h"
#include "Core/HW/GCPad.h"
#include "DolphinQt/Config/Mapping/GCPadWiiUConfigDialog.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/Settings.h"
#include "InputCommon/GCAdapter.h"
#include <ModalMessageBox.h>
static const std::vector<std::pair<SerialInterface::SIDevices, const char*>> s_gc_types = {
{SerialInterface::SIDEVICE_NONE, _trans("None")},
{SerialInterface::SIDEVICE_GC_CONTROLLER, _trans("Standard Controller")},
{SerialInterface::SIDEVICE_GC_METROID, _trans("Metroid Controller")},
{SerialInterface::SIDEVICE_WIIU_ADAPTER, _trans("GameCube Adapter for Wii U")},
{SerialInterface::SIDEVICE_GC_STEERING, _trans("Steering Wheel")},
{SerialInterface::SIDEVICE_DANCEMAT, _trans("Dance Mat")},
@ -145,6 +148,11 @@ void GamecubeControllersWidget::OnGCPadConfigure()
return;
case SerialInterface::SIDEVICE_GC_CONTROLLER:
type = MappingWindow::Type::MAPPING_GCPAD;
Pad::ChangeUIPrimeHack(static_cast<int>(index), false);
break;
case SerialInterface::SIDEVICE_GC_METROID:
type = MappingWindow::Type::MAPPING_GCPAD_METROID;
Pad::ChangeUIPrimeHack(static_cast<int>(index), true);
break;
case SerialInterface::SIDEVICE_WIIU_ADAPTER:
GCPadWiiUConfigDialog(static_cast<int>(index), this).exec();
@ -168,6 +176,18 @@ void GamecubeControllersWidget::OnGCPadConfigure()
return;
}
if (type == MappingWindow::Type::MAPPING_GCPAD) {
if (!SConfig::GetInstance().bPromptPrimeHackTab) {
if (ModalMessageBox::primehack_gctab(this)) {
type = MappingWindow::Type::MAPPING_GCPAD_METROID;
Pad::ChangeUIPrimeHack(static_cast<int>(index), true);
m_gc_controller_boxes[index]->setCurrentIndex(2);
}
SConfig::GetInstance().bPromptPrimeHackTab = true;
}
}
MappingWindow* window = new MappingWindow(this, type, static_cast<int>(index));
window->setAttribute(Qt::WA_DeleteOnClose, true);
window->setWindowModality(Qt::WindowModality::WindowModal);

View File

@ -0,0 +1,220 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinQt/Config/Mapping/GCPadEmuMetroid.h"
#include <QComboBox>
#include <QFormLayout>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QPushButton>
#include <QRadioButton>
#include <QTimer>
#include "Core/HW/GCPad.h"
#include "Core/HW/GCPadEmu.h"
#include "Core/PrimeHack/HackConfig.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "InputCommon/ControllerEmu/ControlGroup/Attachments.h"
#include "InputCommon/ControllerEmu/ControlGroup/PrimeHackModes.h"
#include "InputCommon/InputConfig.h"
#include <QDesktopServices>
#include <QUrl>
GCPadEmuMetroid::GCPadEmuMetroid(MappingWindow* window)
: MappingWidget(window)
{
CreateMainLayout();
Connect();
ConfigChanged();
SaveSettings();
}
void GCPadEmuMetroid::CreateMainLayout()
{
auto* layout = new QHBoxLayout;
// Column 0
auto* groupbox0 = new QVBoxLayout();
auto* gamecube_buttons = CreateGroupBox(tr("GameCube Buttons"),
Pad::GetGroup(GetPort(), PadGroup::Buttons));
gamecube_buttons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
groupbox0->addWidget(gamecube_buttons);
auto* trigger_buttons = CreateGroupBox(tr("GameCube Triggers"),
Pad::GetGroup(GetPort(), PadGroup::Triggers));
trigger_buttons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
groupbox0->addWidget(trigger_buttons);
auto* gamecube_options = CreateGroupBox(tr("GameCube Controller Properties"),
Pad::GetGroup(GetPort(), PadGroup::Options));
gamecube_options->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
groupbox0->addWidget(gamecube_options, 1);
QGroupBox* help_box = new QGroupBox(tr("Help"));
const auto help_hbox = new QHBoxLayout;
m_help_button = new QPushButton();
m_help_button->setText(tr("Open Wiki Page"));
connect(m_help_button, &QPushButton::clicked, this, []() {
QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/shiiion/dolphin/wiki/Installation#changing-primehack-settings")));
});
help_hbox->addWidget(m_help_button);
help_box->setLayout(help_hbox);
help_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
groupbox0->addWidget(help_box);
// Column 1
auto* groupbox1 = new QVBoxLayout();
auto* beam_box = CreateGroupBox(tr("Beams (C-Stick)"),
Pad::GetGroup(GetPort(), PadGroup::CStick));
groupbox1->addWidget(beam_box);
auto* visor_box = CreateGroupBox(tr("Visors (D-Pad)"), Pad::GetGroup(
GetPort(), PadGroup::DPad));
groupbox1->addWidget(visor_box);
// Column 2
auto* groupbox2 = new QVBoxLayout();
auto* movement_stick = CreateGroupBox(tr("Movement Stick"), Pad::GetGroup(
GetPort(), PadGroup::MainStick));
movement_stick->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
groupbox2->addWidget(movement_stick, 0);
auto* rumble_box = CreateGroupBox(tr("Rumble"), Pad::GetGroup(
GetPort(), PadGroup::Rumble));
groupbox2->addWidget(rumble_box, 1);
// Column 3
auto* groupbox3 = new QVBoxLayout();
auto* modes_group = Pad::GetGroup(GetPort(), PadGroup::Modes);
auto* modes = CreateGroupBox(tr("Mode"), modes_group);
auto* ce_modes = static_cast<ControllerEmu::PrimeHackModes*>(modes_group);
const auto combo_hbox = new QHBoxLayout;
combo_hbox->setAlignment(Qt::AlignCenter);
combo_hbox->setSpacing(10);
combo_hbox->addWidget(new QLabel(tr("Mouse")));
combo_hbox->addWidget(m_radio_mouse = new QRadioButton());
combo_hbox->addSpacing(65);
combo_hbox->addWidget(new QLabel(tr("Controller")));
combo_hbox->addWidget(m_radio_controller = new QRadioButton());
modes->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
static_cast<QFormLayout*>(modes->layout())->insertRow(0, combo_hbox);
groupbox3->addWidget(modes, 0);
auto* camera_options =
CreateGroupBox(tr("Camera"),
Pad::GetGroup(GetPort(), PadGroup::Camera));
groupbox3->addWidget(camera_options, 0, Qt::AlignTop);
camera_control = CreateGroupBox(tr("Camera Control"), Pad::GetGroup(
GetPort(), PadGroup::ControlStick));
camera_control->setEnabled(ce_modes->GetSelectedDevice() == 1);
groupbox3->addWidget(camera_control, 1);
layout->addLayout(groupbox0);
layout->addLayout(groupbox1);
layout->addLayout(groupbox2);
layout->addLayout(groupbox3);
setLayout(layout);
}
void GCPadEmuMetroid::Connect()
{
connect(this, &MappingWidget::ConfigChanged, this, &GCPadEmuMetroid::ConfigChanged);
connect(this, &MappingWidget::Update, this, &GCPadEmuMetroid::Update);
connect(m_radio_mouse, &QRadioButton::toggled, this,
&GCPadEmuMetroid::OnDeviceSelected);
connect(m_radio_controller, &QRadioButton::toggled, this,
&GCPadEmuMetroid::OnDeviceSelected);
}
void GCPadEmuMetroid::OnDeviceSelected()
{
auto* ce_modes = static_cast<ControllerEmu::PrimeHackModes*>(
Pad::GetGroup(GetPort(), PadGroup::Modes));
ce_modes->SetSelectedDevice(m_radio_mouse->isChecked() ? 0 : 1);
camera_control->setEnabled(!m_radio_mouse->isChecked());
ConfigChanged();
SaveSettings();
}
void GCPadEmuMetroid::ConfigChanged()
{
return; // All this does is update the extension UI, which we do not have.
}
void GCPadEmuMetroid::Update()
{
bool checked = Pad::PrimeUseController();
camera_control->setEnabled(checked);
if (m_radio_controller->isChecked() != checked) {
m_radio_controller->setChecked(checked);
m_radio_mouse->setChecked(!checked);
}
}
void GCPadEmuMetroid::LoadSettings()
{
Pad::LoadConfig(); // No need to update hack settings since it's already in LoadConfig.
auto* modes = static_cast<ControllerEmu::PrimeHackModes*>(
Pad::GetGroup(GetPort(), PadGroup::Modes));
bool checked;
// Do not allow mouse mode on platforms with input APIs we do not support.
#if defined CIFACE_USE_WIN32 || defined CIFACE_USE_XLIB
checked = modes->GetSelectedDevice() == 0;
#else
checked = 1;
m_radio_mouse->setEnabled(false);
m_radio_controller->setEnabled(false);
#endif
m_radio_mouse->setChecked(checked);
m_radio_controller->setChecked(!checked);
camera_control->setEnabled(!checked);
}
void GCPadEmuMetroid::SaveSettings()
{
Pad::GetConfig()->SaveConfig();
prime::UpdateHackSettings();
}
InputConfig* GCPadEmuMetroid::GetConfig()
{
return Pad::GetConfig();
}

View File

@ -0,0 +1,34 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinQt/Config/Mapping/MappingWidget.h"
class QComboBox;
class QLabel;
class QRadioButton;
class GCPadEmuMetroid final : public MappingWidget
{
public:
explicit GCPadEmuMetroid(MappingWindow* window);
InputConfig* GetConfig() override;
QGroupBox* camera_control;
QRadioButton* m_radio_mouse;
QRadioButton* m_radio_controller;
QPushButton* m_help_button;
private:
void LoadSettings() override;
void SaveSettings() override;
void CreateMainLayout();
void Connect();
void OnDeviceSelected();
void ConfigChanged();
void Update();
};

View File

@ -27,6 +27,7 @@
#include "DolphinQt/Config/Mapping/GCKeyboardEmu.h"
#include "DolphinQt/Config/Mapping/GCMicrophone.h"
#include "DolphinQt/Config/Mapping/GCPadEmu.h"
#include "DolphinQt/Config/Mapping/GCPadEmuMetroid.h"
#include "DolphinQt/Config/Mapping/Hotkey3D.h"
#include "DolphinQt/Config/Mapping/HotkeyControllerProfile.h"
#include "DolphinQt/Config/Mapping/HotkeyDebugging.h"
@ -400,6 +401,12 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
m_primehack_tab =
AddWidget(PRIMEHACK_TAB_NAME, new PrimeHackEmuGC(this));
break;
case Type::MAPPING_GCPAD_METROID:
widget = new GCPadEmuMetroid(this);
setWindowTitle(tr("GameCube Controller (Metroid) at Port %1").arg(GetPort() + 1));
AddWidget(tr("General"), widget);
break;
case Type::MAPPING_GC_MICROPHONE:
widget = new GCMicrophone(this);

View File

@ -37,6 +37,7 @@ public:
MAPPING_GC_GBA,
MAPPING_GC_KEYBOARD,
MAPPING_GCPAD,
MAPPING_GCPAD_METROID,
MAPPING_GC_STEERINGWHEEL,
MAPPING_GC_MICROPHONE,
// Wii

View File

@ -93,6 +93,7 @@
<ClCompile Include="Config\Mapping\GCKeyboardEmu.cpp" />
<ClCompile Include="Config\Mapping\GCMicrophone.cpp" />
<ClCompile Include="Config\Mapping\GCPadEmu.cpp" />
<ClCompile Include="Config\Mapping\GCPadEmuMetroid.cpp" />
<ClCompile Include="Config\Mapping\GCPadWiiUConfigDialog.cpp" />
<ClCompile Include="Config\Mapping\Hotkey3D.cpp" />
<ClCompile Include="Config\Mapping\HotkeyControllerProfile.cpp" />
@ -221,6 +222,7 @@
<ItemGroup>
<ClInclude Include="Config\CheatCodeEditor.h" />
<ClInclude Include="Config\GameConfigEdit.h" />
<ClInclude Include="Config\Mapping\GCPadEmuMetroid.h" />
<ClInclude Include="Config\Mapping\MappingCommon.h" />
<ClInclude Include="Config\Mapping\MappingIndicator.h" />
<ClInclude Include="Config\Mapping\MappingNumeric.h" />

View File

@ -72,6 +72,25 @@ static inline int ExecPrimeHackWiiTabMessage(QWidget* parent)
return msg.exec();
}
static inline int ExecPrimeHackGCTabMessage(QWidget* parent)
{
ModalMessageBox msg(parent, Qt::WindowModal);
msg.setIcon(QMessageBox::Information);
msg.setWindowTitle(QString::fromStdString("PrimeHack"));
msg.setTextFormat(Qt::RichText);
msg.setText(QString::fromStdString(
"<p>Unless you have a specific reason to use the 'Standard Controller' window, "
" we highly recommend you use the Metroid Controller window instead. "
"Both windows will work, but the Metroid window is specialised to make configuring your controls far easier."
"</p><p>"
"If you would like to go to the Metroid controller window instead, press <b>Open</b>.<br>"));
msg.setStandardButtons(QMessageBox::StandardButton::Ignore);
msg.addButton(QMessageBox::StandardButton::Open);
msg.setDefaultButton(QMessageBox::NoButton);
return msg.exec();
}
void ModalMessageBox::primehack_initialrun(QWidget* parent)
{
if (ExecPrimeHackMessage(parent) == QMessageBox::Help) {
@ -88,6 +107,15 @@ bool ModalMessageBox::primehack_wiitab(QWidget* parent)
return false;
}
bool ModalMessageBox::primehack_gctab(QWidget* parent)
{
if (ExecPrimeHackGCTabMessage(parent) == QMessageBox::Open) {
return true;
}
return false;
}
int ModalMessageBox::critical(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons, StandardButton default_button,
Qt::WindowModality modality)

View File

@ -16,6 +16,7 @@ public:
Qt::WindowModality modality = Qt::WindowModal);
static void primehack_initialrun(QWidget* parent);
static bool primehack_wiitab(QWidget* parent);
static bool primehack_gctab(QWidget* parent);
static int information(QWidget* parent, const QString& title, const QString& text,
StandardButtons buttons = Ok, StandardButton default_button = NoButton,
Qt::WindowModality modality = Qt::WindowModal);

View File

@ -79,9 +79,11 @@ void ControlGroup::LoadConfig(IniFile::Section* sec, const std::string& defdev,
if (type == GroupType::Buttons) {
// Load D-Pad Down into Missiles control
if (use_metroid_ui) {
std::string expression;
sec->Get("D-Pad/Down", &expression, "");
controls[6]->control_ref->SetExpression(std::move(expression));
if (controls.size() == 7) { // Hacky way to tell if Wii or GCN
std::string expression;
sec->Get("D-Pad/Down", &expression, "");
controls[6]->control_ref->SetExpression(std::move(expression));
}
}
}
@ -148,7 +150,9 @@ void ControlGroup::SaveConfig(IniFile::Section* sec, const std::string& defdev,
if (type == GroupType::Buttons) {
// Load D-Pad Down into Missiles control
if (use_metroid_ui) {
sec->Set("D-Pad/Down", controls[6]->control_ref->GetExpression(), "");
if (controls.size() == 7) { // Hacky way to tell if Wii or GCN
sec->Set("D-Pad/Down", controls[6]->control_ref->GetExpression(), "");
}
}
}