bbepis / XUnity.AutoTranslator

MIT License
2.01k stars 293 forks source link

AssetBundle hooks failure in IL2CPP #512

Open krulci opened 8 months ago

krulci commented 8 months ago

Hooks in ResourceAndAssetHooks related with AssetBundle do not work.

By the way:

        public Object[] LoadAllAssets()
        {
            return this.LoadAllAssets(typeof(Object));
        }

        public T[] LoadAllAssets<T>() where T : Object
        {
            return AssetBundle.ConvertObjects<T>(this.LoadAllAssets(typeof(T)));
        }

        public Object[] LoadAllAssets(Type type)
        {
            bool flag = type == null;
            if (flag)
            {
                throw new NullReferenceException("The input type cannot be null.");
            }
            return this.LoadAssetWithSubAssets_Internal("", type);
        }

This is from the managed unity-libs souce code Not sure why hooking public Object[] LoadAllAssets(Type type) does not work, but hooking public Object[] LoadAllAssets() works.

krulci commented 8 months ago

Not sure if there are better technique to handle overload. I simply did:

AssetBundle_LoadFromFile3_Hook
AssetBundle_LoadFromFile2_Hook
AssetBundle_LoadFromFile1_Hook