Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up --- Bug Reports --- Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Linux-command-line-tools for mame-gamelist-processing  (Read 2651 times)

0 Members and 1 Guest are viewing this topic.

Lomaxx

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:April 23, 2012, 02:42:54 pm
Linux-command-line-tools for mame-gamelist-processing
« on: April 13, 2012, 10:03:12 am »
I've been playing around with simple command-line-tools in Linux in order to get a list of games using a certain video-resolution. There are probably more efficient ways of doing this, but I'm not very experienced with other solutions (like gawk, pearl/python-scripting) mentioned on the net for this issue, so i stuck mostly to "(e)grep", "sed" and my favourite editor "vi".
   I could simply provide an already processed list, but since the gamelist of mame changes as time goes by, I decided to write down the things I did for those of you who might do something similar. This seems to be rather long, but that's only due to the fact that I  try to explain everything in detail and noticed that not everything worked out as I planned it in the beginning. So in the end this became sort of a diary.
      
   First of all i wrote the output of the full xml-list of groovymame to a file:

Code: [Select]
groovymame -listxml> groovymame_output.xml   
   The resulting file is rather big and I didn't want all information provided, so i used "egrep" to only pick out some of the lines:
   
Code: [Select]
egrep -o "<game\ .*|<description>.*|<year>.*|<manufacturer>.*|<display .*|<input.*|<control.*|<driver\ .*|</game>" groovymame_output.xml > groovymame_output_partial.txt
 The "-o"-switch tells egrep to only output the exact pattern that was found and not the whole line that contained the pattern.  In this example the difference is that the leading indention is removed.

In order to verify if the results a little, I tested how often these sections are found, which can be done with "egrep -c" ("-c" just counts the number of hits)
   
Code: [Select]
egrep -c "<game name=\"" groovymame_output_partial.txt
10630
egrep -c "<description" groovymame_output_partial.txt
10630
egrep -c "width=\"[[:digit:]]*\" height=\"[[:digit:]]*\"" groovymame_output_partial.txt
9479

While the number of hits for the short name and the full description was exactly the same, the number of hits for the resolution differed. I looked at the file again and noticed that some games do not list the resolution. Seems like these games are not yet supported but were already added for future releases of mame since their status is set to "preliminary".
 More surprisingly some game-entries contain two <display>-tags. Some of them seem to consist of some dual-monitor setup, but as far as I can make out not all of them do. For example try
 
Code: [Select]
grep -B 1 -A 50 "Ghouls'n Ghosts" groovymame_output.xml



Sidenote: After creating the file "groovymame_output_re-lined.txt" (Read on a few lines to see how this is done) you can use the following command to get a full list of the 214 games containing two "<display"-lines:
Code: [Select]
grep "<display.*<display.*" groovymame_output_re-lined.txt | grep -o "<description>.*</description>"


 
As far as I noticed there are three types of statuses: "good", "imperfect", "preliminary". Additionally there are also clones listed which you might want to sort out as well.
 But before I continue I will reformat the text-file in such a way, that all data-fields of each game are listed in one line (one line per game).
 
Code: [Select]
tr -d '\n' < groovymame_output_partial.txt | sed -e 's/<\/game>/<\/game>\n/g' > groovymame_output_re-lined.txt
 This command-line consists of two commands: The "tr"-part removes all line-breaks and the "sed"-part adds one single line-break after each "</game>".
 
 Now we can search for lines that for example contain the status "good" or "imperfect" and are no clones and redirect them into a new file
 
Code: [Select]
egrep "<driver status=\"(good|imperfect)\"" groovymame_output_re-lined.txt | grep -v "cloneof=" > groovymame_output_selection.txt
 For me this resulted in a list of 3493 games. I'm a bit surprised that there are so many clones, which makes me a bit unsure that it's recommended to sort them all out. Can somebody maybe comment on this? Do clones sometimes yield advantages over the original versions? Also: Is it not too strict to sort out all preliminary games? Here are some statistics from my grep-results:
 
Code: [Select]
cat groovymame_output_re-lined.txt | wc -l
10630

egrep "<driver status=\"good\"" groovymame_output_re-lined.txt | wc -l
6079

egrep "<driver status=\"imperfect\"" groovymame_output_re-lined.txt | wc -l
1478

egrep "<driver status=\"preliminary\"" groovymame_output_re-lined.txt | wc -l
3073

egrep -v "cloneof=" groovymame_output_re-lined.txt | wc -l
5382

Unless I'm doing something wrong here, this means that half of the games are clones. Anyway, I will continue with the above specified selection of "groovymame_output_selection.txt".


We can now use this selection as a good source to do faster, further processing of our choice. For example I wanted to get a list of all resolutions that games use. Here is the command-line i used:
  
