Major overhaul of DebugPrint

This commit is contained in:
2023-09-04 03:21:23 -04:00
parent 57ea8d8574
commit e3c20b3f1e
6 changed files with 262 additions and 53 deletions

View File

@@ -7,6 +7,8 @@
#include <string>
#include <string_view>
using namespace DebugPrint;
AIntegrationGameModeBase::AIntegrationGameModeBase()
{
Thread = nullptr;
@@ -19,6 +21,7 @@ AIntegrationGameModeBase::AIntegrationGameModeBase()
//PrimaryActorTick.TickGroup = TG_PrePhysics; // Probably wrong
SetActorTickEnabled(true);
SetActorTickInterval(0.0f);
DebugPrintControl::EnableCollection();
}
AIntegrationGameModeBase::~AIntegrationGameModeBase()
@@ -33,11 +36,11 @@ uint32 AIntegrationGameModeBase::Run()
{
bool triggered = ThreadEvent->Wait(3000);
if (ThreadStopRequested) {
engineutil::DPrint("Thread stopping as requested");
DPrint("Thread stopping as requested");
break;
}
if (!triggered) {
engineutil::DPrint("Thread waiting a long time...");
DPrint("Thread waiting a long time...");
continue;
}
{
@@ -111,7 +114,7 @@ void AIntegrationGameModeBase::Tick(float DeltaSeconds)
HandleLuprexConsoleOutput(lockedwrap);
}
}
TArray<FString> prints = engineutil::DPrintGetStored();
TArray<FString> prints = DebugPrintControl::GetStored();
for (const FString& fs : prints) {
ConsoleOutput.AppendLine(fs);
}
@@ -168,7 +171,7 @@ void AIntegrationGameModeBase::BeginPlay()
// If we failed to initialize the wrapper, print an error message.
if (w->play_initialize == nullptr)
{
engineutil::DPrint("Luprex wrapper initialization failed");
DPrint("Luprex wrapper initialization failed");
}
// If wrapper is initialized, try to initialize the luprex engine.
@@ -178,7 +181,7 @@ void AIntegrationGameModeBase::BeginPlay()
std::string srcpakerr = drvutil::package_lua_source("c:\\Luprex", &srcpak);
if (!srcpakerr.empty())
{
engineutil::DPrint(srcpakerr.c_str());
DPrint(srcpakerr.c_str());
}
std::string_view srcpakv = srcpak.view();
char* argv[1];
@@ -186,11 +189,11 @@ void AIntegrationGameModeBase::BeginPlay()
w->play_initialize(w.Get(), 1, argv, srcpakv.size(), srcpakv.data(), "");
if (w->error[0])
{
engineutil::DPrint(w->error);
DPrint(w->error);
}
else
{
engineutil::DPrint("Luprex initialize success");
DPrint("Luprex initialize success");
}
}