BS-X: Fixed loading .bs files from zip/7z files

This commit is contained in:
Sour 2020-04-26 12:37:01 -04:00
parent dd0287088c
commit e4441b5237
4 changed files with 6 additions and 7 deletions

View file

@ -657,8 +657,7 @@
<Message ID="FilterAvi">Avi files (*.avi)|*.avi|All Files (*.*)|*.*</Message>
<Message ID="FilterGif">GIF files (*.gif)|*.gif|All Files (*.*)|*.*</Message>
<Message ID="FilterPalette">Palette Files (*.pal)|*.pal|All Files (*.*)|*.*</Message>
<Message ID="FilterRom">All supported formats (*.sfc, *.spc, *.zip, *.7z)|*.SFC;*.SMC;*.SWC;*.FIG;*.ZIP;*.7Z;*.SPC|SNES Roms (*.sfc)|*.SFC;*.SMC;*.SWC;*.FIG|SPC Sound Files (*.spc)|*.SPC|ZIP Archives (*.zip)|*.ZIP|7-Zip Archives (*.7z)|*.7z|All (*.*)|*.*</Message>
<Message ID="FilterRomIps">All supported formats (*.nes, *.zip, *.7z, *.fds, *.nsf, *.nsfe, *.unf, *.ips, *.bps, *.ups)|*.NES;*.ZIP;*.7z;*.IPS;*.BPS;*.UPS;*.FDS;*.NSF;*.NSFE;*.UNF|NES Roms (*.nes, *.unf)|*.NES;*.UNF|Famicom Disk System Roms (*.fds)|*.FDS|NSF files (*.nsf, *.nsfe)|*.nsf;*.nsfe|ZIP Archives (*.zip)|*.ZIP|7-Zip Archives (*.7z)|*.7z|IPS/UPS/BPS Patches (*.ips, *.bps, *.ups)|*.IPS;*.BPS;*.UPS|All (*.*)|*.*</Message>
<Message ID="FilterRom">All supported formats (*.sfc, *.bs, *.spc, *.zip, *.7z)|*.SFC;*.SMC;*.SWC;*.FIG;*.ZIP;*.7Z;*.SPC;*.BS|SNES Roms (*.sfc)|*.SFC;*.SMC;*.SWC;*.FIG;*.BS|SPC Sound Files (*.spc)|*.SPC|ZIP Archives (*.zip)|*.ZIP|7-Zip Archives (*.7z)|*.7z|All (*.*)|*.*</Message>
<Message ID="FilterTest">Test files (*.mtp)|*.mtp|All (*.*)|*.*</Message>
<Message ID="FilterCheat">All supported formats (*.cht, *.xml)|*.cht;*.xml</Message>
<Message ID="FilterSavestate">Mesen-S Savestates (*.mss)|*.mss|All files (*.*)|*.*</Message>

View file

@ -1,5 +1,6 @@
using Mesen.GUI.Config;
using Mesen.GUI.Forms;
using Mesen.GUI.Utilities;
using System;
using System.Collections.Generic;
using System.IO;
@ -35,13 +36,12 @@ namespace Mesen.GUI.Emulation
}
}
public static void LoadPatchFile(string patchFile)
public static void LoadPatchFile(string patchFile)
{
string patchFolder = Path.GetDirectoryName(patchFile);
HashSet<string> romExtensions = new HashSet<string>() { ".sfc", ".smc", ".swc", ".fig" };
List<string> romsInFolder = new List<string>();
foreach(string filepath in Directory.EnumerateFiles(patchFolder)) {
if(romExtensions.Contains(Path.GetExtension(filepath).ToLowerInvariant())) {
if(FolderHelper.IsRomFile(filepath)) {
romsInFolder.Add(filepath);
}
}

View file

@ -15,7 +15,7 @@ namespace Mesen.GUI.Utilities
public static bool IsRomFile(string path)
{
string ext = Path.GetExtension(path).ToLower();
return ext == ".sfc" || ext == ".smc" || ext == ".fig" || ext == ".swc";
return ext == ".sfc" || ext == ".smc" || ext == ".fig" || ext == ".swc" || ext == ".bs";
}
public static bool IsArchiveFile(string path)

View file

@ -10,7 +10,7 @@
#include "../Utilities/IpsPatcher.h"
#include "../Utilities/UpsPatcher.h"
const std::initializer_list<string> VirtualFile::RomExtensions = { ".sfc", ".smc", ".swc", ".fig" };
const std::initializer_list<string> VirtualFile::RomExtensions = { ".sfc", ".smc", ".swc", ".fig", ".bs" };
VirtualFile::VirtualFile()
{