Hamburglin Posted May 19 Share Posted May 19 (edited) Mame has a problem choosing the correct monitor to run in if you have a setup that uses multiple monitors. Monitor indexes get changed in Windows but doesn't get updated in the mame.ini. This happens when you boot with one monitor off, or unplug one and plug it back in. This is frustrating when you're trying to host an arcade cabinet and have it "just work". My games end up on the marquee screens which is a show stopper because it requires editing a text file to fix. Here's a powershell script that permanently fixes this issue. You can turn into an exe via Invoke-PS2EXE and then put into your shell:startup folder to run on boot. It runs mame in verbose mode to grab your (primary) display and then correctly uses that to overwrite the current DISPLAY setting in the mame.ini file. It then immediately shuts down mame. Change the directories to yours: #Set working dir to mame directory so that it can read and write the mame.ini Set-Location -Path "C:\Emulation\Emulators\MAME 250\" #Get-Location #Run mame in verbose to grab display info. Wait 1 second so the file can be written $proc = Start-Process -FilePath "C:\Emulation\Emulators\MAME 250\mame.exe" -ArgumentList "-verbose" -RedirectStandardOutput output.txt Start-Sleep -Seconds 1 $inputs = Get-Content -Path 'C:\Emulation\Emulators\MAME 250\output.txt' #Write-Output $inputs #Find primary DISPLAY $primarydisplayline = ($inputs | Select-String "\(primary\)").Line $primarydisplay = $primarydisplayline -replace '.*(DISPLAY\d).*',"`$1" Write-Output $primarydisplayline Write-Output $primarydisplay #Read in mame.ini $content = Get-Content -Path 'C:\Emulation\Emulators\MAME 250\mame.ini' #Write-Output $content #Edit mame.ini mouse related lines #Update DISPLAYx with primary DISPLAYy $content = $content -replace '(DISPLAY\d)',"$primarydisplay" #Write-Output $content #Write new mame.ini file $content | Set-Content -Path "C:\Emulation\Emulators\MAME 250\mame.ini" #Kill mame Get-Process -Name MAME -ErrorAction SilentlyContinue | Stop-Process -Force #Make guns rumble so we know this all worked cmd.exe /c "echo F.1.2.1 > \\.\COM11" cmd.exe /c "echo F.1.2.1 > \\.\COM12" Edited May 20 by Hamburglin 1 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.