欺骗游戏控制器 [英] Spoofing a game controller

查看:105
本文介绍了欺骗游戏控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写允许用户在游戏机上使用键盘/鼠标组合的内容.我想到的方法是执行以下操作:

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:

弄清输入如何映射到控制台控制器中的输出.这是一个很好的尝试,会出错,基本上是通过USB将控制器连接到计算机,并使用详细的USB日志记录弄清楚控制器如何响应输入.

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.

到目前为止,一切都很好.现在来了复杂的一点.我需要找出一种将计算机连接到控制台的方法,同时使控制台认为实际连接的是标准控制器.为此,我将需要一种方法来创建一个伪造的USB设备,该设备通过USB端口与控制台进行通信.这是我不知道怎么做的部分.

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.

我想我正在寻找某种USB欺骗库,但是我不确定从哪里开始寻找这样的东西.该库的Python绑定会很棒,但我并不挑剔.同样,可以在Mac或Linux上运行的东西是完美的,但是我可以紧紧地使用仅Windows的库.

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.

推荐答案

USB无法以这种方式工作. USB涉及设备的 directed 层次结构,尝试连接两个主机设备(您的计算机和控制台)只会导致不好的事情发生(例如破坏两个设备中的USB控制器).

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).

也许最好的办法是使用某种嵌入式处理器(例如Arduino)在键盘/鼠标和控制台之间进行转换.

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.

这篇关于欺骗游戏控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