The NEW Build Your Own Arcade Controls

Main => Software Forum => Linux => Topic started by: Major Rock Hardy on December 05, 2005, 03:02:25 pm

Title: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 05, 2005, 03:02:25 pm
My Hardware:
P4 2.4 GHz, 512 MB Ram, SB Live! (emu10k1), ATI Radeon 7000 VE (rv100)

My OS:
gentoo-sources 2.6.14-r2 kernel, emerge'd advancemame, alsa

Other:
for development, I also emerged X and fluxbox as a WM.

The Situation:
I am trying to get the framebuffer version working, which I assume SHOULD work since I have tried with AdvanceCD and I got good video and audio.  Perhaps this is a bad assumption.

after following the gentoo alsa HOWTO, I have a working sound device, which I have confirmed by running advs with an .mp3 and it plays beautifully.

From the cmd line I can run advmame mspacman -- works GREAT.  When I run advmame suprmrio -- it looks great, but as soon as I hit '5' to coin-up, the audio comes through, but is very wavy - like a record when you grab a hold/let go of the record as it's playing to slow it down/speed it back up.  Then when gameplay starts, it's terrible.  It's as if the aforementioned record player effect is applied to the whole game (not just audio).

I have some other issues too, but I'm using this as a ping to see if anyone out there is a guru at gentoo/ advmame... barvaz? whammoed? desmatic? others?

Thanks ahead of time,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: starnix17 on December 05, 2005, 03:22:22 pm
I'm not that much of a Linux guru, but try searching the Gentoo Wiki (http://gentoo-wiki.com/Main_Page). Lot's of good stuff in there!
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 05, 2005, 03:50:48 pm
post your advmame.rc file contents
have you made any changes to the file, especially dealing with audio?
after loading suprmrio, hit F11 to bring up the speed and report the results after coining up and playing
have you tried other games and had similar/different reactions?
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 05, 2005, 04:12:20 pm
thanks, you guys...

post your advmame.rc file contents
have you made any changes to the file, especially dealing with audio?
after loading suprmrio, hit F11 to bring up the speed and report the results after coining up and playing
have you tried other games and had similar/different reactions?

I will post the advmame.rc file and results of the F11 tests tonight when I get home...  I have tried other games and had similar reactions: stunrun.

I'm not that much of a Linux guru, but try searching the Gentoo Wiki (http://gentoo-wiki.com/Main_Page). Lot's of good stuff in there!

yeah, I hoped there might be something there... but searches for 'mame', 'advmame', and 'advancemame' all turned up nil.  :P  There seems to be a bit more (still not much) in the gentoo forums.
Title: Re: current status of gentoo linux / advmame
Post by: elvis on December 06, 2005, 12:19:57 am
Which FBDev device are you using (ie: what did you compile intro your kernel)?  SVGA FBDev won't work very well with Advmame.  Make sure you are using the proper radeon one.

Otherwise, I'll wait until I see your .conf files for more comments.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 06, 2005, 01:36:37 am
OK, did the f11 test for suprmrio - says Auto 100% - 8?% - it flickers around 84% most of
the time.  Occasionally the game will hang and then the f11 display will then blink briefly to what appears to be Auto 1??% - 1??% (both numbers > 100), then back to ~84%.  The coin up and game play didn't seem to move it much from 84%, which is what it shows during attract mode.

Also, I should probably note that I have X running on console 7 and I switch
to console 2 to log in as root when I run in fb mode from the cmd line.  I
would assume that since I've switched consoles, that X shouldn't be
interfering... well, I tried it to be sure - I exited from X and that didn't make a difference.

