Skip to content

Expose API for simulated Keyboard/Mouse events #769

@etfre

Description

@etfre

I'm working on a mod to play Stardew Valley by voice without using keyboard or mouse. In order to do this the mod needs to simulate keyboard and mouse events when speech is recognized. The keyboard bit is relatively straightforward to imitate with DirectInput, but it seems that mouse clicks are being suppressed. Right now I have the following workaround with SMAPI:

dynamic inputState = Utils.GetPrivateField(helper.Input, "CurrentInputState")();
Utils.GetPrivateField(inputState, "CustomPressedKeys").Add(SButton.MouseLeft);
Utils.SetPrivateField(inputState, "HasNewOverrides", true);

It would be great if there was a public API so this felt a bit less hacky/fragile.

Metadata

Metadata

Assignees

Labels

not a dev taskThis is a non-development task (e.g. user support, questions, or incorrect bug report).

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions