BASIC

Author Topic: JOY commands when no gamepad plugged cause heavy Frame Rate drops (Windows).  (Read 224 times)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3322
    • View Profile
    • Space Fractal
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.
« Last Edit: 2017-Oct-16 by spacefractal »
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4057
    • View Profile
    • Portfolio
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!

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3322
    • View Profile
    • Space Fractal
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.
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4057
    • View Profile
    • Portfolio
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.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4057
    • View Profile
    • Portfolio
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.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3322
    • View Profile
    • Space Fractal
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.
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4057
    • View Profile
    • Portfolio

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1170
    • View Profile
I had this issue on my Zombie shooter game... if gamepad was removed or connected after loading... etc.
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4057
    • View Profile
    • Portfolio
In my case i was calling 2 joypads but had only one connected.

Offline dreamerman

  • Mr. Polyvector
  • ***
  • Posts: 159
    • View Profile
    • my personal website
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...
Check my source code editor for GLBasic - link

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3322
    • View Profile
    • Space Fractal
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.
« Last Edit: 2017-Oct-24 by spacefractal »
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10649
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
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.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3322
    • View Profile
    • Space Fractal
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.
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.