Skip to content

Commit fa57ea3

Browse files
committed
Merge pull request #444 from asarium/feature/benchmark
Add benchmark command line option
2 parents a7bf7c6 + 661678f commit fa57ea3

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

code/cmdline/cmdline.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ Flag exe_params[] =
231231
{ "-profile_frame_time", "Profile engine subsystems", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_frame_timings", },
232232
{ "-profile_write_file", "Write profiling information to file", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_write_file", },
233233
{ "-no_unfocused_pause","Don't pause if the window isn't focused", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_unfocused_pause", },
234+
{ "-benchmark_mode", "Puts the game into benchmark mode", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-benchmark_mode", },
234235
};
235236

236237
// forward declaration
@@ -479,6 +480,8 @@ cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL, AT_NONE); //Cmdline
479480
cmdline_parm frame_profile_arg("-profile_frame_time", NULL, AT_NONE); //Cmdline_frame_profile
480481
cmdline_parm frame_profile_write_file("-profile_write_file", NULL, AT_NONE); // Cmdline_profile_write_file
481482
cmdline_parm no_unfocused_pause_arg("-no_unfocused_pause", NULL, AT_NONE); //Cmdline_no_unfocus_pause
483+
cmdline_parm benchmark_mode_arg("-benchmark_mode", NULL, AT_NONE); //Cmdline_benchmark_mode
484+
482485

483486
char *Cmdline_start_mission = NULL;
484487
int Cmdline_old_collision_sys = 0;
@@ -506,6 +509,7 @@ int Cmdline_reparse_mainhall = 0;
506509
bool Cmdline_frame_profile = false;
507510
bool Cmdline_profile_write_file = false;
508511
bool Cmdline_no_unfocus_pause = false;
512+
bool Cmdline_benchmark_mode = false;
509513

510514
// Other
511515
cmdline_parm get_flags_arg("-get_flags", "Output the launcher flags file", AT_NONE);
@@ -1764,6 +1768,11 @@ bool SetCmdlineParams()
17641768
{
17651769
Cmdline_no_unfocus_pause = true;
17661770
}
1771+
1772+
if (benchmark_mode_arg.found())
1773+
{
1774+
Cmdline_benchmark_mode = true;
1775+
}
17671776

17681777
//Deprecated flags - CommanderDJ
17691778
if( deprecated_spec_arg.found() )

code/cmdline/cmdline.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,6 @@ extern int Cmdline_reparse_mainhall;
161161
extern bool Cmdline_frame_profile;
162162
extern bool Cmdline_profile_write_file;
163163
extern bool Cmdline_no_unfocus_pause;
164+
extern bool Cmdline_benchmark_mode;
164165

165166
#endif

code/freespace2/freespace.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5764,6 +5764,10 @@ void game_leave_state( int old_state, int new_state )
57645764
snd_aav_init();
57655765

57665766
freespace_stop_mission();
5767+
5768+
if (Cmdline_benchmark_mode) {
5769+
gameseq_post_event( GS_EVENT_QUIT_GAME );
5770+
}
57675771
}
57685772
break;
57695773

code/menuui/playermenu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ void player_select_init()
335335
player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
336336
}
337337

338-
if ( (Player_select_num_pilots == 1) && Player_select_input_mode ) {
338+
if (Cmdline_benchmark_mode || ((Player_select_num_pilots == 1) && Player_select_input_mode)) {
339+
// When benchmarking, just accept automatically
339340
Player_select_autoaccept = 1;
340341
}
341342
}

0 commit comments

Comments
 (0)