Files
mandy/runtime/test/gameinput_no_sdl_test.cpp
Moriz82 273b3bdf9d [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD)
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.

Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.

Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.

Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.

No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:42:12 -06:00

47 lines
2.1 KiB
C++

// gameinput.dll!#1 without SDL3: the retail executable imports GameInputCreate by ordinal, and a build without SDL3
// still has to hand back an interface instead of letting the loader fall through to the host's gameinput.dll, which
// answers with a null pointer that the title dereferences.
#include <windows.h>
#include <cstdint>
#include <cstdio>
#include "shims.h"
namespace {
int g_failed = 0;
void check(bool ok, const char* what) {
std::printf("%s %s\n", ok ? "ok " : "FAIL ", what);
if (!ok) ++g_failed;
}
} // namespace
int main() {
auto create = reinterpret_cast<HRESULT(WINAPI*)(void**)>(rt::shims::find("gameinput.dll", "#1"));
auto named = reinterpret_cast<HRESULT(WINAPI*)(void**)>(rt::shims::find("gameinput.dll", "GameInputCreate"));
check(create != nullptr, "the ordinal import gameinput.dll!#1 is served");
check(named != nullptr, "the name GameInputCreate is served");
if (!create) return 1;
void* object = nullptr;
check(create(&object) == S_OK, "GameInputCreate returns S_OK");
check(object != nullptr, "GameInputCreate hands back a non-null interface");
if (!object) return 1;
auto* vtable = *static_cast<void* const* const*>(object);
auto add_ref = reinterpret_cast<ULONG(__stdcall*)(void*)>(vtable[1]);
auto release = reinterpret_cast<ULONG(__stdcall*)(void*)>(vtable[2]);
check(add_ref(object) >= 1, "slot 1 (AddRef) is callable and counts");
check(release(object) >= 0, "slot 2 (Release) is callable and does not underflow");
// A device query answers a clean refusal through the same object rather than faulting.
auto get_devices = reinterpret_cast<HRESULT(__stdcall*)(void*, uint32_t, void**)>(vtable[9]);
void* devices = reinterpret_cast<void*>(0x1);
check(get_devices(object, 0, &devices) == E_NOTIMPL, "an unserved slot returns E_NOTIMPL");
check(devices == reinterpret_cast<void*>(0x1), "an unserved slot writes nothing to its out-parameter");
check(create(nullptr) == E_POINTER, "a null out parameter is E_POINTER");
std::printf("%d failure(s)\n", g_failed);
return g_failed ? 1 : 0;
}