diff options
author | aszlig <aszlig@nix.build> | 2018-07-18 11:47:03 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2018-07-19 06:35:24 +0200 |
commit | ec65da1fbc93bd4fcdbdf20cb41c085ece53473c (patch) | |
tree | c73242ef0680067486de97f5ddca30fdd06bcc16 /pkgs/games/build-support/monogame-patcher/src/test.sh | |
parent | be80103bd659e922569deb9c52982a8c081fb698 (diff) |
monogame-patcher: Allow specifying extra assembly
If we want to replace a call with one that's not in a module which is currently referenced by the target file we now have another command line flag for replace-call (-a) where we can specify the additional DLL file. Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/games/build-support/monogame-patcher/src/test.sh')
-rw-r--r-- | pkgs/games/build-support/monogame-patcher/src/test.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pkgs/games/build-support/monogame-patcher/src/test.sh b/pkgs/games/build-support/monogame-patcher/src/test.sh index b19457d4..a4f65aef 100644 --- a/pkgs/games/build-support/monogame-patcher/src/test.sh +++ b/pkgs/games/build-support/monogame-patcher/src/test.sh @@ -34,6 +34,19 @@ public class b { } EOF +cat > "c.cs" <<EOF +using System; + +public class c { + public static string anotherReplacement(string foobar) { + if (foobar == "nope") + return "nope"; + Console.WriteLine("foobar called: " + foobar); + return "foobar"; + } +} +EOF + cat > "test1.cs" <<EOF class test1 { public static void Main() { @@ -54,6 +67,7 @@ EOF mkdir subdir mcs a.cs -target:library -out:subdir/a.dll mcs b.cs -target:library -out:subdir/b.dll +mcs c.cs -target:library -out:subdir/c.dll 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 @@ -70,6 +84,13 @@ mcs test2.cs -r:subdir/a -r:subdir/b -out:subdir/test2.exe test "$(mono subdir/test1.exe)" = "bar called: xxx" +"$out/bin/monogame-patcher" replace-call -i subdir/test1.exe -a subdir/c.dll \ + "System.String b::replacement(System.String)" \ + "System.String c::anotherReplacement(System.String)" \ + test1 + +test "$(mono subdir/test1.exe)" = "foobar called: xxx" + echo foo > write_test.txt test "$(mono subdir/test2.exe)" = "can write" |