For comparison purposes, I fired up mspacman again and it was a solid 100%, occasionally blinking a 98% or something (so fast I couldn't see it).  Great authentic flickery video!

OK, here is my .advance/advmame.rc:
------snip---------
device_video fb
device_video_clock 25.2 - 202.5 / 30 - 96 / 48 - 120
device_video_interlace no
device_video_output fullscreen
dir_artwork /home/sloaner/.advance/artwork:/usr/share/games/advance/artwork
dir_diff /home/sloaner/.advance/diff
dir_hi /home/sloaner/.advance/hi
dir_image /home/sloaner/.advance/image:/usr/share/games/advance/image
dir_inp /home/sloaner/.advance/inp
dir_memcard /home/sloaner/.advance/memcard
dir_nvram /home/sloaner/.advance/nvram
dir_rom /home/sloaner/.advance/rom:/usr/share/games/advance/rom:/ntfs/roms
dir_sample /home/sloaner/.advance/sample:/usr/share/games/advance/sample:/ntfs/samples
dir_snap /home/sloaner/.advance/snap:/ntfs/snap
dir_sta /home/sloaner/.advance/sta
display_resizeeffect none
------snip---------

you'll notice ranges given for device_video_clock - these were for a Dell Ultrascan P990 Multisync monitor.  I guessed at the range of pclock values but the others came from here:
http://support.dell.com/support/edocs/monitors/p990/specs.htm


Thanks again,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 06, 2005, 01:37:59 am
Also, I forgot to mention, I used the -log option when running these tests.  I uploaded them to a buddy's
webserver... here they are, but mind the file sizes:

http://www.ninjaboot.com/suprmrio_log.txt (25 MB)
and
http://www.ninjaboot.com/mspacman_log.txt (1.9 MB)

thanks again,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 06, 2005, 01:45:44 am
Which FBDev device are you using (ie: what did you compile intro your kernel)? SVGA FBDev won't work very well with Advmame. Make sure you are using the proper radeon one.

I did a grep FB /usr/src/linux/.config and here were the results:

# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_FB=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_SOFT_CURSOR=y
# CONFIG_FB_MACMODES is not set
CONFIG_FB_MODE_HELPERS=y
# CONFIG_FB_TILEBLITTING is not set
# CONFIG_FB_CIRRUS is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ARC is not set
# CONFIG_FB_ASILIANT is not set
# CONFIG_FB_IMSTT is not set
# CONFIG_FB_VGA16 is not set
# CONFIG_FB_VESA is not set
# CONFIG_FB_HGA is not set
# CONFIG_FB_NVIDIA is not set
# CONFIG_FB_RIVA is not set
# CONFIG_FB_I810 is not set
# CONFIG_FB_INTEL is not set
# CONFIG_FB_MATROX is not set
# CONFIG_FB_RADEON_OLD is not set
CONFIG_FB_RADEON=y
CONFIG_FB_RADEON_I2C=y
CONFIG_FB_RADEON_DEBUG=y
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_ATY is not set
# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_KYRO is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VOODOO1 is not set
# CONFIG_FB_CYBLA is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_GEODE is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_VIRTUAL is not set

... so it looks like the CONFIG_FB_RADEON is correct - I'll try the RADEON_OLD in a minute

thanks always,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 06, 2005, 10:08:34 am
OK, tried the old radeon driver, that didn't work even for mspacman... I got:

No video modes available for the current game.
Unable to start video emulation

 :-\

EDIT:  OOPS!  I had tweaked some device_video_clock  numbers to cause this failure - not a scientific test, but I retried with the correct numbers and the changing to the old radeon driver still didn't fix the suprmrio problem
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 06, 2005, 10:32:16 am
oh yeah,

try changing advmame.rc with this setting:
device_sound none

this will turn off the sound and narrow down the problem to either your audio or video config.  I'm sure either one can cause your choppy play.  Play a troublesome game with hitting f11 to see if you can get smooth play.  A 2.4 ghz processor should be plenty to run all but the few oddball games at full speed.
Title: Re: current status of gentoo linux / advmame
Post by: elvis on December 06, 2005, 06:33:12 pm
What mode is video being chosen by the system when you play the slow games?  (Use the TAB menu to find out).  Also check to make sure you're not applying a resize or filter, as these slow things down a lot.

Always try to use generate or 1.0X modes, and not scale modes.  The scaling is done by software for FBDev and SVGALib, and makes things very slow.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 07, 2005, 02:40:13 am
oh yeah,

try changing advmame.rc with this setting:
device_sound none

this will turn off the sound and narrow down the problem to either your audio or video config. I'm sure either one can cause your choppy play. Play a troublesome game with hitting f11 to see if you can get smooth play. A 2.4 ghz processor should be plenty to run all but the few oddball games at full speed.

OK, did this w/ suprmrio and now we're at ~99%, but it still freezes (although much more briefly), then sort of 'bursts' (over 100%) to 'keep up' I guess.  So I guess it's still a video problem.



What mode is video being chosen by the system when you play the slow games? (Use the TAB menu to find out). Also check to make sure you're not applying a resize or filter, as these slow things down a lot.

Always try to use generate or 1.0X modes, and not scale modes. The scaling is done by software for FBDev and SVGALib, and makes things very slow.


for mspacman, it chooses 720x576x16 28.2/31.5/50.0  ... now when I have the menu up, I can switch the resize mode to mixed, and the rgb mode on scan2horiz and apply a resize effect of 'filter' (or 'scale') and mspacman still runs at 100% when I'm playing it... so I suppose that confirms there's plenty of horsepower behind the emulation...  ???

now, for some reason, I can't start suprmrio again (black/blank screen).  AARRRRGGGGHHHHH!  >:(

rebooting...

Rock

Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 07, 2005, 03:16:43 am
HAHAHA  SUCCESS !  ;D  (well sort of).

I now have acheived 100% emulation speed in suprmrio by going into the menu and turning off vsync.  That alone did it, regardless of scaling/resizing.  However, it seems now I can't run suprmrio without a reboot.

one step forwards and 1/2 step back I guess.

I am beginning to believe that I have a bit too much faith  :angel: in this piece of junk Radeon 7000 VE.  Has anyone gotten framebuffer mode to work w/ advmame under linux... if so, what card?

Thanks always,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 07, 2005, 10:06:16 am
I have used framebuffer with a radeon 7000 before.  I believe brand can make a difference though.  I don't remember what mine is.  This was at cga resolution, so i wasn't using any kind of scaling and was running at the original refresh rates so sync issues wouldn't have been a problem.  Anyway, I ended up switching to svgalib because you can use lower pclocks.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 07, 2005, 01:18:13 pm
This was at cga resolution, so i wasn't using any kind of scaling and was running at the original refresh rates so sync issues wouldn't have been a problem.

Thanks whammoed, perhaps you could expand on this... if I am using a Multiscan monitor is "running at the original refresh rates" impossible?  The advmame documentation sort of leads me to believe that anything is possible with a multiscan monitor.

Another issue that has been always present is the fact that whenever I exit advmame, it doesn't return to the console prompt - at least not visibly.  The screen has a few lines of colored dots - ctrl+L doesn't help, reset command doesn't help.  I have to Ctrl+Alt+F7 to my X session and then switch back in order for it to be useable again.  Would running advmame in conjunction w/ advmenu help solve this problem?
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 07, 2005, 03:15:39 pm
Well, you won't be able to run at the original resolution exactly but I would think you should be able to at least find something to use at the original Vertical refresh.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 07, 2005, 04:19:27 pm
Mr. whammoed, thank you again...

I will try the display_adjust clock line.

I would love to run advv - but as far as I can tell when I emerged advancemame on gentoo, it did not build the advv or advcfg binaries.  Is there a trick for this, like manually editing a build script or something on the emerge commandline?  Sorry for the gentoo noob question.

Thanks,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 07, 2005, 04:29:13 pm
This was fixed in newest advmame release 102.  Installing it should work now for the utilities.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 07, 2005, 05:33:39 pm
cool, I will re-emerge tonight and report results... do you happen to know if it applies the fb patches when it builds?  Or wait, I would have to rebuild my kernel with the fb patches that come with advmame, correct?  Do you know if the emerge build patches the kernel source?

thanks again,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: elvis on December 07, 2005, 08:34:26 pm
cool, I will re-emerge tonight and report results... do you happen to know if it applies the fb patches when it builds?  Or wait, I would have to rebuild my kernel with the fb patches that come with advmame, correct?  Do you know if the emerge build patches the kernel source?

thanks again,
Rock

Gentoo does not apply the fb nor svgalib patches when compiling from portage.

However the patches supplied by the advmame authors are generally only for low-res (15KHz) modes anyway.  If you're using a 31KHz VGA monitor, you don't generally need these patches.

If you are using an arcade monitor and want to use low res modes, I suggest downloading the advmame source and compiling it yourself manually (including the fb patches against the kernel), rather than letting gentoo portage deal with it.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 14, 2005, 07:39:10 pm
elvis, whammoed-

are you using fb in your latest projects?  or did you get tired of fighting it and switch to svgalib?  I'm beginning to think I'm going to do that since other emulators I want to run will support svgalib but I don't know of any that support fb...

Thanks,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 14, 2005, 08:46:15 pm
The only reason I switched to svgalib was to get lower pclocks.
Title: Re: current status of gentoo linux / advmame
Post by: elvis on December 14, 2005, 09:04:41 pm
I use SVGALib.  It was the first method I tried, and it worked, so I've used it ever since on all of my projects and never bothered to test FBDev out of sheer laziness. :)

From what I can see, SVGALib supports more chipsets too.  Not that it matters for most ATi/Nvidia owning people.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 15, 2005, 03:53:05 pm
K, thanks you two...

so I'm going about the SVGA path and I've run into a wierd message..

I downloaded svgalib-1.9.19 and advancemame-0.102.0... now, following desmatic's patch instructions on easymamecab, here are the results:

me@persephone /usr/src/svgalib-1.9.19 $ sudo patch -p1 < ../advancemame-0.102.0/contrib/mame/svgalib/svgalib-1.9.19-force.diff
patching file src/timing.c
patching file src/timing.h
me@persephone /usr/src/svgalib-1.9.19 $ sudo patch -p1 < ../advancemame-0.102.0/contrib/mame/svgalib/svgalib-1.9.19-radeon.diff
patching file src/drivers/r128.c
patch unexpectedly ends in middle of line
Hunk #4 succeeded at 862 with fuzz 1.

...
any thoughts about my fuzzy hunk?  :o

thanks,
Rock


Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 15, 2005, 04:03:51 pm
I got errors when the radeon files were patching too.  I ignored them without issue and I am using a radeon.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 15, 2005, 05:01:22 pm
K, I ignored them and went on... and I got this when I tried to insmod:

persephone svgalib-1.9.19 # insmod /lib/modules/2.6.14-gentoo-r2/kernel/misc/svgalib_helper.ko
insmod: error inserting '/lib/modules/2.6.14-gentoo-r2/kernel/misc/svgalib_helper.ko': -1 Unknown symbol in module


any thoughts?  should I be doing this a different way for Gentoo?

Thanks again,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 15, 2005, 05:37:41 pm
desmatic suggests:

If the svgalib_helper module won't load
1. you compiled svgalib with a different compiler than the one used to compile your kernel
2. you are trying to load the wrong version of the module. 2.6.x modules end in .ko and 2.4.x modules in .o Both modules can be found in the kernel/svgalib_helper directory. The SVGAlib make install by default places these modules in /lib/modules/`uname -r`/kernel/misc directory.

as far as I can tell, NEITHER apply to me... FYI:

me@persephone /usr/src/svgalib-1.9.19 $ gcc --version; cat /proc/version
gcc (GCC) 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Linux version 2.6.14-gentoo-r2 (root@persephone) (gcc version 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)) #10 PREEMPT Sat Dec 3 20:16:04 MST 2005

