Extend the sensor/pointer test screen (#17180)

Added extra edge indicators for special -0x8000 coordinates,
added touch press display, and fixed horizontal wheel display.
This commit is contained in:
zoltanvb 2024-11-11 00:02:00 +01:00 committed by GitHub
parent 7736237872
commit 2a6de277b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 52 additions and 32 deletions

View File

@ -166,7 +166,7 @@ static struct descriptor pointer = {
.port_min = 0, .port_min = 0,
.port_max = 0, .port_max = 0,
.index_min = 0, .index_min = 0,
.index_max = 0, .index_max = 2,
.id_min = RETRO_DEVICE_ID_POINTER_X, .id_min = RETRO_DEVICE_ID_POINTER_X,
.id_max = RETRO_DEVICE_ID_POINTER_COUNT .id_max = RETRO_DEVICE_ID_POINTER_COUNT
}; };
@ -204,7 +204,7 @@ static struct descriptor *descriptors[] = {
}; };
static uint16_t analog_item_colors[32]; static uint16_t analog_item_colors[32];
static uint16_t sensor_item_colors[104]; static uint16_t sensor_item_colors[107];
static uint16_t combo_def[] = static uint16_t combo_def[] =
{ {
@ -1035,6 +1035,8 @@ void NETRETROPAD_CORE_PREFIX(retro_run)(void)
} }
} }
/* Button values for sensor test screen, since they do not follow any pattern, it is *
* provided as a direct list. */
if (mouse_type == NETRETROPAD_MOUSE) if (mouse_type == NETRETROPAD_MOUSE)
{ {
int offset; int offset;
@ -1054,10 +1056,10 @@ void NETRETROPAD_CORE_PREFIX(retro_run)(void)
offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_WHEELDOWN); offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_WHEELDOWN);
sensor_item_colors[84] = mouse.value[offset] ? 0xA000 : 0x0000; sensor_item_colors[84] = mouse.value[offset] ? 0xA000 : 0x0000;
offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP); offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN);
sensor_item_colors[85] = mouse.value[offset] ? 0xA000 : 0x0000; sensor_item_colors[85] = mouse.value[offset] ? 0xA000 : 0x0000;
offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN); offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP);
sensor_item_colors[86] = mouse.value[offset] ? 0xA000 : 0x0000; sensor_item_colors[86] = mouse.value[offset] ? 0xA000 : 0x0000;
offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_BUTTON_4); offset = DESC_OFFSET(&mouse, 0, 0, RETRO_DEVICE_ID_MOUSE_BUTTON_4);
@ -1108,17 +1110,35 @@ void NETRETROPAD_CORE_PREFIX(retro_run)(void)
sensor_item_colors[97] = lightgun.value[offset] ? 0xA000 : 0x0000; sensor_item_colors[97] = lightgun.value[offset] ? 0xA000 : 0x0000;
} }
else if (mouse_type == NETRETROPAD_POINTER)
{
int offset;
offset = DESC_OFFSET(&lightgun, 0, 0, RETRO_DEVICE_ID_POINTER_PRESSED);
sensor_item_colors[104] = pointer.value[offset] ? 0xA000 : 0x0000;
offset = DESC_OFFSET(&lightgun, 0, 1, RETRO_DEVICE_ID_POINTER_PRESSED);
sensor_item_colors[105] = pointer.value[offset] ? 0xA000 : 0x0000;
offset = DESC_OFFSET(&lightgun, 0, 2, RETRO_DEVICE_ID_POINTER_PRESSED);
sensor_item_colors[106] = pointer.value[offset] ? 0xA000 : 0x0000;
}
/* Edge / offscreen indicators */
if (mouse_type == NETRETROPAD_POINTER || mouse_type == NETRETROPAD_LIGHTGUN) if (mouse_type == NETRETROPAD_POINTER || mouse_type == NETRETROPAD_LIGHTGUN)
{ {
sensor_item_colors[90] = (pointer_x == -32768) ? 0xA000 : 0x0000; sensor_item_colors[98] = (pointer_x == -32768) ? 0xA000 : 0x0000;
sensor_item_colors[100] = (pointer_x < -32700) ? 0xA000 : 0x0000; sensor_item_colors[90] = (pointer_x == -32767) ? 0xA000 : 0x0000;
sensor_item_colors[92] = (pointer_x == 32767) ? 0xA000 : 0x0000; sensor_item_colors[100] = (pointer_x < -32700) ? 0xA000 : 0x0000;
sensor_item_colors[102] = (pointer_x > 32700) ? 0xA000 : 0x0000; sensor_item_colors[92] = (pointer_x == 32767) ? 0xA000 : 0x0000;
sensor_item_colors[91] = (pointer_y == -32768) ? 0xA000 : 0x0000; sensor_item_colors[102] = (pointer_x > 32700) ? 0xA000 : 0x0000;
sensor_item_colors[101] = (pointer_y < -32700) ? 0xA000 : 0x0000; sensor_item_colors[99] = (pointer_y == -32768) ? 0xA000 : 0x0000;
sensor_item_colors[93] = (pointer_y == 32767) ? 0xA000 : 0x0000; sensor_item_colors[91] = (pointer_y == -32767) ? 0xA000 : 0x0000;
sensor_item_colors[103] = (pointer_y > 32700) ? 0xA000 : 0x0000; sensor_item_colors[101] = (pointer_y < -32700) ? 0xA000 : 0x0000;
sensor_item_colors[93] = (pointer_y == 32767) ? 0xA000 : 0x0000;
sensor_item_colors[103] = (pointer_y > 32700) ? 0xA000 : 0x0000;
} }
/* Zero indicator */
if (mouse_type != 0) if (mouse_type != 0)
sensor_item_colors[87] = (pointer_x == 0 && pointer_y == 0) ? 0xA000 : 0x0000; sensor_item_colors[87] = (pointer_x == 0 && pointer_y == 0) ? 0xA000 : 0x0000;

