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>
268 lines
6.2 KiB
C++
268 lines
6.2 KiB
C++
#if !defined(AUDREND_HPP)
|
|
# define AUDREND_HPP
|
|
|
|
# if !defined(RENDERER_HPP)
|
|
# include <renderer.hpp>
|
|
# endif
|
|
# if !defined(AUDIO_HPP)
|
|
# include <audio.hpp>
|
|
# endif
|
|
# if !defined(AUDSRC_HPP)
|
|
# include <audsrc.hpp>
|
|
# endif
|
|
# if !defined(AUDWGT_HPP)
|
|
# include <audwgt.hpp>
|
|
# endif
|
|
# if !defined(EVENT_HPP)
|
|
# include <event.hpp>
|
|
# endif
|
|
# if !defined(VCHAIN_HPP)
|
|
# include <vchain.hpp>
|
|
# endif
|
|
# if !defined(L4AUDHDW_HPP)
|
|
# include <l4audhdw.hpp>
|
|
# endif
|
|
|
|
//##########################################################################
|
|
//######################## AudioRenderer #############################
|
|
//##########################################################################
|
|
|
|
class AudioEvent;
|
|
|
|
class AudioRenderer:
|
|
public Renderer
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction, Destruction, Testing
|
|
//
|
|
public:
|
|
AudioRenderer(RendererRate render_rate);
|
|
~AudioRenderer();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Renderer Interface
|
|
//
|
|
public:
|
|
virtual void
|
|
Initialize();
|
|
|
|
void
|
|
LinkToEntity(Entity *entity);
|
|
|
|
AudioHead*
|
|
GetAudioHead();
|
|
|
|
AudioFrameCount
|
|
GetAudioFrameCount();
|
|
|
|
|
|
void
|
|
PostAudioRequestMessage(
|
|
AudioSource *audio_source,
|
|
AudioSource::RequestMessage *message
|
|
);
|
|
Logical
|
|
ProcessAudioRequestMessage();
|
|
void
|
|
FlushAudioMessages(AudioSource *audio_source);
|
|
|
|
Logical
|
|
ExecuteBackground();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Implementations
|
|
//
|
|
protected:
|
|
void
|
|
ExecuteImplementation(
|
|
RendererComplexity complexity_update,
|
|
RendererOrigin::InterestingEntityIterator *iterator
|
|
);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Private Methods
|
|
//
|
|
private:
|
|
virtual AudioHead*
|
|
MakeAudioHead();
|
|
|
|
void
|
|
StartEntityEffectImplementation(
|
|
Entity *entity,
|
|
DamageZone *damage_zone,
|
|
ResourceDescription::ResourceID resource_ID
|
|
);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Private data
|
|
//
|
|
private:
|
|
typedef VChainOf<AudioEvent*, AudioWeighting>
|
|
AudioEventSocket;
|
|
typedef VChainIteratorOf<AudioEvent*, AudioWeighting>
|
|
AudioEventIterator;
|
|
|
|
AudioHead
|
|
*audioHead;
|
|
AudioEventSocket
|
|
audioEventSocket;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Audio Renderer Statistics
|
|
//
|
|
#ifdef LAB_ONLY
|
|
public:
|
|
int
|
|
sourceClippedCount;
|
|
int
|
|
sourceStartCount;
|
|
int
|
|
sourceSuspendCount;
|
|
int
|
|
sourceResumeCount;
|
|
int
|
|
doubleTriggerCount;
|
|
int
|
|
resourceStealCount;
|
|
int
|
|
resourceStealPriorityCount;
|
|
int
|
|
resourceStealVolumeCount;
|
|
int
|
|
stealShortDurationCount;
|
|
#endif
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~ AudioRenderer inlines ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
inline AudioHead*
|
|
AudioRenderer::GetAudioHead()
|
|
{
|
|
Check(audioHead);
|
|
return audioHead;
|
|
}
|
|
|
|
inline AudioFrameCount
|
|
AudioRenderer::GetAudioFrameCount()
|
|
{
|
|
Check(audioHead);
|
|
return audioHead->GetAudioFrameCount();
|
|
}
|
|
|
|
inline Logical
|
|
AudioRenderer::ExecuteBackground()
|
|
{
|
|
Check(this);
|
|
return ProcessAudioRequestMessage();
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~ AudioRenderer profile macros ~~~~~~~~~~~~~~~~~~~~
|
|
|
|
#if defined(TRACE_AUDIO_RENDERER)
|
|
extern BitTrace Audio_Renderer;
|
|
#define SET_AUDIO_RENDERER() Audio_Renderer.Set()
|
|
#define CLEAR_AUDIO_RENDERER() Audio_Renderer.Clear()
|
|
#else
|
|
#define SET_AUDIO_RENDERER()
|
|
#define CLEAR_AUDIO_RENDERER()
|
|
#endif
|
|
|
|
#if defined(TRACE_AUDIO_RENDERER_CREATE_OBJECTS)
|
|
extern BitTrace Audio_Renderer_Create_Objects;
|
|
#define SET_AUDIO_RENDERER_CREATE_OBJECTS() Audio_Renderer_Create_Objects.Set()
|
|
#define CLEAR_AUDIO_RENDERER_CREATE_OBJECTS() Audio_Renderer_Create_Objects.Clear()
|
|
#else
|
|
#define SET_AUDIO_RENDERER_CREATE_OBJECTS()
|
|
#define CLEAR_AUDIO_RENDERER_CREATE_OBJECTS()
|
|
#endif
|
|
|
|
#if defined(TRACE_AUDIO_RENDERER_DESTROY_OBJECTS)
|
|
extern BitTrace Audio_Renderer_Destroy_Objects;
|
|
#define SET_AUDIO_RENDERER_DESTROY_OBJECTS() Audio_Renderer_Destroy_Objects.Set()
|
|
#define CLEAR_AUDIO_RENDERER_DESTROY_OBJECTS() Audio_Renderer_Destroy_Objects.Clear()
|
|
#else
|
|
#define SET_AUDIO_RENDERER_DESTROY_OBJECTS()
|
|
#define CLEAR_AUDIO_RENDERER_DESTROY_OBJECTS()
|
|
#endif
|
|
|
|
#if defined(TRACE_AUDIO_RENDERER_START_HANDLER)
|
|
extern BitTrace Audio_Renderer_Start_Handler;
|
|
#define SET_AUDIO_RENDERER_START_HANDLER() Audio_Renderer_Start_Handler.Set()
|
|
#define CLEAR_AUDIO_RENDERER_START_HANDLER() Audio_Renderer_Start_Handler.Clear()
|
|
#else
|
|
#define SET_AUDIO_RENDERER_START_HANDLER()
|
|
#define CLEAR_AUDIO_RENDERER_START_HANDLER()
|
|
#endif
|
|
|
|
#if defined(TRACE_AUDIO_RENDERER_STOP_HANDLER)
|
|
extern BitTrace Audio_Renderer_Stop_Handler;
|
|
#define SET_AUDIO_RENDERER_STOP_HANDLER() Audio_Renderer_Stop_Handler.Set()
|
|
#define CLEAR_AUDIO_RENDERER_STOP_HANDLER() Audio_Renderer_Stop_Handler.Clear()
|
|
#else
|
|
#define SET_AUDIO_RENDERER_STOP_HANDLER()
|
|
#define CLEAR_AUDIO_RENDERER_STOP_HANDLER()
|
|
#endif
|
|
|
|
#if defined(TRACE_AUDIO_RENDERER_EXECUTE)
|
|
extern BitTrace Audio_Renderer_Execute;
|
|
#define SET_AUDIO_RENDERER_EXECUTE() Audio_Renderer_Execute.Set()
|
|
#define CLEAR_AUDIO_RENDERER_EXECUTE() Audio_Renderer_Execute.Clear()
|
|
#else
|
|
#define SET_AUDIO_RENDERER_EXECUTE()
|
|
#define CLEAR_AUDIO_RENDERER_EXECUTE()
|
|
#endif
|
|
|
|
//##########################################################################
|
|
//######################### AudioEvent ###############################
|
|
//##########################################################################
|
|
|
|
#define AUDIOEVENT_MEMORYBLOCK_ALLOCATION (20)
|
|
|
|
class AudioEvent:
|
|
public Node
|
|
{
|
|
friend class AudioRenderer;
|
|
|
|
private:
|
|
AudioEvent(
|
|
AudioSource *target,
|
|
AudioSource::RequestMessage *message
|
|
);
|
|
~AudioEvent();
|
|
|
|
static MemoryBlock AllocatedMemory;
|
|
|
|
void* operator new(size_t) { return AllocatedMemory.New(); }
|
|
void operator delete(void *where) { AllocatedMemory.Delete(where); }
|
|
|
|
void
|
|
Process();
|
|
|
|
void
|
|
ReleaseLinkHandler(
|
|
Socket *socket,
|
|
Plug *plug
|
|
);
|
|
|
|
AudioSource::RequestMessage
|
|
*messageToSend;
|
|
SlotOf<AudioSource*>
|
|
targetReceiver;
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~ AudioEvent inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
inline void
|
|
AudioEvent::Process()
|
|
{
|
|
Check(targetReceiver.GetCurrent());
|
|
targetReceiver.GetCurrent()->Receive(messageToSend);
|
|
Unregister_Object(this);
|
|
delete this;
|
|
}
|
|
|
|
#endif
|