about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/build-support/monogame-patcher/src/patcher.cs6
-rw-r--r--pkgs/games/build-support/monogame-patcher/src/test.sh21
2 files changed, 16 insertions, 11 deletions
diff --git a/pkgs/games/build-support/monogame-patcher/src/patcher.cs b/pkgs/games/build-support/monogame-patcher/src/patcher.cs
index b35e44d6..6aeaa324 100644
--- a/pkgs/games/build-support/monogame-patcher/src/patcher.cs
+++ b/pkgs/games/build-support/monogame-patcher/src/patcher.cs
@@ -21,8 +21,12 @@ class Command {
             this.outfile = options.outputFile;
         this.infile = options.inputFile;
 
+        var resolver = new DefaultAssemblyResolver();
+        resolver.AddSearchDirectory(Path.GetDirectoryName(this.infile));
+
         var rp = new ReaderParameters {
-            ReadWrite = this.infile == this.outfile
+            ReadWrite = this.infile == this.outfile,
+            AssemblyResolver = resolver
         };
         this.module = ModuleDefinition.ReadModule(this.infile, rp);
     }
diff --git a/pkgs/games/build-support/monogame-patcher/src/test.sh b/pkgs/games/build-support/monogame-patcher/src/test.sh
index 9c51cd7e..b19457d4 100644
--- a/pkgs/games/build-support/monogame-patcher/src/test.sh
+++ b/pkgs/games/build-support/monogame-patcher/src/test.sh
@@ -51,30 +51,31 @@ class test1 {
 }
 EOF
 
-mcs a.cs -target:library -out:a.dll
-mcs b.cs -target:library -out:b.dll
+mkdir subdir
+mcs a.cs -target:library -out:subdir/a.dll
+mcs b.cs -target:library -out:subdir/b.dll
 
-mcs test1.cs -r:a -r:b -out:test1.exe
-mcs test2.cs -r:a -r:b -out:test2.exe
+mcs test1.cs -r:subdir/a -r:subdir/b -out:subdir/test1.exe
+mcs test2.cs -r:subdir/a -r:subdir/b -out:subdir/test2.exe
 
-! "$out/bin/monogame-patcher" replace-call -i test1.exe \
+! "$out/bin/monogame-patcher" replace-call -i subdir/test1.exe \
     "System.String a::replaceMe(System.String)" \
     "System.String b::notfound(System.String)" \
     test1 2> /dev/null
 
-"$out/bin/monogame-patcher" replace-call -i test1.exe \
+"$out/bin/monogame-patcher" replace-call -i subdir/test1.exe \
     "System.String a::replaceMe(System.String)" \
     "System.String b::replacement(System.String)" \
     test1
 
-test "$(mono test1.exe)" = "bar called: xxx"
+test "$(mono subdir/test1.exe)" = "bar called: xxx"
 
 echo foo > write_test.txt
 
-test "$(mono test2.exe)" = "can write"
+test "$(mono subdir/test2.exe)" = "can write"
 
-"$out/bin/monogame-patcher" fix-filestreams -i b.dll b
+"$out/bin/monogame-patcher" fix-filestreams -i subdir/b.dll b
 
-test "$(mono test2.exe)" = "can not write"
+test "$(mono subdir/test2.exe)" = "can not write"
 
 "$out/bin/monogame-patcher" --help 2>&1 | grep -q fix-filestreams