Skip to content

Commit

Permalink
Common: Add a frame limiter if vsync is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
julianxhokaxhiu committed Jan 26, 2023
1 parent b91b531 commit d32dbb1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3311,6 +3311,10 @@ void ffnx_inject_driver(struct game_obj* game_object)

void drawFFNxLogo(struct game_obj* game_object)
{
static time_t last_gametime;
time_t gametime;
double framerate = 60.0f;

int frame_count = 180;
int fade_frame_count = frame_count / 3;
float fade = 0.0;
Expand All @@ -3326,6 +3330,11 @@ void drawFFNxLogo(struct game_obj* game_object)
newRenderer.drawFFNxLogo(fade);

common_flip(game_object);

do qpc_get_time(&gametime);
while ((gametime > last_gametime) && qpc_diff_time(&gametime, &last_gametime, NULL) < ((ff7_game_obj*)common_externals.get_game_object())->countspersecond / framerate);

last_gametime = gametime;
}
}

Expand Down

0 comments on commit d32dbb1

Please sign in to comment.