The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
[SDL2+Linux WINE]-USB Gamepad Issues?
JeZ-l-Lee


Joined: 20 Sep 2009
Posts: 572
Location: Long Island, New York, United States, Earth
[SDL2+Linux WINE]-USB Gamepad Issues?

Hi,

I am using SDL version 2.0.3.
My SDL application makes use of USB gamepads.
When I run the application on either Windows 10 or Linux Mint 17.2(Ubuntu 14.04) the USB gamepads work 100%.
When I run the Windows version of my application under Linux WINE version 1.7.55 the USB gamepads have major problems?
(USB gamepads register movement when they are not being used?)

You can download the open-source cross-platform SDL2 application at below URL:
http://16bitsoft.com/files-V2/PDHSE-WinLinux-Beta.zip

We would like to fix USB gamepads when running SDL2 Windows application in Linux WINE.
Any help would be appreciated, thanks!
JeZ-l-Lee


Joined: 20 Sep 2009
Posts: 572
Location: Long Island, New York, United States, Earth
URL link to the SDL forum post:
http://forums.libsdl.org/viewtopic.php?t=11601

Hi,

So here is my USB gamepad code:
Code:
if (JoystickDeviceOne != NULL)
   {
      SDL_JoystickUpdate();

      Sint16 joystickXmovement = 0;
        if (JoyLEFT[0] > Axis7)
        {
            if ( SDL_JoystickGetButton(JoystickDeviceOne, JoyLEFT[0]-8) )  JoystickDirectionHorizonal[JoystickOne] = LEFT;
            else  if ( SDL_JoystickGetButton(JoystickDeviceOne, JoyRIGHT[0]-8) )  JoystickDirectionHorizonal[JoystickOne] = RIGHT;
        }
        else joystickXmovement = SDL_JoystickGetAxis(JoystickDeviceOne, JoyLEFT[0]);

      Sint16 joystickYmovement = 0;
        if (JoyUP[0] > Axis7)
        {
            if ( SDL_JoystickGetButton(JoystickDeviceOne, JoyUP[0]-8) )  JoystickDirectionVertical[JoystickOne] = UP;
            else  if ( SDL_JoystickGetButton(JoystickDeviceOne, JoyDOWN[0]-8) )  JoystickDirectionVertical[JoystickOne] = DOWN;
        }
        else joystickYmovement = SDL_JoystickGetAxis(JoystickDeviceOne, JoyUP[0]);

      if (joystickYmovement < -16383)
      {
            JoystickDirectionVertical[JoystickOne] = UP;
      }
      else if (joystickYmovement > 16383)
      {
            JoystickDirectionVertical[JoystickOne] = DOWN;
      }

      if (joystickXmovement < -16383)
      {
            JoystickDirectionHorizonal[JoystickOne] = LEFT;
      }
      else if (joystickXmovement > 16383)
      {
            JoystickDirectionHorizonal[JoystickOne] = RIGHT;
      }

        if (JoyButton1[0] > Axis7)
        {
          if ( SDL_JoystickGetButton(JoystickDeviceOne, JoyButton1[0]-8) )  JoystickButtonOne[JoystickOne] = ON;
        }
        else
        {
            Sint16 padAsButton = SDL_JoystickGetAxis(JoystickDeviceOne, JoyButton1[0]);
            if (padAsButton < -16383)  JoystickButtonOne[JoystickOne] = ON;
        }

        if (JoyButton2[0] > Axis7)
        {
          if ( SDL_JoystickGetButton(JoystickDeviceOne, JoyButton2[0]-8) )  JoystickButtonTwo[JoystickOne] = ON;
        }
        else
        {
            Sint16 padAsButton = SDL_JoystickGetAxis(JoystickDeviceOne, JoyButton2[0]);
            if (padAsButton < -16383)  JoystickButtonTwo[JoystickOne] = ON;
        }
    }

    if (JoystickDeviceTwo != NULL)
   {
      SDL_JoystickUpdate();

      Sint16 joystickXmovement = 0;
        if (JoyLEFT[1] > Axis7)
        {
            if ( SDL_JoystickGetButton(JoystickDeviceTwo, JoyLEFT[1]-8) )  JoystickDirectionHorizonal[JoystickTwo] = LEFT;
            else  if ( SDL_JoystickGetButton(JoystickDeviceTwo, JoyRIGHT[1]-8) )  JoystickDirectionHorizonal[JoystickTwo] = RIGHT;
        }
        else joystickXmovement = SDL_JoystickGetAxis(JoystickDeviceTwo, JoyLEFT[1]);

      Sint16 joystickYmovement = 0;
        if (JoyUP[1] > Axis7)
        {
            if ( SDL_JoystickGetButton(JoystickDeviceTwo, JoyUP[1]-8) )  JoystickDirectionVertical[JoystickTwo] = UP;
            else  if ( SDL_JoystickGetButton(JoystickDeviceTwo, JoyDOWN[1]-8) )  JoystickDirectionVertical[JoystickTwo] = DOWN;
        }
        else joystickYmovement = SDL_JoystickGetAxis(JoystickDeviceTwo, JoyUP[1]);

      if (joystickYmovement < -16383)
      {
            JoystickDirectionVertical[JoystickTwo] = UP;
      }
      else if (joystickYmovement > 16383)
      {
            JoystickDirectionVertical[JoystickTwo] = DOWN;
      }

      if (joystickXmovement < -16383)
      {
            JoystickDirectionHorizonal[JoystickTwo] = LEFT;
      }
      else if (joystickXmovement > 16383)
      {
            JoystickDirectionHorizonal[JoystickTwo] = RIGHT;
      }

        if (JoyButton1[1] > Axis7)
        {
          if ( SDL_JoystickGetButton(JoystickDeviceTwo, JoyButton1[1]-8) )  JoystickButtonOne[JoystickTwo] = ON;
        }
        else
        {
            Sint16 padAsButton = SDL_JoystickGetAxis(JoystickDeviceTwo, JoyButton1[1]);
            if (padAsButton < -16383)  JoystickButtonOne[JoystickTwo] = ON;
        }

        if (JoyButton2[1] > Axis7)
        {
          if ( SDL_JoystickGetButton(JoystickDeviceTwo, JoyButton2[1]-8) )  JoystickButtonTwo[JoystickTwo] = ON;
        }
        else
        {
            Sint16 padAsButton = SDL_JoystickGetAxis(JoystickDeviceTwo, JoyButton2[1]);
            if (padAsButton < -16383)  JoystickButtonTwo[JoystickTwo] = ON;
        }
    }

    if (JoystickDeviceThree != NULL)
   {
      SDL_JoystickUpdate();

      Sint16 joystickXmovement = 0;
        if (JoyLEFT[2] > Axis7)
        {
            if ( SDL_JoystickGetButton(JoystickDeviceThree, JoyLEFT[2]-8) )  JoystickDirectionHorizonal[JoystickThree] = LEFT;
            else  if ( SDL_JoystickGetButton(JoystickDeviceThree, JoyRIGHT[2]-8) )  JoystickDirectionHorizonal[JoystickThree] = RIGHT;
        }
        else joystickXmovement = SDL_JoystickGetAxis(JoystickDeviceThree, JoyLEFT[2]);

      Sint16 joystickYmovement = 0;
        if (JoyUP[2] > Axis7)
        {
            if ( SDL_JoystickGetButton(JoystickDeviceThree, JoyUP[2]-8) )  JoystickDirectionVertical[JoystickThree] = UP;
            else  if ( SDL_JoystickGetButton(JoystickDeviceThree, JoyDOWN[2]-8) )  JoystickDirectionVertical[JoystickThree] = DOWN;
        }
        else joystickYmovement = SDL_JoystickGetAxis(JoystickDeviceThree, JoyUP[2]);

      if (joystickYmovement < -16383)
      {
            JoystickDirectionVertical[JoystickThree] = UP;
      }
      else if (joystickYmovement > 16383)
      {
            JoystickDirectionVertical[JoystickThree] = DOWN;
      }

      if (joystickXmovement < -16383)
      {
            JoystickDirectionHorizonal[JoystickThree] = LEFT;
      }
      else if (joystickXmovement > 16383)
      {
            JoystickDirectionHorizonal[JoystickThree] = RIGHT;
      }

        if (JoyButton1[2] > Axis7)
        {
          if ( SDL_JoystickGetButton(JoystickDeviceThree, JoyButton1[2]-8) )  JoystickButtonOne[JoystickThree] = ON;
        }
        else
        {
            Sint16 padAsButton = SDL_JoystickGetAxis(JoystickDeviceThree, JoyButton1[2]);
            if (padAsButton < -16383)  JoystickButtonOne[JoystickThree] = ON;
        }

        if (JoyButton2[2] > Axis7)
        {
          if ( SDL_JoystickGetButton(JoystickDeviceThree, JoyButton2[2]-8) )  JoystickButtonTwo[JoystickThree] = ON;
        }
        else
        {
            Sint16 padAsButton = SDL_JoystickGetAxis(JoystickDeviceThree, JoyButton2[2]);
            if (padAsButton < -16383)  JoystickButtonTwo[JoystickThree] = ON;
        }
    }