Code: [Select]
egrep -o "width=\"[[:digit:]]*\" height=\"[[:digit:]]*\"" groovymame_output_selection.txt | sort -ru
  This line searches for lines containing the pattern

width="" height=""

with any amount of digits between the quotation-mark. The output of the egrep-command is then handed on to the "sort"-command, which because of the "-ru"-switch sorts the lines in reverse order and removes any duplicate lines. The sorting is not yet perfect, but forget about that for now.
 You will get a list of ~206 resolutions. Browse the list a little and notice that there are some very low and rather high resolutions: 22, 64, 1024, 1280
  I was curious what these games are about, so I built up a line that finds the description of these games:
  
Code: [Select]
egrep "(width|height)=\"(1280|1024|22|64)\"" groovymame_output_selection.txt | egrep -o "<description>.*</description>"  
  
  This line searches for lines containing "width"- or "height"-values of the above mentioned, suspicious resolutions.
   The whole egrep-output is then handed on to another egrep-command that searches for "<description>.*</description>". The result is a compact list of the long name of all the games with the suspicious resolutions. I looked these games up and as far as I can tell , I can safely forget about these and concentrate on games with width- and height-values with exactly three digits.
  
Now lets list all resolutions again with this 3-digit-limitation:

Code: [Select]
egrep -o "width=\"[[:digit:]]{3}\" height=\"[[:digit:]]{3}\"" groovymame_output_selection.txt | sort -ru
This time the remaining resolutions are correctly sorted. You can as well sort for height if you want to:

Code: [Select]
egrep -o "width=\"[[:digit:]]{3}\" height=\"[[:digit:]]{3}\"" groovymame_output_selection.txt | sort -ru -k 2
Another example of what you can do is to search for games up to a width or height of "288", which is of interest to me because that's the resolution I can use in progressive modes on my scart-tv. This time I will go for the short name and not the full description and redirect the output into some file:

Code: [Select]
egrep "height=\"[12][0-8][0-8]\"" groovymame_output_selection.txt | egrep -o "name=\"[^\"]*\"" > up_to_288_games.txt
Code: [Select]
egrep "width=\"[12][0-8][0-8]\"" groovymame_output_selection.txt | egrep -o "name=\"[^\"]*\"" >> up_to_288_games.txt
That list will contain duplicate entries, which can be easily removed. Also I wanted to have nothing but the name itself (no name= and no quotes):

Code: [Select]
cat up_to_288_games.txt | sort -u | cut -b 7- | tr -d \" > up_to_288_games_cleaned.txt
And to see the number of games:

Code: [Select]
cat up_to_288_games_cleaned.txt | wc -l
3121
I didn't fully verify the result yet, but it should be correct to the most part of it.


Another list I wanted to have was one of only vertical games that fit the screen of my TV better when it's rotated by 90. First I thought I can break it down to the resolution: a vertical game should be one, that has a bigger "height" than "width". But that's not right. I started to realize this when looking at games with the same height and width. For example for 480x480 these are "Crate Raider", "Spy Hunter" and "Turbo Tag". When looking at these games at mamedb.com, then you will see that "Spy Hunter" and "Turbo Tag" are vertical games, while "Crate Raider" is a horizontal game. I looked at the xml-data of these games and noticed that "Crate Raider" has a rotate value of "0", while the other two have a value of "90". So is that the key to find vertical games? To be honest I have been in doubt that this is correct for all games.
 I took a look at the game "Raiden". I know that this is a vertical game. The resolution of the game is 256x224. Again a proof that vertical games do not necessarily have a greater height-value than width-value. The rotate-value however is "270".
  I decided to create a list of all games that have a rotate-value of "90" or "270"
  
Code: [Select]
egrep "rotate=\"(90|270)\"" groovymame_output_selection.txt | wc -l
  829
  
egrep "rotate=\"(90|270)\"" groovymame_output_selection.txt | grep -o "<description>.*</description>" > groovymame_output_rotated.txt
 I compared a couple of the games with mamedb.com and the results seemed to be rather satisfying. I couldn't make out any horizontal game. However I am not sure if some vertical games are missing.
  
  Remember that my file "groovymame_output_selection.txt" already sorted out all games with preliminary status and that were no clones of some other game.  So the last file we created should contain only "good" and "imperfect" emulated  vertical games without clones. If you want a purified list without the start- and end-flag of <description>, then use sed to cut these tags of:
  
Code: [Select]
sed -i -e 's/<description>//' -e 's/<\/description>//' groovymame_output_rotated.txt
  
  Be careful with that "-i"-switch of sed. It stands for "inplace" and makes sed directly and permanently modify the specified file. Leave "-i" away and you can test the result as it will be shown on standard output. Or redirect the output to a new file like we did before.
  
  Here is a slight variation in case you want to have the same list of games as zip-archives:
    
