1818 */
1919
2020#include <signal.h>
21+ #include <ini.h>
2122#include "common.h"
2223#include "menu.h"
24+ #include "configfile.h"
2325#include "video.h"
2426
2527#define BIOS_PATH "/mnt/Game Boy Advance"
@@ -101,6 +103,11 @@ static char *quick_save_file_extension = "quicksave";
101103char * mRomName = NULL ;
102104char * mRomPath = NULL ;
103105char * quick_save_file = NULL ;
106+ char * console_name ;
107+ char * cfg_file_default = NULL ;
108+ char * cfg_file_rom = NULL ;
109+ static char * cfg_file_default_name = "default_config" ;
110+ static char * cfg_file_extension = "cfg" ;
104111u32 mQuickSaveAndPoweroff = 0 ;
105112
106113
@@ -333,7 +340,7 @@ void parse_cmd_line(int argc, char *argv[])
333340 * slash = 0 ;
334341
335342 /* Rom name without extension */
336- char * point = strrchr ((char * )slash + 1 , '.' );
343+ char * point = strrchr ((char * )slash + 1 , '.' );
337344 * point = 0 ;
338345
339346 /* Set quicksave filename */
@@ -343,6 +350,25 @@ void parse_cmd_line(int argc, char *argv[])
343350 mRomPath , slash + 1 , quick_save_file_extension );
344351 printf ("Quick_save_file: %s\n" , quick_save_file );
345352
353+ /* Set rom cfg filepath */
354+ cfg_file_rom = (char * )malloc (strlen (mRomPath ) + strlen (slash + 1 ) +
355+ strlen (cfg_file_extension ) + 2 + 1 );
356+ sprintf (cfg_file_rom , "%s/%s.%s" ,
357+ mRomPath , slash + 1 , cfg_file_extension );
358+ printf ("cfg_file_rom: %s\n" , cfg_file_rom );
359+
360+ /* Set console cfg filepath */
361+ cfg_file_default = (char * )malloc (strlen (mRomPath ) + strlen (cfg_file_default_name ) +
362+ strlen (cfg_file_extension ) + 2 + 1 );
363+ sprintf (cfg_file_default , "%s/%s.%s" ,
364+ mRomPath , cfg_file_default_name , cfg_file_extension );
365+ printf ("cfg_file_default: %s\n" , cfg_file_default );
366+
367+ /** Load config files */
368+ configfile_load (cfg_file_default );
369+ configfile_load (cfg_file_rom );
370+
371+
346372 fclose (f );
347373 break ;
348374 }
0 commit comments