mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 09:35:32 -07:00
Merge remote-tracking branch 'origin/master' into cdrom_changes
This commit is contained in:
@@ -457,7 +457,7 @@ delete_nvr_file(uint8_t flash)
|
||||
int c;
|
||||
|
||||
/* Set up the NVR file's name. */
|
||||
c = strlen(machine_get_internal_name()) + 5;
|
||||
c = strlen(machine_get_nvr_name()) + 5;
|
||||
fn = (char *) malloc(c + 1);
|
||||
|
||||
if (fn == NULL)
|
||||
@@ -465,9 +465,9 @@ delete_nvr_file(uint8_t flash)
|
||||
flash ? "BIOS flash" : "CMOS");
|
||||
|
||||
if (flash)
|
||||
sprintf(fn, "%s.bin", machine_get_internal_name());
|
||||
sprintf(fn, "%s.bin", machine_get_nvr_name());
|
||||
else
|
||||
sprintf(fn, "%s.nvr", machine_get_internal_name());
|
||||
sprintf(fn, "%s.nvr", machine_get_nvr_name());
|
||||
|
||||
remove(nvr_path(fn));
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ static const device_t cdrom_interface_none_device = {
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
|
||||
@@ -1287,9 +1287,9 @@ sis_5513_pci_to_isa_init(UNUSED(const device_t *info))
|
||||
acpi_set_nvr(dev->sis->acpi, dev->nvr);
|
||||
|
||||
/* Set up the NVR file's name. */
|
||||
c = strlen(machine_get_internal_name()) + 9;
|
||||
c = strlen(machine_get_nvr_name()) + 9;
|
||||
dev->fn = (char *) malloc(c + 1);
|
||||
sprintf(dev->fn, "%s_apc.nvr", machine_get_internal_name());
|
||||
sprintf(dev->fn, "%s_apc.nvr", machine_get_nvr_name());
|
||||
|
||||
fp = nvr_fopen(dev->fn, "rb");
|
||||
|
||||
|
||||
@@ -102,9 +102,9 @@ lm78_log(const char *fmt, ...)
|
||||
void
|
||||
lm78_nvram(lm78_t *dev, uint8_t save)
|
||||
{
|
||||
size_t l = strlen(machine_get_internal_name_ex(machine)) + 14;
|
||||
size_t l = strlen(machine_get_nvr_name_ex(machine)) + 14;
|
||||
char *nvr_path = (char *) malloc(l);
|
||||
sprintf(nvr_path, "%s_as99127f.nvr", machine_get_internal_name_ex(machine));
|
||||
sprintf(nvr_path, "%s_as99127f.nvr", machine_get_nvr_name_ex(machine));
|
||||
|
||||
FILE *fp = nvr_fopen(nvr_path, save ? "wb" : "rb");
|
||||
if (fp) {
|
||||
|
||||
@@ -61,7 +61,7 @@ static const device_t mouse_none_device = {
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
{ .poll = NULL },
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
@@ -75,7 +75,7 @@ static const device_t mouse_internal_device = {
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
{ .poll = NULL },
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
@@ -111,7 +111,6 @@ static atomic_int mouse_buttons;
|
||||
static int mouse_delta_b;
|
||||
static int mouse_old_b;
|
||||
|
||||
static const device_t *mouse_curr;
|
||||
static void *mouse_priv;
|
||||
static int mouse_nbut;
|
||||
static int mouse_raw;
|
||||
@@ -537,17 +536,10 @@ mouse_get_abs_coords(double *x_abs, double *y_abs)
|
||||
void
|
||||
mouse_process(void)
|
||||
{
|
||||
if (mouse_curr == NULL)
|
||||
return;
|
||||
|
||||
if ((mouse_input_mode >= 1) && mouse_poll_ex)
|
||||
mouse_poll_ex();
|
||||
else if ((mouse_input_mode == 0) && ((mouse_dev_poll != NULL) || (mouse_curr->poll != NULL))) {
|
||||
if (mouse_curr->poll != NULL)
|
||||
mouse_curr->poll(mouse_priv);
|
||||
else
|
||||
mouse_dev_poll(mouse_priv);
|
||||
}
|
||||
else if ((mouse_input_mode == 0) && (mouse_dev_poll != NULL))
|
||||
mouse_dev_poll(mouse_priv);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -559,9 +551,6 @@ mouse_set_poll_ex(void (*poll_ex)(void))
|
||||
void
|
||||
mouse_set_poll(int (*func)(void *), void *arg)
|
||||
{
|
||||
if (mouse_type != MOUSE_TYPE_INTERNAL)
|
||||
return;
|
||||
|
||||
mouse_dev_poll = func;
|
||||
mouse_priv = arg;
|
||||
}
|
||||
@@ -629,7 +618,7 @@ mouse_set_raw(int raw)
|
||||
void
|
||||
mouse_reset(void)
|
||||
{
|
||||
if (mouse_curr != NULL)
|
||||
if (mouse_priv != NULL)
|
||||
return; /* Mouse already initialized. */
|
||||
|
||||
mouse_log("MOUSE: reset(type=%d, '%s')\n",
|
||||
@@ -651,19 +640,13 @@ mouse_reset(void)
|
||||
sample_rate = 100.0;
|
||||
timer_on_auto(&mouse_timer, 1000000.0 / sample_rate);
|
||||
|
||||
mouse_curr = mouse_devices[mouse_type].device;
|
||||
|
||||
if ((mouse_type > 1) && (mouse_curr != NULL))
|
||||
mouse_priv = device_add(mouse_curr);
|
||||
if ((mouse_type > 1) && (mouse_devices[mouse_type].device != NULL))
|
||||
mouse_priv = device_add(mouse_devices[mouse_type].device);
|
||||
}
|
||||
|
||||
void
|
||||
mouse_close(void)
|
||||
{
|
||||
if (mouse_curr == NULL)
|
||||
return;
|
||||
|
||||
mouse_curr = NULL;
|
||||
mouse_priv = NULL;
|
||||
mouse_nbut = 0;
|
||||
mouse_dev_poll = NULL;
|
||||
@@ -680,7 +663,6 @@ mouse_init(void)
|
||||
mouse_clear_buttons();
|
||||
|
||||
mouse_type = MOUSE_TYPE_NONE;
|
||||
mouse_curr = NULL;
|
||||
mouse_priv = NULL;
|
||||
mouse_nbut = 0;
|
||||
mouse_dev_poll = NULL;
|
||||
|
||||
@@ -680,6 +680,8 @@ bm_init(const device_t *info)
|
||||
|
||||
mouse_set_sample_rate(0.0);
|
||||
|
||||
mouse_set_poll(bm_poll, dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
@@ -818,7 +820,7 @@ const device_t mouse_logibus_device = {
|
||||
.init = bm_init,
|
||||
.close = bm_close,
|
||||
.reset = NULL,
|
||||
.poll = bm_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = lt_config
|
||||
@@ -832,7 +834,7 @@ const device_t mouse_logibus_onboard_device = {
|
||||
.init = bm_init,
|
||||
.close = bm_close,
|
||||
.reset = NULL,
|
||||
.poll = bm_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
@@ -846,7 +848,7 @@ const device_t mouse_msinport_device = {
|
||||
.init = bm_init,
|
||||
.close = bm_close,
|
||||
.reset = NULL,
|
||||
.poll = bm_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = ms_config
|
||||
|
||||
@@ -525,6 +525,7 @@ mtouch_init(UNUSED(const device_t *info))
|
||||
|
||||
mouse_input_mode = device_get_config_int("crosshair") + 1;
|
||||
mouse_set_buttons(2);
|
||||
mouse_set_poll(mtouch_poll, dev);
|
||||
mouse_set_poll_ex(mtouch_poll_global);
|
||||
mtouch_inst = dev;
|
||||
|
||||
@@ -605,7 +606,7 @@ const device_t mouse_mtouch_device = {
|
||||
.init = mtouch_init,
|
||||
.close = mtouch_close,
|
||||
.reset = NULL,
|
||||
.poll = mtouch_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = mtouch_config
|
||||
|
||||
@@ -352,6 +352,8 @@ mouse_ps2_init(const device_t *info)
|
||||
if (dev->port != NULL)
|
||||
kbc_at_dev_reset(dev, 0);
|
||||
|
||||
mouse_set_poll(ps2_poll, dev);
|
||||
|
||||
/* Return our private data to the I/O layer. */
|
||||
return dev;
|
||||
}
|
||||
@@ -397,7 +399,7 @@ const device_t mouse_ps2_device = {
|
||||
.init = mouse_ps2_init,
|
||||
.close = ps2_close,
|
||||
.reset = NULL,
|
||||
.poll = ps2_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = ps2_config
|
||||
|
||||
@@ -909,6 +909,8 @@ sermouse_init(const device_t *info)
|
||||
/* Tell them how many buttons we have. */
|
||||
mouse_set_buttons(dev->but);
|
||||
|
||||
mouse_set_poll(sermouse_poll, dev);
|
||||
|
||||
/* Return our private data to the I/O layer. */
|
||||
return dev;
|
||||
}
|
||||
@@ -1075,7 +1077,7 @@ const device_t mouse_mssystems_device = {
|
||||
.init = sermouse_init,
|
||||
.close = sermouse_close,
|
||||
.reset = NULL,
|
||||
.poll = sermouse_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = sermouse_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = msssermouse_config
|
||||
@@ -1089,7 +1091,7 @@ const device_t mouse_msserial_device = {
|
||||
.init = sermouse_init,
|
||||
.close = sermouse_close,
|
||||
.reset = NULL,
|
||||
.poll = sermouse_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = sermouse_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = mssermouse_config
|
||||
@@ -1103,7 +1105,7 @@ const device_t mouse_ltserial_device = {
|
||||
.init = sermouse_init,
|
||||
.close = sermouse_close,
|
||||
.reset = NULL,
|
||||
.poll = sermouse_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = sermouse_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = ltsermouse_config
|
||||
|
||||
@@ -662,8 +662,10 @@ wacom_init(const device_t *info)
|
||||
if (dev->tablet_type->type == WACOM_TYPE_IV) {
|
||||
wacom_reset_artpad(dev);
|
||||
wacom_process_settings_dword(dev, 0xE2018000);
|
||||
}
|
||||
else wacom_reset(dev);
|
||||
} else
|
||||
wacom_reset(dev);
|
||||
|
||||
mouse_set_poll(wacom_poll, dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
@@ -721,7 +723,7 @@ const device_t mouse_wacom_device = {
|
||||
.init = wacom_init,
|
||||
.close = wacom_close,
|
||||
.reset = NULL,
|
||||
.poll = wacom_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = wacom_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = wacom_config
|
||||
@@ -735,7 +737,7 @@ const device_t mouse_wacom_artpad_device = {
|
||||
.init = wacom_init,
|
||||
.close = wacom_close,
|
||||
.reset = NULL,
|
||||
.poll = wacom_poll,
|
||||
.available = NULL,
|
||||
.speed_changed = wacom_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = wacom_config
|
||||
|
||||
@@ -366,7 +366,7 @@ const device_t serial_passthrough_device = {
|
||||
.init = serial_passthrough_dev_init,
|
||||
.close = serial_passthrough_dev_close,
|
||||
.reset = NULL,
|
||||
.poll = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = serial_passthrough_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = serial_passthrough_config
|
||||
|
||||
@@ -100,10 +100,10 @@ d86f_handler_t d86f_handler[FDD_NUM];
|
||||
|
||||
static const struct
|
||||
{
|
||||
char *ext;
|
||||
void (*load)(int drive, char *fn);
|
||||
void (*close)(int drive);
|
||||
int size;
|
||||
const char *ext;
|
||||
void (*load)(int drive, char *fn);
|
||||
void (*close)(int drive);
|
||||
int size;
|
||||
} loaders[] = {
|
||||
{ "001", img_load, img_close, -1},
|
||||
{ "002", img_load, img_close, -1},
|
||||
|
||||
@@ -165,10 +165,8 @@ typedef struct _device_ {
|
||||
};
|
||||
void (*close)(void *priv);
|
||||
void (*reset)(void *priv);
|
||||
union {
|
||||
int (*available)(void);
|
||||
int (*poll)(void *priv);
|
||||
};
|
||||
int (*available)(void);
|
||||
int (*poll)(void *priv);
|
||||
void (*speed_changed)(void *priv);
|
||||
void (*force_redraw)(void *priv);
|
||||
|
||||
|
||||
@@ -361,6 +361,7 @@ extern int machine_available(int m);
|
||||
extern const char *machine_getname(void);
|
||||
extern const char *machine_getname_ex(int m);
|
||||
extern const char *machine_get_internal_name(void);
|
||||
extern const char *machine_get_nvr_name(void);
|
||||
extern int machine_get_machine_from_internal_name(const char *s);
|
||||
extern void machine_init(void);
|
||||
#ifdef EMU_DEVICE_H
|
||||
@@ -373,6 +374,7 @@ extern const device_t *machine_get_snd_device(int m);
|
||||
extern const device_t *machine_get_net_device(int m);
|
||||
#endif
|
||||
extern const char *machine_get_internal_name_ex(int m);
|
||||
extern const char *machine_get_nvr_name_ex(int m);
|
||||
extern int machine_get_nvrmask(int m);
|
||||
extern int machine_has_flags(int m, int flags);
|
||||
extern int machine_has_bus(int m, int bus_flags);
|
||||
|
||||
@@ -696,7 +696,7 @@ static const device_config_t pb450_config[] = {
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.bios = {
|
||||
{ .name = "PCI 1.0A", .internal_name = "pci10a", .bios_type = BIOS_NORMAL,
|
||||
{ .name = "PCI 1.0A", .internal_name = "pb450" /*"pci10a"*/, .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/pb450/OPTI802.bin", "" } },
|
||||
{ .name = "PNP 1.1A", .internal_name = "pnp11a", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/pb450/PNP11A.bin", "" } },
|
||||
|
||||
@@ -16565,3 +16565,26 @@ machine_is_sony(void)
|
||||
{
|
||||
return (!strcmp(machines[machine].internal_name, "pcv90"));
|
||||
}
|
||||
|
||||
const char *
|
||||
machine_get_nvr_name_ex(int m)
|
||||
{
|
||||
const char *ret = machines[m].internal_name;
|
||||
const device_t *dev = machine_get_device(m);
|
||||
|
||||
if (dev != NULL) {
|
||||
device_context(dev);
|
||||
const char *bios = device_get_config_string("bios");
|
||||
if ((bios != NULL) && (strcmp(bios, "") != 0))
|
||||
ret = bios;
|
||||
device_context_restore();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char *
|
||||
machine_get_nvr_name(void)
|
||||
{
|
||||
return machine_get_nvr_name_ex(machine);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ catalyst_flash_init(UNUSED(const device_t *info))
|
||||
|
||||
dev = calloc(1, sizeof(flash_t));
|
||||
|
||||
sprintf(flash_path, "%s.bin", machine_get_internal_name_ex(machine));
|
||||
sprintf(flash_path, "%s.bin", machine_get_nvr_name_ex(machine));
|
||||
|
||||
mem_mapping_disable(&bios_mapping);
|
||||
mem_mapping_disable(&bios_high_mapping);
|
||||
|
||||
@@ -353,7 +353,7 @@ intel_flash_init(const device_t *info)
|
||||
|
||||
dev = calloc(1, sizeof(flash_t));
|
||||
|
||||
sprintf(flash_path, "%s.bin", machine_get_internal_name_ex(machine));
|
||||
sprintf(flash_path, "%s.bin", machine_get_nvr_name_ex(machine));
|
||||
|
||||
dev->flags = info->local & 0xff;
|
||||
|
||||
|
||||
@@ -507,7 +507,7 @@ sst_init(const device_t *info)
|
||||
FILE *fp;
|
||||
sst_t *dev = calloc(1, sizeof(sst_t));
|
||||
|
||||
sprintf(flash_path, "%s.bin", machine_get_internal_name_ex(machine));
|
||||
sprintf(flash_path, "%s.bin", machine_get_nvr_name_ex(machine));
|
||||
|
||||
mem_mapping_disable(&bios_mapping);
|
||||
mem_mapping_disable(&bios_high_mapping);
|
||||
|
||||
@@ -1621,7 +1621,7 @@ const device_t modem_device = {
|
||||
.init = modem_init,
|
||||
.close = modem_close,
|
||||
.reset = NULL,
|
||||
.poll = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = modem_speed_changed,
|
||||
.force_redraw = NULL,
|
||||
.config = modem_config
|
||||
|
||||
@@ -161,9 +161,9 @@ nvr_init(nvr_t *nvr)
|
||||
int c;
|
||||
|
||||
/* Set up the NVR file's name. */
|
||||
c = strlen(machine_get_internal_name()) + 5;
|
||||
c = strlen(machine_get_nvr_name()) + 5;
|
||||
nvr->fn = (char *) malloc(c + 1);
|
||||
sprintf(nvr->fn, "%s.nvr", machine_get_internal_name());
|
||||
sprintf(nvr->fn, "%s.nvr", machine_get_nvr_name());
|
||||
|
||||
/* Initialize the internal clock as needed. */
|
||||
memset(&intclk, 0x00, sizeof(intclk));
|
||||
|
||||
@@ -122,9 +122,9 @@ ps2_nvr_init(const device_t *info)
|
||||
nvr->size = 8192;
|
||||
|
||||
/* Set up the NVR file's name. */
|
||||
c = strlen(machine_get_internal_name()) + 9;
|
||||
c = strlen(machine_get_nvr_name()) + 9;
|
||||
nvr->fn = (char *) malloc(c + 1);
|
||||
sprintf(nvr->fn, "%s_sec.nvr", machine_get_internal_name());
|
||||
sprintf(nvr->fn, "%s_sec.nvr", machine_get_nvr_name());
|
||||
|
||||
io_sethandler(0x0074, 3,
|
||||
ps2_nvr_read, NULL, NULL, ps2_nvr_write, NULL, NULL, nvr);
|
||||
|
||||
Reference in New Issue
Block a user