mirror of
https://github.com/86Box/86Box.git
synced 2025-01-23 17:52:01 -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 = {
|
const lpt_device_t lpt_hasp_savquest_device = {
|
||||||
.name = "Protection Dongle for Savage Quest",
|
.name = "Protection Dongle for Savage Quest",
|
||||||
|
.internal_name = "dongle_savquest",
|
||||||
.init = hasp_init_savquest,
|
.init = hasp_init_savquest,
|
||||||
.close = hasp_close,
|
.close = hasp_close,
|
||||||
.write_data = hasp_write_data,
|
.write_data = hasp_write_data,
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
const char *internal_name;
|
||||||
|
|
||||||
void * (*init)(void *lpt);
|
void * (*init)(void *lpt);
|
||||||
void (*close)(void *p);
|
void (*close)(void *p);
|
||||||
|
|
27
src/lpt.c
27
src/lpt.c
|
@ -16,13 +16,24 @@
|
||||||
|
|
||||||
lpt_port_t lpt_ports[PARALLEL_MAX];
|
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 {
|
static const struct {
|
||||||
const char *internal_name;
|
const char *internal_name;
|
||||||
const lpt_device_t *device;
|
const lpt_device_t *device;
|
||||||
} lpt_devices[] = {
|
} lpt_devices[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{"none", NULL },
|
{"none", &lpt_none_device },
|
||||||
{"dss", &dss_device },
|
{"dss", &dss_device },
|
||||||
{"lpt_dac", &lpt_dac_device },
|
{"lpt_dac", &lpt_dac_device },
|
||||||
{"lpt_dac_stereo", &lpt_dac_stereo_device },
|
{"lpt_dac_stereo", &lpt_dac_stereo_device },
|
||||||
|
@ -39,31 +50,29 @@ char *
|
||||||
lpt_device_get_name(int id)
|
lpt_device_get_name(int id)
|
||||||
{
|
{
|
||||||
if (strlen((char *) lpt_devices[id].internal_name) == 0)
|
if (strlen((char *) lpt_devices[id].internal_name) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!lpt_devices[id].device)
|
if (!lpt_devices[id].device)
|
||||||
return "None";
|
return "None";
|
||||||
return (char *) lpt_devices[id].device->name;
|
return (char *) lpt_devices[id].device->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
lpt_device_get_internal_name(int id)
|
lpt_device_get_internal_name(int id)
|
||||||
{
|
{
|
||||||
if (strlen((char *) lpt_devices[id].internal_name) == 0)
|
if (strlen((char *) lpt_devices[id].internal_name) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
return (char *) lpt_devices[id].internal_name;
|
return (char *) lpt_devices[id].internal_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
lpt_device_get_from_internal_name(char *s)
|
lpt_device_get_from_internal_name(char *s)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (strlen((char *) lpt_devices[c].internal_name) != 0) {
|
while (strlen((char *) lpt_devices[c].internal_name) != 0) {
|
||||||
if (strcmp(lpt_devices[c].internal_name, s) == 0)
|
if (strcmp(lpt_devices[c].internal_name, s) == 0)
|
||||||
return c;
|
return c;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -493,6 +493,7 @@ plip_close(void *priv)
|
||||||
|
|
||||||
const lpt_device_t lpt_plip_device = {
|
const lpt_device_t lpt_plip_device = {
|
||||||
.name = "Parallel Line Internet Protocol",
|
.name = "Parallel Line Internet Protocol",
|
||||||
|
.internal_name = "plip",
|
||||||
.init = plip_lpt_init,
|
.init = plip_lpt_init,
|
||||||
.close = plip_close,
|
.close = plip_close,
|
||||||
.write_data = plip_write_data,
|
.write_data = plip_write_data,
|
||||||
|
|
|
@ -2144,6 +2144,7 @@ escp_close(void *priv)
|
||||||
|
|
||||||
const lpt_device_t lpt_prt_escp_device = {
|
const lpt_device_t lpt_prt_escp_device = {
|
||||||
"Generic ESC/P Dot-Matrix",
|
"Generic ESC/P Dot-Matrix",
|
||||||
|
"dot_matrix",
|
||||||
escp_init,
|
escp_init,
|
||||||
escp_close,
|
escp_close,
|
||||||
write_data,
|
write_data,
|
||||||
|
|
|
@ -401,6 +401,7 @@ ps_close(void *p)
|
||||||
|
|
||||||
const lpt_device_t lpt_prt_ps_device = {
|
const lpt_device_t lpt_prt_ps_device = {
|
||||||
.name = "Generic PostScript Printer",
|
.name = "Generic PostScript Printer",
|
||||||
|
.internal_name = "postscript",
|
||||||
.init = ps_init,
|
.init = ps_init,
|
||||||
.close = ps_close,
|
.close = ps_close,
|
||||||
.write_data = ps_write_data,
|
.write_data = ps_write_data,
|
||||||
|
|
|
@ -484,6 +484,7 @@ prnt_close(void *priv)
|
||||||
|
|
||||||
const lpt_device_t lpt_prt_text_device = {
|
const lpt_device_t lpt_prt_text_device = {
|
||||||
"Generic Text Printer",
|
"Generic Text Printer",
|
||||||
|
"text_prt",
|
||||||
prnt_init,
|
prnt_init,
|
||||||
prnt_close,
|
prnt_close,
|
||||||
write_data,
|
write_data,
|
||||||
|
|
|
@ -110,6 +110,7 @@ dac_close(void *p)
|
||||||
|
|
||||||
const lpt_device_t lpt_dac_device = {
|
const lpt_device_t lpt_dac_device = {
|
||||||
"LPT DAC / Covox Speech Thing",
|
"LPT DAC / Covox Speech Thing",
|
||||||
|
"lpt_dac",
|
||||||
dac_init,
|
dac_init,
|
||||||
dac_close,
|
dac_close,
|
||||||
dac_write_data,
|
dac_write_data,
|
||||||
|
@ -121,6 +122,7 @@ const lpt_device_t lpt_dac_device = {
|
||||||
|
|
||||||
const lpt_device_t lpt_dac_stereo_device = {
|
const lpt_device_t lpt_dac_stereo_device = {
|
||||||
"Stereo LPT DAC",
|
"Stereo LPT DAC",
|
||||||
|
"lpt_dac_stereo",
|
||||||
dac_stereo_init,
|
dac_stereo_init,
|
||||||
dac_close,
|
dac_close,
|
||||||
dac_write_data,
|
dac_write_data,
|
||||||
|
|
|
@ -133,6 +133,7 @@ dss_close(void *p)
|
||||||
|
|
||||||
const lpt_device_t dss_device = {
|
const lpt_device_t dss_device = {
|
||||||
"Disney Sound Source",
|
"Disney Sound Source",
|
||||||
|
"dss",
|
||||||
dss_init,
|
dss_init,
|
||||||
dss_close,
|
dss_close,
|
||||||
dss_write_data,
|
dss_write_data,
|
||||||
|
|
Loading…
Add table
Reference in a new issue