refactor ui_init_LCD() use

This commit is contained in:
Gwenhael Le Moine 2024-04-10 08:27:26 +02:00
parent ae866703e1
commit dd51ede578
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
9 changed files with 11 additions and 16 deletions

View file

@ -10,7 +10,7 @@
#include "runtime_options.h"
#include "emulator.h"
#include "romio.h"
#include "ui.h" /* ui_init_LCD(); ui_update_LCD(); */
#include "ui.h" /* ui_update_LCD(); */
#include "debugger.h"
#define MAX_ARGS 16
@ -3553,7 +3553,6 @@ static void cmd_load( int argc, char** argv )
free( tmp_saturn.port2 );
/* After reloading state we need to refresh the UI's LCD */
ui_init_LCD();
ui_update_LCD();
} else {
printf( "Loading emulator-state from files failed.\n" );

View file

@ -106,7 +106,6 @@ int main( int argc, char** argv )
init_display();
/* (G)UI */
ui_init_LCD();
setup_frontend(); /* points init_ui to the correct function */
init_ui( argc, argv );

View file

@ -467,10 +467,9 @@ int parse_args( int argc, char* argv[] )
if ( !normalize_config_dir() ) {
fprintf( stderr, "Configuration directory doesn't exist!\n" );
exit(1);
exit( 1 );
}
/**********************/
/* 1. read config.lua */
/**********************/
@ -655,7 +654,7 @@ int parse_args( int argc, char* argv[] )
/* normalize config_dir again in case it's been modified */
if ( !normalize_config_dir() ) {
fprintf( stderr, "Configuration directory doesn't exist!\n" );
exit(1);
exit( 1 );
}
normalize_filenames();

View file

@ -178,6 +178,8 @@ void setup_frontend( void )
init_ui = init_text_ui;
break;
}
ui_init_LCD();
}
int SmallTextWidth( const char* string, unsigned int length )

View file

@ -67,10 +67,5 @@ extern void ( *ui_draw_annunc )( void );
/*******************/
extern void ( *init_ui )( int argc, char** argv );
/*********************************/
/* used in: debugger.c */
/*********************************/
extern void ui_init_LCD( void );
extern void setup_frontend( void );
#endif /* !_UI_H */

View file

@ -566,5 +566,6 @@ static unsigned char equal_gx_bitmap[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0
/* functions */
/*************/
extern int SmallTextWidth( const char* string, unsigned int length );
extern void ui_init_LCD( void );
#endif /* _UI_INNER_H */

View file

@ -1956,7 +1956,7 @@ void sdl_update_LCD( void )
}
}
} else
memset( lcd_nibbles_buffer, 0xf0, sizeof( lcd_nibbles_buffer ) );
ui_init_LCD();
}
void sdl_refresh_LCD( void ) {}
@ -2029,8 +2029,7 @@ void sdl_adjust_contrast()
SDLCreateAnnunc();
// redraw LCD
memset( lcd_nibbles_buffer, 0, sizeof( lcd_nibbles_buffer ) );
ui_init_LCD();
sdl_update_LCD();
// redraw annunc

View file

@ -16,6 +16,7 @@
#include "runtime_options.h" /* mono, gray, small, tiny, progname */
#include "ui.h" /* last_annunc_state, lcd_nibbles_buffer, DISP_ROWS */
#include "ui_inner.h"
#define LCD_WIDTH 131
#define LCD_HEIGHT 64

View file

@ -2411,7 +2411,7 @@ void refresh_display( void )
void redraw_display( void )
{
XClearWindow( dpy, lcd.win );
memset( lcd_nibbles_buffer, 0, sizeof( lcd_nibbles_buffer ) );
ui_init_LCD();
x11_update_LCD();
}
@ -3597,7 +3597,7 @@ void x11_update_LCD( void )
memset( lcd.menu_image->data, 0, ( size_t )( lcd.menu_image->bytes_per_line * lcd.menu_image->height ) );
lcd.display_update = UPDATE_DISP | UPDATE_MENU;
} else {
memset( lcd_nibbles_buffer, 0xf0, sizeof( lcd_nibbles_buffer ) );
ui_init_LCD();
for ( i = 0; i < 64; i++ ) {
for ( j = 0; j < NIBBLES_PER_ROW; j++ ) {
draw_nibble( j, i, 0x00 );