Blood (build engine) & analog sticks as emulated mouse via joymap

Having problems with a specific game or application? Post your problems here!

Blood (build engine) & analog sticks as emulated mouse via joymap

Postby PicoFemto » 2019-12-03 @ 14:44

Good day,

Background

I'm attempting to play my (purchased) copy of Blood (1997, Monolith) on DosBox (on my Raspberry Pi 3b+, aka RPI3b+, running RetroPie). I am able to launch the game, get audio working, etc. Graphics are limited to 320x240 (VESA modes are slow, not sure if it can be run on a RPI due to limited computing power). My main problem is getting a gamepad working, using "joymap" (i.e. emulate a gamepad to behave as if it were a mouse).

I'm attempting to use my Logitech F310 gamepad (which is very similar to the Playstation style controllers with dual analog thumb sticks). I've used the following tutorials to get to where I currently am:
  • "DosBox - PC", <https://github.com/retropie/retropie-setup/wiki/PC#tutorials>, accessed 2019-12-02.
  • "Mapping a Game Controller in Kodi - PetRockBlock", <https://blog.petrockblock.com/forums/topic/mapping-a-game-controller-in-kodi/#post-106586>, accessed 2019-12-02.
  • "DosBox; Mapping mouse to PS3 Analog Stick", <https://retropie.org.uk/forum/topic/2032/dosbox-mapping-mouse-to-ps3-analog-stick>, accessed 2019-12-02.
  • "F310 Gamepad - Logitech", <https://www.logitechg.com/en-ca/products/gamepads/f310-gamepad.html>, accessed 2019-12-02.
What I've done, is configure Blood to use "Keyboard + Mouse" controls via the "SETUP.EXE" tool that is bundled with it. For example, the WASD keys are mapped to movement/strafing, and the mouse is configured for turning/aiming. I also use the following launcher script to invoke "joymap" and DosBox to launch my game.

/home/pi/RetroPie/roms/pc/blood.sh
Code: Select all
#!/bin/bash
LOADMAP="/home/pi/joy/loadmap"
KEYMAP="/home/pi/RetroPie/roms/pc/blood/blood_keys.map"
DOSBOX="/opt/retropie/emulators/dosbox/bin/dosbox"
PC_ROMS="/home/pi/RetroPie/roms/pc"

sudo "${LOADMAP}" "${KEYMAP}" &
"${DOSBOX}" -c "mount c ${PC_ROMS}" -c "c:" -c "cd BLOOD" -c "SETUP.EXE" -c "exit"
sudo killall loadmap
sleep 1


Additionally, by careful inspection using the jscal and jstest tools via the command-line, I generated the following joymap configuration file.

/home/pi/RetroPie/roms/pc/blood/blood_keys.map
Code: Select all
# General Mouse Mapping for DOSBox for Blood (1997), Monolith.

################################################################################
# Movement.
################################################################################
# Walk forward/backward.
# "w" ==> Logitech F310 "Left-analog-stick up"
# "s" ==> Logitech F310 "Left-analog-stick down"
axis vendor=0x046d product=0xc21d src=1 target=kbd minus="w" plus="s"

# Strafe left/right.
# "a" ==> Logitech F310 "Left-analog-stick left"
# "d" ==> Logitech F310 "Left-analog-stick right"
axis vendor=0x046d product=0xc21d src=0 target=kbd minus="a" plus="d"

# Rotate left/right.
axis vendor=0x046d product=0xc21d src=3 target=mouse axis=1 deadzone=1000

# Look up/down (must use "toggle mouse aim" toggle button at least once!).
axis vendor=0x046d product=0xc21d src=4 target=mouse axis=0 deadzone=1000

# Run.
# "t" ==> Logitech F310 "Left-shoulder"
axis vendor=0x046d product=0xc21d src=2 target=kbd plus="t"

# Jump.
# "k" ==> Logitech F310 "A"
button vendor=0x046d product=0xc21d src=0 target=kbd button="k"

# Crouch.
# "h" ==> Logitech F310 "Left-analog-button"
button vendor=0x046d product=0xc21d src=9 target=kbd button="h"


################################################################################
# Action buttons.
################################################################################
# Use item.
# "p" ==> Logitech F310 "Right-shoulder"
axis vendor=0x046d product=0xc21d src=5 target=kbd plus="p"

# Open door (action).
# "j" ==> Logitech F310 "X"
button vendor=0x046d product=0xc21d src=2 target=kbd button="j"

# Toggle mouse/right-analog-stick aiming (always do this once).
# "l" ==> Logitech F310 "Right-analog-button"
button vendor=0x046d product=0xc21d src=10 target=kbd button="l"

# Previous weapon.
# "u" ==> Logitech F310 "Y"
button vendor=0x046d product=0xc21d src=3 target=kbd button="u"

# Next weapon.
# "i" ==> Logitech F310 "B"
button vendor=0x046d product=0xc21d src=1 target=kbd button="i"

# Previous item.
# "," ==> Logitech F310 "Select"
button vendor=0x046d product=0xc21d src=6 target=kbd button=","

# Next item.
# "." ==> Logitech F310 "Start"
button vendor=0x046d product=0xc21d src=7 target=kbd button="."

# Fire weapon.
# "o" ==> Logitech F310 "Right trigger"
button vendor=0x046d product=0xc21d src=5 target=kbd button="o"

# Alt-fire weapon.
# "y" ==> Logitech F310 "Left trigger"
button vendor=0x046d product=0xc21d src=4 target=kbd button="y"


Problem/Question

  1. If I click the left mouse button, the thumb sticks (left for movement, right for aiming), begin to work, but they are constantly spinning in circles. I tried setting "deadzone" to 100, 1000, etc.; but can't get the thumb sticks to be usable (in a meaningful sense). How do I fine-tune the analog sticks?
  2. None of the "button" entries work. I've configured the game to expect, the "w", "a", "s", "d"; buttons to correspond to movement. However, none of my button inputs work at all. I could, hypothetically, use the DosBox mapper (i.e. via CTRL+F1) to configure these keys, but I'd prefer to use a single tool to remap all the game pad's digital/analog controls rather than adding more levels of complexity to my setup. How do I get my button mappings working?

If I can figure this out, I'll gladly post an in-depth tutorial (with pictures) in the future.

Thank you in advance for your time and assistance.
PicoFemto
Newbie
 
Posts: 2
Joined: 2019-12-03 @ 14:14

Re: Blood (build engine) & analog sticks as emulated mouse via joymap

Postby PicoFemto » 2019-12-03 @ 15:53

So I've made some (lucky) progress this morning. Analog controls are mostly fine with the changes below. Now to figure out why digital button presses aren't being received by the game. Doesn't make sense, as analog stick controls are being converted to WASD keys. It's as if the joystick-button-to-keyboard-button functionality is broken somehow.

Code: Select all
# General Mouse Mapping for DOSBox for Blood (1997), Monolith.

################################################################################
# Movement.
################################################################################
# Walk forward/backward (analog input to digital output).
# "w" ==> Logitech F310 "Left-analog-stick up"
# "s" ==> Logitech F310 "Left-analog-stick down"
axis vendor=0x046d product=0xc21d src=1 target=kbd minus="w" plus="s" min=-32767 max=32767 deadzone=1000            flags="trinary"                                                                         

# Strafe left/right (analog input to digital output).
# "a" ==> Logitech F310 "Left-analog-stick left"
# "d" ==> Logitech F310 "Left-analog-stick right"
axis vendor=0x046d product=0xc21d src=0 target=kbd minus="a" plus="d" min=-32767 max=32767 deadzone=1000            flags="trinary"                                                                         

# Rotate left/right (analog input to analog output).
axis vendor=0x046d product=0xc21d src=3 target=mouse axis=0           min=-32767 max=32767 deadzone=1000 speed=1200                                                                                         

# Look up/down (analog input to analog output).
# Must use "toggle mouse aim" toggle button at least once!
axis vendor=0x046d product=0xc21d src=4 target=mouse axis=1           min=-32767 max=32767 deadzone=1000 speed=800  flags="trinary,invert"                                     
PicoFemto
Newbie
 
Posts: 2
Joined: 2019-12-03 @ 14:14


Return to DOSBox Games/Apps

Who is online

Users browsing this forum: No registered users and 1 guest