Jump to content
LaunchBox Community Forums

How to make MAME set smaller to fit on a smaller harddrive to use on Big Box


SLUGIE79
Go to solution Solved by faeran,

Recommended Posts

hi guys
I’m just wondering if there is an easy way to import my Mame arcade collection from launch box onto another PC as I have an 8TB harddrive in my main pc but I have a small form factor PC in my living room which I would like to use mainly for MAME games and some other games that I like to play from different consoles.
I have a 2 TB hard drive 2.5 inch and my MAME rom set is roughly 500gb with all the zipped games and CHD files.
When I did the important to launch box at roughly scraped 3000 games, and what I would like to do is delete all the other games, except for the 3000 games to save space on my hard drive.
Is there an easy way to do this or is it a case of going through every game and delete and the rest inc CHD files that go with the games that are not scraped.
Thank you in advance

Edited by SLUGIE79
Link to comment
Share on other sites

I doubt there's anything built into Launchbox for this but you're right that there are a lot of useless CHD files for non-working games that takes up a LOT of hard drive space.

I wrote a PowerShell script that uses the -listxml output from mame.exe to filter non-working CHD files and moves them to a subdirectory.  It could probably be adapted to move non-working roms too, but I'm not concerned with the rom hard drive space.  Space taken up by roms is nothing compared to CHDs.

I run the script every time I update my MAME rom and CHD set to a new version.

Link to comment
Share on other sites

Hi There 

Is there any chance you could send me the script and instructions on how to do it.

If i understand correctly it will add a separate list with zip files and CHD so that i can delete them on Launch box so it deletes them in my MAME rom folder or do you use the script to delete them in MAME rom folder directly .

 

Thank you

Link to comment
Share on other sites

  • Solution

This will only work if you use a Non-merged set.

But, you could go to your Arcade platform, select all the games, and run the Tools > File Management > Export/Copy ROM files from Selected Games to New Folder...

It will make a copy of all your imported games into a new folder, which should work out to about 20GB.

This won't bring over your CHD files, but if you have the CHD Requred playlist you could identify which CHD games you have, and manually move over the ones you have ROMs for.

This part of the MAME video shows it in action:

Again, this will only work if you use a non-merged set.

 

Link to comment
Share on other sites

Hi There 

Thank you so much for that im pretty sure that i dont have a merged set and i have a split set, would that work?

just to be clear if im correct a merged set will have a zip folder with every region version of that game in side of it and a non merged version has a all the different region versions of that game in separate zip files?

I’m assuming that the 20 GB is just for the zip files, and then I import the CHD is over separately 

I will make a separate playlist on my original big box for CHD files find out what games they are in the names of the CHD files, transfer them over and then delete the CHD playlist afterwards

When i copy the roms I will still have them in my original set up and I’m assuming this will work with any platform so I can just pick random games from platforms to add on there to take up less space on  the harddrive?

Thank you this has been really helpful and will save me lot of time I will just copy over the emulators as they are then copy the roms and let big box add the artwork for them so is less space is used on the hard drive.

Edited by SLUGIE79
adding more information
Link to comment
Share on other sites

6 hours ago, SLUGIE79 said:

Thank you so much for that im pretty sure that i dont have a merged set and i have a split set, would that work?

 

As stated, this will only work with a non-merged set. This will appear to work with merged and split sets, but then you'll find a lot of your games will not work due to missing files. The reason it works with non-merged is because it's the only set where every file actually equals 1 full game (not including CHD files)

6 hours ago, SLUGIE79 said:

just to be clear if im correct a merged set will have a zip folder with every region version of that game in side of it and a non merged version has a all the different region versions of that game in separate zip files?

 

Not just regional versions, but yes, it's sort of like that. The video I posted has a section that will tell you the differences, so it's a good watch.

6 hours ago, SLUGIE79 said:

I’m assuming that the 20 GB is just for the zip files, and then I import the CHD is over separately 

 

That's correct

6 hours ago, SLUGIE79 said:

When i copy the roms I will still have them in my original set up and I’m assuming this will work with any platform so I can just pick random games from platforms to add on there to take up less space on  the harddrive?

 

Yup

 

Link to comment
Share on other sites

On 10/30/2024 at 2:40 AM, SLUGIE79 said:

Hi There 

Is there any chance you could send me the script and instructions on how to do it.