Code: [Select]
egrep "rotate=\"(90|270)\"" groovymame_output_selection.txt | egrep -o "name=\"[^\"]*\"" | cut -b 7- | sed -e 's/\"/\.zip/' > vertical-games-ziplist.txt  
I tried more or less the same search with "rotate"-values of "0" and "180" and received 2653 games. Together with the above 829 games this gives a total of 3482 games. However "wc -l groovymame_output_selection.txt" shows a total of 3493. What's up with the 11 missing entries?

Code: [Select]
egrep -v "rotate=\"(0|90|180|270)\"" groovymame_output_selection.txt | egrep -o "<description>.*</description>"
Except for "Gamball" and "Dr.Who The Timelord" all these entries seem to be system-roms. I tried to run both games (m_gmball, m_bdrwho) which resulted in a segmentation fault of groovymame. So my decision was to forget about both games.

Edit: Skip the rest of this post. I made a dumb mistake which made me thought that the results are incorrect, but as far as I can tell by now they are pretty much fine.

Now back to the results of games with a rotate-value of "0" and "180": Already the very first games I looked up in the mamedb, showed that there are also vertical games among them. So my doubt was justified.  Unfortunately I couldn't make out any more complex filtering that would help. For example a rotate-value of "0" and "180" AND higher/lower width-value than height-value didn't work as well.
 Some games list a "htotal"- and "vtotal"-value, maybe that would help, but unfortunately only 1385 (of 3493) games list these values. So even in case they would help, this wouldn't bring up a complete list.

  At the moment I am clueless. And since all this is becoming a quite long text, I decided to release it for now. Maybe someone got an idea. Feel free to ask any questions - as you might have noticed I somewhat enjoy stuff like this.
« Last Edit: April 14, 2012, 08:38:25 am by Lomaxx »

Lomaxx

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:April 23, 2012, 02:42:54 pm
Re: Linux command-line-processing of mame-gamelist
« Reply #1 on: April 13, 2012, 02:06:24 pm »
I made a very stupid mistake while verifying the results of the gameslists for vertical/horizontal-games: While browsing the mamedb.com-pictures I only looked at the thumbnails, which always seem to be vertical oriented. Once you click into the actual game-info there, you will see the proper screenshot. Just realized this. Doh!
 So there is still hope that the rotate-value is a proper way of sorting them out. I will make a more intense verification of that tomorrow and report back.

Paradroid

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 676
  • Last login:Yesterday at 06:12:24 pm
    • SCART Hunter
Re: Linux command-line-processing of mame-gamelist
« Reply #2 on: April 14, 2012, 05:04:58 am »
Fascinating! Thanks for documenting this and posting your findings. :)

I've been thinking along very similar lines although I would use different tools to reach the same outcome (sorry, still a Windows guy for now... ;) ).

My idea is that if you know what the most common (or important... although this is subjective, I guess) resolutions used by MAME are, then you can make sure your GroovyMAME monitor specs and monitor setup are focused on these.

For example, what's the most common arcade game resolution? I have know idea. If you're able to pull this information from MAME and do some processing then that should be simple to work out.

There are lots of possible uses for this information. I'm definitely keen to see where you head with this...
My MAME/SCART/CRT blog: SCART Hunter

Lomaxx

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:April 23, 2012, 02:42:54 pm
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #3 on: April 14, 2012, 08:29:51 am »
Thanks for the feedback, Paradroid.

Some updates:

- First of all i changed the thread-topic a little, since i thought it hasn't been very accurate.

- Then I forgot to mention that the long game-names (the one in between the <description>-flag) show the "&"-character as "&amp;". If you want to replace them with "&" again, then you can do it with "sed". An example-line which would remove "<description>","</description>" and exchange "&amp;" back to "&" is:

