欺骗游戏控制器
我正在尝试编写一些内容,允许用户在游戏控制台上使用键盘/鼠标组合。我想到的方法是执行以下操作:
弄清楚输入如何映射到控制台控制器中的输出。这是一个很好的老尝试和错误,基本上通过 USB 将控制器连接到计算机,并使用详细的 USB 日志记录确定控制器如何响应输入。
然后,编写一个用户层程序,该程序接受键盘/鼠标输入并将其转换为控制器的输出。
到目前为止,一切都很好。现在复杂的部分来了。我需要找到一种方法将我的计算机连接到控制台,同时使控制台认为实际连接的是标准控制器。为此,我需要一种方法来创建一个假 USB 设备,该设备通过 USB 端口与控制台进行通信。这是我不知道该怎么做的部分。
我想我正在寻找某种 USB 欺骗库,但我不确定从哪里开始寻找这样的东西。该库的 Python 绑定会很棒,但我并不挑剔。同样,在 Mac 或 Linux 上运行的东西将是完美的,但在紧要关头我可以使用仅 Windows 的库。
I'm trying to write something that will allow a user to use a keyboard/mouse combination on a games console. The approach I've thought of is to do the following:
Figure out how input maps to output in the console's controller. This is good old trial and error, basically connecting the controller via USB to a computer and figuring out how the controller responds to input using detailed USB logging.
Then, write a userland program that takes keyboard/mouse input and converts it to the controller's output.
So far so good. Now comes the complicated bit. I need to figure out a way to connect my computer to the console, while making the console think that what is actually being connected is a standard controller. For this, I will need a way to create a fake USB device, which communicates over a USB port to the console. This is the part that I have no idea whatsoever how to do.
I guess I'm looking for a USB spoofing library of some sort, but I'm not sure where to start looking for something like this. Python bindings for the library would be great, but I'm not fussy. Similarly, something that works on Mac or Linux would be perfect, but I could live with a Windows-only library in a pinch.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
USB 不能以这种方式工作。 USB 涉及设备的定向层次结构,尝试连接两个主机设备(您的计算机和控制台)只会导致不好的事情发生(例如破坏两个设备中的 USB 控制器)。
最好的办法可能是使用某种嵌入式处理器(例如 Arduino),将其置于键盘/鼠标和控制台之间来进行转换。
USB doesn't work this way. USB involves a directed hierarchy of devices, and trying to connect two host devices (your computer and a console) will only result in bad things happen (like destroying the USB controllers in both devices).
Probably the best thing to do would be to use some sort of embedded processor like an Arduino to sit between your keyboard/mouse and the console to do the conversion.