Merge remote-tracking branch 'origin/master'

# Conflicts:
#	game/reconstructed/btl4gau2.cpp
This commit is contained in:
Cyd
2026-07-17 15:48:11 -05:00
17 changed files with 598 additions and 85 deletions
+15 -31
View File
@@ -181,22 +181,11 @@ static void *ResolveLink(void *plug)
//
extern bool BTGetSubsystemAuxScreen(Subsystem *sub, int *screen, int *placement, char *label64);
//
// FUN_0041bf44 -- GetAttributePointer(index): a pointer to the subsystem's Nth
// attribute member (the cooling-loop lamp reaches its cooling-master link at
// attribute slot 3), or 0 if the index is out of range. The engine exposes this
// via Simulation::GetAttributePointer(AttributeID); a miss returns &NullAttribute,
// normalised to 0.
//
static void *FindLinkedSubsystem(void *subsystem, int slot)
{
if (subsystem == 0)
return 0;
void *p = ((Simulation *)subsystem)->GetAttributePointer((Simulation::AttributeID)slot);
if (p == (void *)&Simulation::NullAttribute)
return 0;
return p;
}
// (FUN_0041bf44 GetAttributePointer-by-index helper removed with the task #7
// fix: its only caller was CoolingLoopConnection, which now resolves the
// cooling master through the named-member bridge BTCoolingLoopFrame -- reaching
// an attribute by RAW numeric index is exactly what broke when the audio
// attribute rows grew the chained tables.)
//
// FUN_0041a1a4 IsDerivedFrom(0x50f4bc == PoweredSubsystem's ClassDerivations).
@@ -218,10 +207,16 @@ static Logical IsGeneratorDerived(Subsystem *sub) { return BTIsPoweredSubsystem(
//
// CoolingLoopConnection -- @004c3134 ctor / @004c31a0 sampler (vt 0x518ea8).
// When the source subsystem's coolant loop is active (source+0x134 == 1) it
// follows the linked cooling master (FindLinkedSubsystem(source,3) then Resolve)
// and copies its loop-lamp state (+0x1d4); otherwise 0.
// When the source subsystem's coolant loop is available (coolantAvailable == 1,
// the binary's source+0x134 gate) it follows the linked cooling master (binary
// attr id 3 == "HeatSink" == linkedSinks) and shows its Condenser loop number
// (+0x1d4 == condenserNumber, the image-strip frame); otherwise 0.
// task #7 REGRESSION FIX (2026-07-17): the old raw GetAttributePointer(3) +
// *(+0x1d4) walk AV'd after the audio attribute-table rows shifted the chained
// ids (BT_DEV_GAUGES crash). The sampler now routes through a complete-type
// bridge (heat.cpp) reading NAMED members -- the databinding rule (gotcha 8).
//
extern int BTCoolingLoopFrame(void *subsystem);
class CoolingLoopConnection : public GaugeConnection
{
public:
@@ -230,18 +225,7 @@ public:
source(source), destination(destination) {}
void Update() // @004c31a0
{
void *resolved = 0;
// [T3] guard the raw +0x134 / +0x1d4 reads against the layout mismatch
// (see BTPtrReadable above) -- an invalid chain reads "no source" (0).
if (BTPtrReadable((char *)source + 0x134) &&
*(int *)((char *)source + 0x134) == 1)
{
void *linked = FindLinkedSubsystem(source, 3);
if (linked != 0)
resolved = ResolveLink(linked);
}
*destination = (resolved != 0 && BTPtrReadable((char *)resolved + 0x1d4))
? *(int *)((char *)resolved + 0x1d4) : 0;
*destination = BTCoolingLoopFrame(source);
}
protected:
void *source; // @0x10 this[4]