View File

@ -698,33 +698,33 @@ static uint16_t sensor_buttons[] =
/* 100 */ 1, 255, /* 100 */ 1, 255,
/* 101 */ 1, 255, /* 101 */ 1, 255,
/* 102 */ 1, 255, /* 102 */ 1, 255,
/* 103 */ 1, 255, /* 103 */ 3, 221, 99, 13, 21,
/* 104 */ 1, 255, /* 104 */ 1, 255,
/* 105 */ 3, 220, 91, 15, 20, /* 105 */ 3, 220, 91, 15, 20,
/* 106 */ 31, 20, 70, 4, 5, 71, 4, 6, 72, 4, 4, 73, 6, 4, 74, 4, 6, 75, 3, 11, 76, 3, 11, 77, 3, 59, 94, 2, 8, 95, 2, 8, 96, 1, 8, 97, 1, 32, 90, 1, 1, 101, 13, 1, 92, 1, 19, /* 106 */ 31, 20, 70, 4, 5, 71, 4, 6, 72, 4, 4, 73, 6, 4, 74, 4, 6, 75, 3, 11, 76, 3, 11, 77, 3, 59, 94, 2, 8, 95, 2, 8, 96, 1, 8, 97, 1, 32, 90, 1, 1, 101, 13, 1, 92, 1, 19,
/* 107 */ 45, 19, 70, 2, 2, 70, 2, 4, 71, 2, 2, 71, 1, 4, 72, 2, 7, 73, 6, 4, 74, 2, 2, 74, 1, 4, 75, 1, 6, 75, 3, 4, 76, 1, 6, 76, 3, 4, 77, 1, 2, 77, 2, 57, 94, 4, 7, 95, 2, 7, 96, 2, 8, 97, 2, 31, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19, /* 107 */ 47, 19, 70, 2, 2, 70, 2, 4, 71, 2, 2, 71, 1, 4, 72, 2, 7, 73, 6, 4, 74, 2, 2, 74, 1, 4, 75, 1, 6, 75, 3, 4, 76, 1, 6, 76, 3, 4, 77, 1, 2, 77, 2, 57, 94, 4, 7, 95, 2, 7, 96, 2, 8, 97, 2, 29, 98, 1, 1, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19,
/* 108 */ 43, 19, 70, 2, 2, 70, 2, 4, 71, 4, 5, 72, 2, 9, 73, 2, 6, 74, 4, 5, 75, 4, 4, 75, 1, 5, 76, 4, 3, 76, 1, 6, 77, 1, 1, 77, 1, 1, 77, 1, 56, 94, 6, 6, 95, 2, 6, 96, 5, 4, 97, 5, 30, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19, /* 108 */ 45, 19, 70, 2, 2, 70, 2, 4, 71, 4, 5, 72, 2, 9, 73, 2, 6, 74, 4, 5, 75, 4, 4, 75, 1, 5, 76, 4, 3, 76, 1, 6, 77, 1, 1, 77, 1, 1, 77, 1, 56, 94, 6, 6, 95, 2, 6, 96, 5, 4, 97, 5, 28, 98, 1, 1, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19,
/* 109 */ 41, 19, 70, 6, 4, 71, 4, 5, 72, 2, 9, 73, 2, 6, 74, 4, 6, 75, 4, 3, 75, 1, 6, 76, 4, 2, 76, 2, 5, 77, 1, 1, 77, 1, 1, 77, 1, 58, 94, 2, 6, 95, 6, 4, 96, 5, 4, 97, 5, 30, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19, /* 109 */ 43, 19, 70, 6, 4, 71, 4, 5, 72, 2, 9, 73, 2, 6, 74, 4, 6, 75, 4, 3, 75, 1, 6, 76, 4, 2, 76, 2, 5, 77, 1, 1, 77, 1, 1, 77, 1, 58, 94, 2, 6, 95, 6, 4, 96, 5, 4, 97, 5, 28, 98, 1, 1, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19,
/* 110 */ 45, 19, 70, 2, 2, 70, 2, 4, 71, 2, 2, 71, 1, 4, 72, 2, 9, 73, 2, 6, 74, 2, 2, 74, 1, 8, 75, 1, 3, 75, 1, 9, 76, 1, 2, 76, 1, 6, 77, 2, 2, 77, 1, 58, 94, 2, 7, 95, 4, 6, 96, 2, 8, 97, 2, 31, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19, /* 110 */ 47, 19, 70, 2, 2, 70, 2, 4, 71, 2, 2, 71, 1, 4, 72, 2, 9, 73, 2, 6, 74, 2, 2, 74, 1, 8, 75, 1, 3, 75, 1, 9, 76, 1, 2, 76, 1, 6, 77, 2, 2, 77, 1, 58, 94, 2, 7, 95, 4, 6, 96, 2, 8, 97, 2, 29, 98, 1, 1, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19,
/* 111 */ 43, 19, 70, 2, 2, 70, 2, 4, 71, 4, 6, 72, 4, 6, 73, 2, 6, 74, 2, 2, 74, 1, 5, 75, 3, 4, 75, 1, 6, 76, 3, 3, 76, 3, 5, 77, 3, 59, 94, 2, 8, 95, 2, 8, 96, 1, 8, 97, 1, 32, 90, 1, 0, 100, 1, 5, 87, 3, 5, 102, 1, 0, 92, 1, 19, /* 111 */ 45, 19, 70, 2, 2, 70, 2, 4, 71, 4, 6, 72, 4, 6, 73, 2, 6, 74, 2, 2, 74, 1, 5, 75, 3, 4, 75, 1, 6, 76, 3, 3, 76, 3, 5, 77, 3, 59, 94, 2, 8, 95, 2, 8, 96, 1, 8, 97, 1, 30, 98, 1, 1, 90, 1, 0, 100, 1, 5, 87, 3, 5, 102, 1, 0, 92, 1, 19,
/* 112 */ 13, 219, 90, 1, 0, 100, 1, 4, 87, 1, 2, 87, 2, 4, 102, 1, 0, 92, 1, 19, /* 112 */ 15, 217, 98, 1, 1, 90, 1, 0, 100, 1, 4, 87, 1, 2, 87, 2, 4, 102, 1, 0, 92, 1, 19,
/* 113 */ 15, 219, 90, 1, 0, 100, 1, 4, 87, 1, 1, 87, 1, 1, 87, 1, 4, 102, 1, 0, 92, 1, 19, /* 113 */ 17, 217, 98, 1, 1, 90, 1, 0, 100, 1, 4, 87, 1, 1, 87, 1, 1, 87, 1, 4, 102, 1, 0, 92, 1, 19,
/* 114 */ 15, 219, 90, 1, 0, 100, 1, 4, 87, 1, 1, 87, 1, 1, 87, 1, 4, 102, 1, 0, 92, 1, 19, /* 114 */ 17, 217, 98, 1, 1, 90, 1, 0, 100, 1, 4, 87, 1, 1, 87, 1, 1, 87, 1, 4, 102, 1, 0, 92, 1, 19,
/* 115 */ 43, 19, 80, 2, 8, 81, 1, 4, 81, 1, 4, 82, 4, 4, 83, 2, 2, 83, 2, 4, 84, 4, 5, 85, 2, 1, 85, 1, 1, 85, 1, 8, 86, 2, 1, 86, 1, 1, 86, 1, 73, 88, 1, 5, 89, 6, 48, 90, 1, 0, 100, 1, 4, 87, 2, 2, 87, 1, 4, 102, 1, 0, 92, 1, 19, /* 115 */ 45, 19, 80, 2, 8, 81, 1, 4, 81, 1, 4, 82, 4, 4, 83, 2, 2, 83, 2, 4, 84, 4, 5, 85, 2, 1, 85, 1, 1, 85, 1, 8, 86, 2, 1, 86, 1, 1, 86, 1, 73, 88, 1, 5, 89, 6, 46, 98, 1, 1, 90, 1, 0, 100, 1, 4, 87, 2, 2, 87, 1, 4, 102, 1, 0, 92, 1, 19,
/* 116 */ 49, 19, 80, 2, 8, 81, 6, 4, 82, 2, 2, 82, 1, 3, 83, 2, 2, 83, 2, 4, 84, 2, 2, 84, 1, 4, 85, 2, 1, 85, 1, 1, 85, 1, 2, 85, 1, 5, 86, 2, 1, 86, 1, 1, 86, 1, 1, 86, 1, 1, 86, 1, 68, 88, 2, 5, 89, 1, 53, 90, 1, 0, 100, 1, 5, 87, 3, 5, 102, 1, 0, 92, 1, 19, /* 116 */ 51, 19, 80, 2, 8, 81, 6, 4, 82, 2, 2, 82, 1, 3, 83, 2, 2, 83, 2, 4, 84, 2, 2, 84, 1, 4, 85, 2, 1, 85, 1, 1, 85, 1, 2, 85, 1, 5, 86, 2, 1, 86, 1, 1, 86, 1, 1, 86, 1, 1, 86, 1, 68, 88, 2, 5, 89, 1, 51, 98, 1, 1, 90, 1, 0, 100, 1, 5, 87, 3, 5, 102, 1, 0, 92, 1, 19,
/* 117 */ 45, 19, 80, 2, 8, 81, 6, 4, 82, 4, 4, 83, 2, 2, 83, 2, 4, 84, 2, 2, 84, 1, 4, 85, 2, 1, 85, 1, 1, 85, 1, 2, 85, 1, 5, 86, 2, 1, 86, 1, 1, 86, 1, 1, 86, 2, 68, 88, 1, 1, 88, 1, 5, 89, 5, 49, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19, /* 117 */ 47, 19, 80, 2, 8, 81, 6, 4, 82, 4, 4, 83, 2, 2, 83, 2, 4, 84, 2, 2, 84, 1, 4, 85, 2, 1, 85, 1, 1, 85, 1, 2, 85, 1, 5, 86, 2, 1, 86, 1, 1, 86, 1, 1, 86, 2, 68, 88, 1, 1, 88, 1, 5, 89, 5, 47, 98, 1, 1, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19,
/* 118 */ 47, 19, 80, 2, 8, 81, 2, 2, 81, 2, 4, 82, 2, 2, 82, 1, 3, 83, 2, 2, 83, 2, 4, 84, 2, 2, 84, 1, 4, 85, 2, 1, 85, 1, 1, 85, 1, 2, 85, 1, 5, 86, 2, 1, 86, 1, 1, 86, 1, 1, 86, 1, 68, 88, 5, 4, 89, 6, 48, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19, /* 118 */ 49, 19, 80, 2, 8, 81, 2, 2, 81, 2, 4, 82, 2, 2, 82, 1, 3, 83, 2, 2, 83, 2, 4, 84, 2, 2, 84, 1, 4, 85, 2, 1, 85, 1, 1, 85, 1, 2, 85, 1, 5, 86, 2, 1, 86, 1, 1, 86, 1, 1, 86, 1, 68, 88, 5, 4, 89, 6, 46, 98, 1, 1, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19,
/* 119 */ 45, 19, 80, 2, 8, 81, 2, 2, 81, 2, 4, 82, 2, 2, 82, 1, 3, 83, 6, 4, 84, 2, 2, 84, 1, 4, 85, 2, 1, 85, 1, 1, 85, 1, 2, 85, 1, 5, 86, 2, 1, 86, 1, 1, 86, 1, 1, 86, 1, 71, 88, 1, 10, 89, 1, 48, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19, /* 119 */ 47, 19, 80, 2, 8, 81, 2, 2, 81, 2, 4, 82, 2, 2, 82, 1, 3, 83, 6, 4, 84, 2, 2, 84, 1, 4, 85, 2, 1, 85, 1, 1, 85, 1, 2, 85, 1, 5, 86, 2, 1, 86, 1, 1, 86, 1, 1, 86, 1, 71, 88, 1, 10, 89, 1, 46, 98, 1, 1, 90, 1, 0, 100, 1, 13, 102, 1, 0, 92, 1, 19,
/* 120 */ 37, 19, 80, 6, 4, 81, 2, 2, 81, 2, 4, 82, 2, 2, 82, 1, 4, 83, 4, 5, 84, 4, 6, 85, 2, 1, 85, 1, 3, 85, 1, 6, 86, 2, 1, 86, 1, 2, 86, 1, 71, 88, 1, 5, 89, 5, 49, 90, 1, 1, 103, 13, 1, 92, 1, 19, /* 120 */ 37, 19, 80, 6, 4, 81, 2, 2, 81, 2, 4, 82, 2, 2, 82, 1, 4, 83, 4, 5, 84, 4, 6, 85, 2, 1, 85, 1, 3, 85, 1, 6, 86, 2, 1, 86, 1, 2, 86, 1, 71, 88, 1, 5, 89, 5, 49, 90, 1, 1, 103, 13, 1, 92, 1, 19,
/* 121 */ 3, 220, 93, 15, 20, /* 121 */ 3, 220, 93, 15, 20,
/* 122 */ 1, 255, /* 122 */ 1, 255,
/* 123 */ 1, 255, /* 123 */ 1, 255,
/* 124 */ 1, 255, /* 124 */ 7, 19, 104, 6, 4, 105, 6, 4, 106, 6, 210,
/* 125 */ 1, 255, /* 125 */ 11, 21, 104, 2, 8, 105, 2, 3, 105, 2, 3, 106, 2, 3, 106, 2, 207,
/* 126 */ 1, 255, /* 126 */ 17, 21, 104, 2, 3, 104, 1, 4, 105, 2, 2, 105, 1, 1, 105, 1, 3, 106, 2, 2, 106, 1, 1, 106, 1, 207,
/* 127 */ 1, 255, /* 127 */ 13, 21, 104, 2, 2, 104, 2, 4, 105, 2, 3, 105, 2, 3, 106, 2, 3, 106, 1, 208,
/* 128 */ 1, 255, /* 128 */ 15, 21, 104, 2, 3, 104, 1, 4, 105, 2, 2, 105, 1, 5, 106, 2, 2, 106, 1, 1, 106, 1, 207,
/* 129 */ 1, 255, /* 129 */ 13, 21, 104, 2, 3, 104, 1, 4, 105, 2, 2, 105, 3, 3, 106, 2, 3, 106, 2, 207,
/* 130 */ 1, 255, /* 130 */ 1, 255,
/* 131 */ 1, 255, /* 131 */ 1, 255,
/* 132 */ 1, 255, /* 132 */ 1, 255,