The model structure now uses a pointer to a function that returns the pointer to the device structure, rather than a pointer to the device structure directly.

This commit is contained in:
OBattler
2017-09-02 15:46:21 +02:00
parent c81e5af8a0
commit be16ee33ba
6 changed files with 36 additions and 13 deletions

View File

@@ -155,14 +155,14 @@ MODEL models[] =
{"[8088] Compaq Portable", ROM_PORTABLE, "portable", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 128, 640, 128, 0, xt_init, NULL },
{"[8088] DTK XT clone", ROM_DTKXT, "dtk", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 640, 64, 0, xt_init, NULL },
{"[8088] IBM PC", ROM_IBMPC, "ibmpc", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 640, 32, 0, xt_init, NULL },
{"[8088] IBM PCjr", ROM_IBMPCJR, "ibmpcjr", {{"", cpus_pcjr}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, 0, 128, 640, 128, 0, pcjr_init, &pcjr_device },
{"[8088] IBM PCjr", ROM_IBMPCJR, "ibmpcjr", {{"", cpus_pcjr}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, 0, 128, 640, 128, 0, pcjr_init, pcjr_get_device },
{"[8088] IBM XT", ROM_IBMXT, "ibmxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 640, 64, 0, xt_init, NULL },
{"[8088] Generic XT clone", ROM_GENXT, "genxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 640, 64, 0, xt_init, NULL },
{"[8088] Juko XT clone", ROM_JUKOPC, "jukopc", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 640, 64, 0, xt_init, NULL },
{"[8088] Phoenix XT clone", ROM_PXXT, "pxxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 640, 64, 0, xt_init, NULL },
{"[8088] Schneider EuroPC", ROM_EUROPC, "europc", {{"", cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 512, 640, 128, 0, europc_init, NULL },
{"[8088] Tandy 1000", ROM_TANDY, "tandy", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, 0, 128, 640, 128, 0, tandy1k_init, &tandy1000_device },
{"[8088] Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, 0, 256, 640, 128, 0, tandy1k_init, &tandy1000hx_device },
{"[8088] Tandy 1000", ROM_TANDY, "tandy", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, 0, 128, 640, 128, 0, tandy1k_init, tandy1000_get_device },
{"[8088] Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, 0, 256, 640, 128, 0, tandy1k_init, tandy1000hx_get_device },
{"[8088] VTech Laser Turbo XT", ROM_LTXT, "ltxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 1152, 64, 0, xt_laserxt_init, NULL },
{"[8088] VTech Laser XT3", ROM_LXT3, "lxt3", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, 0, 64, 1152, 64, 0, xt_laserxt_init, NULL },
@@ -287,7 +287,14 @@ char *model_getname(void)
device_t *model_getdevice(int model)
{
return models[model].device;
if (models[model].get_device)
{
return models[model].get_device();
}
else
{
return NULL;
}
}
@@ -1108,6 +1115,6 @@ void model_init(void)
models[model].init();
if (models[model].device)
device_add(models[model].device);
if (models[model].get_device)
device_add(models[model].get_device());
}

View File

@@ -46,7 +46,7 @@ typedef struct {
int ram_granularity;
int nvrmask;
void (*init)(void);
device_t *device;
device_t *(*get_device)(void);
} MODEL;

View File

@@ -579,7 +579,7 @@ static device_config_t pcjr_config[] =
/*This isn't really a device as such - more of a convenient way to hook in the
config information*/
device_t pcjr_device =
static device_t pcjr_device =
{
"IBM PCjr",
0,
@@ -591,3 +591,8 @@ device_t pcjr_device =
NULL,
pcjr_config
};
device_t *pcjr_get_device(void)
{
return &pcjr_device;
}

View File

@@ -1,2 +1,3 @@
extern device_t pcjr_video_device;
extern device_t pcjr_device;
device_t *pcjr_get_device(void);

View File

@@ -655,7 +655,7 @@ static device_config_t tandy_config[] =
/*These aren't really devices as such - more of a convenient way to hook in the
config information*/
device_t tandy1000_device =
static device_t tandy1000_device =
{
"Tandy 1000",
0,
@@ -667,7 +667,7 @@ device_t tandy1000_device =
NULL,
tandy_config
};
device_t tandy1000hx_device =
static device_t tandy1000hx_device =
{
"Tandy 1000HX",
0,
@@ -679,3 +679,13 @@ device_t tandy1000hx_device =
NULL,
tandy_config
};
device_t *tandy1000_get_device(void)
{
return &tandy1000_device;
}
device_t *tandy1000hx_get_device(void)
{
return &tandy1000hx_device;
}

View File

@@ -1,4 +1,4 @@
extern device_t tandy_device;
extern device_t tandy1000_device;
extern device_t tandy1000hx_device;
device_t *tandy1000_get_device(void);
device_t *tandy1000hx_get_device(void);