forked from Miroirs/x49gp
Compare commits
3 commits
a3b530ec17
...
ef93299925
Author | SHA1 | Date | |
---|---|---|---|
|
ef93299925 | ||
|
042b94516a | ||
|
150615937f |
3 changed files with 78 additions and 56 deletions
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@ TARGET_ALLCAPS = X50NG
|
||||||
|
|
||||||
VERSION_MAJOR = 1
|
VERSION_MAJOR = 1
|
||||||
VERSION_MINOR = 6
|
VERSION_MINOR = 6
|
||||||
PATCHLEVEL = 0
|
PATCHLEVEL = 1
|
||||||
|
|
||||||
INSTALL_PREFIX = /usr/local
|
INSTALL_PREFIX = /usr/local
|
||||||
INSTALL_BINARY_DIR = "$(INSTALL_PREFIX)"/bin
|
INSTALL_BINARY_DIR = "$(INSTALL_PREFIX)"/bin
|
||||||
|
|
|
@ -43,31 +43,48 @@ The third and final group contains two items: *Reset*, which resets the calculat
|
||||||
|
|
||||||
During the first launch, *x50ng* generates a new configuration with default values and empty memory. *x50ng* does not ship with a default firmware, only with the bootloaders for the supported calculators. Hence, the user is required to select a firmware to load into the flash. *x50ng* will show a file selection window for that task. For the stock firmware HP has always used the file extension “.bin”, any other files (including the update.scp files that typically come with them!) are generally not actual firmware files.
|
During the first launch, *x50ng* generates a new configuration with default values and empty memory. *x50ng* does not ship with a default firmware, only with the bootloaders for the supported calculators. Hence, the user is required to select a firmware to load into the flash. *x50ng* will show a file selection window for that task. For the stock firmware HP has always used the file extension “.bin”, any other files (including the update.scp files that typically come with them!) are generally not actual firmware files.
|
||||||
|
|
||||||
When the file selection dialog is cancelled or the file could not be read, *x50ng* creates a flash without firmware; the bootloader will complain and offer ways to correct the situation just like it would on a real device, which include receiving a firmware via USB (currently not available in *x50ng*, see _Caveats_ below) or loading one from the SD card. Apart from these options, it's also possible to recover from this by exiting *x50ng* and either delet‐ ing the flash file or using one of the options *-f* and *-F*, causing *x50ng* to rebuild the flash and ask for a firmware again.
|
When the file selection dialog is cancelled or the file could not be read, *x50ng* creates a flash without firmware; the bootloader will complain and offer ways to correct the situation just like it would on a real device, which include receiving a firmware via USB (currently not available in *x50ng*, see _Caveats_ below) or loading one from the SD card. Apart from these options, it's also possible to recover from this by exiting *x50ng* and either deleting the flash file or using one of the options *-f* and *-F*, causing *x50ng* to rebuild the flash and ask for a firmware again.
|
||||||
|
|
||||||
Please consult HP's manual (for their official firmware) or the documentation of the custom firmware (if using one) for an explanation of using the calculator.
|
Please consult HP's manual (for their official firmware) or the documentation of the custom firmware (if using one) for an explanation of using the calculator.
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
|
||||||
- *-h* *--help* print this message and exit
|
*-h* *--help* print this message and exit
|
||||||
- *--verbose* print out more information
|
*-v* *--version* print out version
|
||||||
- *--datadir*[=_absolute path_] alternate datadir (default: $XDG_CONFIG_HOME/x50ng/)
|
*-V* *--verbose* print out more information
|
||||||
- *--overwrite-config* force writing <datadir>/config.lua even if it exists
|
*-d* *--datadir*[=_absolute path_] alternate datadir (default: $XDG_CONFIG_HOME/x50ng/)
|
||||||
- *--50g* emulate an HP 50g (default)
|
*-n* *--name*[=_name_] set alternate UI name
|
||||||
- *--49gp* emulate an HP 49g+
|
*-s* *--style*[=_filename_] css filename in <datadir> (default: style-50g.css)
|
||||||
- *--newrpl-keyboard* label keyboard for newRPL
|
*-S* *--display-scale*[=_X_] scale LCD by X (default: 2)
|
||||||
- *-n* *--name*[=_name_] set alternate UI name
|
*-r* *--reboot* reboot on startup instead of continuing from the saved state in the state file
|
||||||
- *-s* *--style-filename*[=_filename_] css filename in <datadir> (default: style-<model>.css)
|
*--overwrite-config* force writing <datadir>/config.lua even if it exists
|
||||||
- *-S* *--display-scale*[=_X_] scale LCD by X (default: 2)
|
|
||||||
- *--enable-debug*[=_port_] enable the debugger interface (default port: 1234)
|
*--newrpl-keyboard* label keyboard for newRPL
|
||||||
- *--debug* use along -D to also start the debugger immediately
|
|
||||||
- *--reflash*[=_firmware_] rebuild the flash using the supplied firmware (default: select one interactively) (implies -r for safety reasons)
|
*--enable-debug*[=_port_] enable the debugger interface (default port: 1234)
|
||||||
- *--reflash-full*[=_firmware_] rebuild the flash using the supplied firmware and drop the flash contents in the area beyond the firmware (default: select one interactively) (implies -r for safety reasons)
|
*--debug* use along -D to also start the debugger immediately
|
||||||
- *-r* *--reboot* reboot on startup instead of continuing from the saved state in the state file
|
|
||||||
|
*--reflash*[=_firmware_] rebuild the flash using the supplied firmware (default: select one interactively) (implies -r for safety reasons)
|
||||||
|
*--reflash-full*[=_firmware_] rebuild the flash using the supplied firmware and drop the flash contents in the area beyond the firmware (default: select one interactively) (implies -r for safety reasons)
|
||||||
|
*--50g* use an HP 50g bootloader when (re-)flashing (default)
|
||||||
|
*--49gp* use an HP 49g+ bootloader when (re-)flashing
|
||||||
|
|
||||||
# FILES
|
# FILES
|
||||||
|
|
||||||
All files are located under ~/.config/x50ng/
|
## System-wide
|
||||||
|
|
||||||
|
- *style-50g.css* and *style-49gp.css*
|
||||||
|
|
||||||
|
Default styles provided defining colors and fonts (mostly) for the GUI. The format is CSS as defined by gtk+-3.
|
||||||
|
|
||||||
|
- *firmware/*
|
||||||
|
|
||||||
|
This directory contains a _Makefile_ that will download and extract the following files:
|
||||||
|
- the arm bootloaders [ from _https://www.hpcalc.org/hp49/pc/rom/hp-arm-models-bootloader.zip_ ]
|
||||||
|
- the latest official HP ROM 2.15 [ from _https://www.hpcalc.org/hp49/pc/rom/hp4950v215.zip_ ]
|
||||||
|
- the latest newRPL build [ from _https://hpgcc3.org/downloads/newrplfw.bin_ ]
|
||||||
|
|
||||||
|
## All further files are located under ~/.config/x50ng/
|
||||||
|
|
||||||
- *config.lua*
|
- *config.lua*
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ static char* config_to_string( void )
|
||||||
"name = \"%s\" -- this customize the title of the window\n"
|
"name = \"%s\" -- this customize the title of the window\n"
|
||||||
"model = \"%s\" -- possible values: \"49gp\", \"50g\". Changes the bootloader looked for when (re-)flashing\n"
|
"model = \"%s\" -- possible values: \"49gp\", \"50g\". Changes the bootloader looked for when (re-)flashing\n"
|
||||||
"newrpl_keyboard = %s -- when true this makes the keyboard labels more suited to newRPL use\n"
|
"newrpl_keyboard = %s -- when true this makes the keyboard labels more suited to newRPL use\n"
|
||||||
"style_filename = \"%s\" -- CSS file (relative to this file)\n"
|
"style = \"%s\" -- CSS file (relative to this file)\n"
|
||||||
"display_scale = %i -- integer only\n"
|
"display_scale = %i -- integer only\n"
|
||||||
"verbose = %s\n"
|
"verbose = %s\n"
|
||||||
"--- End of x50ng configuration -----------------------------------------------\n",
|
"--- End of x50ng configuration -----------------------------------------------\n",
|
||||||
|
@ -158,20 +158,21 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
int print_config_and_exit = false;
|
int print_config_and_exit = false;
|
||||||
int overwrite_config = false;
|
int overwrite_config = false;
|
||||||
|
|
||||||
const char* optstring = "hrf:n:s:S:";
|
const char* optstring = "dhrf:n:s:S:vV";
|
||||||
struct option long_options[] = {
|
struct option long_options[] = {
|
||||||
{"help", no_argument, NULL, 'h' },
|
{"help", no_argument, NULL, 'h' },
|
||||||
{"print-config", no_argument, &print_config_and_exit, true},
|
{"version", no_argument, NULL, 'v' },
|
||||||
{"verbose", no_argument, &clopt_verbose, true},
|
{"verbose", no_argument, NULL, 'V' },
|
||||||
|
|
||||||
|
{"print-config", no_argument, &print_config_and_exit, true},
|
||||||
{"overwrite-config", no_argument, &overwrite_config, true},
|
{"overwrite-config", no_argument, &overwrite_config, true},
|
||||||
{"datadir", required_argument, NULL, 1 },
|
{"datadir", required_argument, NULL, 'd' },
|
||||||
|
|
||||||
{"50g", no_argument, NULL, 506 },
|
{"50g", no_argument, NULL, 506 },
|
||||||
{"49gp", no_argument, NULL, 496 },
|
{"49gp", no_argument, NULL, 496 },
|
||||||
{"newrpl-keyboard", no_argument, &clopt_newrpl, true},
|
{"newrpl-keyboard", no_argument, &clopt_newrpl, true},
|
||||||
{"name", required_argument, NULL, 'n' },
|
{"name", required_argument, NULL, 'n' },
|
||||||
{"style-filename", required_argument, NULL, 's' },
|
{"style", required_argument, NULL, 's' },
|
||||||
{"display-scale", required_argument, NULL, 'S' },
|
{"display-scale", required_argument, NULL, 'S' },
|
||||||
|
|
||||||
{"enable-debug", required_argument, NULL, 10 },
|
{"enable-debug", required_argument, NULL, 10 },
|
||||||
|
@ -189,45 +190,34 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
switch ( c ) {
|
switch ( c ) {
|
||||||
case 'h':
|
case 'h':
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"%s %i.%i.%i Emulator for HP 49G+ / 50G calculators\n"
|
"%s %i.%i.%i\n"
|
||||||
|
"Emulator for HP 49G+ / 50G calculators' hardware\n"
|
||||||
"Usage: %s [<options>]\n"
|
"Usage: %s [<options>]\n"
|
||||||
"Valid options:\n"
|
"Valid options:\n"
|
||||||
" -h --help print this message and exit\n"
|
"-h --help print this message and exit\n"
|
||||||
" --verbose print out more information\n"
|
"-v --version print out version\n"
|
||||||
|
"-V --verbose print out more information\n"
|
||||||
|
"-d --datadir[=absolute path] alternate datadir (default: $XDGCONFIGHOME/%s/)\n"
|
||||||
|
"-n --name[=name] set alternate UI name\n"
|
||||||
|
"-s --style[=filename] css filename in <datadir> (default: style-50g.css)\n"
|
||||||
|
"-S --display-scale[=X] scale LCD by X (default: 2)\n"
|
||||||
|
"-r --reboot reboot on startup instead of continuing from the saved state in the state file\n"
|
||||||
|
"--overwrite-config force writing <datadir>/config.lua even if it exists\n"
|
||||||
"\n"
|
"\n"
|
||||||
" --datadir[=<absolute path>] alternate datadir (default: $XDG_CONFIG_HOME/%s/)\n"
|
"--newrpl-keyboard label keyboard for newRPL\n"
|
||||||
"\n"
|
"\n"
|
||||||
" --overwrite-config force writing <datadir>/config.lua even if it exists\n"
|
"--enable-debug[=port] enable the debugger interface (default port: %i)\n"
|
||||||
|
"--debug use along -D to also start the debugger immediately\n"
|
||||||
"\n"
|
"\n"
|
||||||
" --50g emulate an HP 50g (default)\n"
|
"--reflash[=firmware] rebuild the flash using the supplied firmware (default: select one interactively) "
|
||||||
" --49gp emulate an HP 49g+\n"
|
"(implies -r for safety reasons)\n"
|
||||||
" --newrpl-keyboard label keyboard for newRPL\n"
|
"--reflash-full[=firmware] rebuild the flash using the supplied firmware and drop the flash contents in the "
|
||||||
"\n"
|
"area beyond the firmware (default: select one interactively) (implies -r for safety reasons)\n"
|
||||||
" -n --name[=<name>] set alternate UI name\n"
|
"--50g use an HP 50g bootloader when (re-)flashing (default)\n"
|
||||||
" -s --style-filename[=<filename>] css filename in <datadir> (default: style-<model>.css)\n"
|
"--49gp use an HP 49g+ bootloader when (re-)flashing\n",
|
||||||
" -S --display-scale[=<X>] scale LCD by X (default: 2)\n"
|
|
||||||
"\n"
|
|
||||||
" --enable-debug[=<port>] enable the debugger interface\n"
|
|
||||||
" (default port: %u)\n"
|
|
||||||
" --debug use along -D to also start the debugger immediately\n"
|
|
||||||
"\n"
|
|
||||||
" --reflash[=firmware] rebuild the flash using the supplied firmware\n"
|
|
||||||
" (default: select one interactively)\n"
|
|
||||||
" (implies -r for safety reasons)\n"
|
|
||||||
" --reflash-full[=firmware] rebuild the flash using the supplied firmware and drop the flash contents\n"
|
|
||||||
" in the area beyond the firmware\n"
|
|
||||||
" -r --reboot reboot on startup instead of continuing from the\n"
|
|
||||||
" saved state in the state file\n\n",
|
|
||||||
progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, progname, progname, DEFAULT_GDBSTUB_PORT );
|
progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, progname, progname, DEFAULT_GDBSTUB_PORT );
|
||||||
exit( EXIT_SUCCESS );
|
exit( EXIT_SUCCESS );
|
||||||
break;
|
break;
|
||||||
case 'r':
|
|
||||||
if ( opt.reinit < X49GP_REINIT_REBOOT_ONLY )
|
|
||||||
opt.reinit = X49GP_REINIT_REBOOT_ONLY;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
opt.datadir = strdup( optarg );
|
|
||||||
break;
|
|
||||||
case 10:
|
case 10:
|
||||||
do_enable_debugger = true;
|
do_enable_debugger = true;
|
||||||
opt.debug_port = atoi( optarg );
|
opt.debug_port = atoi( optarg );
|
||||||
|
@ -258,15 +248,30 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
if ( clopt_style_filename == NULL )
|
if ( clopt_style_filename == NULL )
|
||||||
clopt_style_filename = "style-50g.css";
|
clopt_style_filename = "style-50g.css";
|
||||||
break;
|
break;
|
||||||
|
case 'd':
|
||||||
|
opt.datadir = strdup( optarg );
|
||||||
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
clopt_name = strdup( optarg );
|
clopt_name = strdup( optarg );
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
if ( opt.reinit < X49GP_REINIT_REBOOT_ONLY )
|
||||||
|
opt.reinit = X49GP_REINIT_REBOOT_ONLY;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
clopt_style_filename = strdup( optarg );
|
clopt_style_filename = strdup( optarg );
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
clopt_display_scale = atoi( optarg );
|
clopt_display_scale = atoi( optarg );
|
||||||
break;
|
break;
|
||||||
|
case 'v':
|
||||||
|
fprintf( stderr, "%i.%i.%i\n", VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL );
|
||||||
|
exit( EXIT_SUCCESS );
|
||||||
|
break;
|
||||||
|
case 'V':
|
||||||
|
clopt_verbose = true;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +314,7 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
lua_getglobal( config_lua_values, "name" );
|
lua_getglobal( config_lua_values, "name" );
|
||||||
opt.name = strdup( luaL_optstring( config_lua_values, -1, opt.name ) );
|
opt.name = strdup( luaL_optstring( config_lua_values, -1, opt.name ) );
|
||||||
|
|
||||||
lua_getglobal( config_lua_values, "style_filename" );
|
lua_getglobal( config_lua_values, "style" );
|
||||||
opt.style_filename = strdup( luaL_optstring( config_lua_values, -1, opt.style_filename ) );
|
opt.style_filename = strdup( luaL_optstring( config_lua_values, -1, opt.style_filename ) );
|
||||||
|
|
||||||
lua_getglobal( config_lua_values, "display_scale" );
|
lua_getglobal( config_lua_values, "display_scale" );
|
||||||
|
|
Loading…
Reference in a new issue