291 lines
11 KiB
C
291 lines
11 KiB
C
#define BYTES_PER_SECTOR 512
|
|
#define SECTORS_PER_TRACK 18
|
|
#define TRACK_SIZE (SECTORS_PER_TRACK * BYTES_PER_SECTOR)
|
|
#define TRACKS_ON_DISK (80 * 2) // * 2 because it is double-sided
|
|
|
|
#define CPCLASS_DEFAULT 99
|
|
#define CPCLASS_EGA 0
|
|
#define CPCLASS_EGA2 1
|
|
#define CPCLASS_EGA3 2
|
|
#define CPCLASS_EGA4 3
|
|
#define CPCLASS_HEBEGA 4
|
|
|
|
typedef struct {
|
|
UINT iCP;
|
|
UINT iClass;
|
|
} CLASSFROMCP;
|
|
|
|
const CLASSFROMCP rgCPtoClassMap[] =
|
|
{{1258, CPCLASS_DEFAULT},
|
|
{874, CPCLASS_DEFAULT},
|
|
{932, CPCLASS_DEFAULT},
|
|
{936, CPCLASS_DEFAULT},
|
|
{949, CPCLASS_DEFAULT},
|
|
{950, CPCLASS_DEFAULT},
|
|
{708, CPCLASS_DEFAULT},
|
|
{709, CPCLASS_DEFAULT},
|
|
{710, CPCLASS_DEFAULT},
|
|
{860, CPCLASS_DEFAULT},
|
|
{861, CPCLASS_DEFAULT},
|
|
{863, CPCLASS_DEFAULT},
|
|
{864, CPCLASS_DEFAULT},
|
|
{865, CPCLASS_DEFAULT},
|
|
|
|
{850, CPCLASS_EGA},
|
|
{852, CPCLASS_EGA},
|
|
{437, CPCLASS_EGA},
|
|
|
|
{869, CPCLASS_EGA2},
|
|
{737, CPCLASS_EGA2},
|
|
{857, CPCLASS_EGA2},
|
|
|
|
{866, CPCLASS_EGA3},
|
|
{775, CPCLASS_EGA3},
|
|
{855, CPCLASS_EGA3},
|
|
|
|
{720, CPCLASS_EGA4},
|
|
|
|
{862, CPCLASS_HEBEGA}};
|
|
|
|
#define KEYBOARD_US 0
|
|
#define KEYBOARD_GR 1
|
|
#define KEYBOARD_HE 2
|
|
#define KEYBOARD_FR 3
|
|
#define KEYBOARD_SP 4
|
|
#define KEYBOARD_IT 5
|
|
#define KEYBOARD_SV 6
|
|
#define KEYBOARD_NL 7
|
|
#define KEYBOARD_BR 8
|
|
#define KEYBOARD_NO 9
|
|
#define KEYBOARD_DK 10
|
|
#define KEYBOARD_SU 11
|
|
#define KEYBOARD_RU 12
|
|
#define KEYBOARD_CZ 13
|
|
#define KEYBOARD_PL 14
|
|
#define KEYBOARD_HU 15
|
|
#define KEYBOARD_PO 16
|
|
#define KEYBOARD_TR 17
|
|
#define KEYBOARD_GK 18
|
|
#define KEYBOARD_BL 19
|
|
#define KEYBOARD_BG 20
|
|
#define KEYBOARD_YU 21
|
|
#define KEYBOARD_BE 22
|
|
#define KEYBOARD_CF 23
|
|
#define KEYBOARD_UK 24
|
|
#define KEYBOARD_ET 25
|
|
#define KEYBOARD_SF 26
|
|
#define KEYBOARD_SG 27
|
|
#define KEYBOARD_IS 28
|
|
#define KEYBOARD_IME 29
|
|
#define KEYBOARD_RO 30
|
|
#define KEYBOARD_YC 31
|
|
#define KEYBOARD_LA 32
|
|
#define KEYBOARD_UR 33
|
|
#define KEYBOARD_SL 34
|
|
|
|
typedef struct {
|
|
WORD wLangId;
|
|
UINT iKB;
|
|
} KBFROMLANGID;
|
|
|
|
const KBFROMLANGID rgLangIdtoKBMap[] =
|
|
{{MAKELANGID(LANG_AFRIKAANS,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_ALBANIAN,0), KEYBOARD_US},
|
|
{0x45e, KEYBOARD_US}, // AMHARIC
|
|
{MAKELANGID(LANG_ARABIC,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_ARMENIAN,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_ASSAMESE,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_AZERI,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_BASQUE,0), KEYBOARD_SP},
|
|
{MAKELANGID(LANG_BELARUSIAN,0), KEYBOARD_BL},
|
|
{MAKELANGID(LANG_BENGALI,0), KEYBOARD_US},
|
|
{0x101a, KEYBOARD_US}, // BOSNIA/HERZEGOVINA
|
|
{MAKELANGID(LANG_BULGARIAN,0), KEYBOARD_BG},
|
|
{0x455, KEYBOARD_US}, // BURMESE
|
|
{MAKELANGID(LANG_CATALAN,0), KEYBOARD_SP},
|
|
{0x45c, KEYBOARD_US}, // CHEROKEE
|
|
{MAKELANGID(LANG_CHINESE,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_CROATIAN,0), KEYBOARD_YU},
|
|
{0x450, KEYBOARD_US}, // CYRILLIC
|
|
{MAKELANGID(LANG_CZECH,0), KEYBOARD_CZ},
|
|
{MAKELANGID(LANG_DANISH,0), KEYBOARD_DK},
|
|
|
|
{MAKELANGID(LANG_DUTCH,0), KEYBOARD_NL},
|
|
{MAKELANGID(LANG_DUTCH,SUBLANG_DUTCH_BELGIAN), KEYBOARD_BE},
|
|
|
|
{MAKELANGID(LANG_ENGLISH,0), KEYBOARD_US},
|
|
{0x4409, KEYBOARD_US}, // ENGLISH / MALAYSIA
|
|
{MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_UK), KEYBOARD_UK},
|
|
{MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_CAN), KEYBOARD_CF},
|
|
{MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_EIRE), KEYBOARD_UK},
|
|
{0x1809, KEYBOARD_UK}, // ENGLISH / IRELAND
|
|
|
|
|
|
{MAKELANGID(LANG_ESTONIAN,0), KEYBOARD_ET},
|
|
{MAKELANGID(LANG_FAEROESE,0), KEYBOARD_DK},
|
|
{MAKELANGID(LANG_FARSI,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_FINNISH,0), KEYBOARD_SU},
|
|
|
|
{MAKELANGID(LANG_FRENCH,0), KEYBOARD_FR},
|
|
{MAKELANGID(LANG_FRENCH,SUBLANG_FRENCH_BELGIAN), KEYBOARD_BE},
|
|
{MAKELANGID(LANG_FRENCH,SUBLANG_FRENCH_CANADIAN), KEYBOARD_CF},
|
|
{MAKELANGID(LANG_FRENCH,SUBLANG_FRENCH_SWISS), KEYBOARD_SF},
|
|
|
|
{0x462, KEYBOARD_US}, // FRISIAN
|
|
{0x83c, KEYBOARD_UK}, // GAELIC / IRELAND
|
|
{0x43c, KEYBOARD_UK}, // GAELIC / SCOTLAND
|
|
{0x456, KEYBOARD_SP}, // GALICIAN
|
|
{MAKELANGID(LANG_GEORGIAN,0), KEYBOARD_US},
|
|
|
|
{MAKELANGID(LANG_GERMAN,0), KEYBOARD_GR},
|
|
{MAKELANGID(LANG_GERMAN,SUBLANG_GERMAN_SWISS), KEYBOARD_SG},
|
|
|
|
{MAKELANGID(LANG_GREEK,0), KEYBOARD_GK},
|
|
{MAKELANGID(LANG_GUJARATI,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_HEBREW,0), KEYBOARD_HE},
|
|
{MAKELANGID(LANG_HINDI,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_HUNGARIAN,0), KEYBOARD_HU},
|
|
{MAKELANGID(LANG_ICELANDIC,0), KEYBOARD_IS},
|
|
{MAKELANGID(LANG_INDONESIAN,0), KEYBOARD_US},
|
|
{0x45e, KEYBOARD_US}, // INUKITUT
|
|
{MAKELANGID(LANG_ITALIAN,0), KEYBOARD_IT},
|
|
{MAKELANGID(LANG_JAPANESE,0), KEYBOARD_IME},
|
|
{MAKELANGID(LANG_KANNADA,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_KASHMIRI,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_KAZAK,0), KEYBOARD_US},
|
|
{0x453, KEYBOARD_US}, // KHMER
|
|
{0x440, KEYBOARD_US}, // KIRGHIZ
|
|
{MAKELANGID(LANG_KONKANI,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_KOREAN,0), KEYBOARD_IME},
|
|
{0x454, KEYBOARD_US}, // LAO
|
|
{0x464, KEYBOARD_US}, // LATIN (VATICAN)
|
|
{MAKELANGID(LANG_LATVIAN,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_LITHUANIAN,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_MACEDONIAN,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_MALAY,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_MALAYALAM,0), KEYBOARD_US},
|
|
{0x43e, KEYBOARD_US}, // MALAYSIAN
|
|
{0x43a, KEYBOARD_US}, // MALTESE
|
|
{MAKELANGID(LANG_MANIPURI,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_MARATHI,0), KEYBOARD_US},
|
|
{0x850, KEYBOARD_US}, // MONGOLIAN
|
|
{MAKELANGID(LANG_NEPALI,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_NEUTRAL,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_NORWEGIAN,0), KEYBOARD_NO},
|
|
{MAKELANGID(LANG_ORIYA,0), KEYBOARD_US},
|
|
{0x463, KEYBOARD_US}, // PASHTO
|
|
{MAKELANGID(LANG_POLISH,0), KEYBOARD_PL},
|
|
|
|
{MAKELANGID(LANG_PORTUGUESE,0), KEYBOARD_PO},
|
|
{MAKELANGID(LANG_PORTUGUESE,SUBLANG_PORTUGUESE_BRAZILIAN), KEYBOARD_BR},
|
|
|
|
{MAKELANGID(LANG_PUNJABI,0), KEYBOARD_US},
|
|
{0x417, KEYBOARD_US}, // RHAETO-ROMANIC
|
|
{MAKELANGID(LANG_ROMANIAN,0), KEYBOARD_RO},
|
|
{MAKELANGID(LANG_RUSSIAN,0), KEYBOARD_RU},
|
|
{0x43b, KEYBOARD_US}, // SAMI (LAPPISH)
|
|
{MAKELANGID(LANG_SANSKRIT,0), KEYBOARD_US},
|
|
|
|
{MAKELANGID(LANG_SERBIAN,0), KEYBOARD_YC},
|
|
{MAKELANGID(LANG_SERBIAN,SUBLANG_SERBIAN_CYRILLIC), KEYBOARD_YC},
|
|
{MAKELANGID(LANG_SERBIAN,SUBLANG_SERBIAN_LATIN), KEYBOARD_YU},
|
|
|
|
{MAKELANGID(LANG_SINDHI,0), KEYBOARD_US},
|
|
{0x45b, KEYBOARD_US}, // SINHALESE
|
|
{MAKELANGID(LANG_SLOVAK,0), KEYBOARD_SL},
|
|
{MAKELANGID(LANG_SLOVENIAN,0), KEYBOARD_YU},
|
|
{0x42e, KEYBOARD_US}, // SORBIAN
|
|
|
|
{MAKELANGID(LANG_SPANISH,0), KEYBOARD_SP},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_ARGENTINA), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_BOLIVIA), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_CHILE), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_COLOMBIA), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_COSTA_RICA), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_DOMINICAN_REPUBLIC), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_ECUADOR), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_EL_SALVADOR), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_GUATEMALA), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_HONDURAS), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_MEXICAN), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_NICARAGUA), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_PANAMA), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_PARAGUAY), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_PERU), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_PUERTO_RICO), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_MODERN), KEYBOARD_SP},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_URUGUAY), KEYBOARD_LA},
|
|
{MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_VENEZUELA), KEYBOARD_LA},
|
|
|
|
{0x430, KEYBOARD_US}, // SUTU
|
|
{MAKELANGID(LANG_SWAHILI,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_SWEDISH,0), KEYBOARD_SV},
|
|
{0x45a, KEYBOARD_US}, // SYRIAC
|
|
{0x428, KEYBOARD_US}, // TAJIK
|
|
{MAKELANGID(LANG_TAMIL,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_TATAR,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_TELUGU,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_THAI,0), KEYBOARD_US},
|
|
{0x451, KEYBOARD_US}, // TIBETAN
|
|
{0x431, KEYBOARD_US}, // TSONGA
|
|
{0x432, KEYBOARD_US}, // TSWANA
|
|
{MAKELANGID(LANG_TURKISH,0), KEYBOARD_TR},
|
|
{0x442, KEYBOARD_US}, // TURKMEN
|
|
{MAKELANGID(LANG_UKRAINIAN,0), KEYBOARD_UR},
|
|
{MAKELANGID(LANG_URDU,0), KEYBOARD_US},
|
|
{MAKELANGID(LANG_UZBEK,0), KEYBOARD_US},
|
|
{0x433, KEYBOARD_US}, // VENDA
|
|
{MAKELANGID(LANG_VIETNAMESE,0), KEYBOARD_US},
|
|
{0x452, KEYBOARD_US}, // WELSH
|
|
{0x434, KEYBOARD_US}, // XHOSA
|
|
{0x43d, KEYBOARD_US}, // YIDDISH
|
|
{0x435, KEYBOARD_US}};// ZULU
|
|
|
|
#define KBCLASS_1 0
|
|
#define KBCLASS_2 1
|
|
#define KBCLASS_3 2
|
|
#define KBCLASS_4 3
|
|
#define KBCLASS_BLANK 99
|
|
|
|
typedef struct {
|
|
UINT iKB;
|
|
UINT iClass;
|
|
} CLASSFROMKB;
|
|
|
|
const CLASSFROMKB rgKBtoClassMap[] =
|
|
{{KEYBOARD_US, KBCLASS_BLANK},
|
|
{KEYBOARD_GR, KBCLASS_1},
|
|
{KEYBOARD_HE, KBCLASS_4},
|
|
{KEYBOARD_FR, KBCLASS_1},
|
|
{KEYBOARD_SP, KBCLASS_1},
|
|
{KEYBOARD_IT, KBCLASS_1},
|
|
{KEYBOARD_SV, KBCLASS_1},
|
|
{KEYBOARD_NL, KBCLASS_1},
|
|
{KEYBOARD_BR, KBCLASS_1},
|
|
{KEYBOARD_NO, KBCLASS_1},
|
|
{KEYBOARD_DK, KBCLASS_1},
|
|
{KEYBOARD_SU, KBCLASS_1},
|
|
{KEYBOARD_RU, KBCLASS_3},
|
|
{KEYBOARD_CZ, KBCLASS_2},
|
|
{KEYBOARD_PL, KBCLASS_4},
|
|
{KEYBOARD_HU, KBCLASS_2},
|
|
{KEYBOARD_PO, KBCLASS_1},
|
|
{KEYBOARD_TR, KBCLASS_2},
|
|
{KEYBOARD_GK, KBCLASS_4},
|
|
{KEYBOARD_BL, KBCLASS_3},
|
|
{KEYBOARD_BG, KBCLASS_2},
|
|
{KEYBOARD_YU, KBCLASS_2},
|
|
{KEYBOARD_BE, KBCLASS_1},
|
|
{KEYBOARD_CF, KBCLASS_2},
|
|
{KEYBOARD_UK, KBCLASS_1},
|
|
{KEYBOARD_ET, KBCLASS_4},
|
|
{KEYBOARD_SF, KBCLASS_1},
|
|
{KEYBOARD_SG, KBCLASS_1},
|
|
{KEYBOARD_IS, KBCLASS_2},
|
|
{KEYBOARD_IME,KBCLASS_1},
|
|
{KEYBOARD_RO, KBCLASS_2},
|
|
{KEYBOARD_YC, KBCLASS_2},
|
|
{KEYBOARD_LA, KBCLASS_1},
|
|
{KEYBOARD_UR, KBCLASS_3},
|
|
{KEYBOARD_SL, KBCLASS_2}};
|