Files
TeslaRel410/restoration/source410/BT_L4/BTL4.CPP
T
CydandClaude Fable 5 5b35eb973c 4.10 reconstruction: BTL4OPT.EXE links clean and BOOTS to the first staged brick
The reconstructed tree now produces a runnable binary with the authentic
1995 toolchain (BC4.52 / tlink32 / DPMI32):

- BTL4.CPP main TU reconstructed from the 4.11 Ghidra decomp (FUN_0040109c)
  + the 4.10 binary's own string pool + surviving RPL4TOOL.CPP house style;
  probe_main.cpp scaffold retired (BTL4.NOTES.md documents every decoded call)
- L4NET.CPP staged: L4NetworkManager ctor/dtor + 10 vtable-pulled virtuals
  (standalone-benign ones no-op, network ones Fail loudly) + NetNub client
  globals (Net_Common_Ptr=NULL routes L4File to its plain-DOS path)
- build410.sh: libs now built in the AUTHENTIC makefile member order
  (MUNGA.MAK / mungal4.mak / BT.MAK / BTL4.MAK). Order is load-bearing:
  tlink emits static-init records in module pull order, and alphabetical
  order booted into a null-vptr crash (IcomManager::ClassDerivations
  constructing before parent NetworkClient::ClassDerivations). Also fixed
  stage_link to the proven 32-bit lib set (SOSDBXC+SOSMBXC, no WATTCPLG)
- BOXTREE.HPP MemoryBlock unify, BTL4GRND notify stubs, remaining engine
  backfills (audio/gauge/resource/stream TUs) that closed the deep ledger

Smoke test (DOSBox-X + 32RTM, copy of the pod BT tree, our exe swapped in):
  BattleTech v4.10
  BTL4Application::BTL4Application
  l4net.cpp(22): L4NetworkManager -- l4net.cpp not yet reconstructed
Static init, main, -egg parse, BTL4.RES load (version 1.0.6 check passes),
ApplicationManager and the BTL4Application ctor chain all execute real
reconstructed code; boot halts at the first staged Fail() as designed.
Next brick: the real l4net.cpp body.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 19:05:53 -05:00

92 lines
2.9 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
//##########################################################################
//#################### 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 (missionReviewMode >= 1):
// a MissionReviewApplicationManager with a SPOOLSIZE-byte packet
// spool plus BTL4PlaybackApplication -- those bricks are not yet
// reconstructed (see BTL4.NOTES.md for the decompiled structure).
//-------------------------------------------------------------------
//
Fail("btl4.cpp -- mission review/camera launch not yet reconstructed");
return 1;
}
application_manager->RunMissions();
delete application_manager;
return Exit_Code;
}