forked from Miroirs/x49gp
Compare commits
2 commits
697dadda7d
...
846402e9dc
Author | SHA1 | Date | |
---|---|---|---|
|
846402e9dc | ||
|
93132e2702 |
2 changed files with 6 additions and 13 deletions
|
@ -14,8 +14,7 @@
|
||||||
|
|
||||||
struct options opt = {
|
struct options opt = {
|
||||||
.datadir = NULL,
|
.datadir = NULL,
|
||||||
.config_lua_filename = NULL,
|
|
||||||
.state_filename = NULL,
|
|
||||||
.debug_port = 0,
|
.debug_port = 0,
|
||||||
.start_debugger = false,
|
.start_debugger = false,
|
||||||
.reinit = X49GP_REINIT_NONE,
|
.reinit = X49GP_REINIT_NONE,
|
||||||
|
@ -117,8 +116,6 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
int option_index;
|
int option_index;
|
||||||
int c = '?';
|
int c = '?';
|
||||||
|
|
||||||
char* config_lua_filename = ( char* )"config.lua";
|
|
||||||
|
|
||||||
bool do_enable_debugger = false;
|
bool do_enable_debugger = false;
|
||||||
bool do_start_debugger = false;
|
bool do_start_debugger = false;
|
||||||
bool do_reflash = false;
|
bool do_reflash = false;
|
||||||
|
@ -219,6 +216,7 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
do_reflash = true;
|
do_reflash = true;
|
||||||
|
opt.firmware = strdup( optarg );
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
do_reflash_full = true;
|
do_reflash_full = true;
|
||||||
|
@ -255,14 +253,14 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
opt.datadir = g_build_filename( user_config_dir, progname, NULL );
|
opt.datadir = g_build_filename( user_config_dir, progname, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
opt.config_lua_filename = g_build_filename( opt.datadir, config_lua_filename, NULL );
|
const char* config_lua_filename = g_build_filename( opt.datadir, "config.lua", NULL );
|
||||||
|
|
||||||
opt.state_filename = g_build_filename( opt.datadir, "state", NULL );
|
opt.state_filename = g_build_filename( opt.datadir, "state", NULL );
|
||||||
|
|
||||||
/**********************/
|
/**********************/
|
||||||
/* 1. read config.lua */
|
/* 1. read config.lua */
|
||||||
/**********************/
|
/**********************/
|
||||||
bool haz_config_file = config_read( opt.config_lua_filename );
|
bool haz_config_file = config_read( config_lua_filename );
|
||||||
if ( haz_config_file ) {
|
if ( haz_config_file ) {
|
||||||
lua_getglobal( config_lua_values, "newrpl_keyboard" );
|
lua_getglobal( config_lua_values, "newrpl_keyboard" );
|
||||||
opt.newrpl = lua_toboolean( config_lua_values, -1 );
|
opt.newrpl = lua_toboolean( config_lua_values, -1 );
|
||||||
|
@ -325,9 +323,9 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
print_config();
|
print_config();
|
||||||
|
|
||||||
if ( !haz_config_file ) {
|
if ( !haz_config_file ) {
|
||||||
fprintf( stderr, "\nConfiguration file %s doesn't seem to exist or is invalid!\n", opt.config_lua_filename );
|
fprintf( stderr, "\nConfiguration file %s doesn't seem to exist or is invalid!\n", config_lua_filename );
|
||||||
fprintf( stderr, "You can solve this by running `mkdir -p %s/ && %s --print-config >> %s`\n\n", opt.datadir, progname,
|
fprintf( stderr, "You can solve this by running `mkdir -p %s/ && %s --print-config >> %s`\n\n", opt.datadir, progname,
|
||||||
opt.config_lua_filename );
|
config_lua_filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( do_enable_debugger ) {
|
if ( do_enable_debugger ) {
|
||||||
|
@ -340,10 +338,6 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
if ( opt.reinit < X49GP_REINIT_FLASH )
|
if ( opt.reinit < X49GP_REINIT_FLASH )
|
||||||
opt.reinit = X49GP_REINIT_FLASH;
|
opt.reinit = X49GP_REINIT_FLASH;
|
||||||
|
|
||||||
if ( opt.firmware != NULL )
|
|
||||||
fprintf( stderr, "Additional firmware file \"%s\" specified, overriding\n", optarg );
|
|
||||||
opt.firmware = optarg;
|
|
||||||
|
|
||||||
if ( do_reflash_full )
|
if ( do_reflash_full )
|
||||||
opt.reinit = X49GP_REINIT_FLASH_FULL;
|
opt.reinit = X49GP_REINIT_FLASH_FULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ struct options {
|
||||||
char* font;
|
char* font;
|
||||||
int display_scale;
|
int display_scale;
|
||||||
int font_size;
|
int font_size;
|
||||||
char* config_lua_filename;
|
|
||||||
bool verbose;
|
bool verbose;
|
||||||
|
|
||||||
char* datadir;
|
char* datadir;
|
||||||
|
|
Loading…
Reference in a new issue