Browse Source

Removed modreq for `out` parameters

pull/63/head
Zingabopp 3 years ago
parent
commit
8ad818e1fd
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      IPA.Injector/Virtualizer.cs

+ 7
- 6
IPA.Injector/Virtualizer.cs View File

@ -70,7 +70,7 @@ namespace IPA.Injector
} }
private TypeReference inModreqRef; private TypeReference inModreqRef;
private TypeReference outModreqRef;
// private TypeReference outModreqRef;
private void VirtualizeType(TypeDefinition type) private void VirtualizeType(TypeDefinition type)
{ {
@ -119,11 +119,12 @@ namespace IPA.Injector
inModreqRef ??= module.ImportReference(typeof(System.Runtime.InteropServices.InAttribute)); inModreqRef ??= module.ImportReference(typeof(System.Runtime.InteropServices.InAttribute));
param.ParameterType = AddModreqIfNotExist(param.ParameterType, inModreqRef); param.ParameterType = AddModreqIfNotExist(param.ParameterType, inModreqRef);
} }
if (param.IsOut)
{
outModreqRef ??= module.ImportReference(typeof(System.Runtime.InteropServices.OutAttribute));
param.ParameterType = AddModreqIfNotExist(param.ParameterType, outModreqRef);
}
// Breaks override methods if modreq is applied to `out` parameters
//if (param.IsOut)
//{
// outModreqRef ??= module.ImportReference(typeof(System.Runtime.InteropServices.OutAttribute));
// param.ParameterType = AddModreqIfNotExist(param.ParameterType, outModreqRef);
//}
} }
method.IsVirtual = true; method.IsVirtual = true;


Loading…
Cancel
Save