From 89942fac75087e91926bfea74b561bcc477c467f Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 13 Dec 2024 05:56:57 +0100 Subject: [PATCH] Some clean-ups and corrections for the OPL2 board, fixes warning in snd_opl.c. --- src/include/86box/snd_opl.h | 14 +++++++------- src/sound/snd_opl2board.c | 35 +++++++++++++---------------------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/src/include/86box/snd_opl.h b/src/include/86box/snd_opl.h index 8a6a7d6ef..fe0112b47 100644 --- a/src/include/86box/snd_opl.h +++ b/src/include/86box/snd_opl.h @@ -18,13 +18,13 @@ #define SOUND_OPL_H enum fm_type { - FM_YM3812 = 0, /* OPL2 */ - FM_YMF262 = 1, /* OPL3 */ - FM_YMF289B = 2, /* OPL3-L */ - FM_YMF278B = 3, /* OPL 4 */ - FM_ESFM = 4, /* ESFM */ - FM_MAX = 5, - FM_OPL2BOARD = 6 /* OPL2BOARD (External Device)*/ + FM_YM3812 = 0, /* OPL2 */ + FM_YMF262 = 1, /* OPL3 */ + FM_YMF289B = 2, /* OPL3-L */ + FM_YMF278B = 3, /* OPL 4 */ + FM_ESFM = 4, /* ESFM */ + FM_OPL2BOARD = 5, /* OPL2BOARD (External Device)*/ + FM_MAX = 6 }; enum fm_driver { diff --git a/src/sound/snd_opl2board.c b/src/sound/snd_opl2board.c index 57fafbae7..efd408b97 100644 --- a/src/sound/snd_opl2board.c +++ b/src/sound/snd_opl2board.c @@ -56,15 +56,9 @@ opl2board_device_log(const char *fmt, ...) typedef struct opl2board_device_t { fm_drv_t opl; - - uint8_t pos_regs[8]; - - + uint8_t pos_regs[8]; } opl2board_device_t; - - - static void opl2board_device_get_buffer(int32_t *buffer, int len, void *priv) { @@ -115,6 +109,7 @@ opl2board_device_mca_write(int port, uint8_t val, void *priv) default: break; } + serial->pos_regs[port & 7] = val; } @@ -131,8 +126,7 @@ opl2board_device_init(UNUSED(const device_t *info)) { opl2board_device_t *serial = malloc(sizeof(opl2board_device_t)); memset(serial, 0, sizeof(opl2board_device_t)); - - + opl2board_device_log("opl2board_device_init\n"); fm_driver_get(FM_OPL2BOARD, &serial->opl); io_sethandler(0x0388, 0x0002, @@ -141,9 +135,7 @@ opl2board_device_init(UNUSED(const device_t *info)) serial->opl.priv); music_add_handler(opl2board_device_get_buffer, serial); - return serial; - } void * @@ -175,19 +167,18 @@ opl2board_device_close(void *priv) static const device_config_t opl2board_config[] = { - - { - .name = "host_serial_path", - .description = "Host Serial Device", - .type = CONFIG_SERPORT, - .default_string = "", - .file_filter = NULL, - .spinner = {}, - .selection = {} +{ + .name = "host_serial_path", + .description = "Host Serial Device", + .type = CONFIG_SERPORT, + .default_string = "", + .file_filter = NULL, + .spinner = {}, + .selection = {} }, - { .name = "", .description = "", .type = CONFIG_END } + { .name = "", .description = "", .type = CONFIG_END } +}; - }; const device_t opl2board_device = { .name = "OPL2Board (External Device)", .internal_name = "opl2board_device",