Code: [Select]
sed -e 's/<description>//' -e 's/<\/description>//' -e 's/\&amp\;/\&/g'
You could add this line behind some egrep-command of your choice seperated by a "|" (that's called a "pipe"). Also see the examples in the first post to understand how to pipe output into "sed". Alternatively you can specify a file at the end and/or redirect the output into a new file.

- Most importantly of all: I again compared the first ~100 entries of the vertical- and horizontal-game-list with mamedb.com - this time correctly I hope. :P The result was pretty satisfying, although it's no 100% proof of correctness. For quite some games no screenshot was available, others were not listed at all and sometimes only a ingame-/title-screenshot was shown but no shot of the cabinet with the monitor (which is after all the most reliable proof). But at least i couldn't find any clear examples of mistakes.
 I will edit the above post in order not to confuse anyone.

@Paradroid: A sort of statistic of which resolution is used how often shouldn't be too hard. I will look into that.
« Last Edit: April 14, 2012, 08:34:31 am by Lomaxx »

Lomaxx

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:April 23, 2012, 02:42:54 pm
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #4 on: April 14, 2012, 09:16:19 am »
With a little help from the net I found a way to get a statistic of how often each resolution is used rather fast. First I tried to do it with the "-c"-switch (stands for "count hits") of grep. But that only counts all hits. I could have written a bash-script that calls "grep -c" for each search-pattern, but gladly I stumbled upon a far easier solution.

Remember the egrep-line that I used before to get a sorted list of all used resolutions? Well here it is again:

Code: [Select]
egrep -o "width=\"[[:digit:]]*\" height=\"[[:digit:]]*\"" groovymame_output_selection.txt | sort -ru
 All we need to do is to remove the "-ru"-switch from sort ("r" could be left as it simply does a reverse sorting, but "u" needs to be removed as it does the same as "uniq", i.e remove double entries) and pipe the output into the "uniq"-command which has an option to count how often each duplicate line appeared. After that I sort the result once again.

Code: [Select]
egrep -o "width=\"[[:digit:]]*\" height=\"[[:digit:]]*\"" groovymame_output_selection.txt | sort | uniq -c | sort
Here is the result for quick reading:

Code: [Select]
   592 width="256" height="224"
    438 width="320" height="224"
    322 width="256" height="240"
    304 width="320" height="240"
    193 width="288" height="224"
    166 width="640" height="480"
    130 width="384" height="224"
     77 width="384" height="240"
     74 width="512" height="224"
     62 width="256" height="256"
     61 width="336" height="240"
     48 width="384" height="256"
     47 width="640" height="240"
     46 width="512" height="240"
     42 width="416" height="224"
     42 width="320" height="200"
     41 width="240" height="240"
     38 width="260" height="224"
     36 width="512" height="256"
     35 width="352" height="240"
     34 width="512" height="288"
     34 width="256" height="192"
     30 width="240" height="224"
     26 width="512" height="480"
     26 width="256" height="232"
     21 width="320" height="232"
     20 width="304" height="224"
     19 width="399" height="253"
     17 width="288" height="216"
     17 width="240" height="248"
     16 width="671" height="216"
     16 width="448" height="224"
     15 width="496" height="384"
     15 width="256" height="248"
     14 width="488" height="384"
     14 width="384" height="232"
     14 width="304" height="216"
     13 width="544" height="480"
     13 width="512" height="384"
     13 width="432" height="224"
     13 width="240" height="192"
     12 width="272" height="224"
     11 width="400" height="256"
     11 width="336" height="239"
     10 width="480" height="64"
     10 width="464" height="248"
     10 width="360" height="240"
     10 width="292" height="240"
     10 width="256" height="208"
      9 width="400" height="300"
      9 width="400" height="280"
      8 width="508" height="240"
      8 width="280" height="210"
      7 width="703" height="272"
      7 width="512" height="400"
      7 width="400" height="240"
      6 width="400" height="224"
      6 width="320" height="256"
      6 width="304" height="240"
      5 width="704" height="480"
      5 width="576" height="224"
      5 width="512" height="236"
      5 width="400" height="248"
      5 width="338" height="240"
      5 width="336" height="225"
      5 width="240" height="256"
      4 width="384" height="384"
      4 width="380" height="224"
      4 width="368" height="240"
      4 width="360" height="224"
      4 width="280" height="224"
      4 width="276" height="240"
      4 width="248" height="256"
      3 width="672" height="240"
      3 width="576" height="432"
      3 width="576" height="400"
      3 width="512" height="448"
      3 width="496" height="480"
      3 width="480" height="480"
      3 width="432" height="256"
      3 width="384" height="280"
      3 width="352" height="296"
      3 width="352" height="256"
      3 width="294" height="294"
      3 width="294" height="238"
      3 width="288" height="240"
      3 width="280" height="240"
      3 width="256" height="216"
      3 width="248" height="240"
      2 width="720" height="768"
      2 width="508" height="384"
      2 width="508" height="254"
      2 width="464" height="224"
      2 width="394" height="240"
      2 width="376" height="240"
      2 width="368" height="224"
      2 width="336" height="238"
      2 width="320" height="190"
      2 width="318" height="239"
      2 width="272" height="236"
      2 width="256" height="239"
      2 width="256" height="230"
      2 width="236" height="224"
      2 width="224" height="224"
      2 width="1280" height="1024"
      2 width="1024" height="1024"
      1 width="800" height="600"
      1 width="544" height="242"
      1 width="512" height="232"
      1 width="512" height="228"
      1 width="512" height="192"
      1 width="511" height="399"
      1 width="508" height="224"
      1 width="496" height="232"
      1 width="496" height="224"
      1 width="480" height="464"
      1 width="480" height="224"
      1 width="448" height="240"
      1 width="392" height="224"
      1 width="376" height="250"
      1 width="376" height="224"
      1 width="368" height="232"
      1 width="366" height="240"
      1 width="360" height="245"
      1 width="352" height="224"
      1 width="342" height="240"
      1 width="338" height="236"
      1 width="335" height="240"
      1 width="322" height="241"
      1 width="321" height="224"
      1 width="320" height="248"
      1 width="320" height="236"
      1 width="319" height="255"
      1 width="319" height="240"
      1 width="319" height="223"
      1 width="318" height="240"
      1 width="316" height="239"
      1 width="304" height="256"
      1 width="304" height="232"
      1 width="296" height="480"
      1 width="296" height="240"
      1 width="292" height="231"
      1 width="288" height="208"
      1 width="280" height="232"
      1 width="272" height="200"
      1 width="264" height="240"
      1 width="264" height="224"
      1 width="260" height="240"
      1 width="256" height="288"
      1 width="256" height="234"
      1 width="256" height="231"
      1 width="256" height="222"
      1 width="255" height="232"
      1 width="254" height="240"
      1 width="248" height="224"
      1 width="240" height="252"
      1 width="240" height="232"
      1 width="240" height="216"
      1 width="232" height="224"
      1 width="223" height="240"
      1 width="208" height="208"
      1 width="192" height="22"
      1 width="192" height="192"
      1 width="184" height="176"
      1 width="160" height="200"

Again you could sort the result by the content of second or third "column" by using the "-k 2" or -k 3"-switch of sort.


« Last Edit: April 14, 2012, 09:22:52 am by Lomaxx »

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6790
  • Last login:December 04, 2019, 09:42:01 am
  • Quote me with care
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #5 on: April 14, 2012, 09:27:01 am »
Hi Lomaxx, really nice thread. I just wanted to confirm that checking for a "rotate" value of 90 or 270 is exactly the method I use in VMMaker to detect vertical games.
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead or pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

Lomaxx

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:April 23, 2012, 02:42:54 pm
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #6 on: April 14, 2012, 09:37:30 am »
Hey Calamity. That's brilliant news. Now I can rest assured that I do the right thing. :)

Another small hint: I noticed, that there are BIOS-files among the result of my horizontal games. But only 14 of them. If you you want to sort them out, then do a negative search for them (search for lines that do not contain BIOS in their description).

Depending on which output you pipe into use something like

Code: [Select]
grep -v "<description>.*BIOS.*</description>"
or when you pipe a list of nothing but the sole long-name:

Code: [Select]
grep -v "BIOS"
If I'll find other things worth sorting out, then I will edit this post.


Lomaxx

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:April 23, 2012, 02:42:54 pm
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #7 on: April 14, 2012, 12:39:01 pm »
Here's another aspect: Categories

The "-listxml"-output of groovymame unfortunately does not contain any information about the category. You still might want to make a selection based on them for some reason. So what to do? I found an English catalog of categories on the net at http://www.progettoemma.net/history/catlist.php.  They do also offer them in a version for genres and a zip-file which offers all of them in some other sort-scheme. Actually they are all worth a look, because they might become handy for the one or other situation. For now I will stick to the "catver.ini". I downloaded that archive and unzipped it.
 After some testing I noticed that I better change the format of that file for further grep-processing. First of all it was written on a MsWindows-machine, because of which it uses a different line-break-special-character. We can fix that quickly by using "dos2unix". Additionally it's easier to grep entries when the shortname and the category are enclosed by doublequotes. And finally I only needed the first 18202 lines of the file since after that the category-listing ends and some versioning-stuff starts (see with an editor to understand what i mean). So i copied and modified the file a little:

Code: [Select]
head -n 18202 catveren/Catver.ini | dos2unix | sed -e 's/^/\"/' -e 's/=/\"=\"/' -e 's/$/\"/' > catlist_modified.txt
The sed-part adds a doublequote at the start of each line, at the end of each line and replaces the equal-sign with a doublequotes-equalsign-doublequotes combination. So in the and the lines look like in this example:

"1942"="Shooter / Flying Vertical"

So now that I have that modfied catlist, I can create a list of .... let's say' ... vertical games containing the shortnames still holding the doublequotes around them:

Code: [Select]
egrep "rotate=\"(90|270)\"" groovymame_output_selection.txt | egrep -o "name=\"[^\"]*\"" | cut -b 6-  > vertical-games_shortname.txt
and now grab only these vertical games from the modified catlist:

Code: [Select]
fgrep -f vertical-games_shortname.txt catlist_modified.txt > vertical-games_with_category.txt

Note:
When I did this, I noticed that 3 games were not mentioned in the resulting list: cprosocc, ddp3, taxidrvr
These were not listed in catlist most likely because I used version 0.145 of it while my groovymame-version was only 0.143. I assume their name changed for some reason. So better try to use the same version of both lists. Although I can't tell you right now where to get a 0.143-catlist.

From here on you can do further sorting or selecting with the list containing both the shortname and the category. A list holding genres should be creatable in an analog way.
« Last Edit: April 14, 2012, 12:40:58 pm by Lomaxx »

krick

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2002
  • Last login:November 16, 2019, 11:47:54 am
  • Gotta have blue hair.
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #8 on: April 16, 2012, 11:33:23 pm »
You really should take a look at XSLT.

You can transform XML in amazing ways using XSL transforms.

In fact, the target format doesn't even have to be XML.

Check out the XSL file included with XML2INFO for an example of the sort of thing that can be done.

http://mame.3feetunder.com/xml2info/
Hantarex Polo 15KHz
Sapphire Radeon HD 7750 2GB (GCN)
GroovyMAME 0.197.017h_d3d9ex
CRT Emudriver & CRT Tools 2.0 beta 13 (Crimson 16.2.1 for GCN cards)
Windows 7 Home Premium 64-bit
Intel Core i7-4790K @ 4.8GHz
ASUS Z87M-PLUS Motherboard

Lomaxx

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:April 23, 2012, 02:42:54 pm
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #9 on: April 17, 2012, 10:40:19 am »
I tried

Code: [Select]
xsltproc xml2info.xsl groovymame_output.xml > listinfo.txt
, but it seems like that needs quite a lot of memory. My computer started to swap and swap and swap memory .... and after something like 10 minutes i decided to cancel the operation. I guess my 8 year old computer with 512MB ram is simply too old for that. :) I'll keep it in mind once i buy a new one. ;) Thanks for pointing me to it.

