static TIMER_CALLBACK(microtouch_timer_callback) { if ( microtouch.tx_buffer_ptr < microtouch.tx_buffer_num ) { microtouch.tx_callback( machine, microtouch.tx_buffer[microtouch.tx_buffer_ptr++] ); if ( microtouch.tx_buffer_ptr == microtouch.tx_buffer_num ) { microtouch.tx_buffer_ptr = microtouch.tx_buffer_num = 0; } return; } if ( (microtouch.reset_done == 0) || ((microtouch.format_tablet == 0) && (microtouch.format_decimal == 0)) || (microtouch.mode_inactive == 1) || (microtouch.mode_stream == 0) ) { return; } // send format tablet packet if ( input_port_read(machine, "TOUCH") & 0x01 ) { int tx = input_port_read(machine, "TOUCH_X"); int ty = input_port_read(machine, "TOUCH_Y"); if ( microtouch.touch_callback == NULL || microtouch.touch_callback( machine, &tx, &ty ) != 0 ) { ty = 0x4000 - ty; if ( microtouch.format_tablet ) { microtouch_send_format_table_packet(0xc8, tx, ty); } else if ( microtouch.format_decimal ) { microtouch_send_format_decimal_packet(tx, ty); } microtouch.last_touch_state = 1; microtouch.last_x = tx; microtouch.last_y = ty; } } else { if ( microtouch.last_touch_state == 1 ) { microtouch.last_touch_state = 0; if ( microtouch.format_tablet ) { microtouch_send_format_table_packet(0x88, microtouch.last_x, microtouch.last_y); } else if ( microtouch.format_decimal ) { microtouch_send_format_decimal_packet(microtouch.last_x, microtouch.last_y); } } } };
static void microtouch_send_touch_packet(running_machine &machine) { int tx = input_port_read(machine, "TOUCH_X"); int ty = input_port_read(machine, "TOUCH_Y"); if ( microtouch.touch_callback == NULL || microtouch.touch_callback( machine, &tx, &ty ) != 0 ) { ty = 0x4000 - ty; switch( microtouch.format ) { case FORMAT_TABLET: microtouch_send_format_table_packet(0xc8, tx, ty); break; case FORMAT_DECIMAL: microtouch_send_format_decimal_packet(tx, ty); break; case FORMAT_UNKNOWN: break; } microtouch.last_touch_state = 1; microtouch.last_x = tx; microtouch.last_y = ty; } }
static TIMER_CALLBACK(microtouch_timer_callback) { if ( microtouch.tx_buffer_ptr < microtouch.tx_buffer_num ) { microtouch.tx_callback( machine, microtouch.tx_buffer[microtouch.tx_buffer_ptr++] ); if ( microtouch.tx_buffer_ptr == microtouch.tx_buffer_num ) { microtouch.tx_buffer_ptr = microtouch.tx_buffer_num = 0; } return; } if ( (microtouch.reset_done == 0) || (microtouch.format == FORMAT_UNKNOWN) || (microtouch.mode != MODE_STREAM)) { return; } // send format tablet packet if ( input_port_read(machine, "TOUCH") & 0x01 ) { microtouch_send_touch_packet(machine); } else { if ( microtouch.last_touch_state == 1 ) { microtouch.last_touch_state = 0; switch( microtouch.format ) { case FORMAT_TABLET: microtouch_send_format_table_packet(0x88, microtouch.last_x, microtouch.last_y); break; case FORMAT_DECIMAL: microtouch_send_format_decimal_packet(microtouch.last_x, microtouch.last_y); break; case FORMAT_UNKNOWN: break; } } } };