Fix #3448. Support MAME 7z romsets

This commit is contained in:
CasualPokePlayer 2022-11-16 17:32:20 -08:00
parent 4479fec74d
commit d0266816a5
3 changed files with 6 additions and 3 deletions

View File

@ -780,7 +780,7 @@ namespace BizHawk.Client.Common
public static readonly IReadOnlyCollection<string> AppleII = new[] { "dsk", "do", "po" };
public static readonly IReadOnlyCollection<string> Arcade = new[] { "zip", "chd" };
public static readonly IReadOnlyCollection<string> Arcade = new[] { "zip", "7z", "chd" };
public static readonly IReadOnlyCollection<string> C64 = new[] { "prg", "d64", "g64", "crt", "tap" };

View File

@ -404,6 +404,7 @@ namespace BizHawk.Emulation.Common
break;
case ".ZIP":
case ".7Z":
game.System = VSystemID.Raw.Arcade;
break;
}

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using BizHawk.Common;
@ -35,7 +36,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
private MAMEMachineDB(string basePath)
{
using HawkFile mameMachineFile = new(Path.Combine(basePath, "mame_machines.txt"));
using var mameMachineFile = new HawkFile(Path.Combine(basePath, "mame_machines.txt"));
using var sr = new StreamReader(mameMachineFile.GetStream());
while (true)
{
@ -53,7 +54,8 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
public static bool IsMAMEMachine(string path)
{
if (_acquire == null) throw new InvalidOperationException("MAME Machine DB not initialized. It's a client responsibility because only a client knows where the database is located.");
if (Path.GetExtension(path).ToLowerInvariant() != ".zip") return false;
if (path.Contains('|')) return false; // binded archive, can't be a mame zip (note | is not a legal filesystem char, at least on windows)
if (Path.GetExtension(path).ToLowerInvariant() is not ".zip" and not ".7z") return false;
_acquire.WaitOne();
return Instance.MachineDB.Contains(Path.GetFileNameWithoutExtension(path).ToLowerInvariant());
}