Comments (20)
@wpdever @joywater @Magneto235
最新的提交已经解决了这个问题。
from injectfix.
dll变小,是指clr程序集么?
我以前的测试,标注一个Attribute,il2cpp后代码量挺大的,会为每一个Attribute生成一个初始化函数。这点你可以确认下。
对于“il2cpp对字段数量的限制是32767”,把一些第三方的库排除掉试试?
from injectfix.
是clr程序集变小了,因为里面没有IDMAP了。il2cpp后的代码到没有关注。
il2cpp对字段数量的限制是32767,这个应该是Unity的bug,应该是上限是65535,我把unity安装包里的dll反编译修改后,就可以了打出ios包了。
from injectfix.
ipa包体增加6M多,还可以接受。
1.31GB (1,404,329,736 字节)
1.30GB (1,398,143,846 字节)
il2cpp虽然会生成创建Attribute的函数,但是应该是每次GetCustomAttribute时调用一下,只多了些内存。
直觉IDMAP里的枚举字符串名字肯定也要在某个地方存储,虽然没在cpp的代码里搜到。
from injectfix.
“IDMAP里的枚举字符串”是反射信息的一种。应该是用文件来存储。
如果il2cpp实现的没太挫的话,这些信息应该不用常驻内存的。
from injectfix.
还有每个attitude也是要有反射信息的
from injectfix.
6M多不能和1.31G的包体比,应该和代码段比。而且苹果对应用的代码段是有大小限制的。
from injectfix.
我们这个项目特别情况,解决编译问题得三选一
- 修改unity安装目录里的dll。
- 修改Ifix的补丁索引实现。
- 少导出类。
代码段大小对我们项目不是问题了,ios 9.0 以上是400M,所以选择了第2个。
from injectfix.
有的项目还是挺case那几M代码段大小的。
你现在是已经修改并跑成功了么?
from injectfix.
嗯,跑成功了。很小的改动,增加了个XIDAttribute。
还有额外的好处,这样对注入函数的数量限制就变大了非常多,Load时查询索引的速度应该会变快。
改Unity的dll也成功了,但有些不放心,算是做个两手准备。
from injectfix.
请问官方有解决方案了吗?我们也遇到这个问题了, Unity 2018.4.7
IL2CPP error for type 'IFix.IDMAP' in assembly '/xxx.../Data/Managed/Assembly-CSharp.dll'
Additional information: Value of type 'int' is too large to convert to ushort.
from injectfix.
可以先参考我的实现,改下,在我fork的库里的local分支上的最近一次提交。
treert@980d318
官方不知道会不会这么改了。
from injectfix.
@treert 我把你的local代码下载下来,重新编译,放到工程里,生成的patch有问题
Unhandled Exception:System.NullReferenceException: Object reference not set to an instance of an object
at IFix.CecilExtensions.getAssemblyFullName (Mono.Cecil.TypeReference typeReference) [0x00000] in E:\ProjectTest\InjectFix1\InjectFix\Source\VSProj\Src\Tools\CecilExtensions.cs:133
at IFix.CecilExtensions.GetAssemblyQualifiedName (Mono.Cecil.TypeReference typeReference, Mono.Cecil.TypeReference contextType, System.Boolean skipAssemblyQualified, System.Boolean skipAssemblyQualifiedOnce) [0x001bb] in E:\ProjectTest\InjectFix1\InjectFix\Source\VSProj\Src\Tools\CecilExtensions.cs:259
at IFix.CodeTranslator.Serialize (System.IO.Stream output) [0x003e8] in E:\ProjectTest\InjectFix1\InjectFix\Source\VSProj\Src\Tools\CodeTranslator.cs:3427
from injectfix.
是个bug,修复了。注释掉两个文件,各一行代码,就好了。
treert@8efbc8c
from injectfix.
@chexiongsheng 我们也遇到函数个数太大,IDMAP过大问题,如果能保证生成Patch时,工程和原注入的dll只有修复的函数会变化,那么是否能保证patch时函数的id和原函数的id的一致的?如果一致的话,是不是可以直接把id写进patch里,而不需要用函数签名的方式来查找IDMAP的对应域来找id,这样感觉可以去掉IDMAP?
from injectfix.
1、总不能需要用户保证函数的不增不减;
2、即使不增不减,也是“应该”id不会发生变化。
最早是patch写id,但是由于你得知道之前分配的id是啥,所以以前版本的ifix得输入原来的dll,通过原来的dll获取当时分配了啥id。所以项目得保留已经注入好的线上项目对应的dll。
但是有个大项目,在全球各地区都有不同的版本,他们要保留很多版本的dll,对他们来说十分繁琐,所以改成了现在这样。
treert的方式是对代码段大小有一定的影响,很多项目对这还是比较在乎的。
不过按理说,如果去掉一些第三方库,一般自己写的代码没那么多吧?
from injectfix.
@chexiongsheng 非常感谢解答,我们的项目由于5+年,函数有10W+了,即便筛掉一些感觉不容易出错的,也还是有8 - 9W,单个IDMAP不能了,除非是实现分段IDMAP0~n,比如每1w个值存放在一个;目前只好用用XIDAttribute方式,代码段的话,估计IDMAP也要占用的吧(每个函数签名不短,估计跟XIDAttribute的占用差不多了),另外,““IDMAP里的枚举字符串”是反射信息的一种。应该是用文件来存储,不常驻内存” 这个很难说,访问过搞不好就一直在内存了(这个我没实测);
from injectfix.
treert测试过了, 他们项目多了6M,不是内存,是代码段。
from injectfix.
@treert 我打算修改这问题,加下我QQ讨论下?
from injectfix.
@treert 我打算修改这问题,加下我QQ讨论下?
你QQ号是啥
from injectfix.
Related Issues (20)
- Webgl使用问题。 HOT 2
- 催更 HOT 3
- [Bug] 文档错误Doc/quick_start.md
- 包含 as 的函数 Inject 不成功,不能对函数热更 HOT 1
- 为何不能直接使用await Task.Delay呢 HOT 1
- 如何定位到Injectfix的文件代码位置 HOT 1
- Unity 2021.3.26 无法热更 async/await HOT 5
- Unity3d 2022.3.7f1c1 IFixToolKit/IFix.exe.mdb doesn't match image HOT 1
- 对UI事件函数制作补丁,在load补丁的时候会报错
- unity2019.4.17f 安卓打包注入失败 HOT 2
- Unhandled Exception:System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. HOT 9
- InjectFix的使用范围建议? HOT 2
- InvalidProgramException: no closure wrapper for CallbackSignal`2+Action`2[Unit,System.Int32,Unit,System.Int32]
- 是否支持WebGL平台 HOT 3
- 自动化打包流程安卓生成patch文件失败
- 在unity 2022.3.14f1版本建立空工程,打包APK无法Inject。大佬可以看下问题么。
- [Unity2022.3.16]在Unity2022下Inject成功,但是在dll中没有看到IFix相关内容,热更新失效
- 如果通过 patch 文件判断是否有方法调用了处于不同程序集的 base 方法
- Tuple 数组作为参数或返回值时,不生效,但是List 可以
- 打包到客户端System.Exception: assembly may be not injected yet, cat find IFix.ILFixInterfaceBridge, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from injectfix.