diff --git a/native/.gitignore b/native/.gitignore index 318a1fd176..e79ff5fdff 100644 --- a/native/.gitignore +++ b/native/.gitignore @@ -10,6 +10,9 @@ Thumbs.db /prebuilt_mk*.zip /simulator.json +# Ignore xcodeproj for backup +/simulator.xcodeproj + # Ignore files build by Visual Studio *.obj *.exe diff --git a/native/cocos/cocos2d.cpp b/native/cocos/cocos2d.cpp index 5e806e8be7..6ca64f60aa 100644 --- a/native/cocos/cocos2d.cpp +++ b/native/cocos/cocos2d.cpp @@ -31,7 +31,7 @@ NS_CC_BEGIN CC_DLL const char* cocos2dVersion() { - return "1.6.2"; + return "1.7.0"; } NS_CC_END diff --git a/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-zh.md b/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-zh.md index b0081dcc7d..a257d70ebe 100644 --- a/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-zh.md +++ b/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-zh.md @@ -835,7 +835,7 @@ classes_owned_by_cpp = #### Windows -* 运行游戏 +* 编译、运行游戏(或在Creator中直接使用模拟器运行) * 用Chrome浏览器打开[chrome-devtools://devtools/bundled/inspector.html?v8only=true&ws=127.0.0.1:5086/00010002-0003-4004-8005-000600070008](chrome-devtools://devtools/bundled/inspector.html?v8only=true&ws=127.0.0.1:5086/00010002-0003-4004-8005-000600070008) 断点调试: @@ -849,7 +849,8 @@ Profile #### Android -* 运行游戏 +* 保证Android设备与PC或者Mac在同一个局域网中 +* 编译,运行游戏 * 用Chrome浏览器打开[chrome-devtools://devtools/bundled/inspector.html?v8only=true&ws=xxx.xxx.xxx.xxx:5086/00010002-0003-4004-8005-000600070008](chrome-devtools://devtools/bundled/inspector.html?v8only=true&ws=xxx.xxx.xxx.xxx:5086/00010002-0003-4004-8005-000600070008), 其中`xxx.xxx.xxx.xxx`为局域网中Android设备的IP地址 * 调试界面与Windows相同 @@ -861,16 +862,25 @@ Profile 1. 打开Mac上的Safari,偏好设置 -> 高级 -> 显示开发者选项 2. 为Xcode工程添加entitlements文件,如果entitlements存在则跳过此步骤。如果不存在,则到工程的Capabilities设置中打开App Sandbox,然后再关闭,这时.entitlements文件会自动被添加进工程。![](jsc-entitlements.png) 3. 打开entitlements文件,添加com.apple.security.get-task-allow,值类型为Boolean,值为true. ![](jsc-security-key.png) -4. 运行游戏 -5. Safari菜单中选择Develop -> 你的Mac设备名称 -> Cocos2d-x JSB 会自动打开Web Inspector页面,然后即可进行设置断点、Timeline profile、console等操作。![](jsc-mac-debug.png) ![](jsc-breakpoint.png) ![](jsc-timeline.png) +4. 编译、运行游戏 +5. 如果是直接在Creator的模拟器中运行,则可以跳过第2,3,4步骤 +6. Safari菜单中选择Develop -> 你的Mac设备名称 -> Cocos2d-x JSB 会自动打开Web Inspector页面,然后即可进行设置断点、Timeline profile、console等操作。![](jsc-mac-debug.png) ![](jsc-breakpoint.png) ![](jsc-timeline.png) + +**注意** + +如果开发者有修改引擎源码或者自己合并了一些Patch,需要重新编译模拟器,记得重新设置一下模拟器工程的证书。 + +![](jsc-mac-simulator-sign.png) + +然后再调用`gulp gen-simulator`生成模拟器。 #### iOS 1. 先打开iPhone的设置 -> Safari -> 高级 -> Web检查器 2. 为Xcode工程添加entitlements文件,如果entitlements存在则跳过此步骤。如果不存在,则到工程的Capabilities设置中打开App Sandbox,然后再关闭,这时.entitlements文件会自动被添加进工程。 (图示与macOS的第2步类似) 3. 打开entitlements文件,添加com.apple.security.get-task-allow,值类型为Boolean,值为true。(图示与macOS的第3步类似) -4. 运行游戏 -5. Safari菜单中选择Develop -> 你的iPhone设备名称 -> Cocos2d-x JSB 会自动打开Web Inspector页面,然后即可进行设置断点、Timeline profile、console等操作。(图示与macOS的第5步类似) +4. 编译、运行游戏 +5. Safari菜单中选择Develop -> 你的iPhone设备名称 -> Cocos2d-x JSB 会自动打开Web Inspector页面,然后即可进行设置断点、Timeline profile、console等操作。(图示与macOS的第6步类似) ## Q & A @@ -947,9 +957,9 @@ SE_BIND_FINALIZE_FUNC(js_cocos2d_Sprite_finalize) ```c++ bool AppDelegate::applicationDidFinishLaunching() { - ... - ... - se::ScriptEngine* se = se::ScriptEngine::getInstance(); + ... + ... + se::ScriptEngine* se = se::ScriptEngine::getInstance(); se->setExceptionCallback([](const char* location, const char* message, const char* stack){ // Send exception information to server like Tencent Bugly. @@ -958,9 +968,9 @@ bool AppDelegate::applicationDidFinishLaunching() }); jsb_register_all_modules(); - ... - ... - return true; + ... + ... + return true; } ``` diff --git a/native/cocos/scripting/js-bindings/docs/jsc-mac-simulator-sign.png b/native/cocos/scripting/js-bindings/docs/jsc-mac-simulator-sign.png new file mode 100644 index 0000000000..1854313d7d Binary files /dev/null and b/native/cocos/scripting/js-bindings/docs/jsc-mac-simulator-sign.png differ diff --git a/native/cocos/scripting/js-bindings/jswrapper/config.hpp b/native/cocos/scripting/js-bindings/jswrapper/config.hpp index 7ff0fde09b..041e0b1d19 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/config.hpp +++ b/native/cocos/scripting/js-bindings/jswrapper/config.hpp @@ -11,7 +11,7 @@ #elif defined(ANDROID) || (defined(_WIN32) && defined(_WINDOWS)) // Windows and Android use V8 #define SCRIPT_ENGINE_TYPE SCRIPT_ENGINE_V8 #else - #define SCRIPT_ENGINE_TYPE SCRIPT_ENGINE_NONE + #error "Unknown Script Engine" #endif #if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0 diff --git a/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp b/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp index 9ba63b71a0..6fd120c511 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp @@ -62,7 +62,7 @@ static bool js_PlistParser_getInstance(se::State& s) SAXParser* parser = delegator->getParser(); if (parser) { - native_ptr_to_seval(parser, __jsb_cocos2d_SAXParser_class, &s.rval()); + native_ptr_to_rooted_seval(parser, __jsb_cocos2d_SAXParser_class, &s.rval()); return true; } return false; diff --git a/native/cocos/scripting/js-bindings/manual/jsb_conversions.hpp b/native/cocos/scripting/js-bindings/manual/jsb_conversions.hpp index 4a53856092..105e56b2b2 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_conversions.hpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_conversions.hpp @@ -136,7 +136,7 @@ bool seval_to_Vector(const se::Value& v, cocos2d::Vector* ret) for (uint32_t i = 0; i < len; ++i) { ok = obj->getArrayElement(i, &tmp); - if (!ok && tmp.isObject()) + if (!ok || !tmp.isObject()) { ret->clear(); return false; @@ -150,6 +150,39 @@ bool seval_to_Vector(const se::Value& v, cocos2d::Vector* ret) return true; } +template +bool seval_to_Map_string_key(const se::Value& v, cocos2d::Map* ret) +{ + assert(ret != nullptr); + assert(v.isObject()); + se::Object* obj = v.toObject(); + + std::vector allKeys; + bool ok = obj->getAllKeys(&allKeys); + if (!ok) + { + ret->clear(); + return false; + } + + se::Value tmp; + for (const auto& key : allKeys) + { + ok = obj->getProperty(key.c_str(), &tmp); + if (!ok || !tmp.isObject()) + { + ret->clear(); + return false; + } + + T nativeObj = (T)tmp.toObject()->getPrivateData(); + + ret->insert(key, nativeObj); + } + + return true; +} + // native value -> se value bool int8_to_seval(int8_t v, se::Value* ret); bool uint8_to_seval(uint8_t v, se::Value* ret); diff --git a/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js b/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js index 285063e074..d1251f8384 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js +++ b/native/cocos/scripting/js-bindings/script/jsb_cocos2d.js @@ -595,7 +595,10 @@ cc.DrawNode = cc._DrawNode.extend({ cc._DrawNode.prototype.drawDot.call(this, pos, radius, color); }, - drawSegment:function (from, to, lineWidth = this._lineWidth, color = this._drawColor) { + drawSegment:function (from, to, lineWidth, color) { + lineWidth = lineWidth || this._lineWidth; + color = color || this._drawColor; + cc._DrawNode.prototype.drawSegment.call(this, from, to, lineWidth, color); }, @@ -1107,17 +1110,21 @@ cc.defineGetterSetter(cc.BlendFunc, "ALPHA_NON_PREMULTIPLIED", cc.BlendFunc._alp cc.BlendFunc.ADDITIVE; cc.defineGetterSetter(cc.BlendFunc, "ADDITIVE", cc.BlendFunc._additive); -cc.GLProgram.prototype.setUniformLocationWithMatrix2fv = function (...args) { - args = Array.prototype.concat.call(args, 2); - this.setUniformLocationWithMatrixfvUnion.apply(this, args); +cc.GLProgram.prototype.setUniformLocationWithMatrix2fv = function(){ + var tempArray = Array.prototype.slice.call(arguments); + tempArray.push(2); + this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); }; -cc.GLProgram.prototype.setUniformLocationWithMatrix3fv = function (...args) { - args = Array.prototype.concat.call(args, 3); - this.setUniformLocationWithMatrixfvUnion.apply(this, args); + +cc.GLProgram.prototype.setUniformLocationWithMatrix3fv = function(){ + var tempArray = Array.prototype.slice.call(arguments); + tempArray.push(3); + this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); }; -cc.GLProgram.prototype.setUniformLocationWithMatrix4fv = function (...args) { - args = Array.prototype.concat.call(args, 4); - this.setUniformLocationWithMatrixfvUnion.apply(this, args); +cc.GLProgram.prototype.setUniformLocationWithMatrix4fv = function(){ + var tempArray = Array.prototype.slice.call(arguments); + tempArray.push(4); + this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); }; // diff --git a/native/cocos/scripting/js-bindings/script/jsb_create_apis.js b/native/cocos/scripting/js-bindings/script/jsb_create_apis.js index 02ba2824c9..7250935e39 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_create_apis.js +++ b/native/cocos/scripting/js-bindings/script/jsb_create_apis.js @@ -293,8 +293,8 @@ cc.ActionInterval.prototype._ctor = function(d) { d !== undefined && this.initWithDuration(d); }; -cc.Sequence.prototype._ctor = function(...args) { - var actions = (args[0] instanceof Array) ? args[0] : args; +cc.Sequence.prototype._ctor = function(tempArray) { + var actions = (tempArray instanceof Array) ? tempArray : arguments; var last = actions.length - 1; if ((last >= 0) && (actions[last] == null)) cc.log('parameters should not be ending with null in Javascript'); @@ -309,8 +309,8 @@ cc.Sequence.prototype._ctor = function(...args) { this.initWithTwoActions(prev, actions[last]); } }; -cc.sequence = cc.Sequence.create = function (...args) { - var actions = (args[0] instanceof Array) ? args[0] : args; +cc.sequence = cc.Sequence.create = function (tempArray) { + var actions = (tempArray instanceof Array) ? tempArray : arguments; var last = actions.length - 1; if ((last >= 0) && (actions[last] == null)) cc.log('parameters should not be ending with null in Javascript'); @@ -343,8 +343,8 @@ cc.repeatForever = cc.RepeatForever.create = function (action) { return new cc.RepeatForever(action); }; -cc.Spawn.prototype._ctor = function (...args) { - var actions = (args[0] instanceof Array) ? args[0] : args; +cc.Spawn.prototype._ctor = function (tempArray) { + var actions = (tempArray instanceof Array) ? tempArray : arguments; var last = actions.length - 1; if ((last >= 0) && (actions[last] == null)) cc.log('parameters should not be ending with null in Javascript'); @@ -359,8 +359,8 @@ cc.Spawn.prototype._ctor = function (...args) { this.initWithTwoActions(prev, actions[last]); } }; -cc.spawn = cc.Spawn.create = function (...args) { - var actions = (args[0] instanceof Array) ? args[0] : args; +cc.spawn = cc.Spawn.create = function (tempArray) { + var actions = (tempArray instanceof Array) ? tempArray : arguments; var last = actions.length - 1; if ((last >= 0) && (actions[last] == null)) cc.log('parameters should not be ending with null in Javascript'); diff --git a/native/cocos/scripting/js-bindings/script/jsb_opengl.js b/native/cocos/scripting/js-bindings/script/jsb_opengl.js index e0925c169a..63317cb348 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_opengl.js +++ b/native/cocos/scripting/js-bindings/script/jsb_opengl.js @@ -353,11 +353,11 @@ gl.getAttachedShaders = function(program) { // void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException // void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException // void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException -gl.texImage2D = function (...args) { - if (args.length < 9) { - throw "texImage2D: Unsupported number of parameters:" + args.length; - } - gl._texImage2D.apply(gl, args); +gl.texImage2D = function() { + if( arguments.length < 9) + throw "texImage2D: Unsupported number of parameters:" + arguments.length; + + gl._texImage2D.apply(this, arguments); }; // XXX: Currently only the 1st one is supported @@ -366,11 +366,11 @@ gl.texImage2D = function (...args) { // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException -gl.texSubImage2D = function (...args) { - if (args.length < 9) - throw "texImage2D: Unsupported number of parameters"; +gl.texSubImage2D = function() { + if( arguments.length < 9) + throw "texSubImage2D: Unsupported number of parameters:" + arguments.length; - gl._texSubImage2D.apply(gl, args); + gl._texSubImage2D.apply(this, arguments); }; // diff --git a/native/cocos/scripting/js-bindings/script/jsb_prepare.js b/native/cocos/scripting/js-bindings/script/jsb_prepare.js index 1a14e3142b..c902356ff8 100644 --- a/native/cocos/scripting/js-bindings/script/jsb_prepare.js +++ b/native/cocos/scripting/js-bindings/script/jsb_prepare.js @@ -129,7 +129,7 @@ cc.Class.extend = function (prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function (name, fn) { - return function (...args) { + return function () { var tmp = this._super; // Add a new ._super() method that is the same method @@ -138,7 +138,7 @@ cc.Class.extend = function (prop) { // The method only need to be bound temporarily, so we // remove it when we're done executing - var ret = fn.apply(this, args); + var ret = fn.apply(this, arguments); this._super = tmp; return ret; @@ -147,18 +147,18 @@ cc.Class.extend = function (prop) { prop[name]; } - Class = function (...args) { + Class = function () { if (!initializing) { this.__instanceId = ClassManager.getNewInstanceId(); if (this.ctor) { - switch (args.length) { + switch (arguments.length) { case 0: this.ctor(); break; - case 1: this.ctor(args[0]); break; - case 2: this.ctor(args[0], args[1]); break; - case 3: this.ctor(args[0], args[1], args[2]); break; - case 4: this.ctor(args[0], args[1], args[2], args[3]); break; - case 5: this.ctor(args[0], args[1], args[2], args[3], args[4]); break; - default: this.ctor.apply(this, args); + case 1: this.ctor(arguments[0]); break; + case 2: this.ctor(arguments[0], arguments[1]); break; + case 3: this.ctor(arguments[0], arguments[1], arguments[2]); break; + case 4: this.ctor(arguments[0], arguments[1], arguments[2], arguments[3]); break; + case 5: this.ctor(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); break; + default: this.ctor.apply(this, arguments); } } } diff --git a/native/external/config.json b/native/external/config.json index e5736e52ec..f3153a92ad 100644 --- a/native/external/config.json +++ b/native/external/config.json @@ -1,5 +1,5 @@ { - "version": "v3-deps-47", + "version": "v3-deps-48", "zip_file_size": "114318593", "repo_name": "cocos2d-x-lite-external", "repo_parent": "https://github.com/cocos-creator/" diff --git a/native/gulpfile.js b/native/gulpfile.js index b92059eb32..74be6e5ffd 100644 --- a/native/gulpfile.js +++ b/native/gulpfile.js @@ -119,6 +119,10 @@ gulp.task('gen-simulator', function(cb) { var cocosConsoleBin; if (process.platform === 'darwin') { cocosConsoleBin = Path.join(cocosConsoleRoot, 'cocos'); + // copy mac xcode project with signing info + if (fs.existsSync('simulator.xcodeproj')) { + fs.copySync('./simulator.xcodeproj', './tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj'); + } } else { cocosConsoleBin = Path.join(cocosConsoleRoot, 'cocos.bat'); } @@ -140,6 +144,8 @@ gulp.task('gen-simulator', function(cb) { if (code !== 0) { console.error('Generate simulator failed'); } + //reset project file to hide code sign information. + ExecSync('git checkout -- ./tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj'); cb(); return; }); diff --git a/native/templates/cocos2dx_files.json b/native/templates/cocos2dx_files.json index 4febbe3a1d..e2eaa15622 100644 --- a/native/templates/cocos2dx_files.json +++ b/native/templates/cocos2dx_files.json @@ -4726,6 +4726,7 @@ "cocos/scripting/js-bindings/docs/jsc-breakpoint.png", "cocos/scripting/js-bindings/docs/jsc-entitlements.png", "cocos/scripting/js-bindings/docs/jsc-mac-debug.png", + "cocos/scripting/js-bindings/docs/jsc-mac-simulator-sign.png", "cocos/scripting/js-bindings/docs/jsc-security-key.png", "cocos/scripting/js-bindings/docs/jsc-timeline.png", "cocos/scripting/js-bindings/docs/v8-win32-debug.jpg", diff --git a/native/templates/js-template-binary/frameworks/runtime-src/Classes/AppDelegate.cpp b/native/templates/js-template-binary/frameworks/runtime-src/Classes/AppDelegate.cpp index 7e712e1335..673687f8f2 100755 --- a/native/templates/js-template-binary/frameworks/runtime-src/Classes/AppDelegate.cpp +++ b/native/templates/js-template-binary/frameworks/runtime-src/Classes/AppDelegate.cpp @@ -64,7 +64,8 @@ bool AppDelegate::applicationDidFinishLaunching() jsb_init_file_operation_delegate(); #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) - jsb_enable_debugger("127.0.0.1", 5086); // Enable debugger here + // Enable debugger here + jsb_enable_debugger("0.0.0.0", 5086); #endif se->setExceptionCallback([](const char* location, const char* message, const char* stack){ diff --git a/native/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp b/native/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp index 58afe2a0ed..1f8632fce4 100755 --- a/native/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp +++ b/native/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp @@ -65,8 +65,7 @@ bool AppDelegate::applicationDidFinishLaunching() #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) // Enable debugger here - // Change IP while remote debugging on Android device. - jsb_enable_debugger("127.0.0.1", 5086); + jsb_enable_debugger("0.0.0.0", 5086); #endif se->setExceptionCallback([](const char* location, const char* message, const char* stack){ diff --git a/native/templates/js-template-link/frameworks/runtime-src/Classes/AppDelegate.cpp b/native/templates/js-template-link/frameworks/runtime-src/Classes/AppDelegate.cpp index 58afe2a0ed..1f8632fce4 100755 --- a/native/templates/js-template-link/frameworks/runtime-src/Classes/AppDelegate.cpp +++ b/native/templates/js-template-link/frameworks/runtime-src/Classes/AppDelegate.cpp @@ -65,8 +65,7 @@ bool AppDelegate::applicationDidFinishLaunching() #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) // Enable debugger here - // Change IP while remote debugging on Android device. - jsb_enable_debugger("127.0.0.1", 5086); + jsb_enable_debugger("0.0.0.0", 5086); #endif se->setExceptionCallback([](const char* location, const char* message, const char* stack){ diff --git a/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.cpp b/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.cpp index bde6a8b0d2..442cd66568 100755 --- a/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.cpp +++ b/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.cpp @@ -8,7 +8,7 @@ #include "cocos/base/CCDirector.h" // 2dx engine -#if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) +#if (CC_CODE_IDE_DEBUG_SUPPORT > 0) #include "runtime/ConfigParser.h" // config #include "runtime/Runtime.h" @@ -159,8 +159,7 @@ bool RuntimeJsImpl::initJsEnv() #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) // Enable debugger here - // Change IP while remote debugging on Android device. - jsb_enable_debugger("127.0.0.1", 5086); + jsb_enable_debugger("0.0.0.0", 5086); #endif se->setExceptionCallback([](const char* location, const char* message, const char* stack){ diff --git a/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.h b/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.h index 874796d3ac..db70b34f17 100755 --- a/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.h +++ b/native/tools/simulator/frameworks/runtime-src/Classes/ide-support/RuntimeJsImpl.h @@ -9,7 +9,7 @@ #include "ide-support/CodeIDESupport.h" -#if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) +#if (CC_CODE_IDE_DEBUG_SUPPORT > 0) #include "runtime/RuntimeProtocol.h" class RuntimeJsImpl : public RuntimeProtocol diff --git a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/jni/Application.mk b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/jni/Application.mk index 42107b7363..b31b93cb0d 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/jni/Application.mk +++ b/native/tools/simulator/frameworks/runtime-src/proj.android-studio/app/jni/Application.mk @@ -10,11 +10,12 @@ APP_LDFLAGS := -latomic APP_SHORT_COMMANDS := true ifeq ($(NDK_DEBUG),1) + APP_CFLAGS += -DCOCOS2D_DEBUG=1 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := debug else + APP_CFLAGS += -DNDEBUG APP_CPPFLAGS += -DNDEBUG - APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := release endif diff --git a/native/tools/simulator/frameworks/runtime-src/proj.android/jni/Application.mk b/native/tools/simulator/frameworks/runtime-src/proj.android/jni/Application.mk index 6d9ee09cb5..fc868a3588 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.android/jni/Application.mk +++ b/native/tools/simulator/frameworks/runtime-src/proj.android/jni/Application.mk @@ -7,11 +7,12 @@ APP_LDFLAGS := -latomic APP_SHORT_COMMANDS := true ifeq ($(NDK_DEBUG),1) + APP_CFLAGS += -DCOCOS2D_DEBUG=1 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := debug else + APP_CFLAGS += -DNDEBUG APP_CPPFLAGS += -DNDEBUG - APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := release endif diff --git a/native/tools/simulator/libsimulator/lib/runtime/FileServer.cpp b/native/tools/simulator/libsimulator/lib/runtime/FileServer.cpp index a0b1cadb70..7dc193a874 100755 --- a/native/tools/simulator/libsimulator/lib/runtime/FileServer.cpp +++ b/native/tools/simulator/libsimulator/lib/runtime/FileServer.cpp @@ -35,7 +35,9 @@ THE SOFTWARE. #endif #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID -#define bzero(a, b) memset(a, 0, b); + #ifndef bzero + #define bzero(a, b) memset(a, 0, b); + #endif #endif //1M size diff --git a/native/tools/simulator/libsimulator/lib/runtime/FileServer.h b/native/tools/simulator/libsimulator/lib/runtime/FileServer.h index b7a3d7da65..0f726c90d7 100755 --- a/native/tools/simulator/libsimulator/lib/runtime/FileServer.h +++ b/native/tools/simulator/libsimulator/lib/runtime/FileServer.h @@ -38,7 +38,9 @@ THE SOFTWARE. #include #include +#ifndef bzero #define bzero(a, b) memset(a, 0, b); +#endif #else #include