Skip to content

Commit

Permalink
Fix font loading, Fix PS2Inator running after chams, Turn on Warnings
Browse files Browse the repository at this point in the history
Also adds an unused CL_DispatchSound hook
  • Loading branch information
Viceroyy committed Aug 6, 2024
1 parent 75613fe commit ebc5d38
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Fusion/Fusion.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAVX2|x64'">
<ClCompile>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>false</SDLCheck>
Expand Down
3 changes: 3 additions & 0 deletions Fusion/src/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ void CCore::Load()
F::EventListener.Setup({ "item_pickup" });

F::Configs.LoadConfig(F::Configs.sCurrentConfig, false);

Sleep(150);

H::Fonts.Reload();
F::Menu.ConfigLoaded = true;

Expand Down
42 changes: 42 additions & 0 deletions Fusion/src/Hooks/CL_DispatchSound.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// We use S_StartDynamicSound for the far esp, I did this because I was bored, also the origin pos seems to be wrong here
#include "../SDK/SDK.h"

struct SoundInfo_t
{
int nSequenceNumber;
int nEntityIndex;
int nChannel;
const char* pszName; // UNDONE: Make this a FilenameHandle_t to avoid bugs with arrays of these
Vector vOrigin;
Vector vDirection;
float fVolume;
soundlevel_t Soundlevel;
bool bLooping;
int nPitch;
int nSpecialDSP;
Vector vListenerOrigin;
int nFlags;
int nSoundNum;
float fDelay;
bool bIsSentence;
bool bIsAmbient;
int nSpeakerEntity;
};

MAKE_SIGNATURE(CL_DispatchSound, "engine.dll", "48 8B C4 48 89 78 ? 55 48 8D 68", 0x0);

MAKE_HOOK(CL_DispatchSound, S::CL_DispatchSound(), int, __fastcall,
const SoundInfo_t& sound)
{
if (sound.nEntityIndex <= 0)
return CALL_ORIGINAL(sound);

Vector vOrigin = sound.vOrigin;
const int iEntIndex = sound.nEntityIndex;
auto pEntity = I::ClientEntityList->GetClientEntity(iEntIndex);

if (pEntity && iEntIndex != I::EngineClient->GetLocalPlayer() && pEntity->IsDormant() && pEntity->GetClassID() == ETFClassID::CTFPlayer)
G::DormancyMap[iEntIndex] = { vOrigin, I::EngineClient->Time() };

return CALL_ORIGINAL(sound);
}
8 changes: 4 additions & 4 deletions Fusion/src/Hooks/ModelRender_DrawModelExecute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ MAKE_HOOK(ModelRender_DrawModelExecute, U::Memory.GetVFunc(I::ModelRender, 19),
if (Vars::Visuals::Removals::Cosmetics.Value && pEntity && pEntity->GetClassID() == ETFClassID::CTFWearable)
return;

if (Vars::Visuals::Other::ThePS2Inator.Value)
*const_cast<int*>(&pState.m_lod) = 7;

if (F::Chams.bRendering)
return F::Chams.RenderHandler(pState, pInfo, pBoneToWorld);
if (F::Glow.bRendering)
Expand All @@ -41,9 +44,6 @@ MAKE_HOOK(ModelRender_DrawModelExecute, U::Memory.GetVFunc(I::ModelRender, 19),
return;
}

if (Vars::Visuals::Other::ThePS2Inator.Value)
*const_cast<int*>(&pState.m_lod) = 7;

CALL_ORIGINAL(ecx, pState, pInfo, pBoneToWorld);
}

Expand All @@ -53,7 +53,7 @@ MAKE_HOOK(CBaseAnimating_DrawModel, S::CBaseAnimating_DrawModel(), int, __fastca
static const auto dwDrawModel = S::ViewmodelAttachment_DrawModel();
const auto dwRetAddr = std::uintptr_t(_ReturnAddress());

if (Vars::Visuals::UI::CleanScreenshots.Value && I::EngineClient->IsTakingScreenshot() || G::Unload)
if (I::EngineVGui->IsGameUIVisible() || Vars::Visuals::UI::CleanScreenshots.Value && I::EngineClient->IsTakingScreenshot() || G::Unload)
return CALL_ORIGINAL(ecx, flags);

if (dwRetAddr == dwDrawModel && flags & STUDIO_RENDER)
Expand Down

0 comments on commit ebc5d38

Please sign in to comment.