diff --git a/src/device/mouse.c b/src/device/mouse.c index 98ce0eaf4..7eb6a08a9 100644 --- a/src/device/mouse.c +++ b/src/device/mouse.c @@ -75,19 +75,20 @@ static const device_t mouse_internal_device = { static mouse_t mouse_devices[] = { // clang-format off - { &mouse_none_device }, - { &mouse_internal_device }, - { &mouse_logibus_device }, - { &mouse_msinport_device }, + { &mouse_none_device }, + { &mouse_internal_device }, + { &mouse_logibus_device }, + { &mouse_msinport_device }, #if 0 - { &mouse_genibus_device }, + { &mouse_genibus_device }, #endif - { &mouse_mssystems_device }, - { &mouse_msserial_device }, - { &mouse_ltserial_device }, - { &mouse_ps2_device }, - { &mouse_wacom_device }, - { NULL } + { &mouse_mssystems_device }, + { &mouse_msserial_device }, + { &mouse_ltserial_device }, + { &mouse_ps2_device }, + { &mouse_wacom_device }, + { &mouse_wacom_artpad_device }, + { NULL } // clang-format on }; diff --git a/src/device/mouse_wacom_tablet.c b/src/device/mouse_wacom_tablet.c index f6f39fa95..09d98083e 100644 --- a/src/device/mouse_wacom_tablet.c +++ b/src/device/mouse_wacom_tablet.c @@ -9,6 +9,7 @@ #include <86box/mouse.h> #include <86box/serial.h> #include <86box/plat.h> +#include <86box/fifo8.h> #define FLAG_3BTN 0x20 /* enable 3-button mode */ @@ -19,34 +20,112 @@ enum wacom_modes { WACOM_MODE_SWITCH = 3, }; +enum wacom_handshake_modes { + WACOM_HANDSHAKE_NONE = 0, + WACOM_HANDSHAKE_CTS = 1, + WACOM_HANDSHAKE_DTS = 2, + WACOM_HANDSHAKE_BOTH = 3, +}; + +enum wacom_cmd_set { + WACOM_CMDSET_BITPAD = 0, + WACOM_CMDSET_MM1201 = 1, + WACOM_CMDSET_IIS = 2, + WACOM_CMDSET_IV = 3 +}; + +enum wacom_tablet_type { + WACOM_TYPE_IISONLY = 0, + WACOM_TYPE_IV, +}; + enum { REPORT_PHASE_PREPARE, REPORT_PHASE_TRANSMIT }; +typedef struct wacom_tablet_id { + char id[64]; + int type; +} wacom_tablet_id; + +static const wacom_tablet_id sd510_id = { + .id = "~#SD51C V3.2.1.01\r", + .type = WACOM_TYPE_IISONLY +}; + +static const wacom_tablet_id artpad_id = { + .id = "~#KT-0405-R00 V1.1-0\r", + .type = WACOM_TYPE_IV +}; + +static const uint32_t wacom_resolution_values[4] = { + 500, + 508, + 1000, + 1270 +}; + typedef struct { const char *name; /* name of this device */ int8_t type, /* type of this device */ port; uint8_t flags, but, /* device flags */ - status, format, - data_len, data[64], + status, bits, data_rec[0x200]; int abs_x, abs_y, rel_x, rel_y, oldb, b; - int data_pos, data_rec_pos, mode, transmission_ongoing, transmission_format, interval; + Fifo8 data; + + int data_rec_pos, mode, interval; int increment, suppressed_increment; int transmission_stopped; int reset; int transmit_id, transmit_id_pending; int pressure_mode; - int suppressed, measurement, always_report; - int remote_req, remote_mode; + int suppressed, measurement; + int remote_req; + + uint32_t x_res, y_res; + const wacom_tablet_id* tablet_type; - int last_abs_x, last_abs_y; /* Suppressed/Increment Mode. */ - uint32_t settings; /* Settings DWORD */ + int last_abs_x, last_abs_y; /* Suppressed/Increment Mode. */ + union { + uint32_t settings; /* Settings DWORD */ + /* We don't target any architectures except x86/x64/ARM32/ARM64. + (The ABIs for those are explicit in little-endian bit ordering) */ + struct { + uint8_t remote_mode : 1; + uint8_t bitpad_two_cursor_data : 1; + uint8_t mm961_orientation : 1; + uint8_t mm_command_set : 1; + uint8_t tilt : 1; + uint8_t multi_device : 1; + uint8_t reading_height : 1; + uint8_t pressure_sensitivity : 1; + + uint8_t pnp : 1; /* Unused. */ + uint8_t dummy : 1; + uint8_t terminator : 2; + uint8_t out_of_range_data : 1; + uint8_t origin_location : 1; + uint8_t resolution : 2; + + uint8_t transfer_rate : 2; + uint8_t coord_sys : 1; + uint8_t output_format : 1; + uint8_t transfer_mode : 2; + uint8_t handshake : 2; + + uint8_t stop_bits_conf : 1; + uint8_t data_bits_conf : 1; + uint8_t parity : 2; + uint8_t baud_rate : 2; + uint8_t cmd_set : 2; + } settings_bits; + }; double transmit_period; double old_tsc, reset_tsc; @@ -55,12 +134,22 @@ typedef struct { serial_t *serial; } mouse_wacom_t; +static unsigned int +reverse(register unsigned int x) +{ + x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); + x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); + x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); + x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); + return ((x >> 16) | (x << 16)); +} + static double wacom_transmit_period(mouse_wacom_t *dev, int bps, int rps) { double dbps = (double) bps; double temp = 0.0; - int word_len = 10; + int word_len = dev->bits; if (rps == -1) temp = (double) word_len; @@ -74,25 +163,82 @@ wacom_transmit_period(mouse_wacom_t *dev, int bps, int rps) return temp; } +static void +wacom_process_settings_dword(mouse_wacom_t *wacom, uint32_t dword) +{ + wacom->settings = dword; + + wacom->mode = wacom->settings_bits.transfer_mode; + + wacom->bits = 1 + 7 + wacom->settings_bits.data_bits_conf; + wacom->bits += 1 + wacom->settings_bits.stop_bits_conf; + if (wacom->settings_bits.parity == 2 && !(wacom->bits % 2)) { + wacom->bits++; + } else if (wacom->settings_bits.parity == 3 && (wacom->bits % 2)) { + wacom->bits++; + } + + switch(wacom->settings_bits.baud_rate) { + case 0: + wacom->transmit_period = wacom_transmit_period(wacom, 2400, -1); + break; + + case 1: + wacom->transmit_period = wacom_transmit_period(wacom, 4800, -1); + break; + + case 2: + wacom->transmit_period = wacom_transmit_period(wacom, 9600, -1); + break; + + case 3: + wacom->transmit_period = wacom_transmit_period(wacom, 19200, -1); + break; + } + + mouse_mode = !wacom->settings_bits.coord_sys; + wacom->x_res = wacom->y_res = wacom_resolution_values[wacom->settings_bits.resolution]; +} + static void wacom_reset(mouse_wacom_t *wacom) { - wacom->transmit_period = wacom_transmit_period(wacom, 9600, -1); - wacom->mode = WACOM_MODE_POINT; - wacom->data_pos = 0; - wacom->transmission_ongoing = 0; - wacom->mode = 0; - wacom->transmission_stopped = 0; - wacom->interval = 0; - wacom->transmit_id = 0; - wacom->format = 0; /* ASCII */ - wacom->measurement = 1; + wacom->transmit_period = wacom_transmit_period(wacom, 9600, -1); + wacom->mode = WACOM_MODE_POINT; + wacom->transmission_stopped = 0; + wacom->interval = 0; + wacom->transmit_id = 0; + wacom->settings_bits.output_format = 1; /* ASCII */ + wacom->settings_bits.cmd_set = 1; + wacom->measurement = 1; wacom->increment = wacom->suppressed_increment = 0; wacom->reset_tsc = tsc; - wacom->remote_mode = wacom->remote_req = 0; - wacom->always_report = 0; + wacom->settings_bits.remote_mode = wacom->remote_req = 0; + wacom->settings_bits.out_of_range_data = 0; mouse_mode = 1; + wacom_process_settings_dword(wacom, 0xA21BC800); +} + +static void +wacom_reset_artpad(mouse_wacom_t *wacom) +{ + wacom->transmit_period = wacom_transmit_period(wacom, 9600, -1); + wacom->mode = WACOM_MODE_SUPPRESSED; + wacom->transmission_stopped = 0; + wacom->interval = 0; + wacom->transmit_id = 0; + wacom->settings_bits.output_format = 0; /* Binary */ + wacom->measurement = 1; + wacom->increment = 0; + wacom->suppressed_increment = 1; + wacom->reset_tsc = tsc; + wacom->settings_bits.remote_mode = 0; + wacom->remote_req = 0; + wacom->settings_bits.out_of_range_data = 0; + + wacom_process_settings_dword(wacom, 0xE203C000); + mouse_mode = 1; } static void @@ -100,7 +246,23 @@ wacom_callback(struct serial_s *serial, void *priv) { mouse_wacom_t *wacom = (mouse_wacom_t *) priv; - wacom->transmit_period = wacom_transmit_period(wacom, 9600, -1); + switch(wacom->settings_bits.baud_rate) { + case 0: + wacom->transmit_period = wacom_transmit_period(wacom, 2400, -1); + break; + + case 1: + wacom->transmit_period = wacom_transmit_period(wacom, 4800, -1); + break; + + case 2: + wacom->transmit_period = wacom_transmit_period(wacom, 9600, -1); + break; + + case 3: + wacom->transmit_period = wacom_transmit_period(wacom, 19200, -1); + break; + } timer_stop(&wacom->report_timer); timer_on_auto(&wacom->report_timer, wacom->transmit_period); } @@ -119,8 +281,15 @@ wacom_write(struct serial_s *serial, void *priv, uint8_t data) switch (data) { case '#': { - if (!wacom->transmission_ongoing) - wacom->transmit_id++; + wacom->transmit_id = 1; + break; + } + case 'C': + case '*': + case 'R': + { + wacom->data_rec[wacom->data_rec_pos++] = '~'; + wacom->data_rec[wacom->data_rec_pos++] = data; break; } } @@ -130,7 +299,15 @@ wacom_write(struct serial_s *serial, void *priv, uint8_t data) if (data == '@') { wacom->remote_req = 1; - wacom->remote_mode = 1; + wacom->settings_bits.remote_mode = 1; + return; + } + if (data == '#' && wacom->tablet_type->type == WACOM_TYPE_IV) { + wacom_reset_artpad(wacom); + return; + } + if (data == '$') { + wacom_reset(wacom); return; } if (data == 0x13) { @@ -139,7 +316,7 @@ wacom_write(struct serial_s *serial, void *priv, uint8_t data) } if (data == 0x11) { wacom->transmission_stopped = 0; - wacom->remote_mode = wacom->remote_req = 0; + wacom->settings_bits.remote_mode = wacom->remote_req = 0; return; } wacom->data_rec[wacom->data_rec_pos++] = data; @@ -151,39 +328,72 @@ wacom_write(struct serial_s *serial, void *priv, uint8_t data) pclog("Wacom: written %s", wacom->data_rec); else pclog("Wacom: written %s\n", wacom->data_rec); - if (!memcmp(wacom->data_rec, "AS", 2)) { - wacom->format = (wacom->data_rec[2] == '1'); - wacom->transmission_ongoing = 0; + if (!memcmp(wacom->data_rec, "AS", 2) && wacom->settings_bits.cmd_set == WACOM_CMDSET_IIS) { + wacom->settings_bits.output_format = !(wacom->data_rec[2] == '1'); } else if (!memcmp(wacom->data_rec, "SR", 2)) { wacom->mode = WACOM_MODE_STREAM; - wacom->suppressed_increment = 0; } else if (!memcmp(wacom->data_rec, "IN", 2)) { sscanf((const char *) wacom->data_rec, "IN%d", &wacom->increment); - } else if (!memcmp(wacom->data_rec, "RE", 2) || wacom->data_rec[0] == '$' || wacom->data_rec[0] == '#') { - wacom_reset(wacom); + } else if (!memcmp(wacom->data_rec, "RE", 2)) { + if (wacom->tablet_type->type == WACOM_TYPE_IV) wacom_reset_artpad(wacom); + else wacom_reset(wacom); } else if (!memcmp(wacom->data_rec, "IT", 2)) { sscanf((const char *) wacom->data_rec, "IT%d", &wacom->interval); - } else if (!memcmp(wacom->data_rec, "DE", 2)) { + } else if (!memcmp(wacom->data_rec, "DE", 2) && wacom->settings_bits.cmd_set == WACOM_CMDSET_IIS) { sscanf((const char *) wacom->data_rec, "DE%d", &mouse_mode); mouse_mode = !mouse_mode; plat_mouse_capture(0); } else if (!memcmp(wacom->data_rec, "SU", 2)) { sscanf((const char *) wacom->data_rec, "SU%d", &wacom->suppressed_increment); - } else if (!memcmp(wacom->data_rec, "PH", 2)) { + wacom->settings_bits.transfer_mode = wacom->mode = WACOM_MODE_SUPPRESSED; + } else if (!memcmp(wacom->data_rec, "PH", 2) && wacom->settings_bits.cmd_set == WACOM_CMDSET_IIS) { sscanf((const char *) wacom->data_rec, "PH%d", &wacom->pressure_mode); } else if (!memcmp(wacom->data_rec, "IC", 2)) { sscanf((const char *) wacom->data_rec, "IC%d", &wacom->measurement); + } else if (!memcmp(wacom->data_rec, "SW", 2)) { + wacom->mode = WACOM_MODE_SWITCH; } else if (!memcmp(wacom->data_rec, "AL", 2)) { - sscanf((const char *) wacom->data_rec, "AL%d", &wacom->always_report); + uint8_t out_of_range_data = wacom->settings_bits.out_of_range_data; + wacom->settings_bits.out_of_range_data = !!out_of_range_data; } else if (!memcmp(wacom->data_rec, "RQ", 2)) { - sscanf((const char *) wacom->data_rec, "RQ%d", &wacom->remote_mode); - if (wacom->remote_mode) + uint8_t remote_mode = 0; + sscanf((const char *) wacom->data_rec, "RQ%d", &remote_mode); + wacom->settings_bits.remote_mode = !!remote_mode; + if (wacom->settings_bits.remote_mode) wacom->remote_req = 1; } else if (!memcmp(wacom->data_rec, "SP", 2)) { wacom->transmission_stopped = 1; } else if (!memcmp(wacom->data_rec, "ST", 2)) { wacom->transmission_stopped = 0; - wacom->remote_mode = wacom->remote_req = 0; + wacom->settings_bits.remote_mode = wacom->remote_req = 0; + } else if (!memcmp(wacom->data_rec, "NR", 2)) { + sscanf((const char *) wacom->data_rec, "NR%d", &wacom->x_res); + wacom->y_res = wacom->x_res; + } else if (wacom->tablet_type->type == WACOM_TYPE_IV && wacom->data_rec[0] == '~') { + if (!memcmp(wacom->data_rec, "~*", 2)) { + uint32_t settings_dword = wacom->settings; + if (strstr(wacom->data_rec, ",")) { + uint32_t x_res = wacom->x_res, y_res = wacom->y_res; + uint32_t increment = wacom->increment; + uint32_t interval = wacom->interval; + + sscanf("~*%08X,%d,%d,%d,%d", wacom->data_rec, &settings_dword, &increment, &interval, &x_res, &y_res); + + wacom->interval = interval; + wacom->increment = increment; + wacom->x_res = x_res; + wacom->y_res = y_res; + } else { + sscanf("~*%X", wacom->data_rec, &settings_dword); + } + wacom_process_settings_dword(wacom, settings_dword); + } else if (!memcmp(wacom->data_rec, "~C", 2)) { + fifo8_push_all(&wacom->data, "~C5039,3779\r", sizeof("~C5039,3779\r") - 1); + } else if (!memcmp(wacom->data_rec, "~R", 2)) { + uint8_t data[256] = { 0 }; + snprintf(data, sizeof(data), "~*%08X,%d,%d,%d,%d\r", wacom->settings, wacom->increment, wacom->interval, wacom->x_res, wacom->y_res); + fifo8_push_all(&wacom->data, data, strlen(data)); + } } } } @@ -192,18 +402,24 @@ static int wacom_poll(int x, int y, int z, int b, double abs_x, double abs_y, void *priv) { mouse_wacom_t *wacom = (mouse_wacom_t *) priv; - wacom->abs_x = abs_x * (wacom->measurement ? 4566. : 5800.); - wacom->abs_y = abs_y * (wacom->measurement ? 2972. : 3774.); - if (wacom->abs_x > (wacom->measurement ? 4566 : 5800)) - wacom->abs_x = (wacom->measurement ? 4566 : 5800); - if (wacom->abs_y > (wacom->measurement ? 2972 : 3774)) - wacom->abs_x = (wacom->measurement ? 2972 : 3774); - if (wacom->abs_x < 0) - wacom->abs_x = 0; - if (wacom->abs_y < 0) - wacom->abs_y = 0; - wacom->rel_x = x; - wacom->rel_y = y; + + if (wacom->settings_bits.cmd_set == WACOM_CMDSET_IV) { + wacom->abs_x = abs_x * 5039. * (wacom->x_res / 1000.); + wacom->abs_y = abs_y * 3779. * (wacom->y_res / 1000.); + } else { + wacom->abs_x = abs_x * (wacom->measurement ? 4566. : 5800.); + wacom->abs_y = abs_y * (wacom->measurement ? 2972. : 3774.); + if (wacom->abs_x > (wacom->measurement ? 4566 : 5800)) + wacom->abs_x = (wacom->measurement ? 4566 : 5800); + if (wacom->abs_y > (wacom->measurement ? 2972 : 3774)) + wacom->abs_x = (wacom->measurement ? 2972 : 3774); + if (wacom->abs_x < 0) + wacom->abs_x = 0; + if (wacom->abs_y < 0) + wacom->abs_y = 0; + wacom->rel_x = x; + wacom->rel_y = y; + } if (wacom->b != b) wacom->oldb = wacom->b; wacom->b = b; @@ -239,54 +455,72 @@ wacom_get_switch(int b) static void wacom_transmit_prepare(mouse_wacom_t *wacom, int x, int y) { - wacom->transmission_ongoing = 1; - wacom->data_pos = 0; - memset(wacom->data, 0, sizeof(wacom->data)); if (wacom->transmit_id) { - wacom->transmission_format = 0; - snprintf((char *) wacom->data, sizeof(wacom->data), "~#SD51C V3.2.1.01\r"); + uint8_t data[128] = { 0 }; + snprintf((char *) data, sizeof(data), "%s", wacom->tablet_type->id); + fifo8_push_all(&wacom->data, data, strlen(data)); + wacom->transmit_id = 0; return; } - wacom->transmission_format = wacom->format; wacom->last_abs_x = wacom->abs_x; wacom->last_abs_y = wacom->abs_y; wacom->remote_req = 0; wacom->oldb = wacom->b; - if (wacom->format == 1) { - wacom->data[0] = 0xC0; - wacom->data[6] = wacom->pressure_mode ? ((wacom->b & 0x1) ? (uint8_t) 31 : (uint8_t) -31) : wacom_get_switch(wacom->b); + if (wacom->settings_bits.output_format == 0) { + uint8_t data[7]; + data[0] = 0xC0; + if (wacom->settings_bits.cmd_set == WACOM_CMDSET_IV) { + if (tablet_tool_type == 0) + data[6] = ((wacom->b & 0x1) ? (uint8_t) 31 : (uint8_t) -1); + else + data[6] = ((wacom->b & 0x1) ? (uint8_t) 63 : (uint8_t) -63); + } + else + data[6] = (wacom->pressure_mode || wacom->settings_bits.cmd_set == WACOM_CMDSET_IV) ? ((wacom->b & 0x1) ? (uint8_t) 31 : (uint8_t) -31) : wacom_get_switch(wacom->b); - wacom->data[5] = (y & 0x7F); - wacom->data[4] = ((y & 0x3F80) >> 7) & 0x7F; - wacom->data[3] = (((y & 0xC000) >> 14) & 3); + data[5] = (y & 0x7F); + data[4] = ((y & 0x3F80) >> 7) & 0x7F; + data[3] = (((y & 0xC000) >> 14) & 3); - wacom->data[2] = (x & 0x7F); - wacom->data[1] = ((x & 0x3F80) >> 7) & 0x7F; - wacom->data[0] |= (((x & 0xC000) >> 14) & 3); + data[2] = (x & 0x7F); + data[1] = ((x & 0x3F80) >> 7) & 0x7F; + data[0] |= (((x & 0xC000) >> 14) & 3); - if (mouse_mode == 0) { - wacom->data[0] |= (!!(x < 0)) << 2; - wacom->data[3] |= (!!(y < 0)) << 2; + if (mouse_mode == 0 && wacom->settings_bits.cmd_set == WACOM_CMDSET_IIS) { + data[0] |= (!!(x < 0)) << 2; + data[3] |= (!!(y < 0)) << 2; } - if (wacom->pressure_mode) { - wacom->data[0] |= 0x10; - wacom->data[6] &= 0x7F; + if (wacom->settings_bits.cmd_set == WACOM_CMDSET_IV) { + data[6] &= 0x7F; + data[3] &= 0x3; + if (wacom_get_switch(wacom->b) != 0x21) { + data[3] |= (wacom_get_switch(wacom->b) & 0xF) << 3; + data[0] |= 0x8; + } + } + + if (wacom->pressure_mode && wacom->settings_bits.cmd_set == WACOM_CMDSET_IIS) { + data[0] |= 0x10; + data[6] &= 0x7F; } if (tablet_tool_type == 1) { - wacom->data[0] |= 0x20; + data[0] |= 0x20; } if (!mouse_tablet_in_proximity) { - wacom->data[0] &= ~0x40; + data[0] &= ~0x40; } + fifo8_push_all(&wacom->data, data, 7); } else { - wacom->data[0] = 0; - snprintf((char *) wacom->data, sizeof(wacom->data), "*,%05d,%05d,%d\r\n", + uint8_t data[128]; + data[0] = 0; + snprintf((char *) data, sizeof(data), "*,%05d,%05d,%d\r\n", wacom->abs_x, wacom->abs_y, wacom->pressure_mode ? ((wacom->b & 0x1) ? (uint8_t) -31 : (uint8_t) 15) : ((wacom->b & 0x1) ? 21 : 00)); + fifo8_push_all(&wacom->data, data, strlen(data)); } } @@ -306,17 +540,17 @@ wacom_report_timer(void *priv) timer_on_auto(&wacom->report_timer, wacom->transmit_period); if ((((double) (tsc - wacom->reset_tsc)) / cpuclock * 1000.0) <= 10) return; - if (wacom->transmit_id && !wacom->transmission_ongoing) + if (wacom->transmit_id) goto transmit_prepare; - if (wacom->transmission_ongoing) + if (fifo8_num_used(&wacom->data)) goto transmit; - else if (wacom->remote_mode && !wacom->remote_req) + else if (wacom->settings_bits.remote_mode && !wacom->remote_req) return; else { - if (wacom->remote_mode && wacom->remote_req) { + if (wacom->settings_bits.remote_mode && wacom->remote_req) { goto transmit_prepare; } - if (wacom->transmission_stopped || (!mouse_tablet_in_proximity && !wacom->always_report)) + if (wacom->transmission_stopped || (!mouse_tablet_in_proximity && !wacom->settings_bits.out_of_range_data)) return; if (milisecond_diff >= (wacom->interval * 5)) { @@ -331,6 +565,8 @@ wacom_report_timer(void *priv) case WACOM_MODE_POINT: { + if (wacom->suppressed_increment) + break; if (!(wacom_switch_off_to_on(wacom->b, wacom->oldb))) return; break; @@ -345,6 +581,9 @@ wacom_report_timer(void *priv) } } + if (increment && !mouse_tablet_in_proximity) + return; + if (increment && !(x_diff > increment || y_diff > increment)) { if (wacom->suppressed_increment && (wacom->b == wacom->oldb)) return; @@ -358,12 +597,8 @@ transmit_prepare: wacom_transmit_prepare(wacom, x, y); transmit: - serial_write_fifo(wacom->serial, wacom->data[wacom->data_pos++]); - if ((wacom->transmission_format == 0 && wacom->data[wacom->data_pos] == 0) - || (wacom->transmission_format == 1 && wacom->data_pos == 7)) { - wacom->transmission_ongoing = 0; - wacom->transmit_id = 0; - wacom->data_pos = 0; + serial_write_fifo(wacom->serial, fifo8_pop(&wacom->data)); + if (fifo8_num_used(&wacom->data) == 0) { wacom->old_tsc = tsc; } return; @@ -377,6 +612,13 @@ wacom_init(const device_t *info) dev = (mouse_wacom_t *) calloc(1, sizeof(mouse_wacom_t)); dev->name = info->name; dev->but = 3; + dev->bits = 10; + if (info->local == 0) { + dev->tablet_type = &sd510_id; + } else + dev->tablet_type = (wacom_tablet_id*)info->local; + + fifo8_create(&dev->data, 512); dev->port = device_get_config_int("port"); @@ -384,7 +626,11 @@ wacom_init(const device_t *info) timer_add(&dev->report_timer, wacom_report_timer, dev, 0); mouse_set_buttons(dev->but); - wacom_reset(dev); + if (dev->tablet_type->type == WACOM_TYPE_IV) { + wacom_reset_artpad(dev); + wacom_process_settings_dword(dev, 0xE2018000); + } + else wacom_reset(dev); return dev; } @@ -402,6 +648,8 @@ wacom_close(void *priv) { mouse_wacom_t *dev = (mouse_wacom_t *) priv; + fifo8_destroy(&dev->data); + /* Detach serial port from the mouse. */ if (dev && dev->serial && dev->serial->sd) memset(dev->serial->sd, 0, sizeof(serial_device_t)); @@ -435,7 +683,21 @@ const device_t mouse_wacom_device = { .name = "Wacom SD-510C", .internal_name = "wacom_serial", .flags = DEVICE_COM, - .local = MOUSE_TYPE_WACOM, + .local = 0, + .init = wacom_init, + .close = wacom_close, + .reset = NULL, + { .poll = wacom_poll }, + .speed_changed = wacom_speed_changed, + .force_redraw = NULL, + .config = wacom_config +}; + +const device_t mouse_wacom_artpad_device = { + .name = "Wacom ArtPad", + .internal_name = "wacom_serial_artpad", + .flags = DEVICE_COM, + .local = (uintptr_t)&artpad_id, .init = wacom_init, .close = wacom_close, .reset = NULL, diff --git a/src/include/86box/mouse.h b/src/include/86box/mouse.h index e6ad93e80..317e267a0 100644 --- a/src/include/86box/mouse.h +++ b/src/include/86box/mouse.h @@ -35,6 +35,7 @@ #define MOUSE_TYPE_LT3BUTTON 10 /* Logitech 3-button Serial Mouse */ #define MOUSE_TYPE_PS2 11 /* PS/2 series Bus Mouse */ #define MOUSE_TYPE_WACOM 12 /* WACOM tablet */ +#define MOUSE_TYPE_WACOMARTP 13 /* WACOM tablet (ArtPad) */ #define MOUSE_TYPE_ONBOARD 0x80 /* Mouse is an on-board version of one of the above. */ @@ -65,6 +66,7 @@ extern const device_t mouse_msserial_device; extern const device_t mouse_ltserial_device; extern const device_t mouse_ps2_device; extern const device_t mouse_wacom_device; +extern const device_t mouse_wacom_artpad_device; #endif extern void mouse_init(void); diff --git a/src/include/86box/snd_mpu401.h b/src/include/86box/snd_mpu401.h index 4afbc6b53..a6ef8d271 100644 --- a/src/include/86box/snd_mpu401.h +++ b/src/include/86box/snd_mpu401.h @@ -26,7 +26,7 @@ #define MPU401_VERSION 0x15 #define MPU401_REVISION 0x01 -#define MPU401_QUEUE 64 +#define MPU401_QUEUE 1024 #define MPU401_INPUT_QUEUE 1024 #define MPU401_TIMECONSTANT (60000000 / 1000.0f) #define MPU401_RESETBUSY 27.0f diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index b61613b89..ecf5887a0 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -206,13 +206,13 @@ msgid "&About 86Box..." msgstr "關於 86Box(&A)..." msgid "&New image..." -msgstr "新增鏡像(&N)..." +msgstr "新增映像(&N)..." msgid "&Existing image..." -msgstr "開啟已存在的鏡像(&E)..." +msgstr "開啟已存在的映像(&E)..." msgid "Existing image (&Write-protected)..." -msgstr "開啟已存在的鏡像並寫保護(&W)..." +msgstr "開啟已存在的映像並寫保護(&W)..." msgid "&Record" msgstr "錄製(&R)" @@ -227,10 +227,10 @@ msgid "&Fast forward to the end" msgstr "快進至終點(&F)" msgid "E&ject" -msgstr "彈出(&J)" +msgstr "退出(&J)" msgid "&Image..." -msgstr "鏡像(&I)..." +msgstr "映像(&I)..." msgid "E&xport to 86F..." msgstr "匯出為 86F 格式(&x)..." @@ -242,7 +242,7 @@ msgid "E&mpty" msgstr "空置光碟機(&M)" msgid "&Reload previous image" -msgstr "載入上一個鏡像(&R)" +msgstr "載入上一個映像(&R)" msgid "&Folder..." msgstr "資料夾(&F)..." @@ -272,7 +272,7 @@ msgid "&VSync" msgstr "垂直同步(&V)" msgid "&Select shader..." -msgstr "選擇著色器(&S)..." +msgstr "選取著色器(&S)..." msgid "&Remove shader" msgstr "移除著色器(&R)" @@ -284,7 +284,7 @@ msgid "Sound Gain" msgstr "音量增益" msgid "New Image" -msgstr "新增鏡像" +msgstr "新增映像" msgid "Settings" msgstr "設定" @@ -533,7 +533,7 @@ msgid "&New..." msgstr "新增(&N)..." msgid "&Existing..." -msgstr "已有鏡像(&E)..." +msgstr "已有映像(&E)..." msgid "&Remove" msgstr "移除(&R)" @@ -566,10 +566,10 @@ msgid "Type:" msgstr "類型:" msgid "Image Format:" -msgstr "鏡像格式:" +msgstr "映像格式:" msgid "Block Size:" -msgstr "塊大小:" +msgstr "區塊大小:" msgid "Floppy drives:" msgstr "軟碟機:" @@ -647,10 +647,10 @@ msgid "ZIP %03i %i (%s): %ls" msgstr "ZIP %03i %i (%s): %ls" msgid "ZIP images" -msgstr "ZIP 鏡像" +msgstr "ZIP 映像" msgid "86Box could not find any usable ROM images.\n\nPlease download a ROM set and extract it into the \"roms\" directory." -msgstr "86Box 找不到任何可用的 ROM 鏡像。\n\n請下載ROM 包並將其解壓到 \"roms\" 資料夾。" +msgstr "86Box 找不到任何可用的 ROM 映像。\n\n請下載ROM 包並將其解壓到 \"roms\" 資料夾。" msgid "(empty)" msgstr "(空)" @@ -668,13 +668,13 @@ msgid "Off" msgstr "關" msgid "All images" -msgstr "所有鏡像" +msgstr "所有映像" msgid "Basic sector images" -msgstr "基本磁區鏡像" +msgstr "基本磁區映像" msgid "Surface images" -msgstr "表面鏡像" +msgstr "表面映像" msgid "Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine." msgstr "由於 roms/machines 資料夾中缺少合適的 ROM,機型 \"%hs\" 不可用。將切換到其他可用機型。" @@ -806,10 +806,10 @@ msgid "Floppy %i (%s): %ls" msgstr "軟碟 %i (%s): %ls" msgid "Advanced sector images" -msgstr "進階磁區鏡像" +msgstr "進階磁區映像" msgid "Flux images" -msgstr "Flux 鏡像" +msgstr "Flux 映像" msgid "Unable to initialize FreeType" msgstr "無法初始化 FreeType" @@ -830,7 +830,7 @@ msgid "MO %i (%ls): %ls" msgstr "磁光碟 %i (%ls): %ls" msgid "MO images" -msgstr "磁光碟鏡像" +msgstr "磁光碟映像" msgid "Welcome to 86Box!" msgstr "歡迎使用 86Box!" @@ -920,7 +920,7 @@ msgid "Don't reset" msgstr "不重設" msgid "CD-ROM images" -msgstr "光碟鏡像" +msgstr "光碟映像" msgid "%hs Device Configuration" msgstr "%hs 裝置配置" @@ -947,13 +947,13 @@ msgid "Cassette: %s" msgstr "磁帶: %s" msgid "Cassette images" -msgstr "磁帶鏡像" +msgstr "磁帶映像" msgid "Cartridge %i: %ls" msgstr "卡帶 %i: %ls" msgid "Cartridge images" -msgstr "卡帶鏡像" +msgstr "卡帶映像" msgid "Error initializing renderer" msgstr "初始化渲染器時出錯" @@ -1004,13 +1004,13 @@ msgid "Add Existing Hard Disk" msgstr "添加已存在的硬碟" msgid "HDI disk images cannot be larger than 4 GB." -msgstr "HDI 磁碟鏡像不能超過 4 GB。" +msgstr "HDI 磁碟映像不能超過 4 GB。" msgid "Disk images cannot be larger than 127 GB." -msgstr "磁碟鏡像不能超過 127 GB。" +msgstr "磁碟映像不能超過 127 GB。" msgid "Hard disk images" -msgstr "硬碟鏡像" +msgstr "硬碟映像" msgid "Unable to read file" msgstr "無法讀取檔案" @@ -1019,19 +1019,19 @@ msgid "Unable to write file" msgstr "無法寫入檔案" msgid "HDI or HDX images with a sector size other than 512 are not supported." -msgstr "不支援非 512 位元組磁區大小的 HDI 或 HDX 鏡像。" +msgstr "不支援非 512 位元組磁區大小的 HDI 或 HDX 映像。" msgid "USB is not yet supported" msgstr "尚未支援 USB" msgid "Disk image file already exists" -msgstr "磁碟鏡像檔案已存在" +msgstr "磁碟映像檔案已存在" msgid "Please specify a valid file name." msgstr "請指定有效的檔案名。" msgid "Disk image created" -msgstr "已創建磁碟鏡像" +msgstr "已創建磁碟映像" msgid "Make sure the file exists and is readable." msgstr "請確定此檔案已存在並可讀取。" @@ -1040,16 +1040,16 @@ msgid "Make sure the file is being saved to a writable directory." msgstr "請確定此檔案保存在可寫目錄中。" msgid "Disk image too large" -msgstr "磁碟鏡像太大" +msgstr "磁碟映像太大" msgid "Remember to partition and format the newly-created drive." -msgstr "請記得為新創建的鏡像分區並格式化。" +msgstr "請記得為新創建的映像分區並格式化。" msgid "The selected file will be overwritten. Are you sure you want to use it?" msgstr "選定的檔案將被覆蓋。確定繼續使用此檔案嗎?" msgid "Unsupported disk image" -msgstr "不支援的磁碟鏡像" +msgstr "不支援的磁碟映像" msgid "Overwrite" msgstr "覆蓋" @@ -1058,13 +1058,13 @@ msgid "Don't overwrite" msgstr "不覆蓋" msgid "Raw image (.img)" -msgstr "原始鏡像 (.img)" +msgstr "原始映像 (.img)" msgid "HDI image (.hdi)" -msgstr "HDI 鏡像 (.hdi)" +msgstr "HDI 映像 (.hdi)" msgid "HDX image (.hdx)" -msgstr "HDX 鏡像 (.hdx)" +msgstr "HDX 映像 (.hdx)" msgid "Fixed-size VHD (.vhd)" msgstr "固定大小 VHD (.vhd)" @@ -1076,19 +1076,19 @@ msgid "Differencing VHD (.vhd)" msgstr "差分 VHD (.vhd)" msgid "Large blocks (2 MB)" -msgstr "大塊 (2 MB)" +msgstr "大區塊 (2 MB)" msgid "Small blocks (512 KB)" -msgstr "小塊 (512 KB)" +msgstr "小區塊 (512 KB)" msgid "VHD files" msgstr "VHD 檔案" msgid "Select the parent VHD" -msgstr "選擇父 VHD 檔案" +msgstr "選取父 VHD 檔案" msgid "This could mean that the parent image was modified after the differencing image was created.\n\nIt can also happen if the image files were moved or copied, or by a bug in the program that created this disk.\n\nDo you want to fix the timestamps?" -msgstr "父映像可能在創建差異鏡像後被修改。\n\n如果鏡像檔案被移動或複製,或創建此磁碟的程式中存在錯誤,也可能發生這種情況。\n\n是否需要修復時間戳?" +msgstr "父映像可能在創建差異映像後被修改。\n\n如果映像檔案被移動或複製,或創建此磁碟的程式中存在錯誤,也可能發生這種情況。\n\n是否需要修復時間戳?" msgid "Parent and child disk timestamps do not match" msgstr "父碟與子碟的時間戳不匹配" @@ -1175,34 +1175,34 @@ msgid "ZIP 100" msgstr "ZIP 100" msgid "3.5\" 128 MB (ISO 10090)" -msgstr "3.5 英寸 128 MB (ISO 10090)" +msgstr "3.5 英吋 128 MB (ISO 10090)" msgid "3.5\" 230 MB (ISO 13963)" -msgstr "3.5 英寸 230 MB (ISO 13963)" +msgstr "3.5 英吋 230 MB (ISO 13963)" msgid "3.5\" 540 MB (ISO 15498)" -msgstr "3.5 英寸 540 MB (ISO 15498)" +msgstr "3.5 英吋 540 MB (ISO 15498)" msgid "3.5\" 640 MB (ISO 15498)" -msgstr "3.5 英寸 640 MB (ISO 15498)" +msgstr "3.5 英吋 640 MB (ISO 15498)" msgid "3.5\" 1.3 GB (GigaMO)" -msgstr "3.5 英寸 1.3 GB (GigaMO)" +msgstr "3.5 英吋 1.3 GB (GigaMO)" msgid "3.5\" 2.3 GB (GigaMO 2)" -msgstr "3.5 英寸 2.3 GB (GigaMO 2)" +msgstr "3.5 英吋 2.3 GB (GigaMO 2)" msgid "5.25\" 600 MB" -msgstr "5.25 英寸 600 MB" +msgstr "5.25 英吋 600 MB" msgid "5.25\" 650 MB" -msgstr "5.25 英寸 650 MB" +msgstr "5.25 英吋 650 MB" msgid "5.25\" 1 GB" -msgstr "5.25 英寸 1 GB" +msgstr "5.25 英吋 1 GB" msgid "5.25\" 1.3 GB" -msgstr "5.25 英寸 1.3 GB" +msgstr "5.25 英吋 1.3 GB" msgid "Perfect RPM" msgstr "標準轉速 (RPM)" @@ -1218,4 +1218,3 @@ msgstr "低於標準轉速的 2%" msgid "(System Default)" msgstr "(系統預設)" - diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 29f8af5aa..a41a3e889 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -138,7 +138,11 @@ main_thread_fn() } is_quit = 1; - QTimer::singleShot(0, QApplication::instance(), []() { QApplication::instance()->quit(); }); + if (gfxcard[1]) { + ui_deinit_monitor(1); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + } + QTimer::singleShot(0, QApplication::instance(), []() { QApplication::processEvents(); QApplication::instance()->quit(); }); } static std::thread *main_thread; diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 65af4d8d3..f360a83e9 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -733,7 +733,9 @@ MainWindow::initRendererMonitorSlot(int monitor_index) secondaryRenderer->showMaximized(); } secondaryRenderer->switchRenderer((RendererStack::Renderer) vid_api); + secondaryRenderer->setMouseTracking(true); } + connect(this, &MainWindow::pollMouse, secondaryRenderer.get(), &RendererStack::mousePoll, Qt::DirectConnection); } } diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index 9ebd891c3..3f7c36199 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -127,7 +127,7 @@ qt_mouse_capture(int on) { if (!on) { mouse_capture = 0; - QApplication::setOverrideCursor(Qt::ArrowCursor); + if (QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); #ifdef __APPLE__ CGAssociateMouseAndMouseCursorPosition(true); #endif @@ -144,6 +144,20 @@ qt_mouse_capture(int on) void RendererStack::mousePoll() { + if (m_monitor_index >= 1) { + if (mouse_mode >= 1) { + mouse_x_abs = mousedata.x_abs; + mouse_y_abs = mousedata.y_abs; + if (!mouse_tablet_in_proximity) { + mouse_tablet_in_proximity = mousedata.mouse_tablet_in_proximity; + } + if (mousedata.mouse_tablet_in_proximity) { + mouse_buttons = mousedata.mousebuttons; + } + } + return; + } + #ifdef Q_OS_WINDOWS if (mouse_mode == 0) { mouse_x_abs = mousedata.x_abs; @@ -151,6 +165,7 @@ RendererStack::mousePoll() return; } #endif + #ifndef __APPLE__ mouse_x = mousedata.deltax; mouse_y = mousedata.deltay; @@ -270,8 +285,9 @@ void RendererStack::leaveEvent(QEvent *event) { mousedata.mouse_tablet_in_proximity = 0; - if (mouse_mode == 1) - QApplication::setOverrideCursor(Qt::ArrowCursor); + + if (mouse_mode == 1 && QApplication::overrideCursor()) + QApplication::restoreOverrideCursor(); if (QApplication::platformName().contains("wayland")) { event->accept(); return; diff --git a/src/qt/qt_winrawinputfilter.cpp b/src/qt/qt_winrawinputfilter.cpp index 522130432..ccaea1f56 100644 --- a/src/qt/qt_winrawinputfilter.cpp +++ b/src/qt/qt_winrawinputfilter.cpp @@ -45,9 +45,11 @@ #include #include +#include "qt_rendererstack.hpp" + extern "C" void win_joystick_handle(PRAWINPUT); std::unique_ptr -WindowsRawInputFilter::Register(QMainWindow *window) +WindowsRawInputFilter::Register(MainWindow *window) { HWND wnd = (HWND) window->winId(); @@ -70,7 +72,7 @@ WindowsRawInputFilter::Register(QMainWindow *window) return inputfilter; } -WindowsRawInputFilter::WindowsRawInputFilter(QMainWindow *window) +WindowsRawInputFilter::WindowsRawInputFilter(MainWindow *window) { this->window = window; @@ -108,8 +110,18 @@ WindowsRawInputFilter::nativeEventFilter(const QByteArray &eventType, void *mess MSG *msg = static_cast(message); if (msg->message == WM_INPUT) { + if (window->isActiveWindow() && menus_open == 0) handle_input((HRAWINPUT) msg->lParam); + else + { + for (auto &w : window->renderers) { + if (w && w->isActiveWindow()) { + handle_input((HRAWINPUT) msg->lParam); + break; + } + } + } return true; } diff --git a/src/qt/qt_winrawinputfilter.hpp b/src/qt/qt_winrawinputfilter.hpp index b03f6783e..81b2c0d48 100644 --- a/src/qt/qt_winrawinputfilter.hpp +++ b/src/qt/qt_winrawinputfilter.hpp @@ -41,6 +41,8 @@ #include +#include "qt_mainwindow.hpp" + #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) # define result_t qintptr #else @@ -51,7 +53,7 @@ class WindowsRawInputFilter : public QObject, public QAbstractNativeEventFilter Q_OBJECT public: - static std::unique_ptr Register(QMainWindow *window); + static std::unique_ptr Register(MainWindow *window); bool nativeEventFilter(const QByteArray &eventType, void *message, result_t *result) override; @@ -61,7 +63,7 @@ public slots: void mousePoll(); private: - QMainWindow *window; + MainWindow *window; uint16_t scancode_map[768]; int buttons = 0; int dx = 0; @@ -69,7 +71,7 @@ private: int dwheel = 0; int menus_open = 0; - WindowsRawInputFilter(QMainWindow *window); + WindowsRawInputFilter(MainWindow *window); void handle_input(HRAWINPUT input); void keyboard_handle(PRAWINPUT raw); diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index a70a9552d..50ed4f5a3 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -5126,9 +5126,9 @@ mystique_hwcursor_draw(svga_t *svga, int displine) case XCURCTRL_CURMODE_XGA: for (x = 0; x < 64; x++) { if (!(dat[1] & (1ull << 63))) - buffer32->line[displine][offset + svga->x_add] = (dat[0] & (1ull << 63)) ? mystique->cursor.col[1] : mystique->cursor.col[0]; + svga->monitor->target_buffer->line[displine][offset + svga->x_add] = (dat[0] & (1ull << 63)) ? mystique->cursor.col[1] : mystique->cursor.col[0]; else if (dat[0] & (1ull << 63)) - buffer32->line[displine][offset + svga->x_add] ^= 0xffffff; + svga->monitor->target_buffer->line[displine][offset + svga->x_add] ^= 0xffffff; offset++; dat[0] <<= 1; diff --git a/src/video/vid_table.c b/src/video/vid_table.c index fb6624ced..e4b53978b 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -199,7 +199,7 @@ video_cards[] = { { &s3_diamond_stealth_4000_pci_device }, { &s3_trio3d2x_pci_device }, #if defined(DEV_BRANCH) && defined(USE_MGA) - { &millennium_device }, + { &millennium_device, VIDEO_FLAG_TYPE_SPECIAL }, { &mystique_device }, { &mystique_220_device }, #endif diff --git a/src/video/vid_tvp3026_ramdac.c b/src/video/vid_tvp3026_ramdac.c index 148c9b748..783b52abf 100644 --- a/src/video/vid_tvp3026_ramdac.c +++ b/src/video/vid_tvp3026_ramdac.c @@ -489,7 +489,7 @@ tvp3026_hwcursor_draw(svga_t *svga, int displine) y_pos = displine; x_pos = offset + svga->x_add; - p = buffer32->line[y_pos]; + p = svga->monitor->target_buffer->line[y_pos]; if (offset >= svga->dac_hwcursor_latch.x) { switch (mode) { diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index ef94f9846..6ad91ad1f 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -2265,10 +2265,9 @@ banshee_overlay_draw(svga_t *svga, int displine) case VIDPROCCFG_FILTER_MODE_DITHER_4X4: if (banshee->voodoo->scrfilter && banshee->voodoo->scrfilterEnabled) { - uint8_t fil[64 * 3]; - uint8_t fil3[64 * 3]; + uint8_t fil[2048 * 3]; + uint8_t fil3[2048 * 3]; - assert(svga->overlay_latch.cur_xsize <= 64); if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) /* leilei HACK - don't know of real 4x1 hscaled behavior yet, double for now */ { for (x = 0; x < svga->overlay_latch.cur_xsize; x++) { @@ -2335,16 +2334,15 @@ banshee_overlay_draw(svga_t *svga, int displine) case VIDPROCCFG_FILTER_MODE_DITHER_2X2: if (banshee->voodoo->scrfilter && banshee->voodoo->scrfilterEnabled) { - uint8_t fil[64 * 3]; - uint8_t soak[64 * 3]; - uint8_t soak2[64 * 3]; + uint8_t fil[2048 * 3]; + uint8_t soak[2048 * 3]; + uint8_t soak2[2048 * 3]; - uint8_t samp1[64 * 3]; - uint8_t samp2[64 * 3]; - uint8_t samp3[64 * 3]; - uint8_t samp4[64 * 3]; + uint8_t samp1[2048 * 3]; + uint8_t samp2[2048 * 3]; + uint8_t samp3[2048 * 3]; + uint8_t samp4[2048 * 3]; - assert(svga->overlay_latch.cur_xsize <= 64); src = &svga->vram[src_addr2 & svga->vram_mask]; OVERLAY_SAMPLE(banshee->overlay_buffer[1]); for (x = 0; x < svga->overlay_latch.cur_xsize; x++) { diff --git a/src/vnc.c b/src/vnc.c index eaa1d89fe..fcf966d65 100644 --- a/src/vnc.c +++ b/src/vnc.c @@ -98,6 +98,14 @@ vnc_mouse_poll(void) mouse_buttons = ms.buttons; b = ms.buttons; } + + mouse_x_abs = (double)ptr_x / (double)allowedX; + mouse_y_abs = (double)ptr_y / (double)allowedY; + + if (mouse_x_abs > 1.0) mouse_x_abs = 1.0; + if (mouse_y_abs > 1.0) mouse_y_abs = 1.0; + if (mouse_x_abs < 0.0) mouse_x_abs = 0.0; + if (mouse_y_abs < 0.0) mouse_y_abs = 0.0; } static void diff --git a/src/win/languages/zh-TW.rc b/src/win/languages/zh-TW.rc index 5325f0815..4262889a1 100644 --- a/src/win/languages/zh-TW.rc +++ b/src/win/languages/zh-TW.rc @@ -137,17 +137,17 @@ CassetteSubmenu MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "新增鏡像(&N)...", IDM_CASSETTE_IMAGE_NEW + MENUITEM "新增映像(&N)...", IDM_CASSETTE_IMAGE_NEW MENUITEM SEPARATOR - MENUITEM "開啟已存在的鏡像(&E)...", IDM_CASSETTE_IMAGE_EXISTING - MENUITEM "開啟已存在的鏡像並寫保護(&W)...", IDM_CASSETTE_IMAGE_EXISTING_WP + MENUITEM "開啟已存在的映像(&E)...", IDM_CASSETTE_IMAGE_EXISTING + MENUITEM "開啟已存在的映像並寫保護(&W)...", IDM_CASSETTE_IMAGE_EXISTING_WP MENUITEM SEPARATOR MENUITEM "錄製(&R)", IDM_CASSETTE_RECORD MENUITEM "播放(&P)", IDM_CASSETTE_PLAY MENUITEM "倒帶至起點(&R)", IDM_CASSETTE_REWIND MENUITEM "快進至終點(&F)", IDM_CASSETTE_FAST_FORWARD MENUITEM SEPARATOR - MENUITEM "彈出(&J)", IDM_CASSETTE_EJECT + MENUITEM "退出(&J)", IDM_CASSETTE_EJECT END END @@ -155,9 +155,9 @@ CartridgeSubmenu MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "鏡像(&I)...", IDM_CARTRIDGE_IMAGE + MENUITEM "映像(&I)...", IDM_CARTRIDGE_IMAGE MENUITEM SEPARATOR - MENUITEM "彈出(&J)", IDM_CARTRIDGE_EJECT + MENUITEM "退出(&J)", IDM_CARTRIDGE_EJECT END END @@ -165,14 +165,14 @@ FloppySubmenu MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "新增鏡像(&N)...", IDM_FLOPPY_IMAGE_NEW + MENUITEM "新增映像(&N)...", IDM_FLOPPY_IMAGE_NEW MENUITEM SEPARATOR - MENUITEM "開啟已存在的鏡像(&E)...", IDM_FLOPPY_IMAGE_EXISTING - MENUITEM "開啟已存在的鏡像並寫保護(&W)...", IDM_FLOPPY_IMAGE_EXISTING_WP + MENUITEM "開啟已存在的映像(&E)...", IDM_FLOPPY_IMAGE_EXISTING + MENUITEM "開啟已存在的映像並寫保護(&W)...", IDM_FLOPPY_IMAGE_EXISTING_WP MENUITEM SEPARATOR MENUITEM "匯出為 86F 格式(&x)...", IDM_FLOPPY_EXPORT_TO_86F MENUITEM SEPARATOR - MENUITEM "彈出(&J)", IDM_FLOPPY_EJECT + MENUITEM "退出(&J)", IDM_FLOPPY_EJECT END END @@ -183,9 +183,9 @@ BEGIN MENUITEM "靜音(&M)", IDM_CDROM_MUTE MENUITEM SEPARATOR MENUITEM "空置光碟機(&M)", IDM_CDROM_EMPTY - MENUITEM "載入上一個鏡像(&R)", IDM_CDROM_RELOAD + MENUITEM "載入上一個映像(&R)", IDM_CDROM_RELOAD MENUITEM SEPARATOR - MENUITEM "鏡像(&I)...", IDM_CDROM_IMAGE + MENUITEM "映像(&I)...", IDM_CDROM_IMAGE MENUITEM "資料夾(&F)...", IDM_CDROM_DIR END END @@ -194,13 +194,13 @@ ZIPSubmenu MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "新增鏡像(&N)...", IDM_ZIP_IMAGE_NEW + MENUITEM "新增映像(&N)...", IDM_ZIP_IMAGE_NEW MENUITEM SEPARATOR - MENUITEM "開啟已存在的鏡像(&E)...", IDM_ZIP_IMAGE_EXISTING - MENUITEM "開啟已存在的鏡像並寫保護(&W)...", IDM_ZIP_IMAGE_EXISTING_WP + MENUITEM "開啟已存在的映像(&E)...", IDM_ZIP_IMAGE_EXISTING + MENUITEM "開啟已存在的映像並寫保護(&W)...", IDM_ZIP_IMAGE_EXISTING_WP MENUITEM SEPARATOR - MENUITEM "彈出(&J)", IDM_ZIP_EJECT - MENUITEM "載入上一個鏡像(&R)", IDM_ZIP_RELOAD + MENUITEM "退出(&J)", IDM_ZIP_EJECT + MENUITEM "載入上一個映像(&R)", IDM_ZIP_RELOAD END END @@ -208,13 +208,13 @@ MOSubmenu MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "新增鏡像(&N)...", IDM_MO_IMAGE_NEW + MENUITEM "新增映像(&N)...", IDM_MO_IMAGE_NEW MENUITEM SEPARATOR - MENUITEM "開啟已存在的鏡像(&E)...", IDM_MO_IMAGE_EXISTING - MENUITEM "開啟已存在的鏡像並寫保護(&W)...", IDM_MO_IMAGE_EXISTING_WP + MENUITEM "開啟已存在的映像(&E)...", IDM_MO_IMAGE_EXISTING + MENUITEM "開啟已存在的映像並寫保護(&W)...", IDM_MO_IMAGE_EXISTING_WP MENUITEM SEPARATOR - MENUITEM "鏡像(&J)", IDM_MO_EJECT - MENUITEM "載入上一個鏡像(&R)", IDM_MO_RELOAD + MENUITEM "退出(&J)", IDM_MO_EJECT + MENUITEM "載入上一個映像(&R)", IDM_MO_RELOAD END END @@ -230,7 +230,7 @@ BEGIN MENUITEM "75 fps(&7)", IDM_VID_GL_FPS_75 END MENUITEM "垂直同步(&V)", IDM_VID_GL_VSYNC - MENUITEM "選擇著色器(&S)...", IDM_VID_GL_SHADER + MENUITEM "選取著色器(&S)...", IDM_VID_GL_SHADER MENUITEM "移除著色器(&R)", IDM_VID_GL_NOSHADER END @@ -242,7 +242,7 @@ END #define STR_PREFERENCES "首選項" #define STR_SND_GAIN "音量增益" -#define STR_NEW_FLOPPY "新增鏡像" +#define STR_NEW_FLOPPY "新增映像" #define STR_CONFIG "設定" #define STR_SPECIFY_DIM "指定主視窗大小" @@ -346,7 +346,7 @@ END #define STR_HDD "硬碟:" #define STR_NEW "新增(&N)..." -#define STR_EXISTING "已有鏡像(&E)..." +#define STR_EXISTING "已有映像(&E)..." #define STR_REMOVE "移除(&R)" #define STR_BUS "匯流排:" #define STR_CHANNEL "通道:" @@ -359,8 +359,8 @@ END #define STR_CYLS "柱面(C):" #define STR_SIZE_MB "大小 (MB):" #define STR_TYPE "類型:" -#define STR_IMG_FORMAT "鏡像格式:" -#define STR_BLOCK_SIZE "塊大小:" +#define STR_IMG_FORMAT "映像格式:" +#define STR_BLOCK_SIZE "區塊大小:" #define STR_FLOPPY_DRIVES "軟碟機:" #define STR_TURBO "加速時序" @@ -401,14 +401,14 @@ BEGIN IDS_2052 "按下 Ctrl+Alt+PgDn 返回到視窗模式。" IDS_2053 "速度" IDS_2054 "ZIP %03i %i (%s): %ls" - IDS_2055 "ZIP 鏡像 (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0" - IDS_2056 "86Box 找不到任何可用的 ROM 鏡像。\n\n請下載ROM 包並將其解壓到 ""roms"" 資料夾。" + IDS_2055 "ZIP 映像 (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0" + IDS_2056 "86Box 找不到任何可用的 ROM 映像。\n\n請下載ROM 包並將其解壓到 ""roms"" 資料夾。" IDS_2057 "(空)" - IDS_2058 "ZIP 鏡像 (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0所有檔案 (*.*)\0*.*\0" + IDS_2058 "ZIP 映像 (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0所有檔案 (*.*)\0*.*\0" IDS_2059 "加速" IDS_2060 "開" IDS_2061 "關" - IDS_2062 "所有鏡像 (*.86F;*.DSK;*.FLP;*.IM?;*.*FD?)\0*.86F;*.DSK;*.FLP;*.IM?;*.*FD?\0基本磁區鏡像 (*.DSK;*.FLP;*.IM?;*.*FD?)\0*.DSK;*.FLP;*.IM?;*.IMG;*.*FD?\0表面鏡像 (*.86F)\0*.86F\0" + IDS_2062 "所有映像 (*.86F;*.DSK;*.FLP;*.IM?;*.*FD?)\0*.86F;*.DSK;*.FLP;*.IM?;*.*FD?\0基本磁區映像 (*.DSK;*.FLP;*.IM?;*.*FD?)\0*.DSK;*.FLP;*.IM?;*.IMG;*.*FD?\0表面映像 (*.86F)\0*.86F\0" IDS_2063 "由於 roms/machines 資料夾中缺少合適的 ROM,機型 ""%hs"" 不可用。將切換到其他可用機型。" END @@ -426,7 +426,7 @@ BEGIN IDS_2073 "軟碟/光碟機" IDS_2074 "其他可移除裝置" IDS_2075 "其他周邊裝置" - IDS_2076 "表面鏡像 (*.86F)\0*.86F\0" + IDS_2076 "表面映像 (*.86F)\0*.86F\0" IDS_2077 "點擊視窗捕捉滑鼠" IDS_2078 "按下 F8+F12 釋放滑鼠" IDS_2079 "按下 F8+F12 或滑鼠中鍵釋放滑鼠" @@ -464,14 +464,14 @@ BEGIN IDS_2107 "%u" IDS_2108 "%u MB (CHS: %i, %i, %i)" IDS_2109 "軟碟 %i (%s): %ls" - IDS_2110 "所有鏡像 (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF\0進階磁區鏡像 (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0基本磁區鏡像 (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux 鏡像 (*.FDI)\0*.FDI\0表面鏡像 (*.86F;*.MFM)\0*.86F;*.MFM\0所有檔案 (*.*)\0*.*\0" + IDS_2110 "所有映像 (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF\0進階磁區映像 (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0基本磁區映像 (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux 映像 (*.FDI)\0*.FDI\0表面映像 (*.86F;*.MFM)\0*.86F;*.MFM\0所有檔案 (*.*)\0*.*\0" IDS_2111 "無法初始化 FreeType" IDS_2112 "無法初始化 SDL,需要 SDL2.dll" IDS_2113 "確定要硬重設模擬器嗎?" IDS_2114 "確定要退出 86Box 嗎?" IDS_2115 "無法初始化 Ghostscript" IDS_2116 "磁光碟 %i (%ls): %ls" - IDS_2117 "磁光碟鏡像 (*.IM?;*.MDI)\0*.IM?;*.MDI\0所有檔案 (*.*)\0*.*\0" + IDS_2117 "磁光碟映像 (*.IM?;*.MDI)\0*.IM?;*.MDI\0所有檔案 (*.*)\0*.*\0" IDS_2118 "歡迎使用 86Box!" IDS_2119 "內部控制器" IDS_2120 "退出" @@ -515,8 +515,8 @@ BEGIN IDS_2137 "不退出" IDS_2138 "重設" IDS_2139 "不重設" - IDS_2140 "磁光碟鏡像 (*.IM?;*.MDI)\0*.IM?;*.MDI\0所有檔案 (*.*)\0*.*\0" - IDS_2141 "光碟鏡像 (*.ISO;*.CUE)\0*.ISO;*.CUE\0所有檔案 (*.*)\0*.*\0" + IDS_2140 "磁光碟映像 (*.IM?;*.MDI)\0*.IM?;*.MDI\0所有檔案 (*.*)\0*.*\0" + IDS_2141 "光碟映像 (*.ISO;*.CUE)\0*.ISO;*.CUE\0所有檔案 (*.*)\0*.*\0" IDS_2142 "%hs 裝置配置" IDS_2143 "顯示器處在睡眠狀態" IDS_2144 "OpenGL 著色器 (*.GLSL)\0*.GLSL\0所有檔案 (*.*)\0*.*\0" @@ -525,9 +525,9 @@ BEGIN IDS_2147 "此模擬電腦禁用了基於選定電腦的 CPU 類型過濾。\n\n能夠選中與所選機器本不相容的 CPU,但是可能會遇到與機器 BIOS 或其他軟體不相容的問題。\n\n啟用此設定不受官方支援,並且提交的任何錯誤報告可能會視為無效而關閉。" IDS_2148 "繼續" IDS_2149 "磁帶: %s" - IDS_2150 "磁帶鏡像 (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0所有檔案 (*.*)\0*.*\0" + IDS_2150 "磁帶映像 (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0所有檔案 (*.*)\0*.*\0" IDS_2151 "卡帶 %i: %ls" - IDS_2152 "卡帶鏡像 (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0所有檔案 (*.*)\0*.*\0" + IDS_2152 "卡帶映像 (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0所有檔案 (*.*)\0*.*\0" IDS_2153 "初始化渲染器時出錯" IDS_2154 "無法初始化 OpenGL (3.0 核心) 渲染器。請使用其他渲染器。" IDS_2155 "恢復執行" @@ -554,35 +554,35 @@ BEGIN IDS_4101 "自訂 (大容量)..." IDS_4102 "添加新硬碟" IDS_4103 "添加已存在的硬碟" - IDS_4104 "HDI 磁碟鏡像不能超過 4 GB。" - IDS_4105 "磁碟鏡像不能超過 127 GB。" - IDS_4106 "硬碟鏡像 (*.HD?;*.IM?;*.VHD)\0*.HD?;*.IM?;*.VHD\0所有檔案 (*.*)\0*.*\0" + IDS_4104 "HDI 磁碟映像不能超過 4 GB。" + IDS_4105 "磁碟映像不能超過 127 GB。" + IDS_4106 "硬碟映像 (*.HD?;*.IM?;*.VHD)\0*.HD?;*.IM?;*.VHD\0所有檔案 (*.*)\0*.*\0" IDS_4107 "無法讀取檔案" IDS_4108 "無法寫入檔案" - IDS_4109 "不支援非 512 位元組磁區大小的 HDI 或 HDX 鏡像。" + IDS_4109 "不支援非 512 位元組磁區大小的 HDI 或 HDX 映像。" IDS_4110 "尚未支援 USB" - IDS_4111 "磁碟鏡像檔案已存在" + IDS_4111 "磁碟映像檔案已存在" IDS_4112 "請指定有效的檔案名。" - IDS_4113 "已創建磁碟鏡像" + IDS_4113 "已創建磁碟映像" IDS_4114 "請確定此檔案已存在並可讀取。" IDS_4115 "請確定此檔案保存在可寫目錄中。" - IDS_4116 "磁碟鏡像太大" - IDS_4117 "請記得為新創建的鏡像分區並格式化。" + IDS_4116 "磁碟映像太大" + IDS_4117 "請記得為新創建的映像分區並格式化。" IDS_4118 "選定的檔案將被覆蓋。確定繼續使用此檔案嗎?" - IDS_4119 "不支援的磁碟鏡像" + IDS_4119 "不支援的磁碟映像" IDS_4120 "覆蓋" IDS_4121 "不覆蓋" - IDS_4122 "原始鏡像 (.img)" - IDS_4123 "HDI 鏡像 (.hdi)" - IDS_4124 "HDX 鏡像 (.hdx)" + IDS_4122 "原始映像 (.img)" + IDS_4123 "HDI 映像 (.hdi)" + IDS_4124 "HDX 映像 (.hdx)" IDS_4125 "固定大小 VHD (.vhd)" IDS_4126 "動態大小 VHD (.vhd)" IDS_4127 "差分 VHD (.vhd)" - IDS_4128 "大塊 (2 MB)" - IDS_4129 "小塊 (512 KB)" + IDS_4128 "大區塊 (2 MB)" + IDS_4129 "小區塊 (512 KB)" IDS_4130 "VHD 檔案 (*.VHD)\0*.VHD\0所有檔案 (*.*)\0*.*\0" - IDS_4131 "選擇父 VHD 檔案" - IDS_4132 "父映像可能在創建差異鏡像後被修改。\n\n如果鏡像檔案被移動或複製,或創建此磁碟的程式中存在錯誤,也可能發生這種情況。\n\n是否需要修復時間戳?" + IDS_4131 "選取父 VHD 檔案" + IDS_4132 "父映像可能在創建差異映像後被修改。\n\n如果映像檔案被移動或複製,或創建此磁碟的程式中存在錯誤,也可能發生這種情況。\n\n是否需要修復時間戳?" IDS_4133 "父碟與子碟的時間戳不匹配" IDS_4134 "無法修復 VHD 時間戳。" IDS_4135 "%01i:%02i" @@ -625,16 +625,16 @@ BEGIN IDS_5899 "2.88 MB" IDS_5900 "ZIP 100" IDS_5901 "ZIP 250" - IDS_5902 "3.5 英寸 128 MB (ISO 10090)" - IDS_5903 "3.5 英寸 230 MB (ISO 13963)" - IDS_5904 "3.5 英寸 540 MB (ISO 15498)" - IDS_5905 "3.5 英寸 640 MB (ISO 15498)" - IDS_5906 "3.5 英寸 1.3 GB (GigaMO)" - IDS_5907 "3.5 英寸 2.3 GB (GigaMO 2)" - IDS_5908 "5.25 英寸 600 MB" - IDS_5909 "5.25 英寸 650 MB" - IDS_5910 "5.25 英寸 1 GB" - IDS_5911 "5.25 英寸 1.3 GB" + IDS_5902 "3.5 英吋 128 MB (ISO 10090)" + IDS_5903 "3.5 英吋 230 MB (ISO 13963)" + IDS_5904 "3.5 英吋 540 MB (ISO 15498)" + IDS_5905 "3.5 英吋 640 MB (ISO 15498)" + IDS_5906 "3.5 英吋 1.3 GB (GigaMO)" + IDS_5907 "3.5 英吋 2.3 GB (GigaMO 2)" + IDS_5908 "5.25 英吋 600 MB" + IDS_5909 "5.25 英吋 650 MB" + IDS_5910 "5.25 英吋 1 GB" + IDS_5911 "5.25 英吋 1.3 GB" IDS_6144 "標準轉速 (RPM)" IDS_6145 "低於標準轉速的 1%" diff --git a/src/win/win_settings.c b/src/win/win_settings.c index b6166c76c..932338698 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -101,21 +101,29 @@ static int temp_mouse, temp_joystick; /* Sound category */ static int temp_sound_card[SOUND_CARD_MAX]; -static int temp_midi_output_device, temp_midi_input_device, temp_mpu401; -static int temp_float, temp_fm_driver; +static int temp_midi_output_device; +static int temp_midi_input_device; +static int temp_mpu401; +static int temp_float; +static int temp_fm_driver; /* Network category */ -static int temp_net_type[NET_CARD_MAX]; -static int temp_net_card[NET_CARD_MAX]; -static char temp_pcap_dev[NET_CARD_MAX][128]; +static int temp_net_type[NET_CARD_MAX]; +static uint16_t temp_net_card[NET_CARD_MAX]; +static char temp_pcap_dev[NET_CARD_MAX][128]; /* Ports category */ -static int temp_lpt_devices[PARALLEL_MAX]; -static int temp_serial[SERIAL_MAX], temp_lpt[PARALLEL_MAX]; -static int temp_serial_passthrough_enabled[SERIAL_MAX]; +static int temp_lpt_devices[PARALLEL_MAX]; +static uint8_t temp_serial[SERIAL_MAX]; +static uint8_t temp_lpt[PARALLEL_MAX]; +static int temp_serial_passthrough_enabled[SERIAL_MAX]; /* Other peripherals category */ -static int temp_fdc_card, temp_hdc, temp_ide_ter, temp_ide_qua, temp_cassette; +static int temp_fdc_card; +static int temp_hdc; +static int temp_ide_ter; +static int temp_ide_qua; +static int temp_cassette; static int temp_scsi_card[SCSI_BUS_MAX]; static int temp_bugger; static int temp_postcard; @@ -442,7 +450,7 @@ win_settings_init(void) static int win_settings_changed(void) { - int i = 0, j = 0; + int i = 0; /* Machine category */ i = i || (machine != temp_machine); @@ -468,7 +476,7 @@ win_settings_changed(void) i = i || (joystick_type != temp_joystick); /* Sound category */ - for (j = 0; j < SOUND_CARD_MAX; j++) + for (uint8_t j = 0; j < SOUND_CARD_MAX; j++) i = i || (sound_card_current[j] != temp_sound_card[j]); i = i || (midi_output_device_current != temp_midi_output_device); i = i || (midi_input_device_current != temp_midi_input_device); @@ -477,24 +485,24 @@ win_settings_changed(void) i = i || (fm_driver != temp_fm_driver); /* Network category */ - for (j = 0; j < NET_CARD_MAX; j++) { + for (uint8_t j = 0; j < NET_CARD_MAX; j++) { i = i || (net_cards_conf[j].net_type != temp_net_type[j]); i = i || strcmp(temp_pcap_dev[j], net_cards_conf[j].host_dev_name); i = i || (net_cards_conf[j].device_num != temp_net_card[j]); } /* Ports category */ - for (j = 0; j < PARALLEL_MAX; j++) { + for (uint8_t j = 0; j < PARALLEL_MAX; j++) { i = i || (temp_lpt_devices[j] != lpt_ports[j].device); i = i || (temp_lpt[j] != lpt_ports[j].enabled); } - for (j = 0; j < SERIAL_MAX; j++) { + for (uint8_t j = 0; j < SERIAL_MAX; j++) { i = i || (temp_serial[j] != com_ports[j].enabled); i = i || (temp_serial_passthrough_enabled[i] != serial_passthrough_enabled[i]); } /* Storage devices category */ - for (j = 0; j < SCSI_BUS_MAX; j++) + for (uint8_t j = 0; j < SCSI_BUS_MAX; j++) i = i || (temp_scsi_card[j] != scsi_card_current[j]); i = i || (fdc_type != temp_fdc_card); i = i || (hdc_current != temp_hdc); @@ -506,7 +514,7 @@ win_settings_changed(void) i = i || memcmp(hdd, temp_hdd, HDD_NUM * sizeof(hard_disk_t)); /* Floppy drives category */ - for (j = 0; j < FDD_NUM; j++) { + for (uint8_t j = 0; j < FDD_NUM; j++) { i = i || (temp_fdd_types[j] != fdd_get_type(j)); i = i || (temp_fdd_turbo[j] != fdd_get_turbo(j)); i = i || (temp_fdd_check_bpb[j] != fdd_get_check_bpb(j)); @@ -523,7 +531,7 @@ win_settings_changed(void) i = i || (temp_isartc != isartc_type); /* ISA memory boards. */ - for (j = 0; j < ISAMEM_MAX; j++) + for (uint8_t j = 0; j < ISAMEM_MAX; j++) i = i || (temp_isamem[j] != isamem_type[j]); i = i || !!temp_deviceconfig; @@ -535,8 +543,6 @@ win_settings_changed(void) static void win_settings_save(void) { - int i = 0; - pc_reset_hard_close(); /* Machine category */ @@ -563,7 +569,7 @@ win_settings_save(void) joystick_type = temp_joystick; /* Sound category */ - for (i = 0; i < SOUND_CARD_MAX; i++) + for (uint8_t i = 0; i < SOUND_CARD_MAX; i++) sound_card_current[i] = temp_sound_card[i]; midi_output_device_current = temp_midi_output_device; midi_input_device_current = temp_midi_input_device; @@ -572,7 +578,7 @@ win_settings_save(void) fm_driver = temp_fm_driver; /* Network category */ - for (i = 0; i < NET_CARD_MAX; i++) { + for (uint8_t i = 0; i < NET_CARD_MAX; i++) { net_cards_conf[i].net_type = temp_net_type[i]; memset(net_cards_conf[i].host_dev_name, '\0', sizeof(net_cards_conf[i].host_dev_name)); strcpy(net_cards_conf[i].host_dev_name, temp_pcap_dev[i]); @@ -580,17 +586,17 @@ win_settings_save(void) } /* Ports category */ - for (i = 0; i < PARALLEL_MAX; i++) { + for (uint8_t i = 0; i < PARALLEL_MAX; i++) { lpt_ports[i].device = temp_lpt_devices[i]; lpt_ports[i].enabled = temp_lpt[i]; } - for (i = 0; i < SERIAL_MAX; i++) { + for (uint8_t i = 0; i < SERIAL_MAX; i++) { com_ports[i].enabled = temp_serial[i]; serial_passthrough_enabled[i] = temp_serial_passthrough_enabled[i]; } /* Storage devices category */ - for (i = 0; i < SCSI_BUS_MAX; i++) + for (uint8_t i = 0; i < SCSI_BUS_MAX; i++) scsi_card_current[i] = temp_scsi_card[i]; hdc_current = temp_hdc; fdc_type = temp_fdc_card; @@ -600,11 +606,11 @@ win_settings_save(void) /* Hard disks category */ memcpy(hdd, temp_hdd, HDD_NUM * sizeof(hard_disk_t)); - for (i = 0; i < HDD_NUM; i++) + for (uint8_t i = 0; i < HDD_NUM; i++) hdd[i].priv = NULL; /* Floppy drives category */ - for (i = 0; i < FDD_NUM; i++) { + for (uint8_t i = 0; i < FDD_NUM; i++) { fdd_set_type(i, temp_fdd_types[i]); fdd_set_turbo(i, temp_fdd_turbo[i]); fdd_set_check_bpb(i, temp_fdd_check_bpb[i]); @@ -612,7 +618,7 @@ win_settings_save(void) /* Removable devices category */ memcpy(cdrom, temp_cdrom, CDROM_NUM * sizeof(cdrom_t)); - for (i = 0; i < CDROM_NUM; i++) { + for (uint8_t i = 0; i < CDROM_NUM; i++) { cdrom[i].is_dir = 0; cdrom[i].priv = NULL; cdrom[i].ops = NULL; @@ -623,12 +629,12 @@ win_settings_save(void) cdrom[i].get_channel = NULL; } memcpy(zip_drives, temp_zip_drives, ZIP_NUM * sizeof(zip_drive_t)); - for (i = 0; i < ZIP_NUM; i++) { + for (uint8_t i = 0; i < ZIP_NUM; i++) { zip_drives[i].f = NULL; zip_drives[i].priv = NULL; } memcpy(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); - for (i = 0; i < MO_NUM; i++) { + for (uint8_t i = 0; i < MO_NUM; i++) { mo_drives[i].f = NULL; mo_drives[i].priv = NULL; } @@ -639,7 +645,7 @@ win_settings_save(void) isartc_type = temp_isartc; /* ISA memory boards. */ - for (i = 0; i < ISAMEM_MAX; i++) + for (uint8_t i = 0; i < ISAMEM_MAX; i++) isamem_type[i] = temp_isamem[i]; /* Mark configuration as changed. */ @@ -2500,7 +2506,7 @@ win_settings_hard_disks_recalc_list(HWND hdlg) lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; - for (i = 0; i < HDD_NUM; i++) { + for (uint8_t i = 0; i < HDD_NUM; i++) { if (temp_hdd[i].bus > 0) { hdc_id_to_listview_index[i] = j; lvI.iSubItem = 0;