您的位置:首页 > 编程语言 > C语言/C++

4.6.x IL2CPP问题汇总

2016-02-11 03:47 585 查看
使用4.6.x发布64bit游戏时, 需要用到IL2CPP做scriptingEnd. 过程中遇到了一些问题,一一记录如下。

1. 4.6.3使用IL2CPP后, ICSharpCode的ZipInputSteam read返回值不对,在64bit下不会返回0,导致解压缩一个文件夹时,持续写入第一个文件到无穷大. 解决办法: 使用unity4.6.9f1, 并下载icsharpcode源代码,自行编译最新的dll. 但是实际上,只编译icsharpcode,不使用4.6.9f1的时候, 毫无改变。所以应该是4.6.9f1改掉了一些bug

2. 4.6.9配合ulua,某些情况下会遇到无法wrap ulua类型的情况,大多数为范型, 比如List<XYZ>, 而此时打印过warning后, il2cpp会抛出一个异常Il2CppExceptionWrapper, 导致程序终止运行.解决办法:找到不能wrap的类型并绕行,或者暂时修改il2cpp生成的源代码,不理会exception, 但可能会存在更多隐患. 本次修改是加入了try catch(因为是il2cpp 生成,所以函数名可能会变,但是原理相同)

MetaFunctions_runFunctionDelegate_m11981会抛出异常,导致程序终止运行,所以改成如下有try catch的语句.

try {
L_8 = LuaCSFunction_Invoke_m18905(L_6, L_7, /*hidden argument*/NULL);
}
catch (Il2CppExceptionWrapper& e) {
}


另外一个函数

// System.Int32 LuaInterface.MetaFunctions::runFunctionDelegate(System.IntPtr)
int32_t STDCALL native_delegate_wrapper_MetaFunctions_runFunctionDelegate_m11948(intptr_t ___luaState)
{
il2cpp_native_wrapper_vm_thread_attacher _vmThreadHelper;
// Marshaling of parameter '___luaState' to managed representation
IntPtr_t ____luaState_unmarshaled;
(____luaState_unmarshaled).___m_value_0 =reinterpret_cast<void*>(___luaState);
// Managed method invocation and marshaling of return value back from managed representation
int32_t _return_value =0;
try {
_return_value = MetaFunctions_runFunctionDelegate_m11948(NULL, ____luaState_unmarshaled,NULL);
}
catch (Il2CppExceptionWrapper& e) {
//
}
// Marshaling of parameter '___luaState' to native representation
return _return_value;
}

3. 在debug下运行没问题, 在release下发现有一些莫名奇怪的crash, 比如发现指针为0x100000000. 发现debug下Optimization Level是-O0, 而release是-Os, 好吧,祝你好运,从-O2, -O1, -O0, 一个一个是过来吧, 我只有-O1才没问题。

4. 编译问题, 与c++混编链接报错, 需要添加libc++.dylib, 需要AddOther, 然后command+shift+g, 检索到/usr/lib, 然后添加.

5. 使用pomelo的服务器,发现有时候socket连接上后,handshake的包有去无回. 导致disconnect, 目前正在解决

使用tcpdump抓包,发现服务端没有数据,然后使用客户端抓包

我的iphone udid MYIPHONE_UDID

rvictl -s
MYIPHONE_UDID

rvitcl -l

sudo tcpdump -i rvi0 -n -vv | grep 192.168.1.132

sudo tcpdump -i rvi0 -vv host 192.168.1.132 and port not 8090
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: