Prevent misconfigured Triforce launches and warn on mismatched hardware

This commit is contained in:
crediar 2025-07-17 14:36:20 +02:00
commit 001b94a6e2

View file

@ -1147,6 +1147,39 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
}
}
/*
When booting Triforce games, we need to ensure that the hardware is set up correctly.
*/
const auto volume_type =
std::get<BootParameters::Disc>(parameters->parameters).volume->GetVolumeType();
const bool triforce_hardware_sp1 = Config::Get(Config::MAIN_SERIAL_PORT_1) == ExpansionInterface::EXIDeviceType::Baseboard;
const bool triforce_hardware_port_1 = Config::Get(Config::GetInfoForSIDevice(0)) == SerialInterface::SIDevices::SIDEVICE_AM_BASEBOARD;
if (volume_type == DiscIO::Platform::Triforce)
{
if (!triforce_hardware_sp1 || !triforce_hardware_port_1)
{
ModalMessageBox::critical(
this, tr("Error"), tr("To boot a Triforce game, SP1 and Port 1 must be set to Triforce Baseboard."),
QMessageBox::Ok);
HideRenderWidget();
return;
}
}
else
{
/*
Some Triforce tools don't include a boot.id file, but they can still be launched.
*/
if (triforce_hardware_sp1 || triforce_hardware_port_1)
{
ModalMessageBox::warning(
this, tr("Warning"), tr("Non-Triforce games cannot be booted with Triforce hardware attached."),
QMessageBox::Ok);
}
}
// If we're running, only start a new game once we've stopped the last.
if (!Core::IsUninitialized(m_system))
{