diff --git a/src/device/hasp.c b/src/device/hasp.c index 60dae74c6..299796a6d 100644 --- a/src/device/hasp.c +++ b/src/device/hasp.c @@ -301,6 +301,7 @@ hasp_close(void *priv) const lpt_device_t lpt_hasp_savquest_device = { .name = "Protection Dongle for Savage Quest", + .internal_name = "dongle_savquest", .init = hasp_init_savquest, .close = hasp_close, .write_data = hasp_write_data, diff --git a/src/include/86box/lpt.h b/src/include/86box/lpt.h index b5b8d2699..8ddf2c805 100644 --- a/src/include/86box/lpt.h +++ b/src/include/86box/lpt.h @@ -20,6 +20,7 @@ typedef struct { const char *name; + const char *internal_name; void * (*init)(void *lpt); void (*close)(void *p); diff --git a/src/lpt.c b/src/lpt.c index bc82454bc..b6c639d6b 100644 --- a/src/lpt.c +++ b/src/lpt.c @@ -16,13 +16,24 @@ lpt_port_t lpt_ports[PARALLEL_MAX]; +const lpt_device_t lpt_none_device = { + .name = "None", + .internal_name = "none", + .init = NULL, + .close = NULL, + .write_data = NULL, + .write_ctrl = NULL, + .read_data = NULL, + .read_status = NULL, + .read_ctrl = NULL +}; static const struct { const char *internal_name; const lpt_device_t *device; } lpt_devices[] = { // clang-format off - {"none", NULL }, + {"none", &lpt_none_device }, {"dss", &dss_device }, {"lpt_dac", &lpt_dac_device }, {"lpt_dac_stereo", &lpt_dac_stereo_device }, @@ -39,31 +50,29 @@ char * lpt_device_get_name(int id) { if (strlen((char *) lpt_devices[id].internal_name) == 0) - return NULL; + return NULL; if (!lpt_devices[id].device) - return "None"; + return "None"; return (char *) lpt_devices[id].device->name; } - char * lpt_device_get_internal_name(int id) { if (strlen((char *) lpt_devices[id].internal_name) == 0) - return NULL; + return NULL; return (char *) lpt_devices[id].internal_name; } - int lpt_device_get_from_internal_name(char *s) { int c = 0; while (strlen((char *) lpt_devices[c].internal_name) != 0) { - if (strcmp(lpt_devices[c].internal_name, s) == 0) - return c; - c++; + if (strcmp(lpt_devices[c].internal_name, s) == 0) + return c; + c++; } return 0; diff --git a/src/network/net_plip.c b/src/network/net_plip.c index f0af9dee5..528099f9b 100644 --- a/src/network/net_plip.c +++ b/src/network/net_plip.c @@ -493,6 +493,7 @@ plip_close(void *priv) const lpt_device_t lpt_plip_device = { .name = "Parallel Line Internet Protocol", + .internal_name = "plip", .init = plip_lpt_init, .close = plip_close, .write_data = plip_write_data, diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index b788c317f..ef8b26eac 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -2144,6 +2144,7 @@ escp_close(void *priv) const lpt_device_t lpt_prt_escp_device = { "Generic ESC/P Dot-Matrix", + "dot_matrix", escp_init, escp_close, write_data, diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index fdc820a84..e90e19e82 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -401,6 +401,7 @@ ps_close(void *p) const lpt_device_t lpt_prt_ps_device = { .name = "Generic PostScript Printer", + .internal_name = "postscript", .init = ps_init, .close = ps_close, .write_data = ps_write_data, diff --git a/src/printer/prt_text.c b/src/printer/prt_text.c index 070e1bd4c..e4ddb2b20 100644 --- a/src/printer/prt_text.c +++ b/src/printer/prt_text.c @@ -484,6 +484,7 @@ prnt_close(void *priv) const lpt_device_t lpt_prt_text_device = { "Generic Text Printer", + "text_prt", prnt_init, prnt_close, write_data, diff --git a/src/sound/snd_lpt_dac.c b/src/sound/snd_lpt_dac.c index e4869f397..cac610c91 100644 --- a/src/sound/snd_lpt_dac.c +++ b/src/sound/snd_lpt_dac.c @@ -110,6 +110,7 @@ dac_close(void *p) const lpt_device_t lpt_dac_device = { "LPT DAC / Covox Speech Thing", + "lpt_dac", dac_init, dac_close, dac_write_data, @@ -121,6 +122,7 @@ const lpt_device_t lpt_dac_device = { const lpt_device_t lpt_dac_stereo_device = { "Stereo LPT DAC", + "lpt_dac_stereo", dac_stereo_init, dac_close, dac_write_data, diff --git a/src/sound/snd_lpt_dss.c b/src/sound/snd_lpt_dss.c index 131349141..caf98b20b 100644 --- a/src/sound/snd_lpt_dss.c +++ b/src/sound/snd_lpt_dss.c @@ -133,6 +133,7 @@ dss_close(void *p) const lpt_device_t dss_device = { "Disney Sound Source", + "dss", dss_init, dss_close, dss_write_data,