From f9d629cfc593f2d8f8c67579c8a0acdbfad3c031 Mon Sep 17 00:00:00 2001 From: rarified Date: Tue, 22 Mar 2022 13:52:03 -0600 Subject: [PATCH 1/8] Expand thread memory allocations for stack and heap to 1.25MB --- Build/VS2010/Plasma/Apps/plClient/plClient.vcxproj | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Build/VS2010/Plasma/Apps/plClient/plClient.vcxproj b/Build/VS2010/Plasma/Apps/plClient/plClient.vcxproj index eb1fa5e4..76165a77 100644 --- a/Build/VS2010/Plasma/Apps/plClient/plClient.vcxproj +++ b/Build/VS2010/Plasma/Apps/plClient/plClient.vcxproj @@ -1,4 +1,4 @@ - + @@ -121,6 +121,8 @@ $(OutDir)$(TargetName).map true UseLinkTimeCodeGeneration + 0x140000 + 0x140000 _DEBUG;%(PreprocessorDefinitions) @@ -177,6 +179,8 @@ $(OutDir)$(TargetName).map true UseLinkTimeCodeGeneration + 0x140000 + 0x140000 _DEBUG;%(PreprocessorDefinitions) @@ -237,6 +241,8 @@ MachineX86 true UseLinkTimeCodeGeneration + 0x140000 + 0x140000 NDEBUG;%(PreprocessorDefinitions) @@ -298,6 +304,8 @@ MachineX86 true UseLinkTimeCodeGeneration + 0x140000 + 0x140000 NDEBUG;%(PreprocessorDefinitions) @@ -802,4 +810,4 @@ - + \ No newline at end of file From fd0c2a205e2c84b0d30688b59e9bc84cc241cb8b Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 6 Apr 2022 19:18:05 -0500 Subject: [PATCH 2/8] Fix nondeterministic conflicting page processing on startup --- .../PubUtilLib/plResMgr/plResManager.cpp | 64 +++++++++++-------- .../Plasma/PubUtilLib/plResMgr/plResManager.h | 8 ++- 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp index a43cc5e8..0da65a02 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp @@ -1299,7 +1299,7 @@ void plResManager::PageInAge(const char *age) hsBool plResManager::VerifyPages() { - hsTArray invalidPages, newerPages; + PageSet invalidPages, newerPages; // Step 1: verify major/minor version changes if (plResMgrSettings::Get().GetFilterNewerPageVersions() || @@ -1313,7 +1313,7 @@ hsBool plResManager::VerifyPages() if (page->GetPageCondition() == kPageTooNew && plResMgrSettings::Get().GetFilterNewerPageVersions()) { - newerPages.Append(page); + newerPages.insert(page); fAllPages.erase(page); } else if ( @@ -1321,21 +1321,21 @@ hsBool plResManager::VerifyPages() page->GetPageCondition() == kPageOutOfDate) && plResMgrSettings::Get().GetFilterOlderPageVersions()) { - invalidPages.Append(page); + invalidPages.insert(page); fAllPages.erase(page); } } } // Handle all our invalid pages now - if (invalidPages.GetCount() > 0) + if (!invalidPages.empty()) { if (!IDeleteBadPages(invalidPages, false)) return false; } // Warn about newer pages - if (newerPages.GetCount() > 0) + if (!newerPages.empty()) { if (!IWarnNewerPages(newerPages)) return false; @@ -1343,22 +1343,35 @@ hsBool plResManager::VerifyPages() // Step 2 of verification: make sure no sequence numbers conflict PageSet::iterator it = fAllPages.begin(); - for (; it != fAllPages.end(); it++) + for (; it != fAllPages.end();) { plRegistryPageNode* page = *it; PageSet::iterator itUp = it; itUp++; - for (; itUp != fAllPages.end(); itUp++) + bool amValid = true; + for (; itUp != fAllPages.end();) { plRegistryPageNode* upPage = *itUp; - if (page->GetPageInfo().GetLocation() == upPage->GetPageInfo().GetLocation()) - { - invalidPages.Append(upPage); - fAllPages.erase(itUp); - break; + if (page->GetPageInfo().GetLocation() == upPage->GetPageInfo().GetLocation()) { + invalidPages.insert(upPage); + itUp = fAllPages.erase(itUp); + amValid = false; + } else { + itUp++; } } + + // Delete *all* conflicting pages, not just conflicting - 1. + // If we leave in a single conflicting page, a new conflict can trivially + // be introduced if the page we leave behind is defunct and a new version + // is later downloaded from the FileSrv. + if (!amValid) { + invalidPages.insert(page); + it = fAllPages.erase(it); + } else { + it++; + } } // Redo our loaded pages list, since Verify() might force the page's keys to load or unload @@ -1374,7 +1387,7 @@ hsBool plResManager::VerifyPages() } // Handle all our conflicting pages now - if (invalidPages.GetCount() > 0) + if (!invalidPages.empty() > 0) return IDeleteBadPages(invalidPages, true); return true; @@ -1384,9 +1397,10 @@ hsBool plResManager::VerifyPages() // Given an array of pages that are invalid (major version out-of-date or // whatnot), asks the user what we should do about them. -static void ICatPageNames(hsTArray& pages, char* buf, int bufSize) +static void ICatPageNames(const std::set& pages, char* buf, int bufSize) { - for (int i = 0; i < pages.GetCount(); i++) + int i = 0; + for (auto it = pages.cbegin(); it != pages.cend(); ++it, ++i) { if (i >= 25) { @@ -1394,7 +1408,7 @@ static void ICatPageNames(hsTArray& pages, char* buf, int b break; } - const char* pagePath = pages[i]->GetPagePath(); + const char* pagePath = (*it)->GetPagePath(); const char* pageFile = plFileUtils::GetFileName(pagePath); if (strlen(buf) + strlen(pageFile) > bufSize - 5) @@ -1408,7 +1422,7 @@ static void ICatPageNames(hsTArray& pages, char* buf, int b } } -hsBool plResManager::IDeleteBadPages(hsTArray& invalidPages, hsBool conflictingSeqNums) +hsBool plResManager::IDeleteBadPages(PageSet& invalidPages, hsBool conflictingSeqNums) { #ifndef PLASMA_EXTERNAL_RELEASE if (!hsMessageBox_SuppressPrompts) @@ -1430,12 +1444,12 @@ hsBool plResManager::IDeleteBadPages(hsTArray& invalidPages #endif // PLASMA_EXTERNAL_RELEASE // Delete 'em - for (int i = 0; i < invalidPages.GetCount(); i++) + for (PageSet::iterator it = invalidPages.begin(); it != invalidPages.end(); ++it) { - invalidPages[i]->DeleteSource(); - delete invalidPages[i]; + (*it)->DeleteSource(); + delete *it; } - invalidPages.Reset(); + invalidPages.clear(); fLastFoundPage = nil; @@ -1447,7 +1461,7 @@ hsBool plResManager::IDeleteBadPages(hsTArray& invalidPages // than the "current" one), warns the user about them but does nothing to // them. -hsBool plResManager::IWarnNewerPages(hsTArray &newerPages) +hsBool plResManager::IWarnNewerPages(PageSet &newerPages) { #ifndef PLASMA_EXTERNAL_RELEASE if (!hsMessageBox_SuppressPrompts) @@ -1465,9 +1479,9 @@ hsBool plResManager::IWarnNewerPages(hsTArray &newerPages) // Not deleting the files, just delete them from memory - for (int i = 0; i < newerPages.GetCount(); i++) - delete newerPages[i]; - newerPages.Reset(); + for (PageSet::iterator it = newerPages.begin(); it != newerPages.end(); ++it) + delete *it; + newerPages.clear(); fLastFoundPage = nil; diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h index c60ec5bd..201eb11d 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h @@ -61,6 +61,9 @@ typedef void(*plProgressProc)(plKey key); class plResManager : public hsResMgr { +protected: + typedef std::set PageSet; + public: plResManager(); virtual ~plResManager(); @@ -194,8 +197,8 @@ protected: void IUnloadPageKeys(plRegistryPageNode* pageNode, hsBool dontClear = false); - hsBool IDeleteBadPages(hsTArray& invalidPages, hsBool conflictingSeqNums); - hsBool IWarnNewerPages(hsTArray& newerPages); + hsBool IDeleteBadPages(PageSet& invalidPages, hsBool conflictingSeqNums); + hsBool IWarnNewerPages(PageSet& newerPages); void ILockPages(); void IUnlockPages(); @@ -233,7 +236,6 @@ protected: UInt8 fPageListLock; // Number of locks on the page lists. If it's greater than zero, they can't be modified hsBool fPagesNeedCleanup; // True if something modified the page lists while they were locked. - typedef std::set PageSet; PageSet fAllPages; // All the pages, loaded or not PageSet fLoadedPages; // Just the loaded pages From 33bbc490be81bfd0d4a210438c2de05b6cfd3cab Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 6 Apr 2022 19:32:30 -0500 Subject: [PATCH 3/8] Minor code quality correction --- Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp index 0da65a02..cb30f6cb 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp @@ -1387,7 +1387,7 @@ hsBool plResManager::VerifyPages() } // Handle all our conflicting pages now - if (!invalidPages.empty() > 0) + if (!invalidPages.empty()) return IDeleteBadPages(invalidPages, true); return true; From 3489e04463d998ecf4536478b58d20c34214d86a Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 6 Apr 2022 19:46:00 -0500 Subject: [PATCH 4/8] Fix crash from plMouseDevice::HideCursor if it is called before cursor is created --- .../Plasma/PubUtilLib/plInputCore/plInputDevice.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp index eec78f77..2e4306f6 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp @@ -481,8 +481,8 @@ void plMouseDevice::SetCursorY(hsScalar y) void plMouseDevice::HideCursor(hsBool override) { - if( fInstance->fCursor != nil ) - fInstance->fCursor->SetVisible( false ); + if (fInstance && fInstance->fCursor) + fInstance->fCursor->SetVisible(false); plMouseDevice::bCursorOverride = (override != 0); plMouseDevice::bCursorHidden = true; @@ -499,9 +499,11 @@ void plMouseDevice::ShowCursor(hsBool override) plMouseDevice::bCursorHidden = false; plMouseDevice::bCursorOverride = false; - if( fInstance->fCursor == nil ) - fInstance->CreateCursor( fInstance->fCursorID ); - fInstance->fCursor->SetVisible( true ); + if (fInstance) { + if (!fInstance->fCursor) + fInstance->CreateCursor(fInstance->fCursorID); + fInstance->fCursor->SetVisible(true); + } } void plMouseDevice::NewCursor(char* cursor) From 8aaa98b8b76de643ea4dbf46fef39ddad77dceae Mon Sep 17 00:00:00 2001 From: Edmond Mondor Date: Fri, 29 Apr 2022 07:46:54 -0700 Subject: [PATCH 5/8] Change to prevent crashing when fCurStage is null --- Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp index 9439ebe8..72b22571 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp @@ -326,7 +326,7 @@ bool plAvBrainClimb::IProcessExitStage(double time, float elapsed) float curBlend = ai->GetBlend(); - if(curBlend > .99) // reached peak strength + if(fCurStage && curBlend > .99) // reached peak strength { fCurStage->Detach(fAvMod); // remove the (now completely masked) underlying anim fCurStage = nil; From f54f14328e2f342a4ce9216a36d7820dd16ebb0b Mon Sep 17 00:00:00 2001 From: Edmond Mondor Date: Wed, 4 May 2022 20:16:58 -0700 Subject: [PATCH 6/8] PR from Huru to prevent dynamics from moving during age initilization --- .../Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index 03996b27..17669f5d 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -1328,15 +1328,15 @@ void plPXPhysical::GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsV void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV) { - bool initialSync = plNetClientApp::GetInstance()->IsLoadingInitialAgeState() && - plNetClientApp::GetInstance()->GetJoinOrder() == 0; - + bool isLoading = plNetClientApp::GetInstance()->IsLoadingInitialAgeState(); + bool isFirstIn = plNetClientApp::GetInstance()->GetJoinOrder() == 0; + bool initialSync = isLoading && isFirstIn; // If the physical has fallen out of the sim, and this is initial age state, and we're // the first person in, reset it to the original position. (ie, prop the default state // we've got right now) if (pos && pos->fZ < kMaxNegativeZPos && initialSync) { - SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName()); + SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName().c_str()); DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients); return; } @@ -1350,6 +1350,13 @@ void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsV SetLinearVelocitySim(*linV); if (angV) SetAngularVelocitySim(*angV); + // If we're loading the age, then we should ensure the objects stay asleep if they're supposed to be asleep. + // NOTE: We should only do this if the objects are not at their initial locations. Otherwise, they might + // sleep inside each other and explode or float randomly in midair + if (isLoading && GetProperty(plSimulationInterface::kStartInactive) && !fActor->readBodyFlag(NX_BF_KINEMATIC)) { + if (!pos && !rot) + fActor->putToSleep(); + } SendNewLocation(false, true); } From 126e7a76ddbb43835778c487196197edb5588934 Mon Sep 17 00:00:00 2001 From: ZarothYe Date: Tue, 10 May 2022 20:07:41 -0500 Subject: [PATCH 7/8] Add subtitle and loc key message flags --- Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h index 6c5d104e..8d8b41dc 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h @@ -165,6 +165,8 @@ class pfKIMsg : public plMessage kUNUSED1 = 0x00000008, kStatusMsg = 0x00000010, kNeighborMsg = 0x00000020, // sending to all the neighbors + kSubtitleMsg = 0x00000040, + kLocKeyMsg = 0x00000080, kChannelMask = 0x0000ff00 }; From 202e846a5639c370fadbe9711e456587c61fec67 Mon Sep 17 00:00:00 2001 From: Edmond Mondor Date: Wed, 11 May 2022 14:16:44 -0700 Subject: [PATCH 8/8] Fix compile error --- Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index 17669f5d..6e9df8ef 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -1336,7 +1336,7 @@ void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsV // we've got right now) if (pos && pos->fZ < kMaxNegativeZPos && initialSync) { - SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName().c_str()); + SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName()); DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients); return; }