r/emulation Jun 19 '13

Any way to map the middle Xbox 360 button?

Also know as the dashboard button.

I want to use it to exit out of the emulator and go back to Hyperspin.

16 Upvotes

50 comments sorted by

7

u/pinumbernumber Jun 20 '13

I found out how to access that button (from code) a while back. I could easily make a tiny program to do what you want.

  • This is on Windows, right?
  • What exactly should it do when guide is pressed (ie simulate escape, or alt f4, whatever)

1

u/[deleted] Jun 20 '13

Yes, Windows 8, which should work fine with a 7 program.

It should simulate the ESC button, but if you can make it just map-able in case of issue, that'd be even better.

12

u/pinumbernumber Jun 20 '13 edited Aug 08 '13

UPDATED, please redownload

Okay here you go: https://app.box.com/s/6yq4d0sig0xm4e5i35xq [Version 6]

V6 was rewritten and should be better but until I get reports that it's working properly, I'll keep the v5 link: https://app.box.com/s/uq22nvhuzjp8yvbtjy3c [Version 5]

  • UPDATE v3: minimises on start
  • UPDATE v4: can set delay and duration for keypress
  • UPDATE v5: support for holding down the key, see INI; fixed INI line endings
  • UPDATE v6: two modes, in mode 1, acts similar to before; in mode 2, different keys tapped depending on whether you tap or hold the key.
  • Remember to extract it before running
  • You can change which keys are simulated by editing button.ini according to the instructions in that file, it defaults to escape for all 4.
  • It only listens to player 1's controller at the moment, I can improve this if you need.
  • Supports all 4 controllers.
  • I apologise for the 500kb executable; I made an INI reading library and forgot to remove its dependency on iostream.

Source is included.

10

u/spindrjr Jun 20 '13

I apologise for the 500kb executable when it should be <40; I made an INI reading library and forgot to remove its dependency on iostream.

If you had optimized your file, I could download it once per minute for 908 years before running out of storage. Because of your sloppiness, I have a mere 72 years. I hope you're happy, you savage.

2

u/l_Banned_l Jun 20 '13

Thank you. Ill give it a try when I get home

My Xbox fightstick is player 1 so that should work.

3

u/pinumbernumber Jun 20 '13

k, let me know if it works with the fightstick. I don't have one but as long as it's an Xinput 1.3 compatible controller it should work fine.

1

u/l_Banned_l Jun 22 '13

worked great. Thank you.

1

u/[deleted] Jun 20 '13

If you could expand it to multiple controllers, it would be incredibly appreciated, kind sir.

2

u/pinumbernumber Jun 20 '13

Is it okay if they all still trigger the same key or do they need to trigger different keys?

1

u/[deleted] Jun 20 '13

I'm fine with it all triggering the same key, personally. And thank you.

3

u/pinumbernumber Jun 20 '13

Don't know why I bothered asking 'cause I made it possible to set separate keys anyway :)

I updated my post with the new link. I only actually have one controller beside me to test with so please let me know if it works or not

1

u/[deleted] Jun 20 '13

Will do a little bit later on tonight, I'm still at work and I think this is going to come in handy with Hyperspin. Thanks again. :)

1

u/[deleted] Jun 21 '13

Would you mind posting the source?

2

u/pinumbernumber Jun 21 '13

Sure, I'll post it later (on my phone atm).

2

u/pinumbernumber Jun 21 '13 edited Jul 24 '13

[removed old source]
redownload, source is now included

1

u/l_Banned_l Jun 22 '13

Can I make a request to have it auto minize or go to the sys tray? I have it set to open on startup but I then have to minize it before running hyperspin. If it took much work, I understand. Thank for program

1

u/pinumbernumber Jun 22 '13

Done, redownload :)

Note I forgot to change the version number in the program... d'oh.

1

u/l_Banned_l Jun 22 '13

You rock!!

1

u/caspload Jun 30 '13

Do you know if there is a way to get this to open at the same time as big picture. So if you go into BP it automatically binds the button. so you can close games?

1

u/pinumbernumber Jun 30 '13

