Pagina 1 di 1

[SCRIPT] A.R.C.A.M.A.D.O.

Inviato: 29/04/2026, 17:29
da 0zzy
Diamo un senso a questo CIGS al 50%

Vi lascio questo script powershell che fa cose che gia altre utility fanno, ma siamo nel 2026, vuoi non usare l'ai?

Lo script A.R.C.A.M.A.D.O.(Automated Retro Compatibility & Arcade Machine Asset Distribution Orchestrator), prende in input:
- il file xml del mame (che devi aver gia creato),
- un catlist.ini anche poco piu recente della versione del mame che si sta utilizzando
- la directory dove hai il tuo romset full (chiaramente della stessa versione del mame dal quale hai estratto l'xml)
- la directory dove verranno ricopiate le sole roms di giochi arcade perfetti e imperfetti ad esclusione di bios, device, console, laserdisc, pinball e porcaria varia

Nella directory di output le roms saranno poi sudddivise in quattro sotto directory parent-orrizzontali, parent-verticali, clone-orrizzontali, clone-verticali

Lo script si lancia come qualsiasi altro script powershell

.\ARCAMADO.ps1 -XmlPath "D:\mame0278b_64bit\mame-gamelist.xml" -CatListPath "D:\mame0278b_64bit\catlist.ini" -RomSourcePath "D:\mame0278b_64bit\roms" -OutputBasePath "E:\roms-smallset" `

Codice: Seleziona tutto


param(
    [string]$XmlPath,
    [string]$RomSourcePath,
    [string]$OutputBasePath,
    [string]$CatListPath,
    [string]$DriverStatus,
    [string]$Emulation
)

# -------------------------
# FILTRI GIOCABILITÀ
# -------------------------
$allowedStatus = @("good", "imperfect")
$allowedEmu    = @("good", "imperfect")

if ($DriverStatus) {
    $allowedStatus = $DriverStatus.Split(",") | ForEach-Object { $_.Trim().ToLower() }
}

if ($Emulation) {
    $allowedEmu = $Emulation.Split(",") | ForEach-Object { $_.Trim().ToLower() }
}

# -------------------------
# CATLIST ARCADE FILTER (STRICT)
# -------------------------
function Load-ArcadeSet($path) {

    $set = New-Object 'System.Collections.Generic.HashSet[string]'
    $inArcade = $false
    $exclude = $false

    $excluded = @(
        "Board Game",
        "Card Game",
        "Electromechanical",
        "Gambling",
        "Medal Game",
        "misc",
        "music game",
        "musical instrument",
        "quiz",
        "redemption game",
        "slot machine",
        "tabletop",
        "ttl",
        "utilities"
    )

    Get-Content $path | ForEach-Object {

        $line = $_.Trim()

        if ($line -match "^\[(.+?)\]") {

            $section = $matches[1]

            $inArcade = $false
            $exclude = $false

            if ($section -like "Arcade:*") {

                foreach ($ex in $excluded) {
                    if ($section -match [regex]::Escape($ex)) {
                        $exclude = $true
                        break
                    }
                }

                if (-not $exclude) {
                    $inArcade = $true
                }
            }

            return
        }

        if ($inArcade -and -not $exclude -and $line -ne "") {
            $set.Add($line.ToLower()) | Out-Null
        }
    }

    return $set
}

# -------------------------
# ARCADE FILTER XML (TECH)
# -------------------------
function IsArcadeGame($m) {

    if ($m.isbios -eq "yes") { return $false }
    if ($m.isdevice -eq "yes") { return $false }
    if ($m.runnable -eq "no") { return $false }

    if ($m.sourcefile -match "console|computer|home|bios|handheld") { return $false }
    if ($m.sourcefile -match "laserdisc|ld-|pinball|slot|pachinko|electro") { return $false }

    return $true
}

# -------------------------
# LOAD XML
# -------------------------
[xml]$xml = Get-Content $XmlPath
$machines = $xml.SelectNodes("//machine")

$total = $machines.Count
$index = 0

# -------------------------
# LOAD ARCADE WHITELIST
# -------------------------
$arcadeSet = Load-ArcadeSet $CatListPath

# -------------------------
# MAIN LOOP
# -------------------------
foreach ($m in $machines) {

    $index++

    Write-Progress `
        -Activity "A.R.C.A.D.E." `
        -Status "$index / $total : $($m.name)" `
        -PercentComplete (($index / $total) * 100)

    # filtro tecnico XML
    if (-not (IsArcadeGame $m)) { continue }

    if (-not $m.driver) { continue }

    $status = if ($m.driver.status) { $m.driver.status.ToLower() } else { "" }
    $emu    = if ($m.driver.emulation) { $m.driver.emulation.ToLower() } else { "" }

    if (-not ($allowedStatus -contains $status)) { continue }
    if (-not ($allowedEmu -contains $emu)) { continue }

    # filtro catlist arcade
    if (-not $arcadeSet.Contains($m.name.ToLower())) {
        continue
    }

    # ROTAZIONE
    $rotate = 0
    if ($m.display.rotate) {
        $r = $m.display.rotate
        if ($r -is [Array]) { $rotate = [int]$r[0] }
        else { $rotate = [int]$r }
    }

    $orientation = if ($rotate -eq 90 -or $rotate -eq 270) { "vertical" } else { "horizontal" }

    # parent / clone
    $type = if ($m.cloneof) { "clone" } else { "parent" }

    # ROM FILE
    $romFile = "$($m.name).zip"
    $sourceFile = Join-Path $RomSourcePath $romFile

    if (-not (Test-Path $sourceFile)) { continue }

    # OUTPUT 4 CARTELLE
    $destPath = Join-Path $OutputBasePath "$type`_$orientation"

    New-Item -ItemType Directory -Force -Path $destPath | Out-Null
    Copy-Item $sourceFile $destPath -Force
}

# -------------------------
# END
# -------------------------
Write-Progress -Activity "A.R.C.A.D.E." -Completed

Write-Host ""
Write-Host "COMPLETATO"


Re: [SCRIPT] A.R.C.A.M.A.D.O.

Inviato: 29/04/2026, 18:45
da DigDug
Bello! Grazie.

Re: [SCRIPT] A.R.C.A.M.A.D.O.

Inviato: 30/04/2026, 16:15
da 0zzy
Ciao, per filtrare con piu precisone ed escludere le tipologie di giochi come Card Game, Gambling, Medal Game, music game,quiz, slot machine, ecc bisogna per forza di cose dare in input anche un file catlist.ini.
Lo script ora è aggiornato per prendere in ingresso anche tale file.