diff --git a/MUNGA/APP.cpp b/MUNGA/APP.cpp index 93bd652..d8ed7e8 100644 --- a/MUNGA/APP.cpp +++ b/MUNGA/APP.cpp @@ -34,6 +34,23 @@ Application *application = NULL; int Exit_Code = 0; Logical Application::suppressGauges = False; +// +// RP412CAMLOG - see app.h. Cached: the waiting trace asks once a second +// for as long as a station sits unlaunched. +// +Logical + RPCameraLog() +{ + static int enabled = -1; + + if (enabled < 0) + { + const char *setting = getenv("RP412CAMLOG"); + enabled = (setting != NULL && atoi(setting) != 0) ? 1 : 0; + } + return enabled ? True : False; +} + //############################################################################# //########################### Application ############################### //############################################################################# @@ -1340,7 +1357,15 @@ void InterestManager *interest_mgr = GetInterestManager(); Check(interest_mgr); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: player data set - loading interest arenas\n" << std::flush; + } interest_mgr->LoadInterestArenas(currentMission); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: interest arenas loaded - mission created\n" << std::flush; + } } // @@ -1376,7 +1401,16 @@ void trace_manager.StartTimingAnalysis(); #endif Check(interestManager); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: LoadMission handler - loading interest manager\n" << std::flush; + } interestManager->LoadMission(currentMission); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: interest manager loaded - about to make the player\n" + << std::flush; + } // //-------------------------------------------------------------------------- @@ -1546,6 +1580,13 @@ void case CreatingMission: case LoadingMission: case WaitingForLaunch: + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: CheckLoad state=" << (int) applicationState.GetState() + << " minPriorityQueueEmpty=" + << (int) (eventQueue->IsPriorityEmpty(MinEventPriority) ? 1 : 0) + << "\n" << std::flush; + } if (eventQueue->IsPriorityEmpty(MinEventPriority)) { Host *console_host; @@ -1598,6 +1639,11 @@ void RunMissionMessage run_mission_message; Post(DefaultEventPriority, this, &run_mission_message); Tell("Sent ready message to ourselves\n"); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: no console - posted RunMission to ourselves\n" + << std::flush; + } } } diff --git a/MUNGA/APP.h b/MUNGA/APP.h index 0ea47d4..0114086 100644 --- a/MUNGA/APP.h +++ b/MUNGA/APP.h @@ -56,6 +56,20 @@ class GeneralEventQueue; class Entity__MakeMessage; class ResourceFile; +//########################################################################## +//######################### Live Cam tracing ############################# +//########################################################################## +// +// RP412CAMLOG=1 traces the camera-station bring-up: the registry choosing +// a director, the director creating its camera ship, and the launch +// handshake it waits on. The Live Cam path is selected purely by egg data +// (hostType=1 plus vehicle=camera), so when it does not come up there is +// nothing in the log to say how far it got - which is exactly the hole +// this fills. Off by default; it prints once per second while waiting. +// +Logical + RPCameraLog(); + //########################################################################## //######################### Application ############################## //########################################################################## diff --git a/MUNGA/PLAYER.cpp b/MUNGA/PLAYER.cpp index 73bf11a..a460ab6 100644 --- a/MUNGA/PLAYER.cpp +++ b/MUNGA/PLAYER.cpp @@ -172,6 +172,11 @@ void // Create any MUNGA level vehicles //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: CreatePlayerVehicle, cameraShipPlayer=" + << (int) (IsCameraShipPlayer() ? 1 : 0) << "\n" << std::flush; + } if (IsCameraShipPlayer()) { Check(application); @@ -186,6 +191,11 @@ void playerMission->GetGameModel(), ResourceDescription::ModelListResourceType ); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: model '" << playerMission->GetGameModel() + << "' resource " << (camera_res ? "FOUND" : "MISSING") << "\n" << std::flush; + } Check(camera_res); CameraShip::MakeMessage create_camera( diff --git a/MUNGA_L4/L4NET.CPP b/MUNGA_L4/L4NET.CPP index 996cf4c..d25637c 100644 --- a/MUNGA_L4/L4NET.CPP +++ b/MUNGA_L4/L4NET.CPP @@ -447,6 +447,14 @@ void Check(application->GetHostManager()); application->GetHostManager()->AdoptLocalHost(my_l4host); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: stand-alone local host '" + << (const char *) mission_host_data->GetAddressString() + << "' hostType=" << (int) mission_host_data->GetHostType() + << " - posting LoadMission\n" << std::flush; + } + // //-------------------------------------------------------------------- // Now, since this host creator is for stand-alone mode, send the load diff --git a/RP/RPDIRECT.cpp b/RP/RPDIRECT.cpp index 1dab1ea..9c0d1b0 100644 --- a/RP/RPDIRECT.cpp +++ b/RP/RPDIRECT.cpp @@ -147,8 +147,17 @@ void { Check(this); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: CreateRPCameraShip - making the camera ship\n" + << std::flush; + } CameraDirector::CreateCameraShip(time_slice); SetPerformance(&RPCameraDirector::BeARPDirector); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: camera ship up, now directing\n" << std::flush; + } } //############################################################################# @@ -172,6 +181,13 @@ RPCameraDirector::RPCameraDirector( { SetPerformance(&RPCameraDirector::CreateRPCameraShip); } + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: RPCameraDirector built, football=" + << (int) (martianFootball ? 1 : 0) + << " replicant=" << (int) (GetInstance() == ReplicantInstance ? 1 : 0) + << "\n" << std::flush; + } } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/RP/RPREG.cpp b/RP/RPREG.cpp index 1feb678..779812a 100644 --- a/RP/RPREG.cpp +++ b/RP/RPREG.cpp @@ -5,6 +5,7 @@ #include "rpmssn.h" #include "rpplayer.h" #include "rpdirect.h" +#include "..\munga\app.h" // RPCameraLog #include "crusher.h" #include "runner.h" #include "blocker.h" @@ -170,6 +171,11 @@ Player* else { + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: registry making an RPCameraDirector (game model '" + << mission->GetGameModel() << "')\n" << std::flush; + } RPCameraDirector::MakeMessage create_director( RPCameraDirector::MakeMessageID, sizeof(RPCameraDirector::MakeMessage), diff --git a/RP_L4/RPL4ENVIRON.cpp b/RP_L4/RPL4ENVIRON.cpp index 9e5ea08..09f8d14 100644 --- a/RP_L4/RPL4ENVIRON.cpp +++ b/RP_L4/RPL4ENVIRON.cpp @@ -428,6 +428,14 @@ namespace "# 0 or unset = off. (Alt+Q, the mission abort, is always live.)\n" "#RP412DEVKEYS=1\n" "\n" +"# Nonzero traces the Live Cam bring-up: the egg's host type and game\n" +"# model, the registry choosing a camera director, the director making\n" +"# its camera ship, and the launch handshake. A camera station is picked\n" +"# purely by egg data (hostType=1 and vehicle=camera on that host's\n" +"# entry), so without this there is nothing in the log to say how far it\n" +"# got. Prints once a second while a station sits unlaunched.\n" +"#RP412CAMLOG=1\n" +"\n" "# Console race-length override, integer seconds (short test races).\n" "# Values <= 0 are ignored.\n" "#L4CONSOLELEN=30\n" diff --git a/RP_L4/RPL4MSSN.cpp b/RP_L4/RPL4MSSN.cpp index 5834e88..2074ed2 100644 --- a/RP_L4/RPL4MSSN.cpp +++ b/RP_L4/RPL4MSSN.cpp @@ -74,6 +74,12 @@ void gameModel = strdup(player_model); Register_Pointer(gameModel); + if (RPCameraLog()) + { + DEBUG_STREAM << "CamLog: local player node '" << (const char *) player_node + << "' gameModel '" << gameModel << "'\n" << std::flush; + } + dropZoneName = NULL; const char* drop_zone = NULL; notation_file->GetEntry(player_node, "dropzone", &drop_zone);