mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-17 18:37:07 +02:00
The game can stream 20480 textures at once. When a map and its mods need one more, it takes a slot past the end of its table and waits for ever on a byte that is part of a counter: a hang, then a crash in the hang's own report (crash reports of 2026-10-11). The limit is raised to 32764, the most a texture's 16-bit handle can index, before the game makes its texture streaming manager: - The manager is allocated longer (6.0 MB, was 2.3 MB) and its slot table and per-slot floats moved behind its end. Each of the 226 instructions that hold one of those offsets or sizes gets another number; no code is added. Its four fixed lists are pointed at longer storage once the constructor has run. - The renderer keeps a block of floats per slot for each of four layers. Its object grows to match (27 instructions), and the two places that index a layer's block as layer * 20480 become a multiply by the new count, in the same twelve bytes. - Three functions keep 20480 entries on their own stack. Two list filters go through a longer list a stretch at a time, and the sort is given scratch room of its own past that many. Up to 20480 they run as the game wrote them. Every instruction is checked byte for byte first, and nothing is changed if any differs or the manager already exists. An empty texture_limit_stock.txt beside the game leaves the limit as it is. Players are told when they come close: a notice at 90% of the limit in force and an error at 100%, each once until use falls below 80%. The log records each new high in steps of 5%. Also: when a function of the game finds its stack written over, the game ends itself with exit code 0xc0000409 and no crash report. The log now names that function and its callers first. The site table (texture_streaming_sites.inc) is generated from a sweep of the supported build; texture_streaming.h describes the layout. Tested in game below 20480 textures only. Nothing has run above the old limit, where the three stack guards and the longer lists first matter. At 32764 the game still hangs; the notice is the protection.
11 lines
458 B
C++
11 lines
458 B
C++
#pragma once
|
|
#include <cstdint>
|
|
|
|
// When a function of the game finds its stack written over, the game ends itself with a fast
|
|
// fail (exit code 0xc0000409): no exception, so neither crash reporter writes anything. This
|
|
// puts where it happened in the log first. A diagnostic for work on the game's fixed-size
|
|
// tables (texture_handle_limit); it changes nothing else.
|
|
namespace dingosdk::stack_check_report {
|
|
bool install(std::uintptr_t base) noexcept;
|
|
}
|