Merge pull request #879 from dumganhar/jsb2.0

Polish jsbinding code and debugger & profiler work
This commit is contained in:
James Chen
2017-10-10 16:50:03 +08:00
committed by GitHub
88 changed files with 896 additions and 755 deletions
@@ -1,5 +1,6 @@
#include "scripting/js-bindings/auto/jsb_box2d_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "Box2D/Box2D.h"
se::Object* __jsb_b2Draw_proto = nullptr;
@@ -1,6 +1,7 @@
#include "scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.hpp"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "audio/include/AudioEngine.h"
se::Object* __jsb_cocos2d_experimental_AudioProfile_proto = nullptr;
@@ -1,5 +1,6 @@
#include "scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "cocos2d.h"
#include "scripting/js-bindings/manual/BaseJSAction.h"
@@ -1777,7 +1778,7 @@ bool js_register_cocos2dx_Component(se::Object* obj)
__jsb_cocos2d_Component_proto = cls->getProto();
__jsb_cocos2d_Component_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Component.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Component");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -4655,7 +4656,7 @@ bool js_register_cocos2dx_Node(se::Object* obj)
__jsb_cocos2d_Node_proto = cls->getProto();
__jsb_cocos2d_Node_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Node.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Node");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -4806,7 +4807,7 @@ bool js_register_cocos2dx_Scene(se::Object* obj)
__jsb_cocos2d_Scene_proto = cls->getProto();
__jsb_cocos2d_Scene_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Scene.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Scene");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -12277,7 +12278,7 @@ bool js_register_cocos2dx_SpriteFrame(se::Object* obj)
__jsb_cocos2d_SpriteFrame_proto = cls->getProto();
__jsb_cocos2d_SpriteFrame_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.SpriteFrame.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "SpriteFrame");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -12479,7 +12480,7 @@ bool js_register_cocos2dx_Sequence(se::Object* obj)
__jsb_cocos2d_Sequence_proto = cls->getProto();
__jsb_cocos2d_Sequence_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Sequence.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Sequence");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -12597,7 +12598,7 @@ bool js_register_cocos2dx_Repeat(se::Object* obj)
__jsb_cocos2d_Repeat_proto = cls->getProto();
__jsb_cocos2d_Repeat_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Repeat.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Repeat");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -12713,7 +12714,7 @@ bool js_register_cocos2dx_RepeatForever(se::Object* obj)
__jsb_cocos2d_RepeatForever_proto = cls->getProto();
__jsb_cocos2d_RepeatForever_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.RepeatForever.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "RepeatForever");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -12814,7 +12815,7 @@ bool js_register_cocos2dx_Spawn(se::Object* obj)
__jsb_cocos2d_Spawn_proto = cls->getProto();
__jsb_cocos2d_Spawn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Spawn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Spawn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -12937,7 +12938,7 @@ bool js_register_cocos2dx_RotateTo(se::Object* obj)
__jsb_cocos2d_RotateTo_proto = cls->getProto();
__jsb_cocos2d_RotateTo_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.RotateTo.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "RotateTo");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -13080,7 +13081,7 @@ bool js_register_cocos2dx_RotateBy(se::Object* obj)
__jsb_cocos2d_RotateBy_proto = cls->getProto();
__jsb_cocos2d_RotateBy_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.RotateBy.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "RotateBy");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -13183,7 +13184,7 @@ bool js_register_cocos2dx_MoveBy(se::Object* obj)
__jsb_cocos2d_MoveBy_proto = cls->getProto();
__jsb_cocos2d_MoveBy_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MoveBy.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MoveBy");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -13286,7 +13287,7 @@ bool js_register_cocos2dx_MoveTo(se::Object* obj)
__jsb_cocos2d_MoveTo_proto = cls->getProto();
__jsb_cocos2d_MoveTo_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MoveTo.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MoveTo");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -13393,7 +13394,7 @@ bool js_register_cocos2dx_SkewTo(se::Object* obj)
__jsb_cocos2d_SkewTo_proto = cls->getProto();
__jsb_cocos2d_SkewTo_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.SkewTo.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "SkewTo");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -13500,7 +13501,7 @@ bool js_register_cocos2dx_SkewBy(se::Object* obj)
__jsb_cocos2d_SkewBy_proto = cls->getProto();
__jsb_cocos2d_SkewBy_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.SkewBy.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "SkewBy");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -13611,7 +13612,7 @@ bool js_register_cocos2dx_JumpBy(se::Object* obj)
__jsb_cocos2d_JumpBy_proto = cls->getProto();
__jsb_cocos2d_JumpBy_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.JumpBy.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "JumpBy");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -13722,7 +13723,7 @@ bool js_register_cocos2dx_JumpTo(se::Object* obj)
__jsb_cocos2d_JumpTo_proto = cls->getProto();
__jsb_cocos2d_JumpTo_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.JumpTo.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "JumpTo");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -13777,7 +13778,7 @@ bool js_register_cocos2dx_BezierBy(se::Object* obj)
__jsb_cocos2d_BezierBy_proto = cls->getProto();
__jsb_cocos2d_BezierBy_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.BezierBy.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "BezierBy");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -13832,7 +13833,7 @@ bool js_register_cocos2dx_BezierTo(se::Object* obj)
__jsb_cocos2d_BezierTo_proto = cls->getProto();
__jsb_cocos2d_BezierTo_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.BezierTo.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "BezierTo");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14016,7 +14017,7 @@ bool js_register_cocos2dx_ScaleTo(se::Object* obj)
__jsb_cocos2d_ScaleTo_proto = cls->getProto();
__jsb_cocos2d_ScaleTo_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.ScaleTo.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "ScaleTo");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14133,7 +14134,7 @@ bool js_register_cocos2dx_ScaleBy(se::Object* obj)
__jsb_cocos2d_ScaleBy_proto = cls->getProto();
__jsb_cocos2d_ScaleBy_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.ScaleBy.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "ScaleBy");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14236,7 +14237,7 @@ bool js_register_cocos2dx_Blink(se::Object* obj)
__jsb_cocos2d_Blink_proto = cls->getProto();
__jsb_cocos2d_Blink_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Blink.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Blink");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14339,7 +14340,7 @@ bool js_register_cocos2dx_FadeTo(se::Object* obj)
__jsb_cocos2d_FadeTo_proto = cls->getProto();
__jsb_cocos2d_FadeTo_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.FadeTo.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "FadeTo");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14436,7 +14437,7 @@ bool js_register_cocos2dx_FadeIn(se::Object* obj)
__jsb_cocos2d_FadeIn_proto = cls->getProto();
__jsb_cocos2d_FadeIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.FadeIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "FadeIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14533,7 +14534,7 @@ bool js_register_cocos2dx_FadeOut(se::Object* obj)
__jsb_cocos2d_FadeOut_proto = cls->getProto();
__jsb_cocos2d_FadeOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.FadeOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "FadeOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14661,7 +14662,7 @@ bool js_register_cocos2dx_TintTo(se::Object* obj)
__jsb_cocos2d_TintTo_proto = cls->getProto();
__jsb_cocos2d_TintTo_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.TintTo.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "TintTo");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14772,7 +14773,7 @@ bool js_register_cocos2dx_TintBy(se::Object* obj)
__jsb_cocos2d_TintBy_proto = cls->getProto();
__jsb_cocos2d_TintBy_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.TintBy.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "TintBy");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14849,7 +14850,7 @@ bool js_register_cocos2dx_DelayTime(se::Object* obj)
__jsb_cocos2d_DelayTime_proto = cls->getProto();
__jsb_cocos2d_DelayTime_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.DelayTime.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "DelayTime");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -14948,7 +14949,7 @@ bool js_register_cocos2dx_ReverseTime(se::Object* obj)
__jsb_cocos2d_ReverseTime_proto = cls->getProto();
__jsb_cocos2d_ReverseTime_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.ReverseTime.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "ReverseTime");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -15078,7 +15079,7 @@ bool js_register_cocos2dx_TargetedAction(se::Object* obj)
__jsb_cocos2d_TargetedAction_proto = cls->getProto();
__jsb_cocos2d_TargetedAction_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.TargetedAction.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "TargetedAction");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -15501,7 +15502,7 @@ bool js_register_cocos2dx_EaseIn(se::Object* obj)
__jsb_cocos2d_EaseIn_proto = cls->getProto();
__jsb_cocos2d_EaseIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -15580,7 +15581,7 @@ bool js_register_cocos2dx_EaseOut(se::Object* obj)
__jsb_cocos2d_EaseOut_proto = cls->getProto();
__jsb_cocos2d_EaseOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -15659,7 +15660,7 @@ bool js_register_cocos2dx_EaseInOut(se::Object* obj)
__jsb_cocos2d_EaseInOut_proto = cls->getProto();
__jsb_cocos2d_EaseInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -15736,7 +15737,7 @@ bool js_register_cocos2dx_EaseExponentialIn(se::Object* obj)
__jsb_cocos2d_EaseExponentialIn_proto = cls->getProto();
__jsb_cocos2d_EaseExponentialIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseExponentialIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseExponentialIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -15813,7 +15814,7 @@ bool js_register_cocos2dx_EaseExponentialOut(se::Object* obj)
__jsb_cocos2d_EaseExponentialOut_proto = cls->getProto();
__jsb_cocos2d_EaseExponentialOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseExponentialOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseExponentialOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -15890,7 +15891,7 @@ bool js_register_cocos2dx_EaseExponentialInOut(se::Object* obj)
__jsb_cocos2d_EaseExponentialInOut_proto = cls->getProto();
__jsb_cocos2d_EaseExponentialInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseExponentialInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseExponentialInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -15967,7 +15968,7 @@ bool js_register_cocos2dx_EaseSineIn(se::Object* obj)
__jsb_cocos2d_EaseSineIn_proto = cls->getProto();
__jsb_cocos2d_EaseSineIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseSineIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseSineIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16044,7 +16045,7 @@ bool js_register_cocos2dx_EaseSineOut(se::Object* obj)
__jsb_cocos2d_EaseSineOut_proto = cls->getProto();
__jsb_cocos2d_EaseSineOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseSineOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseSineOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16121,7 +16122,7 @@ bool js_register_cocos2dx_EaseSineInOut(se::Object* obj)
__jsb_cocos2d_EaseSineInOut_proto = cls->getProto();
__jsb_cocos2d_EaseSineInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseSineInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseSineInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16305,7 +16306,7 @@ bool js_register_cocos2dx_EaseElasticIn(se::Object* obj)
__jsb_cocos2d_EaseElasticIn_proto = cls->getProto();
__jsb_cocos2d_EaseElasticIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseElasticIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseElasticIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16396,7 +16397,7 @@ bool js_register_cocos2dx_EaseElasticOut(se::Object* obj)
__jsb_cocos2d_EaseElasticOut_proto = cls->getProto();
__jsb_cocos2d_EaseElasticOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseElasticOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseElasticOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16487,7 +16488,7 @@ bool js_register_cocos2dx_EaseElasticInOut(se::Object* obj)
__jsb_cocos2d_EaseElasticInOut_proto = cls->getProto();
__jsb_cocos2d_EaseElasticInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseElasticInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseElasticInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16585,7 +16586,7 @@ bool js_register_cocos2dx_EaseBounceIn(se::Object* obj)
__jsb_cocos2d_EaseBounceIn_proto = cls->getProto();
__jsb_cocos2d_EaseBounceIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseBounceIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseBounceIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16662,7 +16663,7 @@ bool js_register_cocos2dx_EaseBounceOut(se::Object* obj)
__jsb_cocos2d_EaseBounceOut_proto = cls->getProto();
__jsb_cocos2d_EaseBounceOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseBounceOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseBounceOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16739,7 +16740,7 @@ bool js_register_cocos2dx_EaseBounceInOut(se::Object* obj)
__jsb_cocos2d_EaseBounceInOut_proto = cls->getProto();
__jsb_cocos2d_EaseBounceInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseBounceInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseBounceInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16816,7 +16817,7 @@ bool js_register_cocos2dx_EaseBackIn(se::Object* obj)
__jsb_cocos2d_EaseBackIn_proto = cls->getProto();
__jsb_cocos2d_EaseBackIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseBackIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseBackIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16893,7 +16894,7 @@ bool js_register_cocos2dx_EaseBackOut(se::Object* obj)
__jsb_cocos2d_EaseBackOut_proto = cls->getProto();
__jsb_cocos2d_EaseBackOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseBackOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseBackOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -16970,7 +16971,7 @@ bool js_register_cocos2dx_EaseBackInOut(se::Object* obj)
__jsb_cocos2d_EaseBackInOut_proto = cls->getProto();
__jsb_cocos2d_EaseBackInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseBackInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseBackInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17073,7 +17074,7 @@ bool js_register_cocos2dx_EaseBezierAction(se::Object* obj)
__jsb_cocos2d_EaseBezierAction_proto = cls->getProto();
__jsb_cocos2d_EaseBezierAction_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseBezierAction.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseBezierAction");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17150,7 +17151,7 @@ bool js_register_cocos2dx_EaseQuadraticActionIn(se::Object* obj)
__jsb_cocos2d_EaseQuadraticActionIn_proto = cls->getProto();
__jsb_cocos2d_EaseQuadraticActionIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseQuadraticActionIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseQuadraticActionIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17227,7 +17228,7 @@ bool js_register_cocos2dx_EaseQuadraticActionOut(se::Object* obj)
__jsb_cocos2d_EaseQuadraticActionOut_proto = cls->getProto();
__jsb_cocos2d_EaseQuadraticActionOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseQuadraticActionOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseQuadraticActionOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17304,7 +17305,7 @@ bool js_register_cocos2dx_EaseQuadraticActionInOut(se::Object* obj)
__jsb_cocos2d_EaseQuadraticActionInOut_proto = cls->getProto();
__jsb_cocos2d_EaseQuadraticActionInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseQuadraticActionInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseQuadraticActionInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17381,7 +17382,7 @@ bool js_register_cocos2dx_EaseQuarticActionIn(se::Object* obj)
__jsb_cocos2d_EaseQuarticActionIn_proto = cls->getProto();
__jsb_cocos2d_EaseQuarticActionIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseQuarticActionIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseQuarticActionIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17458,7 +17459,7 @@ bool js_register_cocos2dx_EaseQuarticActionOut(se::Object* obj)
__jsb_cocos2d_EaseQuarticActionOut_proto = cls->getProto();
__jsb_cocos2d_EaseQuarticActionOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseQuarticActionOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseQuarticActionOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17535,7 +17536,7 @@ bool js_register_cocos2dx_EaseQuarticActionInOut(se::Object* obj)
__jsb_cocos2d_EaseQuarticActionInOut_proto = cls->getProto();
__jsb_cocos2d_EaseQuarticActionInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseQuarticActionInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseQuarticActionInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17612,7 +17613,7 @@ bool js_register_cocos2dx_EaseQuinticActionIn(se::Object* obj)
__jsb_cocos2d_EaseQuinticActionIn_proto = cls->getProto();
__jsb_cocos2d_EaseQuinticActionIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseQuinticActionIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseQuinticActionIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17689,7 +17690,7 @@ bool js_register_cocos2dx_EaseQuinticActionOut(se::Object* obj)
__jsb_cocos2d_EaseQuinticActionOut_proto = cls->getProto();
__jsb_cocos2d_EaseQuinticActionOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseQuinticActionOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseQuinticActionOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17766,7 +17767,7 @@ bool js_register_cocos2dx_EaseQuinticActionInOut(se::Object* obj)
__jsb_cocos2d_EaseQuinticActionInOut_proto = cls->getProto();
__jsb_cocos2d_EaseQuinticActionInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseQuinticActionInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseQuinticActionInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17843,7 +17844,7 @@ bool js_register_cocos2dx_EaseCircleActionIn(se::Object* obj)
__jsb_cocos2d_EaseCircleActionIn_proto = cls->getProto();
__jsb_cocos2d_EaseCircleActionIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseCircleActionIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseCircleActionIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17920,7 +17921,7 @@ bool js_register_cocos2dx_EaseCircleActionOut(se::Object* obj)
__jsb_cocos2d_EaseCircleActionOut_proto = cls->getProto();
__jsb_cocos2d_EaseCircleActionOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseCircleActionOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseCircleActionOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -17997,7 +17998,7 @@ bool js_register_cocos2dx_EaseCircleActionInOut(se::Object* obj)
__jsb_cocos2d_EaseCircleActionInOut_proto = cls->getProto();
__jsb_cocos2d_EaseCircleActionInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseCircleActionInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseCircleActionInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18074,7 +18075,7 @@ bool js_register_cocos2dx_EaseCubicActionIn(se::Object* obj)
__jsb_cocos2d_EaseCubicActionIn_proto = cls->getProto();
__jsb_cocos2d_EaseCubicActionIn_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseCubicActionIn.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseCubicActionIn");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18151,7 +18152,7 @@ bool js_register_cocos2dx_EaseCubicActionOut(se::Object* obj)
__jsb_cocos2d_EaseCubicActionOut_proto = cls->getProto();
__jsb_cocos2d_EaseCubicActionOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseCubicActionOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseCubicActionOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18228,7 +18229,7 @@ bool js_register_cocos2dx_EaseCubicActionInOut(se::Object* obj)
__jsb_cocos2d_EaseCubicActionInOut_proto = cls->getProto();
__jsb_cocos2d_EaseCubicActionInOut_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.EaseCubicActionInOut.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "EaseCubicActionInOut");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18323,7 +18324,7 @@ bool js_register_cocos2dx_Show(se::Object* obj)
__jsb_cocos2d_Show_proto = cls->getProto();
__jsb_cocos2d_Show_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Show.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Show");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18397,7 +18398,7 @@ bool js_register_cocos2dx_Hide(se::Object* obj)
__jsb_cocos2d_Hide_proto = cls->getProto();
__jsb_cocos2d_Hide_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Hide.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Hide");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18655,7 +18656,7 @@ bool js_register_cocos2dx_FlipX(se::Object* obj)
__jsb_cocos2d_FlipX_proto = cls->getProto();
__jsb_cocos2d_FlipX_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.FlipX.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "FlipX");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18754,7 +18755,7 @@ bool js_register_cocos2dx_FlipY(se::Object* obj)
__jsb_cocos2d_FlipY_proto = cls->getProto();
__jsb_cocos2d_FlipY_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.FlipY.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "FlipY");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18853,7 +18854,7 @@ bool js_register_cocos2dx_Place(se::Object* obj)
__jsb_cocos2d_Place_proto = cls->getProto();
__jsb_cocos2d_Place_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Place.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Place");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18924,7 +18925,7 @@ bool js_register_cocos2dx_CallFunc(se::Object* obj)
__jsb_cocos2d_CallFunc_proto = cls->getProto();
__jsb_cocos2d_CallFunc_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc._CallFunc.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "_CallFunc");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -18979,7 +18980,7 @@ bool js_register_cocos2dx_CallFuncN(se::Object* obj)
__jsb_cocos2d_CallFuncN_proto = cls->getProto();
__jsb_cocos2d_CallFuncN_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.CallFunc.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "CallFunc");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -19324,7 +19325,7 @@ bool js_register_cocos2dx_ActionManager(se::Object* obj)
__jsb_cocos2d_ActionManager_proto = cls->getProto();
__jsb_cocos2d_ActionManager_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.ActionManager.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "ActionManager");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -20597,7 +20598,7 @@ bool js_register_cocos2dx_DrawNode(se::Object* obj)
__jsb_cocos2d_DrawNode_proto = cls->getProto();
__jsb_cocos2d_DrawNode_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.DrawNode.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "DrawNode");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -22633,7 +22634,7 @@ bool js_register_cocos2dx_Label(se::Object* obj)
__jsb_cocos2d_Label_proto = cls->getProto();
__jsb_cocos2d_Label_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Label.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Label");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -22707,7 +22708,7 @@ bool js_register_cocos2dx_LabelTTF(se::Object* obj)
__jsb_cocos2d_LabelTTF_proto = cls->getProto();
__jsb_cocos2d_LabelTTF_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.LabelTTF.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "LabelTTF");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -22781,7 +22782,7 @@ bool js_register_cocos2dx_Layer(se::Object* obj)
__jsb_cocos2d_Layer_proto = cls->getProto();
__jsb_cocos2d_Layer_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Layer.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Layer");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -23027,7 +23028,7 @@ bool js_register_cocos2dx_LayerColor(se::Object* obj)
__jsb_cocos2d_LayerColor_proto = cls->getProto();
__jsb_cocos2d_LayerColor_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.LayerColor.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "LayerColor");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -23412,7 +23413,7 @@ bool js_register_cocos2dx_LayerGradient(se::Object* obj)
__jsb_cocos2d_LayerGradient_proto = cls->getProto();
__jsb_cocos2d_LayerGradient_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.LayerGradient.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "LayerGradient");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -23549,7 +23550,7 @@ bool js_register_cocos2dx_LayerMultiplex(se::Object* obj)
__jsb_cocos2d_LayerMultiplex_proto = cls->getProto();
__jsb_cocos2d_LayerMultiplex_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.LayerMultiplex.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "LayerMultiplex");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -23829,7 +23830,7 @@ bool js_register_cocos2dx_MenuItem(se::Object* obj)
__jsb_cocos2d_MenuItem_proto = cls->getProto();
__jsb_cocos2d_MenuItem_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MenuItem.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MenuItem");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -24054,7 +24055,7 @@ bool js_register_cocos2dx_MenuItemLabel(se::Object* obj)
__jsb_cocos2d_MenuItemLabel_proto = cls->getProto();
__jsb_cocos2d_MenuItemLabel_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MenuItemLabel.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MenuItemLabel");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -24170,7 +24171,7 @@ bool js_register_cocos2dx_MenuItemAtlasFont(se::Object* obj)
__jsb_cocos2d_MenuItemAtlasFont_proto = cls->getProto();
__jsb_cocos2d_MenuItemAtlasFont_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MenuItemAtlasFont.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MenuItemAtlasFont");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -24426,7 +24427,7 @@ bool js_register_cocos2dx_MenuItemFont(se::Object* obj)
__jsb_cocos2d_MenuItemFont_proto = cls->getProto();
__jsb_cocos2d_MenuItemFont_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MenuItemFont.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MenuItemFont");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -24707,7 +24708,7 @@ bool js_register_cocos2dx_MenuItemSprite(se::Object* obj)
__jsb_cocos2d_MenuItemSprite_proto = cls->getProto();
__jsb_cocos2d_MenuItemSprite_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MenuItemSprite.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MenuItemSprite");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -24898,7 +24899,7 @@ bool js_register_cocos2dx_MenuItemImage(se::Object* obj)
__jsb_cocos2d_MenuItemImage_proto = cls->getProto();
__jsb_cocos2d_MenuItemImage_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MenuItemImage.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MenuItemImage");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -25104,7 +25105,7 @@ bool js_register_cocos2dx_MenuItemToggle(se::Object* obj)
__jsb_cocos2d_MenuItemToggle_proto = cls->getProto();
__jsb_cocos2d_MenuItemToggle_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MenuItemToggle.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MenuItemToggle");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -25332,7 +25333,7 @@ bool js_register_cocos2dx_Menu(se::Object* obj)
__jsb_cocos2d_Menu_proto = cls->getProto();
__jsb_cocos2d_Menu_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Menu.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Menu");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -25814,7 +25815,7 @@ bool js_register_cocos2dx_MotionStreak(se::Object* obj)
__jsb_cocos2d_MotionStreak_proto = cls->getProto();
__jsb_cocos2d_MotionStreak_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.MotionStreak.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "MotionStreak");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -26169,7 +26170,7 @@ bool js_register_cocos2dx_ParticleBatchNode(se::Object* obj)
__jsb_cocos2d_ParticleBatchNode_proto = cls->getProto();
__jsb_cocos2d_ParticleBatchNode_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.ParticleBatchNode.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "ParticleBatchNode");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -28288,7 +28289,7 @@ bool js_register_cocos2dx_ParticleSystem(se::Object* obj)
__jsb_cocos2d_ParticleSystem_proto = cls->getProto();
__jsb_cocos2d_ParticleSystem_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc._ParticleSystem.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "_ParticleSystem");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -30933,7 +30934,7 @@ bool js_register_cocos2dx_Sprite(se::Object* obj)
__jsb_cocos2d_Sprite_proto = cls->getProto();
__jsb_cocos2d_Sprite_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Sprite.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Sprite");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -31585,7 +31586,7 @@ bool js_register_cocos2dx_RenderTexture(se::Object* obj)
__jsb_cocos2d_RenderTexture_proto = cls->getProto();
__jsb_cocos2d_RenderTexture_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.RenderTexture.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "RenderTexture");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -32260,7 +32261,7 @@ bool js_register_cocos2dx_GLProgram(se::Object* obj)
__jsb_cocos2d_GLProgram_proto = cls->getProto();
__jsb_cocos2d_GLProgram_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.GLProgram.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "GLProgram");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -33639,7 +33640,7 @@ bool js_register_cocos2dx_SpriteBatchNode(se::Object* obj)
__jsb_cocos2d_SpriteBatchNode_proto = cls->getProto();
__jsb_cocos2d_SpriteBatchNode_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.SpriteBatchNode.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "SpriteBatchNode");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -34469,7 +34470,7 @@ bool js_register_cocos2dx_TextFieldTTF(se::Object* obj)
__jsb_cocos2d_TextFieldTTF_proto = cls->getProto();
__jsb_cocos2d_TextFieldTTF_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.TextFieldTTF.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "TextFieldTTF");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -34589,7 +34590,7 @@ bool js_register_cocos2dx_ParallaxNode(se::Object* obj)
__jsb_cocos2d_ParallaxNode_proto = cls->getProto();
__jsb_cocos2d_ParallaxNode_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.ParallaxNode.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "ParallaxNode");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -36442,7 +36443,7 @@ bool js_register_cocos2dx_TMXMapInfo(se::Object* obj)
__jsb_cocos2d_TMXMapInfo_proto = cls->getProto();
__jsb_cocos2d_TMXMapInfo_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.TMXMapInfo.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "TMXMapInfo");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -37008,7 +37009,7 @@ bool js_register_cocos2dx_TMXLayer(se::Object* obj)
__jsb_cocos2d_TMXLayer_proto = cls->getProto();
__jsb_cocos2d_TMXLayer_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.TMXLayer.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "TMXLayer");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -37474,7 +37475,7 @@ bool js_register_cocos2dx_TMXTiledMap(se::Object* obj)
__jsb_cocos2d_TMXTiledMap_proto = cls->getProto();
__jsb_cocos2d_TMXTiledMap_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.TMXTiledMap.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "TMXTiledMap");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -37645,7 +37646,7 @@ bool js_register_cocos2dx_TileMapAtlas(se::Object* obj)
__jsb_cocos2d_TileMapAtlas_proto = cls->getProto();
__jsb_cocos2d_TileMapAtlas_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.TileMapAtlas.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "TileMapAtlas");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -37700,7 +37701,7 @@ bool js_register_cocos2dx_BaseJSAction(se::Object* obj)
__jsb_cocos2d_BaseJSAction_proto = cls->getProto();
__jsb_cocos2d_BaseJSAction_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.BaseJSAction.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "BaseJSAction");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -1,5 +1,6 @@
#include "scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "editor-support/dragonbones/cocos2dx/CCDragonBonesHeaders.h"
se::Object* __jsb_dragonBones_BaseObject_proto = nullptr;
@@ -1,6 +1,7 @@
#include "scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "ui/UIVideoPlayer.h"
se::Object* __jsb_cocos2d_experimental_ui_VideoPlayer_proto = nullptr;
@@ -1,6 +1,7 @@
#include "scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.hpp"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "ui/UIWebView.h"
se::Object* __jsb_cocos2d_experimental_ui_WebView_proto = nullptr;
@@ -1,5 +1,6 @@
#include "scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "extensions/cocos-ext.h"
se::Object* __jsb_cocos2d_extension_EventAssetsManagerEx_proto = nullptr;
@@ -1,5 +1,6 @@
#include "scripting/js-bindings/auto/jsb_cocos2dx_network_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "network/CCDownloader.h"
se::Object* __jsb_cocos2d_network_Downloader_proto = nullptr;
@@ -1,5 +1,6 @@
#include "scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "spine/spine-cocos2dx.h"
se::Object* __jsb_spine_SkeletonRenderer_proto = nullptr;
@@ -1721,7 +1722,7 @@ bool js_register_cocos2dx_spine_SkeletonAnimation(se::Object* obj)
__jsb_spine_SkeletonAnimation_proto = cls->getProto();
__jsb_spine_SkeletonAnimation_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { sp.SkeletonAnimation.extend = cc.Class.extend; })()");
jsb_set_extend_property("sp", "SkeletonAnimation");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -1,5 +1,6 @@
#include "scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "ui/CocosGUI.h"
se::Object* __jsb_cocos2d_ui_Widget_proto = nullptr;
@@ -1424,7 +1425,7 @@ bool js_register_cocos2dx_ui_Widget(se::Object* obj)
__jsb_cocos2d_ui_Widget_proto = cls->getProto();
__jsb_cocos2d_ui_Widget_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { ccui.Widget.extend = cc.Class.extend; })()");
jsb_set_extend_property("ccui", "Widget");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -2690,7 +2691,7 @@ bool js_register_cocos2dx_ui_Scale9Sprite(se::Object* obj)
__jsb_cocos2d_ui_Scale9Sprite_proto = cls->getProto();
__jsb_cocos2d_ui_Scale9Sprite_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { ccui.Scale9Sprite.extend = cc.Class.extend; })()");
jsb_set_extend_property("ccui", "Scale9Sprite");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -3285,7 +3286,7 @@ bool js_register_cocos2dx_ui_EditBox(se::Object* obj)
__jsb_cocos2d_ui_EditBox_proto = cls->getProto();
__jsb_cocos2d_ui_EditBox_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { ccui.EditBox.extend = cc.Class.extend; })()");
jsb_set_extend_property("ccui", "EditBox");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -1,5 +1,6 @@
#include "scripting/js-bindings/auto/jsb_creator_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
#include "creator/CCScale9Sprite.h"
#include "creator/CCGraphicsNode.h"
#include "editor-support/creator/physics/CCPhysicsDebugDraw.h"
@@ -749,7 +750,7 @@ bool js_register_creator_Scale9SpriteV2(se::Object* obj)
__jsb_creator_Scale9SpriteV2_proto = cls->getProto();
__jsb_creator_Scale9SpriteV2_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.Scale9SpriteV2.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "Scale9SpriteV2");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -1518,7 +1519,7 @@ bool js_register_creator_GraphicsNode(se::Object* obj)
__jsb_creator_GraphicsNode_proto = cls->getProto();
__jsb_creator_GraphicsNode_class = cls;
se::ScriptEngine::getInstance()->evalString("(function () { cc.GraphicsNode.extend = cc.Class.extend; })()");
jsb_set_extend_property("cc", "GraphicsNode");
se::ScriptEngine::getInstance()->clearException();
return true;
}
@@ -256,9 +256,9 @@ bool foo()
* JS引擎在se::Object::createXXX后,如果由于某种原因JS引擎做了GC操作,导致后续使用的se::Object内部引用了一个非法指针,引发程序崩溃
为了解决上述两个问题,抽象层定义了一个辅助管理**手动创建对象**的类型,即se::handleObject。
为了解决上述两个问题,抽象层定义了一个辅助管理**手动创建对象**的类型,即`se::HandleObject`。
se::HandleObject是一个辅助类,用于更加简单地管理手动创建的se::Object对象的释放、root和unroot操作。
`se::HandleObject`是一个辅助类,用于更加简单地管理手动创建的se::Object对象的释放、root和unroot操作。
以下两种代码写法是等价的,使用se::HandleObject的代码量明显少很多,而且更加安全。
```c++
@@ -805,24 +805,72 @@ persistent_classes = TextureCache SpriteFrameCache FileUtils EventDispatcher Act
classes_owned_by_cpp =
```
## 远程调试
## 远程调试与Profile
默认远程调试和Profile是在debug模式中生效的,如果需要在release模式下也启用,需要手动修改cocos/scripting/js-bindings/jswrapper/config.hpp中的宏开关。
```c++
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0
#define SE_ENABLE_INSPECTOR 1
#define SE_DEBUG 2
#else
#define SE_ENABLE_INSPECTOR 0
#define SE_DEBUG 0
#endif
```
改为:
```c++
#if 1 // 这里改为1,强制启用调试
#define SE_ENABLE_INSPECTOR 1
#define SE_DEBUG 2
#else
#define SE_ENABLE_INSPECTOR 0
#define SE_DEBUG 0
#endif
```
### Chrome远程调试V8
TBD
#### Windows
Windows:
* 运行游戏
* 用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)
断点调试:
![](v8-win32-debug.jpg)
抓取JS Heap
![](v8-win32-memory.jpg)
Profile
![](v8-win32-profile.jpg)
#### Android
* 运行游戏
* 用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相同
Android:
### Safari远程调试JavaScriptCore
TBD
#### macOS
Mac:
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)
iOS:
#### 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步类似)
## Q & A
@@ -851,7 +899,10 @@ bool AppDelegate::applicationDidFinishLaunching()
```
### se::Object::root/unroot 与 se::Object::incRef/decRef的区别?
TBD
root/unroot用于控制JS对象是否受GC控制,root表示不受GC控制,unroot则相反,表示交由GC控制,对一个se::Object来说,root和unroot可以被调用多次,se::Object内部有_rootCount变量用于表示root的次数。当unroot被调用,且_rootCount为0时,se::Object关联的JS对象将交由GC管理。还有一种情况,即如果se::Object的析构被触发了,如果_rootCount > 0,则强制把JS对象交由GC控制。
incRef/decRef用于控制se::Object这个`cpp`对象的生命周期,前面章节已经提及,建议用户使用se::HandleObject来控制`手动创建非绑定对象`的方式控制se::Object的生命周期。因此,一般情况下,开发者不需要接触到incRef/decRef。
### 对象生命周期的关联与解除关联
Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

@@ -2,6 +2,7 @@
#include "ChakraCore.h"
#include "ChakraCoreVersion.h"
#include <string>
#include <vector>
@@ -225,13 +225,14 @@ namespace se {
return exist;
}
void Object::setProperty(const char* name, const Value& v)
bool Object::setProperty(const char* name, const Value& v)
{
JsValueRef jsValue = JS_INVALID_REFERENCE;
internal::seToJsValue(v, &jsValue);
JsPropertyIdRef propertyId;
_CHECK(JsCreatePropertyId(name, strlen(name), &propertyId));
_CHECK(JsSetProperty(_obj, propertyId, jsValue, true));
return true;
}
bool Object::defineProperty(const char *name, JsNativeFunction getter, JsNativeFunction setter)
@@ -24,7 +24,7 @@ namespace se {
static Object* createObjectWithClass(Class* cls);
bool getProperty(const char* name, Value* data);
void setProperty(const char* name, const Value& v);
bool setProperty(const char* name, const Value& v);
bool defineProperty(const char *name, JsNativeFunction getter, JsNativeFunction setter);
bool isFunction() const;
@@ -70,7 +70,6 @@ namespace se {
: _rt(JS_INVALID_RUNTIME_HANDLE)
, _cx(JS_INVALID_REFERENCE)
, _globalObj(nullptr)
, _nodeEventListener(nullptr)
, _exceptionCallback(nullptr)
, _currentSourceContext(0)
, _vmId(0)
@@ -84,7 +83,7 @@ namespace se {
bool ScriptEngine::init()
{
cleanup();
LOGD("Initializing ChakraCore ... \n");
LOGD("Initializing ChakraCore, version: %d.%d.%d\n", CHAKRA_CORE_MAJOR_VERSION, CHAKRA_CORE_MINOR_VERSION, CHAKRA_CORE_PATCH_VERSION);
++_vmId;
for (const auto& hook : _beforeInitHookArray)
@@ -159,7 +158,6 @@ namespace se {
_cx = nullptr;
_globalObj = nullptr;
_isValid = false;
_nodeEventListener = nullptr;
_registerCallbackArray.clear();
@@ -423,23 +421,17 @@ namespace se {
iterOwner->second->detachObject(iterTarget->second);
}
bool ScriptEngine::_onReceiveNodeEvent(void* node, NodeEventType type)
{
assert(_nodeEventListener != nullptr);
return _nodeEventListener(node, type);
}
bool ScriptEngine::_setNodeEventListener(NodeEventListener listener)
{
_nodeEventListener = listener;
return true;
}
void ScriptEngine::enableDebugger(unsigned int port/* = 5086*/)
void ScriptEngine::enableDebugger(const std::string& serverAddr, uint32_t port)
{
//FIXME:
}
bool ScriptEngine::isDebuggerEnabled() const
{
//FIXME:
return false;
}
void ScriptEngine::mainLoopUpdate()
{
//FIXME:
@@ -119,7 +119,8 @@ namespace se {
void setExceptionCallback(const ExceptionCallback& cb);
const std::chrono::steady_clock::time_point& getStartTime() const { return _startTime; }
void enableDebugger(unsigned int port = 5086);
void enableDebugger(const std::string& serverAddr, uint32_t port);
bool isDebuggerEnabled() const;
void mainLoopUpdate();
uint32_t getVMId() const { return _vmId; }
@@ -127,18 +128,6 @@ namespace se {
void _retainScriptObject(void* owner, void* target);
void _releaseScriptObject(void* owner, void* target);
enum class NodeEventType
{
ENTER,
EXIT,
ENTER_TRANSITION_DID_FINISH,
EXIT_TRANSITION_DID_START,
CLEANUP
};
bool _onReceiveNodeEvent(void* node, NodeEventType type);
using NodeEventListener = bool(*)(void*, NodeEventType);
bool _setNodeEventListener(NodeEventListener listener);
private:
struct ExceptionInfo
{
@@ -164,7 +153,6 @@ namespace se {
JsContextRef _cx;
Object* _globalObj;
NodeEventListener _nodeEventListener;
FileOperationDelegate _fileOperationDelegate;
ExceptionCallback _exceptionCallback;
@@ -14,9 +14,13 @@
#define SCRIPT_ENGINE_TYPE SCRIPT_ENGINE_NONE
#endif
#define SE_ENABLE_INSPECTOR 0
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0
#define SE_ENABLE_INSPECTOR 1
#define SE_DEBUG 2
#else
#define SE_ENABLE_INSPECTOR 0
#define SE_DEBUG 0
#endif
#ifdef ANDROID
@@ -61,6 +65,7 @@ void seLog(const char * format, ...);
#ifndef __SSIZE_T
#define __SSIZE_T
typedef SSIZE_T ssize_t;
#define _SSIZE_T_DEFINED // libuv also defines ssize_t, use the one defined here.
#endif // __SSIZE_T
#endif
@@ -227,8 +227,9 @@ namespace se {
return exist;
}
void Object::setProperty(const char* name, const Value& v)
bool Object::setProperty(const char* name, const Value& v)
{
bool ret = true;
JSStringRef jsName = JSStringCreateWithUTF8CString(name);
JSValueRef jsValue = nullptr;
JSObjectRef obj = _obj;
@@ -265,9 +266,12 @@ namespace se {
if (exception != nullptr)
{
ScriptEngine::getInstance()->_clearException(exception);
ret = false;
}
JSStringRelease(jsName);
return ret;
}
bool Object::defineProperty(const char *name, JSObjectCallAsFunctionCallback getter, JSObjectCallAsFunctionCallback setter)
@@ -87,8 +87,9 @@ namespace se {
* @brief Sets a property to an object.
* @param[in] name A utf-8 string containing the property's name.
* @param[in] value A value to be used as the property's value.
* @return true if the property is set successfully, otherwise false.
*/
void setProperty(const char* name, const Value& value);
bool setProperty(const char* name, const Value& value);
/**
* @brief Defines a property with native accessor callbacks for an object.
@@ -83,13 +83,13 @@ namespace se {
ScriptEngine::ScriptEngine()
: _cx(nullptr)
, _globalObj(nullptr)
, _nodeEventListener(nullptr)
, _exceptionCallback(nullptr)
, _vmId(0)
, _isGarbageCollecting(false)
, _isValid(false)
, _isInCleanup(false)
, _isErrorHandleWorking(false)
, _isDebuggerEnabled(false)
{
}
@@ -183,7 +183,6 @@ namespace se {
_cx = nullptr;
_globalObj = nullptr;
_isValid = false;
_nodeEventListener = nullptr;
_registerCallbackArray.clear();
@@ -393,11 +392,20 @@ namespace se {
if (fileName == nullptr)
fileName = "(no filename)";
// Fix the source url is too long displayed in Safari debugger.
std::string sourceUrl = fileName;
static const std::string prefixKey = "/temp/quick-scripts/";
size_t prefixPos = sourceUrl.find(prefixKey);
if (prefixPos != std::string::npos)
{
sourceUrl = sourceUrl.substr(prefixPos + prefixKey.length());
}
std::string exceptionStr;
std::string scriptStr(script, length);
JSValueRef exception = nullptr;
JSStringRef jsSourceUrl = JSStringCreateWithUTF8CString(fileName);
JSStringRef jsSourceUrl = JSStringCreateWithUTF8CString(sourceUrl.c_str());
JSStringRef jsScript = JSStringCreateWithUTF8CString(scriptStr.c_str());
JSValueRef result = nullptr;
@@ -490,26 +498,20 @@ namespace se {
iterOwner->second->detachObject(iterTarget->second);
}
bool ScriptEngine::_onReceiveNodeEvent(void* node, NodeEventType type)
{
assert(_nodeEventListener != nullptr);
return _nodeEventListener(node, type);
}
bool ScriptEngine::_setNodeEventListener(NodeEventListener listener)
{
_nodeEventListener = listener;
return true;
}
void ScriptEngine::clearException()
{
//FIXME:
}
void ScriptEngine::enableDebugger(unsigned int port/* = 5086*/)
void ScriptEngine::enableDebugger(const std::string& serverAddr, uint32_t port)
{
// empty implementation
_isDebuggerEnabled = true;
}
bool ScriptEngine::isDebuggerEnabled() const
{
return _isDebuggerEnabled;
}
void ScriptEngine::mainLoopUpdate()
@@ -202,6 +202,7 @@ namespace se {
/**
* @brief Gets the start time of script engine.
* @return The start time of script engine.
*/
const std::chrono::steady_clock::time_point& getStartTime() const { return _startTime; }
@@ -209,7 +210,13 @@ namespace se {
* @brief Enables JavaScript debugger
* @param[in] port The port of debugger server will use.
*/
void enableDebugger(unsigned int port = 5086);
void enableDebugger(const std::string& serverAddr, uint32_t port);
/**
* @brief Tests whether JavaScript debugger is enabled
* @return true if JavaScript debugger is enabled, otherwise false.
*/
bool isDebuggerEnabled() const;
/**
* @brief Main loop update trigger, it's need to invoked in main thread every frame.
@@ -225,18 +232,6 @@ namespace se {
void _retainScriptObject(void* owner, void* target);
void _releaseScriptObject(void* owner, void* target);
enum class NodeEventType
{
ENTER,
EXIT,
ENTER_TRANSITION_DID_FINISH,
EXIT_TRANSITION_DID_START,
CLEANUP
};
bool _onReceiveNodeEvent(void* node, NodeEventType type);
using NodeEventListener = bool(*)(void*, NodeEventType);
bool _setNodeEventListener(NodeEventListener listener);
void _clearException(JSValueRef exception);
JSContextRef _getContext() const { return _cx; }
@@ -279,7 +274,6 @@ namespace se {
JSGlobalContextRef _cx;
Object* _globalObj;
NodeEventListener _nodeEventListener;
FileOperationDelegate _fileOperationDelegate;
ExceptionCallback _exceptionCallback;
@@ -289,6 +283,7 @@ namespace se {
bool _isValid;
bool _isInCleanup;
bool _isErrorHandleWorking;
bool _isDebuggerEnabled;
};
} // namespace se {
@@ -176,13 +176,13 @@ namespace se {
return ok;
}
void Object::setProperty(const char* name, const Value& v)
bool Object::setProperty(const char* name, const Value& v)
{
JS::RootedObject object(__cx, _getJSObject());
JS::RootedValue value(__cx);
internal::seToJsValue(__cx, v, &value);
JS_SetProperty(__cx, object, name, value);
return JS_SetProperty(__cx, object, name, value);
}
bool Object::defineProperty(const char *name, JSNative getter, JSNative setter)
@@ -24,7 +24,7 @@ namespace se {
static Object* getObjectWithPtr(void* ptr);
bool getProperty(const char* name, Value* data);
void setProperty(const char* name, const Value& v);
bool setProperty(const char* name, const Value& v);
bool defineProperty(const char *name, JSNative getter, JSNative setter);
bool isFunction() const;
@@ -248,8 +248,8 @@ namespace se {
, _globalObj(nullptr)
, _debugGlobalObj(nullptr)
, _oldCompartment(nullptr)
, _nodeEventListener(nullptr)
, _exceptionCallback(nullptr)
, _debuggerServerPort(0)
, _vmId(0)
, _isGarbageCollecting(false)
, _isValid(false)
@@ -302,7 +302,7 @@ namespace se {
bool ScriptEngine::init()
{
cleanup();
LOGD("Initializing SpiderMonkey \n");
LOGD("Initializing SpiderMonkey, version: %s\n", JS_GetImplementationVersion());
++_vmId;
for (const auto& hook : _beforeInitHookArray)
@@ -453,7 +453,6 @@ namespace se {
_globalObj = nullptr;
_oldCompartment = nullptr;
_isValid = false;
_nodeEventListener = nullptr;
_registerCallbackArray.clear();
@@ -512,11 +511,317 @@ namespace se {
_registerCallbackArray.push_back(cb);
}
#pragma mark - Debug
static std::string inData;
static std::string outData;
static std::vector<std::string> g_queue;
static std::mutex g_qMutex;
static std::mutex g_rwMutex;
static int clientSocket = -1;
static uint32_t s_nestedLoopLevel = 0;
static void cc_closesocket(int fd)
{
#ifdef _WIN32
closesocket(fd);
#else
close(fd);
#endif
}
void ScriptEngine::_debugProcessInput(const std::string& str)
{
JS::RootedObject debugGlobal(_cx, _debugGlobalObj->_getJSObject());
JSCompartment *globalCpt = JS_EnterCompartment(_cx, debugGlobal);
Value func;
if (_debugGlobalObj->getProperty("processInput", &func) && func.isObject() && func.toObject()->isFunction())
{
ValueArray args;
args.push_back(Value(str));
func.toObject()->call(args, _debugGlobalObj);
}
JS_LeaveCompartment(_cx, globalCpt);
}
static bool NS_ProcessNextEvent()
{
std::string message;
size_t messageCount = 0;
while (true)
{
g_qMutex.lock();
messageCount = g_queue.size();
if (messageCount > 0)
{
auto first = g_queue.begin();
message = *first;
g_queue.erase(first);
--messageCount;
}
g_qMutex.unlock();
if (!message.empty())
{
ScriptEngine::getInstance()->_debugProcessInput(message);
}
if (messageCount == 0)
break;
}
// std::this_thread::yield();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
return true;
}
static bool JSBDebug_enterNestedEventLoop(State& s)
{
enum {
NS_OK = 0,
NS_ERROR_UNEXPECTED
};
#define NS_SUCCEEDED(v) ((v) == NS_OK)
int rv = NS_OK;
uint32_t nestLevel = ++s_nestedLoopLevel;
while (NS_SUCCEEDED(rv) && s_nestedLoopLevel >= nestLevel) {
drainJobQueue();
if (!NS_ProcessNextEvent())
rv = NS_ERROR_UNEXPECTED;
}
assert(s_nestedLoopLevel <= nestLevel);
s.rval().setInt32(s_nestedLoopLevel);
return true;
}
SE_BIND_FUNC(JSBDebug_enterNestedEventLoop)
static bool JSBDebug_exitNestedEventLoop(State& s)
{
if (s_nestedLoopLevel > 0) {
--s_nestedLoopLevel;
} else {
s.rval().setInt32(0);
return true;
}
return true;
}
SE_BIND_FUNC(JSBDebug_exitNestedEventLoop)
static bool JSBDebug_getEventLoopNestLevel(State& s)
{
s.rval().setInt32(s_nestedLoopLevel);
return true;
}
SE_BIND_FUNC(JSBDebug_getEventLoopNestLevel)
static void _clientSocketWriteAndClearString(std::string& s)
{
::send(clientSocket, s.c_str(), s.length(), 0);
s.clear();
}
static void processInput(const std::string& data) {
std::lock_guard<std::mutex> lk(g_qMutex);
g_queue.push_back(data);
}
static void clearBuffers() {
std::lock_guard<std::mutex> lk(g_rwMutex);
// only process input if there's something and we're not locked
if (!inData.empty()) {
processInput(inData);
inData.clear();
}
if (!outData.empty()) {
_clientSocketWriteAndClearString(outData);
}
}
static void serverEntryPoint(uint32_t port)
{
// start a server, accept the connection and keep reading data from it
struct addrinfo hints, *result = nullptr, *rp = nullptr;
int s = 0;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; // TCP stream sockets
hints.ai_flags = AI_PASSIVE; // fill in my IP for me
std::stringstream portstr;
portstr << port;
int err = 0;
#ifdef _WIN32
WSADATA wsaData;
err = WSAStartup(MAKEWORD(2, 2),&wsaData);
#endif
if ((err = getaddrinfo(NULL, portstr.str().c_str(), &hints, &result)) != 0) {
LOGD("getaddrinfo error : %s\n", gai_strerror(err));
}
for (rp = result; rp != NULL; rp = rp->ai_next) {
if ((s = socket(rp->ai_family, rp->ai_socktype, 0)) < 0) {
continue;
}
int optval = 1;
if ((setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&optval, sizeof(optval))) < 0) {
cc_closesocket(s);
TRACE_DEBUGGER_SERVER("debug server : error setting socket option SO_REUSEADDR\n");
return;
}
#ifdef __APPLE__
if ((setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval))) < 0) {
close(s);
TRACE_DEBUGGER_SERVER("debug server : error setting socket option SO_NOSIGPIPE\n");
return;
}
#endif
if ((::bind(s, rp->ai_addr, rp->ai_addrlen)) == 0) {
break;
}
cc_closesocket(s);
s = -1;
}
if (s < 0 || rp == NULL) {
TRACE_DEBUGGER_SERVER("debug server : error creating/binding socket\n");
return;
}
freeaddrinfo(result);
listen(s, 1);
#define MAX_RECEIVED_SIZE 1024
#define BUF_SIZE MAX_RECEIVED_SIZE + 1
char buf[BUF_SIZE] = {0};
int readBytes = 0;
while (true) {
clientSocket = accept(s, NULL, NULL);
if (clientSocket < 0)
{
TRACE_DEBUGGER_SERVER("debug server : error on accept\n");
return;
}
else
{
// read/write data
TRACE_DEBUGGER_SERVER("debug server : client connected\n");
inData = "connected";
// process any input, send any output
clearBuffers();
while ((readBytes = (int)::recv(clientSocket, buf, MAX_RECEIVED_SIZE, 0)) > 0)
{
buf[readBytes] = '\0';
// TRACE_DEBUGGER_SERVER("debug server : received command >%s", buf);
// no other thread is using this
inData.append(buf);
// process any input, send any output
clearBuffers();
} // while(read)
cc_closesocket(clientSocket);
}
} // while(true)
#undef BUF_SIZE
#undef MAX_RECEIVED_SIZE
}
static bool JSBDebug_require(State& s)
{
const auto& args = s.args();
int argc = (int)args.size();
if (argc >= 1)
{
ScriptEngine::getInstance()->runScript(args[0].toString());
return true;
}
SE_REPORT_ERROR("Wrong number of arguments: %d, expected: %d", argc, 1);
return false;
}
SE_BIND_FUNC(JSBDebug_require)
static bool JSBDebug_BufferWrite(State& s)
{
const auto& args = s.args();
int argc = (int)args.size();
if (argc == 1)
{
// this is safe because we're already inside a lock (from clearBuffers)
outData.append(args[0].toString());
_clientSocketWriteAndClearString(outData);
}
return true;
}
SE_BIND_FUNC(JSBDebug_BufferWrite)
bool ScriptEngine::start()
{
if (!init())
return false;
if (_debugGlobalObj == nullptr)
{
JS::CompartmentOptions options;
options.behaviors().setVersion(JSVERSION_LATEST);
options.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
JS::RootedObject debugGlobal(_cx, JS_NewGlobalObject(_cx, &__globalClass, nullptr, JS::DontFireOnNewGlobalHook, options));
_debugGlobalObj = Object::_createJSObject(nullptr, debugGlobal);
_debugGlobalObj->root();
JSCompartment *globalCpt = JS_EnterCompartment(_cx, debugGlobal);
JS_InitStandardClasses(_cx, debugGlobal);
JS_FireOnNewGlobalObject(_cx, debugGlobal);
JS_DefineDebuggerObject(_cx, debugGlobal);
// these are used in the debug program
JS_DefineFunction(_cx, debugGlobal, "log", __log, 0, JSPROP_PERMANENT);
_debugGlobalObj->defineFunction("require", _SE(JSBDebug_require));
_debugGlobalObj->defineFunction("_bufferWrite", _SE(JSBDebug_BufferWrite));
_debugGlobalObj->defineFunction("_enterNestedEventLoop", _SE(JSBDebug_enterNestedEventLoop));
_debugGlobalObj->defineFunction("_exitNestedEventLoop", _SE(JSBDebug_exitNestedEventLoop));
_debugGlobalObj->defineFunction("_getEventLoopNestLevel", _SE(JSBDebug_getEventLoopNestLevel));
JS::RootedObject globalObj(_cx, _globalObj->_getJSObject());
JS_WrapObject(_cx, &globalObj);
runScript("script/jsb_debugger.js");
// prepare the debugger
Value prepareDebuggerFunc;
assert(_debugGlobalObj->getProperty("_prepareDebugger", &prepareDebuggerFunc) && prepareDebuggerFunc.isObject() && prepareDebuggerFunc.toObject()->isFunction());
ValueArray args;
args.push_back(Value(_globalObj));
prepareDebuggerFunc.toObject()->call(args, _debugGlobalObj);
// start bg thread
auto t = std::thread(&serverEntryPoint, _debuggerServerPort);
t.detach();
JS_LeaveCompartment(_cx, globalCpt);
}
bool ok = false;
_startTime = std::chrono::steady_clock::now();
@@ -721,18 +1026,6 @@ namespace se {
iterOwner->second->detachObject(iterTarget->second);
}
bool ScriptEngine::_onReceiveNodeEvent(void* node, NodeEventType type)
{
assert(_nodeEventListener != nullptr);
return _nodeEventListener(node, type);
}
bool ScriptEngine::_setNodeEventListener(NodeEventListener listener)
{
_nodeEventListener = listener;
return true;
}
void ScriptEngine::clearException()
{
if (_cx == nullptr)
@@ -813,317 +1106,15 @@ namespace se {
_exceptionCallback = cb;
}
#pragma mark - Debug
static std::string inData;
static std::string outData;
static std::vector<std::string> g_queue;
static std::mutex g_qMutex;
static std::mutex g_rwMutex;
static int clientSocket = -1;
static uint32_t s_nestedLoopLevel = 0;
static void cc_closesocket(int fd)
void ScriptEngine::enableDebugger(const std::string& serverAddr, uint32_t port)
{
#ifdef _WIN32
closesocket(fd);
#else
close(fd);
#endif
_debuggerServerAddr = serverAddr;
_debuggerServerPort = port;
}
void ScriptEngine::_debugProcessInput(const std::string& str)
bool ScriptEngine::isDebuggerEnabled() const
{
JS::RootedObject debugGlobal(_cx, _debugGlobalObj->_getJSObject());
JSCompartment *globalCpt = JS_EnterCompartment(_cx, debugGlobal);
Value func;
if (_debugGlobalObj->getProperty("processInput", &func) && func.isObject() && func.toObject()->isFunction())
{
ValueArray args;
args.push_back(Value(str));
func.toObject()->call(args, _debugGlobalObj);
}
JS_LeaveCompartment(_cx, globalCpt);
}
static bool NS_ProcessNextEvent()
{
std::string message;
size_t messageCount = 0;
while (true)
{
g_qMutex.lock();
messageCount = g_queue.size();
if (messageCount > 0)
{
auto first = g_queue.begin();
message = *first;
g_queue.erase(first);
--messageCount;
}
g_qMutex.unlock();
if (!message.empty())
{
ScriptEngine::getInstance()->_debugProcessInput(message);
}
if (messageCount == 0)
break;
}
// std::this_thread::yield();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
return true;
}
static bool JSBDebug_enterNestedEventLoop(State& s)
{
enum {
NS_OK = 0,
NS_ERROR_UNEXPECTED
};
#define NS_SUCCEEDED(v) ((v) == NS_OK)
int rv = NS_OK;
uint32_t nestLevel = ++s_nestedLoopLevel;
while (NS_SUCCEEDED(rv) && s_nestedLoopLevel >= nestLevel) {
drainJobQueue();
if (!NS_ProcessNextEvent())
rv = NS_ERROR_UNEXPECTED;
}
assert(s_nestedLoopLevel <= nestLevel);
s.rval().setInt32(s_nestedLoopLevel);
return true;
}
SE_BIND_FUNC(JSBDebug_enterNestedEventLoop)
static bool JSBDebug_exitNestedEventLoop(State& s)
{
if (s_nestedLoopLevel > 0) {
--s_nestedLoopLevel;
} else {
s.rval().setInt32(0);
return true;
}
return true;
}
SE_BIND_FUNC(JSBDebug_exitNestedEventLoop)
static bool JSBDebug_getEventLoopNestLevel(State& s)
{
s.rval().setInt32(s_nestedLoopLevel);
return true;
}
SE_BIND_FUNC(JSBDebug_getEventLoopNestLevel)
static void _clientSocketWriteAndClearString(std::string& s)
{
::send(clientSocket, s.c_str(), s.length(), 0);
s.clear();
}
static void processInput(const std::string& data) {
std::lock_guard<std::mutex> lk(g_qMutex);
g_queue.push_back(data);
}
static void clearBuffers() {
std::lock_guard<std::mutex> lk(g_rwMutex);
// only process input if there's something and we're not locked
if (!inData.empty()) {
processInput(inData);
inData.clear();
}
if (!outData.empty()) {
_clientSocketWriteAndClearString(outData);
}
}
static void serverEntryPoint(unsigned int port)
{
// start a server, accept the connection and keep reading data from it
struct addrinfo hints, *result = nullptr, *rp = nullptr;
int s = 0;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; // TCP stream sockets
hints.ai_flags = AI_PASSIVE; // fill in my IP for me
std::stringstream portstr;
portstr << port;
int err = 0;
#ifdef _WIN32
WSADATA wsaData;
err = WSAStartup(MAKEWORD(2, 2),&wsaData);
#endif
if ((err = getaddrinfo(NULL, portstr.str().c_str(), &hints, &result)) != 0) {
LOGD("getaddrinfo error : %s\n", gai_strerror(err));
}
for (rp = result; rp != NULL; rp = rp->ai_next) {
if ((s = socket(rp->ai_family, rp->ai_socktype, 0)) < 0) {
continue;
}
int optval = 1;
if ((setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&optval, sizeof(optval))) < 0) {
cc_closesocket(s);
TRACE_DEBUGGER_SERVER("debug server : error setting socket option SO_REUSEADDR");
return;
}
#ifdef __APPLE__
if ((setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval))) < 0) {
close(s);
TRACE_DEBUGGER_SERVER("debug server : error setting socket option SO_NOSIGPIPE");
return;
}
#endif
if ((::bind(s, rp->ai_addr, rp->ai_addrlen)) == 0) {
break;
}
cc_closesocket(s);
s = -1;
}
if (s < 0 || rp == NULL) {
TRACE_DEBUGGER_SERVER("debug server : error creating/binding socket");
return;
}
freeaddrinfo(result);
listen(s, 1);
#define MAX_RECEIVED_SIZE 1024
#define BUF_SIZE MAX_RECEIVED_SIZE + 1
char buf[BUF_SIZE] = {0};
int readBytes = 0;
while (true) {
clientSocket = accept(s, NULL, NULL);
if (clientSocket < 0)
{
TRACE_DEBUGGER_SERVER("debug server : error on accept");
return;
}
else
{
// read/write data
TRACE_DEBUGGER_SERVER("debug server : client connected");
inData = "connected";
// process any input, send any output
clearBuffers();
while ((readBytes = (int)::recv(clientSocket, buf, MAX_RECEIVED_SIZE, 0)) > 0)
{
buf[readBytes] = '\0';
// TRACE_DEBUGGER_SERVER("debug server : received command >%s", buf);
// no other thread is using this
inData.append(buf);
// process any input, send any output
clearBuffers();
} // while(read)
cc_closesocket(clientSocket);
}
} // while(true)
#undef BUF_SIZE
#undef MAX_RECEIVED_SIZE
}
static bool JSBDebug_require(State& s)
{
const auto& args = s.args();
int argc = (int)args.size();
if (argc >= 1)
{
ScriptEngine::getInstance()->runScript(args[0].toString());
return true;
}
SE_REPORT_ERROR("Wrong number of arguments: %d, expected: %d", argc, 1);
return false;
}
SE_BIND_FUNC(JSBDebug_require)
static bool JSBDebug_BufferWrite(State& s)
{
const auto& args = s.args();
int argc = (int)args.size();
if (argc == 1)
{
// this is safe because we're already inside a lock (from clearBuffers)
outData.append(args[0].toString());
_clientSocketWriteAndClearString(outData);
}
return true;
}
SE_BIND_FUNC(JSBDebug_BufferWrite)
void ScriptEngine::enableDebugger(unsigned int port)
{
if (_debugGlobalObj != nullptr)
{
LOGD("Debugger was enabled!");
return;
}
JS::CompartmentOptions options;
options.behaviors().setVersion(JSVERSION_LATEST);
options.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
JS::RootedObject debugGlobal(_cx, JS_NewGlobalObject(_cx, &__globalClass, nullptr, JS::DontFireOnNewGlobalHook, options));
_debugGlobalObj = Object::_createJSObject(nullptr, debugGlobal);
_debugGlobalObj->root();
JSCompartment *globalCpt = JS_EnterCompartment(_cx, debugGlobal);
JS_InitStandardClasses(_cx, debugGlobal);
//cjh registerDefaultClasses(_cx, debugGlobal);
JS_FireOnNewGlobalObject(_cx, debugGlobal);
JS_DefineDebuggerObject(_cx, debugGlobal);
// these are used in the debug program
JS_DefineFunction(_cx, debugGlobal, "log", __log, 0, JSPROP_PERMANENT);
_debugGlobalObj->defineFunction("require", _SE(JSBDebug_require));
_debugGlobalObj->defineFunction("_bufferWrite", _SE(JSBDebug_BufferWrite));
_debugGlobalObj->defineFunction("_enterNestedEventLoop", _SE(JSBDebug_enterNestedEventLoop));
_debugGlobalObj->defineFunction("_exitNestedEventLoop", _SE(JSBDebug_exitNestedEventLoop));
_debugGlobalObj->defineFunction("_getEventLoopNestLevel", _SE(JSBDebug_getEventLoopNestLevel));
JS::RootedObject globalObj(_cx, _globalObj->_getJSObject());
JS_WrapObject(_cx, &globalObj);
runScript("script/jsb_debugger.js");
// prepare the debugger
Value prepareDebuggerFunc;
assert(_debugGlobalObj->getProperty("_prepareDebugger", &prepareDebuggerFunc) && prepareDebuggerFunc.isObject() && prepareDebuggerFunc.toObject()->isFunction());
ValueArray args;
args.push_back(Value(_globalObj));
prepareDebuggerFunc.toObject()->call(args, _debugGlobalObj);
// start bg thread
auto t = std::thread(&serverEntryPoint, port);
t.detach();
JS_LeaveCompartment(_cx, globalCpt);
return !_debuggerServerAddr.empty() && _debuggerServerPort > 0;
}
void ScriptEngine::mainLoopUpdate()
@@ -104,7 +104,8 @@ namespace se {
const std::chrono::steady_clock::time_point& getStartTime() const { return _startTime; }
void enableDebugger(unsigned int port = 5086);
void enableDebugger(const std::string& serverAddr, uint32_t port);
bool isDebuggerEnabled() const;
void mainLoopUpdate();
uint32_t getVMId() const { return _vmId; }
@@ -112,19 +113,6 @@ namespace se {
void _retainScriptObject(void* owner, void* target);
void _releaseScriptObject(void* owner, void* target);
enum class NodeEventType
{
ENTER,
EXIT,
ENTER_TRANSITION_DID_FINISH,
EXIT_TRANSITION_DID_START,
CLEANUP
};
bool _onReceiveNodeEvent(void* node, NodeEventType type);
using NodeEventListener = bool(*)(void*, NodeEventType);
bool _setNodeEventListener(NodeEventListener listener);
void _debugProcessInput(const std::string& str);
private:
@@ -139,7 +127,6 @@ namespace se {
Object* _globalObj;
Object* _debugGlobalObj;
NodeEventListener _nodeEventListener;
FileOperationDelegate _fileOperationDelegate;
@@ -156,6 +143,9 @@ namespace se {
// name ~> JSScript map
std::unordered_map<std::string, JS::PersistentRootedScript*> _filenameScriptMap;
std::string _debuggerServerAddr;
uint32_t _debuggerServerPort;
uint32_t _vmId;
bool _isGarbageCollecting;
@@ -256,11 +256,11 @@ namespace se {
return true;
}
void Object::setProperty(const char *name, const Value& data)
bool Object::setProperty(const char *name, const Value& data)
{
v8::MaybeLocal<v8::String> nameValue = v8::String::NewFromUtf8(__isolate, name, v8::NewStringType::kNormal);
if (nameValue.IsEmpty())
return;
return false;
v8::Local<v8::Value> value;
internal::seToJsValue(__isolate, data, &value);
@@ -268,7 +268,9 @@ namespace se {
if (ret.IsNothing())
{
LOGD("ERROR: %s, Set return nothing ...\n", __FUNCTION__);
return false;
}
return true;
}
bool Object::defineProperty(const char *name, v8::AccessorNameGetterCallback getter, v8::AccessorNameSetterCallback setter)
@@ -30,7 +30,7 @@ namespace se {
bool getProperty(const char *name, Value* data);
void setProperty(const char *name, const Value& data);
bool setProperty(const char *name, const Value& data);
bool defineProperty(const char *name, v8::AccessorNameGetterCallback getter, v8::AccessorNameSetterCallback setter);
bool isFunction() const;
@@ -8,7 +8,7 @@
//#include "mozilla/EndianUtils.h"
#include "SHA1.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include <string.h>
#include <assert.h>
@@ -527,4 +527,4 @@ shaCompress(volatile unsigned* aX, const uint32_t* aBuf)
XH(4) += E;
}
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -9,7 +9,7 @@
#pragma once
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
//#include "mozilla/Types.h"
@@ -68,5 +68,5 @@ public:
} /* namespace se */
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -204,11 +204,11 @@ namespace se {
, _handleScope(nullptr)
, _allocator(nullptr)
, _globalObj(nullptr)
, _nodeEventListener(nullptr)
, _exceptionCallback(nullptr)
#if SE_ENABLE_INSPECTOR
, _env(nullptr)
#endif
, _debuggerServerPort(0)
, _vmId(0)
, _isValid(false)
, _isGarbageCollecting(false)
@@ -235,7 +235,7 @@ namespace se {
bool ScriptEngine::init()
{
cleanup();
LOGD("Initializing V8\n");
LOGD("Initializing V8, version: %s\n", v8::V8::GetVersion());
++_vmId;
for (const auto& hook : _beforeInitHookArray)
@@ -331,7 +331,6 @@ namespace se {
_isolate = nullptr;
_globalObj = nullptr;
_isValid = false;
_nodeEventListener = nullptr;
_registerCallbackArray.clear();
@@ -385,6 +384,24 @@ namespace se {
return false;
se::AutoHandleScope hs;
// debugger
if (isDebuggerEnabled())
{
#if SE_ENABLE_INSPECTOR
// V8 inspector stuff, most code are taken from NodeJS.
_isolateData = node::CreateIsolateData(_isolate, uv_default_loop());
_env = node::CreateEnvironment(_isolateData, _context.Get(_isolate), 0, nullptr, 0, nullptr);
node::DebugOptions options;
options.set_wait_for_connect(false); // Don't wait for connect, otherwise, the program will be hung up.
options.set_inspector_enabled(true);
options.set_port((int)_debuggerServerPort);
options.set_host_name(_debuggerServerAddr.c_str());
_env->inspector_agent()->Start(_platform, "", options);
#endif
}
//
bool ok = false;
_startTime = std::chrono::steady_clock::now();
@@ -439,13 +456,22 @@ namespace se {
if (fileName == nullptr)
fileName = "(no filename)";
// Fix the source url is too long displayed in Chrome debugger.
std::string sourceUrl = fileName;
static const std::string prefixKey = "/temp/quick-scripts/";
size_t prefixPos = sourceUrl.find(prefixKey);
if (prefixPos != std::string::npos)
{
sourceUrl = sourceUrl.substr(prefixPos + prefixKey.length());
}
std::string scriptStr(script, length);
v8::MaybeLocal<v8::String> source = v8::String::NewFromUtf8(_isolate, scriptStr.c_str(), v8::NewStringType::kNormal);
if (source.IsEmpty())
return false;
v8::MaybeLocal<v8::String> originStr = v8::String::NewFromUtf8(_isolate, fileName, v8::NewStringType::kNormal);
v8::MaybeLocal<v8::String> originStr = v8::String::NewFromUtf8(_isolate, sourceUrl.c_str(), v8::NewStringType::kNormal);
if (originStr.IsEmpty())
return false;
@@ -535,18 +561,6 @@ namespace se {
iterOwner->second->detachObject(iterTarget->second);
}
bool ScriptEngine::_onReceiveNodeEvent(void* node, NodeEventType type)
{
assert(_nodeEventListener != nullptr);
return _nodeEventListener(node, type);
}
bool ScriptEngine::_setNodeEventListener(NodeEventListener listener)
{
_nodeEventListener = listener;
return true;
}
void ScriptEngine::clearException()
{
//FIXME:
@@ -562,24 +576,15 @@ namespace se {
return _context.Get(_isolate);
}
void ScriptEngine::enableDebugger(unsigned int port/* = 5086*/)
void ScriptEngine::enableDebugger(const std::string& serverAddr, uint32_t port)
{
#if SE_ENABLE_INSPECTOR
AutoHandleScope hs;
// V8 inspector stuff, most code are taken from NodeJS.
_debuggerServerAddr = serverAddr;
_debuggerServerPort = port;
}
_isolateData = node::CreateIsolateData(_isolate, uv_default_loop());
_env = node::CreateEnvironment(_isolateData, _context.Get(_isolate), 0, nullptr, 0, nullptr);
node::DebugOptions options;
options.set_wait_for_connect(true);
options.set_inspector_enabled(true);
options.set_port((int)port);
// options.set_host_name("192.168.2.4"); // Change IP while remote debugging on Android device.
_env->inspector_agent()->Start(_platform, "", options);
//
#endif
bool ScriptEngine::isDebuggerEnabled() const
{
return !_debuggerServerAddr.empty() && _debuggerServerPort > 0;
}
void ScriptEngine::mainLoopUpdate()
@@ -138,7 +138,8 @@ namespace se {
const std::chrono::steady_clock::time_point& getStartTime() const { return _startTime; }
void enableDebugger(unsigned int port = 5086);
void enableDebugger(const std::string& serverAddr, uint32_t port);
bool isDebuggerEnabled() const;
void mainLoopUpdate();
uint32_t getVMId() const { return _vmId; }
@@ -146,18 +147,6 @@ namespace se {
void _retainScriptObject(void* owner, void* target);
void _releaseScriptObject(void* owner, void* target);
enum class NodeEventType
{
ENTER,
EXIT,
ENTER_TRANSITION_DID_FINISH,
EXIT_TRANSITION_DID_START,
CLEANUP
};
bool _onReceiveNodeEvent(void* node, NodeEventType type);
using NodeEventListener = bool(*)(void*, NodeEventType);
bool _setNodeEventListener(NodeEventListener listener);
v8::Local<v8::Context> _getContext() const;
private:
static void privateDataFinalize(void* nativeObj);
@@ -182,7 +171,6 @@ namespace se {
v8::ArrayBuffer::Allocator* _allocator;
Object* _globalObj;
NodeEventListener _nodeEventListener;
FileOperationDelegate _fileOperationDelegate;
ExceptionCallback _exceptionCallback;
@@ -191,6 +179,9 @@ namespace se {
node::IsolateData* _isolateData;
#endif
std::string _debuggerServerAddr;
uint32_t _debuggerServerPort;
uint32_t _vmId;
bool _isValid;
@@ -1,6 +1,6 @@
#include "env.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "uv.h"
@@ -119,4 +119,4 @@ namespace node {
} // namespace node {
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -1,7 +1,7 @@
#pragma once
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "inspector_agent.h"
@@ -295,7 +295,7 @@ v8::Eternal<TypeName> PropertyName ## _;
uv_loop_t* const event_loop_;
uint32_t* const zero_fill_field_;
DISALLOW_COPY_AND_ASSIGN(IsolateData);
NODE_DISALLOW_COPY_AND_ASSIGN(IsolateData);
};
class Environment
@@ -396,7 +396,7 @@ v8::Eternal<TypeName> PropertyName ## _;
private:
Environment* env_;
DISALLOW_COPY_AND_ASSIGN(AsyncCallbackScope);
NODE_DISALLOW_COPY_AND_ASSIGN(AsyncCallbackScope);
};
private:
@@ -625,5 +625,5 @@ Environment::NewFunctionTemplate(v8::FunctionCallback callback,
} // namespace node {
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -23,7 +23,7 @@
*/
#include "http_parser.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include <assert.h>
#include <stddef.h>
@@ -2470,4 +2470,4 @@ http_parser_version(void) {
HTTP_PARSER_VERSION_PATCH * 0x00001;
}
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -22,7 +22,7 @@
#define http_parser_h
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#ifdef __cplusplus
extern "C" {
@@ -364,6 +364,6 @@ int http_body_is_final(const http_parser *parser);
}
#endif
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif
@@ -1,6 +1,6 @@
#include "inspector_agent.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "inspector_io.h"
#include "env.h"
@@ -812,4 +812,4 @@ void Agent::RequestIoThreadStart() {
//cjh NODE_MODULE_CONTEXT_AWARE_BUILTIN(inspector,
// node::inspector::Agent::InitInspector);
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -2,7 +2,7 @@
#define SRC_INSPECTOR_AGENT_H_
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include <memory>
@@ -113,6 +113,6 @@ class Agent {
} // namespace inspector
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // SRC_INSPECTOR_AGENT_H_
@@ -1,5 +1,5 @@
#include "inspector_io.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "inspector_socket_server.h"
#include "env.h"
@@ -527,4 +527,4 @@ void IoSessionDelegate::SendMessageToFrontend(
} // namespace inspector
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -2,7 +2,7 @@
#define SRC_INSPECTOR_IO_H_
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "inspector_socket_server.h"
#include "node_debug_options.h"
@@ -175,6 +175,6 @@ std::unique_ptr<v8_inspector::StringBuffer> Utf8ToStringView(
} // namespace inspector
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // SRC_INSPECTOR_IO_H_
@@ -1,6 +1,6 @@
#include "inspector_socket.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "util.h"
@@ -637,4 +637,4 @@ void InspectorSocket::reinit() {
} // namespace inspector
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -2,7 +2,7 @@
#define SRC_INSPECTOR_SOCKET_H_
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "http_parser.h"
#include "util.h"
@@ -67,7 +67,7 @@ class InspectorSocket {
bool connection_eof;
private:
DISALLOW_COPY_AND_ASSIGN(InspectorSocket);
NODE_DISALLOW_COPY_AND_ASSIGN(InspectorSocket);
};
int inspector_accept(uv_stream_t* server, InspectorSocket* inspector,
@@ -100,6 +100,6 @@ inline InspectorSocket* inspector_from_stream(uv_handle_t* stream) {
} // namespace inspector
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // SRC_INSPECTOR_SOCKET_H_
@@ -1,6 +1,6 @@
#include "inspector_socket_server.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "node.h"
#include "uv.h"
@@ -643,4 +643,4 @@ void ServerSocket::SocketClosedCallback(uv_handle_t* tcp_socket) {
} // namespace inspector
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -2,7 +2,7 @@
#define SRC_INSPECTOR_SOCKET_SERVER_H_
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "inspector_agent.h"
#include "inspector_socket.h"
@@ -99,6 +99,6 @@ class InspectorSocketServer {
} // namespace inspector
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // SRC_INSPECTOR_SOCKET_SERVER_H_
@@ -1,6 +1,6 @@
#include "node.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "util.h"
#include "env.h"
@@ -809,6 +809,8 @@ void SetupProcessObject(Environment* env,
READONLY_PROPERTY(versions,
"uv",
OneByteString(env->isolate(), uv_version_string()));
LOGD("libuv version: %s\n", uv_version_string());
// READONLY_PROPERTY(versions,
// "zlib",
// FIXED_ONE_BYTE_STRING(env->isolate(), ZLIB_VERSION));
@@ -1133,4 +1135,4 @@ void SetupProcessObject(Environment* env,
} // namespace node {
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -1,7 +1,7 @@
#pragma once
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "v8.h"
@@ -162,4 +162,4 @@ void SetupProcessObject(Environment* env,
} // namespace node {
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -1,6 +1,6 @@
#include "node_debug_options.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include <errno.h>
#include <stdlib.h>
@@ -138,4 +138,4 @@ int DebugOptions::port() const {
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -2,7 +2,7 @@
#define SRC_NODE_DEBUG_OPTIONS_H_
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include <string>
@@ -40,6 +40,6 @@ class DebugOptions {
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // SRC_NODE_DEBUG_OPTIONS_H_
@@ -2,7 +2,7 @@
#define SRC_NODE_MUTEX_H_
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#include "util.h"
#include "uv.h"
@@ -37,7 +37,7 @@ class MutexBase {
template <typename> friend class ConditionVariableBase;
friend class ScopedUnlock;
const MutexBase& mutex_;
DISALLOW_COPY_AND_ASSIGN(ScopedLock);
NODE_DISALLOW_COPY_AND_ASSIGN(ScopedLock);
};
class ScopedUnlock {
@@ -48,13 +48,13 @@ class MutexBase {
private:
friend class ScopedLock;
const MutexBase& mutex_;
DISALLOW_COPY_AND_ASSIGN(ScopedUnlock);
NODE_DISALLOW_COPY_AND_ASSIGN(ScopedUnlock);
};
private:
template <typename> friend class ConditionVariableBase;
mutable typename Traits::MutexT mutex_;
DISALLOW_COPY_AND_ASSIGN(MutexBase);
NODE_DISALLOW_COPY_AND_ASSIGN(MutexBase);
};
template <typename Traits>
@@ -70,7 +70,7 @@ class ConditionVariableBase {
private:
typename Traits::CondT cond_;
DISALLOW_COPY_AND_ASSIGN(ConditionVariableBase);
NODE_DISALLOW_COPY_AND_ASSIGN(ConditionVariableBase);
};
struct LibuvMutexTraits {
@@ -187,6 +187,6 @@ MutexBase<Traits>::ScopedUnlock::~ScopedUnlock() {
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // SRC_NODE_MUTEX_H_
@@ -21,7 +21,7 @@
#include "util.h"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
//cjh #include "string_bytes.h"
//#include "node_buffer.h"
@@ -114,4 +114,4 @@ void DumpBacktrace(FILE* fp) {
} // namespace node
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
@@ -23,7 +23,7 @@
#define SRC_UTIL_H_
#include "../config.hpp"
#if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#define NODE_WANT_INTERNALS 1 //cjh added
@@ -92,7 +92,7 @@ template <typename T> using remove_reference = std::remove_reference<T>;
#define FIXED_ONE_BYTE_STRING(isolate, string) \
(node::OneByteString((isolate), (string), sizeof(string) - 1))
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
#define NODE_DISALLOW_COPY_AND_ASSIGN(TypeName) \
void operator=(const TypeName&) = delete; \
void operator=(TypeName&&) = delete; \
TypeName(const TypeName&) = delete; \
@@ -166,7 +166,7 @@ class ListNode {
template <typename U, ListNode<U> (U::*M)> friend class ListHead;
ListNode* prev_;
ListNode* next_;
DISALLOW_COPY_AND_ASSIGN(ListNode);
NODE_DISALLOW_COPY_AND_ASSIGN(ListNode);
};
template <typename T, ListNode<T> (T::*M)>
@@ -196,7 +196,7 @@ class ListHead {
private:
ListNode<T> head_;
DISALLOW_COPY_AND_ASSIGN(ListHead);
NODE_DISALLOW_COPY_AND_ASSIGN(ListHead);
};
// The helper is for doing safe downcasts from base types to derived types.
@@ -441,6 +441,6 @@ class BufferValue : public MaybeStackBuffer<char> {
#define NODE_UTIL_H_INCLUDE
#include "util-inl.h"
#endif // #if defined(SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // #if (SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_V8) && SE_ENABLE_INSPECTOR
#endif // SRC_UTIL_H_
@@ -38,7 +38,8 @@ ScriptingCore* ScriptingCore::getInstance()
}
ScriptingCore::ScriptingCore()
: _callFromScript(false)
: _nodeEventListener(nullptr)
, _callFromScript(false)
{
}
@@ -193,6 +194,12 @@ int ScriptingCore::handleActionEvent(void* data)
return ret;
}
bool ScriptingCore::setNodeEventListener(NodeEventListener listener)
{
_nodeEventListener = listener;
return true;
}
int ScriptingCore::handleNodeEvent(void* data)
{
if (nullptr == data)
@@ -208,23 +215,23 @@ int ScriptingCore::handleNodeEvent(void* data)
bool ret = false;
if (action == kNodeOnEnter)
{
ret = se::ScriptEngine::getInstance()->_onReceiveNodeEvent(node, se::ScriptEngine::NodeEventType::ENTER);
ret = _nodeEventListener(node, NodeEventType::ENTER);
}
else if (action == kNodeOnExit)
{
ret = se::ScriptEngine::getInstance()->_onReceiveNodeEvent(node, se::ScriptEngine::NodeEventType::EXIT);
ret = _nodeEventListener(node, NodeEventType::EXIT);
}
else if (action == kNodeOnEnterTransitionDidFinish)
{
ret = se::ScriptEngine::getInstance()->_onReceiveNodeEvent(node, se::ScriptEngine::NodeEventType::ENTER_TRANSITION_DID_FINISH);
ret = _nodeEventListener(node, NodeEventType::ENTER_TRANSITION_DID_FINISH);
}
else if (action == kNodeOnExitTransitionDidStart)
{
ret = se::ScriptEngine::getInstance()->_onReceiveNodeEvent(node, se::ScriptEngine::NodeEventType::EXIT_TRANSITION_DID_START);
ret = _nodeEventListener(node, NodeEventType::EXIT_TRANSITION_DID_START);
}
else if (action == kNodeOnCleanup)
{
ret = se::ScriptEngine::getInstance()->_onReceiveNodeEvent(node, se::ScriptEngine::NodeEventType::CLEANUP);
ret = _nodeEventListener(node, NodeEventType::CLEANUP);
}
return ret ? 1 : 0;
@@ -132,12 +132,25 @@ public:
void restartVM();
enum class NodeEventType
{
ENTER,
EXIT,
ENTER_TRANSITION_DID_FINISH,
EXIT_TRANSITION_DID_START,
CLEANUP
};
using NodeEventListener = bool(*)(void*, NodeEventType);
bool setNodeEventListener(NodeEventListener listener);
private:
ScriptingCore();
int handleActionEvent(void* data);
int handleNodeEvent(void* data);
NodeEventListener _nodeEventListener;
bool _callFromScript;
};
@@ -420,6 +420,9 @@ bool register_all_dragonbones_manual(se::Object* obj)
// std::string typeName = typeid(*obj).name();
auto cleanup = [=](){
if (!se::ScriptEngine::getInstance()->isValid())
return;
se::AutoHandleScope hs;
se::ScriptEngine::getInstance()->clearException();
@@ -12,14 +12,15 @@ se::Object* __jscObj = nullptr;
se::Object* __ccObj = nullptr;
se::Object* __jsbObj = nullptr;
static const char* BYTE_CODE_FILE_EXT = ".jsc";
static std::string xxteaKey = "";
void jsb_set_xxtea_key(const std::string& key)
{
xxteaKey = key;
}
#if SCRIPT_ENGINE_TYPE != SCRIPT_ENGINE_SM
static const char* BYTE_CODE_FILE_EXT = ".jsc";
static std::string removeFileExt(const std::string& filePath)
{
size_t pos = filePath.rfind('.');
@@ -29,35 +30,36 @@ static std::string removeFileExt(const std::string& filePath)
}
return filePath;
}
#endif
bool jsb_run_script(const std::string& filePath)
void jsb_init_file_operation_delegate()
{
static se::ScriptEngine::FileOperationDelegate delegate;
if (!delegate.isValid())
{
delegate.onGetDataFromFile = [](const std::string& path, const std::function<void(const uint8_t*, size_t)>& readCallback) -> void{
assert(!path.empty());
Data fileData;
#if SCRIPT_ENGINE_TYPE != SCRIPT_ENGINE_SM
std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT;
if (FileUtils::getInstance()->isFileExist(byteCodePath)) {
fileData = FileUtils::getInstance()->getDataFromFile(byteCodePath);
size_t dataLen = 0;
uint8_t* data = xxtea_decrypt((unsigned char*)fileData.getBytes(), (uint32_t)fileData.getSize(), (unsigned char*)xxteaKey.c_str(), (uint32_t)xxteaKey.size(), (uint32_t*)&dataLen);
if (data == nullptr) {
SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str());
}
readCallback(data, dataLen);
free(data);
return;
}
#endif
fileData = FileUtils::getInstance()->getDataFromFile(path);
readCallback(fileData.getBytes(), fileData.getSize());
@@ -65,27 +67,27 @@ bool jsb_run_script(const std::string& filePath)
delegate.onGetStringFromFile = [](const std::string& path) -> std::string{
assert(!path.empty());
#if SCRIPT_ENGINE_TYPE != SCRIPT_ENGINE_SM
std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT;
if (FileUtils::getInstance()->isFileExist(byteCodePath)) {
Data fileData = FileUtils::getInstance()->getDataFromFile(byteCodePath);
uint32_t retLength;
uint8_t* data = xxtea_decrypt((uint8_t*)fileData.getBytes(), (uint32_t)fileData.getSize(), (uint8_t*)xxteaKey.c_str(), (uint32_t)xxteaKey.size(), &retLength);
if (data == nullptr) {
SE_REPORT_ERROR("Can't decrypt code for %s", byteCodePath.c_str());
return "";
}
std::string ret(reinterpret_cast<const char*>(data), retLength);
free(data);
return ret;
}
#endif
return FileUtils::getInstance()->getStringFromFile(path);
};
@@ -103,7 +105,59 @@ bool jsb_run_script(const std::string& filePath)
se::ScriptEngine::getInstance()->setFileOperationDelegate(delegate);
}
}
bool jsb_enable_debugger(const std::string& debuggerServerAddr, uint32_t port)
{
if (debuggerServerAddr.empty() || port == 0)
return false;
auto se = se::ScriptEngine::getInstance();
se->enableDebugger(debuggerServerAddr.c_str(), port);
// For debugger main loop
class SimpleRunLoop
{
public:
void update(float dt)
{
se::ScriptEngine::getInstance()->mainLoopUpdate();
}
};
static SimpleRunLoop runLoop;
Director::getInstance()->getScheduler()->scheduleUpdate(&runLoop, 0, false);
return true;
}
bool jsb_set_extend_property(const char* ns, const char* clsName)
{
se::Object* globalObj = se::ScriptEngine::getInstance()->getGlobalObject();
se::Value nsVal;
if (globalObj->getProperty(ns, &nsVal) && nsVal.isObject())
{
se::Value ccVal;
if (globalObj->getProperty("cc", &ccVal) && ccVal.isObject())
{
se::Value ccClassVal;
if (ccVal.toObject()->getProperty("Class", &ccClassVal) && ccClassVal.isObject())
{
se::Value extendVal;
if (ccClassVal.toObject()->getProperty("extend", &extendVal) && extendVal.isObject() && extendVal.toObject()->isFunction())
{
se::Value targetClsVal;
if (nsVal.toObject()->getProperty(clsName, &targetClsVal) && targetClsVal.isObject())
{
return targetClsVal.toObject()->setProperty("extend", extendVal);
}
}
}
}
}
return false;
}
bool jsb_run_script(const std::string& filePath)
{
se::AutoHandleScope hs;
return se::ScriptEngine::getInstance()->runScript(filePath);
}
@@ -12,6 +12,9 @@ extern se::Object* __jsbObj;
bool jsb_register_global_variables(se::Object* global);
void jsb_init_file_operation_delegate();
bool jsb_enable_debugger(const std::string& debuggerServerAddr, uint32_t port);
bool jsb_set_extend_property(const char* ns, const char* clsName);
bool jsb_run_script(const std::string& filePath);
void jsb_set_xxtea_key(const std::string& key);
@@ -1443,7 +1443,7 @@ static void cleanupAllSchedulesForTarget(Node* node, se::Object* jsThis)
node->getScheduler()->unscheduleAllForTarget(jsThis);
}
static bool onReceiveNodeEvent(void* node, se::ScriptEngine::NodeEventType type)
static bool onReceiveNodeEvent(void* node, ScriptingCore::NodeEventType type)
{
auto iter = se::NativePtrToObjectMap::find(node);
if (iter == se::NativePtrToObjectMap::end())
@@ -1459,35 +1459,35 @@ static bool onReceiveNodeEvent(void* node, se::ScriptEngine::NodeEventType type)
#if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM
JSNative func = nullptr;
#endif
if (type == se::ScriptEngine::NodeEventType::ENTER)
if (type == ScriptingCore::NodeEventType::ENTER)
{
funcName = "onEnter";
#if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM
func = _SE(Node_onEnter);
#endif
}
else if (type == se::ScriptEngine::NodeEventType::EXIT)
else if (type == ScriptingCore::NodeEventType::EXIT)
{
funcName = "onExit";
#if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM
func = _SE(Node_onExit);
#endif
}
else if (type == se::ScriptEngine::NodeEventType::ENTER_TRANSITION_DID_FINISH)
else if (type == ScriptingCore::NodeEventType::ENTER_TRANSITION_DID_FINISH)
{
funcName = "onEnterTransitionDidFinish";
#if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM
func = _SE(Node_onEnterTransitionDidFinish);
#endif
}
else if (type == se::ScriptEngine::NodeEventType::EXIT_TRANSITION_DID_START)
else if (type == ScriptingCore::NodeEventType::EXIT_TRANSITION_DID_START)
{
funcName = "onExitTransitionDidStart";
#if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM
func = _SE(Node_onExitTransitionDidStart);
#endif
}
else if (type == se::ScriptEngine::NodeEventType::CLEANUP)
else if (type == ScriptingCore::NodeEventType::CLEANUP)
{
funcName = "cleanup";
#if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM
@@ -1513,15 +1513,15 @@ static bool onReceiveNodeEvent(void* node, se::ScriptEngine::NodeEventType type)
}
// Handle schedule stuff
if (type == se::ScriptEngine::NodeEventType::ENTER)
if (type == ScriptingCore::NodeEventType::ENTER)
{
resumeAllSchedulesForTarget((Node*)node, target);
}
else if (type == se::ScriptEngine::NodeEventType::EXIT)
else if (type == ScriptingCore::NodeEventType::EXIT)
{
pauseAllSchedulesForTarget((Node*)node, target);
}
else if (type == se::ScriptEngine::NodeEventType::CLEANUP)
else if (type == ScriptingCore::NodeEventType::CLEANUP)
{
cleanupAllSchedulesForTarget((Node*)node, target);
}
@@ -1588,7 +1588,7 @@ bool jsb_register_Node_manual(se::Object* global)
__jsb_Node_proto->setProperty("var2", se::Value(10000.323));
#endif
se::ScriptEngine::getInstance()->_setNodeEventListener(onReceiveNodeEvent);
ScriptingCore::getInstance()->setNodeEventListener(onReceiveNodeEvent);
se::ScriptEngine::getInstance()->clearException();
return true;
@@ -92,6 +92,7 @@ LOCAL_EXPORT_LDLIBS := -lz
LOCAL_STATIC_LIBRARIES := cocos2dx_static
# LOCAL_STATIC_LIBRARIES += spidermonkey_static
LOCAL_STATIC_LIBRARIES += uv_static
LOCAL_STATIC_LIBRARIES += v8_static
include $(BUILD_STATIC_LIBRARY)
@@ -195,7 +195,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;HAVE_INSPECTOR;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_USRJSSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos\editor-support;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(EngineRoot)external\win32\include\spidermonkey;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\uv;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos\editor-support;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\uv;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;4099;4083;4700;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
@@ -219,7 +219,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;HAVE_INSPECTOR;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_USRJSSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos\editor-support;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(EngineRoot)external\win32\include\spidermonkey;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\uv;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos\editor-support;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\uv;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;4099;4083;4700;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DebugInformationFormat>None</DebugInformationFormat>
@@ -1,5 +1,6 @@
#include "jsb_anysdk_protocols_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.hpp"
#include "PluginManager.h"
#include "ProtocolAnalytics.h"
#include "ProtocolIAP.h"
@@ -1,5 +1,6 @@
#include "jsb_anysdk_protocols_auto.hpp"
#include "scripting/js-bindings/manual/jsb_conversions.hpp"
#include "scripting/js-bindings/manual/jsb_global.hpp"
#include "PluginManager.h"
#include "ProtocolAnalytics.h"
#include "ProtocolYAP.h"
+1 -1
View File
@@ -1,5 +1,5 @@
{
"version": "v3-deps-46",
"version": "v3-deps-47",
"zip_file_size": "114318593",
"repo_name": "cocos2d-x-lite-external",
"repo_parent": "https://github.com/cocos-creator/"
@@ -60,6 +60,18 @@ bool AppDelegate::applicationDidFinishLaunching()
se::ScriptEngine* se = se::ScriptEngine::getInstance();
jsb_set_xxtea_key("");
jsb_init_file_operation_delegate();
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
jsb_enable_debugger("127.0.0.1", 5086); // Enable debugger here
#endif
se->setExceptionCallback([](const char* location, const char* message, const char* stack){
// Send exception information to server like Tencent Bugly.
});
jsb_register_all_modules();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
@@ -68,24 +80,7 @@ bool AppDelegate::applicationDidFinishLaunching()
#endif
se->start();
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
se->enableDebugger(); // Enable debugger here
class SimpleRunLoop
{
public:
void update(float dt)
{
se::ScriptEngine::getInstance()->mainLoopUpdate();
}
};
static SimpleRunLoop runLoop;
director->getScheduler()->scheduleUpdate(&runLoop, 0, false);
#endif
jsb_set_xxtea_key("");
jsb_run_script("main.js");
return true;
@@ -18,9 +18,11 @@ endif
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_CFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_CFLAGS += -DNDEBUG
APP_OPTIM := release
endif
@@ -18,9 +18,11 @@ endif
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_CFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_CFLAGS += -DNDEBUG
APP_OPTIM := release
endif
@@ -91,7 +91,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\service;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib\runtime;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib\protobuf-lite;$(COCOS_X_ROOT)\external\win32-specific\zlib\include;$(COCOS_X_ROOT)\tools\simulator\libsimulator\proj.win32;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib;$(COCOS_X_ROOT)\;$(COCOS_X_ROOT)\cocos;$(COCOS_X_ROOT)\cocos\base;$(COCOS_X_ROOT)\external;$(COCOS_X_ROOT)\cocos\storage;$(COCOS_X_ROOT)\cocos\editor-support;$(COCOS_X_ROOT)\cocos\scripting\js-bindings\auto;$(COCOS_X_ROOT)\cocos\scripting\js-bindings\manual;$(COCOS_X_ROOT)\cocos\audio\include;$(COCOS_X_ROOT)\external\win32\include\spidermonkey;$(COCOS_X_ROOT)\external\win32\include\v8;$(COCOS_X_ROOT)\external\win32\include\chipmunk;$(COCOS_X_ROOT)\external\win32\include\curl;$(COCOS_X_ROOT)\external\win32\include\glfw3;$(COCOS_X_ROOT)\extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\service;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib\runtime;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib\protobuf-lite;$(COCOS_X_ROOT)\external\win32-specific\zlib\include;$(COCOS_X_ROOT)\tools\simulator\libsimulator\proj.win32;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib;$(COCOS_X_ROOT)\;$(COCOS_X_ROOT)\cocos;$(COCOS_X_ROOT)\cocos\base;$(COCOS_X_ROOT)\external;$(COCOS_X_ROOT)\cocos\storage;$(COCOS_X_ROOT)\cocos\editor-support;$(COCOS_X_ROOT)\cocos\scripting\js-bindings\auto;$(COCOS_X_ROOT)\cocos\scripting\js-bindings\manual;$(COCOS_X_ROOT)\cocos\audio\include;$(COCOS_X_ROOT)\external\win32\include\v8;$(COCOS_X_ROOT)\external\win32\include\chipmunk;$(COCOS_X_ROOT)\external\win32\include\curl;$(COCOS_X_ROOT)\external\win32\include\glfw3;$(COCOS_X_ROOT)\extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -116,7 +116,7 @@ xcopy /Y /Q "$(COCOS_X_ROOT)\prebuilt\win32\*.*" "$(OutDir)"
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -162,7 +162,7 @@ copy "$(ProjectDir)..\..\..\project.json" "$(LocalDebuggerWorkingDirectory)" /Y<
<ProxyFileName>game_p.c</ProxyFileName>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\service;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib\runtime;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib\protobuf-lite;$(COCOS_X_ROOT)\external\win32-specific\zlib\include;$(COCOS_X_ROOT)\tools\simulator\libsimulator\proj.win32;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib;$(COCOS_X_ROOT)\;$(COCOS_X_ROOT)\cocos;$(COCOS_X_ROOT)\cocos\base;$(COCOS_X_ROOT)\external;$(COCOS_X_ROOT)\cocos\storage;$(COCOS_X_ROOT)\cocos\editor-support;$(COCOS_X_ROOT)\cocos\scripting\js-bindings\auto;$(COCOS_X_ROOT)\cocos\scripting\js-bindings\manual;$(COCOS_X_ROOT)\cocos\audio\include;$(COCOS_X_ROOT)\external\win32\include\spidermonkey;$(COCOS_X_ROOT)\external\win32\include\v8;$(COCOS_X_ROOT)\external\win32\include\chipmunk;$(COCOS_X_ROOT)\external\win32\include\glfw3;$(COCOS_X_ROOT)\external\win32\include\curl;$(COCOS_X_ROOT)\extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\service;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib\runtime;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib\protobuf-lite;$(COCOS_X_ROOT)\external\win32-specific\zlib\include;$(COCOS_X_ROOT)\tools\simulator\libsimulator\proj.win32;$(COCOS_X_ROOT)\tools\simulator\libsimulator\lib;$(COCOS_X_ROOT)\;$(COCOS_X_ROOT)\cocos;$(COCOS_X_ROOT)\cocos\base;$(COCOS_X_ROOT)\external;$(COCOS_X_ROOT)\cocos\storage;$(COCOS_X_ROOT)\cocos\editor-support;$(COCOS_X_ROOT)\cocos\scripting\js-bindings\auto;$(COCOS_X_ROOT)\cocos\scripting\js-bindings\manual;$(COCOS_X_ROOT)\cocos\audio\include;$(COCOS_X_ROOT)\external\win32\include\v8;$(COCOS_X_ROOT)\external\win32\include\chipmunk;$(COCOS_X_ROOT)\external\win32\include\glfw3;$(COCOS_X_ROOT)\external\win32\include\curl;$(COCOS_X_ROOT)\extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
@@ -187,7 +187,7 @@ xcopy /Y /Q "$(COCOS_X_ROOT)\prebuilt\win32\*.*" "$(OutDir)"
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<SubSystem>Windows</SubSystem>
@@ -60,6 +60,20 @@ bool AppDelegate::applicationDidFinishLaunching()
se::ScriptEngine* se = se::ScriptEngine::getInstance();
jsb_set_xxtea_key("");
jsb_init_file_operation_delegate();
#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);
#endif
se->setExceptionCallback([](const char* location, const char* message, const char* stack){
// Send exception information to server like Tencent Bugly.
});
jsb_register_all_modules();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
@@ -69,23 +83,6 @@ bool AppDelegate::applicationDidFinishLaunching()
se->start();
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
se->enableDebugger(); // Enable debugger here
class SimpleRunLoop
{
public:
void update(float dt)
{
se::ScriptEngine::getInstance()->mainLoopUpdate();
}
};
static SimpleRunLoop runLoop;
director->getScheduler()->scheduleUpdate(&runLoop, 0, false);
#endif
jsb_set_xxtea_key("");
jsb_run_script("main.js");
return true;
@@ -18,8 +18,10 @@ endif
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_CFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_CFLAGS += -DNDEBUG
APP_OPTIM := release
endif
@@ -18,8 +18,10 @@ endif
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_CFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_CFLAGS += -DNDEBUG
APP_OPTIM := release
endif
@@ -85,7 +85,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\;$(EngineRoot)external\win32\include\spidermonkey;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -107,7 +107,7 @@
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@@ -147,7 +147,7 @@ copy "$(ProjectDir)..\..\..\project.json" "$(OutDir)\" /Y</Command>
<ProxyFileName>game_p.c</ProxyFileName>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\spidermonkey;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
@@ -170,7 +170,7 @@ copy "$(ProjectDir)..\..\..\project.json" "$(OutDir)\" /Y</Command>
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
@@ -60,6 +60,20 @@ bool AppDelegate::applicationDidFinishLaunching()
se::ScriptEngine* se = se::ScriptEngine::getInstance();
jsb_set_xxtea_key("");
jsb_init_file_operation_delegate();
#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);
#endif
se->setExceptionCallback([](const char* location, const char* message, const char* stack){
// Send exception information to server like Tencent Bugly.
});
jsb_register_all_modules();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && PACKAGE_AS
@@ -69,23 +83,6 @@ bool AppDelegate::applicationDidFinishLaunching()
se->start();
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
se->enableDebugger(); // Enable debugger here
class SimpleRunLoop
{
public:
void update(float dt)
{
se::ScriptEngine::getInstance()->mainLoopUpdate();
}
};
static SimpleRunLoop runLoop;
director->getScheduler()->scheduleUpdate(&runLoop, 0, false);
#endif
jsb_set_xxtea_key("");
jsb_run_script("main.js");
return true;
@@ -18,8 +18,10 @@ endif
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_CFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_CFLAGS += -DNDEBUG
APP_OPTIM := release
endif
@@ -18,8 +18,10 @@ endif
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_CFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_CFLAGS += -DNDEBUG
APP_OPTIM := release
endif
@@ -85,7 +85,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\;$(EngineRoot)external\win32\include\spidermonkey;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -107,7 +107,7 @@
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@@ -147,7 +147,7 @@ copy "$(ProjectDir)..\..\..\project.json" "$(OutDir)\" /Y</Command>
<ProxyFileName>game_p.c</ProxyFileName>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\spidermonkey;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
@@ -170,7 +170,7 @@ copy "$(ProjectDir)..\..\..\project.json" "$(OutDir)\" /Y</Command>
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
Submodule native/tools/bindings-generator updated: d282641f99...d74a80c6e4
Submodule native/tools/cocos2d-console updated: c4118fc5e7...eb9f5af3eb
@@ -22,8 +22,6 @@
#include "scripting/js-bindings/manual/jsb_module_register.hpp"
#include "scripting/js-bindings/manual/jsb_global.h"
static const char *RUNTIME_JS_BOOT_SCRIPT = "script/jsb_boot.js";
static bool reloadScript(const string& file)
{
auto director = cocos2d::Director::getInstance();
@@ -155,10 +153,25 @@ bool RuntimeJsImpl::initJsEnv()
cocos2d::ScriptEngineProtocol *engine = ScriptingCore::getInstance();
cocos2d::ScriptEngineManager::getInstance()->setScriptEngine(engine);
auto se = se::ScriptEngine::getInstance();
jsb_set_xxtea_key("");
jsb_init_file_operation_delegate();
#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);
#endif
se->setExceptionCallback([](const char* location, const char* message, const char* stack){
// Send exception information to server like Tencent Bugly.
});
jsb_register_all_modules();
se::ScriptEngine::getInstance()->addRegisterCallback(register_FileUtils);
se::ScriptEngine::getInstance()->start();
se->addRegisterCallback(register_FileUtils);
se->start();
return true;
}
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>
@@ -177,6 +177,7 @@
1A16779E1F540F7C00294BB1 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
1A1677BB1F54218800294BB1 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; };
1A1677BD1F54219E00294BB1 /* libicucore.A.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libicucore.A.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/usr/lib/libicucore.A.tbd; sourceTree = DEVELOPER_DIR; };
1A719F531F8CB0480022549D /* Simulator.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Simulator.entitlements; sourceTree = "<group>"; };
1AF4C402178663F200122817 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
3EB51526195187AF006966AA /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
3EEEDB60197107C0006A9FF8 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; };
@@ -340,6 +341,7 @@
5023817117EBBE3400990C9B /* mac */ = {
isa = PBXGroup;
children = (
1A719F531F8CB0480022549D /* Simulator.entitlements */,
DA9648A01A70F925001F41E8 /* ConsoleWindow.xib */,
9FD6FC701A5D2A820028EDC6 /* ConsoleWindowController.h */,
9FD6FC711A5D2A820028EDC6 /* ConsoleWindowController.m */,
@@ -741,6 +743,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CODE_SIGN_ENTITLEMENTS = mac/Simulator.entitlements;
COMBINE_HIDPI_IMAGES = YES;
CONFIGURATION_BUILD_DIR = ../../../../../simulator/mac;
GCC_DYNAMIC_NO_PIC = NO;
@@ -778,6 +781,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CODE_SIGN_ENTITLEMENTS = mac/Simulator.entitlements;
COMBINE_HIDPI_IMAGES = YES;
CONFIGURATION_BUILD_DIR = ../../../../../simulator/mac;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -73,7 +73,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\runtime;$(ProjectDir)..\Classes\ide-support;$(EngineRoot)cocos\base;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\win32\include;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\curl;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)external\win32\include\spidermonkey;$(EngineRoot)external\win32\include\v8;$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\runtime;$(ProjectDir)..\Classes\ide-support;$(EngineRoot)cocos\base;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\win32\include;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\curl;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)external\win32\include\v8;$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -93,7 +93,7 @@
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OutDir);$(EngineRoot)external\win32\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libcurl.lib;websockets.lib;libSpine.lib;libDragonBones.lib;v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libcurl.lib;websockets.lib;libSpine.lib;libDragonBones.lib;v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@@ -116,9 +116,9 @@
</DllDataFileName>
</Midl>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\Classes\ide-support\lang" "$(OutDir)"
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\Classes\ide-support\lang" "$(OutDir)"
</Command>
<Message>
</Message>
@@ -128,22 +128,22 @@ xcopy /Y /Q "$(ProjectDir)..\Classes\ide-support\lang" "$(OutDir)"
</Command>
</PreLinkEvent>
<PostBuildEvent>
<Command>if not exist "$(ProjectDir)..\..\..\runtime" mkdir "$(ProjectDir)..\..\..\runtime"
if not exist "$(ProjectDir)..\..\..\runtime\win32" mkdir "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.exe" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
if exist "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" copy "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" "$(OutDir)config.json"
<Command>if not exist "$(ProjectDir)..\..\..\runtime" mkdir "$(ProjectDir)..\..\..\runtime"
if not exist "$(ProjectDir)..\..\..\runtime\win32" mkdir "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.exe" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
if exist "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" copy "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" "$(OutDir)config.json"
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\runtime;$(ProjectDir)..\Classes\ide-support;$(EngineRoot)cocos\base;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)extensions;$(EngineRoot)external\win32\include;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\curl;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)external\win32\include\spidermonkey;$(EngineRoot)external\win32\include\v8;$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\runtime;$(ProjectDir)..\Classes\ide-support;$(EngineRoot)cocos\base;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)extensions;$(EngineRoot)external\win32\include;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\curl;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)external\win32\include\v8;$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -162,7 +162,7 @@ if exist "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" copy "$(Proje
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>$(OutDir);$(EngineRoot)external\spidermonkey\prebuilt\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libcurl.lib;websockets.lib;libSpine.lib;libDragonBones.lib;v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libcurl.lib;websockets.lib;libSpine.lib;libDragonBones.lib;v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>false</GenerateDebugInformation>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@@ -185,9 +185,9 @@ if exist "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" copy "$(Proje
</DllDataFileName>
</Midl>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\Classes\ide-support\lang" "$(OutDir)"
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\Classes\ide-support\lang" "$(OutDir)"
</Command>
<Message>
</Message>
@@ -197,13 +197,13 @@ xcopy /Y /Q "$(ProjectDir)..\Classes\ide-support\lang" "$(OutDir)"
</Command>
</PreLinkEvent>
<PostBuildEvent>
<Command>if not exist "$(ProjectDir)..\..\..\runtime" mkdir "$(ProjectDir)..\..\..\runtime"
if not exist "$(ProjectDir)..\..\..\runtime\win32" mkdir "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.exe" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
<Command>if not exist "$(ProjectDir)..\..\..\runtime" mkdir "$(ProjectDir)..\..\..\runtime"
if not exist "$(ProjectDir)..\..\..\runtime\win32" mkdir "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.exe" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
</Command>
</PostBuildEvent>
<Manifest>