Home Page

sdlmame won't respond to joystick if I compile

Posted By: dman777

sdlmame won't respond to joystick if I compile - 05/01/15 04:42 PM

I am still having problems getting sdlmame to respond my xbox 360 controller when I compile sdlmame manually. This is with clone from git and doing a simple 'make'.

I checked the make file, but I did not see any compile choices for the joystick.

This is for mame .159 and .159.

What is weird... I run gentoo and if I emerge sdlmame .148, the joystick works great on sdlmame with no issues. But if I compile .148 manually, then sdlmame is not responsive to the joystick again.

Here is what the ebuild is like for compileing it....

Code:
localhost four # cat /usr/portage/games-emulation/sdlmame/sdlmame-0.148_p1-r1.ebuild
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-emulation/sdlmame/sdlmame-0.148_p1-r1.ebuild,v 1.6 2015/04/08 18:10:41 mgorny Exp $

EAPI=5
PYTHON_COMPAT=( python2_7 )
inherit eutils flag-o-matic python-any-r1 games

MY_PV=${PV/.}
MY_CONF_PN=${PN/sdl}
MY_P=sdlmame${MY_PV}
MY_P=${MY_P%%_p*}
MY_CONF_VER="0.139"

# patches
SRC_URI="$(for PATCH_VER in $(seq 1 ${PV##*_p}) ; do echo "http://dev.gentoo.org/~hasufell/distfiles/${MY_P}u${PATCH_VER}_diff.zip"; done)"

DESCRIPTION="Multiple Arcade Machine Emulator (SDL)"
HOMEPAGE="http://mamedev.org/"
# Upstream doesn't allow fetching with unknown User-Agent such as wget
SRC_URI="$SRC_URI http://dev.gentoo.org/~hasufell/distfiles/${MY_P/sdl}s.zip"
if [[ ${PN} == "sdlmame" ]] ; then
	SRC_URI="$SRC_URI http://www.netswarm.net/misc/sdlmame-ui.bdf.gz"
fi

LICENSE="XMAME"
SLOT="0"
KEYWORDS="amd64 ~ppc x86"
IUSE="X alsa debug opengl"
REQUIRED_USE="debug? ( X )"

RDEPEND="dev-libs/expat
	media-libs/fontconfig
	media-libs/flac
	>=media-libs/libsdl-1.2.10[X,sound,joystick,opengl?,video]
	media-libs/sdl-ttf
	sys-libs/zlib
	virtual/jpeg
	alsa? ( media-libs/alsa-lib )
	X? (
		gnome-base/gconf
		x11-libs/gtk+:2
		x11-libs/libX11
		x11-libs/libXinerama
	)"
DEPEND="${RDEPEND}
	${PYTHON_DEPS}
	app-arch/unzip
	media-libs/alsa-lib
	virtual/pkgconfig
	X? ( x11-proto/xineramaproto )"

S=${WORKDIR}

# Function to disable a makefile option
disable_feature() {
	sed -i \
		-e "/$1.*=/s:^:# :" \
		"${S}"/makefile \
		|| die "sed failed"
}

# Function to enable a makefile option
enable_feature() {
	sed -i \
		-e "/^#.*$1.*=/s:^#::"  \
		"${S}"/${2:-makefile} \
		|| die "sed failed"
}

pkg_setup() {
	games_pkg_setup
	python-any-r1_pkg_setup
}

src_unpack() {
	default
	unpack ./mame.zip
	rm -f mame.zip
}

