It is currently Sun Nov 18, 2018 2:52 pm



Reply to topic  [ 9 posts ] 
 Getting the 8bitdo SFC30 to work with FreePie? 
Author Message
One Eyed Hopeful
User avatar

Joined: Wed Sep 23, 2015 7:31 pm
Posts: 8
Reply with quote
Hi,

I just got a new controller, the SFC30 (I think they changed the name to just "SF" at one point) by 8bitdo, and I'm having a hell of a time trying to get it working with FreePie.

Trying to do a simple diagnostics.watch() and go from there, but the only inputs seem to be xbox360[0]?
Tried loading up x360ce but it doesn't seem compatible with FreePie?

I've tried a ton of searches.
Any ideas for getting this working?


Wed Sep 26, 2018 5:14 pm
Profile
One Eyed Hopeful
User avatar

Joined: Wed Sep 23, 2015 7:31 pm
Posts: 8
Reply with quote
I got it working.
I used joystick[1] instead of xbox360[0] and it worked.

For anyone stumbling across this via a search, here's my code:

Code:
def ini():
   speech.say("penis")

def keymap(b, k):
   if b:
      keyboard.setKeyDown(k)
   else:
      keyboard.setKeyUp(k)

def stickmap(b, a, k):
   if b == a:
      keyboard.setKeyDown(k)
   else:
      keyboard.setKeyUp(k)

def buttons():
   keymap(joystick[1].getDown(0),      Key.B)         #B
   keymap(joystick[1].getDown(1),      Key.A)         #A
   keymap(joystick[1].getDown(2),      Key.Y)         #Y
   keymap(joystick[1].getDown(3),      Key.X)         #X

   keymap(joystick[1].getDown(4),      Key.L)         #L
   keymap(joystick[1].getDown(5),      Key.R)         #R

   keymap(joystick[1].getDown(6),      Key.Backspace)   #Select
   keymap(joystick[1].getDown(7),      Key.Return)      #Start

def sticks():
   stickmap(joystick[1].y,      -1000,      Key.UpArrow)      #Dpad Up
   stickmap(joystick[1].y,      1000,      Key.DownArrow)      #Dpad Down
   stickmap(joystick[1].x,      -1000,      Key.LeftArrow)      #Dpad Left
   stickmap(joystick[1].x,      1000,      Key.RightArrow)      #Dpad Right

if starting:
   ini()

buttons()
sticks()



diagnostics.watch(joystick[1].getDown(0))      #B
diagnostics.watch(joystick[1].getDown(1))      #A
diagnostics.watch(joystick[1].getDown(2))      #Y
diagnostics.watch(joystick[1].getDown(3))      #X
diagnostics.watch(joystick[1].getDown(4))      #L
diagnostics.watch(joystick[1].getDown(5))      #R
diagnostics.watch(joystick[1].getDown(6))      #Select
diagnostics.watch(joystick[1].getDown(7))      #Start

diagnostics.watch(joystick[1].y)            #Dpad Y
diagnostics.watch(joystick[1].x)            #Dpad X


Have a good one.


Wed Sep 26, 2018 9:29 pm
Profile
Cross Eyed!

Joined: Mon Mar 02, 2015 3:58 pm
Posts: 119
Reply with quote
SFC30 by default provides DirectInput, not XInput. That is why joystick[] is needed. By the way, you can refer to it by name as well, e.g. joystick["Your Controller Name"], so that the script is not confused if you attach and detach more controllers.

To switch to XInput you need to do this:

Quote:
Alternatively, you can also hold the X-button while powering on your controller to use Xinput without having to install Xpad(as long as you are using the latest firmware for your controller). This will basically make every program recognise your controller as if it were an XBOX 360 controller.


according to this post:

https://www.reddit.com/r/8bitdo/comments/72er1v/xpad_app_doesnt_work_trying_to_use_sfc30_as/


Thu Sep 27, 2018 5:37 am
Profile
One Eyed Hopeful
User avatar

Joined: Wed Sep 23, 2015 7:31 pm
Posts: 8
Reply with quote
Ok, I got it paired as an XInput controller.

You actually have to re-register a new controller, and it's more pressing both X and start for about a second, then releasing both. Then the LED does a double blink for XInput pairing.

It shows up as "8bitdo SFC30(x)" and pairs as "Xbox Bluetooth Gamepad". But here's the thing though... In FreePie, the xbox360[] inputs don't register anything, and instead of joystick[1], it's now joystick[0].
Weird hey.

Perhaps there's something wrong with the drivers. I'm going to try ripping out all the HID drivers and Bluetooth drivers out, installing Toshiba again and starting from scratch. ...Tomorrow.


Thu Sep 27, 2018 11:13 am
Profile
Cross Eyed!

Joined: Mon Mar 02, 2015 3:58 pm
Posts: 119
Reply with quote
I am not sure all XInput is seen by the plugin as XBox360 controller... What is wrong with using joystick[]?


Thu Sep 27, 2018 12:58 pm
Profile
One Eyed Hopeful
User avatar

Joined: Wed Sep 23, 2015 7:31 pm
Posts: 8
Reply with quote
Well, there's nothing wrong with it. It works fine, for the SFC30.

I figured it's a good idea to get it working for other 8bitdo controllers.
Some of them have 2 joysticks and a dpad, and joystick[] only has the one x and y.


Thu Sep 27, 2018 4:02 pm
Profile
Cross Eyed!

Joined: Mon Mar 02, 2015 3:58 pm
Posts: 119
Reply with quote
joystick[] supports as many axes as Windows does, they are only named differently (rz, xRotation, sliders[0] etc.). It also supports the hat (which some controllers map the dpad to).


Thu Sep 27, 2018 11:40 pm
Profile
One Eyed Hopeful
User avatar

Joined: Wed Sep 23, 2015 7:31 pm
Posts: 8
Reply with quote
Ah, I didn't know joystick[] could do that, I've not used it before, just xbox360[].

I also found the location of the proper names of the joysticks, from a post you made 4 years ago.
Thanks for that.

It's in:
HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM\
somewhere.
But, all the controllers, they're all named "Bluetooth HID Port" under OEMName.
Fortunately, you can just modify that to whatever name you like. So you modify one of them. Then test if that's the controller you're trying to program for.


Fri Sep 28, 2018 4:12 am
Profile
Cross Eyed!

Joined: Mon Mar 02, 2015 3:58 pm
Posts: 119
Reply with quote
If you type in „joystick[0].” you get the autocompletion list, so you can check out what properties and methods the given entity has. Unfortunately, it does not work with joystick names.

I am glad that you find that info useful. freePIE is so useful (and fun) for me, that I try to help any way I can. Alas, I am not much of a programmer...


Fri Sep 28, 2018 5:48 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by STSoftware.