Skip to content

Commit

Permalink
disable frame limiter when the game wishes to
Browse files Browse the repository at this point in the history
  • Loading branch information
Kethen committed Sep 30, 2024
1 parent 0e90d62 commit eefef76
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions s4_league_fps_unlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,13 @@ void __attribute__((thiscall)) patched_game_tick(void *tick_ctx){

static struct time_context tctx;

struct game_context *ctx = fetch_game_context();
LOG_VERBOSE("game context at 0x%08x", (uint32_t)ctx);

bool should_limit = ctx->fps_limiter_toggle != 0;

pthread_mutex_lock(&config_mutex);
if(config.max_framerate > 0){
if(config.max_framerate > 0 && should_limit){
static struct timespec last_tick = {0};
struct timespec this_tick;
clock_gettime(CLOCK_MONOTONIC, &this_tick);
Expand Down Expand Up @@ -788,11 +793,10 @@ void __attribute__((thiscall)) patched_game_tick(void *tick_ctx){
}
pthread_mutex_unlock(&config_mutex);

struct game_context *ctx = fetch_game_context();
LOG_VERBOSE("game context at 0x%08x", (uint32_t)ctx);
uint8_t fps_limiter_toggle_orig = ctx->fps_limiter_toggle;
ctx->fps_limiter_toggle = 0;

orig_game_tick(tick_ctx);
ctx->fps_limiter_toggle = fps_limiter_toggle_orig;

update_time_delta(&tctx);

Expand Down

0 comments on commit eefef76

Please sign in to comment.