src_prepare() {
	if [[ $PV == *_p* ]] ; then
		edos2unix $(find $(grep +++ *diff | awk '{ print $2 }' | sort -u) 2>/dev/null) *diff
		einfo "Patching release with source updates"
		epatch ${MY_PV%%_p*}*.diff
	fi
	edos2unix src/osd/sdl/osdsdl.h

	epatch \
		"${FILESDIR}"/${P}-makefile.patch \
		"${FILESDIR}"/${P}-no-opengl.patch

	# Don't compile zlib and expat
	einfo "Disabling embedded libraries: expat, flac, jpeg, zlib"
	disable_feature BUILD_EXPAT
	disable_feature BUILD_FLAC
	disable_feature BUILD_JPEG
	disable_feature BUILD_ZLIB

	if use amd64; then
		einfo "Enabling 64-bit support"
		enable_feature PTR64
	fi

	if use ppc; then
		einfo "Enabling PPC support"
		enable_feature BIGENDIAN
	fi

	if use debug; then
		einfo "Enabling debug support"
		enable_feature DEBUG
	fi

	if ! use opengl ; then
		einfo "Disabling opengl support"
		enable_feature NO_OPENGL src/osd/sdl/sdl.mak
	fi

	if ! use alsa ; then
		einfo "Disabling alsa midi support"
		enable_feature NO_USE_MIDI src/osd/sdl/sdl.mak
	fi

	if ! use X ; then
		einfo "Disabling X support"
		enable_feature NO_X11 src/osd/sdl/sdl.mak
	fi
}

src_compile() {
	emake \
		TARGET="${PN#sdl}" \
		NAME="${PN}" \
		OPT_FLAGS='-DINI_PATH=\"\$$HOME/.'${PN}'\;'"${GAMES_SYSCONFDIR}/${PN}"'\"' \
		NO_DEBUGGER=$(usex debug "0" "1") default
}

src_install() {
        enable_feature DEBUG
    fi

    if ! use opengl ; then
        einfo "Disabling opengl support"
        enable_feature NO_OPENGL src/osd/sdl/sdl.mak
    fi

    if ! use alsa ; then
        einfo "Disabling alsa midi support"
        enable_feature NO_USE_MIDI src/osd/sdl/sdl.mak
    fi

    if ! use X ; then
        einfo "Disabling X support"
        enable_feature NO_X11 src/osd/sdl/sdl.mak
    fi
}

