RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    DosBox; Mapping mouse to PS3 Analog Stick

    Scheduled Pinned Locked Moved Help and Support
    32 Posts 6 Posters 22.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mayki
      last edited by

      Not problem with capture, problem is analog axis. The left analog stick in the middle : constantly sends the cursor to the upper left corner, analog stick in the right down position : the cursor stops at the zero position.

      1 Reply Last reply Reply Quote 0
      • C
        Concat @dudleydes
        last edited by

        @dudleydes
        Just thought I'd ask what version of joymap you are using...

        D 1 Reply Last reply Reply Quote 0
        • D
          dudleydes @Concat
          last edited by

          @Concat I'm using version 0.3.1.

          1 Reply Last reply Reply Quote 1
          • C
            Concat
            last edited by

            @dudleydes

            Hmmm... well I'm at a loss. I can't get the mouse to map properly in Dosbox either. Cursor just sits in the top left corner like Mayki.

            Do you launch Albion from the command line? I suppose I could try that. Right now I have it set up to load the map in the .emulators.cfg file, much the same way you suggested I do it for PPSSPP. Perhaps there is some confliction with emulationstation(?)

            D 1 Reply Last reply Reply Quote 0
            • D
              dudleydes @Concat
              last edited by

              @Concat The script that I use to launch Albion is in my first post above. As you can see, I launch loadmap with each game to allow for game-specific mappings.

              Maybe you can try my binary. You can download it from here.

              1 Reply Last reply Reply Quote 1
              • dishinsD
                dishins @dudleydes
                last edited by dishins

                @dudleydes

                hi, i'm trying to do this config with sorr (Streets of rage remake) but i'm struggling to make this work, can you help me on this?

                nvm, sorted it out :)

                1 Reply Last reply Reply Quote 0
                • C
                  Concat @Mayki
                  last edited by

                  @Mayki said in DosBox; Mapping mouse to PS3 Analog Stick:

                  Mapping mouse for DosBox. Tested in the game Albion, Abuse and directly in DOSBox, the mouse cursor will automatically move into the upper left corner and not move him.

                  The linuxjoystickmapper dev released a new version which fixed this issue for me. Give it a try.

                  Unfortunately, I still have issue mapping keys to axes. It doesn't release the key press when the axis returns to neutral no matter what I try. Oh well. At least the mouse is working.

                  1 Reply Last reply Reply Quote 0
                  • M
                    Mayki
                    last edited by

                    Yes, I noticed it. We're currently investigating a problem with the PC, then I try it likes. Thank you for the warning.

                    1 Reply Last reply Reply Quote 0
                    • GetKeyOpenDoorG
                      GetKeyOpenDoor
                      last edited by GetKeyOpenDoor

                      I've successfully created all the necessary files etc. (and it somewhat works in dosbox) but how do you figure out which button id comes from which button?
                      I've used Kodi's logging before to get id's etc but the dpad returns a hat value and I can't find anything in the joymap docs about hat values.
                      Also the buttons id's from Kodi's log aren't the same as what joymap recognizes.
                      i.e button id 10 is my startbutton in kodi, but when I map
                      button vendor=0x045e product=0x028e src=10 target=kbd button="enter"
                      it doesn't work

                      D 1 Reply Last reply Reply Quote 0
                      • D
                        dudleydes @GetKeyOpenDoor
                        last edited by

                        @GetKeyOpenDoor You can use jstest. From the command line, run:

                        jstest /dev/input/js0
                        
                        1 Reply Last reply Reply Quote 1
                        • GetKeyOpenDoorG
                          GetKeyOpenDoor
                          last edited by GetKeyOpenDoor

                          That works, thank you.

                          so dpad left is -32767 and dpad right is 32767 on axis 4
                          same for dpad up/down. up = -32767 and down is 32767 on axis 5
                          and the same for the thumbs. but on axes 0-3
                          No idea how to map this in joymap, I don't understand how
                          src=0 target=mouse axis=0 interprets the axes values

                          because how does this work when dpad up and down is both on axis 5
                          axis vendor=0x045e product=0x028e src=5 target=kbd button="up"
                          axis vendor=0x045e product=0x028e src=5 target=kbd button="down"

                          EDIT: read something in the docs about plus and minus but no explanation on how to use it.
                          I've tried axis vendor=0x045e product=0x028e src=5 minus target=kbd button="up"
                          but that doesn't seem to do anything :EDIT

                          Also did you guys already figure out how to use the extra values like deadzone and speed?
                          Do you just paste that on the same line as the button config?

                          1 Reply Last reply Reply Quote 0
                          • GetKeyOpenDoorG
                            GetKeyOpenDoor
                            last edited by

                            Ok, so I just tested this with the game Abuse after getting all the values from jstest

                            button vendor=0x045e product=0x028e src=2 target=mouse button=0
                            button vendor=0x045e product=0x028e src=0 target=mouse button=1
                            Using a 360wired, I've mapped X to mousebutton 0 (left?) and a to button 1 (right?)
                            nothing happens in game when pressed

                            I'm about to give up lol, i've been at it for 2 days already and it's proven to be way to difficult.

                            1 Reply Last reply Reply Quote 0
                            • C
                              Concat
                              last edited by

                              You're asking so many specific questions it's hard to understand what you're even trying to do. lol. You should start there. And post your entire mapping file in something like pastebin for us to look at. If you have one error in the file, it will fail to load any of it.

                              As for plus and minus, look at this mapping:

                              axis vendor=0x054c product=0x0268 src=0 target=kbd plus="k" minus="i"
                              axis vendor=0x054c product=0x0268 src=1 target=kbd plus="l" minus="j"
                              

                              First line is axis, because I'm targeting an axes on my controller.
                              Vendor and product define which controller.
                              src defines what input on my controller I'm targetting. In this case, 0 is the X-axis on the left joystick, and 1 is the Y-axis on the left joystick. I've already told the script it's an axis, so it won't look for button 0 and button 1.
                              On the left joystick, when I push right, the input delivers a positive value, so it's mapped to k. Left is negative, so i.
                              Y axis is reverse on the ps3 controller. Up is negative and down is positive.

                              That's how plus and minus work. It's used to map joystick axes to buttons (either keyboard, or a different controller button). I had a hell of a time making this work until the developer released a new version with a "trinary" flag. I dont really understand what it does, but there is documentation on it. so my mapping becomes:

                              axis vendor=0x054c product=0x0268 src=0 target=kbd plus="k" minus="i" flags="trinary"
                              axis vendor=0x054c product=0x0268 src=1 target=kbd plus="l" minus="j" flags="trinary"
                              

                              I have not mapped a button to a mouse click, but this looks fine (at least the format does):

                              button vendor=0x045e product=0x028e src=2 target=mouse button=0
                              button vendor=0x045e product=0x028e src=0 target=mouse button=1
                              

                              I just don't know what the numbers are for a wired 360 controller. I googled PS3 and found one that works.

                              This is gibberish:

                              axis vendor=0x045e product=0x028e src=5 target=kbd button="up"
                              axis vendor=0x045e product=0x028e src=5 target=kbd button="down"
                              

                              You are trying to map axis 5 to both up and down without specifying + is up/down, and what - is. I find it strange that your dpad is registering as an axis in general. The ps3 dpad acts as buttons.

                              Deadzone is a new feature. I put in 1000 and the file failed to load. 100 loads, but I swear it doesn't do anything. I gave up on that because it wasn't needed in my case. At any rate, you would just put Deadzone=100 at the end of an axis target. I never looked into speed.

                              Overall it is a difficult tool to use. You have to cobble together information from the wiki, the documentation and topics like this. If you think 2 days is bad... look at when I posted first posted this topic. I had to harass the developer because I could not get joystick to keyboard mappings to work without chaos. He listened, found a bug or two, and introduced new features. With the trinary flag , it finally works for me and now I can play shadow warrior with dual joysticks.

                              The developer himself said he made the tool for himself some time ago, so don't expect some polished product with great instructions. Just keep trying and eliminate all sources of error. Try some easy first, like mapping a single button to a keyboard press, then loading dosbox and see if the button returns the key in the command line. If it doesn't, you are doing something fundamentally wrong. Wrong product number, wrong button number, wrong script to load the map file when the game runs, etc.

                              GetKeyOpenDoorG 1 Reply Last reply Reply Quote 1
                              • GetKeyOpenDoorG
                                GetKeyOpenDoor @Concat
                                last edited by

                                @Concat Thank you so much for the proper explanation, I'll try to experiment again in a little bit.

                                As for
                                axis vendor=0x045e product=0x028e src=5 target=kbd button="up"
                                axis vendor=0x045e product=0x028e src=5 target=kbd button="down"
                                That was just an example to explain what was confusing me about my dpad, not actually something I put in my mapping file. Because my dpad up/down is both scr=5 I didn't understand how to map that.

                                1 Reply Last reply Reply Quote 0
                                • GetKeyOpenDoorG
                                  GetKeyOpenDoor
                                  last edited by GetKeyOpenDoor

                                  Ok, so I've been messing around again for a bit. I can confirm joymap loads, and that my vendor and product ID's are correct. This is my runcommand.log

                                  Found device Microsoft X-Box 360 pad (vendor=0x045e, product=0x028e)
                                  Found device JOYMAP Code Device (vendor=0x00ff, product=0x0000)
                                  DOSBox version SVN
                                  

                                  So joymap loads, dosbox loads and the game loads. (I tried again with the game Abuse)
                                  Confirmed button A is 0 via jstest and I've mapped the up keyboard button to A on my controller.

                                  button vendor=0x045e product=0x028e src=0 target=kbd button="up"
                                  

                                  But in game pressing the A button does nothing. Tried mapping other buttons as well, like escape to select and enter to start but got nothing.

                                  button vendor=0x045e product=0x028e src=8 target=kbd button="esc"
                                  button vendor=0x045e product=0x028e src=9 target=kbd button="enter"
                                  

                                  Then I tried tumbstick mapping.

                                  # mouse to right thumb
                                  axis vendor=0x045e product=0x028e src=2 target=mouse axis=0
                                  axis vendor=0x045e product=0x028e src=3 target=mouse axis=1
                                  
                                  # kbd arrows to left thumb
                                  axis vendor=0x045e product=0x028e src=0 target=kbd plus="right" minus="left"
                                  axis vendor=0x045e product=0x028e src=1 target=kbd plus="down" minus="up"
                                  

                                  That somewhat worked, but it's constantly registering something because the character is jumping and moving around unless I keep the thumbstick in a fixed position.
                                  Same for the mouse, it's constantly registering up and I can't really control it.
                                  So I tried with the deadzone value set to 100 but that had no effect.
                                  Then I read the documentation again and found that you can set the binary flag.
                                  From the joymap docs: The binary flag can be used to trigger events only when the axis is moved completely in the other direction.
                                  But this didn't help either, and neither did the trinary flag.

                                  So unless I'm missing something obvious and I'm being an idiot again, I think I give up.

                                  1 Reply Last reply Reply Quote 0
                                  • C
                                    Concat
                                    last edited by Concat

                                    Try this:

                                    axis vendor=0x045e product=0x028e src=0 target=kbd plus="right" minus="left" flags="trinary"
                                    axis vendor=0x045e product=0x028e src=1 target=kbd plus="down" minus="up" flags="trinary"

                                    Then again, your controller might just have crappy joysticks that really need the deadzone sorted out.

                                    For the buttons, just load dosbox without a game. Map something like "T" to your A button, and see if you can type a T with the button. No idea why a button mapping wont work. Thats the easiest thing to do in this tool...

                                    Also, try using this to help: http://joystickmapper.com/layouts/mac-xbox360controller-layout.png

                                    Buttons all seem to line up with whatre youre saying except for the axes. Maybe you have some of them wrong.

                                    GetKeyOpenDoorG 1 Reply Last reply Reply Quote 0
                                    • GetKeyOpenDoorG
                                      GetKeyOpenDoor @Concat
                                      last edited by GetKeyOpenDoor

                                      @Concat I've tried the trinary flag, but didn't have any effect either.

                                      For the buttons, just load dosbox without a game. Map something like "T" to your A button, and see if you can type a T with the button. No idea why a button mapping wont work. Thats the easiest thing to do in this tool...

                                      I'll try that later.
                                      Here's another thing I was thinking about trying out though.

                                      • min – The reported minimum value on the axis. Used for determining
                                      trigger levels.
                                      • max – The reported maximum value on the axis. Used for determining
                                      trigger levels
                                      

                                      Except I'm not 100% sure how to implement it, but I was thinking something likes this...
                                      Assuming my thumbsticks have 'idle' axis values ranging between 0-2000 and either -32767 or 32767 when hold to the max in a direction, then defining a min/max value close to the max value should work? (in theory)

                                      # so for movement to the left
                                      axis vendor=0x045e product=0x028e src=2 target=mouse axis=0 min=-30000 max=-32767
                                      # movement to the right
                                      axis vendor=0x045e product=0x028e src=2 target=mouse axis=0 min=30000 max=32767
                                      # up movement
                                      axis vendor=0x045e product=0x028e src=3 target=mouse axis=1 min=-30000 max=-32767
                                      # down movement
                                      axis vendor=0x045e product=0x028e src=3 target=mouse axis=1 min=30000 max=32767
                                      

                                      EDIT: Well that seemed to have fixed the deadzone issues, but besides that nothing is working like it should.
                                      Currently the mouse cursor is fixed top left and won't move except for when I push the thumbstick all the way to the left, then it moves to the bottom left in a flash and when I release the thumb it moves back to top left.
                                      It seems to me like something is messed up when it comes to button/axes values, and it's not registering the values as presented by jstest
                                      Really weird because DOSBOX's internal mapper works perfectly fine, if only it had the possibility of mapping the mousekeys.

                                      I've also tested running just dosbox with the Y button mapped to the letter y but it's not responding.

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post

                                      Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                      Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.