Skip to content

Commit a01653a

Browse files
committed
change patch cast to pointer, fix inline init
1 parent 2c24284 commit a01653a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

patch1337tocpp/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static void Main(string[] args) {
6464
foreach (var patch in patches) {
6565
var addressableName = Regex.Replace(patch.ModuleName, "([^A-Za-z0-9])+", "_");
6666

67-
w.WriteLine($"Patch {addressableName} = Patch {{ \"{patch.ModuleName}\", {{");
67+
w.WriteLine($"Patch {addressableName} = {{ \"{patch.ModuleName}\", {{");
6868

6969
foreach (var addr in patch.Patches) {
7070
w.WriteLine($"PatchAddress{{ {addr.Address}, {addr.OldByte}, {addr.NewByte} }},");
@@ -74,12 +74,12 @@ static void Main(string[] args) {
7474

7575
w.WriteLine($"void patch_{addressableName}() {{");
7676
w.WriteLine($"for (PatchAddress addr : {addressableName}.Patches) {{");
77-
w.WriteLine("PatchUChar((unsigned char*)addr.Address, (unsigned char*)addr.NewByte, 1); }");
77+
w.WriteLine("PatchUChar((unsigned char*)addr.Address, &addr.NewByte, 1); }");
7878
w.WriteLine("};");
7979

8080
w.WriteLine($"void unpatch_{addressableName}() {{");
8181
w.WriteLine($"for (PatchAddress addr : {addressableName}.Patches) {{");
82-
w.WriteLine("PatchUChar((unsigned char*)addr.Address,(unsigned char*)addr.OldByte, 1); }");
82+
w.WriteLine("PatchUChar((unsigned char*)addr.Address,&addr.OldByte, 1); }");
8383
w.WriteLine("};");
8484
}
8585

@@ -104,4 +104,4 @@ public class CommandLineOpts
104104
[Option('f', "patch_file", Required = true, HelpText = "The patch file.")]
105105
public string patchFile { get; set; }
106106
}
107-
}
107+
}

0 commit comments

Comments
 (0)