...
and see above for proof that I tried to load the .ko instead of the .o

 :-\

Rock
Title: Re: current status of gentoo linux / advmame
Post by: elvis on December 15, 2005, 08:57:17 pm
Oooh that rings a bell.  I got an "unknown symbol" error a while back from memory.

Check:

a) If you *need* the patches for your kernel (I believe one of the patches does not need issuing after 2.6.8 because something was fixed in the kernel)

b) That your kernel revision is supported (you might need to downgrade your kernel).

Check the readme's that go with the patches, and read them all start to finish whether they seem obvious or not.

Bugger... there was something else I had to do to get rid of that "unknown symbol" error but I can't remember what!  Time to google...

[edit] a voice in my head is telling me it was something to do with a udev/devfs problem... still googling...

[edit2] run:

dmesg | grep -i 'svga'

And see what get's spat out.  If you get an error about it not being able to make a symlink in devfs or something similar, read the following thread and see if it helps:
http://forums.gentoo.org/viewtopic-t-331838-highlight-svgalibhelper.html
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 16, 2005, 01:19:46 pm
Man I'm getting into the nitty-gritty...

I ran your
dmesg | grep -i svga
and got:
svgalib_helper: Unknown symbol pci_find_class
svgalib_helper: Unknown symbol io_remap_page_range

so due to this thread on the gentoo forums (http://forums.gentoo.org/viewtopic.php?t=216985) it looks as if the kernel? function "pci_find_class" was at some point (and perhaps only in gentoo kernels?) changed to "pci_get_class".

so from the svgalib-1.9.19 directory, I ran
grep -r pci_find_class *
 and it was only in one source file:
kernel/svgalib_helper/main.c:                                   pci_find_class(PCI_CLASS_DISPLAY_VGA<<8,dev)) &&

so I just went into this file (kernel/svgalib_helper/main.c) and changed "pci_find_class" to "pci_get_class".

Then from the svgalib-1.9.19 directory, I ran
make clean
make install
make demoprogs
cp -f kernel/svgalib_helper/svgalib_helper.ko /lib/modules/2.6.14-gentoo-r2/kernel/misc/svgalib_helper.ko
insmod /lib/modules/2.6.14-gentoo-r2/kernel/misc/svgalib_helper.ko


still got:
insmod: error inserting '/lib/modules/2.6.14-gentoo-r2/kernel/misc/svgalib_helper.ko': -1 Unknown symbol in module

however, upon running
dmesg | grep -i svga

now it just says:
svgalib_helper: Unknown symbol io_remap_page_range

so I got one of them, still working on the other... stay tuned.

Thanks again elvis,
Rock


Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 16, 2005, 04:46:30 pm
Oh boy...

to get the other message (svgalib_helper: Unknown symbol io_remap_page_range) to go away it was a bit more involved... I finally found a french google groups posting (http://groups.google.fr/group/svgalib/browse_thread/thread/baea20cf230bbbf8/2d3796c629b5890c?hl=fr)

So I went to the svgalib-1.9.19 directory and added a few lines (MAKE A BACKUP COPY FIRST) to kernel/svgalib_helper/kernel26compat.h (relative path) to make this:

Code: [Select]
#else /* Kernel 2.6 */

#define NO_TASK

# ifndef KERNEL_2_6
#  define KERNEL_2_6
# endif

# define my_io_remap_page_range(vma, start, ofs, len, prot) \
                io_remap_page_range(vma,start,ofs,len,prot)

look like this:

Code: [Select]
#else /* Kernel 2.6 */

#define NO_TASK

# ifndef KERNEL_2_6
#  define KERNEL_2_6
# endif

// majorrockhardy - added this vvvvvv
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
# define io_remap_page_range(vma, vaddr, paddr, size, prot)            \
                remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot)
#endif
// majorrockhardy - added this ^^^^^^

# define my_io_remap_page_range(vma, start, ofs, len, prot) \
                io_remap_page_range(vma,start,ofs,len,prot)


Then from the svgalib-1.9.19 directory, I ran
make clean
make install
make demoprogs
cp -f kernel/svgalib_helper/svgalib_helper.ko /lib/modules/2.6.14-gentoo-r2/kernel/misc/svgalib_helper.ko

so here's the insmod result:

me@persephone /usr/src/svgalib-1.9.19 $ insmod /lib/modules/2.6.14-gentoo-r2/kernel/misc/svgalib_helper.ko
me@persephone /usr/src/svgalib-1.9.19 $ dmesg -c | grep -i svga
svgalib_helper: Initializing, version 1.9.19
svgalib_helper: device1: vendor:1002 id:5159

no more errors!

success (maybe)... stay tuned...


Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 16, 2005, 06:50:10 pm
HA HA HA HA!!!  ;D

it worked!

I have advmenu working and advmame loads suprmrio and mspacman and joust and etc...

I have a question though - stunrun is one of my favorite games.  In win2k it plays at pretty much full speed.  However in advmame it doesn't - unless I turn the sound off.  Any ideas?  In other games, sound works just fine.  Surely this isn't a processing overhead issue w/ Linux not being able to do what win2k can do, right?

Anyone using Linux advmame not get stunrun to work w/ sound at full speed?  Or, if it does work for you, what processor do you have?

Thanks,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 16, 2005, 07:37:50 pm
Hmmm, in my experiences Linux has outperformed XP/2000 for game speeds.  I will test that one out when I get a chance.
Title: Re: current status of gentoo linux / advmame
Post by: elvis on December 16, 2005, 07:56:36 pm
so due to this thread on the gentoo forums (http://forums.gentoo.org/viewtopic.php?t=216985) it looks as if the kernel? function "pci_find_class" was at some point (and perhaps only in gentoo kernels?) changed to "pci_get_class".

Ah, that was it!  I had to do the same on my Slackware install to get it working.  Now I remember! :)

But anyways... you're up and running which is good.

I have a question though - stunrun is one of my favorite games.  In win2k it plays at pretty much full speed.  However in advmame it doesn't - unless I turn the sound off.  Any ideas?  In other games, sound works just fine.  Surely this isn't a processing overhead issue w/ Linux not being able to do what win2k can do, right?

Anyone using Linux advmame not get stunrun to work w/ sound at full speed?  Or, if it does work for you, what processor do you have?

AdvMAME sometimes chooses silly display settings for some games (particularly non-CGA games which I have a funny feeling stunrun is).

Make sure that:

1) Video modes are 15, 16 or 32 bit BGR modes only.  Avoid all the other crazy 8bit and YUV mode.  You can hack your advmame.cfg file to limit available modes (I run all my games in 16bit which is fine).

2) AdvMAME is choosing a nice generate or 1X mode.  Don't use software scaling for 2X or greater modes, as this slows things down ALOT.  Scaling might sometimes be "auto", "mixed" or "integer".  Turn these off!

3) There are no scale2x or lq or hq filters being applied, and that.  Same as (2).

4) Turn VSync off, and double-buffer on.

With all those set, you should see full speed games.  Like Whammoed said, I get better performance out of Linux+SVGALib than I do Windows+DirectX (especially on "borderline" hardware), which I assume is thanks to much lower overall overhead and less unecessary desktop-OS fluff.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 16, 2005, 08:48:00 pm
OK, thanks elvis...

I changed Resize to no, Color to bgr16, Resize Effect to no, Rgb Effect to no, Vsync to no, SMP to no...

[edit] the above seemed to help a bit, but it's still draggin' a**

