| 119 | static bool IsVirtualKeyAnAppleIIKey(WPARAM wparam); |
| 120 | |
| 121 | void KeybQueueKeypress (WPARAM key, Keystroke_e bASCII) |
| 122 | { |
| 123 | if (bASCII == ASCII) // WM_CHAR |
| 124 | { |
| 125 | if (GetFrame().g_bFreshReset && key == VK_CANCEL) // OLD HACK: 0x03 |
| 126 | { |
| 127 | GetFrame().g_bFreshReset = false; |
| 128 | return; // Swallow spurious CTRL-C caused by CTRL-BREAK |
| 129 | } |
| 130 | |
| 131 | GetFrame().g_bFreshReset = false; |
| 132 | |
| 133 | if (GetApple2Type() == A2TYPE_TK30002E && (key > 0x7F) && !g_bTK3KModeKey) // When in TK3000 mode, we have special keys which need remapping |
| 134 | return; |
| 135 | |
| 136 | // Initially default to non-clone behaviour: |
| 137 | if (IsAppleIIeOrAbove(GetApple2Type())) |
| 138 | { |
| 139 | if (!IS_CLONE() && key > 0x7F) // accented chars, eg. AltGr+A |
| 140 | return; |
| 141 | |
| 142 | if (g_bCapsLock && key >= 'a' && key <='z') |
| 143 | keycode = (BYTE)(key - 32); |
| 144 | else |
| 145 | keycode = (BYTE)key; |
| 146 | } |
| 147 | else |
| 148 | { |
| 149 | if (!IS_CLONE() && (key == '`' || key >= '{')) // `,{,|,},~,DEL and >0x7F (excludes a..z) |
| 150 | return; |
| 151 | |
| 152 | if (key >= 'a' && key <='z') |
| 153 | keycode = (BYTE)(key - 32); |
| 154 | else |
| 155 | keycode = (BYTE)key; |
| 156 | } |
| 157 | |
| 158 | // Next apply any clone override: |
| 159 | if (IS_CLONE()) |
| 160 | { |
| 161 | keycode &= 0x7F; // for accented chars, eg. AltGr+A |
| 162 | |
| 163 | if (IsPravets(GetApple2Type())) |
| 164 | keycode = GetPravets().ConvertToKeycode(key, keycode); |
| 165 | |
| 166 | // Remap for the TK3000 //e, which had a special |Mode| key for displaying accented chars on screen |
| 167 | // Borrowed from Fábio Belavenuto's TK3000e emulator (Copyright (C) 2004) - http://code.google.com/p/tk3000e/ |
| 168 | if (GetApple2Type() == A2TYPE_TK30002E && g_bTK3KModeKey) // We already switch this on only if the the TK3000 is currently being emulated |
| 169 | { |
| 170 | if ((key >= 0xC0) && (key <= 0xDA)) key += 0x20; // Convert uppercase to lowercase |
| 171 | switch (key) |
| 172 | { |
| 173 | case 0xE0: key = '_'; break; // à |
| 174 | case 0xE1: key = '@'; break; // á |
| 175 | case 0xE2: key = '\\'; break; // â |
| 176 | case 0xE3: key = '['; break; // ã |
| 177 | case 0xE7: key = ']'; break; // ç |
| 178 | case 0xE9: key = '`'; break; // é |
no test coverage detected