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/)
|
*-d* *--datadir*[=_absolute path_] alternate datadir (default: $XDG_CONFIG_HOME/x50ng/)
|
||||||
*-n* *--name*[=_name_] set alternate UI name
|
*-n* *--name*[=_name_] set alternate UI name
|
||||||
*-s* *--style*[=_filename_] css filename in <datadir> (default: style-50g.css)
|
*-s* *--style*[=_filename_] css filename in <datadir> (default: style-50g.css)
|
||||||
*-z* *--zoom*[=_X_] scale LCD by X (default: 2)
|
*-S* *--display-scale*[=_X_] scale LCD by X (default: 2)
|
||||||
*-r* *--reset* reboot on startup instead of continuing from the saved state in the state file
|
*-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
|
*--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)
|
*--enable-debug*[=_port_] enable the debugger interface (default port: 1234)
|
||||||
*--debug* use along -D to also start the debugger immediately
|
*--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*[=_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)
|
*--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)
|
*--50g* use an HP 50g bootloader when (re-)flashing (default)
|
||||||
*--49gp* use an HP 49g+ bootloader when (re-)flashing
|
*--49gp* use an HP 49g+ bootloader when (re-)flashing
|
||||||
|
|
||||||
# FILES
|
# FILES
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ struct options opt = {
|
||||||
.name = NULL,
|
.name = NULL,
|
||||||
.verbose = false,
|
.verbose = false,
|
||||||
.style_filename = NULL,
|
.style_filename = NULL,
|
||||||
.zoom = 2,
|
.display_scale = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
lua_State* config_lua_values;
|
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"
|
"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 = \"%s\" -- CSS file (relative to this file)\n"
|
"style = \"%s\" -- CSS file (relative to this file)\n"
|
||||||
"zoom = %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",
|
||||||
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" );
|
opt.verbose ? "true" : "false" );
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
@ -154,12 +153,12 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
char* clopt_style_filename = NULL;
|
char* clopt_style_filename = NULL;
|
||||||
int clopt_model = -1;
|
int clopt_model = -1;
|
||||||
int clopt_newrpl = -1;
|
int clopt_newrpl = -1;
|
||||||
int clopt_zoom = -1;
|
int clopt_display_scale = -1;
|
||||||
|
|
||||||
int print_config_and_exit = false;
|
int print_config_and_exit = false;
|
||||||
int overwrite_config = 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[] = {
|
struct option long_options[] = {
|
||||||
{"help", no_argument, NULL, 'h' },
|
{"help", no_argument, NULL, 'h' },
|
||||||
{"version", no_argument, NULL, 'v' },
|
{"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},
|
{"newrpl-keyboard", no_argument, &clopt_newrpl, true},
|
||||||
{"name", required_argument, NULL, 'n' },
|
{"name", required_argument, NULL, 'n' },
|
||||||
{"style", required_argument, NULL, 's' },
|
{"style", required_argument, NULL, 's' },
|
||||||
{"display-scale", required_argument, NULL, 'S' }, /* deprecated */
|
{"display-scale", required_argument, NULL, 'S' },
|
||||||
{"zoom", required_argument, NULL, 'z' },
|
|
||||||
|
|
||||||
{"enable-debug", required_argument, NULL, 10 },
|
{"enable-debug", required_argument, NULL, 10 },
|
||||||
{"debug", no_argument, NULL, 11 },
|
{"debug", no_argument, NULL, 11 },
|
||||||
{"reflash", required_argument, NULL, 90 },
|
{"reflash", required_argument, NULL, 90 },
|
||||||
{"reflash-full", required_argument, NULL, 91 },
|
{"reflash-full", required_argument, NULL, 91 },
|
||||||
{"reboot", no_argument, NULL, 'r' }, /* deprecated */
|
{"reboot", no_argument, NULL, 'r' },
|
||||||
{"reset", no_argument, NULL, 'r' },
|
|
||||||
|
|
||||||
{0, 0, 0, 0 }
|
{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"
|
"-d --datadir[=absolute path] alternate datadir (default: $XDGCONFIGHOME/%s/)\n"
|
||||||
"-n --name[=name] set alternate UI name\n"
|
"-n --name[=name] set alternate UI name\n"
|
||||||
"-s --style[=filename] css filename in <datadir> (default: style-50g.css)\n"
|
"-s --style[=filename] css filename in <datadir> (default: style-50g.css)\n"
|
||||||
"-S --zoom[=X] scale LCD by X (default: 2)\n"
|
"-S --display-scale[=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"
|
"-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"
|
"--overwrite-config force writing <datadir>/config.lua even if it exists\n"
|
||||||
"\n"
|
"\n"
|
||||||
"--newrpl-keyboard label keyboard for newRPL\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 );
|
clopt_style_filename = strdup( optarg );
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
clopt_zoom = atoi( optarg );
|
clopt_display_scale = atoi( optarg );
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
fprintf( stderr, "%i.%i.%i\n", VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL );
|
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" );
|
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, "zoom" );
|
lua_getglobal( config_lua_values, "display_scale" );
|
||||||
opt.zoom = luaL_optinteger( config_lua_values, -1, opt.zoom );
|
opt.display_scale = luaL_optinteger( config_lua_values, -1, opt.display_scale );
|
||||||
|
|
||||||
lua_getglobal( config_lua_values, "zoom" );
|
|
||||||
opt.zoom = luaL_optinteger( config_lua_values, -1, opt.zoom );
|
|
||||||
}
|
}
|
||||||
if ( opt.haz_config_file && overwrite_config )
|
if ( opt.haz_config_file && overwrite_config )
|
||||||
opt.haz_config_file = false;
|
opt.haz_config_file = false;
|
||||||
|
@ -342,8 +336,8 @@ void config_init( char* progname, int argc, char* argv[] )
|
||||||
opt.model = clopt_model;
|
opt.model = clopt_model;
|
||||||
if ( clopt_newrpl != -1 )
|
if ( clopt_newrpl != -1 )
|
||||||
opt.newrpl = clopt_newrpl;
|
opt.newrpl = clopt_newrpl;
|
||||||
if ( clopt_zoom > 0 )
|
if ( clopt_display_scale > 0 )
|
||||||
opt.zoom = clopt_zoom;
|
opt.display_scale = clopt_display_scale;
|
||||||
|
|
||||||
if ( print_config_and_exit ) {
|
if ( print_config_and_exit ) {
|
||||||
fprintf( stdout, config_to_string() );
|
fprintf( stdout, config_to_string() );
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct options {
|
||||||
bool newrpl;
|
bool newrpl;
|
||||||
char* name;
|
char* name;
|
||||||
|
|
||||||
int zoom;
|
int display_scale;
|
||||||
char* style_filename;
|
char* style_filename;
|
||||||
bool verbose;
|
bool verbose;
|
||||||
bool haz_config_file;
|
bool haz_config_file;
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
|
|
||||||
#define KB_NB_ROWS 10
|
#define KB_NB_ROWS 10
|
||||||
|
|
||||||
#define LCD_WIDTH ( 131 * opt.zoom )
|
#define LCD_WIDTH ( 131 * opt.display_scale )
|
||||||
#define LCD_HEIGHT ( 80 * opt.zoom )
|
#define LCD_HEIGHT ( 80 * opt.display_scale )
|
||||||
|
|
||||||
static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
|
static x49gp_ui_key_t ui_keys[ NB_KEYS ] = {
|
||||||
{.css_class = "menu",
|
{.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_busy, x49gp_get_pixel_color( lcd, 131, 5 ) );
|
||||||
gtk_widget_set_opacity( ui->ui_ann_io, x49gp_get_pixel_color( lcd, 131, 0 ) );
|
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 y = 0; y < ( LCD_HEIGHT / opt.display_scale ); y++ )
|
||||||
for ( int x = 0; x < ( LCD_WIDTH / opt.zoom ); x++ )
|
for ( int x = 0; x < ( LCD_WIDTH / opt.display_scale ); x++ )
|
||||||
_draw_pixel( ui->lcd_surface, opt.zoom * x, opt.zoom * y, opt.zoom, opt.zoom,
|
_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 ) ] ) );
|
&( ui->colors[ UI_COLOR_GRAYSCALE_0 + x49gp_get_pixel_color( lcd, x, y ) ] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue