SamboyCoding / Cpp2IL

Work-in-progress tool to reverse unity's IL2CPP toolchain.
MIT License
1.56k stars 178 forks source link

Operand kind VectorRegisterElement not yet implemented. #301

Closed commonuserlol closed 1 week ago

commonuserlol commented 1 week ago

ARM64, log:

[Info] [Program] Invoking processing layers...
[Info] [Program]     CustomAttribute Analyzer...
[Info] [Program]     CustomAttribute Analyzer finished in 312.6536ms
[Info] [Program]     Attribute Injector...
[Info] [Program]     Attribute Injector finished in 791.902ms
[Info] [Program]     Call Analyzer...
[Verb] [Program]    Looking for Exported il2cpp_object_new function...Found at 0x20C5E94
[Verb] [Program]    Looking for Exported il2cpp_type_get_object function...Found at 0x20C5F6C
[Verb] [Program]    Looking for Exported il2cpp_resolve_icall function...Found at 0x20C5558
[Verb] [Program]    Looking for Exported il2cpp_string_new function...Found at 0x20C5EF8
[Verb] [Program]    Looking for Exported il2cpp_string_new_wrapper function...Found at 0x20C5EFC
[Verb] [Program]    Looking for Exported il2cpp_value_box function...Found at 0x20C5EB8
[Verb] [Program]    Looking for Exported il2cpp_object_unbox function...Found at 0x20C5EB4
[Verb] [Program]    Looking for Exported il2cpp_raise_exception function...Found at 0x20C5AE8
[Verb] [Program]    Looking for Exported il2cpp_runtime_class_init function...Found at 0x20C5EE0
[Verb] [Program]    Looking for Exported il2cpp_array_new_specific function...Found at 0x20C5574
[Verb] [Program]    Trying to use System.Type::IsInstanceOfType to find il2cpp::vm::Object::IsInst...IsInstanceOfType found at 0x3E1BA94...Method does not match expected signature. Aborting.
[Verb] [Program]        Mapping il2cpp_object_new to vm::Object::New...Found at 0x0
[Verb] [Program]        Mapping il2cpp_resolve_icall to Reflection::GetTypeObject...Found at 0xD059FA8
[Verb] [Program]        Mapping il2cpp_resolve_icall to InternalCalls::Resolve...Found at 0x0
[Verb] [Program]        Mapping il2cpp_string_new to String::New...Found at 0x12245EAA
[Verb] [Program]        Mapping il2cpp_string_new_wrapper to String::NewWrapper...Found at 0x12245EAA
[Verb] [Program]        Mapping String::NewWrapper to il2cpp_codegen_string_new_wrapper...Found at 0x0
[Verb] [Program]        Mapping il2cpp_value_box to Object::Box...Found at 0x0
[Verb] [Program]        Mapping il2cpp_object_unbox to Object::Unbox...Found at 0x0
[Verb] [Program]        Mapping il2cpp_raise_exception to il2cpp::vm::Exception::Raise...Found at 0x0
[Verb] [Program]        Mapping il2cpp_runtime_class_init to il2cpp:vm::Runtime::ClassInit...Found at 0x0
[Verb] [Program]        Mapping il2cpp_array_new_specific to vm::Array::NewSpecific...Found at 0x0
[Fail] [Program] Processing layer callanalyzer threw an exception: System.NotImplementedException: Operand kind VectorRegisterElement not yet implemented.
   at Cpp2IL.Core.InstructionSets.NewArmV8InstructionSet.ConvertOperand(Arm64Instruction, Int32) in /_/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs:line 340
   at Cpp2IL.Core.InstructionSets.NewArmV8InstructionSet.ConvertInstructionStatement(Arm64Instruction, IsilBuilder, MethodAnalysisContext) in /_/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs:line 62
   at Cpp2IL.Core.InstructionSets.NewArmV8InstructionSet.GetIsilFromMethod(MethodAnalysisContext) in /_/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs:line 46
   at Cpp2IL.Core.Model.Contexts.MethodAnalysisContext.Analyze() in /_/Cpp2IL.Core/Model/Contexts/MethodAnalysisContext.cs:line 133
   at Cpp2IL.Core.ProcessingLayers.CallAnalysisProcessingLayer.InjectAttribute(ApplicationAnalysisContext) in /_/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs:line 170
   at Cpp2IL.Core.ProcessingLayers.CallAnalysisProcessingLayer.Process(ApplicationAnalysisContext, Action`2 ) in /_/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs:line 25
   at Cpp2IL.Program.<>c.<MainWithArgs>b__10_1(Cpp2IlProcessingLayer processingLayer) in /home/runner/work/Cpp2IL/Cpp2IL/Cpp2IL/Program.cs:line 593
   at Cpp2IL.Program.RunProcessingLayers(Cpp2IlRuntimeArgs runtimeArgs, Action`1 run) in /home/runner/work/Cpp2IL/Cpp2IL/Cpp2IL/Program.cs:line 634
ds5678 commented 1 week ago

I suspect the solution is something akin to this:

public static InstructionSetIndependentOperand MakeVectorRegisterElement(string registerName, int elementWidth, int elementIndex) => new(OperandType.Register, new IsilVectorRegisterElementOperand(registerName, elementWidth, elementIndex));
commonuserlol commented 1 week ago

Hey, there's no IsilVectorRegisterElementOperand at least in source code

SamboyCoding commented 1 week ago

Regardless this shouldn't throw. Will fix.

commonuserlol commented 1 week ago

Thanks. Latest actions build works fine