diff --git a/cocos/2d/cocos2d_winrt.props b/cocos/2d/cocos2d_winrt.props index 3f0a98ecc4..edd7aab524 100644 --- a/cocos/2d/cocos2d_winrt.props +++ b/cocos/2d/cocos2d_winrt.props @@ -7,12 +7,12 @@ - _VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _VARIADIC_MAX=10;NOMINMAX;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) true true false OldStyle - 4056;4996; + 4056;4996;4244; /IGNORE:4264 %(AdditionalOptions) diff --git a/cocos/2d/cocos2d_wp8.vcxproj b/cocos/2d/cocos2d_wp8.vcxproj index cfc4097d71..94ebe8a919 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj +++ b/cocos/2d/cocos2d_wp8.vcxproj @@ -54,19 +54,19 @@ - + - + - + - + @@ -706,7 +706,4 @@ - - - \ No newline at end of file diff --git a/cocos/2d/cocos2d_wp8.vcxproj.filters b/cocos/2d/cocos2d_wp8.vcxproj.filters index c8defb9951..efbec2797f 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj.filters +++ b/cocos/2d/cocos2d_wp8.vcxproj.filters @@ -1454,9 +1454,4 @@ renderer\shaders - - - renderer - - \ No newline at end of file diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp index ec7f41a8a9..ddc162c22c 100644 --- a/cocos/platform/CCFileUtils.cpp +++ b/cocos/platform/CCFileUtils.cpp @@ -947,23 +947,15 @@ bool FileUtils::isAbsolutePath(const std::string& path) const bool FileUtils::isDirectoryExistInternal(const std::string& dirPath) const { -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) - struct stat st; - if (stat(dirPath.c_str(), &st) == 0) - { - return S_ISDIR(st.st_mode); - } - return false; -#endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - WIN32_FILE_ATTRIBUTE_DATA wfad; - if (GetFileAttributesExA(dirPath.c_str(), GetFileExInfoStandard, &wfad)) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) + WIN32_FILE_ATTRIBUTE_DATA wfad; + std::wstring wdirPath(dirPath.begin(), dirPath.end()); + if (GetFileAttributesEx(wdirPath.c_str(), GetFileExInfoStandard, &wfad)) { return true; } return false; -#endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) unsigned long fAttrib = GetFileAttributesA(dirPath.c_str()); if (fAttrib != INVALID_FILE_ATTRIBUTES && (fAttrib & FILE_ATTRIBUTE_DIRECTORY)) @@ -971,7 +963,16 @@ bool FileUtils::isDirectoryExistInternal(const std::string& dirPath) const return true; } return false; +#else + struct stat st; + if (stat(dirPath.c_str(), &st) == 0) + { + return S_ISDIR(st.st_mode); + } + return false; #endif + + } bool FileUtils::isDirectoryExist(const std::string& dirPath) @@ -1040,29 +1041,12 @@ bool FileUtils::createDirectory(const std::string& path) } } } - -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) - DIR *dir = NULL; - - // Create path recursively - subpath = ""; - for (int i = 0; i < dirs.size(); ++i) { - subpath += dirs[i]; - dir = opendir(subpath.c_str()); - if (!dir) - { - int ret = mkdir(subpath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO); - if (ret != 0 && (errno != EEXIST)) - { - return false; - } - } - } - return true; -#endif + + #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) WIN32_FILE_ATTRIBUTE_DATA wfad; - if (!(GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &wfad))) + std::wstring wpath(path.begin(), path.end()); + if (!(GetFileAttributesEx(wpath.c_str(), GetFileExInfoStandard, &wfad))) { subpath = ""; for(int i = 0 ; i < dirs.size() ; ++i) @@ -1070,7 +1054,8 @@ bool FileUtils::createDirectory(const std::string& path) subpath += dirs[i]; if (i > 0 && !isDirectoryExist(subpath)) { - BOOL ret = CreateDirectoryA(subpath.c_str(), NULL); + std::wstring wsubpath(subpath.begin(), subpath.end()); + BOOL ret = CreateDirectory(wsubpath.c_str(), NULL); if (!ret && ERROR_ALREADY_EXISTS != GetLastError()) { return false; @@ -1079,8 +1064,7 @@ bool FileUtils::createDirectory(const std::string& path) } } return true; -#endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) if ((GetFileAttributesA(path.c_str())) == INVALID_FILE_ATTRIBUTES) { subpath = ""; @@ -1098,6 +1082,24 @@ bool FileUtils::createDirectory(const std::string& path) } } return true; +#else + DIR *dir = NULL; + + // Create path recursively + subpath = ""; + for (int i = 0; i < dirs.size(); ++i) { + subpath += dirs[i]; + dir = opendir(subpath.c_str()); + if (!dir) + { + int ret = mkdir(subpath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO); + if (ret != 0 && (errno != EEXIST)) + { + return false; + } + } + } + return true; #endif } @@ -1110,21 +1112,13 @@ bool FileUtils::removeDirectory(const std::string& path) } // Remove downloaded files -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) - std::string command = "rm -r "; - // Path may include space. - command += "\"" + path + "\""; - if (system(command.c_str()) >= 0) - return true; - else - return false; -#endif + #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - std::string Files = path + "*.*"; + std::wstring wpath = std::wstring(path.begin(), path.end()); + std::wstring files = wpath + L"*.*"; WIN32_FIND_DATA wfd; - HANDLE search = FindFirstFileEx(Files.c_str(), FindExInfoStandard, &wfd, FindExSearchNameMatch, NULL, 0); + HANDLE search = FindFirstFileEx(files.c_str(), FindExInfoStandard, &wfd, FindExSearchNameMatch, NULL, 0); bool ret=true; - std::string Tmp; if (search!=INVALID_HANDLE_VALUE) { bool find=true; @@ -1133,16 +1127,16 @@ bool FileUtils::removeDirectory(const std::string& path) //. .. if(wfd.cFileName[0]!='.') { - Tmp = path + wfd.cFileName; + std::wstring temp = wpath + wfd.cFileName; if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - Tmp += '/'; - ret = ret && this->removeDirectory(Tmp); + temp += '/'; + ret = ret && this->removeDirectory(std::string(temp.begin(), temp.end())); } else { - SetFileAttributes(Tmp.c_str(), FILE_ATTRIBUTE_NORMAL); - ret = ret && DeleteFile(Tmp.c_str()); + SetFileAttributes(temp.c_str(), FILE_ATTRIBUTE_NORMAL); + ret = ret && DeleteFile(temp.c_str()); } } find = FindNextFile(search, &wfd); @@ -1150,10 +1144,9 @@ bool FileUtils::removeDirectory(const std::string& path) FindClose(search); } if (ret) - return RemoveDirectoryA(path.c_str()); + return RemoveDirectory(wpath.c_str()); return false; -#endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) std::string command = "cmd /c rd /s /q "; // Path may include space. command += "\"" + path + "\""; @@ -1162,14 +1155,8 @@ bool FileUtils::removeDirectory(const std::string& path) return true; else return false; -#endif -} - -bool FileUtils::removeFile(const std::string &path) -{ - // Remove downloaded file -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) - std::string command = "rm -f "; +#else + std::string command = "rm -r "; // Path may include space. command += "\"" + path + "\""; if (system(command.c_str()) >= 0) @@ -1177,14 +1164,20 @@ bool FileUtils::removeFile(const std::string &path) else return false; #endif +} + +bool FileUtils::removeFile(const std::string &path) +{ + // Remove downloaded file + #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - if (DeleteFileA(path.c_str())) + std::wstring wpath(path.begin(), path.end()); + if (DeleteFile(wpath.c_str())) { return true; } return false; -#endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) std::string command = "cmd /c del /q "; std::string win32path = path; int len = win32path.length(); @@ -1201,6 +1194,14 @@ bool FileUtils::removeFile(const std::string &path) return true; else return false; +#else + std::string command = "rm -f "; + // Path may include space. + command += "\"" + path + "\""; + if (system(command.c_str()) >= 0) + return true; + else + return false; #endif } diff --git a/cocos/platform/winrt/CCStdC.h b/cocos/platform/winrt/CCStdC.h index 97d53e2631..f86549779b 100644 --- a/cocos/platform/winrt/CCStdC.h +++ b/cocos/platform/winrt/CCStdC.h @@ -94,12 +94,14 @@ typedef SSIZE_T ssize_t; #include +#ifdef WINRT_NO_WINSOCK #undef timeval struct timeval { long tv_sec; // seconds long tv_usec; // microSeconds -}; +}; +#endif // WINRT_NO_WINSOCK #endif // CC_TARGET_PLATFORM == CC_PLATFORM_WP8 struct timezone diff --git a/cocos/platform/wp8/shaders/precompiledshaders.h b/cocos/platform/wp8/shaders/precompiledshaders.h index 3a23edfe5d..51da7437e0 100644 --- a/cocos/platform/wp8/shaders/precompiledshaders.h +++ b/cocos/platform/wp8/shaders/precompiledshaders.h @@ -86,7 +86,7 @@ const unsigned char s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873[] = { 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 248, 3, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 221, 144, 0, 0, 0, 0, + 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 11, 95, 74, 206, 145, 124, 32, 219, 67, 19, @@ -456,7 +456,7 @@ const unsigned char s_13E33F532157A58EC77EDE3B3112560A89D272B2[] = { 116, 114, 105, 120, 0, 0, 0, 0, 0, 0, 0, 0, 204, 2, 0, 0, 164, 4, 0, 0, 0, 0, 0, 0, -221, 144, 0, 0, 0, 0, 0, 0, +194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 127, 145, 81, 72, 216, 190, 16, 61, 245, 231, 235, 249, @@ -800,7 +800,7 @@ const unsigned char s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE[] = { 116, 67, 111, 108, 111, 114, 0, 0, 0, 0, 3, 0, 0, 0, 208, 7, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 221, 144, 0, 0, 0, 0, + 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 65, 106, 69, 173, 111, 248, 97, 165, 186, 90, @@ -1301,7 +1301,7 @@ const unsigned char s_53938AB67AD93ABA0DDB87F3C9889304284E011E[] = { 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 24, 4, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 221, 144, 0, 0, 0, 0, + 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 200, 5, 103, 205, 248, 30, 69, 65, 32, 117, @@ -1675,7 +1675,7 @@ const unsigned char s_67837675F2BB48C0E926316F505FC1538228E0FA[] = { 86, 80, 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 0, 0, 0, 0, 16, 4, 0, 0, 48, 5, 0, 0, - 0, 0, 0, 0, 221, 144, 0, 0, + 0, 0, 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 79, 226, 72, 124, 94, 252, 37, 157, @@ -2070,7 +2070,7 @@ const unsigned char s_78250E25D1929D4A842050738140787BE42541C6[] = { 108, 112, 104, 97, 95, 118, 97, 108, 117, 101, 0, 0, 0, 0, 2, 0, 0, 0, 36, 5, 0, 0, 4, 5, - 0, 0, 0, 0, 0, 0, 221, 144, + 0, 0, 0, 0, 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 100, 113, 175, 29, 164, 71, @@ -2485,7 +2485,7 @@ const unsigned char s_7B67DD242152D35ACC079265FAD9D03DC98182DE[] = { 67, 95, 84, 101, 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 248, 3, 0, 0, 0, 5, - 0, 0, 0, 0, 0, 0, 221, 144, + 0, 0, 0, 0, 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 11, 95, 74, 206, 145, 124, @@ -2869,7 +2869,7 @@ const unsigned char s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 96, 4, 0, 0, 192, 4, 0, 0, 0, 0, 0, - 0, 221, 144, 0, 0, 0, 0, 0, + 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 157, 116, 105, 89, 118, 135, 249, 239, 42, 226, 184, @@ -3250,7 +3250,7 @@ const unsigned char s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C[] = { 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 1, 0, 0, 0, 52, 3, 0, 0, 40, 4, 0, 0, 0, - 0, 0, 0, 221, 144, 0, 0, 0, + 0, 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 153, 8, 62, 201, 202, 170, 111, 182, 149, @@ -3584,7 +3584,7 @@ const unsigned char s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5[] = { 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 240, 4, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, -221, 144, 0, 0, 0, 0, 0, 0, +194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 134, 66, 128, 226, 107, 172, 247, 161, 241, 207, 89, 240, @@ -4001,7 +4001,7 @@ const unsigned char s_92BE325B516F887D2C928EDE20ADF428DB01C038[] = { 95, 118, 97, 108, 117, 101, 0, 0, 0, 0, 2, 0, 0, 0, 36, 5, 0, 0, 0, 5, 0, 0, 0, 0, - 0, 0, 221, 144, 0, 0, 0, 0, + 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 100, 113, 175, 29, 164, 71, 177, 78, 120, 99, @@ -5038,7 +5038,7 @@ const unsigned char s_976D0E98457C40DFC2F0FBD00E30607C9E4CFDAE[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 3, 0, 0, 0, 96, 4, 0, 0, 148, 13, 0, 0, 0, 0, 0, - 0, 221, 144, 0, 0, 0, 0, 0, + 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 157, 116, 105, 89, 118, 135, 249, 239, 42, 226, 184, @@ -5709,7 +5709,7 @@ const unsigned char s_A2377A827972A5466DA8637681045D32DA8A817D[] = { 99, 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 96, 4, 0, 0, 144, 4, 0, 0, 0, 0, 0, - 0, 221, 144, 0, 0, 0, 0, 0, + 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 157, 116, 105, 89, 118, 135, 249, 239, 42, 226, 184, @@ -6094,7 +6094,7 @@ const unsigned char s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86[] = { 111, 108, 111, 114, 0, 0, 0, 0, 2, 0, 0, 0, 240, 5, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, -221, 144, 0, 0, 0, 0, 0, 0, +194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 223, 173, 203, 80, 172, 13, 170, 215, 168, 128, 228, 5, @@ -6526,7 +6526,7 @@ const unsigned char s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893[] = { 77, 97, 116, 114, 105, 120, 0, 0, 0, 0, 0, 0, 0, 0, 204, 2, 0, 0, 144, 4, 0, 0, 0, 0, - 0, 0, 221, 144, 0, 0, 0, 0, + 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 127, 145, 81, 72, 216, 190, 16, 61, 245, 231, @@ -6856,8 +6856,8 @@ const unsigned char s_E2D56227712263272BD5218FEA117CD06180F81B[] = { 117, 95, 112, 111, 105, 110, 116, 83, 105, 122, 101, 0, 0, 0, 0, 2, 0, 0, 0, 204, 2, 0, 0, 208, - 4, 0, 0, 0, 0, 0, 0, 221, -144, 0, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 194, +137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 127, 145, 81, 72, 216, 190, 16, 61, 245, 231, 235, 249, 125, @@ -7207,7 +7207,7 @@ const unsigned char s_F46558C274182079784898CF4968CF431593D5E2[] = { 116, 67, 111, 108, 111, 114, 0, 0, 0, 0, 3, 0, 0, 0, 108, 6, 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 221, 144, 0, 0, 0, 0, + 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 47, 220, 115, 183, 137, 174, 141, 96, 204, 60, @@ -7663,7 +7663,7 @@ const unsigned char s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6[] = { 101, 120, 116, 117, 114, 101, 48, 0, 0, 0, 0, 1, 0, 0, 0, 156, 3, 0, 0, 144, 4, 0, 0, 0, - 0, 0, 0, 221, 144, 0, 0, 0, + 0, 0, 0, 194, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 88, 66, 67, 203, 117, 183, 110, 154, 52, 220, 70, 125, diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.cpp b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.cpp index 421b71db67..daf87f8f2d 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.cpp +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/src/Direct3DInterop.cpp @@ -188,10 +188,10 @@ void Direct3DInterop::SetCocos2dOpenURLDelegate(Cocos2dOpenURLDelegate ^ delegat bool Direct3DInterop::SendCocos2dEvent(Cocos2dEvent event) { - std::string str; + Platform::String^ str; if(m_delegate) { - m_delegate->Invoke(event, stringToPlatformString(str)); + m_delegate->Invoke(event, str); return true; } return false;