where do I find out about double_buffer?

Thanks,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on December 20, 2005, 12:39:44 pm
sorry, elvis,

I meant where do I find out about double-buffer?

whammoed (or anyone) how does stunrun work under linux/SVGAlib?

Thanks,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 20, 2005, 12:41:09 pm
Sorry, still haven't tried.  Its on my to do list.
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on December 20, 2005, 06:59:53 pm
OK, just ran stunrunner. it runs fine with room to spare. this is on a P4 2.8 Ghz
Title: Re: current status of gentoo linux / advmame
Post by: elvis on December 20, 2005, 08:18:49 pm
OK, thanks elvis...

I changed Resize to no, Color to bgr16, Resize Effect to no, Rgb Effect to no, Vsync to no, SMP to no...

[edit] the above seemed to help a bit, but it's still draggin' a**

where do I find out about double_buffer?

Thanks,
Rock

Try these on for size (some you already have):

Reference reading:
http://advancemame.sourceforge.net/doc-advmame.html#8.3

display_scanlines no
display_vsync no
display_buffer no # (try switching to "yes" and seeing what the effect is on your system)
display_resize none
display_magnify 1
display_skiplines auto
display_skipcolumns auto
display_frameskip auto # (try "0" also)
display_resizeeffect none
display_rgbeffect none
display_interlaceeffect none

device_color_palette8 no
device_color_bgr8 no
device_color_bgr15 no
device_color_bgr16 yes
device_color_bgr24 no
device_color_bgr32 no
device_color_yuy2 no

display_color bgr16
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on January 06, 2006, 03:56:45 pm
S.T.U.N. Runner - Working  :o

you're not going to believe why...  I tried elvis's settings - that made things better but stunrun was still sluggish.

I just happened to plug in a USB Mouse and keyboard today instead of the normal PS2 mouse and keyboard.  Stunrunner was glorious!  It took a bit to realize the USB might be what caused the operational behavior.  I swapped the USB keyboard for a PS/2 keyboard and rebooted - still worked.  Swapped the USB mouse for a PS/2 mouse - broken.  Swapped the PS/2 keyboard for the USB keyboard and left the PS/2 mouse plugged in - still broken.  Swapped the PS/2 mouse for a USB mouse and we're running at full speed again!

So I deduced that the PS/2 mouse driver must be hogging CPU cycles to a degree that dragged emulation down.  That seems pretty crazy to me.  Any ideas why?

thanks for all the help guys,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on January 06, 2006, 04:06:25 pm
did you have both an analog control and mouse active for that game in advmame.rc?  If so try setting device_mouse none
and see if you can keep the mouse plugged in.  Don't know why the ps2 vs usb mouse would make a difference though...
Title: Re: current status of gentoo linux / advmame
Post by: elvis on January 07, 2006, 03:11:26 am
That is pretty crazy.  When the suspect mouse is plugged in, run the "top" program to see your load averages.

All I can suspect is that there's an issue with polling the PS/2 mouse port.  God knows why though.

Out of curiosity, what kernel are you running?  There were known problems with 2.6.10 that had a bad kernel paging issue that ate up all available RAM.  It killed my cocktail cab, and I dropped back to 2.6.9 to fix it.  2.6.13 is all good and fixed, however.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on January 07, 2006, 09:43:13 pm
My OS:
gentoo-sources 2.6.14-r2 kernel, emerge'd advancemame, alsa

not to be pompous - I couldn't remember myself...

anyway, I am really stumped by the PS/2 mouse issue - but I'm not attached to it in the least.  The mouse is only going to be used for development, and I have a USB optipac for my trackballs.  I have switched to a USB mouse for development now, and as far as I'm concerned, the PS/2 driver (or whatever the hell was the problem) can just fahk right off.

I am now in the throes of getting joysticks to work.  I would like to get event to work, but so far only raw has worked.  Any good resources you know of?  And even when I use raw, I can't calibrate it under advmame.  I go to the TAB menu and when I highlight 'calibrate joystick' and hit enter, the menu just kinda blinks and then comes back.  I don't know what it is supposed to do.  I have tried this with both my USB Groovy Game Gear GPWiz49 and my Ultimarc A-PAC.   Any ideas?

Thanks,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on January 09, 2006, 05:04:38 pm
ah ha,

I believe I have found part of the event issues... from http://gentoo-wiki.com/HOWTO_Joystick_Setup , I realized I didn't have event stuff set up in my kernel config.  Apparently you need:

Code: [Select]
Device Drivers -->
 Input Device Support -->
  <*> Joystick Interface
  <*> Event Interface
   [*] Joysticks
 USB Support -->
  <*> Support for Host-side USB
   [*] USB device filesystem
  <*> EHCI HCD (USB 2.0) support
  <*> OHCI HCD support
  <*> UHCI HCD (most Intel and VIA) support
  <*> USB Human Interface Device (full HID) support
   [*] HID input layer support

I'll post again to let you know if this helped.

Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on January 10, 2006, 07:09:54 pm
success!  well, at least partially... the changes to the kernel caused the joysticks, keyboard, and mouse to show up as /dev/input/event#!

I had a couple hiccups w/ permissions, for which, I did the following:

chown -R root:games /dev/input/

since my mame user is a member of the group 'games'.  Still not perfect, needed:

chmod 660 /dev/input/event*

I understand from a buddy that this will only change the ownership/permissions temporarily and to do it the right way, permanently, I need to modify some 'udev' stuff.  I'll look into that soon.

Geez, after all this, building the cab is going to be the easy part!

Additionally, this still did not solve my calibration issues... going through the TAB menu to 'Calibrate Joystick' just blinked the menu again.  Is joystick calibration working for anyone under advmame?  If so, please let me know what game and what are your settings for that game (post your .rc file).  Whammoed, you use event joysticks right?  Or are you using a keyboard encoder?

Thanks,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on January 10, 2006, 07:27:46 pm
I use a keyboard encoder.  Don't have any analog sticks anyway, so I still couldn't help there.  I only use the event interface for mice.
Has something changed since 2.6.5 as far as setting permissions?  I seem to remember only using chmod for access to the dev/input and it stuck after reboot...  :-\
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on January 10, 2006, 07:41:33 pm
I use a keyboard encoder.  Don't have any analog sticks anyway, so I still couldn't help there.

damn.  I was really hoping.  I will forge ahead then as I really want my SW yoke to work for stunrunner.  Any chance you are thinking about going to 49 ways?  That will be my next uncharted territory.

Has something changed since 2.6.5 as far as setting permissions?

I believe the answer is yes, and the reason is udev.

this was one of the links from the Gentoo udev page:
http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html

where the author wrote:
"As of kernel-2.6.13 using devfs is no longer an option."

So I suppose it's possible you are using devfs (deprecated now) and not udev.

Rock
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on January 11, 2006, 10:02:22 am
chance you are thinking about going to 49 ways?
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on January 11, 2006, 11:21:41 am
FYI, I chose them so I could use the GGG boards and digitally restrict the joysticks to 2 way vert or horiz, 4 way, 4 way diagonal, 8 way, etc.  I am planning a cocktail and that way the same stick will work for joust, defender, qbert, mspacman, etc.  Jeez this is starting to sound like a sales pitch.  Like I said it is uncharted territory so we'll see how bad the headaches are.   8)
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on January 11, 2006, 11:55:28 am
got it working last night so the permissions came up correctly after reboot!

I went into /etc/udev/rules.d/50-udev.rules and changed this line:

KERNEL=="event*", NAME="input/%k", MODE="0600"

to read like this (red is new stuff):

KERNEL=="event*", NAME="input/%k", MODE="0660", GROUP="games"

