Initial commit: bt411 -- standalone Windows BattleTech (Tesla 4.10 port)
Clean, self-contained extraction of the BattleTech-specific work from the
reverse-engineering workspace -- engine + game + content + build, with nothing
from Red Planet or the raw archive dumps. Builds green (Win32) and runs the
single-player drive->animate->target->fire->damage->destroy loop out of the box.
Layout:
engine/ MUNGA + MUNGA_L4 shared 2007 engine, carrying our BT render/loader
work (bgfload/L4D3D/L4VIDEO: BSL bit-slice decode, LOD/ground/shadow
models) + image codec; the minimal rp/ headers the audio HAL needs
game/ reconstructed BT logic + surviving-original BT source + fwd shims
+ WinMain launcher
content/ full runtime tree (BTL4.RES, VIDEO/, GAUGE/, AUDIO/, eggs, BTDPL.INI)
docs/ format specs + reconstruction ledgers
reference/ raw Ghidra pseudocode (recon source-of-truth) + decomp exporter
tools/ MP console emulator + map/resource scanners
One top-level CMake builds munga_engine lib + bt410_l4 game lib + btl4.exe.
All paths relativized (186 fwd shims + ~437 CMake abs paths -> repo-relative);
DXSDK is the one external, overridable via -DDXSDK. Verified: builds to a
byte-identical 2.27MB exe and runs combat (TARGET DESTROYED, 0 crashes) against
the bundled content.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
#include "mungal4.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "..\munga\style.h"
|
||||
|
||||
void* Get_Caller(int level)
|
||||
{
|
||||
char *address;
|
||||
__asm MOV address, EBP;
|
||||
while (level--)
|
||||
{
|
||||
Check_Pointer(address);
|
||||
address = *(char**)address;
|
||||
}
|
||||
Check_Pointer(address);
|
||||
return *(char**)(address+4);
|
||||
}
|
||||
|
||||
#if defined(USE_ACTIVE_PROFILE)
|
||||
#undef inportb
|
||||
#undef outportb
|
||||
|
||||
//
|
||||
// table of data representing bits on the parallel port at 0x378 (usually LPT1)
|
||||
// DO NOT ALTER THIS DATA - IT REQUIRES LOTS OF SCHEMATIC TRACING TO DUPLICATE
|
||||
//
|
||||
struct ParallelBit
|
||||
{
|
||||
unsigned int port;
|
||||
Byte mask;
|
||||
int sense;
|
||||
};
|
||||
|
||||
ParallelBit Bit_Table[12] =
|
||||
{
|
||||
{0x378, 0x80, 0x00},
|
||||
{0x378, 0x40, 0x00},
|
||||
{0x378, 0x20, 0x00},
|
||||
{0x378, 0x10, 0x00},
|
||||
{0x37a, 0x08, 0x01},
|
||||
{0x37a, 0x04, 0x00},
|
||||
{0x37a, 0x02, 0x01},
|
||||
{0x37a, 0x01, 0x01},
|
||||
{0x378, 0x08, 0x00},
|
||||
{0x378, 0x04, 0x00},
|
||||
{0x378, 0x02, 0x00},
|
||||
{0x378, 0x01, 0x00}
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
void BitTrace::SetLineImplementation(Byte line)
|
||||
{
|
||||
Verify(line < ELEMENTS(Bit_Table));
|
||||
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
// read the current value of the appropriate port
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
Byte port_value = inportb(Bit_Table[line].port);
|
||||
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
// set the appropriate bit, taking into account the hardware sense
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
if (!Bit_Table[line].sense)
|
||||
{
|
||||
port_value |= Bit_Table[line].mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
port_value &= (Byte)(~Bit_Table[line].mask);
|
||||
}
|
||||
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
// put the modified value into the appropriate port
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
outportb(Bit_Table[line].port, port_value);
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
void BitTrace::ClearLineImplementation(Byte line)
|
||||
{
|
||||
Verify(line < ELEMENTS(Bit_Table));
|
||||
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
// read the current value of the appropriate port
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
Byte port_value = inportb(Bit_Table[line].port);
|
||||
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
// clear the appropriate bit, taking into account the hardware sense
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
if (!Bit_Table[line].sense)
|
||||
{
|
||||
port_value &= (Byte)(~Bit_Table[line].mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
port_value |= Bit_Table[line].mask;
|
||||
}
|
||||
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
// put the modified value into the appropriate port
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
outportb(Bit_Table[line].port, port_value);
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
Logical
|
||||
BitTrace::IsLineValidImplementation(Byte line)
|
||||
{
|
||||
return line<ELEMENTS(Bit_Table);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user