From cd3c82f2c4ecbb57a7666a4adc42b8fa8a59a19f Mon Sep 17 00:00:00 2001 From: teppy999 Date: Fri, 15 Sep 2023 13:28:18 -0400 Subject: [PATCH] Change some class naming conventions --- Content/IntegrationGameModeBaseBP.uasset | 4 +- Content/TanActor.uasset | 4 +- Content/TangibleActor.uasset | 3 + Source/Integration/AnimQueue.cpp | 56 +++++++++--------- Source/Integration/AnimQueue.h | 58 +++++++++---------- Source/Integration/DebugPrint.cpp | 10 ++-- Source/Integration/DebugPrint.h | 2 +- .../Integration/IntegrationGameModeBase.cpp | 24 ++++---- Source/Integration/IntegrationGameModeBase.h | 8 +-- Source/Integration/LockedWrapper.cpp | 10 ++-- Source/Integration/LockedWrapper.h | 20 +++---- Source/Integration/LuprexSockets.cpp | 50 ++++++++-------- Source/Integration/LuprexSockets.h | 22 +++---- Source/Integration/StringDecoder.cpp | 6 +- Source/Integration/StringDecoder.h | 8 +-- Source/Integration/Tangible.h | 4 +- Source/Integration/TangibleInterface.cpp | 2 +- Source/Integration/TangibleInterface.h | 8 +-- Source/Integration/TangibleManager.cpp | 12 ++-- Source/Integration/TangibleManager.h | 6 +- 20 files changed, 160 insertions(+), 157 deletions(-) create mode 100644 Content/TangibleActor.uasset diff --git a/Content/IntegrationGameModeBaseBP.uasset b/Content/IntegrationGameModeBaseBP.uasset index b4f15e8f..11e947c4 100644 --- a/Content/IntegrationGameModeBaseBP.uasset +++ b/Content/IntegrationGameModeBaseBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3fa8c409d86707040e55f343d2828833e8033b4358a0124e88bf62070f5956b9 -size 53909 +oid sha256:c5d0146aa1bb2e87847726dae381f9e5631fa1441f321ebdba04b8a175afe109 +size 53679 diff --git a/Content/TanActor.uasset b/Content/TanActor.uasset index 41d02421..836c78c6 100644 --- a/Content/TanActor.uasset +++ b/Content/TanActor.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d60a5145deb04f4b59021ab59daafad0d46188eb0a0edb71f219839ae6366efe -size 60404 +oid sha256:8c1e57e6eda0e0446fe1a7fc05b57e376f6e850f6ba8d7705579fed7c6dda0e7 +size 2320 diff --git a/Content/TangibleActor.uasset b/Content/TangibleActor.uasset new file mode 100644 index 00000000..9d9a6994 --- /dev/null +++ b/Content/TangibleActor.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0cb088b3d5231066229add82f253f629a4e049bd906b4a4901ee48d1aa5fa81 +size 60559 diff --git a/Source/Integration/AnimQueue.cpp b/Source/Integration/AnimQueue.cpp index 17f03378..e0a1c1f0 100644 --- a/Source/Integration/AnimQueue.cpp +++ b/Source/Integration/AnimQueue.cpp @@ -1,18 +1,18 @@ #include "AnimQueue.h" -FAnimStep FAnimQueueDecoder::ReadStep() { - FAnimStep result; +FlxAnimStep FlxAnimQueueDecoder::ReadStep() { + FlxAnimStep result; result.Hash = Decoder.read_uint64(); result.Body = Decoder.read_string_view(); return result; } -FAnimField FAnimStepDecoder::ReadField() { - FAnimField result; +FlxAnimField FlxAnimStepDecoder::ReadField() { + FlxAnimField result; result.Name = Decoder.read_string_view(); result.Persistent = Decoder.read_bool(); - result.Type = (EAnimValueType)Decoder.read_uint8(); + result.Type = (ElxAnimValueType)Decoder.read_uint8(); switch (result.Type) { case T_STRING: { result.S = Decoder.read_string_view(); @@ -42,39 +42,39 @@ FAnimField FAnimStepDecoder::ReadField() { return result; } -FString FAnimQueueDecoder::DebugString(std::string_view queue) { +FString FlxAnimQueueDecoder::DebugString(std::string_view queue) { FString result; - FAnimQueueDecoder decoder(queue); + FlxAnimQueueDecoder decoder(queue); while (!decoder.AtEOF()) { - FAnimStep step = decoder.ReadStep(); - FString stepdebug = FAnimStepDecoder::DebugString(step); + FlxAnimStep step = decoder.ReadStep(); + FString stepdebug = FlxAnimStepDecoder::DebugString(step); result.Appendf(TEXT("%s\n"), *stepdebug); } return result; } -FString FAnimStepDecoder::DebugString(const FAnimStep& step) { +FString FlxAnimStepDecoder::DebugString(const FlxAnimStep& step) { FString result; - FAnimStepDecoder decoder(step); + FlxAnimStepDecoder decoder(step); bool first = true; while (!decoder.AtEOF()) { - FAnimField field = decoder.ReadField(); + FlxAnimField field = decoder.ReadField(); if (!first) { result.Append(TEXT(" ")); } result.Append(FString(field.Name.size(), (const UTF8CHAR*)field.Name.data())); result.Append(field.Persistent ? TEXT("=") : TEXT(":")); switch (field.Type) { - case EAnimValueType::T_STRING: + case ElxAnimValueType::T_STRING: result.Append(FString(field.S.size(), (const UTF8CHAR*)field.S.data())); break; - case EAnimValueType::T_NUMBER: + case ElxAnimValueType::T_NUMBER: result.Appendf(TEXT("%lf"), field.X); break; - case EAnimValueType::T_BOOLEAN: + case ElxAnimValueType::T_BOOLEAN: result.Append((field.X) == 1.0 ? TEXT("true") : TEXT("false")); break; - case EAnimValueType::T_XYZ: + case ElxAnimValueType::T_XYZ: result.Appendf(TEXT("%lf,%lf,%lf"), field.X, field.Y, field.Z); break; } @@ -88,7 +88,7 @@ FString FAnimStepDecoder::DebugString(const FAnimStep& step) { //// store the hashes, not the steps. The First element //// of the queue is the oldest item. //// -//TDeque AQ; +//TDeque AQ; //// The sequence number of the first item in AQ. //// @@ -106,7 +106,7 @@ FString FAnimStepDecoder::DebugString(const FAnimStep& step) { //TArray AbortedHashes; -FAnimTracker::FAnimTracker() { +FlxAnimTracker::FlxAnimTracker() { AQ.Empty(); FirstSeqno = 0; HashToSeqno.Empty(); @@ -114,7 +114,7 @@ FAnimTracker::FAnimTracker() { 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 // in encqueue has the same hash as the most recent // entry in AQ, then that's an exact match. Or, @@ -128,7 +128,7 @@ void FAnimTracker::Update(std::string_view encqueue) { } } else { if (!AQ.IsEmpty()) { - FStringDecoder qdecoder(encqueue); + FlxStringDecoder qdecoder(encqueue); uint64 hash = qdecoder.read_uint64(); if (hash == AQ.Last().Hash) { return; @@ -143,11 +143,11 @@ void FAnimTracker::Update(std::string_view encqueue) { // At the same time, push all non-matching records // after the matching record onto a stack of new records. // - FAnimQueueDecoder decoder(encqueue); - TArray newsteps; + FlxAnimQueueDecoder decoder(encqueue); + TArray newsteps; int32 matchingseqno = -1; while (!decoder.AtEOF()) { - FAnimStep step = decoder.ReadStep(); + FlxAnimStep step = decoder.ReadStep(); int32* stepseq = HashToSeqno.Find(step.Hash); if (stepseq == nullptr) { newsteps.Emplace(step); @@ -172,7 +172,7 @@ void FAnimTracker::Update(std::string_view encqueue) { // Transfer the new animations onto the queue. // while (!newsteps.IsEmpty()) { - FAnimStep step = newsteps.Pop(); + FlxAnimStep step = newsteps.Pop(); int32 seqno = FirstSeqno + AQ.Num(); AQ.EmplaceLast(step.Hash, step.Body); HashToSeqno.Emplace(step.Hash, seqno); @@ -202,25 +202,25 @@ void FAnimTracker::Update(std::string_view encqueue) { } } -TArray FAnimTracker::GetAborted() { +TArray FlxAnimTracker::GetAborted() { TArray result; result = std::move(AbortedHashes); AbortedHashes.Empty(); return result; } -bool FAnimTracker::AnyUnstarted() { +bool FlxAnimTracker::AnyUnstarted() { int offset = UnstartedSeqno - FirstSeqno; return (offset < AQ.Num()); } -FAnimStoredStep FAnimTracker::GetUnstarted() { +FlxAnimStoredStep FlxAnimTracker::GetUnstarted() { int offset = UnstartedSeqno - FirstSeqno; check(offset < AQ.Num()); return AQ[offset]; } -void FAnimTracker::Started(uint64 hash) { +void FlxAnimTracker::Started(uint64 hash) { int offset = UnstartedSeqno - FirstSeqno; check(offset < AQ.Num()); check(AQ[offset].Hash == hash); diff --git a/Source/Integration/AnimQueue.h b/Source/Integration/AnimQueue.h index 11ab0f0c..268125c6 100644 --- a/Source/Integration/AnimQueue.h +++ b/Source/Integration/AnimQueue.h @@ -10,7 +10,7 @@ // //////////////////////////////////////////////// -enum EAnimValueType { +enum ElxAnimValueType { T_STRING, T_NUMBER, T_BOOLEAN, @@ -22,28 +22,28 @@ enum EAnimValueType { // // 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 -// FAnimField records you need an FAnimStepDecoder. +// FlxAnimField records you need an FlxAnimStepDecoder. // This comes in two versions: the string version, // and the string_view version. // //////////////////////////////////////////////// -struct FAnimStep { +struct FlxAnimStep { uint64 Hash; std::string_view Body; - FAnimStep() : Hash(0), Body("") {} - FAnimStep(uint64 h, std::string_view b) : Hash(h), Body(b) {} + FlxAnimStep() : Hash(0), Body("") {} + FlxAnimStep(uint64 h, std::string_view b) : Hash(h), Body(b) {} }; -struct FAnimStoredStep { +struct FlxAnimStoredStep { uint64 Hash; std::string Body; - FAnimStoredStep() : Hash(0), Body("") {} - FAnimStoredStep(uint64 h, std::string_view b) : Hash(h), Body(b) {} + FlxAnimStoredStep() : Hash(0), Body("") {} + 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; bool Persistent; - EAnimValueType Type; + ElxAnimValueType Type; double X, Y, Z; std::string_view S; }; @@ -79,14 +79,14 @@ struct FAnimField { // //////////////////////////////////////////////// -class FAnimQueueDecoder { +class FlxAnimQueueDecoder { private: - FStringDecoder Decoder; + FlxStringDecoder Decoder; 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. // @@ -94,7 +94,7 @@ public: // Read one animation step. // - FAnimStep ReadStep(); + FlxAnimStep ReadStep(); // Convert an AnimQueue to an FString. // @@ -106,21 +106,21 @@ public: // An Animation Step Decoder. // // 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 // 'end-of-file'. // //////////////////////////////////////////////// -class FAnimStepDecoder { +class FlxAnimStepDecoder { private: - FStringDecoder Decoder; + FlxStringDecoder Decoder; public: - // Initialize the FAnimStepDecoder from the FAnimStep. + // Initialize the FlxAnimStepDecoder from the FlxAnimStep. // - FAnimStepDecoder(const FAnimStep &step) : Decoder(step.Body) {} - FAnimStepDecoder(const FAnimStoredStep& step) : Decoder(step.Body) {} + FlxAnimStepDecoder(const FlxAnimStep &step) : Decoder(step.Body) {} + FlxAnimStepDecoder(const FlxAnimStoredStep& step) : Decoder(step.Body) {} // Return true if the parser has reached the end of the string. // @@ -128,16 +128,16 @@ public: // Read one field. // - FAnimField ReadField(); + FlxAnimField ReadField(); // 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 // tangible. It can identify when a new animation has @@ -147,13 +147,13 @@ public: // //////////////////////////////////////////////// -class FAnimTracker { +class FlxAnimTracker { public: // Our own copy of the animation queue. We only // store the hashes, not the steps. The First element // of the queue is the oldest item. // - TDeque AQ; + TDeque AQ; // The sequence number of the first item in AQ. // @@ -175,7 +175,7 @@ public: // // Initially, the tracker is in the empty (Clear) state. // - FAnimTracker(); + FlxAnimTracker(); // Update from the specified animation queue. // @@ -199,7 +199,7 @@ public: // // You may only call this if AnyUnstarted returns true. // - FAnimStoredStep GetUnstarted(); + FlxAnimStoredStep GetUnstarted(); // Declare that an animation has been started. // diff --git a/Source/Integration/DebugPrint.cpp b/Source/Integration/DebugPrint.cpp index 4946020f..40b4f5e6 100644 --- a/Source/Integration/DebugPrint.cpp +++ b/Source/Integration/DebugPrint.cpp @@ -145,7 +145,7 @@ namespace DebugPrintControl { ////////////////////////////////////////////////////////////// -void FConsoleOutput::Truncate() { +void FlxConsoleOutput::Truncate() { int lines = 50; int csize = Content.Len(); int total = 0; @@ -160,7 +160,7 @@ void FConsoleOutput::Truncate() { } } -bool FConsoleOutput::MaybeAppendNewline() { +bool FlxConsoleOutput::MaybeAppendNewline() { int csize = Content.Len(); if ((csize > 0) && (Content[csize - 1] != '\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()) { Content += text; 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); if (modified) { 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(); modified |= MaybeAppendText(text); modified |= MaybeAppendNewline(); diff --git a/Source/Integration/DebugPrint.h b/Source/Integration/DebugPrint.h index 8b219dad..8acec4f6 100644 --- a/Source/Integration/DebugPrint.h +++ b/Source/Integration/DebugPrint.h @@ -113,7 +113,7 @@ namespace DebugPrintControl { // ////////////////////////////////////////////////////////////// -class FConsoleOutput { +class FlxConsoleOutput { private: FString Content; bool Dirty; diff --git a/Source/Integration/IntegrationGameModeBase.cpp b/Source/Integration/IntegrationGameModeBase.cpp index c4fa4699..d410f009 100644 --- a/Source/Integration/IntegrationGameModeBase.cpp +++ b/Source/Integration/IntegrationGameModeBase.cpp @@ -36,7 +36,7 @@ AIntegrationGameModeBase::~AIntegrationGameModeBase() // at the moment we trigger it. // uint32 AIntegrationGameModeBase::Run() { - FLockedWrapper lockedwrap(LockableWrapper); + FlxLockedWrapper lockedwrap(LockableWrapper); Sockets->Update(lockedwrap); lockedwrap->play_invoke_event_update(lockedwrap.Get(), EngineSeconds); Sockets->Update(lockedwrap); @@ -52,7 +52,7 @@ void AIntegrationGameModeBase::ResetToInitialState() // Now that the thread's gone, we should be able to // just claim and hold the lock on the wrapper. - FLockedWrapper w(LockableWrapper); + FlxLockedWrapper w(LockableWrapper); // Release and close all sockets. if (Sockets != nullptr) @@ -76,7 +76,7 @@ void AIntegrationGameModeBase::ResetToInitialState() void AIntegrationGameModeBase::UpdateConsoleOutput() { // Copy Luprex Stdout into the console. - FLockedWrapper lockedwrap(LockableWrapper); + FlxLockedWrapper lockedwrap(LockableWrapper); if (Playing) { ConsoleOutput.Append(lockedwrap.FetchStdout()); } @@ -96,7 +96,7 @@ void AIntegrationGameModeBase::UpdateConsoleOutput() { void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) { if (!Playing) return; - FLockedWrapper lockedwrap(LockableWrapper); + FlxLockedWrapper lockedwrap(LockableWrapper); if (EngineSeconds >= NextThreadTrigger) { LuprexUpdateTask.Trigger(); @@ -106,7 +106,7 @@ void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) { void AIntegrationGameModeBase::UpdateTangibles() { if (!Playing) return; - FLockedWrapper w(LockableWrapper); + FlxLockedWrapper w(LockableWrapper); int64 actor = w.GetActor(); TangibleManager.SetActor(actor); TangibleManager.SetNear(w.GetNear(actor, 100, 100, 100)); @@ -119,18 +119,18 @@ void AIntegrationGameModeBase::UpdateTangibles() { for (int i = 0; i < tanids.Num(); i++) { uint64_t tanid = tanids[i]; std::string_view aqueue = aqueues[i]; - UTangible* t = TangibleManager.GetTangible(tanid); + UlxTangible* t = TangibleManager.GetTangible(tanid); check(t != nullptr); t->AnimTracker.Update(aqueue); TArray aborted = t->AnimTracker.GetAborted(); for (uint64 hash : aborted) { - ITangibleInterface::Execute_AbortAnimation(t->Actor, hash); + IlxTangibleInterface::Execute_AbortAnimation(t->Actor, hash); } if (t->AnimTracker.AnyUnstarted()) { - FAnimStoredStep step = t->AnimTracker.GetUnstarted(); - bool started = ITangibleInterface::Execute_StartAnimation(t->Actor, step.Hash, step.Body.size()); + FlxAnimStoredStep step = t->AnimTracker.GetUnstarted(); + bool started = IlxTangibleInterface::Execute_StartAnimation(t->Actor, step.Hash, step.Body.size()); if (started) { t->AnimTracker.Started(step.Hash); } @@ -140,7 +140,7 @@ void AIntegrationGameModeBase::UpdateTangibles() { void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs) { - FLockedWrapper w(LockableWrapper); + FlxLockedWrapper w(LockableWrapper); if (w->engine != nullptr) { const TCHAR* fstchar = *fs; @@ -181,7 +181,7 @@ void AIntegrationGameModeBase::BeginPlay() // Now we're just going to claim the wrapper // lock for the remainder. When we create the thread, // the thread will hang until we release this lock. - FLockedWrapper w(LockableWrapper); + FlxLockedWrapper w(LockableWrapper); // Sanity checks. Make sure everything is clean. 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 (Playing) { - Sockets.Reset(FLpxSockets::Create(w)); + Sockets.Reset(FlxSockets::Create(w)); std::string error = Sockets->GetError(); check(error.empty()); LuprexUpdateTask.Startup(this); diff --git a/Source/Integration/IntegrationGameModeBase.h b/Source/Integration/IntegrationGameModeBase.h index 41b21378..fa72e6ad 100644 --- a/Source/Integration/IntegrationGameModeBase.h +++ b/Source/Integration/IntegrationGameModeBase.h @@ -60,17 +60,17 @@ public: FTangibleManager TangibleManager; // This stores the entire text currently visible in the console. - FConsoleOutput ConsoleOutput; + FlxConsoleOutput ConsoleOutput; // The Luprex EngineWrapper, with a Mutex to protect it. - // To access it, construct a FLockedWrapper. - FLockableWrapper LockableWrapper; + // To access it, construct a FlxLockedWrapper. + FlxLockableWrapper LockableWrapper; // This utility runs the luprex update and socket update in a thread. FTriggeredTask LuprexUpdateTask; // Luprex socket system. Aside from construction, only touched by Luprex thread. - TUniquePtr Sockets; + TUniquePtr Sockets; // True if 'BeginPlay' has been successfully completed. // diff --git a/Source/Integration/LockedWrapper.cpp b/Source/Integration/LockedWrapper.cpp index 518e7fad..ddc53146 100644 --- a/Source/Integration/LockedWrapper.cpp +++ b/Source/Integration/LockedWrapper.cpp @@ -5,7 +5,7 @@ using namespace CommonTypes; -void FLockedWrapper::InitWrapper() { +void FlxLockedWrapper::InitWrapper() { if (Lockable.Wrapper.play_initialize != nullptr) { // Already initialized. return; @@ -21,7 +21,7 @@ void FLockedWrapper::InitWrapper() { } } -FString FLockedWrapper::FetchStdout() { +FString FlxLockedWrapper::FetchStdout() { uint32_t ndata; const char* data; Lockable.Wrapper.get_outgoing(Get(), 0, &ndata, &data); @@ -36,18 +36,18 @@ FString FLockedWrapper::FetchStdout() { return FString(cps.size(), (const UCS2CHAR*)(&cps[0])); } -int64 FLockedWrapper::GetActor() { +int64 FlxLockedWrapper::GetActor() { 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; int64* data; Lockable.Wrapper.get_tangibles_near(Get(), id, rx, ry, rz, &size, &data); return IdView(data, size); } -StringViewVec FLockedWrapper::GetAnimationQueues(IdView ids) { +StringViewVec FlxLockedWrapper::GetAnimationQueues(IdView ids) { // How many animation queues are we fetching? int num = ids.Num(); diff --git a/Source/Integration/LockedWrapper.h b/Source/Integration/LockedWrapper.h index 3b1a7856..746d0962 100644 --- a/Source/Integration/LockedWrapper.h +++ b/Source/Integration/LockedWrapper.h @@ -4,14 +4,14 @@ #include "lpx-enginewrapper.hpp" #include "CommonTypes.h" -// Class FLockableWrapper +// Class FlxLockableWrapper // // Contains the EngineWrapper and a Mutex to lock it. // 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. // -class FLockableWrapper { +class FlxLockableWrapper { private: FCriticalSection Mutex; EngineWrapper Wrapper; @@ -24,12 +24,12 @@ private: TArray AQStrBuffer; public: - friend class FLockedWrapper; + friend class FlxLockedWrapper; }; -class FLockedWrapper { +class FlxLockedWrapper { private: - FLockableWrapper& Lockable; + FlxLockableWrapper& Lockable; public: // Import these types into our Namespace. @@ -38,13 +38,13 @@ public: using StringViewVec = CommonTypes::StringViewVec; public: - // The constructor of the FLockedWrapper claims the mutex. - FLockedWrapper(FLockableWrapper& w) : Lockable(w) { + // The constructor of the FlxLockedWrapper claims the mutex. + FlxLockedWrapper(FlxLockableWrapper& w) : Lockable(w) { Lockable.Mutex.Lock(); } - // The destructor of the FLockedWrapper releases the mutex. - ~FLockedWrapper() { + // The destructor of the FlxLockedWrapper releases the mutex. + ~FlxLockedWrapper() { Lockable.Mutex.Unlock(); } diff --git a/Source/Integration/LuprexSockets.cpp b/Source/Integration/LuprexSockets.cpp index bf43adc4..a7d213c4 100644 --- a/Source/Integration/LuprexSockets.cpp +++ b/Source/Integration/LuprexSockets.cpp @@ -85,7 +85,7 @@ static const char* dummy_key = "HcKc9a4WXhC7yu79e5BnKWltHXY=\n" "-----END PRIVATE KEY-----\n"; -class FLpxSocketsI; +class FlxSocketsI; ///////////////////////////////////////////////////////////////// // @@ -96,11 +96,11 @@ class FLpxSocketsI; class FLpxListener { public: - FLpxSocketsI *LSI; + FlxSocketsI *LSI; int BoundPort; FSocket* Socket; - FLpxListener(FLpxSocketsI *lsi, int bp, FSocket* sock); + FLpxListener(FlxSocketsI *lsi, int bp, FSocket* sock); ~FLpxListener(); void AcceptConnection(); @@ -122,7 +122,7 @@ enum EChanState { class FLpxChannel { public: - FLpxSocketsI* LSI; + FlxSocketsI* LSI; EChanState State; int ChannelID; FSocket* Socket; @@ -172,7 +172,7 @@ public: // buffer, that's inexplicable and therefore serious. 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() { } }; @@ -183,7 +183,7 @@ public: // ///////////////////////////////////////////////////////////////// -class FLpxSocketsI : public FLpxSockets +class FlxSocketsI : public FlxSockets { public: // Fatal error status. @@ -208,8 +208,8 @@ public: SSL_CTX* ClientSecureCTX; SSL_CTX* ClientInsecureCTX; - FLpxSocketsI(FLockedWrapper &w); - virtual ~FLpxSocketsI() override; + FlxSocketsI(FlxLockedWrapper &w); + virtual ~FlxSocketsI() override; // Copy the trace to the DPrint output. void DPrintTrace(); @@ -229,10 +229,10 @@ public: void HandleSocketInputOutput(); // Force Close Everything. - virtual void ForceCloseEverything(FLockedWrapper& w); + virtual void ForceCloseEverything(FlxLockedWrapper& w); // 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) -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; 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; 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()) { 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. Luprex = w.Get(); @@ -857,7 +857,7 @@ FLpxSocketsI::FLpxSocketsI(FLockedWrapper &w) 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. Luprex = w.Get(); @@ -877,7 +877,7 @@ void FLpxSocketsI::ForceCloseEverything(FLockedWrapper& w) Luprex = nullptr; } -FLpxSocketsI::~FLpxSocketsI() +FlxSocketsI::~FlxSocketsI() { checkf(Channels.IsEmpty(), TEXT("Must call ForceCloseEverything before destructor")); @@ -900,7 +900,7 @@ FLpxSocketsI::~FLpxSocketsI() // TODO: Be more thorough. } -void FLpxSocketsI::DPrintTrace() +void FlxSocketsI::DPrintTrace() { char* data; int ndata = BIO_get_mem_data(TraceBIO, &data); @@ -909,7 +909,7 @@ void FLpxSocketsI::DPrintTrace() BIO_reset(TraceBIO); } -bool FLpxSocketsI::ListeningOnPort(int p) +bool FlxSocketsI::ListeningOnPort(int p) { for (const FLpxListener& l : Listeners) { @@ -918,7 +918,7 @@ bool FLpxSocketsI::ListeningOnPort(int p) return false; } -void FLpxSocketsI::HandleListenPorts() +void FlxSocketsI::HandleListenPorts() { uint32_t nports; const uint32_t* 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; Luprex->get_new_outgoing(Luprex, &nchids, &chids); @@ -980,7 +980,7 @@ void FLpxSocketsI::HandleNewOutgoingSockets() } -void FLpxSocketsI::RemoveInactiveChannels() +void FlxSocketsI::RemoveInactiveChannels() { int i = 0; int n = Channels.Num(); @@ -1003,7 +1003,7 @@ void FLpxSocketsI::RemoveInactiveChannels() -void FLpxSocketsI::HandleSocketInputOutput() +void FlxSocketsI::HandleSocketInputOutput() { for (FLpxListener& listener : Listeners) { @@ -1020,7 +1020,7 @@ void FLpxSocketsI::HandleSocketInputOutput() RemoveInactiveChannels(); } -void FLpxSocketsI::Update(FLockedWrapper &w) +void FlxSocketsI::Update(FlxLockedWrapper &w) { // We retain this pointer only so long as we have the wrapper lock. Luprex = w.Get(); @@ -1032,7 +1032,7 @@ void FLpxSocketsI::Update(FLockedWrapper &w) Luprex = nullptr; } -FLpxSockets* FLpxSockets::Create(FLockedWrapper &w) +FlxSockets* FlxSockets::Create(FlxLockedWrapper &w) { - return new FLpxSocketsI(w); + return new FlxSocketsI(w); } diff --git a/Source/Integration/LuprexSockets.h b/Source/Integration/LuprexSockets.h index 9d5135e9..aa55dc1c 100644 --- a/Source/Integration/LuprexSockets.h +++ b/Source/Integration/LuprexSockets.h @@ -4,7 +4,7 @@ #include "LockedWrapper.h" #include -// Class FLpxSockets +// Class FlxSockets // // This class is responsible for creating outgoing and incoming // 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 // does all the communication for the Luprex engine. Note that // 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, // NOT for communication with Unreal. // -// The FLpxSockets keeps a pointer to the EngineWrapper. -// The EngineWrapper must outlive the FLpxSockets. +// The FlxSockets keeps a pointer to the EngineWrapper. +// The EngineWrapper must outlive the FlxSockets. // // This class is an abstract base class. A derived class // implements all the behavior. // -class FLpxSockets; +class FlxSockets; struct EngineWrapper; -class FLpxSockets +class FlxSockets { protected: - FLpxSockets() {} + FlxSockets() {} public: // Create the Luprex socket system. - static FLpxSockets* Create(FLockedWrapper &w); + static FlxSockets* Create(FlxLockedWrapper &w); // Close all sockets. - virtual void ForceCloseEverything(FLockedWrapper& w) = 0; + virtual void ForceCloseEverything(FlxLockedWrapper& w) = 0; // The update routine relays data into and out of // luprex via TCP/IP sockets. - virtual void Update(FLockedWrapper& w) = 0; + virtual void Update(FlxLockedWrapper& w) = 0; // Delete the luprex socket system. // You must call ForceCloseEverything first. - virtual ~FLpxSockets() {} + virtual ~FlxSockets() {} // Obtain any error status report. virtual std::string GetError() = 0; diff --git a/Source/Integration/StringDecoder.cpp b/Source/Integration/StringDecoder.cpp index 72e926a8..1182914d 100644 --- a/Source/Integration/StringDecoder.cpp +++ b/Source/Integration/StringDecoder.cpp @@ -1,13 +1,13 @@ #include "StringDecoder.h" -FStringDecoder::FStringDecoder(std::string_view s) { +FlxStringDecoder::FlxStringDecoder(std::string_view s) { Text = s.data(); Size = s.size(); ErrBeyondEOF = false; ErrStringTooLong = false; } -std::string_view FStringDecoder::read_string_view() { +std::string_view FlxStringDecoder::read_string_view() { size_t length = read_length(); if (length > Size) { ErrBeyondEOF = true; @@ -19,7 +19,7 @@ std::string_view FStringDecoder::read_string_view() { return result; } -void FStringDecoder::set_at_eof() { +void FlxStringDecoder::set_at_eof() { Text += Size; Size = 0; diff --git a/Source/Integration/StringDecoder.h b/Source/Integration/StringDecoder.h index 7fc92c30..e585e741 100644 --- a/Source/Integration/StringDecoder.h +++ b/Source/Integration/StringDecoder.h @@ -5,14 +5,14 @@ ///////////////////////////////////////////////////// // -// FStringDecoder +// FlxStringDecoder // // This class is used to decipher 8-bit strings that // contain packed ints, strings, and other data. // The typical example of usage is to decipher the // 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. // So be sure not to free the string until you're // done analyzing it. @@ -26,7 +26,7 @@ ///////////////////////////////////////////////////// -class FStringDecoder : public BaseReader { +class FlxStringDecoder : public BaseReader { private: const char* Text; size_t Size; @@ -68,7 +68,7 @@ public: // 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. // diff --git a/Source/Integration/Tangible.h b/Source/Integration/Tangible.h index c45f5452..84f0686f 100644 --- a/Source/Integration/Tangible.h +++ b/Source/Integration/Tangible.h @@ -12,7 +12,7 @@ * */ UCLASS() -class INTEGRATION_API UTangible : public UObject +class INTEGRATION_API UlxTangible : public UObject { GENERATED_BODY() @@ -20,7 +20,7 @@ public: UPROPERTY() AActor* Actor; - FAnimTracker AnimTracker; + FlxAnimTracker AnimTracker; void Init(AActor* a) { Actor = a; diff --git a/Source/Integration/TangibleInterface.cpp b/Source/Integration/TangibleInterface.cpp index 8027fd0f..ae86e205 100644 --- a/Source/Integration/TangibleInterface.cpp +++ b/Source/Integration/TangibleInterface.cpp @@ -3,4 +3,4 @@ #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. diff --git a/Source/Integration/TangibleInterface.h b/Source/Integration/TangibleInterface.h index 99df093a..221872ba 100644 --- a/Source/Integration/TangibleInterface.h +++ b/Source/Integration/TangibleInterface.h @@ -8,7 +8,7 @@ // This class does not need to be modified. UINTERFACE(Blueprintable) -class UTangibleInterface : public UInterface +class UlxTangibleInterface : public UInterface { GENERATED_BODY() }; @@ -16,15 +16,15 @@ class UTangibleInterface : public UInterface /** * */ -class INTEGRATION_API ITangibleInterface +class INTEGRATION_API IlxTangibleInterface { GENERATED_BODY() // Add interface functions to this class. This is the class that will be inherited to implement this interface. public: UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality") - bool AbortAnimation(int64 hash); + bool StartAnimation(int64 hash, int StrLen); UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality") - bool StartAnimation(int64 hash, int StrLen); + bool AbortAnimation(int64 hash); }; diff --git a/Source/Integration/TangibleManager.cpp b/Source/Integration/TangibleManager.cpp index 6c0fd9f8..046d42c7 100644 --- a/Source/Integration/TangibleManager.cpp +++ b/Source/Integration/TangibleManager.cpp @@ -21,8 +21,8 @@ void FTangibleManager::Init(UWorld *world, UClass* tanact) { Near = IdView(); } -UTangible *FTangibleManager::GetTangible(int64 id) { - UTangible **p = IdToTangible.Find(id); +UlxTangible *FTangibleManager::GetTangible(int64 id) { + UlxTangible **p = IdToTangible.Find(id); if (p == nullptr) { return nullptr; } else { @@ -30,16 +30,16 @@ UTangible *FTangibleManager::GetTangible(int64 id) { } } -UTangible *FTangibleManager::MakeTangible(int64 id) { - UTangible *& p = IdToTangible.FindOrAdd(id); +UlxTangible *FTangibleManager::MakeTangible(int64 id) { + UlxTangible *& p = IdToTangible.FindOrAdd(id); if (p == nullptr) { FVector location(0,0,0); FRotator rotation(0, 0, 0); FActorSpawnParameters params; AActor* a = World->SpawnActor(ClassTangibleActor, &location, &rotation, params); check(a != nullptr); - check(a->GetClass()->ImplementsInterface(UTangibleInterface::StaticClass())); - p = NewObject(); + check(a->GetClass()->ImplementsInterface(UlxTangibleInterface::StaticClass())); + p = NewObject(); p->Init(a); } return p; diff --git a/Source/Integration/TangibleManager.h b/Source/Integration/TangibleManager.h index cc9c2a93..9a4e1a06 100644 --- a/Source/Integration/TangibleManager.h +++ b/Source/Integration/TangibleManager.h @@ -26,7 +26,7 @@ public: // Given a tangible ID, look up actor pointer (or NULL if actor was deleted) UPROPERTY() - TMap IdToTangible; + TMap IdToTangible; // Actor tangible Id. int64 Actor; @@ -42,10 +42,10 @@ public: void Init(UWorld *world, UClass* tanact); // 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. - UTangible* MakeTangible(int64 id); + UlxTangible* MakeTangible(int64 id); // Delete the tangible. void DeleteTangible(int64 id);