A run-time API resolver for IL2CPP Unity.

Overview

IL2CPP Resolver

A run-time API resolver for IL2CPP Unity.

Donate

Quick Example

#include "Main.hpp"

void SomeFunction()
{
    IL2CPP::Initialize(); // This needs to be called once!

    Unity::CGameObject* pLocal = Unity::GameObject::Find("LocalPlayer");
    Unity::CComponent* pLocalData = pLocal->GetComponent("PlayerData");
    pLocalData->SetMemberValue<bool>("CanFly", true);
}

Creating Thread

void ThreadStart()
{ 
    // Stuff ... Loop ... Smth
}

void ThreadEnd()
{
    // Called after ThreadStart
}

IL2CPP::Thread::Create(ThreadStart, ThreadEnd);
Comments
  • (Question) About private fields.

    (Question) About private fields.

    Hi is there any way to get a private field from a class with IL2CPP Resolver? I am able to see it on DnSpy and Cheat Engine via .Net Info but after trying to get the class variables with IL2CPP Resolver via IL2CPP::Class::GetFields it dones't find any field m_uMaxLength is always zero. Thanks in advance.

    opened by kashiwazaki2 17
  • Trying to get value from field

    Trying to get value from field

    Hey, first of all thank you for the library it is really good and easy to expand for your needs. Hoewer i am having an issue and i am not sure if it related to library or i am missing something, So i am trying to get the value from a Field of the game i am working on.

    Here is the field i want to get, it is a member of ActorModel class (dnspy view) hp

    Here is how i am trying to retreive it on my proyect:

    int GetHp()
    		{
    			if (!MemoryMgr::IsValidPtr(this))
    				return 0;
    
    			auto m_pFieldOffset = IL2CPP::Class::Utils::GetFieldOffset(xorstr_("ActorModel"), xorstr_("get_Hp"));
    			printf("Hp Offset %i || ptr %p\r\n", *reinterpret_cast<int8_t*>(reinterpret_cast<uintptr_t>(this + m_pFieldOffset), reinterpret_cast<uintptr_t>(this) + m_pFieldOffset);
    			return *reinterpret_cast<int8_t*>(this + m_pFieldOffset);
    		}
    
    		int GetHpMax()
    		{
    			if (!MemoryMgr::IsValidPtr(this))
    				return 0;
    
    			auto m_pFieldOffset = IL2CPP::Class::Utils::GetFieldOffset(xorstr_("ActorModel"), xorstr_("get_HpMax"));
    			printf("Hp Offset %i || ptr %p\r\n", *reinterpret_cast<int8_t*>(reinterpret_cast<uintptr_t>(this + m_pFieldOffset), reinterpret_cast<uintptr_t>(this) + m_pFieldOffset);
    			return *reinterpret_cast<int8_t*>(this + m_pFieldOffset);
    		}
    

    Once i call it from any ActorModel it dones't make any exception, it just give me an invalid value like this:

    Output

    Any help is appreciated, thank you!

    opened by kashiwazaki2 4
  • IL2CPP::ResolveCall return zero

    IL2CPP::ResolveCall return zero

    IL2CPP::SystemTypeCache::Initializer::Add("CharacterManager");
    IL2CPP::ResolveCall("CharacterManager::GetCharacterByFid") -> return zero
    
    IL2CPP::Class::GetSystemType("CharacterManager") -> return address, class have in game
    auto ooooo = IL2CPP::Class::Find("CharacterManager"); -> return address same as IL2CPP::Class::GetSystemType("CharacterManager") 
    
    std::vector<Unity::il2cppMethodInfo*> methods;
    IL2CPP::Class::FetchMethods(ooooo, &methods);
    
     for (auto method : methods)
    {
     print(method->name); // return string GetCharacterByFid
    }
    
    public sealed class CharacterManager : Il2CppSystem.Object
    {
    public unsafe ActorModel GetCharacterByFid(int fid)
    }
    

    when my error?

    IL2CPP::Data.Functions.m_pResolveFunction not zero

    opened by fork1488 4
  • Docs probably outdated, example throws pointer error

    Docs probably outdated, example throws pointer error

    Hello,

    First of all I would like to say sorry for my shitty C++ skills, I've been trying to run the example of getting the GameObject list but it seems I've stumbled upon pointer hell.

    image

    Also the Unity::il2cppArray type has no m_pArray, I'm thinking this has been replaced with m_pValues?

    Other than that, the lib seems to be working fine, I've successfully printed methods of my PlayerManager class, but I have no idea how to call them. CClass has the CallMethod function, I got the method pointer through IL2CPP::Class::Utils::GetMethodPointer, but how do I get a CClass in the first place? I couldn't find a constructor and got stuck.

    I would really appreciate some support, and thank you from the bottom of my heart for the nice lib!

    opened by ReijiAzuma 3
  • What software did you use ? How did you build the .dll ?

    What software did you use ? How did you build the .dll ?

    Hi, its really not easy to know what to do with this source code, I tried Code::Block but failed, nothing worked.

    Can you tell me what software did you use ? What compiler ? And how did you build the .dll ?

    Thanks.

    opened by MoccoU 2
  • How does that work ? And how to make it work in Code::Block ?

    How does that work ? And how to make it work in Code::Block ?

    Hi,

    1 - How to make it work in Code::Block ?

    I created a new C++ Console project then in Project->Debug->Search Directories->Compiler, I clicked on Add and added the folder downloaded here containing all sources from IL2CPP_Resolver.

    But I get errors like _undefined reference to `IL2CPP::String::New(char const)'_*

    2 - How does IL2CPP_Resolver work ?

    I'm not a C++ programmer so I don't understand how this works. Do we need to compile a .DLL and inject it ? Does it find the Unity game process automatically?

    If you could answer these two questions, it would be great and I think usefull to others too. Thanks.

    opened by MoccoU 2
  • 86 Crashes

    86 Crashes

    Hey there, this project is pretty amazing (great work on it!), I've used this on many il2cpp game then tried using it on BLOCKPOST (x86 il2cpp), and when calling the initialize function i get a crash. So i went to go change the calling convention from __fastcall to __cdecl and it seemed to fix the crash. But then i am not able to get the camera main or use any other functions. Any ideas?

    opened by xo1337 2
  • Better W2S Function name? (Not fully tested)

    Better W2S Function name? (Not fully tested)

    Seems "UnityEngine.Camera::WorldToScreenPoint_Injected(UnityEngine.Vec" might be a better alternative, only requiring a Vector3 as a parameter. il2cpp_resolve_icall("UnityEngine.Camera::WorldToScreenPoint_Injected(UnityEngine.Vec"); would be used like UnityEngine.Camera::WorldToScreenPoint_Injected(this,UnityEngine.Vector3 m_vec);

    Seems the resolve icall functionality supports slightly different names for method overloads.

    opened by Glatrix 1
  • CallMethod results in a crash

    CallMethod results in a crash

    I am currently rewriting my cheat for Devour using your library but i can't call a function without an access violation happening. Original C# code (using MelonLoader) :

    NolanRankController NolanRank = UnityEngine.Object.FindObjectOfType<NolanRankController>();
    NolanRank.SetRank(50);
    

    New C++ code (using IL2CPP Resolver) :

    void OnUpdate() {
        if (settings::spoof_level) {
            Unity::CGameObject* NolanBehaviour = Unity::Object::FindObjectOfType<Unity::CGameObject>("NolanRankController");
            NolanBehaviour->CallMethodSafe<void*>("SetRank", 50);
        }
    }
    

    The code crashes at void* GetMethodPointer(Unity::il2cppClass* m_pClass, const char* m_pMethodName, int m_iArgs), line 176 of Class.cpp :

    Unity::il2cppMethodInfo* pMethod = reinterpret_cast<Unity::il2cppMethodInfo*(IL2CPP_CALLING_CONVENTION)(void*, const char*, int)>(Data.Functions.m_pClassGetMethodFromName)(m_pClass, m_pMethodName, m_iArgs);
    

    Result : "Access violation in GameAssembly.dll when reading at 0xFFFFFFFF20000133."

    What am i missing there ?

    opened by ALittlePatate 1
  •  Dictionary class?)

    Dictionary class?)

    image

    `template<typename T, typename N>
    	struct il2cppDictionary : il2cppObject
    	{
            void* buckets;
            void* entries;
            int32_t count;
            int32_t version;
            int32_t freeList;
            int32_t freeCount;
            void* comparer;
            void* keys;
            void* values;
            int32_t _syncRoot;
    	};`
    
    sorry not full, go sleeping
    
    documentation 
    opened by fork1488 4
Unity project with an example on how to run the depthai library in Android.

depthai-android-unity-example Unity project (built with Unity 2020.3.25f1) with an example on how to run the depthai library in Android. Important Thi

Ibai Gorordo 19 Dec 20, 2022
Run-time program generator embedded in C++

Run-time program generator embedded in C++

Z Guan 25 Aug 5, 2022
A run-time C++ library for working with units of measurement and conversions between them and with string representations of units and measurements

Units What's new Some of the CMake target names have changed in the latest release, please update builds appropriately Documentation A library that pr

Lawrence Livermore National Laboratory 112 Dec 14, 2022
A composable container for Adaptive ROS 2 Node computations. Select between FPGA, CPU or GPU at run-time.

adaptive_component A composable stateless container for Adaptive ROS 2 Node computations. Select between FPGA, CPU or GPU at run-time. Nodes using har

ROS 2 Hardware Acceleration Working Group 7 Sep 9, 2022
A universal way to create a noclip mod in Unity games (Mono/IIL2CPP)

Universal-Unity-NoClip This projects aim to show how a noclip mod can be created in any unity game, regardless if its using an il2cpp or mono backend.

Jonah 25 Dec 21, 2022
Adds proper Apple Pencil support to Unity's InputSystem.

This project aims to create an Apple Pencil device for Unity's InputSystem package. The problem: Unity does not fully integrate with Apple Pencil. App

Oliver Smith 13 Dec 11, 2022
A native plugin for Unity that provides simple packet division and restoration.

uPacketDivision This is a native plug-in that divides a given data (System.IntPtr or array) into specified sizes and restores them regardless of the i

hecomi 4 Feb 20, 2022
Unity Scripting in C++

Unity Native Scripting A library to allow writing Unity scripts in native code: C, C++, assembly. Purpose This project aims to give you a viable alter

Jackson Dunstan 1.2k Dec 27, 2022
Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research

Welcome to AirSim AirSim is a simulator for drones, cars and more, built on Unreal Engine (we now also have an experimental Unity release). It is open

Microsoft 13.8k Jan 8, 2023
Tests to check the determinism of the basic floating point arithmetic operations on different devices, using Unity and Rust.

This repo contains tests to check the determinism (consistency) of the basic floating point arithmetic operations (add, subtract, multiply, divide) on

Erik Roystan 9 Dec 20, 2022
Useful cmake macros that help with: compiler/linker flags, collecting sources, PCHs, Unity builds and other stuff.

ucm - useful cmake macros ucm is a collection of cmake macros that help with: managing compiler/linker flags collecting source files with grouping in

Viktor Kirilov 196 Dec 20, 2022
A lightweight additive chiptune synthesizer (LV2 and Unity Plugin)

OvenMit Synthesizer kenakofer's first ever synthesizer! Coming initially out of BMusic's excellent tutoral series for lv2 synthesizers, the developer

Kenan Schaefkofer 8 Dec 8, 2022
HLSL to GLSL language translator based on ATI's HLSL2GLSL. Used in Unity.

HLSL to GLSL shader language translator ⚠️ As of mid-2016, the project is unlikely to have any significant developments. At Unity we are moving to a d

Aras Pranckevičius 522 Dec 18, 2022
GLSL optimizer based on Mesa's GLSL compiler. Used to be used in Unity for mobile shader optimization.

GLSL optimizer ⚠️ As of mid-2016, the project is unlikely to have any significant developments. At Unity we are moving to a different shader compilati

Aras Pranckevičius 1.6k Jan 3, 2023
Unity includes a 10,000 NPC scene

luacluster 概要 luacluster分布式游戏服务器框架。特色是实现了万人同屏,实现了无缝大地图,用户开发方式为lua的rpc调用模式,已经接入mongodb。近期计划是写技术白皮书。QQ群:927073440。 [TOC] 1. BUILDING AND INSTALLATION CM

surparallel.org 224 Dec 29, 2022
Updates the Wii's current system time with the real world time.

Fix Wii System Time This is a homebrew tool I made for the Wii a while ago. It updates the current system time with the real world time via worldtimea

Puzzle 2 Nov 9, 2022
Combining Sealighter with unpatched exploits to run the Threat-Intelligence ETW Provider

Sealighter-TI Combining Sealighter with unpatched exploits and PPLDump to run the Microsoft-Windows-Threat-Intelligence ETW Provider without a signed

pat_h/to/file 58 Dec 26, 2022
An attempt to run fcitx5 on Android

fcitx5-android-poc An attempt to run fcitx5 on Android. Project status It can build, run, and print to stdout. Build Dependencies Android SDK Platform

null 527 Jan 8, 2023
anthemtotheego 402 Dec 26, 2022