StarletBootstrapProbe: fail on a Dolphin alert instead of opening a dialog
With no handler registered, Dolphin shows an alert in a modal MessageBox on Windows, and the probe waits until someone closes it. A run that hits an alert then looks like a hang (StarOS EXP-001). The probe now writes the alert to stderr and exits at once with status 3. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ba86a7486c
commit
61ebfffa97
1 file changed
+15
@@ -1,12 +1,14 @@
|
||||
// Copyright 2026 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/WII_IPC.h"
|
||||
#include "Core/IOS/Starlet/ARMCore.h"
|
||||
@@ -25,6 +27,18 @@ enum class ExpectedOutcome
|
||||
Phase2
|
||||
};
|
||||
|
||||
// Exit status of a run stopped by a Dolphin alert (1: failed expectation, 2: usage).
|
||||
constexpr int ALERT_EXIT_STATUS = 3;
|
||||
|
||||
// Dolphin's default handler shows an alert in a modal MessageBox on Windows, which blocks the
|
||||
// probe until someone closes it. Report the alert on stderr and fail the run at once instead.
|
||||
bool FailOnAlert(const char* caption, const char* text, bool, Common::MsgType)
|
||||
{
|
||||
std::cout.flush();
|
||||
std::cerr << "Dolphin alert (" << caption << "): " << text << std::endl;
|
||||
std::_Exit(ALERT_EXIT_STATUS);
|
||||
}
|
||||
|
||||
bool Run(const std::string& path, bool jit, ExpectedOutcome expected)
|
||||
{
|
||||
std::ifstream file(path, std::ios::binary | std::ios::ate);
|
||||
@@ -132,6 +146,7 @@ bool Run(const std::string& path, bool jit, ExpectedOutcome expected)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
Common::RegisterMsgAlertHandler(FailOnAlert);
|
||||
if (argc < 2 || argc > 4)
|
||||
{
|
||||
std::cerr << "Usage: StarletBootstrapProbe <ELF> [--jit] "
|
||||
|
||||
Reference in new issue
Block a user