diff --git a/SabreTools.Skippers/SabreTools.Skippers.csproj b/SabreTools.Skippers/SabreTools.Skippers.csproj
index f2b10d4e..4ad07811 100644
--- a/SabreTools.Skippers/SabreTools.Skippers.csproj
+++ b/SabreTools.Skippers/SabreTools.Skippers.csproj
@@ -20,18 +20,4 @@
git
-
-
-
-
-
-
- Always
-
-
-
-
-
-
-
diff --git a/SabreTools.Skippers/SkipperMatch.cs b/SabreTools.Skippers/SkipperMatch.cs
index 3a801310..93b0224a 100644
--- a/SabreTools.Skippers/SkipperMatch.cs
+++ b/SabreTools.Skippers/SkipperMatch.cs
@@ -1,9 +1,5 @@
using System.Collections.Generic;
using System.IO;
-using System.Xml;
-using System.Xml.Schema;
-using System.Xml.Serialization;
-using SabreTools.IO;
namespace SabreTools.Skippers
{
@@ -29,92 +25,17 @@ namespace SabreTools.Skippers
///
private static List? Skippers = null;
- ///
- /// Local paths
- ///
- private static readonly string LocalPath = Path.Combine(PathTool.GetRuntimeDirectory(), "Skippers") + Path.DirectorySeparatorChar;
-
///
/// Initialize static fields
///
- /// True to enable internal header skipper generation, false to use file-based generation (default)
- public static void Init(bool experimental = false)
+ public static void Init()
{
// If the list is populated, don't add to it
if (Skippers != null)
return;
- // If we're using internal skipper generation
- if (experimental)
- PopulateSkippersInternal();
-
- // If we're using file-based skipper generation
- else
- PopulateSkippers();
- }
-
- ///
- /// Populate the entire list of header skippers from physical files
- ///
- ///
- /// http://mamedev.emulab.it/clrmamepro/docs/xmlheaders.txt
- /// http://www.emulab.it/forum/index.php?topic=127.0
- ///
- private static void PopulateSkippers()
- {
- // Ensure the list exists
- Skippers ??= [];
-
- // Create the XML serializer
- var xts = new XmlSerializer(typeof(Detector));
-
- // Get skippers for each known header type
-#if NET20 || NET35
- foreach (string skipperPath in Directory.GetFiles(LocalPath, "*"))
-#else
- foreach (string skipperPath in Directory.EnumerateFiles(LocalPath, "*", SearchOption.AllDirectories))
-#endif
- {
- try
- {
- // Create the XML reader
- var xtr = XmlReader.Create(skipperPath, new XmlReaderSettings
- {
- CheckCharacters = false,
-#if NET40_OR_GREATER
- DtdProcessing = DtdProcessing.Ignore,
-#endif
- IgnoreComments = true,
- IgnoreWhitespace = true,
- ValidationFlags = XmlSchemaValidationFlags.None,
- ValidationType = ValidationType.None,
- });
-
- // Deserialize the detector, if possible
- if (xts.Deserialize(xtr) is not Detector detector || detector == null)
- continue;
-
- // Set the source file on the detector
- string sourceFile = Path.GetFileNameWithoutExtension(skipperPath);
- detector.SourceFile = sourceFile;
-
- // Set the source file on the rules
- if (detector.Rules != null)
- {
- for (int i = 0; i < detector.Rules.Length; i++)
- {
- if (detector.Rules[i] == null)
- continue;
-
- detector.Rules[i].SourceFile = sourceFile;
- }
- }
-
- // Add the skipper to the set
- Skippers.Add(detector);
- }
- catch { }
- }
+ // Generate header skippers internally
+ PopulateSkippers();
}
///
@@ -124,7 +45,7 @@ namespace SabreTools.Skippers
/// http://mamedev.emulab.it/clrmamepro/docs/xmlheaders.txt
/// http://www.emulab.it/forum/index.php?topic=127.0
///
- private static void PopulateSkippersInternal()
+ private static void PopulateSkippers()
{
// Ensure the list exists
Skippers ??= [];
diff --git a/SabreTools.Skippers/Skippers/a7800.xml b/SabreTools.Skippers/Skippers/a7800.xml
deleted file mode 100644
index de87cae8..00000000
--- a/SabreTools.Skippers/Skippers/a7800.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
- Atari 7800
- Roman Scherzer
- 1.0
-
-
-
-
-
-
-
-
-
-
diff --git a/SabreTools.Skippers/Skippers/fds.xml b/SabreTools.Skippers/Skippers/fds.xml
deleted file mode 100644
index deeebf00..00000000
--- a/SabreTools.Skippers/Skippers/fds.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
- fds
- Yori Yoshizuki
- 1.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SabreTools.Skippers/Skippers/lynx.xml b/SabreTools.Skippers/Skippers/lynx.xml
deleted file mode 100644
index c6683d73..00000000
--- a/SabreTools.Skippers/Skippers/lynx.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
- Atari Lynx
- Roman Scherzer
- 1.0
-
-
-
-
-
-
-
-
-
-
diff --git a/SabreTools.Skippers/Skippers/n64.xml b/SabreTools.Skippers/Skippers/n64.xml
deleted file mode 100644
index 93f1bac0..00000000
--- a/SabreTools.Skippers/Skippers/n64.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- Nintendo 64 - ABCD
- CUE
- 1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SabreTools.Skippers/Skippers/nes.xml b/SabreTools.Skippers/Skippers/nes.xml
deleted file mode 100644
index 67e68a8d..00000000
--- a/SabreTools.Skippers/Skippers/nes.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- Nintendo Famicon/NES
- Roman Scherzer
- 1.1
-
-
-
-
-
-
diff --git a/SabreTools.Skippers/Skippers/pce.xml b/SabreTools.Skippers/Skippers/pce.xml
deleted file mode 100644
index f3b8416b..00000000
--- a/SabreTools.Skippers/Skippers/pce.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- NEC TurboGrafx-16/PC-Engine
- Matt Nadareski (darksabre76)
- 1.0
-
-
-
-
-
-
diff --git a/SabreTools.Skippers/Skippers/psid.xml b/SabreTools.Skippers/Skippers/psid.xml
deleted file mode 100644
index 1a5586d2..00000000
--- a/SabreTools.Skippers/Skippers/psid.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
- psid
- Yori Yoshizuki
- 1.2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SabreTools.Skippers/Skippers/snes.xml b/SabreTools.Skippers/Skippers/snes.xml
deleted file mode 100644
index b971e967..00000000
--- a/SabreTools.Skippers/Skippers/snes.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- Nintendo Super Famicom/SNES
- Matt Nadareski (darksabre76)
- 1.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SabreTools.Skippers/Skippers/spc.xml b/SabreTools.Skippers/Skippers/spc.xml
deleted file mode 100644
index 829c0278..00000000
--- a/SabreTools.Skippers/Skippers/spc.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- Nintendo Super Famicon SPC
- Yori Yoshizuki
- 1.0
-
-
-
-
-
-
diff --git a/SabreTools.Test/Skippers/SkipperMatchHeaderTests.cs b/SabreTools.Test/Skippers/SkipperMatchHeaderTests.cs
index a27ed4a2..2de7333d 100644
--- a/SabreTools.Test/Skippers/SkipperMatchHeaderTests.cs
+++ b/SabreTools.Test/Skippers/SkipperMatchHeaderTests.cs
@@ -10,7 +10,7 @@ namespace SabreTools.Test.Skippers
{
public SkipperMatchHeaderTests()
{
- SkipperMatch.Init(false);
+ SkipperMatch.Init();
}
[Theory]
diff --git a/SabreTools.Test/Skippers/SkipperMatchInternalTests.cs b/SabreTools.Test/Skippers/SkipperMatchInternalTests.cs
deleted file mode 100644
index e17a5871..00000000
--- a/SabreTools.Test/Skippers/SkipperMatchInternalTests.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-using System.IO;
-
-using SabreTools.Skippers;
-using Xunit;
-
-namespace SabreTools.Test.Skippers
-{
- [Collection("SkipperMatch")]
- public class SkipperMatchInternalTests
- {
- public SkipperMatchInternalTests()
- {
- SkipperMatch.Init(true);
- }
-
- [Theory]
- [InlineData(0x01, new byte[] { 0x41, 0x54, 0x41, 0x52, 0x49, 0x37, 0x38, 0x30, 0x30})]
- [InlineData(0x64, new byte[] { 0x41, 0x43, 0x54, 0x55, 0x41, 0x4C, 0x20, 0x43, 0x41, 0x52, 0x54, 0x20, 0x44, 0x41, 0x54, 0x41, 0x20, 0x53, 0x54, 0x41, 0x52, 0x54, 0x53, 0x20, 0x48, 0x45, 0x52, 0x45 })]
- public void A7800TestInternal(int offset, byte[] content)
- {
- // Create the stream with the required input
- var ms = new MemoryStream();
- for (int i = 0; i < offset; i++)
- {
- ms.WriteByte(0xFF);
- }
-
- ms.Write(content);
- ms.Seek(0, SeekOrigin.Begin);
-
- // Check that we get a match
- var rule = SkipperMatch.GetMatchingRule(ms, string.Empty);
- Assert.NotNull(rule);
- Assert.Equal("a7800", rule.SourceFile);
- }
-
- [Theory]
- [InlineData(new byte[] { 0x46, 0x44, 0x53, 0x1A, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })]
- [InlineData(new byte[] { 0x46, 0x44, 0x53, 0x1A, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })]
- [InlineData(new byte[] { 0x46, 0x44, 0x53, 0x1A, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })]
- [InlineData(new byte[] { 0x46, 0x44, 0x53, 0x1A, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })]
-
- public void FDSTestInternal(byte[] content)
- {
- // Create the stream with the required input
- var ms = new MemoryStream();
- ms.Write(content);
- ms.Seek(0, SeekOrigin.Begin);
-
- // Check that we get a match
- var rule = SkipperMatch.GetMatchingRule(ms, string.Empty);
- Assert.NotNull(rule);
- Assert.Equal("fds", rule.SourceFile);
- }
-
- [Theory]
- [InlineData(0x00, new byte[] { 0x4C, 0x59, 0x4E, 0x58 })]
- [InlineData(0x06, new byte[] { 0x42, 0x53, 0x39 })]
- public void LynxTestInternal(int offset, byte[] content)
- {
- // Create the stream with the required input
- var ms = new MemoryStream();
- for (int i = 0; i < offset; i++)
- {
- ms.WriteByte(0xFF);
- }
-
- ms.Write(content);
- ms.Seek(0, SeekOrigin.Begin);
-
- // Check that we get a match
- var rule = SkipperMatch.GetMatchingRule(ms, string.Empty);
- Assert.NotNull(rule);
- Assert.Equal("lynx", rule.SourceFile);
- }
-
- [Theory]
- [InlineData(new byte[] { 0x80, 0x37, 0x12, 0x40 })]
- [InlineData(new byte[] { 0x37, 0x80, 0x40, 0x12 })]
- [InlineData(new byte[] { 0x40, 0x12, 0x37, 0x80 })]
- public void N64TestInternal(byte[] content)
- {
- // Create the stream with the required input
- var ms = new MemoryStream();
- ms.Write(content);
- ms.Seek(0, SeekOrigin.Begin);
-
- // Check that we get a match
- var rule = SkipperMatch.GetMatchingRule(ms, string.Empty);
- Assert.NotNull(rule);
- Assert.Equal("n64", rule.SourceFile);
- }
-
- [Fact]
- public void NESTestInternal()
- {
- // Create the stream with the required input
- var ms = new MemoryStream();
- ms.Write(new byte[] { 0x4E, 0x45, 0x53, 0x1A });
- ms.Seek(0, SeekOrigin.Begin);
-
- // Check that we get a match
- var rule = SkipperMatch.GetMatchingRule(ms, string.Empty);
- Assert.NotNull(rule);
- Assert.Equal("nes", rule.SourceFile);
- }
-
- [Fact]
- public void PCETestInternal()
- {
- // Create the stream with the required input
- var ms = new MemoryStream();
- ms.Write(new byte[] { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xBB, 0x02 });
- ms.Seek(0, SeekOrigin.Begin);
-
- // Check that we get a match
- var rule = SkipperMatch.GetMatchingRule(ms, string.Empty);
- Assert.NotNull(rule);
- Assert.Equal("pce", rule.SourceFile);
- }
-
- [Theory]
- [InlineData(new byte[] { 0x50, 0x53, 0x49, 0x44, 0x00, 0x01, 0x00, 0x76 })]
- [InlineData(new byte[] { 0x50, 0x53, 0x49, 0x44, 0x00, 0x03, 0x00, 0x7c })]
- [InlineData(new byte[] { 0x50, 0x53, 0x49, 0x44, 0x00, 0x02, 0x00, 0x7c })]
- [InlineData(new byte[] { 0x50, 0x53, 0x49, 0x44, 0x00, 0x01, 0x00, 0x7c })]
- [InlineData(new byte[] { 0x52, 0x53, 0x49, 0x44, 0x00, 0x02, 0x00, 0x7c })]
- public void PSIDTestInternal(byte[] content)
- {
- // Create the stream with the required input
- var ms = new MemoryStream();
- ms.Write(content);
- ms.Seek(0, SeekOrigin.Begin);
-
- // Check that we get a match
- var rule = SkipperMatch.GetMatchingRule(ms, string.Empty);
- Assert.NotNull(rule);
- Assert.Equal("psid", rule.SourceFile);
- }
-
- [Theory]
- [InlineData(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })]
- [InlineData(new byte[] { 0xAA, 0xBB, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 })]
- [InlineData(new byte[] { 0x53, 0x55, 0x50, 0x45, 0x52, 0x55, 0x46, 0x4F })]
- public void SNESTestInternal(byte[] content)
- {
- // Create the stream with the required input
- var ms = new MemoryStream();
- for (int i = 0; i < 0x16; i++)
- {
- ms.WriteByte(0xFF);
- }
-
- ms.Write(content);
- ms.Seek(0, SeekOrigin.Begin);
-
- // Check that we get a match
- var rule = SkipperMatch.GetMatchingRule(ms, string.Empty);
- Assert.NotNull(rule);
- Assert.Equal("snes", rule.SourceFile);
- }
-
- [Fact]
- public void SPCTestInternal()
- {
- // Create the stream with the required input
- var ms = new MemoryStream();
- ms.Write(new byte[] { 0x53, 0x4E, 0x45, 0x53, 0x2D, 0x53, 0x50, 0x43 });
- ms.Seek(0, SeekOrigin.Begin);
-
- // Check that we get a match
- var rule = SkipperMatch.GetMatchingRule(ms, string.Empty);
- Assert.NotNull(rule);
- Assert.Equal("spc", rule.SourceFile);
- }
- }
-}
\ No newline at end of file
diff --git a/SabreTools.Test/Skippers/SkipperRuleTransformTests.cs b/SabreTools.Test/Skippers/SkipperRuleTransformTests.cs
index 2928093c..dd9afafb 100644
--- a/SabreTools.Test/Skippers/SkipperRuleTransformTests.cs
+++ b/SabreTools.Test/Skippers/SkipperRuleTransformTests.cs
@@ -10,7 +10,7 @@ namespace SabreTools.Test.Skippers
{
public RuleTransformTests()
{
- SkipperMatch.Init(false);
+ SkipperMatch.Init();
}
[Theory]