Skip to content

Commit

Permalink
Update SLH for CTRL+T/Pending load state
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgamerz committed Apr 21, 2021
1 parent 1613d15 commit 063b0fc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
37 changes: 31 additions & 6 deletions SteamingLevelsHUD/StreamingLevelsHUD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ int critNumTicksToFlip = 10; //start
const int critNumTicksToTurnOff = 30;
const int critNumTicksToTurnOn = 30;
BOOL critVisible = true;
bool DrawSLH = true;
bool CanToggleDrawSLH = false;

static void RenderTextSLH(std::wstring msg, const float x, const float y, const char r, const char g, const char b, const float alpha, UCanvas* can)
{
Expand Down Expand Up @@ -63,6 +65,20 @@ void __fastcall HookedPE(UObject* pObject, void* edx, UFunction* pFunction, void
char* funcName = pFunction->GetFullName();
if (strcmp(funcName, "Function SFXGame.BioHUD.PostRender") == 0)
{
// Toggle drawing/not drawing
if ((GetKeyState('T') & 0x8000) && (GetKeyState(VK_CONTROL) & 0x8000)) {
if (CanToggleDrawSLH) {
CanToggleDrawSLH = false; // Will not activate combo again until you re-press combo
DrawSLH = !DrawSLH;
}
}
else
{
if (!(GetKeyState('T') & 0x8000) || !(GetKeyState(VK_CONTROL) & 0x8000)) {
CanToggleDrawSLH = true; // can press key combo again
}
}

currentCritTick++;
if (currentCritTick > critNumTicksToFlip)
{
Expand Down Expand Up @@ -104,7 +120,8 @@ void __fastcall HookedPE(UObject* pObject, void* edx, UFunction* pFunction, void
{
alpha = 0.5;
}
RenderTextSLH(s2ws(string_format("Memory usage: %s (%u bytes)", FormatBytes(pmc.PagefileUsage, str), pmc.PagefileUsage)), 5.0f, 0.0f, r, g, 0, alpha, hud->Canvas);
if (DrawSLH)
RenderTextSLH(s2ws(string_format("Memory usage: %s (%u bytes)", FormatBytes(pmc.PagefileUsage, str), pmc.PagefileUsage)), 5.0f, 0.0f, r, g, 0, alpha, hud->Canvas);


// Max Hit
Expand All @@ -131,12 +148,13 @@ void __fastcall HookedPE(UObject* pObject, void* edx, UFunction* pFunction, void
g = 255;
}

char str2[18] = "";
RenderTextSLH(s2ws(string_format("Max memory hit: %s (%u bytes)", FormatBytes(MaxMemoryHit, str2), MaxMemoryHit)), 5.0f, 12.0f, r, g, 0, 1.0f, hud->Canvas);

if (DrawSLH) {
char str2[18] = "";
RenderTextSLH(s2ws(string_format("Max memory hit: %s (%u bytes)", FormatBytes(MaxMemoryHit, str2), MaxMemoryHit)), 5.0f, 12.0f, r, g, 0, 1.0f, hud->Canvas);
}
}

if (hud->WorldInfo)
if (DrawSLH && hud->WorldInfo)
{
//screenLogger->ClearMessages();
//logger.writeToConsoleOnly(string_format("Number of streaming levels: %d\n", hud->WorldInfo->StreamingLevels.Count), true);
Expand Down Expand Up @@ -176,13 +194,20 @@ void __fastcall HookedPE(UObject* pObject, void* edx, UFunction* pFunction, void
g = 255;
b = 229;
}
else if (sl->bShouldBeLoaded)
else if (sl->bShouldBeLoaded && sl->LoadedLevel)
{
ss << " Loaded";
r = 255;
g = 255;
b = 0;
}
else if (sl->bShouldBeLoaded)
{
ss << " Pending load";
r = 255;
g = 175;
b = 0;
}
const wstring msg = ss.str();
RenderTextSLH(msg, 5, yIndex * 12.0f, r, g, b, 1.0f, hud->Canvas);
yIndex++;
Expand Down
Binary file modified SteamingLevelsHUD/StreamingLevelsHUD.rc
Binary file not shown.
2 changes: 1 addition & 1 deletion SteamingLevelsHUD/resource.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by KismetLogger.rc
// Used by StreamingLevelsHUD.rc

// Next default values for new objects
//
Expand Down

0 comments on commit 063b0fc

Please sign in to comment.