From bca578c2f8f495ff6bbd25846be8549099d97b14 Mon Sep 17 00:00:00 2001 From: bofeng-song Date: Fri, 13 Jun 2014 16:34:39 +0800 Subject: [PATCH 1/3] fix can`t debug vs project normally --- .../frameworks/runtime-src/proj.win32/HelloLua.vcxproj | 4 ++++ .../frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj index facd9e9c4d..35d98fe7b7 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj @@ -78,6 +78,7 @@ WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions) 4267;4251;4244;%(DisableSpecificWarnings) true + $(ProjectDir)../../../runtime/win32/$(PlatformToolsetVersion).pdb Windows @@ -85,6 +86,8 @@ true $(OutDir);%(AdditionalLibraryDirectories) libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies) + $(ProjectDir)../../../runtime/win32/$(TargetName).pdb + $(ProjectDir)../../../runtime/win32/$(TargetName)$(TargetExt) 0x0409 @@ -134,6 +137,7 @@ xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions) 4267;4251;4244;%(DisableSpecificWarnings) true + $(ProjectDir)../../../runtime/win32/$(PlatformToolsetVersion).pdb Windows diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user index 16617e63da..a268f56d81 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user @@ -2,9 +2,13 @@ false - $(OutDir)/Resource + $(OutDir)/Resource WindowsLocalDebugger WindowsLocalDebugger + + $(OutDir)Resource/ + $(OutDir)../../../../runtime/win32/$(TargetFileName) + \ No newline at end of file From 64f517a1b84864dee67166d81920ec962683553b Mon Sep 17 00:00:00 2001 From: bofeng-song Date: Mon, 16 Jun 2014 14:47:14 +0800 Subject: [PATCH 2/3] redirect function: setSearchPaths --- .../runtime-src/Classes/runtime/Runtime.cpp | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp index b46a7c27dd..3b5304b351 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp +++ b/templates/lua-template-runtime/frameworks/runtime-src/Classes/runtime/Runtime.cpp @@ -807,6 +807,61 @@ tolua_lerror: return 0; } +int lua_cocos2dx_runtime_setSearchPaths(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::FileUtils* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.FileUtils",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::FileUtils*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_runtime_setSearchPaths'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::vector vecPaths; + + ok &= luaval_to_std_vector_string(tolua_S, 2,&vecPaths); + if(!ok) + return 0; + + for (int i = 0; i < vecPaths.size(); i++) + { + if (!FileUtils::getInstance()->isAbsolutePath(vecPaths[i])) + vecPaths[i] = g_resourcePath + vecPaths[i]; + } + + + cobj->setSearchPaths(vecPaths); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSearchPaths",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 +tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_runtime_setSearchPaths'.",&tolua_err); +#endif + + return 0; +} + static void register_runtime_override_function(lua_State* tolua_S) { lua_pushstring(tolua_S, "cc.FileUtils"); @@ -814,6 +869,8 @@ static void register_runtime_override_function(lua_State* tolua_S) if (lua_istable(tolua_S,-1)) { tolua_function(tolua_S,"addSearchPath",lua_cocos2dx_runtime_addSearchPath); + tolua_function(tolua_S,"setSearchPaths",lua_cocos2dx_runtime_setSearchPaths); + } lua_pop(tolua_S, 1); } From d97b28db76925fec155f0115a4bd563b4174d255 Mon Sep 17 00:00:00 2001 From: bofeng-song Date: Tue, 17 Jun 2014 18:17:35 +0800 Subject: [PATCH 3/3] modify copy script & modify release version`s outfile addr --- .../runtime-src/proj.win32/HelloLua.vcxproj | 27 +++++++------------ .../proj.win32/HelloLua.vcxproj.user | 8 +++--- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj index 35d98fe7b7..a6390f04a3 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj @@ -108,21 +108,17 @@ if not exist "$(OutDir)" mkdir "$(OutDir)" -if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource" -mkdir "$(OutDir)\Resource" -mkdir "$(OutDir)\Resource\src" -mkdir "$(OutDir)\Resource\res" -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y -xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y -xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y -copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y +xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y +xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y copy files if not exist "$(OutDir)" mkdir "$(OutDir)" xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)" + + xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32\" + @@ -145,6 +141,8 @@ xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"$(OutDir);%(AdditionalLibraryDirectories) libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies) true + $(ProjectDir)../../../runtime/win32/$(TargetName)$(TargetExt) + $(ProjectDir)../../../runtime/win32/$(TargetName).pdb 0x0409 @@ -165,15 +163,8 @@ xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)" if not exist "$(OutDir)" mkdir "$(OutDir)" -if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource" -mkdir "$(OutDir)\Resource" -mkdir "$(OutDir)\Resource\src" -mkdir "$(OutDir)\Resource\res" -xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y -xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y -xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y -copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y -xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y +xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y +xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(ProjectDir)..\..\..\runtime\win32\" /e /Y copy files diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user index a268f56d81..ceb6a746f8 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.vcxproj.user @@ -2,13 +2,15 @@ false - - $(OutDir)/Resource + $(OutDir)../../../../runtime/win32/ WindowsLocalDebugger WindowsLocalDebugger - $(OutDir)Resource/ + $(OutDir)../../../../runtime/win32/ + $(OutDir)../../../../runtime/win32/$(TargetFileName) + + $(OutDir)../../../../runtime/win32/$(TargetFileName) \ No newline at end of file