806 |
|
SDL_VideoDriverName(video_driver, sizeof(video_driver)); |
807 |
|
bool video_driver_found = false; |
808 |
|
char line[256]; |
809 |
+ |
int n_keys = 0; |
810 |
|
while (fgets(line, sizeof(line) - 1, f)) { |
811 |
|
// Read line |
812 |
|
int len = strlen(line); |
819 |
|
continue; |
820 |
|
|
821 |
|
if (video_driver_found) { |
822 |
< |
// Skip aliases |
822 |
> |
// Skip aliases as long as we have read keycodes yet |
823 |
> |
// Otherwise, it's another mapping and we have to stop |
824 |
|
static const char sdl_str[] = "sdl"; |
825 |
< |
if (strncmp(line, sdl_str, sizeof(sdl_str) - 1) == 0) |
825 |
> |
if (strncmp(line, sdl_str, sizeof(sdl_str) - 1) == 0 && n_keys == 0) |
826 |
|
continue; |
827 |
|
|
828 |
|
// Read keycode |
829 |
|
int x_code, mac_code; |
830 |
|
if (sscanf(line, "%d %d", &x_code, &mac_code) == 2) |
831 |
< |
keycode_table[x_code & 0xff] = mac_code; |
831 |
> |
keycode_table[x_code & 0xff] = mac_code, n_keys++; |
832 |
|
else |
833 |
|
break; |
834 |
|
} else { |
853 |
|
WarningAlert(str); |
854 |
|
return; |
855 |
|
} |
856 |
+ |
|
857 |
+ |
D(bug("Using SDL/%s keycodes table, %d key mappings\n", video_driver, n_keys)); |
858 |
|
} |
859 |
|
} |
860 |
|
|