Draco1962 Posted April 15, 2017 Share Posted April 15, 2017 What I am proposing is an application that reads the user's GameEx MAME dat files and database for the ROM names and game names, year, etc. and can assemble the data into a PinballX mame.xml file accordingly. It would also be good for said application to allow for generating .xml files specifically for vertical, horizontal, or both of the user's choosing as well as name them as the user wishes. Attached is a copy of the MAME.xml file that B2K24 created of 863 vertical perfect and imperfect parent ROMS as an example of the format. MAME.zip MAME.zip 1 Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 22, 2017 Author Share Posted April 22, 2017 Thought I would move this thread here. Not sure if there is any interest from Stigzler or Adultery in creating this niche application, but given their programming chops I think either could churn something like this out. Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 22, 2017 Share Posted April 22, 2017 I may have a look at this at some point in the future, Draco. There's a couple of problems: a) I'm not massive on mame or pinball - nothing against either, just not an area I'm overly familiar with in terms of understanding all the intricacies about what you're after. Point being, I couldn't visualise what you were referencing above - illustrating my lack of knowledge around it. There'd be a significant period of researching how it all worked even before putting words to IDE! b ) I've put on about 3 stone over the past couple of years from eating pizza and taping words onto a screen! I've really gotta commit to the gym, outside and fresh air! I'll certainly keep it in mind, though. I'll invariably get around to more detailed mame/pinball work at some point and bet your bottom dollar I'll look at it then Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 22, 2017 Author Share Posted April 22, 2017 I understand. I don't think you would have to know anything about pinball. The main thing is generating the xml file in the format of the attached from the user's MAME collection. Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 23, 2017 Share Posted April 23, 2017 OK - you got me. Provide an example of the file in and an example of the file out (I'm assuming that's the one in the OP) and the method of getting from in to out (i.e. what field do you filter on in the "file in") Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 23, 2017 Author Share Posted April 23, 2017 The input file would likely be the gamelist.txt file located in the \GameEx\DATA\ folder. Using the entry for Capcom's 1942 from the gamelist.txt file as an example: 1942w|1942|Capcom|1985|True|Shooter / Flying Vertical|True|V|224|256|1942|[-LF-]1942 is a vertically scrolling shoot 'em up set in the Asian theater of World War II. The goal is to reach Tokyo and destroy the entire Japanese air fleet. The player (the American 'Super Ace') pilots a plane, and has to shoot down enemy planes. Besides shooting, the player can also perform a 'loop-the-loop' to avoid enemy fire.[-LF-]|6[-LF-]18[-LF-]7[-LF-]8[-LF-]9[-LF-]11[-LF-]101[-LF-]301[-LF-]1551[-LF-]701[-LF-]829[-LF-]835[-LF-]872[-LF-]959[-LF-]1052[-LF-]2681[-LF-]1380[-LF-]1512[-LF-]1633[-LF-]1793[-LF-]2456[-LF-]2457[-LF-]2458[-LF-]2147[-LF-]2241[-LF-]2255[-LF-]2256[-LF-]2288[-LF-]2351[-LF-]2148[-LF-]2602[-LF-]2840[-LF-]2881[-LF-]2889[-LF-]3015[-LF-]3064[-LF-]3096|2P alt|0|False|True|joy8way||1942.c The output for 1942 in the mame.xml file (with the elements higlighted for more clarity as to what will need to be scanned in the file logic to generate a file for vertical games only): <game name="1942"> <description>1942 (Capcom 1985)</description> <rom></rom> <manufacturer>Capcom</manufacturer> <year>1985</year> <type></type> <hidedmd>True</hidedmd> <hidebackglass>True</hidebackglass> <enabled>True</enabled> <rating>0</rating> </game> In this example, just 1942 was used by B2K24 in the game name (instead of 1942w) for the xml file. In my opinion, I think that the entering the complete ROM name should be the norm. The problem this may present is duplicates in the .xml file due to multiple ROM variations of the same game. In the end, the end-user of this will probably still have to modify the .xml file to fit what they want to be displayed. Your thoughts? Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 23, 2017 Author Share Posted April 23, 2017 Just to add, I do not think it necessary to put the manufacturer name and year in parentheses next to the proper name in the description. Some do that for their own setups, but I think it would add unnecessary complexity to what I am proposing. To that end, using 1942 xml entry as an example: <game name="1942w"> <description>1942</description> <rom></rom> <manufacturer>Capcom</manufacturer> <year>1985</year> <type></type> <hidedmd>True</hidedmd> <hidebackglass>True</hidebackglass> <enabled>True</enabled> <rating>0</rating> </game> Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 23, 2017 Share Posted April 23, 2017 @Draco1962I'm in chat, Draco - go into there - easier to clarify that way Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 23, 2017 Author Share Posted April 23, 2017 I sent an email to B2K24 asking how he created his list per your suggestion, also included you as a recipient so you can see his response and respond with any questions you may have that I did not think of. 1 Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 25, 2017 Author Share Posted April 25, 2017 Ok, so... where do we go from here? Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 25, 2017 Share Posted April 25, 2017 On 23/04/2017 at 3:04 PM, Draco1962 said: <game name="1942w"> <description>1942</description> <rom></rom> <manufacturer>Capcom</manufacturer> <year>1985</year> <type></type> <hidedmd>True</hidedmd> <hidebackglass>True</hidebackglass> <enabled>True</enabled> <rating>0</rating> </game> Yerp it's certainly do-able. Could parse the gamelist.txt into a table with user-editable coulmns. This could then be exported as the required xml. Few questions: a) So you're wanting <game name> to be the rom name and not <rom> to be the rom name? I could always put an option in so each user could choose the format of <game name> (either auto-gen'd game name or rom name). Not knowing pinball, don't know how this relates to end use. b ) Do you want the last five elements (<type> to <rating>) to be user editable before export to xml? b2) Should any other fields be user editable? c) In terms of any auto-generated game names, would you want an option to remove game name tags? e.g. "1945k III (newer, OPCX2 PCB)" would become "1945k III" d) Do you want to produce lists by filters on other fields. E.g. produce lists of "Sports / Football" games e) Do you want to be able to produce custom xml lists - e.g. only user selected games via tickbox f) you say "It would also be good for said application to allow for generating .xml files specifically for vertical, horizontal, or both" - wouldn't "both" be all mame games? g) How to filter out any entries that need excluding (you may have to look through the gameslist.txt for this) - this is better figured out at this stage rather than trying to hack it later on... Maybe @B2K24 can come in at this point too to advise on anything that would be helpful. This is all a little bit different because I don't know what I'm designing for as don't use pinball at the moment, so hard to visualise how it all works. Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 25, 2017 Author Share Posted April 25, 2017 Answers below: a) So you're wanting <game name> to be the rom name and not <rom> to be the rom name? I could always put an option in so each user could choose the format of <game name> (either auto-gen'd game name or rom name). Not knowing pinball, don't know how this relates to end use. Correct. The <rom></rom> does not apply in this case for MAME. PinballX looks for the <game name> as the MAME ROM name and matches media to either the <game name> or <description> entries. b ) Do you want the last five elements (<type> to <rating>) to be user editable before export to xml? That would be nice, provided it would not be an issue for the interface to handle so many files. b2) Should any other fields be user editable? See above. c) In terms of any auto-generated game names, would you want an option to remove game name tags? e.g. "1945k III (newer, OPCX2 PCB)" would become "1945k III" Preferred. d) Do you want to produce lists by filters on other fields. E.g. produce lists of "Sports / Football" games Possibly. I know some that use PinballX that have wanted to generate a list of just Driving games as an example. So this may be a good one. e) Do you want to be able to produce custom xml lists - e.g. only user selected games via tickbox I think so but would like to see an example as I am not exactly clear on what you are describing. f) you say "It would also be good for said application to allow for generating .xml files specifically for vertical, horizontal, or both" - wouldn't "both" be all mame games? Change that to read Vertical, Horizontal, or Custom (with Custom being item 'e' above). g) How to filter out any entries that need excluding (you may have to look through the gameslist.txt for this) - this is better figured out at this stage rather than trying to hack it later on... I would say exclude electromechanical, for certain. Maybe have 2 column lists that could have entries moved from Available to Excluded columns. They would include EM, Mature, Mahjong, languages, etc. The end-user is probably going to have to do some manual editing of the xml file to remove some games manually that do not work properly for their cab and/or control panel configuration. Keep in mind that some will be a great variety in CP types in the pinball community as there is in the arcade cab community. Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 25, 2017 Share Posted April 25, 2017 Helpful. Narrowing it down. So further: a) So that would be your preference, but would other users want to be able to edit this field or have it be a different value - for example - I note B2K24 has a different format of field for this (i.e. 1942 rather than 1942w) b ) what kind of values could go in "type"? is this a list of possible values or free text? Also - what's the rating range? (guessing 0-10?) c) optional or automatic? d) Could you find me a total list of all the different genre options (e.g. "Fighter / Versus" / "Ball & Paddle / Breakout"). e) So all the game in gameslist.txt would be on a table. Along the left hand side, you'd have tickboxes for each game. You'd tick the games you want and then click "generate list" and the selected games would make a list. g) Tell me exactly what 'field/s' (i.e. the component of the gameslist.txt where I would find that that needs to be filtered) would contain the values that need to be filtered. Also let me know all the 'values' that you would want options on filtering out. So for example, where in gamelist.txt would I find "EM" or "Mature" or "languages" I've made a start already. if we can nail the above, will make it possible Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 25, 2017 Author Share Posted April 25, 2017 My response: a) So that would be your preference, but would other users want to be able to edit this field or have it be a different value - for example - I note B2K24 has a different format of field for this (i.e. 1942 rather than 1942w) Since it is the ROM name, it might be better to keep it as it displays in the gamelist.txt file. b ) what kind of values could go in "type"? is this a list of possible values or free text? For PinballX, it is either EM (electromechanical) or SS (solid state) for the types of tables available. Not sure if this can have something else entered in it as free text. Probably a Tom question. Also - what's the rating range? (guessing 0-10?) 0-5 c) optional or automatic? Not sure if this is in reference to items in b). If so, and, if this can have a free text entry, would probably then recommend entering the genre. d) Could you find me a total list of all the different genre options (e.g. "Fighter / Versus" / "Ball & Paddle / Breakout"). Refer to the catver.ini in the \gameex\DATA (or \gameex arcade edition\DATA) folder. e) So all the game in gameslist.txt would be on a table. Along the left hand side, you'd have tickboxes for each game. You'd tick the games you want and then click "generate list" and the selected games would make a list. I am assuming so tell me if I am wrong, that the filters (Vertical, Horizontal, etc.) would be applied first before final selection of the games to generate the list. If this is possible, might be preferable. g) Tell me exactly what 'field/s' (i.e. the component of the gameslist.txt where I would find that that needs to be filtered) would contain the values that need to be filtered. Also let me know all the 'values' that you would want options on filtering out. So for example, where in gamelist.txt would I find "EM" or "Mature" or "languages" Would be in the 6th delimited field - example: galsnew|Gals Panic|Kaneko|1990|True|Puzzle / Outline * Mature * Quote Link to comment Share on other sites More sharing options...
Adultery Posted April 26, 2017 Share Posted April 26, 2017 So you're using gamelist.txt for this... Wouldn't it be smarter to export the MAME.XML into a text file then do a stream read of it and convert it into an XML from there? If you're making it for PinballX, it's more likely this would be more useful with the MAME.EXE since many users won't use GameEx. Unless you plan on exporting a raw gamelist.txt with no filters (GameEx won't allow you to include mchanical anyhow) and supply it every time a MAME revision comes out... In this example snippet I write the XML to a file, Then I use that to look for rom name patterns and send the results out as a DataTable. I pulled this out of MAME Commander, so it does all types of search criteria (# of coins, # of buttons, # of players, Horiz or Vert, by Release Year, etc). It's all right there in the MAME.XML. And if you stream it through, you don't even have to load the whole file into memory. You can look for your criteria and build the XML as you go,and I modified my code to do that instead of adding the DataRow. Don't be confused by that part, I had a helper block that formats the columns and whatnot before filling the table with data and I took the references out. So really, this could be a sub the way it's used here. Here's a really rough example. But it probably would need some tweaking to work... I don't have the MAME.XML structure in front of me. First, let's save the MAME.XML as a file. Be patient, it takes a little bit. I use a "Please Wait" animation while this happens on MC. Public Sub Create_MAME_XML(ByVal xmlpath As String, Optional ByVal rom As String = Nothing) Dim p As New Process() Dim pi As New ProcessStartInfo() Try pi.FileName = Global.DracLabs.Settings.MAME_Path pi.WorkingDirectory = Path.GetDirectoryName(Global.MameCommander.Settings.MAME_Path) If rom IsNot Nothing Then pi.Arguments = "-listxml " & rom Else pi.Arguments = "-listxml" pi.RedirectStandardOutput = True pi.CreateNoWindow = True pi.UseShellExecute = False p.StartInfo = pi p.Start() Using sw As StreamWriter = File.CreateText(xmlpath) sw.Write(p.StandardOutput.ReadToEnd) End Using p.WaitForExit() p.Close() Catch ex As Exception log.Log_Error("Could not create XML!", "Create XML", ex.Message, ex.StackTrace) End Try End Sub Next, we do the search based on what might be in the rom name. For example, 1942 would return 1944w; 1944j; 1944; etc. Private Function Search_Rom_Name(ByVal Rom_Name As String) As DataTable Dim dt As DataTable = New DataTable("RomContains") Using xml_reader As XmlTextReader = New XmlTextReader(MAME_XML) While xml_reader.Read() If xml_reader.Name = "game" OrElse xml_reader.Name = "machine" Then Dim xml_doc As New XmlDocument() xml_doc.LoadXml(xml_reader.ReadOuterXml) Dim root As XmlElement = xml_doc.DocumentElement Dim rom As String = root.GetAttribute("name") If rom.Contains(Rom_Name.ToLower) Then 'Here you can pull up your working XML and add what you need into a node using a format you can read it in. 'This is where I was adding results into the DataTable before. Build_PinballX_XML(xml_doc) End If End If End While End Using Return dt End Function Finally, we take the search results and convert it into XML that PinballX understands: Private Sub Add_To_PBX_XML(ByVal mame_xml As XmlDocument) Dim pbx_xml As New System.Xml.XmlDocument() pbx_xml.Load(Global.PinballX.Xml.Path) Dim pbx_root As System.Xml.XmlElement = pbx_xml.DocumentElement Dim mame_root As System.Xml.XmlElement = mame_xml.DocumentElement Dim e As XmlElement = pbx_xml.CreateElement("game[@'" & root.Attributes("rom").Value & "']") root.AppendChild(e) For Each n As System.Xml.XmlNode In mame_root.ChildNodes Select Case n.Name.ToLower Case "description" Dim gn As XmlElement = pbx_xml.CreateElement("description") gn.InnerText = n.InnerText e.AppendChild(gn) Case "year" Dim gn As XmlElement = pbx_xml.CreateElement("year") gn.InnerText = n.InnerText e.AppendChild(gn) Case "manufacturer" Dim gn As XmlElement = pbx_xml.CreateElement("manufacturer") gn.InnerText = n.InnerText e.AppendChild(gn) End Select Next n pbx_xml.Save(Global.PinballX.Xml.Path) End Sub I would totes help but, ya know, life and whatnot. :shrug: Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 26, 2017 Share Posted April 26, 2017 I think weve come back to my original reservation which is not knowing pinball and how the end use application would work. Read enough of your post to see youre on it, adultery. Ill leave it with you as you appear to understand the end use scenario more. Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 26, 2017 Author Share Posted April 26, 2017 @stigzler - You really don't have to understand PinballX or pinball itself. The main thing is identifying the source and elements within, parsing it to output to the desired format for use by PinballX, @Adultery - Where is the MAME.xml file you are referencing? If it is part of the user's MAME install, does it have a list of the user's installed ROMs? If so, then this would be preferable as this would bypass the need to install GameEx and having to generate the gamelist.txt file. All - once the source is identified and the elements from within, then we could proceed with the GUI design and output. I really think this is doable and would be a great thing if we can keep it as simple as possible for the end-users. Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 26, 2017 Share Posted April 26, 2017 I understand, draco. But the point is it's preferable as shown by adulterys post as he could forsee dev issues that I couldn't. I think he's your best bet towards getting this developed as he's written half the code already! Other thing is I couldn't understand some of the issues not knowing pinballx so hard to pick up and run with his work... Lastly, he could do in an evening what'd take me a week! Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 26, 2017 Author Share Posted April 26, 2017 From his last post, it doesn't look like he will have the time. Oh well, not for a lack of trying. Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 26, 2017 Share Posted April 26, 2017 Can't help it.... Adultery raises a point I wondered about. I was thinking why dont we use the mame.db3 rather than parsing that txt file. However, when I looked at it, it didn't have horizontal or genre or anything.... Thus abandoned idea. However, sounds like there is a xml available with these details on? Then came the second question. Does the pinball mame.xml have to only be games the user has RomS for? For e.g. you could produce lists for all verticle games but does the user have to have all matching Roms? would it break pinball x? you could code this in of course, only add entry if Rom also exists.... Let's wait to see if A can do it. If not, happy to revisit. You work hard on the forums draconian, happy to pitch in with my bit. Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 26, 2017 Author Share Posted April 26, 2017 I will need to figure out where this mame.xml file is that Adultery is referring to. If it is something that the end-user can self-generate via MAME command line, that will have to be part of the use instructions. Ideally, would like it to be limited to those games the user has, but it is not necessary. If a game is listed that does not exist, the only problem in PinballX is that the game will be in the list, and if the user clicks on it, the screen refreshes and the user is back where they started. It will not break it or crash the system. I'll poke about a bit when I get home from work to see if I can find the file Adultery is referencing. Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 26, 2017 Author Share Posted April 26, 2017 P.S. Just found this: If you want an xml file just do this from the command line in the directory where your mame.exe is located... mame.exe -listxml > mame.xml Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 26, 2017 Share Posted April 26, 2017 Can't help it.... Adultery raises a point I wondered about. I was thinking why dont we use the name.db3 rather than parsing that txt file. However, when I looked at it, it didn't have horizontal or genre or anything.... Thus abandoned idea. However, sounds like there is a xml available with these details on? Then came the second question. Does the pinball mame.xml have to only be games the user has RomS for? For e.g. you could produce lists for all verticle games but does the user have to have all matching Roms? would it break pinball x? you could code this in of course, only add entry if Rom also exists.... Let's wait to see if A can do it. If not, happy to revisit. You work hard on the forums draconian, happy to pitch in with my bit. Quote Link to comment Share on other sites More sharing options...
stigzler Posted April 26, 2017 Share Posted April 26, 2017 Find out if this produces a list of games corresponding to user roms or full list and post example node Quote Link to comment Share on other sites More sharing options...
Draco1962 Posted April 26, 2017 Author Share Posted April 26, 2017 Will check into it when I get home tonight. Hopefully will limit to the ROMs the user has. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.