Hope someone can help me, thanks!
[SDL2+Linux WINE]-USB Gamepad Issues?
i8degrees


Joined: 22 Nov 2014
Posts: 39
What gamepads have you tested..? My guess is that it is a XInput issue. Search the web with the query, "wine xinput" to see what I'm thinking. Good luck!

Jeffrey Carpenteri8degrees@gmail.com


On Nov 29, 2015, at 18:53, JeZ-l-Lee wrote:


Quote:
[SDL2+Linux WINE]-USB Gamepad Issues?

Hi,

I am using SDL version 2.0.3.
My SDL application makes use of USB gamepads.
When I run the application on either Windows 10 or Linux Mint 17.2(Ubuntu 14.04) the USB gamepads work 100%.
When I run the Windows version of my application under Linux WINE version 1.7.55 the USB gamepads have major problems?
(USB gamepads register movement when they are not being used?)

You can download the open-source cross-platform SDL2 application at below URL:
http://16bitsoft.com/files-V2/PDHSE-WinLinux-Beta.zip

We would like to fix USB gamepads when running SDL2 Windows application in Linux WINE.
Any help would be appreciated, thanks!



JeZxLee
JessePalser <AT> GMail <DOT> com
16BitSoft Inc.
Video Game Design Studio
www.16BitSoft.com

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

