Skip to main content

2 posts tagged with "bluetooth"

View All Tags

WhereQ-DOSBox 1.0.0.18:你早就有的那把键盘

· 9 min read
WhereQ-DOSBoxWhereQ-DOSBox

抽屉里那把键盘​

大多数人的家里大概都有一把蓝牙键盘。它跟着平板、手机或者电视一起来,然后就一直躺在抽屉里——一块塑料,一百零四个键,手感比屏幕上任何一种"假装出来的键盘"都好。

和手机配对,它能用。

对一切都能用。

除了模拟器。

到这次发版之前,WhereQ-DOSBox 就是这样:配好蓝牙键盘,按一个键,什么也不会发生。不是"按错了键",是什么都没有。内置的 SDL2 根本没有给 Android 键盘事件留通路,Java 层只喂输入法,原生那一侧一次按键事件都收不到。屏幕键盘是 app 唯一的输入通道,而想要一次按键的游戏,收到的是一根手指。

1.0.0.18 修好了它,而且是用这个 app 一贯的方式修:绝不另造一条输入通路。

现在,Android 的键码会被映射成 DOSBox 的键名,再通过屏幕键盘一直在用的那张原生表解析。两条路最后落到同一个扫描码、进入同一个 BIOS 缓冲区、从同一个 INT 09h 出去。Shift、Ctrl 和 Alt 一并带上,DOS 该看到的大写字母就都能看到。按住一个键时只有第一次按下会被转发——DOSBox 在 BIOS 定时器里自己会重复,多送一次事件就等于缓冲区里多一个扫描码。而打在启动脚本编辑器上的按键,永远不会跑到游戏里去。

这些是在模拟器里用真实按键事件验过的,不是用假动作糊过去的:字母和 Enter 能过《真人快打》的过场保护,F1 能开始游戏,F10 能打开它自己的选项菜单,方向键能移动菜单光标,也被游戏当作移动键接受。

抽屉里那把键盘,现在是 DOS 键盘了。

WhereQ-DOSBox 1.0.0.18: the keyboard you already own

· 10 min read
WhereQ-DOSBoxWhereQ-DOSBox

The keyboard in the drawer​

Somewhere in most houses there is a Bluetooth keyboard. It came with a tablet, or a phone, or a television, and it has been sitting in a drawer ever since — a rectangle of plastic with a hundred and four keys that feel better than anything a screen can pretend to be.

Pair it with the phone and it works. For everything.

Except the emulator.

That was the state of WhereQ-DOSBox until this release: you paired the keyboard, you pressed a key, and nothing happened. Not "the wrong key" — nothing. The vendored SDL2 has no path for Android key events at all; the Java layer fed only the IME, and the native side never saw a single key event come in. The on-screen keyboard was the only input the app had, and a game that wanted a keypress got a finger instead.

1.0.0.18 fixes that, and it fixes it the way the app does everything else: by refusing to invent a new input path.

An Android key code is now mapped to a DOSBox key name, and that name is resolved through the same native table the on-screen keyboard already used. Both roads end in the same scancode, in the same BIOS buffer, behind the same INT 09h. Shift, Ctrl and Alt are carried along, so DOS sees the capital letters it should. Only the first press of a held key is forwarded — DOSBox does its own auto-repeat in the BIOS timer, and every extra event would be one more scancode in the buffer. And a keystroke aimed at the launch-script editor never reaches the game, which is the one thing that had to stay true.

Checked in the emulator with real key events, not with a mock: the letters and Enter pass the copy protection of Mortal Kombat, F1 starts the game, F10 opens its own options menu, and the arrow keys move the menu cursor and are accepted as the game's movement keys.

The keyboard in the drawer is a DOS keyboard now.