A downloadable extension for Windows

Download NowName your own price

What this is:

Sometime in 2018 (>1.4.1804 / >2.1.4), GameMaker runtime was updated to no longer poll gamepads when the window is not in focus. On one hand that is good, because you can switch between gamepad-controlled applications without accidentally throwing your character off a cliff, but sometimes you do want to poll gamepads while in background.

This little extension fixes that by convincing the game that the window always has focus (as far as gamepad logic is concerned).

How to use:

Call gamepad_force_focus() once. That's it.
If you for some reason need to disable the extension later, call gamepad_force_focus(false).

Limitations:

Based on this tweet by Russell Kay, this likely only works with XInput devices.

Download

Download NowName your own price

Click download now to get access to the following files:

gamepad_force_focus.gmez 36 kB
gamepad_force_focus.yymp 43 kB
gamepad_force_focus_demo.zip 1 MB

Comments

Log in with itch.io to leave a comment.

(1 edit)

I just realized, this is also helpful for people who run windows programs that automatically change the focus to whichever window you mouse over.

A few gamepad-related things I would love to see in future asset packs...

1. Support for legacy DirectInput devices and DOS-era joysticks.

2. Rumble support.

3. Compatibility with Steam's controller mapping APIs, however those work.

4. Redirecting gamepad input logic to run in a separate thread, with optional GPU acceleration (via OpenACC), and various C++ tricks to make input logic even faster.

5. Support for unique features of specific controllers, assuming that somebody can get certain ones to work on PC in the first place;

  • XBOX ONE: Vibrating triggers.
  • DualShock 3 and later: Motion Controls, Analogue Face Buttons, Analogue D-Pad.
  • DualShock 4 and DualSense: Touchpad, Lightbar, Speaker
  • DualSense-only: Resistive Triggers
  • Nintendo Switch Joycons: Motion Controls, HD Rumble (obviously only if somebody can get them to work on Windows)
  • Steam Controller: Just about everything, I guess.

6. A way to automatically detect if a gamepad (or other input device) has been disconnected.

7. Razer Hydra support. Because those are a thing.

These are all good suggestions, but I regret to inform that this extension is a very simple hack that I offered to do for 10 dollars total as I knew the exact thing I have to do. There are 99 lines of code in it, 73 of which are just boilerplate to set up function hooking.

  1. I have previously investigated DirectInput support, but ultimately I do not know enough about DirectInput internals to even tell which function I’m supposed to rewire, and it does not seem justified to spend a day figuring that out unless someone actually wants to pay for that - for some reason.

  2. GameMaker has externs for whatever rumble that is in XInput API via gamepad_set_vibration.

  3. Steamworks.gml has Steam Controller functions. Most of them are very simple wrappers around the C++ API and the documentation may prove useful. Steam Controller API had been deprecated in favor of Steam Input API in the most recent versions of SDK, but GameMaker doesn’t use them yet.

  4. This sounds like the kind of thing that I would agree to do if I had absolutely nothing to do and someone was willing to pay for it even though the returns are likely to be marginal or lost entirely to cross-thread and GML<->C++ interoperation cost.

  5. Steam Input API allegedly covers that, but see above. I don’t believe that you could really “write your own” without having to reverse-engineer multiple versions of protocols used by each device (as most of these do not have publicly available documentation) or striking deals with each company, which might be why Valve has a monopoly on that for now.

  6. There are Async - System events for that.

  7. I’m open to writing wrappers for any kind of device - no matter how dead or exotic - so long as someone is willing to cover the costs of getting such a device, or is willing to pay extra for me having to write the code without being able to test/debug it (which in some cases can exceed the cost of a device unit).

Do you have anything that would force the gamemaker application to draw above everything on the screen no matter what?

See this screenshot: http://prntscr.com/v7q3rk

I'm using a different extension of yours to draw this animated character with a transparent background. Currently, I can even move her around and the background updates so that it always stays "Transparent". However, if I click on google chrome, she disappears.

This is just a test since I only discovered your wonderful extensions today, but my idea is to have an "idle rpg" game that's always on top of your screen (aside from fullscreen applications). I actually have the entire game designed too, but dropped it since previously I couldn't solve the transparent background issue.

Let me know if you have anything that can do this :)

Window Commands has window_set_topmost, which would be what you want.

Finally, I can play multiplayer and actually communicate at the same time.

Yeah, same idea

(+1)

You actually did it, lol.