@Todd,
NP, just trying to get the word out.
Just curious, have you tried a guitar controller yet?
Also, I have some more info. With the new driver I downloaded, it adds functionality for that lighted up button. When you press it in a DBPro app, a little help/update thingee from Microsoft shows up. Also, the lights tell you what controller it is. Top left light is lit for controller 1, top right for controller 2, not sure where 3 and 4 are, but guessing bottom right then bottom left. Also, when you push that button, the correct light is lit on the help thingee, so it indicates which control launched it.
Anyway, I redid the test app to support up to 4 controllers. And, since my text display is so slow, you can toggle it on and off to see the framerate without the text. Makes a huge difference. There is some fps hit when running two controllers. You'll have to unplug them to find out for yourslf.
here is the code:
//test Todd Riggins XB360 dll
//by Visigoth
autocam off
sync on
sync rate 0
set display mode desktop width(),desktop height(),32
type xbox_todds_dll
id as integer
ctype as integer
thdze as boolean
thdzp as integer
trdze as boolean
trdzp as integer
a_button as boolean
b_button as boolean
x_button as boolean
y_button as boolean
back_button as boolean
start_button as boolean
dpad as integer
l_shoulder as boolean
r_shoulder as boolean
l_thumb as boolean
r_thumb as boolean
l_trigger as float
r_trigger as float
l_thumbX as integer
l_thumbY as integer
r_thumbX as integer
r_thumbY as integer
l_rumble as integer
r_rumble as integer
endtype
global numControllers
global connected
global mclick
global isclicked
connected = gamepad_init_xb360()
numControllers = 3 // to test output to screen for up to 4 controllers
dim controller(numControllers) as xbox_Todds_dll
gamepad_setup(numControllers)
empty checklist
perform checklist for control devices
do
cls
gamepad_update_xb360(numControllers)
gamepad_rumble(numControllers)
stats_toggle()
stats_display(numControllers)
sync
loop
function gamepad_init_xb360()
xb360 init
nc = 0
for i = 0 to 3
a = xb360 controller connected(i)
if a = 1
inc nc,1
endif
next i
endfunction nc
function gamepad_setup(nc)
for i = 0 to nc
if xb360 controller connected(i) = 1 //did this because FPS went way down after seting up ghost controllers
controller(i).id = i
controller(i).thdze = 1
controller(i).thdzp = 20
controller(i).trdze = 1
controller(i).trdzp = 20
controller(i).l_rumble = 65535
controller(i).r_rumble = 65535
xb360 thumb dead zone enable controller(i).id,controller(i).thdze
xb360 thumb dead zone percent controller(i).id,controller(i).thdzp
xb360 trigger dead zone enable controller(i).id,controller(i).trdze
xb360 trigger dead zone percent controller(i).id,controller(i).trdzp
else
controller(i).id = i
endif
next i
endfunction
function gamepad_update_xb360(nc)
xb360 poll 0
for i = 0 to nc
if xb360 controller connected(i) = 1
controller(i).x_button = xb360 x button(controller(i).id)
controller(i).y_button = xb360 y button(controller(i).id)
controller(i).a_button = xb360 a button(controller(i).id)
controller(i).b_button = xb360 b button(controller(i).id)
controller(i).back_button = xb360 back button(controller(i).id)
controller(i).start_button = xb360 start button(controller(i).id)
controller(i).dpad = xb360 dpad(controller(i).id)
controller(i).l_shoulder = xb360 left shoulder(controller(i).id)
controller(i).r_shoulder = xb360 right shoulder(controller(i).id)
controller(i).l_thumb = xb360 left thumb(controller(i).id)
controller(i).r_thumb = xb360 right thumb(controller(i).id)
controller(i).l_trigger = xb360 left trigger(controller(i).id)
controller(i).r_trigger = xb360 right trigger(controller(i).id)
controller(i).l_thumbX = xb360 thumb left x(controller(i).id)
controller(i).l_thumbY = xb360 thumb left y(controller(i).id)
controller(i).r_thumbX = xb360 thumb right x(controller(i).id)
controller(i).r_thumbY = xb360 thumb right y(controller(i).id)
endif
next i
endfunction
function gamepad_rumble(nc)
for i = 0 to nc
if xb360 controller connected(i) = 1
controller(i).l_rumble = controller(i).l_trigger * 257
controller(i).r_rumble = controller(i).r_trigger * 257
xb360 left motor speed controller(i).id,controller(i).l_rumble
xb360 right motor speed controller(i).id,controller(i).r_rumble
endif
next i
endfunction
function stats_toggle()
if mouseclick() = 1
if mclick = 0
isclicked = 1 - isclicked
mclick = 1
endif
endif
if mouseclick() = 0
if mclick = 1
mclick = 0
endif
endif
endfunction
function stats_display(nc)
c_id = 0
x = 20
y = 0
text desktop width() / 2, 0, "Left mouse to toggle text"
text x,y,"MClicked :" + str$(isclicked) : inc y,10
text x,y,"FPS : " + str$(screen fps()) : inc y,10
text x,y,"Num controls : " + str$(numControllers + 1) : inc y,10
if isclicked = 0
for ii = 0 to 1
for i = 0 to 1
if c_id <= connected - 1
s_id = (connected - c_id )
text x,y,"Controller Name : " + checklist string$(s_id) : inc y,10 //because checklist list controllers backwards
//text x,y,"Controller Name : " + str$(s_id) : inc y,10
else
text x,y,"Controller Name : " + "Not Connected" : inc y,10
endif
text x,y,"Controller ID : " + str$(controller(c_id).id) : inc y,10
//buttons
text x,y,"A button : " + str$(controller(c_id).a_button) : inc y,10
text x,y,"B button : " + str$(controller(c_id).b_button) : inc y,10
text x,y,"X button : " + str$(controller(c_id).x_button) : inc y,10
text x,y,"Y button : " + str$(controller(c_id).y_button) : inc y,10
text x,y,"Dpad : " + str$(controller(c_id).dpad) : inc y,10
text x,y,"Back button : " + str$(controller(c_id).back_button) : inc y,10
text x,y,"Start button : " + str$(controller(c_id).start_button) : inc y,10
text x,y,"Left shoulder : " + str$(controller(c_id).l_shoulder) : inc y,10
text x,y,"Right shoulder : " + str$(controller(c_id).r_shoulder) : inc y,10
text x,y,"Left thumb button : " + str$(controller(c_id).l_thumb) : inc y,10
text x,y,"Right thumb button: " + str$(controller(c_id).r_thumb) : inc y,10
//analog
text x,y,"Left trigger : " + str$(controller(c_id).l_trigger) : inc y,10
text x,y,"Right trigger : " + str$(controller(c_id).r_trigger) : inc y,10
text x,y,"Left thumb X axis : " + str$(controller(c_id).l_thumbX) : inc y,10
text x,y,"Left thumb Y axis : " + str$(controller(c_id).l_thumbY) : inc y,10
text x,y,"Right thumb X axis: " + str$(controller(c_id).r_thumbX) : inc y,10
text x,y,"right thumb Y axis: " + str$(controller(c_id).r_thumbY) : inc y,10
//rumble
text x,y,"Left rumble speed : " + str$(controller(c_id).l_rumble) : inc y,10
text x,y,"Right rumble speed: " + str$(controller(c_id).r_rumble) : inc y,10
x = desktop width() / 2
if ii = 0
y = 30
else
y = 400
endif
inc c_id,1
next i
y = 400
x = 20
next ii
endif
endfunction
I noticed Lee himself unlocked this thread. hmmmmm........
edit:
added the .exe if you would rather just run the app instead of compile it.
edit again:
actually, I have no loss in framerate with text display off with one or two controllers.
sorry, one more edit:
Hey Todd, is it possible for you to get the name of the controller somehow?
Using the checklist is kind of a pain.