mirror of
https://github.com/86Box/86Box.git
synced 2025-01-23 09:42:47 -05:00
lpt_device_t.internal_name added
This commit is contained in:
parent
f39f239c05
commit
51532f7aaa
9 changed files with 27 additions and 9 deletions
|
@ -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,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
|
||||
void * (*init)(void *lpt);
|
||||
void (*close)(void *p);
|
||||
|
|
27
src/lpt.c
27
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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue