Author Topic: Control filtering  (Read 6491 times)

TerrapinM

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Control filtering
« on: April 08, 2017, 07:44:25 PM »
I have AttractMode running on two different machines. 

I imported the XML, catver.ini and controls.ini.

Code: [Select]
info_source          listxml
import_extras        $HOME/.mame/mame106.xml;$HOME/.mame/catver.ini;$HOME/.mame/controls.ini

Here is the filter I am using:

Code: [Select]
display Advance Mame
layout               Aracde Game Centre
romlist              Advmame
in_cycle             yes
in_menu              yes
global_filter       
rule                 CloneOf not_equals .*
rule                 Title not_contains bootleg|prototype|Trivia|Quiz|Mahjong|PlayChoice
rule                 Status equals good|imperfect
rule                 Category not_contains Mature|Quiz|Mahjong|Casino|Tabletop|Portable Systems|System|Electromechanical|Development Systems|Home Systems|Synth|Multiplay|Utilities|Instruments|Dance
rule                 Year not_contains ?
rule                 Manufacturer not_contains bootleg
rule                 FileIsAvailable equals 1
rule                 Control not_contains trackball|spinner|gun
rule                 Extra not_contains chd
filter               All
filter               Favourites
rule                 Favourite equals 1

One machine is running Ubuntu and the latest version of Mame.  It correctly filters out the controls.  For example, Millipede is not listed since it uses a trackball.

The new machine I'm setting up is using Retropie and the latest version of AttractMode (2.2.1).  The same filter does not exclude the controls I have listed.  Millipede is listed.  The other rules all seem to be working.

Is there any reason why this would work under Ubuntu and not work under Raspian?

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Control filtering
« Reply #1 on: April 10, 2017, 01:29:46 AM »
Controls.ini currently has an issue in Attract-mode. You can see this post http://forum.attractmode.org/index.php?topic=647.msg4679#msg4679

You shouldn't need this for what you want. Your mame.xml should have the information. I see yours is named mame106.xml. Back in 106 they used the term "game" and now MAME (and Attract-Mode) uses the term "machine" in the XML file. Post the first 50 lines of the mame106.xml file so we can see it.

Also, $HOME/.mame/ doesn't exist by default in RetroPie. Have you added this folder and placed the files there?
« Last Edit: April 10, 2017, 01:37:04 AM by progets »

TerrapinM

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Control filtering
« Reply #2 on: April 10, 2017, 07:17:09 PM »
I know I am using a non-standard directory for the MAME files.  I used it in some other builds so I just stuck with it.  Everything else is working, so I do not think that is the issue.

Here is a sample of the XML file  It is definitely using "game" and not "machine".  I created the file by downloading MAME 106 on a Windows machine and producing the file.  I was having issues with it creating on the RetroPie.  This kind of explains why my other machine which uses the latest version of MAME filters the controls correctly.  Would it work to use a newer version of mame.xml?  I thought the versions would need to match.  Also, the other parts of the filtering are all working.

Thanks.

Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE mame [
<!ELEMENT mame (game+)>
<!ATTLIST mame build CDATA #IMPLIED>
<!ELEMENT game (description, year?, manufacturer, history?, biosset*, rom*, disk*, sample*, chip*, video?, sound?, input?, dipswitch*, driver?)>
<!ATTLIST game name CDATA #REQUIRED>
<!ATTLIST game sourcefile CDATA #IMPLIED>
<!ATTLIST game runnable (yes|no) "yes">
<!ATTLIST game cloneof CDATA #IMPLIED>
<!ATTLIST game romof CDATA #IMPLIED>
<!ATTLIST game sampleof CDATA #IMPLIED>
<!ELEMENT description (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT manufacturer (#PCDATA)>
<!ELEMENT history (#PCDATA)>
<!ELEMENT biosset EMPTY>
<!ATTLIST biosset name CDATA #REQUIRED>
<!ATTLIST biosset description CDATA #REQUIRED>
<!ATTLIST biosset default (yes|no) "no">
<!ELEMENT rom EMPTY>
<!ATTLIST rom name CDATA #REQUIRED>
<!ATTLIST rom bios CDATA #IMPLIED>
<!ATTLIST rom size CDATA #REQUIRED>
<!ATTLIST rom crc CDATA #IMPLIED>
<!ATTLIST rom md5 CDATA #IMPLIED>
<!ATTLIST rom sha1 CDATA #IMPLIED>
<!ATTLIST rom merge CDATA #IMPLIED>
<!ATTLIST rom region CDATA #IMPLIED>
<!ATTLIST rom offset CDATA #IMPLIED>
<!ATTLIST rom status (baddump|nodump|good) "good">
<!ATTLIST rom dispose (yes|no) "no">
<!ELEMENT disk EMPTY>
<!ATTLIST disk name CDATA #REQUIRED>
<!ATTLIST disk md5 CDATA #IMPLIED>
<!ATTLIST disk sha1 CDATA #IMPLIED>
<!ATTLIST disk merge CDATA #IMPLIED>
<!ATTLIST disk region CDATA #IMPLIED>
<!ATTLIST disk index CDATA #IMPLIED>
<!ATTLIST disk status (baddump|nodump|good) "good">
<!ELEMENT sample EMPTY>
<!ATTLIST sample name CDATA #REQUIRED>
<!ELEMENT chip EMPTY>
<!ATTLIST chip name CDATA #REQUIRED>
<!ATTLIST chip type (cpu|audio) #REQUIRED>
<!ATTLIST chip clock CDATA #IMPLIED>
<!ELEMENT video EMPTY>
<!ATTLIST video screen (raster|vector) #REQUIRED>
<!ATTLIST video orientation (vertical|horizontal) #REQUIRED>
<!ATTLIST video width CDATA #IMPLIED>
<!ATTLIST video height CDATA #IMPLIED>
<!ATTLIST video aspectx CDATA #IMPLIED>
<!ATTLIST video aspecty CDATA #IMPLIED>
<!ATTLIST video refresh CDATA #REQUIRED>
<!ELEMENT sound EMPTY>
<!ATTLIST sound channels CDATA #REQUIRED>
<!ELEMENT input EMPTY>
<!ATTLIST input service (yes|no) "no">
<!ATTLIST input tilt (yes|no) "no">
<!ATTLIST input players CDATA #REQUIRED>
<!ATTLIST input control CDATA #IMPLIED>
<!ATTLIST input buttons CDATA #IMPLIED>
<!ATTLIST input coins CDATA #IMPLIED>
<!ELEMENT dipswitch (dipvalue*)>
<!ATTLIST dipswitch name CDATA #REQUIRED>
<!ELEMENT dipvalue EMPTY>
<!ATTLIST dipvalue name CDATA #REQUIRED>
<!ATTLIST dipvalue default (yes|no) "no">
<!ELEMENT driver EMPTY>
<!ATTLIST driver status (good|imperfect|preliminary) #REQUIRED>
<!ATTLIST driver emulation (good|imperfect|preliminary) #REQUIRED>
<!ATTLIST driver color (good|imperfect|preliminary) #REQUIRED>
<!ATTLIST driver sound (good|imperfect|preliminary) #REQUIRED>
<!ATTLIST driver graphic (good|imperfect|preliminary) #REQUIRED>
<!ATTLIST driver cocktail (good|imperfect|preliminary) #IMPLIED>
<!ATTLIST driver protection (good|imperfect|preliminary) #IMPLIED>
<!ATTLIST driver savestate (supported|unsupported) #REQUIRED>
<!ATTLIST driver palettesize CDATA #REQUIRED>
]>

<mame build="0.106 (May 13 2006)">
<game name="puckman" sourcefile="pacman.c">
<description>PuckMan (Japan set 1, Probably Bootleg)</description>
<year>1980</year>
<manufacturer>Namco</manufacturer>
<rom name="namcopac.6e" size="4096" crc="fee263b3" sha1="87117ba5082cd7a615b4ec7c02dd819003fbd669" region="cpu1" offset="0"/>
<rom name="namcopac.6f" size="4096" crc="39d1fc83" sha1="326dbbf94c6fa2e96613dedb53702f8832b47d59" region="cpu1" offset="1000"/>
<rom name="namcopac.6h" size="4096" crc="02083b03" sha1="7e1945f6eb51f2e51806d0439f975f7a2889b9b8" region="cpu1" offset="2000"/>
<rom name="namcopac.6j" size="4096" crc="7a36fe55" sha1="01b4c38108d9dc4e48da4f8d685248e1e6821377" region="cpu1" offset="3000"/>
<rom name="pacman.5e" size="4096" crc="0c944964" sha1="06ef227747a440831c9a3a613b76693d52a2f0a9" region="gfx1" dispose="yes" offset="0"/>
<rom name="pacman.5f" size="4096" crc="958fedf9" sha1="4a937ac02216ea8c96477d4a15522070507fb599" region="gfx1" dispose="yes" offset="1000"/>
<rom name="82s123.7f" size="32" crc="2fc650bd" sha1="8d0268dee78e47c712202b0ec4f1f51109b1f2a5" region="proms" offset="0"/>
<rom name="82s126.4a" size="256" crc="3eb3a8e4" sha1="19097b5f60d1030f8b82d9f1d3a241f93e5c75d6" region="proms" offset="20"/>
<rom name="82s126.1m" size="256" crc="a9cc86bf" sha1="bbcec0570aeceb582ff8238a4bc8546a23430081" region="sound1" offset="0"/>
<rom name="82s126.3m" size="256" crc="77245b66" sha1="0c4d0bee858b97632411c440bea6948a74759746" region="sound1" offset="100"/>
<chip type="cpu" name="Z80" clock="3072000"/>
<chip type="audio" name="Namco" clock="96000"/>
<video screen="raster" orientation="vertical" width="224" height="288" aspectx="3" aspecty="4" refresh="60.606060"/>
<sound channels="1"/>
<input players="2" control="joy4way" buttons="1" coins="2"/>
<dipswitch name="Rack Test (Cheat)">
<dipvalue name="Off" default="yes"/>
<dipvalue name="On"/>
</dipswitch>
<dipswitch name="Service Mode">
<dipvalue name="Off" default="yes"/>
<dipvalue name="On"/>
</dipswitch>
<dipswitch name="Cabinet">
<dipvalue name="Upright" default="yes"/>
<dipvalue name="Cocktail"/>
</dipswitch>
<dipswitch name="Coinage">
<dipvalue name="2 Coins/1 Credit"/>
<dipvalue name="1 Coin/1 Credit" default="yes"/>
<dipvalue name="1 Coin/2 Credits"/>
<dipvalue name="Free Play"/>
</dipswitch>
<dipswitch name="Lives">
<dipvalue name="1"/>
<dipvalue name="2"/>
<dipvalue name="3" default="yes"/>
<dipvalue name="5"/>
</dipswitch>
<dipswitch name="Bonus Life">
<dipvalue name="10000" default="yes"/>
<dipvalue name="15000"/>
<dipvalue name="20000"/>
<dipvalue name="None"/>
</dipswitch>
<dipswitch name="Difficulty">
<dipvalue name="Normal" default="yes"/>
<dipvalue name="Hard"/>
</dipswitch>
<dipswitch name="Ghost Names">
<dipvalue name="Normal" default="yes"/>
<dipvalue name="Alternate"/>
</dipswitch>
<dipswitch name="2x Speed Cheat">
<dipvalue name="Disabled" default="yes"/>
<dipvalue name="Enabled Always"/>
<dipvalue name="Enabled with Button"/>
</dipswitch>
<driver status="good" emulation="good" color="good" sound="good" graphic="good" savestate="supported" palettesize="32"/>
</game>

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Control filtering
« Reply #3 on: April 10, 2017, 08:04:06 PM »
Like I mentioned above your xml file uses the term "game name". Attract-Mode looks for the term "machine name".

Example of what is in your file
Code: [Select]
<game name="puckman" sourcefile="pacman.c">

Example of what Atrract-Mode wants/needs
Code: [Select]
<machine name="puckman" sourcefile="pacman.c">


Do a find and replace on your file.

Find "<game name=" and replace with "<machine name="

and also

find "</game>" and replace with "</machine name>"

You also need to remove this line from your mame.cfg emulator file
Code: [Select]
info_source          listxml

Once you have corrected these things rebuild the romlist and it should contain the control information you're missing.
« Last Edit: April 10, 2017, 08:06:46 PM by progets »

TerrapinM

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Control filtering
« Reply #4 on: April 11, 2017, 05:21:58 PM »
Thanks for the suggestions.  I changed the tags in the XML file and removed "listxml".  Unfortunately that didn't help. 

Here is a sample of the XML:

Code: [Select]
<mame build="0.106 (May 13 2006)">
<machine name="puckman" sourcefile="pacman.c">
<description>PuckMan (Japan set 1, Probably Bootleg)</description>
<year>1980</year>
<manufacturer>Namco</manufacturer>
<rom name="namcopac.6e" size="4096" crc="fee263b3" sha1="87117ba5082cd7a615b4ec7c02dd819003fbd669" region="cpu1" offset="0"/>
<rom name="namcopac.6f" size="4096" crc="39d1fc83" sha1="326dbbf94c6fa2e96613dedb53702f8832b47d59" region="cpu1" offset="1000"/>
<rom name="namcopac.6h" size="4096" crc="02083b03" sha1="7e1945f6eb51f2e51806d0439f975f7a2889b9b8" region="cpu1" offset="2000"/>
<rom name="namcopac.6j" size="4096" crc="7a36fe55" sha1="01b4c38108d9dc4e48da4f8d685248e1e6821377" region="cpu1" offset="3000"/>
<rom name="pacman.5e" size="4096" crc="0c944964" sha1="06ef227747a440831c9a3a613b76693d52a2f0a9" region="gfx1" dispose="yes" offset="0"/>
<rom name="pacman.5f" size="4096" crc="958fedf9" sha1="4a937ac02216ea8c96477d4a15522070507fb599" region="gfx1" dispose="yes" offset="1000"/>
<rom name="82s123.7f" size="32" crc="2fc650bd" sha1="8d0268dee78e47c712202b0ec4f1f51109b1f2a5" region="proms" offset="0"/>
<rom name="82s126.4a" size="256" crc="3eb3a8e4" sha1="19097b5f60d1030f8b82d9f1d3a241f93e5c75d6" region="proms" offset="20"/>
<rom name="82s126.1m" size="256" crc="a9cc86bf" sha1="bbcec0570aeceb582ff8238a4bc8546a23430081" region="sound1" offset="0"/>
<rom name="82s126.3m" size="256" crc="77245b66" sha1="0c4d0bee858b97632411c440bea6948a74759746" region="sound1" offset="100"/>
<chip type="cpu" name="Z80" clock="3072000"/>
<chip type="audio" name="Namco" clock="96000"/>
<video screen="raster" orientation="vertical" width="224" height="288" aspectx="3" aspecty="4" refresh="60.606060"/>
<sound channels="1"/>
<input players="2" control="joy4way" buttons="1" coins="2"/>
<dipswitch name="Rack Test (Cheat)">
<dipvalue name="Off" default="yes"/>
<dipvalue name="On"/>
</dipswitch>
<dipswitch name="Service Mode">
<dipvalue name="Off" default="yes"/>
<dipvalue name="On"/>
</dipswitch>
<dipswitch name="Cabinet">
<dipvalue name="Upright" default="yes"/>
<dipvalue name="Cocktail"/>
</dipswitch>
<dipswitch name="Coinage">
<dipvalue name="2 Coins/1 Credit"/>
<dipvalue name="1 Coin/1 Credit" default="yes"/>
<dipvalue name="1 Coin/2 Credits"/>
<dipvalue name="Free Play"/>
</dipswitch>
<dipswitch name="Lives">
<dipvalue name="1"/>
<dipvalue name="2"/>
<dipvalue name="3" default="yes"/>
<dipvalue name="5"/>
</dipswitch>
<dipswitch name="Bonus Life">
<dipvalue name="10000" default="yes"/>
<dipvalue name="15000"/>
<dipvalue name="20000"/>
<dipvalue name="None"/>
</dipswitch>
<dipswitch name="Difficulty">
<dipvalue name="Normal" default="yes"/>
<dipvalue name="Hard"/>
</dipswitch>
<dipswitch name="Ghost Names">
<dipvalue name="Normal" default="yes"/>
<dipvalue name="Alternate"/>
</dipswitch>
<dipswitch name="2x Speed Cheat">
<dipvalue name="Disabled" default="yes"/>
<dipvalue name="Enabled Always"/>
<dipvalue name="Enabled with Button"/>
</dipswitch>
<driver status="good" emulation="good" color="good" sound="good" graphic="good" savestate="supported" palettesize="32"/>
</machine>

And here is the top of the romlist being generated:

Code: [Select]
#Name;Title;Emulator;CloneOf;Year;Manufacturer;Category;Players;Rotation;Control;Status;DisplayCount;DisplayType;AltRomname;AltTitle;Extra;Buttons
88games;'88 Games;Advmame;;1988;Konami;Sports / Track & Field;4;;;good;0;;;;;4
99lstwar;'99: The Last War;Advmame;sonofphx;1985;Proma;Shooter / Gallery;2;;;good;0;;sonofphx;;;2
99lstwrk;'99: The Last War (Kyugo);Advmame;sonofphx;1985;Kyugo;Shooter / Gallery;2;;;good;0;;sonofphx;;;2
99lstwra;'99: The Last War (alternate);Advmame;sonofphx;1985;Proma;Shooter / Gallery;2;;;good;0;;sonofphx;;;2
yumefuda;(Medal) Yumefuda [BET];Advmame;;;Alba;Tabletop / Hanafuda;1;;;preliminary;0;;;;;6
005;005;Advmame;;;;Maze / Shooter Small;;;;;;;;;;
yard;10-Yard Fight (Japan);Advmame;;1983;Irem;;2;;;good;0;;;;;2
gtmra;1000 Miglia: Great 1000 Miles Rally (94/06/13);Advmame;gtmr;1994;Kaneko;Driving / Race;2;;;good;0;;gtmr;;;2
gtmr;1000 Miglia: Great 1000 Miles Rally (94/07/18);Advmame;;1994;Kaneko;Driving / Race;2;;;good;0;;;;;2
1941;1941;Advmame;;;;Shooter / Flying Vertical;;;;;;;;;;
1941j;1941 - Counter Attack (Japan);Advmame;1941;1990;Capcom;Shooter / Flying Vertical;2;;;good;0;;1941;;;2
1941;1941 - Counter Attack (World);Advmame;;1990;Capcom;Shooter / Flying Vertical;2;;;good;0;;;;;2
1941j;1941j;Advmame;;;;Shooter / Flying Vertical;;;;;;;;;;
1942;1942;Advmame;;;;Shooter / Flying Vertical;;;;;;;;;;

The controls are still not being set. 

I took a closer look at the differences between the old XML and the new XML.  I think the structure of the <control> tag changed.

In .106:

Code: [Select]
<input players="2" control="joy4way" buttons="1" coins="2"/>

In the latest:

Code: [Select]
<input players="2" coins="2">
<control type="joy" player="1" ways="4"/>
<control type="joy" player="2" ways="4"/>
</input>

That is going to be more difficult to convert.  Is there another way I can accomplish this?  How bad would it be to use a newer version?  Do you know what version the format of the XML changed?

TerrapinM

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Control filtering
« Reply #5 on: April 11, 2017, 06:45:36 PM »
Quick update.  I got the mame.xml from version .149.  It has the correct control structure but still uses "game".  I converted the "game" tags to "machine" and now the filtering on controls work.  Unfortunately it is newer than the .106 version I need.  I get a longer list of games even though I no longer see trackball and gun games.  I believe that is because some games that exist but were not playable in .106 are playable now.  I'm going to try to get the .106 file fixed up since I think that would be useful to the RetroPie/Advance Mame/attract mode users.

Thanks for all the help!

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Control filtering
« Reply #6 on: April 12, 2017, 12:21:04 AM »
It's been a while since I tackled this issue. I think that I used romlister https://www.waste.org/~winkles/ROMLister/ to create a batch file of the games I wanted with the 0.139.xml filtering out all the unwanted games and almost all clones. Then I used these filter copied roms against a 0.161.xml to get a decent mame.txt romlist. I then changed the default emulator to mame2003 and set exceptions for the games that need to be run in mame2010, advmame and fba. Even then I need to manually edit the mame.txt for a few entries where the rom names changed.

You can make it perfect (or very close) if you want to take the time and think it out. It would be nice if Attract-Mode looked for both the new and older style .xml files from MAME.
« Last Edit: April 12, 2017, 12:27:31 AM by progets »

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Control filtering
« Reply #7 on: April 12, 2017, 12:39:36 AM »
I created a request for this here https://github.com/mickelson/attract/issues/341

I don't know if anything will come from it but it's worth a try. This has been a challenge for many on the Pi.

TerrapinM

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Control filtering
« Reply #8 on: April 12, 2017, 05:34:42 AM »
Awesome.  Thanks!