Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- uses: actions/setup-dotnet@v6
with:
dotnet-version: '8.0.x'
dotnet-version: '8.0.427'

- name: Cache NuGet packages
uses: actions/cache@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/recomp-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/setup-dotnet@v6
with:
dotnet-version: '8.0.x'
dotnet-version: '8.0.427'

# Cache downloads only. Preparation still validates pins, and every run
# compiles current Aurora, runtime, and generated sources from scratch.
Expand Down
1 change: 1 addition & 0 deletions runtime/include/perf_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// MKW_PERF_STATS=1: logs the game thread's busy time per presented frame, i.e. wall time minus the
// time it spends blocked on VI pacing, the GX worker or the audio mixer.
// MKW_FRAME_TRACE=<csv path> also records those per-frame timings in Aurora's trace.
namespace PerfStats {

bool Enabled() noexcept;
Expand Down
6 changes: 6 additions & 0 deletions runtime/src/hle/boot_race.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "guest_function_imports.h"
#include "memory.h"
#include "runtime_log.h"
#include <aurora/aurora.h>

#include <array>
#include <charconv>
Expand Down Expand Up @@ -184,6 +185,11 @@ REGISTER_NATIVE_WRAPPER_AS(0x8052F4E8, RacedataScenario_InitScreens_8052f4e8, "R
extern "C" void KartAIController_IsCPU_8072624c(CpuContext* ctx) {
MKW_GUEST_FUNC(8072624C)(ctx);
if (g_cpuDriven) {
static bool benchmarkReady = false;
if (!benchmarkReady) {
benchmarkReady = true;
aurora_report_benchmark_ready();
}
ctx->gpr[3] = 1;
}
}
Expand Down
16 changes: 10 additions & 6 deletions runtime/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ std::atomic_flag g_abortSignalHandled = ATOMIC_FLAG_INIT;
std::atomic_bool g_fatalErrorReported{false};
std::atomic_bool g_fatalPopupShown{false};
bool g_headless = false;
bool g_hidden = false;
std::atomic<int> g_lastExitCode{0};
std::atomic_bool g_exitCodeSet{false};

Expand Down Expand Up @@ -775,7 +776,7 @@ void MarkFatalErrorReported() {
}

void ShowRuntimeFatalPopup(std::string_view category, std::string_view details) noexcept {
if (g_headless || g_fatalPopupShown.exchange(true, std::memory_order_acq_rel)) {
if (g_headless || g_hidden || g_fatalPopupShown.exchange(true, std::memory_order_acq_rel)) {
return;
}

Expand Down Expand Up @@ -1350,16 +1351,19 @@ int RuntimeMain(int argc, char** argv) {
// `--headless`: with a boot race, run without a window, sound or dialogs.
g_headless = std::any_of(argv + 1, argv + argc,
[](const char* arg) { return std::string_view(arg) == "--headless"; });
g_hidden = std::any_of(argv + 1, argv + argc,
[](const char* arg) { return std::string_view(arg) == "--hidden"; });

try {
for (int i = 1; i < argc; ++i) {
if (std::string_view(argv[i]) != "--headless" && !BootRace::ParseArgument(argv[i])) {
if (std::string_view(argv[i]) != "--headless" && std::string_view(argv[i]) != "--hidden" &&
!BootRace::ParseArgument(argv[i])) {
throw std::invalid_argument(std::string("Unknown command-line option '") + argv[i] +
"'; the game runtime only accepts --race[=<course id>], --race-cpu and --headless, use Config.toml through the installed host.");
"'; the game runtime only accepts --race[=<course id>], --race-cpu, --hidden and --headless, use Config.toml through the installed host.");
}
}
if (g_headless && !BootRace::Requested()) {
throw std::invalid_argument("--headless needs --race[=<course id>] or --race-cpu");
if ((g_headless || g_hidden) && !BootRace::Requested()) {
throw std::invalid_argument("--headless and --hidden need --race[=<course id>] or --race-cpu");
}
if (g_headless) {
AudioBackend::Instance().SetSilenced(true);
Expand Down Expand Up @@ -1400,7 +1404,7 @@ int RuntimeMain(int argc, char** argv) {
auroraConfig.hasWindowPosition = RuntimeConfigFile::WindowPosition(
auroraConfig.windowPosX, auroraConfig.windowPosY);
auroraConfig.allowJoystickBackgroundEvents = !g_headless;
auroraConfig.startHidden = g_headless;
auroraConfig.startHidden = g_hidden || g_headless;
auroraConfig.disableCopyFilter = RuntimeConfigFile::DisableCopyFilter(true);
// Dolphin-style custom textures. Aurora indexes <userPath>/texture_replacements
// once during aurora_initialize, so both knobs only take effect on the next launch.
Expand Down
17 changes: 15 additions & 2 deletions runtime/src/perf_stats.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "perf_stats.h"

#include "runtime_log.h"
#include <aurora/aurora.h>

#include <algorithm>
#include <array>
Expand All @@ -24,12 +25,20 @@ struct FrameWindow {

FrameWindow g_window;

bool LogEnabled() noexcept {
static const bool enabled = [] {
const char* value = std::getenv("MKW_PERF_STATS");
return value != nullptr && std::strcmp(value, "0") != 0;
}();
return enabled;
}

} // namespace

bool Enabled() noexcept {
static const bool enabled = [] {
const char* value = std::getenv("MKW_PERF_STATS");
return value != nullptr && std::strcmp(value, "0") != 0;
const char* trace = std::getenv("MKW_FRAME_TRACE");
return LogEnabled() || (trace != nullptr && *trace);
}();
return enabled;
}
Expand All @@ -48,7 +57,11 @@ void OnFramePresented() noexcept {
return;
}
const auto busy = (now - g_window.last) - wait;
aurora_report_producer_timing(
std::chrono::duration_cast<std::chrono::nanoseconds>(now - g_window.last).count(),
std::chrono::duration_cast<std::chrono::nanoseconds>(wait).count());
g_window.last = now;
if (!LogEnabled()) return;
g_window.busyMs[g_window.count++] = std::chrono::duration<double, std::milli>(busy).count();
if (g_window.count < kWindow) {
return;
Expand Down
Loading
Loading