JeZ-l-Lee


Joined: 20 Sep 2009
Posts: 572
Location: Long Island, New York, United States, Earth
URL link to the SDL forum post:
http://forums.libsdl.org/viewtopic.php?t=11601

Hi,

I am getting a crash on exit of Windows SDL2 application in Linux WINE.
Here is the log:
Code:
Unhandled exception: page fault on read access to 0x00000004 in 32-bit code (0x6c7ff445).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:6c7ff445 ESP:0062fd1c EBP:0062fd30 EFLAGS:00210212(  R- --  I   -A- - )
 EAX:00000000 EBX:003509d8 ECX:0062fd1c EDX:001410dc
 ESI:7ffdf000 EDI:00401280
Stack dump:
0x0062fd1c:  001410c0 ffffffff 0062fd28 00000000
0x0062fd2c:  00350748 0062fde8 6c804b88 00350748
0x0062fd3c:  7b8c0000 6c7f919e 00350748 00000000
0x0062fd4c:  7b8c0000 7ffdf000 00401280 0062fde8
0x0062fd5c:  6c741cc4 7ffdf000 00401280 7b8c0000
0x0062fd6c:  0041bfbf 0041ed5e 00000001 7eceeefb
000c: sel=0067 base=00000000 limit=00000000 32-bit r-x
Backtrace:
=>0 0x6c7ff445 in sdl2 (+0xbf445) (0x0062fd30)
  1 0x6c804b88 in sdl2 (+0xc4b87) (0x0062fde8)
  2 0x004010fd in pdh3-sdl2 (+0x10fc) (0x0062fe78)
  3 0x7b862f73 in kernel32 (+0x52f72) (0x0062feb8)
  4 0x7bc84470 call_thread_func_wrapper+0xb() in ntdll (0x0062fed8)
  5 0x7bc8763d call_thread_func+0x7c() in ntdll (0x0062ffa8)
  6 0x7bc8444e RtlRaiseException+0x21() in ntdll (0x0062ffc8)
  7 0x7bc564ce call_dll_entry_point+0x3fd() in ntdll (0x0062ffe8)
  8 0xf762361d wine_call_on_stack+0x1c() in libwine.so.1 (0x00000000)
  9 0xf76236db wine_switch_to_stack+0x2a() in libwine.so.1 (0xffec3768)
  10 0x7bc5c809 LdrInitializeThunk+0x238() in ntdll (0xffec37a8)
  11 0x7b869863 __wine_kernel_init+0xa12() in kernel32 (0xffec48c8)
  12 0x7bc5d733 __wine_process_init+0x192() in ntdll (0xffec4958)
  13 0xf7620d80 wine_init+0x30f() in libwine.so.1 (0xffec49b8)
  14 0x7bf0100c main+0xfb() in <wine-loader> (0xffec4e08)
  15 0xf743ba83 __libc_start_main+0xf2() in libc.so.6 (0x00000000)
