pass config to init_emulator; update README

This commit is contained in:
Gwenhael Le Moine 2024-09-12 15:25:11 +02:00
parent 50329fff2d
commit 168a1e31d5
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
4 changed files with 13 additions and 7 deletions

View file

@ -5,3 +5,8 @@ Standalone HP 48(SX/GX) front-end ready to be plugged into emulators.
Provide both GUI implemented in SDL2 and TUI in ncurses.
Extracted from x48ng.
## How to use?
To plug an emulator you'll want to look into the interface defined in emulator.h and emulator.c
A basic main loop is shown in main.c

View file

@ -1,5 +1,8 @@
#include "config.h"
#include "emulator.h"
static config_t config;
typedef struct hpkey_t {
int code;
bool pressed;
@ -100,10 +103,7 @@ void get_lcd_buffer( int* target )
int get_contrast( void ) { return contrast; }
void init_emulator( void )
{
// nop;
}
void init_emulator( config_t* conf ) { config = *conf; }
void exit_emulator( void )
{

View file

@ -3,6 +3,8 @@
#include <stdbool.h>
#include "config.h"
// Keys
#define HPKEY_A 0
#define HPKEY_B 1
@ -90,7 +92,7 @@ extern void press_key( int hpkey );
extern void release_key( int hpkey );
extern bool is_key_pressed( int hpkey );
extern void init_emulator( void );
extern void init_emulator( config_t* conf );
extern void exit_emulator( void );
extern unsigned char get_annunciators( void );

View file

@ -5,10 +5,9 @@
int main( int argc, char** argv )
{
config_t* config = config_init( argc, argv );
init_emulator();
init_emulator( config );
/* (G)UI */
setup_ui( config );