@@ -72,7 +72,7 @@ namespace plugin {
7272 return nullptr ;
7373 }
7474 logger::info (" old geo ref count before recalc {} {}" , geo->name .c_str (), geo->GetRefCount ());
75- if (geo->GetRefCount () <= 2 ) {
75+ if (geo->GetRefCount () <= 1 ) {
7676 logger::info (" geometry not referenced by anything else" );
7777 return nullptr ;
7878 }
@@ -341,11 +341,12 @@ namespace plugin {
341341 }
342342 }
343343 static auto OriginalFaceApplyMorph =
344- (void (*)(RE ::BSFaceGenManager *, RE ::BSFaceGenNiNode *, RE ::TESNPC *, RE ::BSFixedString *morphName, float relative)) nullptr ;
344+ (uintptr_t (*)(RE ::BSFaceGenManager *, RE ::BSFaceGenNiNode *, RE ::TESNPC *, RE ::BSFixedString *morphName, float relative)) nullptr ;
345345
346- static void FaceApplyMorphHook (RE ::BSFaceGenManager *fg_m, RE ::BSFaceGenNiNode *fg_node, RE ::TESNPC *npc, RE ::BSFixedString *morphName,
346+ static uintptr_t FaceApplyMorphHook (RE ::BSFaceGenManager *fg_m, RE ::BSFaceGenNiNode *fg_node, RE ::TESNPC *npc,
347+ RE ::BSFixedString *morphName,
347348 float relative) {
348- OriginalFaceApplyMorph (fg_m, fg_node, npc, morphName, relative);
349+ uintptr_t retval= OriginalFaceApplyMorph (fg_m, fg_node, npc, morphName, relative);
349350 if (morphName) {
350351 if (fg_node) {
351352 if (npc) {
@@ -360,64 +361,67 @@ namespace plugin {
360361 }
361362 }
362363 }
363- return ;
364+ return retval ;
364365
365366 }
366- static void (*SliderHook)(void *e, float value, uint32_t sliderId) = (void (*)(void *e, float value, uint32_t sliderId)) 0x0;
367- static void SliderHookDetour (void *e, float value, uint32_t sliderId) {
367+ static auto SliderHook = (uintptr_t (*)(void *e, float value, uint32_t sliderId)) 0x0 ;
368+ static uintptr_t SliderHookDetour (void *e, float value, uint32_t sliderId) {
369+ uintptr_t retval = 0x0 ;
368370 {
369371 std::lock_guard<std::recursive_mutex> l (preset_mutex);
370372 applying_slider = true ;
371- SliderHook (e, value, sliderId);
373+ retval= SliderHook (e, value, sliderId);
372374 applying_slider = false ;
373375 }
376+ return retval;
374377 }
375- static void (*ApplyMorphsHookFaceNormalsDetour)(void *e, RE ::TESActorBase *,
376- RE ::BSFaceGenNiNode *) = (void (*)(void *, RE ::TESActorBase *,
378+ static auto ApplyMorphsHookFaceNormalsDetour = (uintptr_t (*)(void *, RE ::TESActorBase *,
377379 RE ::BSFaceGenNiNode *)) 0x0 ;
378- static void ApplyMorphsHookFaceNormals (void *morphInterface, RE ::TESActorBase *base, RE ::BSFaceGenNiNode *node) {
379- ApplyMorphsHookFaceNormalsDetour (morphInterface, base, node);
380+ static uintptr_t ApplyMorphsHookFaceNormals (void *morphInterface, RE ::TESActorBase *base, RE ::BSFaceGenNiNode *node) {
381+ uintptr_t retval = 0x0 ;
382+ retval=ApplyMorphsHookFaceNormalsDetour (morphInterface, base, node);
380383 if (node && GetUserDataFixed (node)) {
381384 if (auto actor = GetUserDataFixed (node)->As <RE ::Actor>()) {
382385 if (actor->Is3DLoaded ()) {
383386 AddActorToRecalculate (actor);
384387 }
385388 }
386389 }
390+ return retval;
387391 }
388- static void (*ApplyMorphHookFaceNormalsDetour)(void *e, RE ::TESNPC *, RE ::BGSHeadPart *,
389- RE ::BSFaceGenNiNode *) = (void (*)(void *e, RE ::TESNPC *, RE ::BGSHeadPart *,
392+ static auto ApplyMorphHookFaceNormalsDetour = (uintptr_t (*)(void *e, RE ::TESNPC *, RE ::BGSHeadPart *,
390393 RE ::BSFaceGenNiNode *)) 0x0 ;
391- static void ApplyMorphHookFaceNormals (void *morphInterface, RE ::TESNPC *npc, RE ::BGSHeadPart *part, RE ::BSFaceGenNiNode *node) {
392- ApplyMorphHookFaceNormalsDetour (morphInterface, npc, part, node);
394+ static uintptr_t ApplyMorphHookFaceNormals (void *morphInterface, RE ::TESNPC *npc, RE ::BGSHeadPart *part, RE ::BSFaceGenNiNode *node) {
395+ uintptr_t retval= ApplyMorphHookFaceNormalsDetour (morphInterface, npc, part, node);
393396 if (node && GetUserDataFixed (node)) {
394397 if (auto actor = GetUserDataFixed (node)->As <RE ::Actor>()) {
395398 if (actor->Is3DLoaded ()) {
396399 AddActorToRecalculate (actor);
397400 }
398401 }
399402 }
403+ return retval;
400404 }
401- static void (*ApplyMorphsHookBodyNormalsDetour)(void *morphInterface, RE ::TESObjectREFR *refr, void *arg2,
402- void *arg3) = (void (*)(void *morphInterface, RE ::TESObjectREFR *refr, void *arg2,void * arg3))nullptr;
403- static void ApplyMorphsHookBodyNormals (void *morphInterface, RE ::TESObjectREFR *refr, void *arg2, void *arg3) {
404- ApplyMorphsHookBodyNormalsDetour (morphInterface, refr, arg2, arg3);
405+ static auto ApplyMorphsHookBodyNormalsDetour = (uintptr_t (*)(void *morphInterface, RE ::TESObjectREFR *refr, void *arg2,void * arg3))nullptr ;
406+ static uintptr_t ApplyMorphsHookBodyNormals (void *morphInterface, RE ::TESObjectREFR *refr, void *arg2, void *arg3) {
407+ uintptr_t retval = ApplyMorphsHookBodyNormalsDetour (morphInterface, refr, arg2, arg3);
405408 if (refr && refr->As <RE ::Actor>()) {
406409 AddActorToRecalculate (refr->As <RE ::Actor>());
407410 }
411+ return retval;
408412 }
409- static void (*UpdateMorphsHook)(void *morphInterface, void * refr,
410- void *arg3) = (void (*)(void *morphInterface,void *refr,
413+ static auto UpdateMorphsHook=(uintptr_t (*)(void *morphInterface,void *refr,
411414 void *arg3)) 0x0 ;
412- static void UpdateMorphsHook_fn (void *morphInterface, void * refr, void * arg3) {
413- UpdateMorphsHook (morphInterface, refr, arg3);
415+ static uintptr_t UpdateMorphsHook_fn (void *morphInterface, void * refr, void * arg3) {
416+ uintptr_t retval= UpdateMorphsHook (morphInterface, refr, arg3);
414417 if (refr) {
415418 if (auto actor = ((RE ::TESObjectREFR *) refr)->As <RE ::Actor>()) {
416419 if (actor->Is3DLoaded ()) {
417420 AddActorToRecalculate (actor);
418421 }
419422 }
420423 }
424+ return retval;
421425 }
422426 void GameEventHandler::onLoad () {
423427 logger::info (" onLoad()" );
@@ -482,36 +486,31 @@ namespace plugin {
482486 memcmp (" BODYTRI" , (void *) ((uintptr_t ) skee64_info.lpBaseOfDll + (uintptr_t ) 0x16b478 ), 7 ) == 0 ) {
483487 UpdateFaceModel = (void (*)(RE ::NiNode *)) REL::Offset (0x3dbda0 ).address ();
484488 NIOVTaskUpdateSkinPartitionvtable = (uint64_t ) skee64_info.lpBaseOfDll + 0x16d118 ;
485- ApplyMorphHookFaceNormalsDetour = (void (*)(void *e, RE ::TESNPC *, RE ::BGSHeadPart *, RE ::BSFaceGenNiNode *))(
489+ ApplyMorphHookFaceNormalsDetour = (uintptr_t (*)(void *e, RE ::TESNPC *, RE ::BGSHeadPart *, RE ::BSFaceGenNiNode *))(
486490 (uint64_t ) skee64_info.lpBaseOfDll + 0x5f480 );
487491 DetourTransactionBegin ();
488492 DetourUpdateThread (GetCurrentThread ());
489493 DetourAttach (&(PVOID &) ApplyMorphHookFaceNormalsDetour, &ApplyMorphHookFaceNormals);
490494 DetourTransactionCommit ();
491495 ApplyMorphsHookFaceNormalsDetour =
492- (void (*)(void *, RE ::TESActorBase *, RE ::BSFaceGenNiNode *))((uint64_t ) skee64_info.lpBaseOfDll + 0x5f9e0 );
496+ (uintptr_t (*)(void *, RE ::TESActorBase *, RE ::BSFaceGenNiNode *))((uint64_t ) skee64_info.lpBaseOfDll + 0x5f9e0 );
493497 DetourTransactionBegin ();
494498 DetourUpdateThread (GetCurrentThread ());
495499 DetourAttach (&(PVOID &) ApplyMorphsHookFaceNormalsDetour, &ApplyMorphsHookFaceNormals);
496500 DetourTransactionCommit ();
497- UpdateMorphsHook = (void (*)(void *, void *, void *))((uint64_t ) skee64_info.lpBaseOfDll + 0x51b0 );
501+ UpdateMorphsHook = (uintptr_t (*)(void *, void *, void *))((uint64_t ) skee64_info.lpBaseOfDll + 0x51b0 );
498502 DetourTransactionBegin ();
499503 DetourUpdateThread (GetCurrentThread ());
500504 DetourAttach (&(PVOID &) UpdateMorphsHook, &UpdateMorphsHook_fn);
501505 DetourTransactionCommit ();
502- OriginalFaceApplyMorph = (void (*)(RE ::BSFaceGenManager *, RE ::BSFaceGenNiNode *, RE ::TESNPC *,
503- RE ::BSFixedString *morphName, float relative)) REL::Offset (0x3d2220 )
504- .address ();
505- DetourTransactionBegin ();
506- DetourUpdateThread (GetCurrentThread ());
507- DetourAttach (&(PVOID &) OriginalFaceApplyMorph, &FaceApplyMorphHook);
508- DetourTransactionCommit ();
509- SliderHook = (void (*)(void *e, float value, uint32_t sliderId))((uint64_t ) skee64_info.lpBaseOfDll + 0x3c810 );
506+
507+ SliderHook = (uintptr_t (*)(void *e, float value, uint32_t sliderId))((uint64_t ) skee64_info.lpBaseOfDll + 0x3c810 );
510508 DetourTransactionBegin ();
511509 DetourUpdateThread (GetCurrentThread ());
512510 DetourAttach (&(PVOID &) SliderHook, &SliderHookDetour);
513511 DetourTransactionCommit ();
514- ApplyMorphsHookBodyNormalsDetour = (void (*)(void *morphInterface, RE ::TESObjectREFR *refr, void *arg2, void *arg3))(
512+ ApplyMorphsHookBodyNormalsDetour = (uintptr_t (*)(void *morphInterface, RE ::TESObjectREFR *refr, void *arg2,
513+ void *arg3))(
515514 (uint64_t ) skee64_info.lpBaseOfDll + 0x73d0 );
516515 DetourTransactionBegin ();
517516 DetourUpdateThread (GetCurrentThread ());
@@ -533,31 +532,25 @@ namespace plugin {
533532
534533 UpdateFaceModel = (void (*)(RE ::NiNode *)) REL::Offset (0x435c50 ).address ();
535534 NIOVTaskUpdateSkinPartitionvtable = (uint64_t ) skee64_info.lpBaseOfDll + 0x1d4c60 ;
536- ApplyMorphHookFaceNormalsDetour = (void (*)(void *e, RE ::TESNPC *, RE ::BGSHeadPart *, RE ::BSFaceGenNiNode *))(
535+ ApplyMorphHookFaceNormalsDetour = (uintptr_t (*)(void *e, RE ::TESNPC *, RE ::BGSHeadPart *, RE ::BSFaceGenNiNode *))(
537536 (uint64_t ) skee64_info.lpBaseOfDll + 0xb9480 );
538537 DetourTransactionBegin ();
539538 DetourUpdateThread (GetCurrentThread ());
540539 DetourAttach (&(PVOID &) ApplyMorphHookFaceNormalsDetour, &ApplyMorphHookFaceNormals);
541540 DetourTransactionCommit ();
542541 ApplyMorphsHookFaceNormalsDetour =
543- (void (*)(void *, RE ::TESActorBase *, RE ::BSFaceGenNiNode *))((uint64_t ) skee64_info.lpBaseOfDll + 0xb9a40 );
542+ (uintptr_t (*)(void *, RE ::TESActorBase *, RE ::BSFaceGenNiNode *))((uint64_t ) skee64_info.lpBaseOfDll + 0xb9a40 );
544543 DetourTransactionBegin ();
545544 DetourUpdateThread (GetCurrentThread ());
546545 DetourAttach (&(PVOID &) ApplyMorphsHookFaceNormalsDetour, &ApplyMorphsHookFaceNormals);
547546 DetourTransactionCommit ();
548- UpdateMorphsHook = (void (*)(void *, void *, void *))((uint64_t ) skee64_info.lpBaseOfDll + 0x167b0 );
547+ UpdateMorphsHook = (uintptr_t (*)(void *, void *, void *))((uint64_t ) skee64_info.lpBaseOfDll + 0x167b0 );
549548 DetourTransactionBegin ();
550549 DetourUpdateThread (GetCurrentThread ());
551550 DetourAttach (&(PVOID &) UpdateMorphsHook, &UpdateMorphsHook_fn);
552551 DetourTransactionCommit ();
553- OriginalFaceApplyMorph = (void (*)(RE ::BSFaceGenManager *, RE ::BSFaceGenNiNode *, RE ::TESNPC *,
554- RE ::BSFixedString *morphName, float relative)) REL::Offset (0x42b610 )
555- .address ();
556- DetourTransactionBegin ();
557- DetourUpdateThread (GetCurrentThread ());
558- DetourAttach (&(PVOID &) OriginalFaceApplyMorph, &FaceApplyMorphHook);
559- DetourTransactionCommit ();
560- ApplyMorphsHookBodyNormalsDetour = (void (*)(void *morphInterface, RE ::TESObjectREFR *refr, void *arg2, void *arg3))(
552+ ApplyMorphsHookBodyNormalsDetour = (uintptr_t (*)(void *morphInterface, RE ::TESObjectREFR *refr, void *arg2,
553+ void *arg3))(
561554 (uint64_t ) skee64_info.lpBaseOfDll + 0x1b890 );
562555 DetourTransactionBegin ();
563556 DetourUpdateThread (GetCurrentThread ());
0 commit comments