C#中的虚拟游戏板 [英] Virtual Gamepad in C#

查看:118
本文介绍了C#中的虚拟游戏板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为与DirectInput一起使用的游戏手柄编写语音控制插件.基本上,使用当前功能,我们的应用程序只能读取用户当时在游戏板上实际按下的任何输入.我们正在使用诸如语音命令之类的高级替代输入法,但是该应用程序不是开源的,因此只能使用控制器.基本上,我们想做的就是创建一个新的HID驱动程序,并将设备安装到Windows中,设置应用程序以使用它.然后,我想钩住来自真实"物理控制器的所有输入,并将其复制并发送,就好像它来自虚拟"控制器一样.我还想让虚拟"控制器的驱动程序在内存中使用命名管道(或其他方式)来监视要发送的其他事件".因此,在同时按住方向轴控件和同时按下两个帽子的同时,所有这些输入都将到达目标,但是我们还希望能够大声说出"2",并使虚拟游戏手柄像向内一样发送入站事件实际上是按2.在我开始创建它之前,已经完成了吗?还是由于错过了任何限制,我的计划真的不可能吗?

注意-我不想扩展游戏手柄的功能,只是有另一种触发事件的方法,您可以使用语音来触发已经可以在其上进行的物理操作.

I''m trying to write a voice control addon for a gamepad to be used with DirectInput. Basically, with the current functionality our application can only read whatever input the user is physically pressing on the gamepad at that time. We''re playing with advanced alternative input methods such as voice commands but the application is not open source so it can only use controllers. Basically, what we''d like to be able to do is create a new HID driver and install the device into windows, settings the application to use it. Then, I''d like to hook all input from the ''real'' physical controller and replicate it and send it along as if it came from the ''virtual'' controller. I''d also like to have the ''virtual'' controller''s driver using a named pipe in memory (or other means) to watch for additional ''events'' to send. So while holding both directional axis controls and pressing both hats, all of those inputs would reach the target, but we''d also like to be able to say "2" out loud and have the virtual gamepad send the same event inbound as if 2 was actually pressed. Before I set out to create this, has it been done already? Or is my plan not really possible due to any limitations I missed?

Note - I don''t want to expand the functions of the gamepad, just have an alternative way of triggering events you can already do on it physically, using voice instead.

推荐答案

问题可以解决,我没有任何限制.恐怕您的管道或任何逻辑上相似的东西都会遇到设计问题,那么您的系统将像许多电话机器人系统一样出现故障.即使这种设计不当的电话系统几乎不能容忍,但在游戏中,它可能会使整个语音功能失去作用.

问题在于,使用管道可以序列化触发器的语音请求.这样,当某些命令在已更改的环境中已经不相关(或更糟糕的是损坏)时,可能会在以后的时间处理某些命令.特别是在语音控制中,这非常常见.

我认为,HID驱动程序是错误的抽象级别. (您想使用什么System.Speech?它提供了应用程序级API.)

因此,我想没人会给您一个代码片段来显示解决方案.您需要1)聘请有能力的应用程序设计师,2)通过阅读一些有关游戏体系结构的书籍(不一定具有语音控制)来成为这样的设计师.

对不起,如果我误解了您的一些想法.我真的很感谢您提出的问题-我的5.
The problem is solvable, I don''t see any limitation. I am afraid you''re going to have a design problem with your pipe or anything logically similar, then your system will be as malfunctional as many phone robot systems. Even if such ill-designed phone systems are barely tolerable, in gaming it may render the whole voice feature useless.

The problem is that with the pipe you will serialize voice requests for triggers. In this way, some commands will potentially be processed at later time when the command is already irrelevant (or worse, damaging) in the already-changed environment. This is very usual with voice control in particular.

A HID driver is a wrong level of abstraction, I think. (What do you want to use, System.Speech? It provides application-level API.)

So, I guess nobody will give you a code snippet to show the solution. You need 1) hire a competent application designer, 2) become such a designer by reading some books on gaming architectures (not necessarily with voice control).

Sorry if I misunderstood some of your ideas. I actually appreciate your formulation of the problem -- my 5.


这篇关于C#中的虚拟游戏板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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