Files
TeslaRel410/restoration/source410/BT_L4/BTL4.CPP
T
CydandClaude Fable 5 d2be54a3b9 BT410 5.3.106: MISSION REVIEW LINKS -- the playback app, the winners circle, and the last Fail() in main
BTL4PB.CPP reconstructed against its AUTHENTIC surviving header (BTL4PB.HPP)
from the binary's 0x4d3b74-0x4d40d8 cluster, cross-checked against the
surviving RP411 twin -- and the review/camera launch in BTL4.CPP's main() is
real code now.  btl4.lib 11 -> 12 members, link clean, zero unresolved: the
linker pulled the entire playback chain for the first time.

The launch decode closed on two identifications:

  The `if (spool_file)` guard in the decomp means the manager getter is
  GetStoredSpoolFile -- the empty-spool getter cannot fail, so a review pod
  with no recorded battle simply starts nothing, which is the right field
  behaviour.

  The camera app's ctor (FUN_0047c3fc) sits in the ENGINE range with the
  (ResourceFile*, ApplicationID) shape: the camera pod's recorder IS the
  engine's own L4SpoolingApplication -- restored one commit ago -- started
  with ApplicationID 1 == BTL4.  BT shipped no camera app of its own.

What the playback app does, all binary-anchored: BTSpoolerTask pumps
recorded packets through DispatchPacket -> the client's own
ReceiveNetworkPacket; RunMission synchronises the clock (timeBias = Now -
the recorded run packet's stamp); the frame loop runs controls ONLY in
interactive review (mode 2), then update/interest/renderer/intercom; and
StopMission plays the WINNERS CIRCLE -- release the spool, park each
player's mech on the dropzone named "win1".."winN" by finishing rank,
freeze it (DoNothing performance), and tilt the camera up 45 degrees over
the tableau.

DOS-authentic ctor shape throughout: the binary's base call is (resource,
0x3eb, DefaultData) -- no windowing parameters ever existed in 4.10; the
RP411 twin's HINSTANCE/HWND threading is port drift, dropped.

Also fixed from 5.3.105's debt: L4PlaybackNetworkManager chains
NetworkManager::DefaultData -- the 1995 header declares no statics of its
own; the RP411 self-reference was drift too.

One [T3] in source: the idle frame's renderer service (the descendant's
ExecuteIdle) has no 1995 entry point; pre-egg the idle frame spins.

RUNTIME TEST PENDING, stated plainly: exercising review needs a
camera/review egg and a recorded spool on the rig (CAMERA-REVIEW-NOTES.md
has the roles).  The normal pod path regressed clean (mode gate untouched).

The Fail() census moves: BTL4.CPP and SEQCTL.CPP are now stub-free; 22
stubs remain across 15 files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 15:54:31 -05:00

129 lines
4.0 KiB
C++

//===========================================================================//
// File: btl4.cpp //
// Project: BattleTech Brick: BattleTech LBE Application //
// Contents: Application launcher (main) //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include <btl4.hpp>
#pragma hdrstop
#if !defined(BTL4APP_HPP)
# include <btl4app.hpp>
#endif
#if !defined(APPMGR_HPP)
# include <appmgr.hpp>
#endif
#if !defined(BTL4VER_HPP)
# include <btl4ver.hpp>
#endif
#if !defined(BTL4PB_HPP)
# include <btl4pb.hpp> // BTL4PlaybackApplication -- the review app
#endif
#if !defined(SPOOLER_HPP)
# include <spooler.hpp> // MissionReviewApplicationManager / SpoolFile
#endif
//##########################################################################
//#################### BTL4Application Globals #######################
//##########################################################################
extern const char* const ProgName;
const char* const ProgName = "btl4";
static Byte
version[3] =
{MAJOR_DATA_VERSION, RELEASE_VERSION, MINOR_DATA_VERSION};
//
//#############################################################################
// main
//#############################################################################
//
int
main(int argc, char *argv[])
{
DEBUG_STREAM << "BattleTech v4.10" << endl;
if (!L4Application::ParseCommandLine(argc, argv, L4Application::ParseToken))
{
return 1;
}
StreamableResourceFile
resources("btl4.res", version);
ApplicationManager
*application_manager = NULL;
if (L4Application::GetMissionReviewMode() < 1)
{
application_manager =
new ApplicationManager(GetTicksPerSecond());
Application
*application = new BTL4Application(&resources);
application_manager->StartApplication(application);
}
else
{
//
//-------------------------------------------------------------------
// Mission review / live-camera launch (mode 1 = camera, 2 = review).
//
// The manager owns SPOOLSIZE-byte packet spools (default 8MB); a
// STORED spool starts the playback application over it, and camera
// mode additionally starts the engine's spooling application -- the
// recorder -- as a second app (the binary's FUN_0047c3fc ctor is
// L4SpoolingApplication's, ApplicationID 1 == BTL4).
//-------------------------------------------------------------------
//
int
spool_size =
(getenv("SPOOLSIZE") != NULL)
? atoi(getenv("SPOOLSIZE"))
: 0x800000;
DEBUG_STREAM << "Spool size = " << spool_size << endl;
MissionReviewApplicationManager
*review_manager =
new MissionReviewApplicationManager(
GetTicksPerSecond(),
(L4Application::GetMissionReviewMode() != 2) ? 2 : 1,
spool_size
);
application_manager = review_manager;
SpoolFile
*spool_file = review_manager->GetStoredSpoolFile();
if (spool_file != NULL)
{
review_manager->StartApplication(
new BTL4PlaybackApplication(&resources, spool_file));
}
if (L4Application::GetMissionReviewMode() == 1)
{
review_manager->StartApplication(
new L4SpoolingApplication(&resources, (ApplicationID)1));
}
}
application_manager->RunMissions();
delete application_manager;
return Exit_Code;
}