[bmx] Xbox 360 Controller Left & Right Triggers not correctly readable w/ JoyZ()

Started by IanMartin, September 14, 2017, 17:25:02

Previous topic - Next topic

IanMartin

Has anyone managed to get the Xbox 360 Controller triggers to read correctly?  If so what are you using to read them?

In BlitzMax,
If you read JoyZ(),
it gives 1 when you press the left trigger all the way down
it gives -1 when you press the right trigger all the way down
when you hold them both down, it reads 0

Each trigger should be independently readable between 0 (not pressed) and 1 (pressed all the way down).
They should not cancel each other out when both held down.

I believe the Xbox 360 controllers use XInput, as do a lot of other PC controllers, such as the Logitech 310.

Does anyone have a solution to correctly read the XBox 360 triggers?

Platfinity (made with BlitzMax) on Steam:
http://store.steampowered.com/app/365440/Platfinity/

Henri

Hi,

out of curiosity, does this problem occur both wireless and wired (I assume this is an option) ?   Never had a Microsoft console.

There is one solution provided by col http://wasted.nz/posts.php?topic=94785#1092801
Download-link doesn't work, but perhaps Dave can provide it.

Testing is tough without the controller, but I'm sure this issue can be solved.

-Henri
- Got 01100011 problems, but the bit ain't 00000001

IanMartin

Sorry, I should have specified:
I mean using the Xbox 360 controller on Windows.

Is col/Dave around?  I've never seen this before, but it may work.  Does anyone have the srs.mod?  Or know what it's doing in there to read the triggers? 
It looks like this does vibration too, which is one of the other things never fixed in BlitzMax's built in stuff.

I can test any code anyone posts...I have Xbox 360 as well as PS3, Logitech 310, generic, PDP, etc. controllers so I can test anything.  Hopefully someone else knows a way to do it or I can find col and see if he still has the old files.  Anyone shipping something on PC really needs this! :D
Platfinity (made with BlitzMax) on Steam:
http://store.steampowered.com/app/365440/Platfinity/

Henri

- Got 01100011 problems, but the bit ain't 00000001

IanMartin

Thanks for the link and the help, Henri :)

The link goes to here:
http://github.com/SRSSoftware/srs.mod
which has this:
d3d11graphics.mod
d3d11max2d.mod
directx11.mod

I don't see the SRS.Xbox360 in there though :(
Maybe it's there somewhere but I'm not seeing it.  I found this though:
https://github.com/SRSSoftware/srs.mod/commit/eb28cfdb9ea4de45a666c33925ca49bf1af0f0a7
line 183 seems to be what I'm looking for, but I'm not sure how to do it.  I wish I was better at doing the external stuff!




Platfinity (made with BlitzMax) on Steam:
http://store.steampowered.com/app/365440/Platfinity/

Henri

You can use 'Browse files' - button to go to that point in repo history. Then just download zip.

This 360 part was designed for old Bmax so some tweaking is involved (but very little).

-Henri
- Got 01100011 problems, but the bit ain't 00000001

col

Hiya,

The SRSSoftware github page is old now, all of my code on github is at

https://github.com/davecamp

The XBox360 controller can be found at

https://github.com/davecamp/xbox360.mod

Any probs let me know  8)

I'll create a working demo and post back...
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

col

I've updated the driver to cater for OS updates, and there's also an example usage app in the repo.

Any questions... feel free 8)
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

IanMartin

Awesome Dave!  Thank you!

OK, I think I'm going to sound really dumb here...but I've managed to get this far in BlitzMax without ever adding any mods. 
I'm not sure how to add the mod.
I tried going to the command line and running bmk but I'm obviously doing something wrong.  When I run the example (I tried it on the previous example too) I get a
Compile Error
Can't find interface for module 'srs.xbox360'

Since I believe no one is truly worthless, as I can always serve as a bad example...and maybe it will help someone else who has the same question but is afraid to ask...
how do I add this mod to my BlitzMax install? 

Platfinity (made with BlitzMax) on Steam:
http://store.steampowered.com/app/365440/Platfinity/

col

QuoteCan't find interface for module 'srs.xbox360'
To build modules ( and create the interface ) you'll need a gcc compiler installed on your system. Unix's supply a gcc compiler with the OS but Windows doesn't come with any compilers  ::)

The easiest way to get a gcc compiler up and running on a Windows unit is to follow this guide here: https://www.syntaxbomb.com/index.php?topic=36.0. I just did it to test and it took just a few minutes.
When installing a new gcc compiler it's very advisable to 'Rebuild all modules' to make sure everything is built using the same version etc.

The module should then located as
*BlitzMax Installation Folder*/mod/srs.mod/xbox360.mod/xbox360.bmx
*BlitzMax Installation Folder*/mod/srs.mod/xbox360.mod/example.bmx

Hit CTRL and D to build the module. Then you can run the example and/or use the module in your own code.

A fair warning is that you may experience some *thorns* getting a gcc installation up and running, most are easily resolved so if you have probs then let us know and we'll sort out them with you. Once you have a working installation then everything is simple to create and build your modules. BlitzMax really comes alive when you can do this so I think it's well worth doing ;)
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

IanMartin

Platfinity (made with BlitzMax) on Steam:
http://store.steampowered.com/app/365440/Platfinity/

IanMartin

I got to the part where I build the modules. 
g+ + is crashing now.

It's coming up with
g+ +.exe has stopped working
It seems to be stopping on freeaudio.mod
Build Error: failed to compile C:/BlitzMax/mod/pub.mod/freeaudio.mod/freeaudio.cpp

Do I need to set g++ to compatibility mode or something?  I'm not sure what else to try.

I'm running Windows 10 Home edition, 64 bit. 
Platfinity (made with BlitzMax) on Steam:
http://store.steampowered.com/app/365440/Platfinity/

col

Are you using the orginal BlitzMax or BlitzMaxNG?
All my steps above are for the original ( windows 150 ) downloadable from Skidracer at https://nitrologic.itch.io/blitzmax

There are also 2 environment variables to set up. You did those yes? and not just one?
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

IanMartin

D'oh!  Yeah, I think I Jezzed it up...I think I forgot to do this one:
In the 'System Variables' scroll down to the "Path", select it and click edit, scroll to the end of the 'Variable Value', add a semi colon and input the MinGW bin folder (eg: C:\MinGW\bin). Then click OK.
It's a bit different on Windows 10 but I think I did it right since the g++ crash isn't happening now.

But I'm still getting:
"Compiling:freeaudio.cpp
Build Error: failed to compile C:/BlitzMax/mod/pub.mod/freeaudio.mod/freeaudio.cpp
Process complete"
And then it's still doing:
"Compile Error
Can't find interface for module 'srs.xbox360'"
When I try the example.

I'm running vanilla original BlitzMax 1.50, downloaded a long time ago from the blitzbasic.com site. 
I don't need BLIde do I?  I'm just using MaxIDE.
Funny thing though, when I go to About MaxIDE It says
G++ Version: Unavailable
at the bottom.  I wonder if that's a clue?


Anyway, I know I'm a boobasaur, so thanks again for helping me!   ;D
Platfinity (made with BlitzMax) on Steam:
http://store.steampowered.com/app/365440/Platfinity/

col

That's great that you have the main installation building now! Awesome.

QuoteAnd then it's still doing:
"Compile Error
Can't find interface for module 'srs.xbox360'"

Can you double check the folder structure for the module is:
*installation*/mod/srs.mod/xbox360.mod/xbox360.bmx

Oops just re-read your post, so its still NOT getting the end of rebuilding the modules?


https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."