krick

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2002
  • Last login:November 16, 2019, 11:47:54 am
  • Gotta have blue hair.
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #10 on: April 17, 2012, 09:49:33 pm »
There are some other XSL tool options on this page...

http://www.xml.com/pub/a/2003/11/26/learnXSLT.html

1) Instant Saxon for Windows (command line).

2) xRay2 for Windows (gui).

3) Xalan for Linux.

You can use a browser to do the XSL transform (also explained on the page above), but I'm guessing that will probably be very slow as well.


EDIT: there's a newer version of Saxon called "Saxon-HE" (currently ver 9.4) that supports XLST 2.0 and runs on Java 1.5 or higher...  http://saxon.sourceforge.net/#F9.4HE

Assuming you have the following files all in the same directory (and Java configured correctly)

saxon9he.jar
mame.xml
xml2info.xsl

...you can run this command line in that directory:

java  -jar saxon9he.jar -s:mame.xml -xsl:xml2info.xsl -o:listinfo.txt

...where...
-s is the source file
-xsl is the file containing the xsl transform
-o is the output file
« Last Edit: April 17, 2012, 10:56:58 pm by krick »
Hantarex Polo 15KHz
Sapphire Radeon HD 7750 2GB (GCN)
GroovyMAME 0.197.017h_d3d9ex
CRT Emudriver & CRT Tools 2.0 beta 13 (Crimson 16.2.1 for GCN cards)
Windows 7 Home Premium 64-bit
Intel Core i7-4790K @ 4.8GHz
ASUS Z87M-PLUS Motherboard

