From dc827486365b3e2d47c32ea5b11f7f539fd621b0 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 3 Feb 2018 12:26:53 +0100 Subject: games/opus-magnum: Update to latest version Upstream changelog summarized: * Switch to DirectSound on Windows. * Remove iron-on patch link. * The Hexstabilized Salt puzzle now requires 18 outputs instead of 6. * Add a new journal issue that is entirely production puzzles. * Add a hidden option that will hopefully fix some of the sound issues that were introduced when we rewrote our audio backend. * Add a new issue to the journal with some "battlefield medicine" themed puzzles. * The game's content files are now opened as read-only, which should hopefully fix some of the antivirus-related crashes some players have been experiencing. * Atom spawn/consume effects on glyphs are now cleared when the simulation is stopped, which should fix a bug causing "ghost atoms" to linger on the board. I've made this summary by picking the relevant parts of the upstream Steam announcement page at: http://steamcommunity.com/games/558990/announcements The best part about the changes is that content files are now opened read-only, so we can finally drop all that patching. This also is the first time I can say something positive about AV software, so thanks for bugging Zachtronics into fixing this issue for Nix as well :-) Signed-off-by: aszlig --- pkgs/games/humblebundle/opus-magnum.nix | 83 ++------------------------------- 1 file changed, 4 insertions(+), 79 deletions(-) (limited to 'pkgs/games/humblebundle/opus-magnum.nix') diff --git a/pkgs/games/humblebundle/opus-magnum.nix b/pkgs/games/humblebundle/opus-magnum.nix index 9b6d27cd..f7b2a244 100644 --- a/pkgs/games/humblebundle/opus-magnum.nix +++ b/pkgs/games/humblebundle/opus-magnum.nix @@ -1,95 +1,20 @@ { stdenv, lib, buildGame, fetchHumbleBundle, makeWrapper, mono50 , SDL2, SDL2_image, SDL2_mixer, libvorbis - -, fetchNuGet, writeText }: -let - cecil = fetchNuGet { - baseName = "Mono.Cecil"; - version = "0.10-beta7"; - sha256 = "03bina3llcnylrfrvp5psnwrfn757j7zch5r360rpdn7gmcjjcpl"; - outputFiles = [ "lib/net40/*" ]; - }; - - patcher = writeText "patcher.cs" '' - using System.Linq; - using System.Collections.Generic; - using Mono.Cecil; - using Mono.Cecil.Cil; - using Mono.Cecil.Rocks; - - public class patcher { - public static void Main() { - var module = ModuleDefinition.ReadModule("Lightning.exe"); - var typesToPatch = new List() { - "#=qpBcj_0KQZcJ0ffkrxQcNZQ==", - "#=qEMEvBoEQXql_zRuLLk1x6w==", - "#=qZzmwsUfWWbRLjboUcCgm9sc9s0f6yVsIVJ2gWSL_c4g=", - "PsdImage" - }; - - var filtered = module.Types.Where(p => typesToPatch.Contains(p.Name)); - foreach (var toPatch in filtered) { - foreach (MethodDefinition md in toPatch.Methods) { - var il = md.Body.GetILProcessor(); - var fileStreams = md.Body.Instructions - .Where(i => i.OpCode == OpCodes.Newobj) - .Where(i => (i.Operand as MethodReference).DeclaringType - .FullName == "System.IO.FileStream"); - - foreach (Instruction i in fileStreams.ToList()) { - var fileAccessRead = il.Create(OpCodes.Ldc_I4_1); - il.InsertBefore(i, fileAccessRead); - - var ctorType = module.AssemblyReferences.Select( - x => new { - type = module.AssemblyResolver.Resolve(x) - .MainModule.GetType("System.IO.FileStream") - } - ).Where(x => x.type != null).Select(x => x.type).First(); - - string wantedCtor = "System.Void System.IO.FileStream" - + "::.ctor(System.String," - + "System.IO.FileMode," - + "System.IO.FileAccess)"; - - var newCtor = ctorType.GetConstructors() - .Single(x => x.ToString() == wantedCtor); - - var refCtor = module.ImportReference(newCtor); - il.Replace(i, il.Create(OpCodes.Newobj, refCtor)); - } - } - } - module.Write("LightningPatched.exe"); - } - } - ''; - -in buildGame rec { +buildGame rec { name = "opus-magnum-${version}"; - version = "1"; + version = "20180111"; src = fetchHumbleBundle { machineName = "opus_magnum_4vffp_linux_Z9zWf"; suffix = "zip"; - md5 = "aefe8aae8cd3dd3915be8d8cd6f3705d"; + md5 = "8bfc49528b69630f8df983fd545518bb"; }; arch = if stdenv.system == "x86_64-linux" then "x86_64" else "x86"; - nativeBuildInputs = [ makeWrapper mono50 cecil ]; - - patchPhase = '' - { export MONO_PATH=${cecil}/lib/dotnet/Mono.Cecil - mcs ${lib.escapeShellArg patcher} -out:patcher \ - -lib:${cecil}/lib/dotnet/Mono.Cecil \ - -r:Mono.Cecil -r:Mono.Cecil.Rocks - mono patcher - mv LightningPatched.exe Lightning.exe - } - ''; + nativeBuildInputs = [ makeWrapper ]; buildPhase = let dllmap = { -- cgit 1.4.1