Change some class naming conventions

This commit is contained in:
2023-09-15 13:28:18 -04:00
parent 40881ec284
commit cd3c82f2c4
20 changed files with 160 additions and 157 deletions

Binary file not shown.

Binary file not shown.

BIN
Content/TangibleActor.uasset LFS Normal file

Binary file not shown.

View File

@@ -1,18 +1,18 @@
#include "AnimQueue.h" #include "AnimQueue.h"
FAnimStep FAnimQueueDecoder::ReadStep() { FlxAnimStep FlxAnimQueueDecoder::ReadStep() {
FAnimStep result; FlxAnimStep result;
result.Hash = Decoder.read_uint64(); result.Hash = Decoder.read_uint64();
result.Body = Decoder.read_string_view(); result.Body = Decoder.read_string_view();
return result; return result;
} }
FAnimField FAnimStepDecoder::ReadField() { FlxAnimField FlxAnimStepDecoder::ReadField() {
FAnimField result; FlxAnimField result;
result.Name = Decoder.read_string_view(); result.Name = Decoder.read_string_view();
result.Persistent = Decoder.read_bool(); result.Persistent = Decoder.read_bool();
result.Type = (EAnimValueType)Decoder.read_uint8(); result.Type = (ElxAnimValueType)Decoder.read_uint8();
switch (result.Type) { switch (result.Type) {
case T_STRING: { case T_STRING: {
result.S = Decoder.read_string_view(); result.S = Decoder.read_string_view();
@@ -42,39 +42,39 @@ FAnimField FAnimStepDecoder::ReadField() {
return result; return result;
} }
FString FAnimQueueDecoder::DebugString(std::string_view queue) { FString FlxAnimQueueDecoder::DebugString(std::string_view queue) {
FString result; FString result;
FAnimQueueDecoder decoder(queue); FlxAnimQueueDecoder decoder(queue);
while (!decoder.AtEOF()) { while (!decoder.AtEOF()) {
FAnimStep step = decoder.ReadStep(); FlxAnimStep step = decoder.ReadStep();
FString stepdebug = FAnimStepDecoder::DebugString(step); FString stepdebug = FlxAnimStepDecoder::DebugString(step);
result.Appendf(TEXT("%s\n"), *stepdebug); result.Appendf(TEXT("%s\n"), *stepdebug);
} }
return result; return result;
} }
FString FAnimStepDecoder::DebugString(const FAnimStep& step) { FString FlxAnimStepDecoder::DebugString(const FlxAnimStep& step) {
FString result; FString result;
FAnimStepDecoder decoder(step); FlxAnimStepDecoder decoder(step);
bool first = true; bool first = true;
while (!decoder.AtEOF()) { while (!decoder.AtEOF()) {
FAnimField field = decoder.ReadField(); FlxAnimField field = decoder.ReadField();
if (!first) { if (!first) {
result.Append(TEXT(" ")); result.Append(TEXT(" "));
} }
result.Append(FString(field.Name.size(), (const UTF8CHAR*)field.Name.data())); result.Append(FString(field.Name.size(), (const UTF8CHAR*)field.Name.data()));
result.Append(field.Persistent ? TEXT("=") : TEXT(":")); result.Append(field.Persistent ? TEXT("=") : TEXT(":"));
switch (field.Type) { switch (field.Type) {
case EAnimValueType::T_STRING: case ElxAnimValueType::T_STRING:
result.Append(FString(field.S.size(), (const UTF8CHAR*)field.S.data())); result.Append(FString(field.S.size(), (const UTF8CHAR*)field.S.data()));
break; break;
case EAnimValueType::T_NUMBER: case ElxAnimValueType::T_NUMBER:
result.Appendf(TEXT("%lf"), field.X); result.Appendf(TEXT("%lf"), field.X);
break; break;
case EAnimValueType::T_BOOLEAN: case ElxAnimValueType::T_BOOLEAN:
result.Append((field.X) == 1.0 ? TEXT("true") : TEXT("false")); result.Append((field.X) == 1.0 ? TEXT("true") : TEXT("false"));
break; break;
case EAnimValueType::T_XYZ: case ElxAnimValueType::T_XYZ:
result.Appendf(TEXT("%lf,%lf,%lf"), field.X, field.Y, field.Z); result.Appendf(TEXT("%lf,%lf,%lf"), field.X, field.Y, field.Z);
break; break;
} }
@@ -88,7 +88,7 @@ FString FAnimStepDecoder::DebugString(const FAnimStep& step) {
//// store the hashes, not the steps. The First element //// store the hashes, not the steps. The First element
//// of the queue is the oldest item. //// of the queue is the oldest item.
//// ////
//TDeque<FAnimStoredStep> AQ; //TDeque<FlxAnimStoredStep> AQ;
//// The sequence number of the first item in AQ. //// The sequence number of the first item in AQ.
//// ////
@@ -106,7 +106,7 @@ FString FAnimStepDecoder::DebugString(const FAnimStep& step) {
//TArray<uint64> AbortedHashes; //TArray<uint64> AbortedHashes;
FAnimTracker::FAnimTracker() { FlxAnimTracker::FlxAnimTracker() {
AQ.Empty(); AQ.Empty();
FirstSeqno = 0; FirstSeqno = 0;
HashToSeqno.Empty(); HashToSeqno.Empty();
@@ -114,7 +114,7 @@ FAnimTracker::FAnimTracker() {
AbortedHashes.Empty(); AbortedHashes.Empty();
} }
void FAnimTracker::Update(std::string_view encqueue) { void FlxAnimTracker::Update(std::string_view encqueue) {
// Check for an exact match. If the most recent entry // Check for an exact match. If the most recent entry
// in encqueue has the same hash as the most recent // in encqueue has the same hash as the most recent
// entry in AQ, then that's an exact match. Or, // entry in AQ, then that's an exact match. Or,
@@ -128,7 +128,7 @@ void FAnimTracker::Update(std::string_view encqueue) {
} }
} else { } else {
if (!AQ.IsEmpty()) { if (!AQ.IsEmpty()) {
FStringDecoder qdecoder(encqueue); FlxStringDecoder qdecoder(encqueue);
uint64 hash = qdecoder.read_uint64(); uint64 hash = qdecoder.read_uint64();
if (hash == AQ.Last().Hash) { if (hash == AQ.Last().Hash) {
return; return;
@@ -143,11 +143,11 @@ void FAnimTracker::Update(std::string_view encqueue) {
// At the same time, push all non-matching records // At the same time, push all non-matching records
// after the matching record onto a stack of new records. // after the matching record onto a stack of new records.
// //
FAnimQueueDecoder decoder(encqueue); FlxAnimQueueDecoder decoder(encqueue);
TArray<FAnimStep> newsteps; TArray<FlxAnimStep> newsteps;
int32 matchingseqno = -1; int32 matchingseqno = -1;
while (!decoder.AtEOF()) { while (!decoder.AtEOF()) {
FAnimStep step = decoder.ReadStep(); FlxAnimStep step = decoder.ReadStep();
int32* stepseq = HashToSeqno.Find(step.Hash); int32* stepseq = HashToSeqno.Find(step.Hash);
if (stepseq == nullptr) { if (stepseq == nullptr) {
newsteps.Emplace(step); newsteps.Emplace(step);
@@ -172,7 +172,7 @@ void FAnimTracker::Update(std::string_view encqueue) {
// Transfer the new animations onto the queue. // Transfer the new animations onto the queue.
// //
while (!newsteps.IsEmpty()) { while (!newsteps.IsEmpty()) {
FAnimStep step = newsteps.Pop(); FlxAnimStep step = newsteps.Pop();
int32 seqno = FirstSeqno + AQ.Num(); int32 seqno = FirstSeqno + AQ.Num();
AQ.EmplaceLast(step.Hash, step.Body); AQ.EmplaceLast(step.Hash, step.Body);
HashToSeqno.Emplace(step.Hash, seqno); HashToSeqno.Emplace(step.Hash, seqno);
@@ -202,25 +202,25 @@ void FAnimTracker::Update(std::string_view encqueue) {
} }
} }
TArray<uint64> FAnimTracker::GetAborted() { TArray<uint64> FlxAnimTracker::GetAborted() {
TArray<uint64> result; TArray<uint64> result;
result = std::move(AbortedHashes); result = std::move(AbortedHashes);
AbortedHashes.Empty(); AbortedHashes.Empty();
return result; return result;
} }
bool FAnimTracker::AnyUnstarted() { bool FlxAnimTracker::AnyUnstarted() {
int offset = UnstartedSeqno - FirstSeqno; int offset = UnstartedSeqno - FirstSeqno;
return (offset < AQ.Num()); return (offset < AQ.Num());
} }
FAnimStoredStep FAnimTracker::GetUnstarted() { FlxAnimStoredStep FlxAnimTracker::GetUnstarted() {
int offset = UnstartedSeqno - FirstSeqno; int offset = UnstartedSeqno - FirstSeqno;
check(offset < AQ.Num()); check(offset < AQ.Num());
return AQ[offset]; return AQ[offset];
} }
void FAnimTracker::Started(uint64 hash) { void FlxAnimTracker::Started(uint64 hash) {
int offset = UnstartedSeqno - FirstSeqno; int offset = UnstartedSeqno - FirstSeqno;
check(offset < AQ.Num()); check(offset < AQ.Num());
check(AQ[offset].Hash == hash); check(AQ[offset].Hash == hash);

View File

@@ -10,7 +10,7 @@
// //
//////////////////////////////////////////////// ////////////////////////////////////////////////
enum EAnimValueType { enum ElxAnimValueType {
T_STRING, T_STRING,
T_NUMBER, T_NUMBER,
T_BOOLEAN, T_BOOLEAN,
@@ -22,28 +22,28 @@ enum EAnimValueType {
// //
// An single animation step. // An single animation step.
// //
// The body consists of a sequence of FAnimField // The body consists of a sequence of FlxAnimField
// records. The body is encoded, to read the // records. The body is encoded, to read the
// FAnimField records you need an FAnimStepDecoder. // FlxAnimField records you need an FlxAnimStepDecoder.
// This comes in two versions: the string version, // This comes in two versions: the string version,
// and the string_view version. // and the string_view version.
// //
//////////////////////////////////////////////// ////////////////////////////////////////////////
struct FAnimStep { struct FlxAnimStep {
uint64 Hash; uint64 Hash;
std::string_view Body; std::string_view Body;
FAnimStep() : Hash(0), Body("") {} FlxAnimStep() : Hash(0), Body("") {}
FAnimStep(uint64 h, std::string_view b) : Hash(h), Body(b) {} FlxAnimStep(uint64 h, std::string_view b) : Hash(h), Body(b) {}
}; };
struct FAnimStoredStep { struct FlxAnimStoredStep {
uint64 Hash; uint64 Hash;
std::string Body; std::string Body;
FAnimStoredStep() : Hash(0), Body("") {} FlxAnimStoredStep() : Hash(0), Body("") {}
FAnimStoredStep(uint64 h, std::string_view b) : Hash(h), Body(b) {} FlxAnimStoredStep(uint64 h, std::string_view b) : Hash(h), Body(b) {}
}; };
//////////////////////////////////////////////// ////////////////////////////////////////////////
@@ -60,10 +60,10 @@ struct FAnimStoredStep {
// //
//////////////////////////////////////////////// ////////////////////////////////////////////////
struct FAnimField { struct FlxAnimField {
std::string_view Name; std::string_view Name;
bool Persistent; bool Persistent;
EAnimValueType Type; ElxAnimValueType Type;
double X, Y, Z; double X, Y, Z;
std::string_view S; std::string_view S;
}; };
@@ -79,14 +79,14 @@ struct FAnimField {
// //
//////////////////////////////////////////////// ////////////////////////////////////////////////
class FAnimQueueDecoder { class FlxAnimQueueDecoder {
private: private:
FStringDecoder Decoder; FlxStringDecoder Decoder;
public: public:
// Initialize the FAnimQueueDecoder with the encoded animation queue. // Initialize the FlxAnimQueueDecoder with the encoded animation queue.
// //
FAnimQueueDecoder(std::string_view s) : Decoder(s) {} FlxAnimQueueDecoder(std::string_view s) : Decoder(s) {}
// Return true if the parser has reached the end of the string. // Return true if the parser has reached the end of the string.
// //
@@ -94,7 +94,7 @@ public:
// Read one animation step. // Read one animation step.
// //
FAnimStep ReadStep(); FlxAnimStep ReadStep();
// Convert an AnimQueue to an FString. // Convert an AnimQueue to an FString.
// //
@@ -106,21 +106,21 @@ public:
// An Animation Step Decoder. // An Animation Step Decoder.
// //
// This acts a lot like a stream reader, // This acts a lot like a stream reader,
// it reads one FAnimField at a time from // it reads one FlxAnimField at a time from
// the animation queue until you reach // the animation queue until you reach
// 'end-of-file'. // 'end-of-file'.
// //
//////////////////////////////////////////////// ////////////////////////////////////////////////
class FAnimStepDecoder { class FlxAnimStepDecoder {
private: private:
FStringDecoder Decoder; FlxStringDecoder Decoder;
public: public:
// Initialize the FAnimStepDecoder from the FAnimStep. // Initialize the FlxAnimStepDecoder from the FlxAnimStep.
// //
FAnimStepDecoder(const FAnimStep &step) : Decoder(step.Body) {} FlxAnimStepDecoder(const FlxAnimStep &step) : Decoder(step.Body) {}
FAnimStepDecoder(const FAnimStoredStep& step) : Decoder(step.Body) {} FlxAnimStepDecoder(const FlxAnimStoredStep& step) : Decoder(step.Body) {}
// Return true if the parser has reached the end of the string. // Return true if the parser has reached the end of the string.
// //
@@ -128,16 +128,16 @@ public:
// Read one field. // Read one field.
// //
FAnimField ReadField(); FlxAnimField ReadField();
// Convert an AnimStep to an FString. // Convert an AnimStep to an FString.
// //
static FString DebugString(const FAnimStep &step); static FString DebugString(const FlxAnimStep &step);
}; };
//////////////////////////////////////////////// ////////////////////////////////////////////////
// //
// FAnimTracker // FlxAnimTracker
// //
// This class monitors the animation queue for a single // This class monitors the animation queue for a single
// tangible. It can identify when a new animation has // tangible. It can identify when a new animation has
@@ -147,13 +147,13 @@ public:
// //
//////////////////////////////////////////////// ////////////////////////////////////////////////
class FAnimTracker { class FlxAnimTracker {
public: public:
// Our own copy of the animation queue. We only // Our own copy of the animation queue. We only
// store the hashes, not the steps. The First element // store the hashes, not the steps. The First element
// of the queue is the oldest item. // of the queue is the oldest item.
// //
TDeque<FAnimStoredStep> AQ; TDeque<FlxAnimStoredStep> AQ;
// The sequence number of the first item in AQ. // The sequence number of the first item in AQ.
// //
@@ -175,7 +175,7 @@ public:
// //
// Initially, the tracker is in the empty (Clear) state. // Initially, the tracker is in the empty (Clear) state.
// //
FAnimTracker(); FlxAnimTracker();
// Update from the specified animation queue. // Update from the specified animation queue.
// //
@@ -199,7 +199,7 @@ public:
// //
// You may only call this if AnyUnstarted returns true. // You may only call this if AnyUnstarted returns true.
// //
FAnimStoredStep GetUnstarted(); FlxAnimStoredStep GetUnstarted();
// Declare that an animation has been started. // Declare that an animation has been started.
// //

View File

@@ -145,7 +145,7 @@ namespace DebugPrintControl {
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
void FConsoleOutput::Truncate() { void FlxConsoleOutput::Truncate() {
int lines = 50; int lines = 50;
int csize = Content.Len(); int csize = Content.Len();
int total = 0; int total = 0;
@@ -160,7 +160,7 @@ void FConsoleOutput::Truncate() {
} }
} }
bool FConsoleOutput::MaybeAppendNewline() { bool FlxConsoleOutput::MaybeAppendNewline() {
int csize = Content.Len(); int csize = Content.Len();
if ((csize > 0) && (Content[csize - 1] != '\n')) { if ((csize > 0) && (Content[csize - 1] != '\n')) {
Content += TEXT("\n"); Content += TEXT("\n");
@@ -171,7 +171,7 @@ bool FConsoleOutput::MaybeAppendNewline() {
} }
} }
bool FConsoleOutput::MaybeAppendText(const FString& text) { bool FlxConsoleOutput::MaybeAppendText(const FString& text) {
if (!text.IsEmpty()) { if (!text.IsEmpty()) {
Content += text; Content += text;
return true; return true;
@@ -181,7 +181,7 @@ bool FConsoleOutput::MaybeAppendText(const FString& text) {
} }
} }
void FConsoleOutput::Append(const FString& text) { void FlxConsoleOutput::Append(const FString& text) {
bool modified = MaybeAppendText(text); bool modified = MaybeAppendText(text);
if (modified) { if (modified) {
Dirty = true; Dirty = true;
@@ -189,7 +189,7 @@ void FConsoleOutput::Append(const FString& text) {
} }
} }
void FConsoleOutput::AppendLine(const FString& text) { void FlxConsoleOutput::AppendLine(const FString& text) {
bool modified = MaybeAppendNewline(); bool modified = MaybeAppendNewline();
modified |= MaybeAppendText(text); modified |= MaybeAppendText(text);
modified |= MaybeAppendNewline(); modified |= MaybeAppendNewline();

View File

@@ -113,7 +113,7 @@ namespace DebugPrintControl {
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
class FConsoleOutput { class FlxConsoleOutput {
private: private:
FString Content; FString Content;
bool Dirty; bool Dirty;

View File

@@ -36,7 +36,7 @@ AIntegrationGameModeBase::~AIntegrationGameModeBase()
// at the moment we trigger it. // at the moment we trigger it.
// //
uint32 AIntegrationGameModeBase::Run() { uint32 AIntegrationGameModeBase::Run() {
FLockedWrapper lockedwrap(LockableWrapper); FlxLockedWrapper lockedwrap(LockableWrapper);
Sockets->Update(lockedwrap); Sockets->Update(lockedwrap);
lockedwrap->play_invoke_event_update(lockedwrap.Get(), EngineSeconds); lockedwrap->play_invoke_event_update(lockedwrap.Get(), EngineSeconds);
Sockets->Update(lockedwrap); Sockets->Update(lockedwrap);
@@ -52,7 +52,7 @@ void AIntegrationGameModeBase::ResetToInitialState()
// Now that the thread's gone, we should be able to // Now that the thread's gone, we should be able to
// just claim and hold the lock on the wrapper. // just claim and hold the lock on the wrapper.
FLockedWrapper w(LockableWrapper); FlxLockedWrapper w(LockableWrapper);
// Release and close all sockets. // Release and close all sockets.
if (Sockets != nullptr) if (Sockets != nullptr)
@@ -76,7 +76,7 @@ void AIntegrationGameModeBase::ResetToInitialState()
void AIntegrationGameModeBase::UpdateConsoleOutput() { void AIntegrationGameModeBase::UpdateConsoleOutput() {
// Copy Luprex Stdout into the console. // Copy Luprex Stdout into the console.
FLockedWrapper lockedwrap(LockableWrapper); FlxLockedWrapper lockedwrap(LockableWrapper);
if (Playing) { if (Playing) {
ConsoleOutput.Append(lockedwrap.FetchStdout()); ConsoleOutput.Append(lockedwrap.FetchStdout());
} }
@@ -96,7 +96,7 @@ void AIntegrationGameModeBase::UpdateConsoleOutput() {
void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) { void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) {
if (!Playing) return; if (!Playing) return;
FLockedWrapper lockedwrap(LockableWrapper); FlxLockedWrapper lockedwrap(LockableWrapper);
if (EngineSeconds >= NextThreadTrigger) if (EngineSeconds >= NextThreadTrigger)
{ {
LuprexUpdateTask.Trigger(); LuprexUpdateTask.Trigger();
@@ -106,7 +106,7 @@ void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) {
void AIntegrationGameModeBase::UpdateTangibles() { void AIntegrationGameModeBase::UpdateTangibles() {
if (!Playing) return; if (!Playing) return;
FLockedWrapper w(LockableWrapper); FlxLockedWrapper w(LockableWrapper);
int64 actor = w.GetActor(); int64 actor = w.GetActor();
TangibleManager.SetActor(actor); TangibleManager.SetActor(actor);
TangibleManager.SetNear(w.GetNear(actor, 100, 100, 100)); TangibleManager.SetNear(w.GetNear(actor, 100, 100, 100));
@@ -119,18 +119,18 @@ void AIntegrationGameModeBase::UpdateTangibles() {
for (int i = 0; i < tanids.Num(); i++) { for (int i = 0; i < tanids.Num(); i++) {
uint64_t tanid = tanids[i]; uint64_t tanid = tanids[i];
std::string_view aqueue = aqueues[i]; std::string_view aqueue = aqueues[i];
UTangible* t = TangibleManager.GetTangible(tanid); UlxTangible* t = TangibleManager.GetTangible(tanid);
check(t != nullptr); check(t != nullptr);
t->AnimTracker.Update(aqueue); t->AnimTracker.Update(aqueue);
TArray<uint64> aborted = t->AnimTracker.GetAborted(); TArray<uint64> aborted = t->AnimTracker.GetAborted();
for (uint64 hash : aborted) { for (uint64 hash : aborted) {
ITangibleInterface::Execute_AbortAnimation(t->Actor, hash); IlxTangibleInterface::Execute_AbortAnimation(t->Actor, hash);
} }
if (t->AnimTracker.AnyUnstarted()) { if (t->AnimTracker.AnyUnstarted()) {
FAnimStoredStep step = t->AnimTracker.GetUnstarted(); FlxAnimStoredStep step = t->AnimTracker.GetUnstarted();
bool started = ITangibleInterface::Execute_StartAnimation(t->Actor, step.Hash, step.Body.size()); bool started = IlxTangibleInterface::Execute_StartAnimation(t->Actor, step.Hash, step.Body.size());
if (started) { if (started) {
t->AnimTracker.Started(step.Hash); t->AnimTracker.Started(step.Hash);
} }
@@ -140,7 +140,7 @@ void AIntegrationGameModeBase::UpdateTangibles() {
void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs) void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs)
{ {
FLockedWrapper w(LockableWrapper); FlxLockedWrapper w(LockableWrapper);
if (w->engine != nullptr) if (w->engine != nullptr)
{ {
const TCHAR* fstchar = *fs; const TCHAR* fstchar = *fs;
@@ -181,7 +181,7 @@ void AIntegrationGameModeBase::BeginPlay()
// Now we're just going to claim the wrapper // Now we're just going to claim the wrapper
// lock for the remainder. When we create the thread, // lock for the remainder. When we create the thread,
// the thread will hang until we release this lock. // the thread will hang until we release this lock.
FLockedWrapper w(LockableWrapper); FlxLockedWrapper w(LockableWrapper);
// Sanity checks. Make sure everything is clean. // Sanity checks. Make sure everything is clean.
checkf(!LuprexUpdateTask.IsRunning(), TEXT("There should be no thread here.")); checkf(!LuprexUpdateTask.IsRunning(), TEXT("There should be no thread here."));
@@ -221,7 +221,7 @@ void AIntegrationGameModeBase::BeginPlay()
// If we successfully created a luprex engine, create a socket system and a worker thread. // If we successfully created a luprex engine, create a socket system and a worker thread.
if (Playing) { if (Playing) {
Sockets.Reset(FLpxSockets::Create(w)); Sockets.Reset(FlxSockets::Create(w));
std::string error = Sockets->GetError(); std::string error = Sockets->GetError();
check(error.empty()); check(error.empty());
LuprexUpdateTask.Startup(this); LuprexUpdateTask.Startup(this);

View File

@@ -60,17 +60,17 @@ public:
FTangibleManager TangibleManager; FTangibleManager TangibleManager;
// This stores the entire text currently visible in the console. // This stores the entire text currently visible in the console.
FConsoleOutput ConsoleOutput; FlxConsoleOutput ConsoleOutput;
// The Luprex EngineWrapper, with a Mutex to protect it. // The Luprex EngineWrapper, with a Mutex to protect it.
// To access it, construct a FLockedWrapper. // To access it, construct a FlxLockedWrapper.
FLockableWrapper LockableWrapper; FlxLockableWrapper LockableWrapper;
// This utility runs the luprex update and socket update in a thread. // This utility runs the luprex update and socket update in a thread.
FTriggeredTask LuprexUpdateTask; FTriggeredTask LuprexUpdateTask;
// Luprex socket system. Aside from construction, only touched by Luprex thread. // Luprex socket system. Aside from construction, only touched by Luprex thread.
TUniquePtr<FLpxSockets> Sockets; TUniquePtr<FlxSockets> Sockets;
// True if 'BeginPlay' has been successfully completed. // True if 'BeginPlay' has been successfully completed.
// //

View File

@@ -5,7 +5,7 @@
using namespace CommonTypes; using namespace CommonTypes;
void FLockedWrapper::InitWrapper() { void FlxLockedWrapper::InitWrapper() {
if (Lockable.Wrapper.play_initialize != nullptr) { if (Lockable.Wrapper.play_initialize != nullptr) {
// Already initialized. // Already initialized.
return; return;
@@ -21,7 +21,7 @@ void FLockedWrapper::InitWrapper() {
} }
} }
FString FLockedWrapper::FetchStdout() { FString FlxLockedWrapper::FetchStdout() {
uint32_t ndata; const char* data; uint32_t ndata; const char* data;
Lockable.Wrapper.get_outgoing(Get(), 0, &ndata, &data); Lockable.Wrapper.get_outgoing(Get(), 0, &ndata, &data);
@@ -36,18 +36,18 @@ FString FLockedWrapper::FetchStdout() {
return FString(cps.size(), (const UCS2CHAR*)(&cps[0])); return FString(cps.size(), (const UCS2CHAR*)(&cps[0]));
} }
int64 FLockedWrapper::GetActor() { int64 FlxLockedWrapper::GetActor() {
return Lockable.Wrapper.get_actor_id(Get()); return Lockable.Wrapper.get_actor_id(Get());
} }
IdView FLockedWrapper::GetNear(int64 id, double rx, double ry, double rz) { IdView FlxLockedWrapper::GetNear(int64 id, double rx, double ry, double rz) {
uint32 size; uint32 size;
int64* data; int64* data;
Lockable.Wrapper.get_tangibles_near(Get(), id, rx, ry, rz, &size, &data); Lockable.Wrapper.get_tangibles_near(Get(), id, rx, ry, rz, &size, &data);
return IdView(data, size); return IdView(data, size);
} }
StringViewVec FLockedWrapper::GetAnimationQueues(IdView ids) { StringViewVec FlxLockedWrapper::GetAnimationQueues(IdView ids) {
// How many animation queues are we fetching? // How many animation queues are we fetching?
int num = ids.Num(); int num = ids.Num();

View File

@@ -4,14 +4,14 @@
#include "lpx-enginewrapper.hpp" #include "lpx-enginewrapper.hpp"
#include "CommonTypes.h" #include "CommonTypes.h"
// Class FLockableWrapper // Class FlxLockableWrapper
// //
// Contains the EngineWrapper and a Mutex to lock it. // Contains the EngineWrapper and a Mutex to lock it.
// This class has no methods. To access the EngineWrapper, // This class has no methods. To access the EngineWrapper,
// construct a FLockedWrapper, and then dereference it // construct a FlxLockedWrapper, and then dereference it
// using operator right arrow. // using operator right arrow.
// //
class FLockableWrapper { class FlxLockableWrapper {
private: private:
FCriticalSection Mutex; FCriticalSection Mutex;
EngineWrapper Wrapper; EngineWrapper Wrapper;
@@ -24,12 +24,12 @@ private:
TArray<const char*> AQStrBuffer; TArray<const char*> AQStrBuffer;
public: public:
friend class FLockedWrapper; friend class FlxLockedWrapper;
}; };
class FLockedWrapper { class FlxLockedWrapper {
private: private:
FLockableWrapper& Lockable; FlxLockableWrapper& Lockable;
public: public:
// Import these types into our Namespace. // Import these types into our Namespace.
@@ -38,13 +38,13 @@ public:
using StringViewVec = CommonTypes::StringViewVec; using StringViewVec = CommonTypes::StringViewVec;
public: public:
// The constructor of the FLockedWrapper claims the mutex. // The constructor of the FlxLockedWrapper claims the mutex.
FLockedWrapper(FLockableWrapper& w) : Lockable(w) { FlxLockedWrapper(FlxLockableWrapper& w) : Lockable(w) {
Lockable.Mutex.Lock(); Lockable.Mutex.Lock();
} }
// The destructor of the FLockedWrapper releases the mutex. // The destructor of the FlxLockedWrapper releases the mutex.
~FLockedWrapper() { ~FlxLockedWrapper() {
Lockable.Mutex.Unlock(); Lockable.Mutex.Unlock();
} }

View File

@@ -85,7 +85,7 @@ static const char* dummy_key =
"HcKc9a4WXhC7yu79e5BnKWltHXY=\n" "HcKc9a4WXhC7yu79e5BnKWltHXY=\n"
"-----END PRIVATE KEY-----\n"; "-----END PRIVATE KEY-----\n";
class FLpxSocketsI; class FlxSocketsI;
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// //
@@ -96,11 +96,11 @@ class FLpxSocketsI;
class FLpxListener class FLpxListener
{ {
public: public:
FLpxSocketsI *LSI; FlxSocketsI *LSI;
int BoundPort; int BoundPort;
FSocket* Socket; FSocket* Socket;
FLpxListener(FLpxSocketsI *lsi, int bp, FSocket* sock); FLpxListener(FlxSocketsI *lsi, int bp, FSocket* sock);
~FLpxListener(); ~FLpxListener();
void AcceptConnection(); void AcceptConnection();
@@ -122,7 +122,7 @@ enum EChanState {
class FLpxChannel class FLpxChannel
{ {
public: public:
FLpxSocketsI* LSI; FlxSocketsI* LSI;
EChanState State; EChanState State;
int ChannelID; int ChannelID;
FSocket* Socket; FSocket* Socket;
@@ -172,7 +172,7 @@ public:
// buffer, that's inexplicable and therefore serious. // buffer, that's inexplicable and therefore serious.
void CloseChannelIfSSLErrorIsSerious(int retval); void CloseChannelIfSSLErrorIsSerious(int retval);
FLpxChannel(FLpxSocketsI *lsi, FSocket* sock, int chid, SSL_CTX* ctx, EChanState state); FLpxChannel(FlxSocketsI *lsi, FSocket* sock, int chid, SSL_CTX* ctx, EChanState state);
FLpxChannel() : FLpxChannel(nullptr, nullptr, 0, nullptr, CHAN_INACTIVE) {} FLpxChannel() : FLpxChannel(nullptr, nullptr, 0, nullptr, CHAN_INACTIVE) {}
~FLpxChannel() { } ~FLpxChannel() { }
}; };
@@ -183,7 +183,7 @@ public:
// //
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
class FLpxSocketsI : public FLpxSockets class FlxSocketsI : public FlxSockets
{ {
public: public:
// Fatal error status. // Fatal error status.
@@ -208,8 +208,8 @@ public:
SSL_CTX* ClientSecureCTX; SSL_CTX* ClientSecureCTX;
SSL_CTX* ClientInsecureCTX; SSL_CTX* ClientInsecureCTX;
FLpxSocketsI(FLockedWrapper &w); FlxSocketsI(FlxLockedWrapper &w);
virtual ~FLpxSocketsI() override; virtual ~FlxSocketsI() override;
// Copy the trace to the DPrint output. // Copy the trace to the DPrint output.
void DPrintTrace(); void DPrintTrace();
@@ -229,10 +229,10 @@ public:
void HandleSocketInputOutput(); void HandleSocketInputOutput();
// Force Close Everything. // Force Close Everything.
virtual void ForceCloseEverything(FLockedWrapper& w); virtual void ForceCloseEverything(FlxLockedWrapper& w);
// Main update routine. // Main update routine.
virtual void Update(FLockedWrapper &w) override; virtual void Update(FlxLockedWrapper &w) override;
}; };
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
@@ -506,7 +506,7 @@ static void BIODiscard(BIO* b, int nbytes, char* chbuf) {
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
#pragma optimize("", off) #pragma optimize("", off)
FLpxChannel::FLpxChannel(FLpxSocketsI* lsi, FSocket* sock, int chid, SSL_CTX* ctx, EChanState st) FLpxChannel::FLpxChannel(FlxSocketsI* lsi, FSocket* sock, int chid, SSL_CTX* ctx, EChanState st)
{ {
LSI = lsi; LSI = lsi;
ChannelID = chid; ChannelID = chid;
@@ -767,7 +767,7 @@ void FLpxChannel::Advance()
// //
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
FLpxListener::FLpxListener(FLpxSocketsI *lsi, int bp, FSocket *sock) FLpxListener::FLpxListener(FlxSocketsI *lsi, int bp, FSocket *sock)
{ {
LSI = lsi; LSI = lsi;
BoundPort = bp; BoundPort = bp;
@@ -804,7 +804,7 @@ void FLpxListener::AcceptConnection()
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
void FLpxSocketsI::SetError(const std::string& s) void FlxSocketsI::SetError(const std::string& s)
{ {
if (FatalError.empty()) { if (FatalError.empty()) {
FatalError = s; FatalError = s;
@@ -812,7 +812,7 @@ void FLpxSocketsI::SetError(const std::string& s)
} }
FLpxSocketsI::FLpxSocketsI(FLockedWrapper &w) FlxSocketsI::FlxSocketsI(FlxLockedWrapper &w)
{ {
// We retain this pointer only so long as we have the wrapper lock. // We retain this pointer only so long as we have the wrapper lock.
Luprex = w.Get(); Luprex = w.Get();
@@ -857,7 +857,7 @@ FLpxSocketsI::FLpxSocketsI(FLockedWrapper &w)
Luprex = nullptr; Luprex = nullptr;
} }
void FLpxSocketsI::ForceCloseEverything(FLockedWrapper& w) void FlxSocketsI::ForceCloseEverything(FlxLockedWrapper& w)
{ {
// We retain this pointer only so long as we have the wrapper lock. // We retain this pointer only so long as we have the wrapper lock.
Luprex = w.Get(); Luprex = w.Get();
@@ -877,7 +877,7 @@ void FLpxSocketsI::ForceCloseEverything(FLockedWrapper& w)
Luprex = nullptr; Luprex = nullptr;
} }
FLpxSocketsI::~FLpxSocketsI() FlxSocketsI::~FlxSocketsI()
{ {
checkf(Channels.IsEmpty(), TEXT("Must call ForceCloseEverything before destructor")); checkf(Channels.IsEmpty(), TEXT("Must call ForceCloseEverything before destructor"));
@@ -900,7 +900,7 @@ FLpxSocketsI::~FLpxSocketsI()
// TODO: Be more thorough. // TODO: Be more thorough.
} }
void FLpxSocketsI::DPrintTrace() void FlxSocketsI::DPrintTrace()
{ {
char* data; char* data;
int ndata = BIO_get_mem_data(TraceBIO, &data); int ndata = BIO_get_mem_data(TraceBIO, &data);
@@ -909,7 +909,7 @@ void FLpxSocketsI::DPrintTrace()
BIO_reset(TraceBIO); BIO_reset(TraceBIO);
} }
bool FLpxSocketsI::ListeningOnPort(int p) bool FlxSocketsI::ListeningOnPort(int p)
{ {
for (const FLpxListener& l : Listeners) for (const FLpxListener& l : Listeners)
{ {
@@ -918,7 +918,7 @@ bool FLpxSocketsI::ListeningOnPort(int p)
return false; return false;
} }
void FLpxSocketsI::HandleListenPorts() void FlxSocketsI::HandleListenPorts()
{ {
uint32_t nports; const uint32_t* ports; uint32_t nports; const uint32_t* ports;
Luprex->get_listen_ports(Luprex, &nports, &ports); Luprex->get_listen_ports(Luprex, &nports, &ports);
@@ -941,7 +941,7 @@ void FLpxSocketsI::HandleListenPorts()
} }
void FLpxSocketsI::HandleNewOutgoingSockets() void FlxSocketsI::HandleNewOutgoingSockets()
{ {
uint32_t nchids; const uint32_t* chids; uint32_t nchids; const uint32_t* chids;
Luprex->get_new_outgoing(Luprex, &nchids, &chids); Luprex->get_new_outgoing(Luprex, &nchids, &chids);
@@ -980,7 +980,7 @@ void FLpxSocketsI::HandleNewOutgoingSockets()
} }
void FLpxSocketsI::RemoveInactiveChannels() void FlxSocketsI::RemoveInactiveChannels()
{ {
int i = 0; int i = 0;
int n = Channels.Num(); int n = Channels.Num();
@@ -1003,7 +1003,7 @@ void FLpxSocketsI::RemoveInactiveChannels()
void FLpxSocketsI::HandleSocketInputOutput() void FlxSocketsI::HandleSocketInputOutput()
{ {
for (FLpxListener& listener : Listeners) for (FLpxListener& listener : Listeners)
{ {
@@ -1020,7 +1020,7 @@ void FLpxSocketsI::HandleSocketInputOutput()
RemoveInactiveChannels(); RemoveInactiveChannels();
} }
void FLpxSocketsI::Update(FLockedWrapper &w) void FlxSocketsI::Update(FlxLockedWrapper &w)
{ {
// We retain this pointer only so long as we have the wrapper lock. // We retain this pointer only so long as we have the wrapper lock.
Luprex = w.Get(); Luprex = w.Get();
@@ -1032,7 +1032,7 @@ void FLpxSocketsI::Update(FLockedWrapper &w)
Luprex = nullptr; Luprex = nullptr;
} }
FLpxSockets* FLpxSockets::Create(FLockedWrapper &w) FlxSockets* FlxSockets::Create(FlxLockedWrapper &w)
{ {
return new FLpxSocketsI(w); return new FlxSocketsI(w);
} }

View File

@@ -4,7 +4,7 @@
#include "LockedWrapper.h" #include "LockedWrapper.h"
#include <string> #include <string>
// Class FLpxSockets // Class FlxSockets
// //
// This class is responsible for creating outgoing and incoming // This class is responsible for creating outgoing and incoming
// sockets for the Luprex engine. It then relays data into and out // sockets for the Luprex engine. It then relays data into and out
@@ -13,39 +13,39 @@
// It only has one interesting method: Update(). This one method // It only has one interesting method: Update(). This one method
// does all the communication for the Luprex engine. Note that // does all the communication for the Luprex engine. Note that
// there aren't any methods where Unreal can query the state // there aren't any methods where Unreal can query the state
// of the FLpxSockets. That's because this class is for // of the FlxSockets. That's because this class is for
// communication between Luprex and outside servers and clients, // communication between Luprex and outside servers and clients,
// NOT for communication with Unreal. // NOT for communication with Unreal.
// //
// The FLpxSockets keeps a pointer to the EngineWrapper. // The FlxSockets keeps a pointer to the EngineWrapper.
// The EngineWrapper must outlive the FLpxSockets. // The EngineWrapper must outlive the FlxSockets.
// //
// This class is an abstract base class. A derived class // This class is an abstract base class. A derived class
// implements all the behavior. // implements all the behavior.
// //
class FLpxSockets; class FlxSockets;
struct EngineWrapper; struct EngineWrapper;
class FLpxSockets class FlxSockets
{ {
protected: protected:
FLpxSockets() {} FlxSockets() {}
public: public:
// Create the Luprex socket system. // Create the Luprex socket system.
static FLpxSockets* Create(FLockedWrapper &w); static FlxSockets* Create(FlxLockedWrapper &w);
// Close all sockets. // Close all sockets.
virtual void ForceCloseEverything(FLockedWrapper& w) = 0; virtual void ForceCloseEverything(FlxLockedWrapper& w) = 0;
// The update routine relays data into and out of // The update routine relays data into and out of
// luprex via TCP/IP sockets. // luprex via TCP/IP sockets.
virtual void Update(FLockedWrapper& w) = 0; virtual void Update(FlxLockedWrapper& w) = 0;
// Delete the luprex socket system. // Delete the luprex socket system.
// You must call ForceCloseEverything first. // You must call ForceCloseEverything first.
virtual ~FLpxSockets() {} virtual ~FlxSockets() {}
// Obtain any error status report. // Obtain any error status report.
virtual std::string GetError() = 0; virtual std::string GetError() = 0;

View File

@@ -1,13 +1,13 @@
#include "StringDecoder.h" #include "StringDecoder.h"
FStringDecoder::FStringDecoder(std::string_view s) { FlxStringDecoder::FlxStringDecoder(std::string_view s) {
Text = s.data(); Text = s.data();
Size = s.size(); Size = s.size();
ErrBeyondEOF = false; ErrBeyondEOF = false;
ErrStringTooLong = false; ErrStringTooLong = false;
} }
std::string_view FStringDecoder::read_string_view() { std::string_view FlxStringDecoder::read_string_view() {
size_t length = read_length(); size_t length = read_length();
if (length > Size) { if (length > Size) {
ErrBeyondEOF = true; ErrBeyondEOF = true;
@@ -19,7 +19,7 @@ std::string_view FStringDecoder::read_string_view() {
return result; return result;
} }
void FStringDecoder::set_at_eof() { void FlxStringDecoder::set_at_eof() {
Text += Size; Text += Size;
Size = 0; Size = 0;

View File

@@ -5,14 +5,14 @@
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
// //
// FStringDecoder // FlxStringDecoder
// //
// This class is used to decipher 8-bit strings that // This class is used to decipher 8-bit strings that
// contain packed ints, strings, and other data. // contain packed ints, strings, and other data.
// The typical example of usage is to decipher the // The typical example of usage is to decipher the
// serialized animation queues fed to us by Luprex. // serialized animation queues fed to us by Luprex.
// //
// The FStringDecoder doesn't make a copy of the string // The FlxStringDecoder doesn't make a copy of the string
// you pass in, instead, it stores a pointer to it. // you pass in, instead, it stores a pointer to it.
// So be sure not to free the string until you're // So be sure not to free the string until you're
// done analyzing it. // done analyzing it.
@@ -26,7 +26,7 @@
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
class FStringDecoder : public BaseReader<FStringDecoder> { class FlxStringDecoder : public BaseReader<FlxStringDecoder> {
private: private:
const char* Text; const char* Text;
size_t Size; size_t Size;
@@ -68,7 +68,7 @@ public:
// Initialize the string decoder with a text to analyze. // Initialize the string decoder with a text to analyze.
// //
FStringDecoder(std::string_view s); FlxStringDecoder(std::string_view s);
// Get the size of the remaining text. // Get the size of the remaining text.
// //

View File

@@ -12,7 +12,7 @@
* *
*/ */
UCLASS() UCLASS()
class INTEGRATION_API UTangible : public UObject class INTEGRATION_API UlxTangible : public UObject
{ {
GENERATED_BODY() GENERATED_BODY()
@@ -20,7 +20,7 @@ public:
UPROPERTY() UPROPERTY()
AActor* Actor; AActor* Actor;
FAnimTracker AnimTracker; FlxAnimTracker AnimTracker;
void Init(AActor* a) { void Init(AActor* a) {
Actor = a; Actor = a;

View File

@@ -3,4 +3,4 @@
#include "TangibleInterface.h" #include "TangibleInterface.h"
// Add default functionality here for any ITangibleInterface functions that are not pure virtual. // Add default functionality here for any IlxTangibleInterface functions that are not pure virtual.

View File

@@ -8,7 +8,7 @@
// This class does not need to be modified. // This class does not need to be modified.
UINTERFACE(Blueprintable) UINTERFACE(Blueprintable)
class UTangibleInterface : public UInterface class UlxTangibleInterface : public UInterface
{ {
GENERATED_BODY() GENERATED_BODY()
}; };
@@ -16,15 +16,15 @@ class UTangibleInterface : public UInterface
/** /**
* *
*/ */
class INTEGRATION_API ITangibleInterface class INTEGRATION_API IlxTangibleInterface
{ {
GENERATED_BODY() GENERATED_BODY()
// Add interface functions to this class. This is the class that will be inherited to implement this interface. // Add interface functions to this class. This is the class that will be inherited to implement this interface.
public: public:
UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality") UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality")
bool AbortAnimation(int64 hash); bool StartAnimation(int64 hash, int StrLen);
UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality") UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality")
bool StartAnimation(int64 hash, int StrLen); bool AbortAnimation(int64 hash);
}; };

View File

@@ -21,8 +21,8 @@ void FTangibleManager::Init(UWorld *world, UClass* tanact) {
Near = IdView(); Near = IdView();
} }
UTangible *FTangibleManager::GetTangible(int64 id) { UlxTangible *FTangibleManager::GetTangible(int64 id) {
UTangible **p = IdToTangible.Find(id); UlxTangible **p = IdToTangible.Find(id);
if (p == nullptr) { if (p == nullptr) {
return nullptr; return nullptr;
} else { } else {
@@ -30,16 +30,16 @@ UTangible *FTangibleManager::GetTangible(int64 id) {
} }
} }
UTangible *FTangibleManager::MakeTangible(int64 id) { UlxTangible *FTangibleManager::MakeTangible(int64 id) {
UTangible *& p = IdToTangible.FindOrAdd(id); UlxTangible *& p = IdToTangible.FindOrAdd(id);
if (p == nullptr) { if (p == nullptr) {
FVector location(0,0,0); FVector location(0,0,0);
FRotator rotation(0, 0, 0); FRotator rotation(0, 0, 0);
FActorSpawnParameters params; FActorSpawnParameters params;
AActor* a = World->SpawnActor(ClassTangibleActor, &location, &rotation, params); AActor* a = World->SpawnActor(ClassTangibleActor, &location, &rotation, params);
check(a != nullptr); check(a != nullptr);
check(a->GetClass()->ImplementsInterface(UTangibleInterface::StaticClass())); check(a->GetClass()->ImplementsInterface(UlxTangibleInterface::StaticClass()));
p = NewObject<UTangible>(); p = NewObject<UlxTangible>();
p->Init(a); p->Init(a);
} }
return p; return p;

View File

@@ -26,7 +26,7 @@ public:
// Given a tangible ID, look up actor pointer (or NULL if actor was deleted) // Given a tangible ID, look up actor pointer (or NULL if actor was deleted)
UPROPERTY() UPROPERTY()
TMap<int64, UTangible*> IdToTangible; TMap<int64, UlxTangible*> IdToTangible;
// Actor tangible Id. // Actor tangible Id.
int64 Actor; int64 Actor;
@@ -42,10 +42,10 @@ public:
void Init(UWorld *world, UClass* tanact); void Init(UWorld *world, UClass* tanact);
// Get the tangible if it exists, otherwise return NULL // Get the tangible if it exists, otherwise return NULL
UTangible* GetTangible(int64 id); UlxTangible* GetTangible(int64 id);
// Get the tangible if it exists, otherwise create it. // Get the tangible if it exists, otherwise create it.
UTangible* MakeTangible(int64 id); UlxTangible* MakeTangible(int64 id);
// Delete the tangible. // Delete the tangible.
void DeleteTangible(int64 id); void DeleteTangible(int64 id);