Paradroid

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 676
  • Last login:Yesterday at 06:12:24 pm
    • SCART Hunter
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #11 on: April 18, 2012, 07:41:07 pm »
Here is the result for quick reading:

Code: [Select]
   592 width="256" height="224"
    438 width="320" height="224"
    322 width="256" height="240"
    304 width="320" height="240"
    193 width="288" height="224"

Very cool!

So, if we look at that top 5, that's very interesting. Are those figures based on parents sets only or are clones included?
My MAME/SCART/CRT blog: SCART Hunter

Lomaxx

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:April 23, 2012, 02:42:54 pm
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #12 on: April 19, 2012, 09:27:38 am »
That statistic was based on the selection from the entire output.xml without games having a status of preliminary (only "good" and "imperfect") or containing the phrase "cloneof="...".

I ran the same line on the complete "groovymame_output_re-lined.txt"-file which consists of 10630 entries (lines):

Code: [Select]
grep -E -o "width=\"[[:digit:]]*\" height=\"[[:digit:]]*\"" groovymame_output_re-lined.txt | sort | uniq -c | sort -r
and this is the result:

Code: [Select]
  1587 width="256" height="224"
    877 width="320" height="224"
    818 width="640" height="480"
    732 width="320" height="240"
    556 width="384" height="224"
    552 width="256" height="240"
    498 width="288" height="224"
    251 width="512" height="288"
    181 width="336" height="240"
    175 width="256" height="256"
    161 width="512" height="224"
    155 width="512" height="256"
    149 width="384" height="240"
    131 width="384" height="256"
    130 width="496" height="384"
    100 width="260" height="224"
     96 width="512" height="384"
     95 width="512" height="240"
     91 width="416" height="224"
     86 width="256" height="232"
     80 width="448" height="224"
     73 width="240" height="240"
     72 width="399" height="253"
     70 width="640" height="240"
     64 width="240" height="224"
     61 width="352" height="240"
     59 width="304" height="224"
     56 width="256" height="192"
     55 width="384" height="232"
     55 width="320" height="232"
     50 width="256" height="248"
     47 width="320" height="200"
     45 width="512" height="480"
     44 width="544" height="480"
     41 width="704" height="480"
     37 width="671" height="216"
     37 width="240" height="192"
     34 width="464" height="248"
     33 width="512" height="400"
     32 width="504" height="296"
     32 width="320" height="256"
     32 width="288" height="216"
     32 width="256" height="208"
     31 width="800" height="600"
     26 width="360" height="240"
     25 width="400" height="256"
     25 width="304" height="216"
     23 width="508" height="384"
     22 width="272" height="224"
     22 width="240" height="248"
     20 width="292" height="240"
     19 width="672" height="240"
     19 width="576" height="224"
     19 width="508" height="240"
     19 width="400" height="300"
     17 width="488" height="384"
     17 width="384" height="280"
     17 width="294" height="238"
     16 width="432" height="224"
     16 width="400" height="224"
     15 width="640" height="400"
     15 width="512" height="448"
     15 width="280" height="240"
     13 width="400" height="280"
     13 width="400" height="240"
     13 width="288" height="240"
     13 width="280" height="224"
     12 width="240" height="256"
     11 width="512" height="228"
     11 width="368" height="240"
     11 width="336" height="239"
     10 width="720" height="480"
     10 width="480" height="64"
     10 width="304" height="240"
     10 width="280" height="210"
      9 width="703" height="272"
      9 width="640" height="200"
      9 width="512" height="236"
      9 width="496" height="480"
      9 width="272" height="236"
      8 width="480" height="240"
      8 width="394" height="240"
      8 width="360" height="224"
      8 width="319" height="255"
      8 width="192" height="22"
      7 width="512" height="512"
      7 width="400" height="248"
      7 width="384" height="384"
      7 width="1024" height="1024"
      6 width="480" height="480"
      6 width="368" height="256"
      6 width="336" height="225"
      6 width="256" height="231"
      6 width="248" height="256"
      6 width="248" height="240"
      5 width="576" height="400"
      5 width="544" height="200"
      5 width="480" height="464"
      5 width="360" height="245"
      5 width="338" height="240"
      5 width="321" height="224"
      5 width="256" height="216"
      4 width="576" height="432"
      4 width="512" height="248"
      4 width="432" height="256"
      4 width="392" height="224"
      4 width="380" height="224"
      4 width="352" height="256"
      4 width="320" height="190"
      4 width="294" height="294"
      4 width="276" height="240"
      4 width="236" height="224"
      3 width="720" height="768"
      3 width="704" height="240"
      3 width="640" height="300"
      3 width="544" height="242"
      3 width="511" height="399"
      3 width="508" height="254"
      3 width="416" height="256"
      3 width="376" height="224"
      3 width="368" height="232"
      3 width="352" height="296"
      3 width="322" height="241"
      3 width="296" height="480"
      3 width="296" height="224"
      3 width="256" height="222"
      3 width="240" height="252"
      3 width="224" height="240"
      2 width="512" height="432"
      2 width="512" height="232"
      2 width="508" height="224"
      2 width="496" height="232"
      2 width="464" height="224"
      2 width="432" height="320"
      2 width="416" height="208"
      2 width="376" height="240"
      2 width="368" height="224"
      2 width="336" height="238"
      2 width="319" height="240"
      2 width="318" height="239"
      2 width="312" height="288"
      2 width="304" height="256"
      2 width="296" height="296"
      2 width="288" height="208"
      2 width="264" height="240"
      2 width="256" height="288"
      2 width="256" height="239"
      2 width="256" height="234"
      2 width="256" height="230"
      2 width="248" height="224"
      2 width="248" height="216"
      2 width="240" height="232"
      2 width="232" height="224"
      2 width="224" height="224"
      2 width="223" height="240"
      2 width="208" height="208"
      2 width="192" height="216"
      2 width="160" height="200"
      2 width="1280" height="240"
      2 width="1280" height="1024"
      1 width="736" height="264"
      1 width="671" height="272"
      1 width="648" height="240"
      1 width="640" height="256"
      1 width="512" height="249"
      1 width="512" height="192"
      1 width="496" height="224"
      1 width="480" height="224"
      1 width="448" height="240"
      1 width="384" height="512"
      1 width="384" height="128"
      1 width="376" height="250"
      1 width="376" height="248"
      1 width="368" height="448"
      1 width="366" height="240"
      1 width="352" height="224"
      1 width="342" height="240"
      1 width="338" height="236"
      1 width="336" height="248"
      1 width="335" height="240"
      1 width="320" height="248"
      1 width="320" height="236"
      1 width="319" height="223"
      1 width="318" height="240"
      1 width="316" height="239"
      1 width="304" height="232"
      1 width="296" height="240"
      1 width="292" height="231"
      1 width="280" height="232"
      1 width="272" height="200"
      1 width="264" height="224"
      1 width="260" height="240"
      1 width="256" height="512"
      1 width="256" height="184"
      1 width="255" height="232"
      1 width="254" height="240"
      1 width="240" height="216"
      1 width="232" height="256"
      1 width="224" height="232"
      1 width="224" height="192"
      1 width="216" height="224"
      1 width="208" height="240"
      1 width="192" height="208"
      1 width="192" height="192"
      1 width="184" height="176"
      1 width="1024" height="512"

