diff --git a/lib/Red/Utils/Resources.hpp b/lib/Red/Utils/Resources.hpp index 68c0554..148e72e 100644 --- a/lib/Red/Utils/Resources.hpp +++ b/lib/Red/Utils/Resources.hpp @@ -69,7 +69,7 @@ inline void WaitForResource(const R& aResource, const W& aTimeout) std::unique_lock lock(mutex); std::condition_variable cv; - Red::JobQueue queue; + JobQueue queue; queue.Wait(Trait::GetJobHandle(aResource)); queue.Dispatch([&lock, &cv]() { lock.release(); @@ -92,7 +92,7 @@ inline void WaitForResources(const V& aResources, const W& aTimeout) std::unique_lock lock(mutex); std::condition_variable cv; - Red::JobQueue queue; + JobQueue queue; for (const auto& resource : aResources) { queue.Wait(Trait::GetJobHandle(resource)); diff --git a/src/App/Extensions/GarmentOverride/Module.cpp b/src/App/Extensions/GarmentOverride/Module.cpp index 95826fa..4d479be 100644 --- a/src/App/Extensions/GarmentOverride/Module.cpp +++ b/src/App/Extensions/GarmentOverride/Module.cpp @@ -450,11 +450,14 @@ void App::GarmentOverrideModule::OnRegisterPart(uintptr_t, Red::Handlecomponents, aPart->path); } -uintptr_t App::GarmentOverrideModule::OnProcessGarment(Red::SharedPtr& aProcessor, - uintptr_t a2, uintptr_t a3, Red::Handle& aEntity) +uintptr_t App::GarmentOverrideModule::OnProcessGarment(Red::SharedPtr& aProcessor, uintptr_t a2, + uintptr_t a3, Red::GarmentProcessorParams* aParams) { + if (!aParams) + return Raw::GarmentAssembler::ProcessGarment(aProcessor, a2, a3, aParams); + std::unique_lock _(s_mutex); - if (auto& entityState = s_stateManager->FindEntityState(aEntity)) + if (auto& entityState = s_stateManager->FindEntityState(aParams->entity)) { #ifndef NDEBUG LogDebug("|{}| [event=ProcessGarment entity={}]", ModuleName, entityState->GetName()); @@ -463,9 +466,9 @@ uintptr_t App::GarmentOverrideModule::OnProcessGarment(Red::SharedPtrLinkEntityToAssembler(aEntity, aProcessor); + s_stateManager->LinkEntityToAssembler(aParams->entity, aProcessor); return result; } diff --git a/src/App/Extensions/GarmentOverride/Module.hpp b/src/App/Extensions/GarmentOverride/Module.hpp index 76a8470..c49effd 100644 --- a/src/App/Extensions/GarmentOverride/Module.hpp +++ b/src/App/Extensions/GarmentOverride/Module.hpp @@ -48,7 +48,7 @@ class GarmentOverrideModule : public ConfigurableUnitModule Red::Handle& aComponents, Red::Handle& aAppearance); static uintptr_t OnProcessGarment(Red::SharedPtr& aProcessor, uintptr_t a2, uintptr_t a3, - Red::Handle& aEntity); + Red::GarmentProcessorParams* aParams); static void OnProcessGarmentMesh(Red::GarmentProcessor* aProcessor, uint32_t, Red::Handle& aPartTemplate, Red::SharedPtr>& aMeshToken, diff --git a/src/Red/GarmentAssembler.hpp b/src/Red/GarmentAssembler.hpp index ccb7483..94f0a1d 100644 --- a/src/Red/GarmentAssembler.hpp +++ b/src/Red/GarmentAssembler.hpp @@ -12,6 +12,11 @@ using AppearancePartOverrides = appearance::AppearancePartOverrides; struct GarmentProcessor {}; +struct GarmentProcessorParams +{ + Handle entity; +}; + struct GarmentItemAddRequest { Handle apperance; // 00 @@ -88,9 +93,8 @@ constexpr auto RemoveItem = Core::RawFunc< constexpr auto ProcessGarment = Core::RawFunc< /* addr = */ Red::Addresses::GarmentAssembler_ProcessGarment, - /* type = */ uintptr_t (*)(Red::SharedPtr& aProcessor, - uintptr_t a2, uintptr_t a3, - Red::Handle& aEntity)>(); + /* type = */ uintptr_t (*)(Red::SharedPtr& aProcessor, uintptr_t a2, uintptr_t a3, + Red::GarmentProcessorParams* aParams)>(); constexpr auto ProcessSkinnedMesh = Core::RawFunc< /* addr = */ Red::Addresses::GarmentAssembler_ProcessSkinnedMesh,