forked from Miroirs/x49gp
Compare commits
No commits in common. "2e9954e57cb7d63f6dbe1be02b32dc401f88a830" and "205bd7213cd8ff33487e6e1bae454336b05ff0f4" have entirely different histories.
2e9954e57c
...
205bd7213c
4 changed files with 30 additions and 36 deletions
|
@ -55,19 +55,19 @@ Please consult HP's manual (for their official firmware) or the documentation of
|
|||
*-d* *--datadir*[=_absolute path_] alternate datadir (default: $XDG_CONFIG_HOME/x50ng/)
|
||||
*-n* *--name*[=_name_] set alternate UI name
|
||||
*-s* *--style*[=_filename_] css filename in <datadir> (default: style-50g.css)
|
||||
*-z* *--zoom*[=_X_] scale LCD by X (default: 2)
|
||||
*-r* *--reset* reboot on startup instead of continuing from the saved state in the state file
|
||||
*--overwrite-config* force writing <datadir>/config.lua even if it exists
|
||||
*-S* *--display-scale*[=_X_] scale LCD by X (default: 2)
|
||||
*-r* *--reboot* reboot on startup instead of continuing from the saved state in the state file
|
||||
*--overwrite-config* force writing <datadir>/config.lua even if it exists
|
||||
|
||||
*--newrpl-keyboard* label keyboard for newRPL
|
||||
*--newrpl-keyboard* label keyboard for newRPL
|
||||
|
||||
*--enable-debug*[=_port_] enable the debugger interface (default port: 1234)
|
||||
*--debug* use along -D to also start the debugger immediately
|
||||
*--enable-debug*[=_port_] enable the debugger interface (default port: 1234)
|
||||
*--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)
|
||||
*--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
|
||||
*--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
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
#include <glib.h>
|
||||
|
||||
|
@ -27,7 +26,7 @@ struct options opt = {
|
|||
.name = NULL,
|
||||
.verbose = false,
|
||||
.style_filename = NULL,
|
||||
.zoom = 2,
|
||||
.display_scale = 2,
|
||||
};
|
||||
|
||||
lua_State* config_lua_values;
|
||||
|
@ -99,10 +98,10 @@ static char* config_to_string( void )
|
|||
"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"
|
||||
"style = \"%s\" -- CSS file (relative to this file)\n"
|
||||
"zoom = %i -- integer only\n"
|
||||
"display_scale = %i -- integer only\n"
|
||||
"verbose = %s\n"
|
||||
"--- End of x50ng configuration -----------------------------------------------\n",
|
||||
opt.name, opt.model == MODEL_50G ? "50g" : "49gp", opt.newrpl ? "true" : "false", opt.style_filename, opt.zoom,
|
||||
opt.name, opt.model == MODEL_50G ? "50g" : "49gp", opt.newrpl ? "true" : "false", opt.style_filename, opt.display_scale,
|
||||
opt.verbose ? "true" : "false" );
|
||||
|
||||
return config;
|
||||
|
@ -154,12 +153,12 @@ void config_init( char* progname, int argc, char* argv[] )
|
|||
char* clopt_style_filename = NULL;
|
||||
int clopt_model = -1;
|
||||
int clopt_newrpl = -1;
|
||||
int clopt_zoom = -1;
|
||||
int clopt_display_scale = -1;
|
||||
|
||||
int print_config_and_exit = false;
|
||||
int overwrite_config = false;
|
||||
|
||||
const char* optstring = "dhrf:n:s:S:vVz:";
|
||||
const char* optstring = "dhrf:n:s:S:vV";
|
||||
struct option long_options[] = {
|
||||
{"help", no_argument, NULL, 'h' },
|
||||
{"version", no_argument, NULL, 'v' },
|
||||
|
@ -174,15 +173,13 @@ void config_init( char* progname, int argc, char* argv[] )
|
|||
{"newrpl-keyboard", no_argument, &clopt_newrpl, true},
|
||||
{"name", required_argument, NULL, 'n' },
|
||||
{"style", required_argument, NULL, 's' },
|
||||
{"display-scale", required_argument, NULL, 'S' }, /* deprecated */
|
||||
{"zoom", required_argument, NULL, 'z' },
|
||||
{"display-scale", required_argument, NULL, 'S' },
|
||||
|
||||
{"enable-debug", required_argument, NULL, 10 },
|
||||
{"debug", no_argument, NULL, 11 },
|
||||
{"reflash", required_argument, NULL, 90 },
|
||||
{"reflash-full", required_argument, NULL, 91 },
|
||||
{"reboot", no_argument, NULL, 'r' }, /* deprecated */
|
||||
{"reset", no_argument, NULL, 'r' },
|
||||
{"reboot", no_argument, NULL, 'r' },
|
||||
|
||||
{0, 0, 0, 0 }
|
||||
};
|
||||
|
@ -203,8 +200,8 @@ void config_init( char* progname, int argc, char* argv[] )
|
|||
"-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 --zoom[=X] scale LCD by X (default: 2)\n"
|
||||
"-r --reset reboot on startup instead of continuing from the saved state in the state file\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"
|
||||
"--newrpl-keyboard label keyboard for newRPL\n"
|
||||
|
@ -265,7 +262,7 @@ void config_init( char* progname, int argc, char* argv[] )
|
|||
clopt_style_filename = strdup( optarg );
|
||||
break;
|
||||
case 'S':
|
||||
clopt_zoom = atoi( optarg );
|
||||
clopt_display_scale = atoi( optarg );
|
||||
break;
|
||||
case 'v':
|
||||
fprintf( stderr, "%i.%i.%i\n", VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL );
|
||||
|
@ -320,11 +317,8 @@ void config_init( char* progname, int argc, char* argv[] )
|
|||
lua_getglobal( config_lua_values, "style" );
|
||||
opt.style_filename = strdup( luaL_optstring( config_lua_values, -1, opt.style_filename ) );
|
||||
|
||||
lua_getglobal( config_lua_values, "zoom" );
|
||||
opt.zoom = luaL_optinteger( config_lua_values, -1, opt.zoom );
|
||||
|
||||
lua_getglobal( config_lua_values, "zoom" );
|
||||
opt.zoom = luaL_optinteger( config_lua_values, -1, opt.zoom );
|
||||
lua_getglobal( config_lua_values, "display_scale" );
|
||||
opt.display_scale = luaL_optinteger( config_lua_values, -1, opt.display_scale );
|
||||
}
|
||||
if ( opt.haz_config_file && overwrite_config )
|
||||
opt.haz_config_file = false;
|
||||
|
@ -342,8 +336,8 @@ void config_init( char* progname, int argc, char* argv[] )
|
|||
opt.model = clopt_model;
|
||||
if ( clopt_newrpl != -1 )
|
||||
opt.newrpl = clopt_newrpl;
|
||||
if ( clopt_zoom > 0 )
|
||||
opt.zoom = clopt_zoom;
|
||||
if ( clopt_display_scale > 0 )
|
||||
opt.display_scale = clopt_display_scale;
|
||||
|
||||
if ( print_config_and_exit ) {
|
||||
fprintf( stdout, config_to_string() );
|
||||
|
|
|
@ -33,7 +33,7 @@ struct options {
|
|||
bool newrpl;
|
||||
char* name;
|
||||
|
||||
int zoom;
|
||||
int display_scale;
|
||||
char* style_filename;
|
||||
bool verbose;
|
||||
bool haz_config_file;
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
#define KB_NB_ROWS 10
|
||||
|
||||
#define LCD_WIDTH ( 131 * opt.zoom )
|
||||
#define LCD_HEIGHT ( 80 * opt.zoom )
|
||||
#define LCD_WIDTH ( 131 * opt.display_scale )
|
||||
#define LCD_HEIGHT ( 80 * opt.display_scale )
|
||||
|
||||
static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
|
||||
{.css_class = "menu",
|
||||
|
@ -1747,9 +1747,9 @@ void gui_update_lcd( x49gp_t* x49gp )
|
|||
gtk_widget_set_opacity( ui->ui_ann_busy, x49gp_get_pixel_color( lcd, 131, 5 ) );
|
||||
gtk_widget_set_opacity( ui->ui_ann_io, x49gp_get_pixel_color( lcd, 131, 0 ) );
|
||||
|
||||
for ( int y = 0; y < ( LCD_HEIGHT / opt.zoom ); y++ )
|
||||
for ( int x = 0; x < ( LCD_WIDTH / opt.zoom ); x++ )
|
||||
_draw_pixel( ui->lcd_surface, opt.zoom * x, opt.zoom * y, opt.zoom, opt.zoom,
|
||||
for ( int y = 0; y < ( LCD_HEIGHT / opt.display_scale ); y++ )
|
||||
for ( int x = 0; x < ( LCD_WIDTH / opt.display_scale ); x++ )
|
||||
_draw_pixel( ui->lcd_surface, opt.display_scale * x, opt.display_scale * y, opt.display_scale, opt.display_scale,
|
||||
&( ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, x, y ) ] ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue