Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

rpc: get fps from 'host_framerate' if enabled #426

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BunnymodXT/cvars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
X(sv_bounce) \
X(fps_max) \
X(default_fov) \
X(skill)
X(skill) \
X(host_framerate)

#define DEFINE_CVARS(X) \
X(_bxt_taslog, "0") \
Expand Down
12 changes: 10 additions & 2 deletions BunnymodXT/discord_integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ namespace discord_integration
skillName = "";
}

snprintf(buffer_state, sizeof(buffer_state), "%s | FPS: %.1f | %s", state.c_str(), CVars::fps_max.GetFloat(), skillName);
if (CVars::host_framerate.GetFloat() > 0.0f)
snprintf(buffer_state, sizeof(buffer_state), "%s | FPS (HFR): %.1f | %s", state.c_str(), 1.0f / CVars::host_framerate.GetFloat(), skillName);
else
snprintf(buffer_state, sizeof(buffer_state), "%s | FPS: %.1f | %s", state.c_str(), CVars::fps_max.GetFloat(), skillName);
presence.state = buffer_state;

if (CustomHud::GetCountingTime())
Expand Down Expand Up @@ -426,7 +429,12 @@ namespace discord_integration
rpc_initialized = true;
}

float FPS_current = CVars::fps_max.GetFloat();
float FPS_current;
if (CVars::host_framerate.GetFloat() > 0.0f)
FPS_current = CVars::host_framerate.GetFloat();
else
FPS_current = CVars::fps_max.GetFloat();

static float FPS_previous = FPS_current;

if (FPS_current != FPS_previous)
Expand Down
1 change: 1 addition & 0 deletions BunnymodXT/modules/HwDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4625,6 +4625,7 @@ void HwDLL::RegisterCVarsAndCommandsIfNeeded()
CVars::fps_max.Assign(FindCVar("fps_max"));
CVars::default_fov.Assign(FindCVar("default_fov"));
CVars::skill.Assign(FindCVar("skill"));
CVars::host_framerate.Assign(FindCVar("host_framerate"));

FindCVarsIfNeeded();

Expand Down