Files
RP412/MUNGA/DEBUGOFF.h
T
CydandClaude Opus 5 ae23c040ce Mission review gets far enough to load the race
Starting the MR port, since the pods want it too. Four changes, and one
correction of my own making.

A release Fail now says what failed. It expanded to a bare abort() that
threw the message away, and because the compiler merges identical cold
paths, every Fail in a function became one anonymous stub - a crash named
the function and nothing else. It now prints message, file and line.

It also writes that line to rpl4-fail.log and closes the file. rpl4.log is
std::cout with an ofstream's streambuf swapped in, and the text written
there did NOT survive the exit however it was flushed; rather than guess
where it stopped, the one line that matters goes to its own file, and
fclose is a promise it reached the disk. Its own file because rpl4.log is
already open for writing and Windows will not share it.

-pb plays a spool back without recording a new one. Mode 2 has been in
RPL4.CPP all along - one spool file instead of two, no spooling
application - with no way to ask for it. -mr starts a recorder alongside
the playback and that recorder is the half that cannot cope away from a
pod bay.

Which is the third fix: L4SpoolingNetworkManager::StartConnecting walks
the hosts named in the egg, and called host->GetHostID() on whatever
FindHost returned. FindHost answers NULL for a host that is in the egg but
not connected - impossible in an arcade, ordinary everywhere else - and it
crashed before the mission could start. The table is read back one pair
per egg host in egg order, so a missing host cannot be skipped without
shifting every entry after it; it writes the pair, says so, and carries on.

And RPL4.CPP chose between the playback application and an idle one in
silence. For the first few seconds those look identical from outside, so a
spool that failed to load was indistinguishable from one that had not
started yet. It now says which, and why not.

The correction: I reported a failure in L4AudioRenderer::Initialize on
audiomr.ini's clipping_radius. That was mine. I was running cdb from the
source tree, so the game looked for audio\audiomr.ini beside the debugger
rather than beside itself and found nothing. With the working directory
right, audio initialises fine and always did.

Where it stands: -pb loads last.spl - "2973012 bytes to play" - creates
RPL4PlaybackApplication and runs without crashing. Whether it puts the
race on the screen is the next thing to look at, and that wants eyes
rather than a log.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 13:15:20 -05:00

80 lines
2.2 KiB
C

#pragma once
#include <stdio.h>
#if !defined(OLD_DEBUG_LEVEL)
#define OLD_DEBUG_LEVEL 0
#else
#undef OLD_DEBUG_LEVEL
#if DEBUG_LEVEL>=3
#define OLD_DEBUG_LEVEL 3
#elif DEBUG_LEVEL==2
#define OLD_DEBUG_LEVEL 2
#elif DEBUG_LEVEL==1
#define OLD_DEBUG_LEVEL 1
#endif
#endif
#undef DEBUG_LEVEL
#undef Verify
#undef Verify_And_Dump
#undef Warn
#undef Warn_And_Dump
#undef Dump
#undef Tell
#undef Check_Signature
#undef Check_Pointer
#undef Mem_Copy
#undef Str_Copy
#undef Str_Cat
#undef Check
#undef Check_Fpu
#undef Fail
#undef Cast_Object
#undef DEBUG_CODE
#undef Sqrt
#undef Arctan
#undef Arccos
#undef Arcsin
#define DEBUG_LEVEL 0
#define DEBUG_CODE(x)
#define Verify(c)
#define Verify_And_Dump(c,v)
#define Warn(c)
#define Warn_And_Dump(c,v)
#define Dump(v)
#define Tell(m)
#define Check_Pointer(p)
#define Check_Fpu()
#define Mem_Copy(destination, source, length, available) memcpy(destination, source, length)
#define Str_Copy(destination, source, available) strcpy(destination, source);
#define Str_Cat(destination, source, available) strcat(destination, source);
#define Sqrt(value) sqrt(value)
#define Arctan(y,x) atan2(y,x)
#define Arccos(x) acos(x)
#define Arcsin(x) asin(x)
#define Power(x,y) pow(x,y)
#define Check(p)
#define Check_Signature(p)
//
// A release build used to answer Fail("clipping_radius not defined") with a
// bare abort(), throwing the message away - and because the compiler merges
// identical cold paths, every Fail in a function became the same anonymous
// stub. A crash then told you the function and nothing else, which cost an
// afternoon of disassembly to learn that a mission review build stops in
// L4AudioRenderer::Initialize without ever saying which of its nine checks
// was the one that tripped.
//
// The debug build has always routed this to a function that prints the
// message with its file and line. Release now does too. The termination is
// unchanged - still abort(), still exit code 0xC0000409 - so nothing
// downstream sees anything different; it just says what happened on the way
// out.
//
extern void Fail_With_Message(const char *message, const char *file, int line);
#define Fail(m) Fail_With_Message(m, __FILE__, __LINE__)
#define Cast_Object(type, ptr) ((type)(ptr))