GLBasic forum

Main forum => Bug Reports => Topic started by: spacefractal on 2017-Oct-16

Title: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: spacefractal on 2017-Oct-16
the fix to the issue is more simple than excepted and took 15 min to fix:

When GETJOYNAME$(x)="" then the JOY command should not been called at all (for all JOY command).

That it.

GETJOYNAME$() is NOT one of the commands that slowdown.

The most stupid issue and im newer noticed it before today.
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: erico on 2017-Oct-16
This is great, it seems that is exactly what I stumbled on a win 10 machine a week ago.
For some unknown reason this one game that calls joypad was working half the speed it should. All other games were fine.
It was pretty much a clean install machine, not much into it.

One chap recommended installing this DIRECT PLAY for the win 10 to fix it but I found annoying that a code won´t work out of the box.
I didn´t get to try out though, but if it is glb fixed, all the better.
Great fix Space!
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: spacefractal on 2017-Oct-16
im have adjusted GameInput API (im update later soon), so its newer call any joy commands when there is no joypad there. Howover there was some back issues as well.

Now its works excellent with the Xbox one controller too.

Simple just use GETJOYNAME$ to make sure there is a joypad before use of any JOY commands.
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: erico on 2017-Oct-17
I will def keep that in mind...strange I never had any trouble with win 7, it was just this one new win 10 machine that did so...and it is a very powerfull machine, it should have no problem handling my games.
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: erico on 2017-Oct-17
just to add up, one of the games had the joybutton command going but not the joydad ones, it worked fine, so did the buttons, the one game that had joypad calls did sport that half speed.
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: spacefractal on 2017-Oct-17
I'm confirm it'd the issue. Framerate is now faster and playable for him again.

I'm when possible release the new game input so it's don't call joy commands when no gamepads is inserted.....

All gernot needs to do its return 0 when name is empty for all joy commands for windows. Then it's been fixed.
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: erico on 2017-Oct-17
Superb Space!  :booze: :good:
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: MrPlow on 2017-Oct-18
I had this issue on my Zombie shooter game... if gamepad was removed or connected after loading... etc.
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: erico on 2017-Oct-18
In my case i was calling 2 joypads but had only one connected.
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: dreamerman on 2017-Oct-23
You found simple fix that doesn't complicate code to much, thats good. Btw it would be nice to have some pinned topic with known bugs and workarounds/fixes for them or something like this.. What's interesting I noticed that in some AAA/normal games you need to have joypad plugged in before starting game, as when game already loads with no joypad it will only allow to use mouse + keyboard as controls...
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: spacefractal on 2017-Oct-24
this fix should been done automatic in the glbasic source code, which should been quite simple too. Its pretty much samme line that should been done for all JOY commands.

btw we could do a sticky thread, that links to bugs with workaround.
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: Kitty Hello on 2017-Oct-26
Doh! Fixed in next update hopefully. The joystick was unaquired, the pointer was null -> I tried to poll it with some very ancient NT joystick code.
I think I'd better remove this code at all one day, because it's very very old APIs that are used.
Title: Re: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).
Post by: spacefractal on 2017-Oct-26
we should use xinput instead? howover this is a nice workaround fix, so its dont fall framerate when gamepad not used. Its was ran fine with a gamepad plugged. So hence.... dont use JOY command when name is empty. Its a one line fix. Just check if a name exits. if not then return it 0.

Also sometimes its can press a button down, even when a name is empty. That issue would also been fixed too.