save the file, reboot, and you're done.  Assuming of course that your mame user is a member of group games.
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on January 11, 2006, 12:00:48 pm
got it working last night so the permissions came up correctly after reboot!

I went into /etc/udev/rules.d/50-udev.rules and changed this line:

KERNEL=="event*", NAME="input/%k", MODE="0600"

to read like this (red is new stuff):

KERNEL=="event*", NAME="input/%k", MODE="0660", GROUP="games"

save the file, reboot, and you're done.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on January 11, 2006, 12:26:03 pm
Are you able to change the 49 way mode with software in linux or are you just doing it manually with the button combos?

well, before striking out on this whole linux adventure, I secured an agreement w/ Randy that I will develop a version of the GPWiz49.exe windows program (the one that changes the board mode) - for linux.  He's going to provide me with the codes that I need to send down the USB cable to the boards to change their mode automagically.  I did a bit of searching and I found this:
http://lwn.net/Kernel/LDD3/
... which should help a great deal.  There's a whole chapter on USB.  I'm a big fan of O'Reilly books.

Looking at some of the advmame docs, it appears that the joystick mode of the original game is available from within advmame, so I'd basically write a script with a case statement in it.  I'm sure that is an oversimplification, but that's what I have in mind currently.
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on January 11, 2006, 12:29:43 pm
Nice.  Reminds me we need a way to control the ledwiz in linux too.  Wonder if anyone is working on that?
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on January 11, 2006, 12:38:11 pm
I'm not sure... shouldn't be too hard.  For my cab, I am thinking of hooking up something like this:

http://www.noritake-elec.com/7000.htm

so it would show the joystick mode (if applicable - if not, spinner, TB, whatever), what buttons are used and their functions, etc.  I know, I'm nuts, but I think it would be slick.
Title: Re: current status of gentoo linux / advmame
Post by: MotorHedJr on January 23, 2006, 01:42:07 pm
Hi Major Rock and Elvis,

Major Rock -- Thanks for the permissions link.

Fellas:

The last thing I wanted to do with my AdvMAME Linux PC before I swapped it w/ my AdvMAME DOS PC was to create a bootsplash theme w/ a nice progress bar --That (and USB compatibility) were the two main  reasons I wanted to switch to Linux.

Do you guys have (or intend to have) a bootsplash on your cabinets?

So after some research:

http://gentoo-wiki.com/HOWTO_fbsplash

It explains recompiling your kernel to add framebuffer support:

Device Drivers > Graphics support:
 
 <*>   VESA VGA graphics support
         VESA driver type (vesafb-tng)  --->
 (HRESxVRES@FREQ) VESA default mode   
                                       # pick resolution@freq of your own here !
                                       # 8pp is the only one supported for this time
                                       # Ex: (1024x768@72)

that's what should be in the kernel...

my kernel shows:

Device Drivers > Graphics support:
 
 <*>   VESA VGA graphics support
         VESA driver type (vesafb-tng)  --->
                                        (  )vesafb
                                        (X)vesafb-tng

What's up w/ the 'X' option? -- No matter I do I cannot put a 'M' or '*' in either option...  Have you seen this before?  I'm using an MSI HM4M-V mobo w/ a Matrox g400 video card...  Anyway I re-complied the kernel (trying both options w/ the 'X') and it broke everything AdvMAME, SVGAhelper, startx... etc.

Man, what a bummer... I can rebuild everything (I took careful notes) but before I try anything w/ a boot splash again I wanted to check and see if this was even possible:

Can you run SVGAlib w/ FB support?
Could my kernel (2.6.12-r6) be broken for FB?
Why does X hate FB?

Thanks for any help -- you guys have been great...

MH Jr.
Title: Re: current status of gentoo linux / advmame
Post by: elvis on January 23, 2006, 07:56:00 pm
1)  The "X" means it's compiled direct into the kernel, and always loaded into memory.  An "M" means it is a module, and needs to be loaded via startup scripts or manually after boot.  I prefer having items loaded into the kernel direct.  Modules are a waste of time, especially on a custom-built system.

2) You shouldn't use the VESA Framebuffer.  It won't work with AdvanceMAME.  You need to use the FrameBuffer driver specific to your video card (there should be ATI and Nvidia framebuffer drivers in the kernel).
Title: Re: current status of gentoo linux / advmame
Post by: MotorHedJr on January 25, 2006, 07:45:36 pm
Hi fellas,

Good news!  I've gotten FB to work and it seems perfect (sound is flawless!)  Ran games w/ F11 test... See attached...

This is what I did:

1) upgraded to kernel 2.6.15.1

2) recompiled w/ matroxFB options  (I've got a G400)

3) changed device-video option to fb (AdvMAME.rc and AdvMENU.rc)

Sorry for all the newbie type hysteria but I'm psyched!!!  ;D

Now mind you the shots are w/ my crappy test bench VGA monitor -- but I'll set video modes later when I switch the PC to my cab...  My test bench setup has been broken the past week, but now it works again (however -- mouse, X, and therefore joystick calibration -- not working)...  But at least now I have motivation to pursue the FBsplash -- progress bar research.

Thanks for your help guys -- I'll send you any info on my setup if you wish...

Regards,

MH Jr.



Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on February 03, 2006, 02:24:14 am
greetings from the bowels of kernel code.  No, I'm not talking about corn s**ts...   ;D

thought I'd let you know I was able to fix my issues with the analog ranges with the GPwiz49 boards under linux.  I had to modify some kernel code but all in all a slick and not too scary fix.  I will try something similar for the A-PAC.  Stay tuned.

Rock
Title: Re: current status of gentoo linux / advmame
Post by: screaming on February 03, 2006, 11:16:59 am
MRH: Keep up the great work! 
Title: Re: current status of gentoo linux / advmame
Post by: MotorHedJr on February 04, 2006, 08:57:56 am
Major Rock,

Quote
this PM thread really should be in our Software forum thread, since we're solving problems that others may encounter too.  I wonder if you'd feel like copying the pertinent parts into our "current status of gentoo linux / advancemame" thread?  And of course post fbsplash updates there too!

Sure, no problem (although rather lengthy -- buts lots of good info)

Quote
Congratulations!

so far you are the only one I know of who has successfully gotten analog controls working under advancemame w/ SVGAlib in linux.  Trust me I've been looking.  And you did it with a new kernel, so that might disprove my theory that my problems were with the kernel drivers.  I would like to know,

1) do a uname -r and let me know what it says...
2) can you PM me your advmame.rc file?

once again, thank you and congratulations - there is hope!

Rock


Quote
Meant to put this in the post but I was too longwinded about my own troubles!!!

I've got this device (AKI) to work in my Gentoo 2.12.6-r6 build:

http://www.dave.bit2000.com/

So far I've only tried it w/ Outrun and Chase HQ but it works great.  It should definitely work w/ a SW yoke.  I think I saw somewhere a 49-way interface as well.

Regards,

MH

Quote
It is interesting to me that you are using a different kernel release than I am.  I am very suspicious that my kernel joystick code is the problem.  I know for a fact I'm going to have to write a custom driver for my gpwiz49 boards, but I expected my A-PAC to work right out of the box w/ the kernel drivers and it didn't.  Oh well, I have done C programming in the past - what's a little more?    Perhaps I should have gone with the AKI instead of A-PAC.  Don't know why I didn't.  The AKI has 5 axes and the A-PAC only 4.

have you tried the jscal program mentioned here:
http://gentoo-wiki.com/HOWTO_Joystick_Setup
?  If so, do you get similar results as advj for the position values?


Rock


Quote
Right now I am calibrating the wheel/petals via the Control Center-> Peripherals->Joystick utility in KDE.

