Skip to content

Commit 987c2fb

Browse files
committed
better framing for DISPLAY MODE notif & print FPS on stdout with -fps arg
1 parent 65524b1 commit 987c2fb

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

frontend/main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,13 @@ void do_emu_action(void)
310310
case SACTION_SWITCH_DISPMODE:
311311
aspect_ratio = (aspect_ratio+1)%NB_ASPECT_RATIOS_TYPES;
312312
if(aspect_ratio == ASPECT_RATIOS_TYPE_MANUAL){
313-
//snprintf(hud_msg, sizeof(hud_msg), "DISPLAY MODE: MANUAL ZOOM %d%%", aspect_ratio_factor_percent);
314-
sprintf(shell_cmd, "%s %d \"DISPLAY MODE: MANUAL ZOOM %d%%%%\"",
313+
//snprintf(hud_msg, sizeof(hud_msg), " DISPLAY MODE: ZOOMED %d%%", aspect_ratio_factor_percent);
314+
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: ZOOMED %d%%%%\"",
315315
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, aspect_ratio_factor_percent);
316316
}
317317
else{
318318
//snprintf(hud_msg, sizeof(hud_msg), "DISPLAY MODE: %s", aspect_ratio_name[aspect_ratio]);
319-
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: %s\"",
319+
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: %s\"",
320320
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, aspect_ratio_name[aspect_ratio]);
321321
}
322322
//hud_new_msg = 4;
@@ -334,9 +334,9 @@ void do_emu_action(void)
334334
else{
335335
aspect_ratio = ASPECT_RATIOS_TYPE_MANUAL;
336336
}
337-
/*snprintf(hud_msg, sizeof(hud_msg), "DISPLAY MODE: MANUAL ZOOM %d%%", aspect_ratio_factor_percent);
337+
/*snprintf(hud_msg, sizeof(hud_msg), " DISPLAY MODE: ZOOMED %d%%", aspect_ratio_factor_percent);
338338
hud_new_msg = 4;*/
339-
sprintf(shell_cmd, "%s %d \"DISPLAY MODE: MANUAL ZOOM %d%%%%\"",
339+
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: ZOOMED %d%%%%\"",
340340
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, aspect_ratio_factor_percent);
341341
fp = popen(shell_cmd, "r");
342342
if (fp == NULL) {
@@ -353,9 +353,9 @@ void do_emu_action(void)
353353
aspect_ratio = ASPECT_RATIOS_TYPE_MANUAL;
354354
}
355355
aspect_ratio = ASPECT_RATIOS_TYPE_MANUAL;
356-
/*snprintf(hud_msg, sizeof(hud_msg), "DISPLAY MODE: MANUAL ZOOM %d%%", aspect_ratio_factor_percent);
356+
/*snprintf(hud_msg, sizeof(hud_msg), " DISPLAY MODE: ZOOMED %d%%", aspect_ratio_factor_percent);
357357
hud_new_msg = 4;*/
358-
sprintf(shell_cmd, "%s %d \"DISPLAY MODE: MANUAL ZOOM %d%%%%\"",
358+
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: ZOOMED %d%%%%\"",
359359
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, aspect_ratio_factor_percent);
360360
fp = popen(shell_cmd, "r");
361361
if (fp == NULL) {

frontend/plugin_lib.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,26 @@ static void print_fps(int h, int border)
111111
hud_printf(pl_vout_buf, pl_vout_w, border + 2, h - HUD_HEIGHT,
112112
"%2d %4.1f", pl_rearmed_cbs.flips_per_sec,
113113
pl_rearmed_cbs.vsps_cur);
114+
115+
#define PRINT_FPS_AVG 200
116+
#ifdef PRINT_FPS_AVG
117+
static int flip_per_sec_avg = 0;
118+
static float vsps_cur_avg = 0;
119+
static int fps_measurements = 0;
120+
121+
flip_per_sec_avg += pl_rearmed_cbs.flips_per_sec;
122+
vsps_cur_avg += pl_rearmed_cbs.vsps_cur;
123+
fps_measurements++;
124+
125+
if(fps_measurements >= PRINT_FPS_AVG){
126+
printf("FPS=%2d %4.1f\n", flip_per_sec_avg/fps_measurements, vsps_cur_avg/fps_measurements);
127+
128+
flip_per_sec_avg = 0;
129+
vsps_cur_avg = 0;
130+
fps_measurements = 0;
131+
}
132+
133+
#endif //PRINT_FPS_AVG
114134
}
115135

116136
static void print_cpu_usage(int w, int h, int border)

0 commit comments

Comments
 (0)