Single-binary race loop: menu -> race -> menu in one process

WinMain now wraps the engine block in a loop: when a front-end-launched
mission ends under the local console, the setup screen comes back in the
same process instead of exiting (the arcade relaunch-per-mission model).
Replaces the CreateProcess self-respawn - required for Steam, where the
lobby and sockets must survive across races.

Second-cycle re-init crash fixed: d3d_OBJECT kept a static texture cache
keyed by filename, so race 2 got IDirect3DTexture9 pointers created on
race 1 destroyed device and died at first draw (DrawMesh AV). The cache
is now flushed in ~DPLRenderer before the device is released, and
ParticleEngine::Initialize drops particles left over from the previous
mission. Verified: three consecutive 30s races in one PID, each stopped
on time by the console with final scores collected.

Also: L4CONSOLELEN env override for test-length races, and the console
exposes MissionCompleted() for the loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-12 18:48:56 -05:00
co-authored by Claude Fable 5
parent 9f79508257
commit 570eb3aceb
7 changed files with 88 additions and 39 deletions
+11
View File
@@ -277,6 +277,17 @@ L4TEXOP d3d_OBJECT::LoadTexture(LPDIRECT3DDEVICE9 device, const char *fileName)
return texOp;
}
void d3d_OBJECT::FlushTextureCache()
{
stdext::hash_map<std::string, L4TEXOP>::iterator iter;
for (iter = mTextureCache.begin(); iter != mTextureCache.end(); ++iter)
{
if ((*iter).second.texture != NULL)
(*iter).second.texture->Release();
}
mTextureCache.clear();
}
d3d_OBJECT::d3d_OBJECT(LPDIRECT3DDEVICE9 device, int vertCount)
: mDevice(device),
mVertCount(vertCount),