Skip to content

Commit

Permalink
fix: wrong playerdata set argument sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
Clazex committed Mar 6, 2023
1 parent ba84e1d commit 09fef8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion HKReflect.Common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Project>
<PropertyGroup>
<Version>0.1.0</Version>
<Version>0.1.1</Version>
<Authors>Clazex</Authors>

<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
10 changes: 5 additions & 5 deletions HKReflect.Fody/InstructionProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ private void ProcessFieldAccessPlayerData(Instruction inst, TypeDefinition pdTyp
.MakeGenericMethod(ModuleDefinition.ImportReference(fieldRef.FieldType)),
},
Code.Stfld => fieldRef.FieldType.FullName switch {
"System.Boolean" => pdType.Methods.First(method => method.Name == "SetBool"),
"System.Int32" => pdType.Methods.First(method => method.Name == "SetInt"),
"System.Single" => pdType.Methods.First(method => method.Name == "SetFloat"),
"UnityEngine.Vector3" => pdType.Methods.First(method => method.Name == "SetVector3"),
_ => pdType.Methods.First(method => method.Name == "SetVariable")
"System.Boolean" => pdType.Methods.First(method => method.Name == "SetBoolSwappedArgs"),
"System.Int32" => pdType.Methods.First(method => method.Name == "SetIntSwappedArgs"),
"System.Single" => pdType.Methods.First(method => method.Name == "SetFloatSwappedArgs"),
"UnityEngine.Vector3" => pdType.Methods.First(method => method.Name == "SetVector3SwappedArgs"),
_ => pdType.Methods.First(method => method.Name == "SetVariableSwappedArgs")
.MakeGenericMethod(ModuleDefinition.ImportReference(fieldRef.FieldType)),
},
Code code => throw new WeavingException($"{body.Method.FullName} contains invalid opcode {code} for accessing field {fieldRef.FullName}")
Expand Down

0 comments on commit 09fef8b

Please sign in to comment.