If i understand correctly it will add a separate list with zip files and CHD so that i can delete them on Launch box so it deletes them in my MAME rom folder or do you use the script to delete them in MAME rom folder directly .

 

Thank you

The PowerShell script is below.  Save those contents to a file named anything you want as long as it has a .ps1 extension.  I call mine "MAME_CHD_CLEANUP.ps1".  If you've never worked with PowerShell scripts before, you'll want to research how to run PS scripts separately.  PS takes a bit of initial config and tricks to run scripts manually.  You can't simply double-click on the file and run it.

Change the $mamepath and $CHDpath variables in the script to point to your mame.exe and the directory where your CHD files are located.

NOTE: This will also KEEP (i.e., not move to the ~NONWORKING subdirectory) CHD files associated with the various Sega platforms that have their own emulators.  I.e.,  Flycast (Naomi, Naomi2, and Atomiswave), Model 2, and Supermodel (Model 3).

 

I keep a separate copy of my mame roms and CHDs from the "working" copy that I actually use to run the games.  I also keep my rom files and my CHD files in separate subdirectories.  So I run this script on that raw, original copy of the CHD files.

The script doesn't "delete" anything.  It just moves CHD files associated with non-working MAME games into a subdirectory called "~NONWORKING".  Then I copy the remaining CHD files (the ones that did NOT get moved to the ~NONWORKING subdirectory) over to the directory location where they're used to actually play the games.

I do this for two reasons.  1) If I find I'm missing a CHD that I really do need, I can copy it back out of the ~NONWORKING subdirectory.  2) It makes it easier to update the MAME set when I want to.  If I'm missing files when I update the set, the update has to redownload them all again.  So when I update, I move the non-working CHDs back to the main directory, update the set, then re-run the script.

Also note, this script does not do anything with the base MAME rom files.  By comparison to the CHD files, the rom files for non-working games takes up little enough space that I don't care about cleaning them up.

 

#Script to determine only working MAME games that require CHDs
#so my actual MAME PC doesn't need to have so much hard drive
#space taken up by CHD files for non-working games.

#Also KEEPS CHD files needed by Sega platforms that have other emulators.
#I.e., Naomi, Naomi2, Atomiswave, Model 2, Model 3

#This script will create a "~NONWORKING" subdirectory under the specified
#CHDs path and move the CHDs for non-working games to that subdirectory.

#Set the path of the mame.exe file
$mamepath = "C:\EMULATOR\mame\mame.exe"

#Set CHD directory path
$CHDpath = "C:\MAME_Torrents\MAME 0.271 CHDs (merged)"


Clear-Host
"`n`n`n"


if (-not (Test-Path $mamepath)) {
    "MAME path does not exist. Quitting.`n$mamepath`n`n"
    Exit
}

if (-not (Test-Path $CHDpath)) {
    "CHD path does not exist.  Quitting.`n$CHDpath`n`n"
    Exit
}


"Please wait.  Generating listxml from mame.exe...`n`n"
Get-Date


#Generate listxml.xml from mame.exe and import as a PowerShell object
#    Out-String is needed to keep the output as a single string rather than an array of strings for each line of text, to then convert to the xml object
[xml]$listxml = & "$mamepath" -listxml | Out-String


#Select machines that use a disk file, that are "imperfect" status
$machines = $listxml.mame.machine |
Where-Object {$_.disk -ne $null -and (($_.driver.status -eq 'preliminary' -or $_driver.emulation -eq 'preliminary') -and -not (($_.sourcefile -eq 'sega/naomi.cpp') -or ($_.sourcefile -eq 'sega/dc_atomiswav.cpp') -or ($_.sourcefile -eq 'sega/model2.cpp') -or ($_.sourcefile -eq 'sega/model3.cpp')))}


#Create the ~NONWORKING subdirectory
New-Item -ItemType Directory -Force -Path "$CHDpath\~NONWORKING" | Out-Null


"Moving nonworking CHDs to ~NONWORKING subdirectory...`n`n"


#Loop through and move the selected CHD files.
foreach ($machine in $machines) {
    if (Test-Path $CHDpath\$($machine.name)) {
        "Moving $CHDpath\$($machine.name)"
        Move-Item -Path $CHDpath\$($machine.name) -Destination $CHDpath\~NONWORKING
    }
}


Get-Date
"FINISHED.`n`n`n"

 

  • Thanks 1
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...