Quote
interesting.  But you use svgalib advancemame, launched from the console - not in X, correct?  If so, does calibrating under KDE stick when you leave X and return to the console?  There seems to be a scarcity of info on calibrating joysticks under linux.

Quote
BTW -- I'm thinking of changing my kernel version as well to something newer as there appears to issues w/ the Matrox Framebuffer support -- what Gentoo kernel version are you using?

Quote
are you planning to use framebuffer?  I thought (once again) that you were using svgalib, which does not use framebuffer.  I would be interested to see how far you get with your videocard using framebuffer however.  That's how I started, but I ended up going to svgalib - the whole thing was documented in:
http://forum.arcadecontrols.com/index.php?topic=46747.0

I'm using a gentoo-sources 2.6.14-r2 kernel - however if you do upgrade, don't blow away your old kernels.  Save them in /boot so you can always fall back on them.  Saving your .config files is a good idea too.

keep me posted.
Rock


Quote
Yes, it sticks...  So far that's the only way I can make it work, and I have to do that everytime after a re-boot...

Quote
cool!  I hope I don't have to use KDE to get this analog control working.  I am going through the kernel code.


Quote
No, I have gotten SVGAlib to work perfectly, after studying your post...  However, like I mentioned, I would really like to get a nice bootsplash screen w/ a progress bar working as the final touch to my cab...  It seems that in order to use fbsplash, you need to compile FB in your kernel (which killed everything in my setup).  Someone has done this w/ a Matrox card however...  (but they used FB for advMAME -- I'd rather not do that if possible):

http://symlink.dk/nostalgia/arcade/software/bootsplash/

Quote
cool link - that would be something I'd like to do as well... however I'm pretty far away from "final touches"!

Quote
Can SVGAlib exist in conjunction w/ matroxfb?  That's the issue I'm researching now...  It (matroxfb) destroys xstart (& KDE).  Removing it and re-compiling seems to bring everything back (except SVGAlib -- which means AdvMAME is broken), but like I mentioned I think that particular anomaly is a kernel issue.  I'll see what I can find out...

Any opinions?

Quote
hmmm... that seems weird.  When you say it destroys things - does that mean that when you emerge it, the emerge process deletes the other programs?  Did you mean to say startx instead of xstart?  If so, that's really weird.  When I was playing around w/ framebuffer stuff for my P.O.S. Radeon 7000 VE card, I could go into X from one console, switch to another virtual console (CTRL+ALT+F2 for instance), log in, and run advmame using fb from that console.  And having X running was my only saving grace when Super Mario Bros. would give me the black screen of death!

Rock

Quote
MotorHedJr-

I don't remember even trying any mouse things when I was screwing around w/ fb.  This is because fb worked so poorly for me that I spent the entire time just trying to get the video working.  I don't think I ever tried mouse games.

It sounds like you were using the raw driver for your analog joystick?  I thought you were using event joysticks... 

It is still unclear to me how the advmame software uses raw as opposed to event.  I am bogged down studying the USB HID joystick driver which is not much fun.  All this pain just to play some games 

As for your mouse - I'm not sure what is going wrong.  I definitely had problems with advmame when a ps/2 mouse was plugged in but a usb mouse was fine.  I assume you have gone into the kernel config and turned on USB mouse support (may be the same as the HID driver) in the kernel under device drivers->input devices?  Based on my experience trying event drivers for everything - you should see a /dev/input/eventN (N being the number of the device recognized) for everything - that is, keyboard, mice (yes plural), joysticks.  If you aren't, I would focus my attention there.  Event mice work flawlessly for me.  I have effectively 3 mice hooked up and I can play marble madness and my two trackballs work great for the 2 different marbles while the regular USB scroll mouse doesnt contribute to either.  I did have to do some input mapping to get this to work, but I think you are familiar w/ this.  One thing that may help point you in the right direction is to do this (as root)

unplug your USB mouse(s)
# tail -f /var/log/messages
now, plug in a USB mouse.  You should see it recognized and some kind of kernel output.  Look for error messages.  Hit CTRL+C to exit this program.

thanks for the fbsplash links.  I really hope I will be able to accomplish a splash screen but still use SVGAlib.

Rock

Quote
I could never get the event driver to work.  I'll have to check my kernel, but I believe in the last compile, I complied it as a module and maybe that made the difference...

Quote
It's not supposed to make a difference, but I remember having ALSA (sound) as a module worked, whereas hard-compiled into the kernel did not.  You should try some scientific experiments where you change one variable at a time and then you'll know!


Quote
BTW, what do you use as a USB X/y axis encoder for your spinner/trackballs?  Previously, I used the Hagstom Electronics ME4:

http://www.hagstromelectronics.com/products/trackball.html  Great product -- but for PS/2...


Quote
Hmm... when you said x/y I immediately thought analog joystick encoder - the answer in that case would be an Ultimarc A-PAC (still not working correctly under linux).  However, when you said trackballs - that's optical.  I don't want to get bogged down in details here but an optical control reports relative movement - i.e. you moved 2 tics to the left, then 3 tics up, from your last position.  Whereas an analog control gives an absolute measurement any time its driver reports - i.e. you are right now exactly at coordinates -14796 (horizontal), 21369 (vertical).  That's why when you run out of mousepad while moving your mouse, you can pick it up, put it at the other side and keep it going in the same direction - you can't do that with an analog stick, which is why calibration is so necessary (and frustrating in my case!).  Anyway, to answer your question, for my trackballs (no spinner(s) yet), I use an Ultimarc Opti-PAC.
Quote
Also, I notice a remarkable difference in using the USB mouse vs. the ps/2... using the advm utility it seems that my PC polls for the USB mouse about 10x more/second than the PS/2...  Fascinating...

Quote
I know for a fact (due to my slowdown issue) that the USB driver is very different than the ps/2 in Linux.  However I believe the difference is that the USB driver is actually interrupt driven, meaning the processor can go off and handle more important things most of the time, like emulation, and the mouse driver will only notify it when things are going on - but the PS/2 driver is a polling driver, meaning every so many compute cycles (arguably too often in my case), the processor polls to find out if the mouse has moved - whether it has or not.  Just a guess on my part though.

BTW-- Be sure to go into your udev rules and change permissions for the event driver.  I had to do this -- otherwise the RAW driver will take precedence over it...


-MH Jr.


Title: Re: current status of gentoo linux / advmame
Post by: MotorHedJr on February 04, 2006, 11:07:40 am
Hello Rock, and all,

Apparently the joystick calibration utility in AdvMAMEis not available outside of DOS.  So I'm trying to use the jscalibration utility as described in:

http://gentoo-wiki.com/HOWTO_Joystick_Setup

When I attempt to launch the utility, I get the following error:

Gtk-WARNING **: cannot open display:

So I try:
#startx

and I get the following error:

Fatal server error:
Cannot run in framebuffer mode.  Please specify busIDs for all framebuffer devices

I'm using the matrox framebuffer complied in kernel (2.12.6.3).  This incompatiblity is an X issue -- so I'm looking at xorg threads in various places.

Anyone using fb have this startx issue?

Thanks.

-MH Jr.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on February 04, 2006, 12:20:18 pm

BTW-- Be sure to go into your udev rules and change permissions for the event driver.  I had to do this -- otherwise the RAW driver will take precedence over it...


... strange... I was pretty sure that the raw vs. event mode inputs were an advancemame concept and it basically meant:

EVENT MODE: advmame takes its input from anything it can find by opening /dev/input/event0 through /dev/input/event31

RAW MODE: advmame takes its input from anything it can find by opening /dev/input/js0 through /dev/input/js3 , /dev/input/mouse0 through /dev/input/mouse3 , etc.

... the fact that you had to change permissions in order for one to take precedence over the other probably means you have (in your advmame.rc):
device_joystick raw event
-or-
device_joystick auto

If you desire to use event and not raw, then just make it read:
device_joystick event
...
thanks for posting our PM thread - hopefully it will help someone.
...
as for your calibration utility - what are your joystick symptoms that make you feel like you need to calibrate?

also, I'm afraid the gentoo joystick wiki is a bit geared towards installing joysticks that run off the gameport of a sound card... I would reccommend reading your kernel documentation on inputs here:

/usr/src/linux-2.6.14-gentoo-r2/Documentation/input/input.txt (read this one first)
and maybe
/usr/src/linux-2.6.14-gentoo-r2/Documentation/input/joystick.txt

MRH: Keep up the great work! 

Hey thanks man, I hope all my hard work at least will help someone other than myself - although sometimes I kind of feel like I'm either crazy or masochistic or both.

just for my information, is there anyone out there following this thread that is interested in a gpwiz49 driver for linux?

Rock
Title: Re: current status of gentoo linux / advmame
Post by: whammoed on February 04, 2006, 01:01:58 pm

just for my information, is there anyone out there following this thread that is interested in a gpwiz49 driver for linux?

Rock


I have no current plans for the gpwiz49 but I'd love to have that option there.

Also, are there any issues with using a non-analog usb gamepad type device in linux...like the regular gpwiz?  I was thinking of using one on my next project.

thanks!
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on February 04, 2006, 02:24:09 pm
I have no regular gpwiz to try but I would guess there shouldn't be a problem at all.

I have plugged in this cheapy gamepad that I mentioned in this thread:
http://forum.arcadecontrols.com/index.php?topic=49364.0

and advj recognized it as a joystick.  All 10 buttons work, including SELECT and START, however the gamepad axes were mapped to Z and something else, instead of X and Y.  Wierd.  You should be able to take care of this with input mapping though.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on February 04, 2006, 11:59:20 pm
Hey all -

I realized today that I didn't have any sound coming when I ran advmame.  You know you've been screwing around with joystick code too long when you don't realize your sound is broken!  I checked my .rc file and nothing is out of place.  After some websearching about "alsa no sound" etc., I came to the realization that I haven't had sound for a while - and I did some playing around with a newer kernel.  Anyway, I had ended up staying with kernel gentoo-sources-2.6.14-r2 (my original).  Well, I couldn't remember having sound working since then.  Hmmm...

I remember at some point a few days after trying 2.6.15, I re-linked /usr/src/linux to point to the older 2.6.14 directory.  Thought that might have something to do with it, so I checked and it was still pointing to my older 2.6.14 directory. 

I mucked around with alsamixer for a while, nothing there fixed anything.  I even did a make menuconfig, removed everything alsa, then a make && make modules_install.  Then went back in to make menuconfig, re-added alsa stuff, then a make && make modules_install.  Still didn't fix anything.  Then finally went in as root and ran alsaconf.  Upon exiting, sound worked!  Alsaconf does several things (not to mention rebuilding the kernel twice), one of which is modules-update.

I'm not sure which of these things did the trick, but if you have problems try one of the above!

Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on February 05, 2006, 02:58:45 am
WOO HOO!  :o

I got my analog controls working!  It took a similar, but slightly more involved hack of the usb input driver but my A-PAC is working like a charm now!  And I would say it almost feels better playing stunrun than in win2k.

Now on to write the program to switch the modes of the gpwiz49 boards... which apparently only one person (other than myself) is partially interested in...

Word to yo' moms...

Rock
Title: Re: current status of gentoo linux / advmame
Post by: MotorHedJr on February 05, 2006, 12:11:22 pm
Hi Rock, and all,

Great news, about the A-PAC!

What did you have to do to make it work? (Or what wasn't working)?

Can you calibrate it, and if so how?

I need to calibrate my AKI (analog HID joystick interface) -- I have it connected to a steering wheel and pedals.  The pedals are wired for a dual axis configuration.  When I play a game like Outrun, the wheel works great but there is not enough of a 'range of motion' for AdvMAME to see the pedals.

So far nothing w/ 'emerge joystick' (no ebuilds), jscalibrator (display issue), and jstest, jscal, commands (get bashed). 

Also, to the best of my knowledge:  Joystick calibration is NOT supported in AdvMAME outside of the DOS platforms.

Again, congratulations!!!

Regards,

-MH Jr.
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on February 09, 2006, 12:28:09 am
Hi all, been busy the past few days...

Great news, about the A-PAC! What did you have to do to make it work? (Or what wasn't working)?
see below for the code diffs

Quote
Can you calibrate it, and if so how?

well, I can run the jscal command and that seems to work... I have followed the directions here:
file:///usr/src/linux/Documentation/input/joystick.txt
... however the jstest program keeps seg-faulting.  Not sure why.  So I have no way of knowing if the jscal is doing anything for me.  When I start starwars for instance, the cursor is always a little left of center.  What's strange is that I have gone into the service menu on the game and when it gets to the pot tester, it shows everything right in the center when the control is in the center - weird.

Quote
I need to calibrate my AKI (analog HID joystick interface) -- I have it connected to a steering wheel and pedals.  The pedals are wired for a dual axis configuration.  When I play a game like Outrun, the wheel works great but there is not enough of a 'range of motion' for AdvMAME to see the pedals.

So far nothing w/ 'emerge joystick' (no ebuilds), jscalibrator (display issue), and jstest, jscal, commands (get bashed). 

Also, to the best of my knowledge:  Joystick calibration is NOT supported in AdvMAME outside of the DOS platforms.

I'm not sure about this one... I read the advmame mailing list archives and I would tend to agree with you about the DOS-only cal menu.  I will continue to investigate this, but for now - if you need a solution you might try manually setting the ranges in the input driver using a hack version of the method I describe below.  This will only work if you don't swap what you have connected to your AKI board.  For instance you could hack axis 0 for instance because your pedal is connected to that.  If you swap stuff, you might be out of luck for now...

The Nitty Gritty:
I will post the files I changed, with the filenames in green and my changes in red.  All these files are in: /usr/src/linux/drivers/usb/input

hid.h:

/*
 * HID device quirks.
 */

#define HID_QUIRK_INVERT         0x001
#define HID_QUIRK_NOTOUCH        0x002
#define HID_QUIRK_IGNORE         0x004
#define HID_QUIRK_NOGET          0x008
#define HID_QUIRK_HIDDEV         0x010
#define HID_QUIRK_BADPAD         0x020
#define HID_QUIRK_MULTI_INPUT       0x040
#define HID_QUIRK_2WHEEL_MOUSE_HACK_7     0x080
#define HID_QUIRK_2WHEEL_MOUSE_HACK_5     0x100
#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON    0x200
#define HID_QUIRK_2WHEEL_POWERMOUSE    0x400
#define HID_QUIRK_ANALOG_RANGE_HACK    0x800


hid-input.c:
   if (usage->type == EV_ABS) {

      int a = field->logical_minimum;
      int b = field->logical_maximum;

      if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) {
         a = field->logical_minimum = 0;
         b = field->logical_maximum = 255;
#ifdef DEBUG
         printk("(set logical min/max to %d / %d)", field->logical_minimum, field->logical_maximum);
#endif
      }

      if ((device->quirks & HID_QUIRK_ANALOG_RANGE_HACK) && (usage->code == ABS_X || usage->code == ABS_Y)) {
         a = field->logical_minimum = -32768;
         b = field->logical_maximum = 32767;
#ifdef DEBUG
         printk("(HID_QUIRK_ANALOG_RANGE_HACK: set logical min/max to %d/%d)", field->logical_minimum, field->logical_maximum);
#endif
      }

      if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK)
         input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4);
      else  input_set_abs_params(input, usage->code, a, b, 0, 0);

   }


