Skip to content

Commit

Permalink
better framing for DISPLAY MODE notif & print FPS on stdout with -fps…
Browse files Browse the repository at this point in the history
… arg
  • Loading branch information
Vincent-FK committed Jan 15, 2021
1 parent 65524b1 commit 987c2fb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frontend/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,13 @@ void do_emu_action(void)
case SACTION_SWITCH_DISPMODE:
aspect_ratio = (aspect_ratio+1)%NB_ASPECT_RATIOS_TYPES;
if(aspect_ratio == ASPECT_RATIOS_TYPE_MANUAL){
//snprintf(hud_msg, sizeof(hud_msg), "DISPLAY MODE: MANUAL ZOOM %d%%", aspect_ratio_factor_percent);
sprintf(shell_cmd, "%s %d \"DISPLAY MODE: MANUAL ZOOM %d%%%%\"",
//snprintf(hud_msg, sizeof(hud_msg), " DISPLAY MODE: ZOOMED %d%%", aspect_ratio_factor_percent);
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: ZOOMED %d%%%%\"",
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, aspect_ratio_factor_percent);
}
else{
//snprintf(hud_msg, sizeof(hud_msg), "DISPLAY MODE: %s", aspect_ratio_name[aspect_ratio]);
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: %s\"",
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: %s\"",
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, aspect_ratio_name[aspect_ratio]);
}
//hud_new_msg = 4;
Expand All @@ -334,9 +334,9 @@ void do_emu_action(void)
else{
aspect_ratio = ASPECT_RATIOS_TYPE_MANUAL;
}
/*snprintf(hud_msg, sizeof(hud_msg), "DISPLAY MODE: MANUAL ZOOM %d%%", aspect_ratio_factor_percent);
/*snprintf(hud_msg, sizeof(hud_msg), " DISPLAY MODE: ZOOMED %d%%", aspect_ratio_factor_percent);
hud_new_msg = 4;*/
sprintf(shell_cmd, "%s %d \"DISPLAY MODE: MANUAL ZOOM %d%%%%\"",
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: ZOOMED %d%%%%\"",
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, aspect_ratio_factor_percent);
fp = popen(shell_cmd, "r");
if (fp == NULL) {
Expand All @@ -353,9 +353,9 @@ void do_emu_action(void)
aspect_ratio = ASPECT_RATIOS_TYPE_MANUAL;
}
aspect_ratio = ASPECT_RATIOS_TYPE_MANUAL;
/*snprintf(hud_msg, sizeof(hud_msg), "DISPLAY MODE: MANUAL ZOOM %d%%", aspect_ratio_factor_percent);
/*snprintf(hud_msg, sizeof(hud_msg), " DISPLAY MODE: ZOOMED %d%%", aspect_ratio_factor_percent);
hud_new_msg = 4;*/
sprintf(shell_cmd, "%s %d \"DISPLAY MODE: MANUAL ZOOM %d%%%%\"",
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: ZOOMED %d%%%%\"",
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, aspect_ratio_factor_percent);
fp = popen(shell_cmd, "r");
if (fp == NULL) {
Expand Down
20 changes: 20 additions & 0 deletions frontend/plugin_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ static void print_fps(int h, int border)
hud_printf(pl_vout_buf, pl_vout_w, border + 2, h - HUD_HEIGHT,
"%2d %4.1f", pl_rearmed_cbs.flips_per_sec,
pl_rearmed_cbs.vsps_cur);

#define PRINT_FPS_AVG 200
#ifdef PRINT_FPS_AVG
static int flip_per_sec_avg = 0;
static float vsps_cur_avg = 0;
static int fps_measurements = 0;

flip_per_sec_avg += pl_rearmed_cbs.flips_per_sec;
vsps_cur_avg += pl_rearmed_cbs.vsps_cur;
fps_measurements++;

if(fps_measurements >= PRINT_FPS_AVG){
printf("FPS=%2d %4.1f\n", flip_per_sec_avg/fps_measurements, vsps_cur_avg/fps_measurements);

flip_per_sec_avg = 0;
vsps_cur_avg = 0;
fps_measurements = 0;
}

#endif //PRINT_FPS_AVG
}

static void print_cpu_usage(int w, int h, int border)
Expand Down

0 comments on commit 987c2fb

Please sign in to comment.