This are altogether 9479 resolutions. Note that a few entries have two resolution-descriptions (like described before in this thread) and others have none at all (obviously, as 9479 is less than 10630).
« Last Edit: April 19, 2012, 09:36:21 am by Lomaxx »

krick

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2002
  • Last login:November 16, 2019, 11:47:54 am
  • Gotta have blue hair.
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #13 on: April 19, 2012, 11:11:56 am »
An easy way to test for vertical in code using the value of the "rotate" attribute from the XML...

(rotate / 10) mod 2

If the result is 0, then it's horizontal, if the result is 1 it's vertical.

for example...

(0 / 10) % 2 = 0
(90 / 10) % 2 = 1
(180 / 10) % 2 = 0
(270 / 10) % 2 = 1

Probably not the fastest way to do it since div and mod aren't exactly fast operations, but it does work.
Hantarex Polo 15KHz
Sapphire Radeon HD 7750 2GB (GCN)
GroovyMAME 0.197.017h_d3d9ex
CRT Emudriver & CRT Tools 2.0 beta 13 (Crimson 16.2.1 for GCN cards)
Windows 7 Home Premium 64-bit
Intel Core i7-4790K @ 4.8GHz
ASUS Z87M-PLUS Motherboard

Paradroid

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 676
  • Last login:Yesterday at 06:12:24 pm
    • SCART Hunter
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #14 on: April 19, 2012, 09:34:04 pm »
That statistic was based on the selection from the entire output.xml without games having a status of preliminary (only "good" and "imperfect") or containing the phrase "cloneof="...".