0x6c7ff445: movl   0x4(%eax),%ecx
Modules:
Module   Address         Debug info   Name (114 modules)
PE     400000-  42e000   Export          pdh3-sdl2
PE   62e80000-62ea6000   Deferred        zlib1
PE   67880000-678d6000   Deferred        sdl2_mixer
PE   68b40000-68b77000   Deferred        libpng16-16
PE   6a880000-6a8b2000   Deferred        sdl2_image
PE   6c740000-6c83f000   Export          sdl2
PE   6cd00000-6cd81000   Deferred        libfreetype-6
PE   71000000-71014000   Deferred        sdl2_ttf
ELF   78630000-7a800000   Deferred        libnvidia-glcore.so.352.63
ELF   7a800000-7a91f000   Deferred        opengl32<elf>
  \-PE   7a820000-7a91f000   \               opengl32
ELF   7b800000-7ba6a000   Dwarf           kernel32<elf>
  \-PE   7b810000-7ba6a000   \               kernel32
ELF   7bc00000-7bcf3000   Dwarf           ntdll<elf>
  \-PE   7bc10000-7bcf3000   \               ntdll
ELF   7bf00000-7bf04000   Dwarf           <wine-loader>
ELF   7c493000-7c4b0000   Deferred        libgcc_s.so.1
ELF   7c4b0000-7c5a6000   Deferred        libasound.so.2
ELF   7c5ce000-7c600000   Deferred        winealsa<elf>
  \-PE   7c5d0000-7c600000   \               winealsa
ELF   7c70f000-7c725000   Deferred        midimap<elf>
  \-PE   7c710000-7c725000   \               midimap
ELF   7c725000-7c73d000   Deferred        libresolv.so.2
ELF   7c73d000-7c769000   Deferred        libvorbis.so.0
ELF   7c769000-7c8e1000   Deferred        libvorbisenc.so.2
ELF   7c8e1000-7c915000   Deferred        libflac.so.8
ELF   7c915000-7c987000   Deferred        libsndfile.so.1
ELF   7cdba000-7cdc3000   Deferred        libogg.so.0
ELF   7cdc3000-7ce0e000   Deferred        libdbus-1.so.3
ELF   7ce0e000-7ce7d000   Deferred        libpulsecommon-4.0.so
ELF   7d1bf000-7d1c8000   Deferred        librt.so.1
ELF   7d1c8000-7d1d2000   Deferred        libwrap.so.0
ELF   7d1d2000-7d1dd000   Deferred        libjson-c.so.2
ELF   7d395000-7d3e4000   Deferred        libpulse.so.0
ELF   7d3ec000-7d405000   Deferred        msacm32<elf>
  \-PE   7d3f0000-7d405000   \               msacm32
ELF   7d40c000-7d435000   Deferred        winepulse<elf>
  \-PE   7d410000-7d435000   \               winepulse
ELF   7d435000-7d459000   Deferred        mmdevapi<elf>
  \-PE   7d440000-7d459000   \               mmdevapi
ELF   7d734000-7d73b000   Deferred        libasyncns.so.0
ELF   7d7a1000-7d8a5000   Deferred        libgl.so.1
ELF   7dbb1000-7dbe8000   Deferred        msctf<elf>
  \-PE   7dbc0000-7dbe8000   \               msctf
ELF   7dbe8000-7dc21000   Deferred        uxtheme<elf>
  \-PE   7dbf0000-7dc21000   \               uxtheme
ELF   7dc21000-7dd2d000   Deferred        comctl32<elf>
  \-PE   7dc30000-7dd2d000   \               comctl32
ELF   7dd2d000-7dd79000   Deferred        dinput<elf>
  \-PE   7dd30000-7dd79000   \               dinput
ELF   7ddd3000-7dde8000   Deferred        xinput1_3<elf>
  \-PE   7dde0000-7dde8000   \               xinput1_3
ELF   7ddf7000-7ddfc000   Deferred        libnvidia-tls.so.352.63
ELF   7ddfc000-7de18000   Deferred        dinput8<elf>
  \-PE   7de00000-7de18000   \               dinput8
ELF   7de18000-7de64000   Deferred        dsound<elf>
  \-PE   7de20000-7de64000   \               dsound