src_compile() {
	newgamesbin ${PN}$(use amd64 && echo 64)$(use debug && echo d) ${PN}

	newman src/osd/sdl/man/${PN#sdl}.6 ${PN}.6

	insinto "${GAMES_DATADIR}/${PN}"
	doins -r src/osd/sdl/keymaps
	[[ ${PN} == "sdlmame" ]] && newins sdlmame-ui.bdf ui.bdf

	insinto "${GAMES_SYSCONFDIR}/${PN}"
	doins "${FILESDIR}"/vector.ini

	sed \
		-e "s:@GAMES_SYSCONFDIR@:${GAMES_SYSCONFDIR}:" \
		-e "s:@GAMES_DATADIR@:${GAMES_DATADIR}:" \
		"${FILESDIR}/${MY_CONF_PN}-${MY_CONF_VER}".ini.in > "${D}/${GAMES_SYSCONFDIR}/${PN}/${MY_CONF_PN}".ini \
		|| die "sed failed"

	dodoc docs/{config,mame,newvideo}.txt
	if [[ ${PN} == "sdlmame" ]] ; then
		dodoc whatsnew*.txt
	else
		dodoc messnew*.txt
	fi

	keepdir \
		"${GAMES_DATADIR}/${PN}"/{ctrlr,cheats,roms,samples,artwork,crosshair} \
		"${GAMES_SYSCONFDIR}/${PN}"/{ctrlr,cheats}

	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst

	elog "optional dependencies:"
	elog "  games-emulation/sdlmametools (development tools)"
	echo
	elog "It's strongly recommended that you change either the system-wide"
	elog "${MY_CONF_PN}.ini at \"${GAMES_SYSCONFDIR}/${PN}\" or use a per-user setup at \$HOME/.${PN}"

	if use opengl; then
		echo
		elog "You built ${PN} with opengl support and should set"
		elog "\"video\" to \"opengl\" in ${MY_CONF_PN}.ini to take advantage of that"
	fi
}



Posted By: R. Belmont

Re: sdlmame won't respond to joystick if I compile - 05/01/15 06:24 PM

Make sure you're running with -joystick. AFAIK the ebuild loads mame.ini from a non-standard location so it will be configured differently by default from a self-build version. I use an Xbox 360 joypad constantly with MAME and MESS on Linux and so I'm positive there are no compatibility issues.
Posted By: dman777

Re: sdlmame won't respond to joystick if I compile - 05/01/15 07:29 PM

ya, I even tried it with mame/sdlmame -joystick and no success. Did you compile yours manually with just 'make'? I am thinking I need to enable something in the compiler but I don't see anything relevent in the make file for config option.
Posted By: R. Belmont

Re: sdlmame won't respond to joystick if I compile - 05/01/15 07:32 PM

Yeah, I just used -joystick. If you run with -verbose does it detect your pad?
Posted By: dman777

Re: sdlmame won't respond to joystick if I compile - 05/02/15 05:24 AM

Just to confirm...you compiled yours with a -joystick? did you add it in the make file?

Posted By: qmc2

Re: sdlmame won't respond to joystick if I compile - 05/02/15 06:06 AM

RB means the -joystick and -verbose command line options for the (already built) MAME/MESS binary... another option to ensure that it's NOT reading any ini file would be to use -noreadconfig together with -joystick and -verbose, so all other settings would definitely be at their default values.
Posted By: etabeta78

Re: sdlmame won't respond to joystick if I compile - 05/02/15 09:01 AM

and to make things even clearer: no compile option is needed to have the emulator compatible with joysticks. they do work by default, and if they don't work at your end, you probably have some runtime option set wrong wink
Posted By: dman777

Re: sdlmame won't respond to joystick if I compile - 05/02/15 11:11 PM

For the first time, I tried/compiled version .161 and made some success... joystick works when I run mame64 as root but not as none-root.

This is with both:
Code:
/usr/games/bin/mame64  -joystick -verbose -noreadconfig -rompath /mnt/samsung/roms/mame/roms



with root:

Code:
Joystick: Start initialization
Input: Adding Joy #0: Xbox Gamepad (userspace driver)
Joystick: Xbox Gamepad (userspace driver)
Joystick:   ...  6 axes, 11 buttons 1 hats 0 balls
Joystick:   ...  Physical id 0 mapped to logical id 1
Joystick: End initialization


with non root:

Code:
Joystick: Start initialization
Joystick: End initialization


Any suggestions since I run my set up from qmc2 in non root user?
Posted By: R. Belmont

Re: sdlmame won't respond to joystick if I compile - 05/03/15 01:35 AM

That's extremely odd, I run as a non-root user and I don't have any problems with the joystick.
Posted By: floo

Re: sdlmame won't respond to joystick if I compile - 05/03/15 09:51 AM

It looks like you are using xboxdrv. It might be some weird device permissions with that driver on gentoo. Try using xpad.
Posted By: dman777

Re: sdlmame won't respond to joystick if I compile - 05/03/15 04:01 PM

Ya, I tried xpad but it doesn't work. Strange...I don't have these xboxdrv issues with sdlmame .148
Posted By: R. Belmont

Re: sdlmame won't respond to joystick if I compile - 05/03/15 04:54 PM

Oh, I see the difference. Fedora comes with a kernel driver for the 360 pad, so it's always available in userland.
Posted By: floo

Re: sdlmame won't respond to joystick if I compile - 05/03/15 11:20 PM

It's obvious the driver/device is working and it's just a permissions issue. Try forcing device permissions with a simple tool such as this https://github.com/vranki/perse or write in the udev rules yourself. But I would recommend xpad, either way.
Posted By: qmc2

Re: sdlmame won't respond to joystick if I compile - 05/04/15 11:17 AM

Isn't this the right solution for your problem?! (In short: you likely just need to add a corresponding udev rule to set device permissions correctly.)
Posted By: dman777

Re: sdlmame won't respond to joystick if I compile - 05/06/15 12:31 AM

Originally Posted By qmc2
Isn't this the right solution for your problem?! (In short: you likely just need to add a corresponding udev rule to set device permissions correctly.)


Thanks...I am using xpad now...still had to set udev...I had to make others have permission:

KERNEL=="event*", GROUP="games", MODE:="666"
KERNEL=="js*", GROUP="games", MODE:="666"
© 2020 Forums