@@ -41,6 +41,8 @@ class GlobalContext {
4141 {
4242 }
4343
44+ using Complete = FullGlobalContext;
45+
4446 static void initializeInstance () noexcept
4547 {
4648 if (!globalContext.isInitialized ()) {
@@ -76,18 +78,17 @@ class GlobalContext {
7678 if (initInProgress)
7779 initCompleteContextFromGameThread ();
7880
79- auto & fullCtx = fullContext ();
80- HookContext hookContext{fullCtx};
81+ HookContext<GlobalContext> hookContext;
8182
8283 if (initInProgress)
8384 finishInit (hookContext);
8485
85- return PeepEventsHookResult{fullCtx .hooks .peepEventsHook .original };
86+ return PeepEventsHookResult{hookContext .hooks () .peepEventsHook .original };
8687 }
8788
8889 [[nodiscard]] std::uint64_t playerPawnSceneObjectUpdater (cs2::C_CSPlayerPawn* entity, void * unknown, bool unknownBool) noexcept
8990 {
90- HookContext hookContext{ fullContext ()} ;
91+ HookContext<GlobalContext> hookContext;
9192 const auto originalReturnValue = hookContext.featuresStates ().visualFeaturesStates .modelGlowState .originalPlayerPawnSceneObjectUpdater (entity, unknown, unknownBool);
9293
9394 auto && playerPawn = hookContext.make <PlayerPawn>(entity);
@@ -101,7 +102,7 @@ class GlobalContext {
101102
102103 [[nodiscard]] std::uint64_t weaponSceneObjectUpdater (cs2::C_CSWeaponBase* weapon, void * unknown, bool unknownBool) noexcept
103104 {
104- HookContext hookContext{ fullContext ()} ;
105+ HookContext<GlobalContext> hookContext;
105106 const auto originalReturnValue = hookContext.featuresStates ().visualFeaturesStates .modelGlowState .originalWeaponSceneObjectUpdater (weapon, unknown, unknownBool);
106107 if (auto && c4 = hookContext.make <BaseWeapon>(weapon).template cast <C4>())
107108 hookContext.make <ModelGlow>().updateInSceneObjectUpdater ()(DroppedBombModelGlow{hookContext}, c4.baseWeapon (), EntityTypeInfo{});
@@ -112,7 +113,7 @@ class GlobalContext {
112113
113114 [[nodiscard]] float getViewmodelFovHook (cs2::ClientModeCSNormal* clientMode) noexcept
114115 {
115- HookContext hookContext{ fullContext ()} ;
116+ HookContext<GlobalContext> hookContext;
116117 const auto originalFov = hookContext.hooks ().originalGetViewmodelFov (clientMode);
117118 if (auto && viewmodelMod = hookContext.template make <ViewmodelMod>(); viewmodelMod.shouldModifyViewmodelFov ())
118119 return viewmodelMod.viewmodelFov ();
@@ -121,7 +122,7 @@ class GlobalContext {
121122
122123 [[nodiscard]] UnloadFlag onRenderStartHook (cs2::CViewRender* viewRender) noexcept
123124 {
124- HookContext hookContext{ fullContext ()} ;
125+ HookContext<GlobalContext> hookContext;
125126 fullContext ().hooks .viewRenderHook .getOriginalOnRenderStart ()(viewRender);
126127 hookContext.make <InWorldPanels>().updateState ();
127128 SoundWatcher<decltype (hookContext)> soundWatcher{fullContext ().soundWatcherState , hookContext};
0 commit comments