From e4441b523730de49f52a1dd1a4135358090ced70 Mon Sep 17 00:00:00 2001 From: Sour Date: Sun, 26 Apr 2020 12:37:01 -0400 Subject: [PATCH] BS-X: Fixed loading .bs files from zip/7z files --- UI/Dependencies/resources.en.xml | 3 +-- UI/Emulation/EmuRunner.cs | 6 +++--- UI/Utilities/FolderHelper.cs | 2 +- Utilities/VirtualFile.cpp | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/UI/Dependencies/resources.en.xml b/UI/Dependencies/resources.en.xml index 86da717..5baff4d 100644 --- a/UI/Dependencies/resources.en.xml +++ b/UI/Dependencies/resources.en.xml @@ -657,8 +657,7 @@ Avi files (*.avi)|*.avi|All Files (*.*)|*.* GIF files (*.gif)|*.gif|All Files (*.*)|*.* Palette Files (*.pal)|*.pal|All Files (*.*)|*.* - 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 (*.*)|*.* - 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 (*.*)|*.* + 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 (*.*)|*.* Test files (*.mtp)|*.mtp|All (*.*)|*.* All supported formats (*.cht, *.xml)|*.cht;*.xml Mesen-S Savestates (*.mss)|*.mss|All files (*.*)|*.* diff --git a/UI/Emulation/EmuRunner.cs b/UI/Emulation/EmuRunner.cs index 5d9f378..c39bb15 100644 --- a/UI/Emulation/EmuRunner.cs +++ b/UI/Emulation/EmuRunner.cs @@ -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 romExtensions = new HashSet() { ".sfc", ".smc", ".swc", ".fig" }; List romsInFolder = new List(); foreach(string filepath in Directory.EnumerateFiles(patchFolder)) { - if(romExtensions.Contains(Path.GetExtension(filepath).ToLowerInvariant())) { + if(FolderHelper.IsRomFile(filepath)) { romsInFolder.Add(filepath); } } diff --git a/UI/Utilities/FolderHelper.cs b/UI/Utilities/FolderHelper.cs index 13f1589..ce49779 100644 --- a/UI/Utilities/FolderHelper.cs +++ b/UI/Utilities/FolderHelper.cs @@ -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) diff --git a/Utilities/VirtualFile.cpp b/Utilities/VirtualFile.cpp index a27fd49..ae25b46 100644 --- a/Utilities/VirtualFile.cpp +++ b/Utilities/VirtualFile.cpp @@ -10,7 +10,7 @@ #include "../Utilities/IpsPatcher.h" #include "../Utilities/UpsPatcher.h" -const std::initializer_list VirtualFile::RomExtensions = { ".sfc", ".smc", ".swc", ".fig" }; +const std::initializer_list VirtualFile::RomExtensions = { ".sfc", ".smc", ".swc", ".fig", ".bs" }; VirtualFile::VirtualFile() {