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

View file

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

View file

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

View file

@ -178,6 +178,8 @@ void setup_frontend( void )
init_ui = init_text_ui; init_ui = init_text_ui;
break; break;
} }
ui_init_LCD();
} }
int SmallTextWidth( const char* string, unsigned int length ) 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 ); extern void ( *init_ui )( int argc, char** argv );
/*********************************/
/* used in: debugger.c */
/*********************************/
extern void ui_init_LCD( void );
extern void setup_frontend( void ); extern void setup_frontend( void );
#endif /* !_UI_H */ #endif /* !_UI_H */

View file

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

View file

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

View file

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

View file

@ -2411,7 +2411,7 @@ void refresh_display( void )
void redraw_display( void ) void redraw_display( void )
{ {
XClearWindow( dpy, lcd.win ); XClearWindow( dpy, lcd.win );
memset( lcd_nibbles_buffer, 0, sizeof( lcd_nibbles_buffer ) ); ui_init_LCD();
x11_update_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 ) ); 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; lcd.display_update = UPDATE_DISP | UPDATE_MENU;
} else { } else {
memset( lcd_nibbles_buffer, 0xf0, sizeof( lcd_nibbles_buffer ) ); ui_init_LCD();
for ( i = 0; i < 64; i++ ) { for ( i = 0; i < 64; i++ ) {
for ( j = 0; j < NIBBLES_PER_ROW; j++ ) { for ( j = 0; j < NIBBLES_PER_ROW; j++ ) {
draw_nibble( j, i, 0x00 ); draw_nibble( j, i, 0x00 );