Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. Thank you for your support. Tom Speirs

Patreon

MAME Software Lists - Database - Powershell Script


Chal021

Recommended Posts

Hey guys, I attempted to load the new MAME software list roms into gameex as an emulator but found that the existing databases dont have the filenames there for it yet. I created a powershell script that gets the XML data from the hash.xml files in MAME and outputs the naming info to a new mdb database template using that info. Thought Id share this as a stopgap measure for the community till the databases are officially updated. Feel free to use this script and modify it however you see fit. No royalties needed.

#Location of Mame Hash File XML
[xml]$xmlhash = get-content G:\0-GameEx-0\Emulators\MAME\hash\gameboy.xml
#Gets System name and stores variable to be used in name of csv file
$systemname = $xmlhash.softwarelist.name 
#Where to output the CSV file (technically a semicolon delimited file)
$csv = "G:\0-GameEx-0\GameEx\DATA\EMULATORS\$systemname.csv"
#Delete file if exists
remove-item $csv -Force
#Names of columns in destination mdb that you want these values to reflect and write to file
$line = "MAME;MAMECloneOf;Name"
$line | out-file -FilePath "$csv" -Encoding ascii -force
#For each rom listing in xml file write the filename name, if clone, and readable name to file 
foreach ($software in $xmlhash.softwarelist.software){
    $line = "$($software.name);$($software.cloneof);$($software.description)"
    $line | out-file -FilePath "$csv" -Append -Encoding ascii
}

Steps: run script (editing to point to the correct xml file in your <mameinstall>\hash folder)->import csv into a copy of database template->point emulator to use that database.

 

Hope this makes life easier :D

 

  • Like 1
Link to comment
Share on other sites

It outputs to CSV which is really just a text file with values seperated with a delimiter such as a comma. I had to do it this way because a direct import from xml, using access, didnt import the "software name" of the file. it just put all the other info under the software header. In other words it wouldnt have captured the "3punyoso" which is what the file is named.

<software name="3punyoso">
		<description>3-pun Yosou Umaban Club (Jpn)</description>
		<year>1992</year>
		<publisher>Hect</publisher>
		<info name="serial" value="DMG-U4J"/>
		<info name="release" value="19921016"/>
		<info name="alt_title" value="3分予想 馬番倶楽部"/>
		<part name="cart" interface="gameboy_cart">
			<feature name="pcb" value="DMG-GDAN-03" />
			<feature name="u1" value="U1 PRG" />
			<feature name="u2" value="U2 MBC2A" />
			<feature name="u3" value="U3 26A" />
			<feature name="batt" value="Batt CR1616" />
			<feature name="slot" value="rom_mbc2" />
			<dataarea name="rom" size="65536">
				<rom name="dmg-u4j-0.u1" size="65536" crc="cafe0d2b" sha1="76643f3f3481f7e515a24482779870862dd8b373" offset="0" />
			</dataarea>
			<dataarea name="nvram" size="8192">
			</dataarea>
		</part>
</software>

 

Link to comment
Share on other sites

Importing from CSV into db3 would most likely work as well although i havent tried it. I just used what was readily available to make a whole new database. i havent found an easy way to merge this info with current official data since the name fields are so different. Sadly i dont have the madd skillz necessary to facilitate that.

For example .. whats currently in the game boy database is: "Best of the Best: Championship Karate"

The Mame hash xml file info is: "Best of the Best - Championship Karate (Euro)"

Maybe i can write something thats a little more interactive to verify each "software" item so that human eyes can verify the fields. Maybe I can actually contribute to updating the official DBs that way. Ill also have to find a way to connect to the database via powershell instead of daisychaining the process thru a csv file. Ill let you know if Im successful.

Link to comment
Share on other sites

You may want to PM @headkaze and @greatflash as they are our two DB gurus, especially Greatflash who has been working to get the databases current for both GameEx and GameEx Evolution. They may be able to give you some pointers or lead you to some tools that will be helpful.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...