hid-core.c:

#define USB_VENDOR_ID_LD      0x0f11
#define USB_DEVICE_ID_CASSY      0x1000
#define USB_DEVICE_ID_POCKETCASSY   0x1010
#define USB_DEVICE_ID_MOBILECASSY   0x1020
#define USB_DEVICE_ID_JWM     0x1080
#define USB_DEVICE_ID_DMMP    0x1081
#define USB_DEVICE_ID_UMIP    0x1090
#define USB_DEVICE_ID_VIDEOCOM      0x1200
#define USB_DEVICE_ID_COM3LAB    0x2000
#define USB_DEVICE_ID_TELEPORT      0x2010
#define USB_DEVICE_ID_NETWORKANALYSER  0x2020
#define USB_DEVICE_ID_POWERCONTROL  0x2030

#define USB_VENDOR_ID_APPLE      0x05ac
#define USB_DEVICE_ID_APPLE_POWERMOUSE 0x0304

#define USB_VENDOR_ID_GGG     0xfafa
#define USB_DEVICE_ID_GGG_GPWIZ49   0x0007

#define USB_VENDOR_ID_ULTIMARC   0xd209
#define USB_DEVICE_ID_APAC 0x0306               // actually the G-PAC, but should be the same as the A-PAC
/*
 * Alphabetically sorted blacklist by quirk type.
 */

