lmmenge / MeSNEmu

Super Nintendo Entertainment System (SNES) / Super Famicom emulator (based on SNES9X) for iOS (iPhone/iPad)
223 stars 75 forks source link

Add support for other iCade-like controllers (Submit your info here) #4

Open lmmenge opened 11 years ago

lmmenge commented 11 years ago

Many iCade-like controllers (controllers that connect to iOS devices as if they were bluetooth keyboards) have different key maps for their buttons. Take for instance the iCade 8-Bitty: it's different enough from the original iCade that some games are nearly unplayable on this controller.

So in order to add support to various iCade-like controllers, I need your help: if you have an iCade-like controller that is not currently supported by MeSNEmu and you want it supported, please follow these instructions and support for it will be added ASAP:

The button sequence you press is very important, since some controllers don't have the exact same layout as a SNES controller. Please try to match it as closely as possible for the best gameplay experience. Below is a picture of a SNES controller. The L and R buttons are on the shoulders of the controller: snes-controller

infernoten commented 10 years ago

The following text string is from a SteelSeries Free gamepad: wedcxzaqoglvythrufjnimkp

I verified it is correct by replacing a previous controller's setOnStateString and offStateString in LMBTControllerView.m with the appropriate on and off character from the above string and testing it out.

lmmenge commented 10 years ago

Hello infernoten! Thanks for submitting. Just confirming the string that will be added to master (since you mentioned you did this before): [self LMBT_setOnStateString:"wdxaolyhujik" offStateString:"eczqgvtrfnmp"];

That looks like a really nice gamepad, too! Comfy?

infernoten commented 10 years ago

That matches what I inserted.

For a small controller, the Free is surprisingly comfy. The shoulder buttons have a really audible click to them, though.

lmmenge commented 10 years ago

SteelSeries Free support pushed to master.

eltonsalmeida commented 10 years ago

The following text string is from a 8bitdo FC30 gamepad: wedcxzaqtufimkpoglvhrjnu

How I fix de buttons position?

lmmenge commented 10 years ago

8Bitdo FC30 support pushed to master.

guidoscheffler commented 10 years ago

The 8Bitdo FC30 strings currently in the code didn't work for me; I had to change it to the following:

[self LMBT_setOnStateString:"wdxazuikolhj"
             offStateString:"ecyqtfmpgvrn"];
lmmenge commented 10 years ago

@eltonsalmeida @guidoscheffler what kind of keyboard layout and language are you guys using? Could this difference be due to keyboard layout mismatches?

guidoscheffler commented 10 years ago

My system language is English; for keyboard layouts I usually switch between English and German. The keyboard layout seems to indeed be the problem; depending on what I set the layout to before connecting the 8Bitdo FC30, the strings are:

Either way, there definitely is an error in @eltonsalmeida's string, because it contains two "u"s. It seems that he turned off the controller by holding down start at the end, which resulted in the second u, and somehow didn't record push select correctly, which would explain the missing z/y at position 9 when comparing it to my strings.

lmmenge commented 10 years ago

@guidoscheffler you are correct. I've just pushed to master your English 8Bitdo FC30 string. Thank you for correcting this.

wiegerthefarmer commented 10 years ago

I've built a customer snes controller using the guide from adafruit. (https://learn.adafruit.com/snes-ez-key-bluefruit-game-pad/overview) The controller works great, and I can re-map the buttons to any keys I want. However, it doesn't send the off keys, only on. Any thoughts on how I can make SiOS work with that?

lmmenge commented 10 years ago

@wiegerthefarmer You need the down/up events separately for the current architecture (both the iOS front-end and the SNES9X back-end use that paradigm). Otherwise, how do we know when you're still holding the button down? How do we know when you have released it?

wiegerthefarmer commented 10 years ago

Yah, that makes sense. On further investigation the adafruit ez-key sends the same key with a keyUp event when its released. I know that this isn't how iCade operates. I'll see if I can write something for SiOS to handle this event structure.

It may end up using private members, but I have a apple dev account, so I can build it myself.... http://stackoverflow.com/questions/18747759/ios-7-hardware-keyboard-events http://nacho4d-nacho4d.blogspot.ca/2012/01/catching-keyboard-events-in-ios.html

Looks like it might be possible using public apis... http://blog.swilliams.me/words/2013/09/19/handling-keyboard-events-with-modifier-keys-in-ios-7/

One last thing.... can get keyups https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/CodeExplainedAdventure/ControllingtheCharacters/ControllingtheCharacters.html

Time to see if I can get it going!

On 13 October 2014 09:09, Lucas Menge notifications@github.com wrote:

@wiegerthefarmer https://github.com/wiegerthefarmer You need the down/up events separately for the current architecture (both the iOS front-end and the SNES9X back-end use that paradigm). Otherwise, how do we know when you're still holding the button down? How do we know when you have released it?

— Reply to this email directly or view it on GitHub https://github.com/lmmenge/SiOS/issues/4#issuecomment-58889328.

wiegerthefarmer commented 10 years ago

This worked! https://gist.github.com/steventroughtonsmith/7515380 -(UIKeyCommand )_keyCommandForEvent:(UIEvent )event // UIPhysicalKeyboardEvent { NSLog(@"keyCommandForEvent: %@\n\ type = %i\n\ keycode = %@\n\ keydown = %@\n\n", event.debugDescription, event.type, [event valueForKey:@"_keyCode"], [event valueForKey:@"_isKeyDown"]);

return  [UIKeyCommand keyCommandWithInput:nil modifierFlags:nil action:@selector(processKeyInput:)];

}

Put that code in iCadeReaderView.m, and you get very clear keyup and keydown events. :)

