Rob_G Posted February 20, 2023 Share Posted February 20, 2023 (edited) I wrote a powershell script to cleanup a full (merged) mame romset and remove the following junk: Non working Non arcade No disk dump CHD Missing Casino Mahjong Playchoice 10 Mechanical Non Runnabl Uses Software lists Clones Filtering mame xml is NOT bulletproof. There are no explicit tags for language or genre so some filtering is tedious and/or may produce undesired results. So it's best to err on the side of caution. There will be casino/mahjong games that slip by for example and this even happens with Launchbox mame import. Final tally is that this reduces a mame merged set from 15000+ files to less than 4000 files. function deletefile($file) { #Comment next line if you don't want backup #$backupfolder = "d:\backupfolder" if (($backupfolder -ne $null) -and (($backupfolder | test-path) -eq $false)) { md $backupfolder } if ((Get-ChildItem $file -ErrorAction SilentlyContinue) -eq $null) {return} if ($backupfolder -ne $null) { write-host "Moving $file.name to $backupfolder" #$file | move-item -Destination $backupfolder } else { write-host "Deleting $file" $file | Remove-Item -Force } } if ($xml -eq $null) { #Changed to wherever your mame.exe is [xml]$xml = D:\Launchbox\Emulators\Mame\mame.exe -listxml } #Change to wherever your roms are stored $dir = "Z:\roms\mame" $xml.mame.machine | ForEach-Object { $name = $_.name $romfile = $dir + "\" + $name + ".zip" #Is a bios if ($_.isbios -eq "yes") {return} #Is a device if ($_.isdevice -eq "yes") {return} # Delete rom if it has no associated input or coins is null if ($_.input -eq $null) { deletefile $romfile return } $checkforcoin = $null $checkforcoin = ($_ | select -ExpandProperty input).coins if ($checkforcoin -eq $null) { deletefile $romfile return } #Unplayable if ($_.driver.status -eq "preliminary") {deletefile $romfile;return} #No disk dump if ($_.disk.status -eq "nodump") {deletefile $romfile;return} #Missing CHD if ($_.disk.status -eq "good") { $chdname = $dir + "\" + $_.name + "\" + $_.disk.name + ".chd" $checkdir = $null $checkdir = Get-ChildItem $chdname -ErrorAction SilentlyContinue if ($checkdir -eq $null) {deletefile $romfile;return} } #Not runnbable if ($_.runnable -eq "no") {deletefile $romfile;return} #Mechanical if ($_.ismechanical -eq "yes") {deletefile $romfile;return} #Description keywords #Playchoice isn't necessary #I think most rhythm games are unplayable as well if ($_.description -match "playchoice|mahjong|percussion|rhythm|beatmania") {deletefile $romfile;return} #Slot machine if ($_.manufacturer -match "Videos A A|QPS|IGT - International Game Technology|Aristocrat|Igrosoft") {deletefile $romfile;return} if ($_.description -match "casino|gamble|slot|fruit|mazooma|gaminator|poker") {deletefile $romfile;return} if ($_.sourcefile -match "barcrest|goldstar.cpp") {deletefile $romfile;return} #A few junk stragglers if ($_.sourcefile -match "nes_clone.cpp|att3b2.cpp|telercas|tvgames|skeleton|aristocrat|casio|yamaha|famibox") {deletefile $romfile;return} #Uses softwarelist if ($_.softwarelist -ne $null) {deletefile $romfile;return} #Is a clone. Not sure we keep or not. Disabled next line for now #if ($_.cloneof -ne $null) {deletefile $romfile;return} } Edited March 10, 2023 by Rob_G 2 Quote Link to comment Share on other sites More sharing options...
Rob_G Posted March 10, 2023 Author Share Posted March 10, 2023 (edited) Ok, one thing I had not counted on was that device roms are not included with the game roms. So for example, Arkanoid won't launch if mame cannot find m68705p3.zip which is a processor device rom. The solution is going to be to not touch device (or bios) zip files now. I have updated the script to leave these alone. Also, I have added a backup option to move files to another location instead of just deleting them if that is what you want. I updated the script in the first post. Rob Edited March 10, 2023 by Rob_G 1 Quote Link to comment Share on other sites More sharing options...
DerSchlachter Posted April 15, 2023 Share Posted April 15, 2023 Thank you, i will check the result in my Test-Setup 🤠 Quote Link to comment Share on other sites More sharing options...
Rob_G Posted April 15, 2023 Author Share Posted April 15, 2023 3 hours ago, DerSchlachter said: Thank you, i will check the result in my Test-Setup 🤠 I've changed my approach a bit now. Instead of deleting items, I just hide them by changing the hidden element in the platform or gamelist xml. I don't have anything written for launchbox (yet), but I did write something for batocera already.. Same principle though. This keeps everything in place like bios and device files which are needed, but hides them since they aren't actually games to play. Rob Quote Link to comment Share on other sites More sharing options...
DerSchlachter Posted April 16, 2023 Share Posted April 16, 2023 (edited) That sounds interesting, if you like you can keep us up to date. I took a closer look at a full import and removed many games such as chess computers, calculators, Mahjong, Casino and games that require a physical device. 400 games have already come together. Edited April 16, 2023 by DerSchlachter Quote Link to comment Share on other sites More sharing options...
SKamber Posted October 8, 2023 Share Posted October 8, 2023 how to use this script? 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.