Thanks for the clarification. That makes sense.

Now, I assume there's a field for refresh rate? Would be interesting to see a similar listing to see what the range is (and graduations across the range)...

The mind boggles... there are so many different ways I can think of to manipulate this data.

I guess one cool outcome would be to create a test suite of games that covers the full range of resolutions and refresh rates used. Especially those that feature smooth scrolling...
My MAME/SCART/CRT blog: SCART Hunter

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 6790
  • Last login:December 04, 2019, 09:42:01 am
  • Quote me with care
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #15 on: April 20, 2012, 04:50:00 am »
Now, I assume there's a field for refresh rate? Would be interesting to see a similar listing to see what the range is (and graduations across the range)...

Of course, there's a refresh rate field. Some drivers even have information for detailed video timings, which can be directly translated into modelines that -in theory- replicate the exact video signal obtained from the pcb. However this would lead us to a huge different in geometry between games, so it's better to recook the video modes to our specs, respecting the native resolution and refresh. There's a limitation to this xml structure anyway: many games switch resolutions and in fact use more than one, but only one of them is listed in the xml data, usually the first one used during pcb's initiallization, which unfortunately is not the most representative one. Some games also switch their refresh rate (i.e. Zoo Keeper).
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead or pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

Paradroid

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 676
  • Last login:Yesterday at 06:12:24 pm
    • SCART Hunter
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #16 on: April 20, 2012, 04:59:35 am »
Thanks for the info Calamity! I've learnt a lot from this thread so far. :)
My MAME/SCART/CRT blog: SCART Hunter

Lomaxx

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:April 23, 2012, 02:42:54 pm
Re: Linux-command-line-tools for mame-gamelist-processing
« Reply #17 on: April 20, 2012, 11:31:20 am »
@krick

You could as well test if the first digit of the rotate value is greater than 1 or not.
With the possible values of "0","90","180","270" you get "0" and "1" for horizontal and "2" and "9" for vertical games, thus vertical games >1.
Just a thought though. I have no idea which of the two ways takes more resources to calculate.