static struct hid_blacklist {

... skip a few lines ...


   { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD },
   { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD },
   { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD },
   { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD },
   { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
   { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
   { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
   { USB_VENDOR_ID_NEC, USB_DEVICE_ID_NEC_USB_GAME_PAD, HID_QUIRK_BADPAD },
   { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD },
   { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },

   { USB_VENDOR_ID_GGG, USB_DEVICE_ID_GGG_GPWIZ49, HID_QUIRK_BADPAD },
   { USB_VENDOR_ID_GGG, USB_DEVICE_ID_GGG_GPWIZ49 + 1, HID_QUIRK_BADPAD },
   { USB_VENDOR_ID_GGG, USB_DEVICE_ID_GGG_GPWIZ49 + 2, HID_QUIRK_BADPAD },
   { USB_VENDOR_ID_GGG, USB_DEVICE_ID_GGG_GPWIZ49 + 3, HID_QUIRK_BADPAD },

   { USB_VENDOR_ID_ULTIMARC, USB_DEVICE_ID_APAC, HID_QUIRK_ANALOG_RANGE_HACK},

   { 0, 0 }
};



... make sense?  That was the most elegant way to do it, IMO.


Anyway, MHJ, you might follow a similar strategy by editing the hid.h file and make a new quirk, like HID_QUIRK_MHJ_PEDAL_LIMIT_HACK, giving it a new set bit (0x1000) then add #defines for your AKI's vendor and device IDs, then modifying the hid_blacklist to assign said hack to said vendor/device IDs.  Then modify the hid-input.c file, adding a new case for your hack, applying only to PEDAL_AXIS:

if ((device->quirks & HID_QUIRK_ANALOG_RANGE_HACK) && (usage->code == ABS_PEDAL_AXIS)) {
         a = field->logical_minimum = APPROPRIATE_LOW_VALUE;
         b = field->logical_maximum = APPROPRIATE_HIGH_VALUE;
#ifdef DEBUG
         printk("(HID_QUIRK_ANALOG_RANGE_HACK: set logical min/max to %d/%d)", field->logical_minimum, field->logical_maximum);
#endif
      }


I can't remember how the AKI works, but I bet it appears to the OS as one X/Y joystick and one X/Y/Z joystick.  If that's the case, put the pedals on axis Z and replace PEDAL_AXIS above w/ Z, so this doesn't booger up the range for the other stick on the AKI.  Use the evtest program to find your appropriate range values.  Do not use advj for the range values because they are already scaled.  You need the device-level ones.

I hope this gets you started at least.  My favorite beer is Hoegaarden.   :angel:

Rock

p.s. If I don't go completely insane, I plan to develop a proper kernel patch for this.
Title: Re: current status of gentoo linux / advmame
Post by: beernut on March 28, 2006, 12:45:21 pm
Quote
just for my information, is there anyone out there following this thread that is interested in a gpwiz49 driver for linux?

Rock


Yes, I am very interested.

Mark Alston
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on March 29, 2006, 11:25:01 am
wow, signed up just to tell me that, eh?

cool.  Well, it is coming along.  I have been hacking the kernel code and I have made some progress.  I will succeed, it's just a matter of time before I break through a few more issues.  I am hoping that tonight I'll have a nice chunk of time to dive into it.

these new smileys are cool  :cheers:

Rock
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on April 04, 2006, 12:55:44 pm
A little update for my Linux brethren - I have made some great progress towards a linux driver for the GPWIZ49 driver...

 I have created a new event type (similar to EV_LED events that advmame uses to change the LEDs on the keyboard) called EV_GPW.  This all seems to be working and I can write these events to the device using a user-space program and see a debug message appear with the correct data in the dmesg buffer.

I now am at the final step - creating the correctly formatted URB (USB request block) to send it to the device.

I will prevail.

:cheers:

Cheers,
Rock
Title: Re: current status of gentoo linux / advmame
Post by: MotorHedJr on August 01, 2006, 08:10:24 pm
Hi All,

Major Rock: Way back in the day on this post you were having an issue w/ your PS/2 mouse
Title: Re: current status of gentoo linux / advmame
Post by: nodog on September 26, 2006, 07:48:57 pm
Major Rock Hardy,

Yes!  I'm also interested in getting drivers to work for the A-PAC.  Has there been any progress on that front?

Title: Re: current status of gentoo linux / advmame
Post by: nodog on September 29, 2006, 08:21:39 pm
Okay.  I didn't understand what you'd done before completely.  Thanks so much for your kernel patches, 'cause they worked for me, too.  I have kernel 2.6.16, so some other quirks had been added, and I had to choose a different bit, but that wasn't a big deal.

Thanks again.  My A-PAC works with Linux (debian) now!
Title: Re: current status of gentoo linux / advmame
Post by: Major Rock Hardy on May 01, 2007, 11:48:28 pm
Nodog, glad that could help you out.  Sorry I've been out of touch.  I hope to get back into the the game (pun intended) in the coming months... need to download all the newest releases and try my patches again.

MRH
Title: Re: current status of gentoo linux / advmame
Post by: MotorHedJr on June 30, 2007, 04:51:27 pm
Hey Fellas,

I'm working on another AdvMAME/MENU gentoo build for a friend.  It's almost finished (much work, but I got it...  PM me if you want the details...)  Anyway, now that AdvMAME is working well -- I want to install AdvMENU.

However it appears that all the sourceforge.net mirrors for the newest advancemenu (2.4.14.tar.gz) are broken.  Other downloads seem to work, except this one.  Is there another mirror somewhere somebody knows about?

Thanks, and Happy 4th!!!

MotorHed Jr.
Title: Re: current status of gentoo linux / advmame
Post by: MotorHedJr on July 08, 2007, 06:12:50 pm
Hey, after a bit more research I solved this.  Just use the patch found here:

http://aur.archlinux.org/packages.php?do_Details=1&ID=3314&O=0&L=0&C=0&K=&SB=l&SO=d&PP=25&do_MyPackages=&do_Orphans=&SeB=

for AdvMENU v2.4.13, and install normally.  It works great now.  One caveat: I had to disable the sound in the menu, otherwise it would freeze and not launch games...