@@ -33,8 +33,8 @@ config_params_s config_initialize(char *filename) {
3333 c .idle_ms = 10 ; // default to high performance
3434 c .wait_for_device = 1 ; // default to exit if device disconnected
3535 c .wait_packets = 256 ; // amount of empty command queue reads before assuming device disconnected
36- c .audio_enabled = 0 ; // route M8 audio to default output
37- c .audio_buffer_size = 0 ; // requested audio buffer size in samples: 0 = let SDL decide
36+ c .audio_enabled = 0 ; // route M8 audio to default output
37+ c .audio_buffer_size = 0 ; // requested audio buffer size in samples: 0 = let SDL decide
3838 c .audio_device_name = NULL ; // Use this device, leave NULL to use the default output device
3939
4040 c .key_up = SDL_SCANCODE_UP ;
@@ -56,6 +56,7 @@ config_params_s config_initialize(char *filename) {
5656 c .key_jazz_inc_velocity = SDL_SCANCODE_KP_MINUS ;
5757 c .key_jazz_dec_velocity = SDL_SCANCODE_KP_PLUS ;
5858 c .key_toggle_audio = SDL_SCANCODE_F12 ;
59+ c .key_toggle_log = SDL_SCANCODE_GRAVE ; // default to ` key
5960
6061 c .gamepad_up = SDL_GAMEPAD_BUTTON_DPAD_UP ;
6162 c .gamepad_left = SDL_GAMEPAD_BUTTON_DPAD_LEFT ;
@@ -90,8 +91,8 @@ void write_config(const config_params_s *conf) {
9091
9192 SDL_Log ("Writing config file to %s" , config_path );
9293
93- #define INI_LINE_COUNT 50
94- #define INI_LINE_LENGTH 50
94+ #define INI_LINE_COUNT 51
95+ #define INI_LINE_LENGTH 50
9596
9697 // Entries for the config file
9798 char ini_values [INI_LINE_COUNT ][INI_LINE_LENGTH ];
@@ -108,11 +109,13 @@ void write_config(const config_params_s *conf) {
108109 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "[audio]\n" );
109110 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "audio_enabled=%s\n" ,
110111 conf -> audio_enabled ? "true" : "false" );
111- snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "audio_buffer_size=%d\n" , conf -> audio_buffer_size );
112+ snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "audio_buffer_size=%d\n" ,
113+ conf -> audio_buffer_size );
112114 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "audio_device_name=%s\n" ,
113115 conf -> audio_device_name ? conf -> audio_device_name : "Default" );
114116 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "[keyboard]\n" );
115- snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , ";Ref: https://wiki.libsdl.org/SDL2/SDL_Scancode\n" );
117+ snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH ,
118+ ";Ref: https://wiki.libsdl.org/SDL2/SDL_Scancode\n" );
116119 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "key_up=%d\n" , conf -> key_up );
117120 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "key_left=%d\n" , conf -> key_left );
118121 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "key_down=%d\n" , conf -> key_down );
@@ -135,7 +138,9 @@ void write_config(const config_params_s *conf) {
135138 conf -> key_jazz_inc_velocity );
136139 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "key_jazz_dec_velocity=%d\n" ,
137140 conf -> key_jazz_dec_velocity );
138- snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "key_toggle_audio=%d\n" , conf -> key_toggle_audio );
141+ snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "key_toggle_audio=%d\n" ,
142+ conf -> key_toggle_audio );
143+ snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "key_toggle_log=%d\n" , conf -> key_toggle_log );
139144 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "[gamepad]\n" );
140145 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "gamepad_up=%d\n" , conf -> gamepad_up );
141146 snprintf (ini_values [initPointer ++ ], INI_LINE_LENGTH , "gamepad_left=%d\n" , conf -> gamepad_left );
@@ -285,6 +290,7 @@ void read_key_config(const ini_t *ini, config_params_s *conf) {
285290 const char * key_jazz_inc_velocity = ini_get (ini , "keyboard" , "key_jazz_inc_velocity" );
286291 const char * key_jazz_dec_velocity = ini_get (ini , "keyboard" , "key_jazz_dec_velocity" );
287292 const char * key_toggle_audio = ini_get (ini , "keyboard" , "key_toggle_audio" );
293+ const char * key_toggle_log = ini_get (ini , "keyboard" , "key_toggle_log" );
288294
289295 if (key_up )
290296 conf -> key_up = SDL_atoi (key_up );
@@ -324,6 +330,8 @@ void read_key_config(const ini_t *ini, config_params_s *conf) {
324330 conf -> key_jazz_dec_velocity = SDL_atoi (key_jazz_dec_velocity );
325331 if (key_toggle_audio )
326332 conf -> key_toggle_audio = SDL_atoi (key_toggle_audio );
333+ if (key_toggle_log )
334+ conf -> key_toggle_log = SDL_atoi (key_toggle_log );
327335}
328336
329337void read_gamepad_config (const ini_t * ini , config_params_s * conf ) {
0 commit comments