lmmenge commented 10 years ago

@wiegerthefarmer Hmm. I'm not sure I like this approach. Since you built your own controller, can't you make it work like an iCade controller? Button down is sending one letter, button up is sending another letter? With your approach, we'd have to use private APIs and add another special case in the front-end just for this controller. I'd rather keep the codebase as clean as possible.

wiegerthefarmer commented 10 years ago

I can try. The big issue is that the Adafruit EZ-key sends the standard keydown keyup events, and isn't compatible with iCade. I could probably add an arduino in the controller....

On 14 October 2014 23:00, Lucas Menge notifications@github.com wrote:

@wiegerthefarmer https://github.com/wiegerthefarmer Hmm. I'm not sure I like this approach. Since you built your own controller, can't you make it work like an iCade controller? Button down is sending one letter, button up is sending another letter? With your approach, we'd have to use private APIs and add another special case in the front-end just for this controller. I'd rather keep the codebase as clean as possible.

— Reply to this email directly or view it on GitHub https://github.com/lmmenge/SiOS/issues/4#issuecomment-59151477.

DerekT07 commented 9 years ago

Here's the string I got for 8bitdo's NES30 controller. Slightly different from the FC30:

wedcxzaqlvogythrjnufkpim

I appreciate the work out into supporting it!

lmmenge commented 9 years ago

@DerekT07 done in 1.4.5.

no2sc2 commented 9 years ago

I know the 8bitdo NES30 key map is given but here is my strings. They said the native mode for the 8bitdo NES30 is mode 2. I had problem using mode 2 on my iPhone 6. It wouldn't response for some reason even after chosen the correct controller in the app settings. I had to boot up on mode 3 for it to work. Here are my strings for the 8bitdo nes30.

8bitdo NES30 Mode 2 (as player one "Start+B" boot) cfdenoijhgkm

8Bitdo NES30 Mode 2 (as player two "Start+B+R" boot) The strings here was as it was set up. The up directional button made the cursor go up, the right directional button made the cursor goes right, down directional button made the cursor go down, left directional button made the cursor go left. Select button was a space and the start button brought the cursor down to the next line. The letter buttons yield as it was, "YBXALR".

8Bitdo NES30 Mode 3 (as single player "Start+A" boot) wedcxzaqlvogythrjnufkpim

I did these strings on my iPhone 6. I did not boot the 8Bitdo nes30 on any other modes because it was only designated for iOS on mode 2 and mode 3 only.

lmmenge commented 9 years ago

@no2sc2 MeSNEmu supports the NES30 in Mode 3 as of version 1.4.5 (DerekT07's Mode 3 string matches yours).

no2sc2 commented 9 years ago

Yes Lucas. I spoke to you about 2 player mode not working. I did a string test anyways so you can get an idea of the keys on mode 2. Maybe it'll help in future updates!

acowinthecrowd commented 9 years ago

I have an ipega controller (http://www.amazon.com/Generic-Bluetooth-Controller-Wireless-Joystick/dp/B00AR9JEQU)

Its layout is different than a typical SNES controller, an and xy are switched. I have two strings for you.

This is hitting the x button on the controller as y, since the SNES has a y where the ipega has an x, etc wedcxzaqjnufythrimkp

This is the key sequence if I follow the instructions exactly, hitting the x where it shows on the controller. wedcxzaqythrjnufimkp

I hope that makes sense but if not, let me know.

lmmenge commented 9 years ago

@acowinthecrowd just to be clear: if you ignore the letters written on your controller and just press the buttons that are in the same positions (spacially) as the real SNES controller, is this the resulting string? wedcxzaqjnufythrimkp

acowinthecrowd commented 9 years ago

That's correct, sorry to make it sound so confusing =)

Gohlan commented 9 years ago

Hi, the following text is for a snakebyte controller: wedcxzaqlvogythrjnufimkp

lmmenge commented 9 years ago

@Gohlan is that for this controller? http://www.snakebyte-europe.com/en/container-produkte/products/android/idroidcon/

lmmenge commented 9 years ago

@acowinthecrowd I just noticed your strings are missing 4 letters. Could you confirm which keys you either don't have or your controller typing while you press?

Gohlan commented 9 years ago

Hello,

Yes it is.

Emmanuel Lévy | +33 6 3378 6556 | Envoyé à partir de mon Windows Phone


De : Lucas Mengemailto:notifications@github.com Envoyé : ‎14/‎01/‎2015 20:56 À : lmmenge/MeSNEmumailto:MeSNEmu@noreply.github.com Cc : Gohlanmailto:emmanuel.levy@live.fr Objet : Re: [MeSNEmu] Add support for other iCade-like controllers (Submit your info here) (#4)

@Gohlan is that for this controller? http://www.snakebyte-europe.com/en/container-produkte/products/android/idroidcon/


Reply to this email directly or view it on GitHub: https://github.com/lmmenge/MeSNEmu/issues/4#issuecomment-69980402

naldin commented 9 years ago

Text string for iPega PG-9025: wedcxzaqoglvjnufythrimkp http://www.dx.com/p/ipega-pg-9025-multimedia-bluetooth-controller-black-256612

lmmenge commented 9 years ago

Pushed IPEGA PG-9025. Thanks @naldin ! Pushed Snakebyte idroid:con. Thanks @Gohlan !

naldin commented 9 years ago

Thanks @Immenge . Do you know when this will be update in http://builds.io?

lmmenge commented 9 years ago

@naldin no idea. I don't own/maintain that site. Maybe you should ask its owner directly?

naldin commented 9 years ago

Ok @lmmenge I will, thank you again ;)