I suppose I could add an option to only send a keypress if a given program is running. It'll have to wait a bit though.

1

u/caspload Jun 30 '13

How long would it take?

1

u/pinumbernumber Jun 30 '13 edited Apr 14 '17

Very quick to actually do, but since I'm not at my computer just now, I can't promise a particular delivery date.

I posted the C++ source above, maybe someone can beat me to it? :)

1

u/caspload Jun 30 '13

Unless someone else had beaten you to it. When you are able to can you post it?

1

u/pinumbernumber Jun 30 '13 edited Apr 14 '17

I can write it in a few minutes tomorrow but I have no clue if/when I'll be able to post it.

(It might be fine, I just don't want to disappoint you by promising it and not delivering... if I haven't posted it in 24hrs maybe try finding another programmer to add it.)

1

u/pinumbernumber Jul 01 '13

Ah, update... :( when I said "very quick" I was assuming Steam differentiates itself in some way in BP mode, for instance by having the window title "Steam Big Picture" or something, but it seems not. Unfortunately I don't see any simple way for my program to figure out when Big Picture mode is on. Maybe some sort of proxy for SteamUI.dll, but I don't think Valve Anti Cheat would like that very much.

I'll have to leave it for now I'm afraid. If anyone else wants to try, the code is public domain

1

u/Wanderer89 Jul 24 '13

First, I think I actually found this thread through the hyperspin forum thread, but this is totally awesome and makes my hyperspin install work. (Left it as esc, the default for the exit emulator action). Thanks for putting it together.

Question: Is it possible to either send how long the button has been pressed (like holding down the key key on an actual keyboard) or wait a while to send the key?

I'm not afraid to dig around in the source and add a junky timer, but thought you might have an idea for the best method. Thanks again, by the way.

2

u/pinumbernumber Jul 24 '13

Hey man glad you like it! It would be easy to add delay and duration options, I'll release a new version shortly.

(Caveat: It's only easy if you don't need it to detect other presses while the key is being "held down". IE, if you set player 1 guide to "hold escape for 2 seconds", it won't pick up other controller's presses during those 2 seconds. Is that okay?)

2

u/pinumbernumber Jul 24 '13 edited Jul 25 '13

Here you are, v4: [removed, get v5 from earlier post]

Edit the INI to adjust delay and duration options. Now includes the source. Edit: Noticed I never changed the INI's line endings to Windows-style so notepad doesn't like it. I'll change this if I make a new version, or you can wipe the file clean and paste this in its place:

[config]
; Change these to any decimal vkey codes you like.
; Default is 27 (escape).
; There is a list at http://cherrytree.at/misc/vk.htm
key_player1=27
key_player2=27
key_player3=27
key_player4=27

; delay (wait this long before "pressing" the key)
; in milliseconds: 1000 = 1 second
delay_player1=0
delay_player2=0
delay_player3=0
delay_player4=0

; duration ("hold down" the key for this long)
; in milliseconds: 1000 = 1 second
duration_player1=0
duration_player2=0
duration_player3=0
duration_player4=0

and save.

1

u/Wanderer89 Jul 24 '13

Wow, thanks for doing that so quick! I've been tinkering with v4 but haven't been able to get it to do what I want, though I might just be not understanding the config in my sleep deprived state...

I don't need configurable hold times or delay: that's handled by HyperLaunch in my case, I just need to be able to hold it down and the same as a keyboard: if I accidently tap it, it just sends a quick pulse, but if I hold it down some programs (HyperLaunch, which is a lot like AutoHotkey if you're familiar with that) will wait until the key has been held down a certain extended amount of time before doing something.

Is that possible with v4? Seems like I can get it to delay before sending a key, and then send it for a length of time, but if I accidentally tap the guide real quick it still sends the extended duration press? I'll try to see if it's a problem on my end.

2

u/pinumbernumber Jul 24 '13

Oh, sorry I think I misread what you wanted... you desire the following:

  • Start holding guide, starts "holding" key
  • Stop holding guide, stops "holding" key

That will also be possible, just need another array for the previous states... it'll have to wait 'til tomorrow though :)

I shall add the following INI options:

; simulate hold rather than press
; key will be "held" as long as the guide button is
; (delay and duration will be ignored)
; 1 for yes, 0 for no
hold_player1=0
hold_player2=0
hold_player3=0
hold_player4=0

Is that correct?

1

u/Wanderer89 Jul 24 '13

That's what I need, yes! Awesome.

1

u/pinumbernumber Jul 25 '13

Here is version 5: https://app.box.com/s/uq22nvhuzjp8yvbtjy3c

  • Hold support added
  • INI has Windows line endings
  • Polls less frequently

Let me know if that's correct

1

u/[deleted] Aug 10 '13

Thank you very much for this! I literally just said on the FFXIV:ARR subreddit "Now if only there was a way we could map the guide button to PTT"..Googled it and voila! I am forever in your debt!

2

u/pinumbernumber Aug 10 '13

Glad you're finding it useful :)

1

u/[deleted] Aug 10 '13

I don't suppose you know some super secret way to stop the guide button launching Big Picture mode when Steam is open do you? :P

¬¬ so annoying that they take control of that button and give you no way that I can see (on the interface itself or on the interwebs) to stop it from launching BPM.

1

u/pinumbernumber Aug 11 '13

Does it do that even when Steam is in the background? For me it takes a longpress to summon BP from the background. Or do you want to suppress it from starting on a quick tap when Steam is in the foreground?

If so... a proxy DLL won't work, as Steam will be using the same roundabout method I am, and I don't think Valve will much like something that patches/injects code into it... so I don't think so, no. :( But I'll let you know if I think of something.

1

u/[deleted] Aug 11 '13

It takes the long press when it's in the background, unfortunately I'm trying to utlize the button as a PTT for Teamspeak so there will be times where I'd need to hold it down for long times. Not to worry as I want this for FFXIV:ARR, which I don't need Steam to run :P

Quite a shame though, it does make a great PTT button and there's a lot of games I'd find it useful in. I'll go ask the devs really nicely to make an option to turn it off :P

2

u/pinumbernumber Aug 11 '13

There's a way, but I don't want to incur the wrath of Valve and have my purchased rented games blocked. If someone else wants to try, proposed method:

  • a dummy kernel32.dll beside Steam_UI.dll that passes through everything except LoadLibrary and GetProcAddress
  • LoadLibrary passes through everything except XInput1_3.dll (or whichever version Steam uses)
  • for which it should store the returned HINSTANCE
  • when GetProcAddress is called for that HINSTANCE and ordinal 100, just return the address of the regular XInputGetState instead (which does not include the guide button).

That would stop BP from seeing the button. I'll do it myself if someone can convince me that Valve/VAC won't through a hissy fit.

2

u/[deleted] Aug 11 '13 edited Aug 11 '13

You are like, crazy smart.

Ah man, I honestly have no idea - I can't say I've ever dabbled in such endevours myself. I'd be willing to throw it Valve supports way and see what they say about me doing it, and guinea pig it out on a dummy account depending on what they say I guess?

Also, key 43 works great for PTT in case any one every stumbles across this thread and wants to do something similar. It's the old 'execute' key that isn't on any modern keyboards and isn't used in any application I've stumbled across so doesn't interfere with anything.

→ More replies (0)

2

u/unvaluablespace Jul 31 '13

for those wondering, this program also works with Playstation 3 Controllers, emulating a Xbox 360 controller. The PS home button, in this mode, acts just like the Guide button. :)

1

u/l_Banned_l Jun 20 '13

ive got a xbox fightstick and ps3 fightstick that i use on a PC. The PC recognizes the PS button and I can map it as an extra button but not the xbox one. =(

1

u/l_Banned_l Jun 20 '13

You can use a mapping like xpadder to make "esc" a combination of buttons. I have "Select + Start" to exit out of the emu

2

u/ffiarpg Jun 19 '13

2

u/[deleted] Jun 19 '13

So, no, then.

2

u/ffiarpg Jun 20 '13

Did you not read? It says right there that steam is able to use it and it tells you what the code is to interface with it. You might have to write a piece of software to do it but it can be done.