Files
ReSkate/Extension/World/load_error_guard.h
T
AyeZeeBB 9b79fd7829 Guard a crash when the game describes a failed load
Guard a crash when the game describes a failed load

When a load fails, the game writes "load <address> failed with error:"
and describes each part of the load's error in turn. That list can
hold parts that were never set, and the game calls through them: six
crash reports from one player on 2.0.5 and 2.0.6 all end at
Skate.exe+0x2e3ab9c, after eight parts that read "no error".

The guard hooks that one function. Before the game describes the
list, every part that is not one of the game's own objects is emptied,
so it reads "no error" as an empty part does; the description also
runs under an exception handler. The failed load is then the game's to
deal with, as it meant to.

What the game wrote goes to the log as a warning ("The game described
the error of a load that failed"), with how many parts were emptied,
so content that does not load can be traced. The game's message names
no asset, only an address.
2026-10-11 18:00:30 -05:00

17 lines
898 B
C++

#pragma once
#include <cstdint>
// A load that failed could crash the game instead: to say why, the game describes each part of
// the load's error in turn, and the list can hold parts that were never set
// (Engine/Game/Build/<build>/load_errors.h). The guard looks at the list first and empties every
// part that is not one of the game's own objects, so those read "no error" as an empty part
// does; the description itself runs under an exception handler as well. The failed load is then
// the game's to deal with, as it meant to. What the game wrote is put in the log, so a mod
// whose content does not load can be found.
namespace dingosdk::load_error_guard {
// Checks this build's function and hooks it; once. False when the build differs (no guard).
bool install(std::uintptr_t base) noexcept;
// How many parts were emptied since the game started.
std::uint64_t emptied() noexcept;
}