From 66716d27b5cf347c490b4f4a73a78bb1c21905dc Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 20 Aug 2018 21:37:31 +1200 Subject: [PATCH 1/9] Re-added test project --- Mamesaver.sln | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Mamesaver.sln b/Mamesaver.sln index dc03e8f..4f3a0b0 100644 --- a/Mamesaver.sln +++ b/Mamesaver.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mamesaver", "Mamesaver\Mame EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MamesaverDeploy", "MamesaverDeploy\MamesaverDeploy.wixproj", "{896ED757-66C2-4C7E-9323-FC5D9CC7B7D2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mamesaver.Test", "Mamesaver.Test\Mamesaver.Test.csproj", "{98F0D731-FC1C-4659-8EEB-7489331621D6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -26,6 +28,10 @@ Global {896ED757-66C2-4C7E-9323-FC5D9CC7B7D2}.Debug|Any CPU.ActiveCfg = Debug|x86 {896ED757-66C2-4C7E-9323-FC5D9CC7B7D2}.Release|Any CPU.ActiveCfg = Release|x86 {896ED757-66C2-4C7E-9323-FC5D9CC7B7D2}.Release|Any CPU.Build.0 = Release|x86 + {98F0D731-FC1C-4659-8EEB-7489331621D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {98F0D731-FC1C-4659-8EEB-7489331621D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {98F0D731-FC1C-4659-8EEB-7489331621D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {98F0D731-FC1C-4659-8EEB-7489331621D6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 77cf8451344e0d602543e09fde863b96e12bb7e4 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 20 Aug 2018 21:51:53 +1200 Subject: [PATCH 2/9] Added package restore hint --- Mamesaver.Test/Mamesaver.Test.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Mamesaver.Test/Mamesaver.Test.csproj b/Mamesaver.Test/Mamesaver.Test.csproj index f588e6a..3908db9 100644 --- a/Mamesaver.Test/Mamesaver.Test.csproj +++ b/Mamesaver.Test/Mamesaver.Test.csproj @@ -18,6 +18,7 @@ UnitTest + PackageReference true From 43c2b664a002c5223259d72c4a63564c1a9b15eb Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 20 Aug 2018 22:05:59 +1200 Subject: [PATCH 3/9] Added Appveyor yml --- Appveyor.yml | 9 +++++++++ Mamesaver.sln | 1 + 2 files changed, 10 insertions(+) create mode 100644 Appveyor.yml diff --git a/Appveyor.yml b/Appveyor.yml new file mode 100644 index 0000000..c7fc18e --- /dev/null +++ b/Appveyor.yml @@ -0,0 +1,9 @@ +version: 1.0.{build} +image: Visual Studio 2017 +environment: + EnableNuGetPackageRestore: true +before_build: +- cmd: >- + nuget restore +build: + verbosity: minimal \ No newline at end of file diff --git a/Mamesaver.sln b/Mamesaver.sln index 4f3a0b0..b2bfd65 100644 --- a/Mamesaver.sln +++ b/Mamesaver.sln @@ -5,6 +5,7 @@ VisualStudioVersion = 15.0.27703.2042 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{45991C83-871A-4411-BA15-2A850C9EA855}" ProjectSection(SolutionItems) = preProject + Appveyor.yml = Appveyor.yml LICENCE.TXT = LICENCE.TXT README.md = README.md EndProjectSection From 239603209265c312a92a1502d6160a201b0c06b5 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 15 Jun 2019 12:30:11 +1200 Subject: [PATCH 4/9] #52 removed prefer 32-bit hint, allowing mamesaver.scr to be manually installed in c:\windows\system32 --- Mamesaver/Mamesaver.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Mamesaver/Mamesaver.csproj b/Mamesaver/Mamesaver.csproj index 6b7520f..449500b 100644 --- a/Mamesaver/Mamesaver.csproj +++ b/Mamesaver/Mamesaver.csproj @@ -58,6 +58,7 @@ false prompt MinimumRecommendedRules.ruleset + false From 0e0376d6e84e48a00bcbce961d1b22ca3ddb9500 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 15 Jun 2019 13:17:17 +1200 Subject: [PATCH 5/9] Tidying --- Mamesaver/Services/Mame/MameInvoker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mamesaver/Services/Mame/MameInvoker.cs b/Mamesaver/Services/Mame/MameInvoker.cs index 7a1b6d7..fc2c375 100644 --- a/Mamesaver/Services/Mame/MameInvoker.cs +++ b/Mamesaver/Services/Mame/MameInvoker.cs @@ -120,9 +120,9 @@ public Process Run(bool start, params string[] arguments) /// Registers a MAME process for automatic termination on shutdown. /// /// - public void Register(Process process) => _processes.Add(process); + private void Register(Process process) => _processes.Add(process); - public virtual void Dispose(bool disposing) + protected virtual void Dispose(bool disposing) { if (!disposing) return; TryStopProcesses(); From da3e85498f9052e765390adc85b6d88c9976aa73 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 15 Jun 2019 13:19:19 +1200 Subject: [PATCH 6/9] #53 added support for older versions of MAME which only support single games as arguments for validation and metadata extraction --- Mamesaver/Services/Mame/GameListBuilder.cs | 35 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/Mamesaver/Services/Mame/GameListBuilder.cs b/Mamesaver/Services/Mame/GameListBuilder.cs index 2a14ee8..8a7678f 100644 --- a/Mamesaver/Services/Mame/GameListBuilder.cs +++ b/Mamesaver/Services/Mame/GameListBuilder.cs @@ -24,7 +24,7 @@ public class GameListBuilder /// Number of ROMs to process per batch. Rom files are batched when passing as arguments to Mame both /// to minimise processing time and to allow a visual indicator that games are being processed. /// - private const int RomsPerBatch = 50; + private const int DefaultRomsPerBatch = 50; /// /// Settings for parsing MAME's listxml output @@ -57,9 +57,22 @@ public List GetGameList(Action progressCallback) var games = new List(); // Enrich game metadata for each verified game - var verifiedGames = GetVerifiedSets(progressCallback).Keys; + var verifiedGames = GetVerifiedSets(progressCallback).Keys.ToList(); var romFiles = GetRomFiles(); + try + { + return GetGameList(progressCallback, romFiles, verifiedGames, games, DefaultRomsPerBatch); + } + catch (XmlException) + { + // Fallback for old versions of MAME which don't support extracting game details for multiple games at a time + return GetGameList(progressCallback, romFiles, verifiedGames, games, 1); + } + } + + private List GetGameList(Action progressCallback, List romFiles, List verifiedGames, List games, int romsPerBatch) + { // Get details for each verified ROM var index = 0; @@ -68,14 +81,14 @@ public List GetGameList(Action progressCallback) var romsProcessed = romFiles.Count + (romFiles.Count - verifiedGames.Count); List romsToProcess; - while ((romsToProcess = verifiedGames.Skip(index).Take(RomsPerBatch).ToList()).Any()) + while ((romsToProcess = verifiedGames.Skip(index).Take(romsPerBatch).ToList()).Any()) { using (var stream = GetGameDetails(romsToProcess)) { games.AddRange(GetRomDetails(stream)); } - index += RomsPerBatch; + index += romsPerBatch; romsProcessed += romsToProcess.Count; // There are two distinct phases in the game list builder, so we are halving the processed count @@ -201,6 +214,16 @@ private static bool IsGameValid(XElement element, string name) /// are returned in the value of the dictionary while the name is used as the key. /// private IDictionary GetVerifiedSets(Action progressCallback) + { + var verifiedSets = GetVerifiedSets(progressCallback, DefaultRomsPerBatch); + if (verifiedSets.Any()) return verifiedSets; + + // Cater for old versions of MAME which only support verifying a single ROM at a time + verifiedSets = GetVerifiedSets(progressCallback, 1); + return verifiedSets; + } + + private IDictionary GetVerifiedSets(Action progressCallback, int romsPerBatch) { var verifiedRoms = new Dictionary(); var regex = new Regex(@"romset (\w*)(?:\s\[(\w*)\])? is good"); //only accept the "good" ROMS @@ -212,7 +235,7 @@ private IDictionary GetVerifiedSets(Action progressCallback var filesProcessed = 0; List filesToVerify; - while ((filesToVerify = romFiles.Skip(index).Take(RomsPerBatch).ToList()).Any()) + while ((filesToVerify = romFiles.Skip(index).Take(romsPerBatch).ToList()).Any()) { var arguments = new List { "-verifyroms" }.Concat(filesToVerify).ToArray(); using (var stream = _invoker.GetOutput(arguments)) @@ -227,7 +250,7 @@ private IDictionary GetVerifiedSets(Action progressCallback } } - index += RomsPerBatch; + index += romsPerBatch; filesProcessed += filesToVerify.Count; // There are two distinct phases in the game list builder, so we are halving the processed count From cce9a359b04e692a936c6d44b478f0445c26bfff Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 15 Jun 2019 13:53:14 +1200 Subject: [PATCH 7/9] Bumped version, added note about compatible versions --- Mamesaver/Properties/AssemblyInfo.cs | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Mamesaver/Properties/AssemblyInfo.cs b/Mamesaver/Properties/AssemblyInfo.cs index 0d0c0e1..ced263a 100644 --- a/Mamesaver/Properties/AssemblyInfo.cs +++ b/Mamesaver/Properties/AssemblyInfo.cs @@ -29,4 +29,4 @@ // Revision // [assembly: AssemblyVersion("3.0.*")] -[assembly: AssemblyFileVersion("3.0")] +[assembly: AssemblyFileVersion("3.0.1")] diff --git a/README.md b/README.md index 5f0b4ce..d1f9458 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ - [Open source](#open-source) -v3.0 +v3.0.1 Licensed under The MIT License [![Build status](https://ci.appveyor.com/api/projects/status/2b8n7te1bq8rf1pp?svg=true)](https://ci.appveyor.com/project/mmihajlovic/mamesaver) @@ -33,7 +33,7 @@ Mamesaver is a Windows screen saver that runs MAME with a random game for specif ### REQUIREMENTS * Microsoft .NET 4.6 -* A working installation of MAME. I used 0.200 but older ones will probably work too. +* A working installation of MAME. Versions from 0.155 have been tested, but earlier versions may also work. * Some working ROMS which can run in MAME successfully. * Each ROM that is installed should have been run at least once to remove the initial disclaimer screen as this is the last thing you want to see when the screen saver is running. From 9093e82ecb0073b1b0a9ee5303117ff506e50107 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 15 Jun 2019 13:53:28 +1200 Subject: [PATCH 8/9] Added support for earlier versions of MAME --- Mamesaver/Services/Mame/GameListBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mamesaver/Services/Mame/GameListBuilder.cs b/Mamesaver/Services/Mame/GameListBuilder.cs index 8a7678f..2d1afad 100644 --- a/Mamesaver/Services/Mame/GameListBuilder.cs +++ b/Mamesaver/Services/Mame/GameListBuilder.cs @@ -122,7 +122,7 @@ private List GetRomDetails(StreamReader stream, bool verify = tr reader.ReadStartElement("mame"); // Read each machine, enriching metadata for verified sets - while (reader.Read() && reader.Name == "machine") + while (reader.Read() && (reader.Name == "machine" || reader.Name == "game")) { // Read game metadata var element = (XElement)XNode.ReadFrom(reader); From 6fe38dcbf707742cf05f1917dda6bd6df407c03d Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 16 Jun 2019 21:49:26 +0100 Subject: [PATCH 9/9] Updated Appveyor to match build pipeline --- Appveyor.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Appveyor.yml b/Appveyor.yml index c7fc18e..8a0811e 100644 --- a/Appveyor.yml +++ b/Appveyor.yml @@ -1,9 +1,19 @@ version: 1.0.{build} image: Visual Studio 2017 -environment: - EnableNuGetPackageRestore: true +configuration: +- Release +- Repack +platform: Any CPU before_build: -- cmd: >- - nuget restore +- cmd: nuget restore build: - verbosity: minimal \ No newline at end of file + verbosity: minimal +artifacts: +- path: MamesaverDeploy\bin\Repack\Mamesaver.msi + name: Mamesaver.msi +- path: Mamesaver\bin\Repack\Mamesaver.scr + name: Mamesaver.scr +- path: Mamesaver\bin\Repack\*.dll + name: dlls +- path: Mamesaver\bin\Repack\Mamesaver.exe + name: repack exe \ No newline at end of file