Spludlow Mame Web Header

Spludlow MAME - About


This web provides a quick and simple way to query the current MAME machines. You can search the machine name and description or the ROM SHA1 hash.

It will be automatically updated from the official MAME full driver information in XML format the software lists are from the XML in the MAME hash directory.

Some Code

The Spludlow Framework has been used to grab the MAME XML and put it into a Microsoft SQL database, here is the update code:

       /// <summary>

       /// Refresh the SQL database with the latest XML from MAME if it has changed

       /// This will be ran every 24 hours

       /// </summary>

       public static string Refresh(string connectionString, string databaseTempDirectory, string webHost, string webAppPool)


              DateTime startTime = DateTime.Now;


              string databaseName = "Mame";

              string databaseTempName = databaseName + "Temp";


              //     Download the XML (or get cached copy)

              string xmlFilename = DownloadXML();


              //     If we have already processed this version do nothing

              string name = Path.GetFileNameWithoutExtension(xmlFilename);

              string lastRefreshName = Spludlow.Variables.GetValue(LastRefreshKey);

              if (lastRefreshName != null && name == lastRefreshName)


                     Spludlow.Log.Info("MAME Data Already have: " + name);

                     return name;



              //     Convert XML to DataSet

              DataSet dataSet = Spludlow.Data.XML.ConvertRelational(xmlFilename, "machine");


              //     Create a schema from the DataSet

              DataSet schema = Spludlow.Data.ADO.Schema(dataSet, true);


              //     Add foreign keys



              //     Delete temp database if already there

              Spludlow.Data.IDAL database = Spludlow.Data.DAL.Create(connectionString);

              if (database.DatabaseExists(databaseTempName) == true)



              //     Import the DataSet to a temp SQL database

              Spludlow.Data.Schemas.ImportDatabase(schema, dataSet, connectionString, databaseTempName, null);


              DateTime offlineStart = DateTime.Now;


              //     Stop the MAME Web application pool

              if (webHost != null)


                     Spludlow.Log.Warning("Mame Data Refresh, Stopping Web Application Pool: " + webHost + ", " + webAppPool);

                     Spludlow.Admin.WebStop(webHost, webAppPool);



              //     Copy the temp database to the live database using SQL backup (for speed)

              Spludlow.Data.Database.CopyDatabaseWithBackup(connectionString, databaseTempName, databaseTempDirectory, connectionString, databaseName, databaseTempDirectory);


              //     Start the MAME Web

              if (webHost != null)


                     Spludlow.Admin.WebStart(webHost, webAppPool);



              //     Delete the temp SQL database

              database = Spludlow.Data.DAL.Create(connectionString);



              //     Record the version XML number

              Spludlow.Variables.SetValue(LastRefreshKey, name);


              //     Make the info line for the Web

              string info = MakeInfo(name, startTime, offlineStart, connectionString + "@" + databaseName);


              Spludlow.Log.Report("MAME New Data Download: " + info);


              return name;


       /// <summary>

       /// Download, Extract, and Save to Cache Directory the MAME XML from the MAME web site

       /// If already download and the same version is on the MAME web then the cached version will be used

       /// </summary>

       public static string DownloadXML()


              if (Directory.Exists(XmlCacheDirectory) == false)



              //     Download all links from MAME page

              string url = @"https://www.mamedev.org/release.php";

              string[] links = Spludlow.Html.Web.DownloadLinks(url);


              //     Find the XML ZIP link

              string xmlZipLink = null;

              foreach (string link in links)


                     if (link.EndsWith("lx.zip") == true)


                           if (xmlZipLink == null)

                                  xmlZipLink = link;


                                  throw new ApplicationException("MAME Data Too many XML links on page: " + url);



              if (xmlZipLink == null)

                     throw new ApplicationException("MAME Data Did not find XML link on page: " + url);


              //     Make the cache name

              string name = Path.GetFileNameWithoutExtension(xmlZipLink);

              string cacheFilename = XmlCacheDirectory + @"\" + name + ".xml";


              if (File.Exists(cacheFilename) == false)


                     using (Spludlow.TempDirectory tempDir = new TempDirectory())


                           //     Download the ZIP

                           string zipFilename = tempDir.Path + @"\" + name + ".zip";

                           Spludlow.Net.Http.GetDataFile(xmlZipLink, zipFilename);


                           //     Extract the ZIP

                           string extractDirectory = tempDir.Path + @"\out";


                           Spludlow.Archive.Extract(zipFilename, extractDirectory);


                           //     Copy the extracted file

                           string[] xmlFilenames = Directory.GetFiles(extractDirectory);

                           if (xmlFilenames.Length != 1)

                                  throw new ApplicationException("MAME Data Did not extract one file: " + xmlZipLink);

                           File.Copy(xmlFilenames[0], cacheFilename);




              return cacheFilename;


The entire database and schema are completely replaced on each update.

Database Diagrams

Here are the automatically generated database diagram in SSMS (click for the PDF)

MAME Machines

The main database from the driver information XML file.

MAME Software Lists

From the XML in the MAME hash directory





Spludlow Mame Web Footer