ELF   7de88000-7de8e000   Deferred        libxfixes.so.3
ELF   7de8e000-7de99000   Deferred        libxcursor.so.1
ELF   7de99000-7dea9000   Deferred        libxi.so.6
ELF   7dea9000-7dead000   Deferred        libxcomposite.so.1
ELF   7dead000-7deb8000   Deferred        libxrandr.so.2
ELF   7deb8000-7dec3000   Deferred        libxrender.so.1
ELF   7dec3000-7dec9000   Deferred        libxxf86vm.so.1
ELF   7dec9000-7decd000   Deferred        libxinerama.so.1
ELF   7decd000-7ded4000   Deferred        libxdmcp.so.6
ELF   7ded4000-7ded8000   Deferred        libxau.so.6
ELF   7ded8000-7defa000   Deferred        libxcb.so.1
ELF   7defa000-7e02e000   Deferred        libx11.so.6
ELF   7e02e000-7e041000   Deferred        libxext.so.6
ELF   7e069000-7e0fd000   Deferred        winex11<elf>
  \-PE   7e070000-7e0fd000   \               winex11
ELF   7e178000-7e1a1000   Deferred        libexpat.so.1
ELF   7e1a1000-7e1dc000   Deferred        libfontconfig.so.1
ELF   7e1dc000-7e204000   Deferred        libpng12.so.0
ELF   7e204000-7e21e000   Deferred        libz.so.1
ELF   7e21e000-7e2be000   Deferred        libfreetype.so.6
ELF   7e2e6000-7e311000   Deferred        msacm32<elf>
  \-PE   7e2f0000-7e311000   \               msacm32
ELF   7e311000-7e3cb000   Deferred        winmm<elf>
  \-PE   7e320000-7e3cb000   \               winmm
ELF   7e3cb000-7e446000   Deferred        shlwapi<elf>
  \-PE   7e3e0000-7e446000   \               shlwapi
ELF   7e446000-7e694000   Deferred        shell32<elf>
  \-PE   7e450000-7e694000   \               shell32
ELF   7e694000-7e7da000   Deferred        oleaut32<elf>
  \-PE   7e6b0000-7e7da000   \               oleaut32
ELF   7e7da000-7e85f000   Deferred        rpcrt4<elf>
  \-PE   7e7f0000-7e85f000   \               rpcrt4
ELF   7e85f000-7e9a4000   Deferred        ole32<elf>
  \-PE   7e880000-7e9a4000   \               ole32
ELF   7e9a4000-7e9be000   Deferred        version<elf>
  \-PE   7e9b0000-7e9be000   \               version
ELF   7e9be000-7eb1a000   Deferred        user32<elf>
  \-PE   7e9d0000-7eb1a000   \               user32
ELF   7eb1a000-7eb96000   Deferred        advapi32<elf>
  \-PE   7eb30000-7eb96000   \               advapi32
ELF   7eb96000-7ecb7000   Deferred        gdi32<elf>
  \-PE   7eba0000-7ecb7000   \               gdi32
ELF   7ecb7000-7ed6c000   Deferred        msvcrt<elf>
  \-PE   7ecd0000-7ed6c000   \               msvcrt
ELF   7ed6c000-7ed79000   Deferred        libnss_files.so.2
ELF   7ed79000-7ed92000   Deferred        libnsl.so.1
ELF   7ef92000-7efd8000   Deferred        libm.so.6
ELF   7efdb000-7f000000   Deferred        imm32<elf>
  \-PE   7efe0000-7f000000   \               imm32
ELF   f7422000-f75d0000   Dwarf           libc.so.6
ELF   f75d0000-f75d5000   Deferred        libdl.so.2
ELF   f75d6000-f75f2000   Deferred        libpthread.so.0
ELF   f75f4000-f7600000   Deferred        libnss_nis.so.2
ELF   f7610000-f7619000   Deferred        libnss_compat.so.2
ELF   f761a000-f77d0000   Dwarf           libwine.so.1
ELF   f77d2000-f77f4000   Deferred        ld-linux.so.2
ELF   f77f4000-f77f5000   Deferred        [vdso].so
Threads:
process  tid      prio (all id:s are in hex)
0000000e services.exe
   0000001e    0
   0000001d    0
   00000014    0
   00000010    0
   0000000f    0
00000012 winedevice.exe
   0000001c    0
   00000019    0
   00000018    0
   00000013    0
0000001a plugplay.exe
   00000020    0
   0000001f    0
   0000001b    0
00000021 explorer.exe
   00000028    0
   00000027    0
   00000026    0
   00000025    0
   00000022    0
00000023 (D) Z:\home\jezxlee\Desktop\VM-SHARE\PDHSE-WinLinux-Beta\PDH3-SDL2.exe
   00000033    0
   00000030   15
   0000002f    0
   0000002e    0
   0000002b    0
   00000024    0 <==
00000029 wineconsole.exe
   0000002a    0
System information:
    Wine build: wine-1.7.55
    Platform: i386 (WOW64)
    Host system: Linux
    Host version: 3.16.0-38-generic


Any help would be appreciated, thanks!