diff --git a/.gitignore b/.gitignore index df753dedd4..59978b5f0c 100644 --- a/.gitignore +++ b/.gitignore @@ -60,4 +60,6 @@ build/ .Target-Release/ # Ignore files built by blackberry -Simulator/ \ No newline at end of file +Simulator/ +Device-Debug/ +Device-Release/ diff --git a/Box2D/proj.qnx/.project b/Box2D/proj.qnx/.project index 931d397f70..1d10bd51eb 100644 --- a/Box2D/proj.qnx/.project +++ b/Box2D/proj.qnx/.project @@ -27,7 +27,7 @@ org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/Box2D/Device-Release} + ${workspace_loc:/Box2D/Device-Debug} org.eclipse.cdt.make.core.contents diff --git a/CocosDenshion/proj.qnx/.project b/CocosDenshion/proj.qnx/.project index 1b9a122299..0cc3463ad9 100644 --- a/CocosDenshion/proj.qnx/.project +++ b/CocosDenshion/proj.qnx/.project @@ -1,89 +1,93 @@ - - - CocosDenshion - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/CocosDenshion/Device-Release} - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.qnx.tools.ide.bbt.core.bbtnature - org.eclipse.cdt.core.ccnature - - - - include - 2 - PARENT-1-PROJECT_LOC/include - - - qnx - 2 - PARENT-1-PROJECT_LOC/qnx - - - + + + CocosDenshion + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?children? + ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\|| + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/CocosDenshion/Device-Debug} + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + com.qnx.tools.ide.bbt.core.bbtnature + org.eclipse.cdt.core.ccnature + + + + include + 2 + PARENT-1-PROJECT_LOC/include + + + qnx + 2 + PARENT-1-PROJECT_LOC/qnx + + + diff --git a/CocosDenshion/qnx/SimpleAudioEngine.cpp b/CocosDenshion/qnx/SimpleAudioEngine.cpp index 1a009ce74c..1e1b4e428b 100644 --- a/CocosDenshion/qnx/SimpleAudioEngine.cpp +++ b/CocosDenshion/qnx/SimpleAudioEngine.cpp @@ -71,7 +71,6 @@ namespace CocosDenshion static strm_dict_t *s_volumeDictionary = 0; static SimpleAudioEngine *s_engine = 0; - static string s_strResourcePath = "./app/native/Resource/"; static void printALError(int err) { @@ -229,8 +228,6 @@ namespace CocosDenshion string path = "file://"; path += cwd; path += "/"; - // CocosDenshion is an independent module, we should not make the coupling between Cocos2dx and CocosDenshion. - path += s_strResourcePath;//cocos2d::CCFileUtils::getResourcePath(); path += pszFilePath; s_mmrConnection = mmr_connect(mmrname); @@ -433,9 +430,7 @@ namespace CocosDenshion ALuint source; soundData *data = new soundData; - // CocosDenshion is an independent module, we should not make the coupling between Cocos2dx and CocosDenshion. - string path = s_strResourcePath;// cocos2d::CCFileUtils::getResourcePath(); - path += pszFilePath; + string path = pszFilePath; buffer = alutCreateBufferFromFile(path.data()); diff --git a/chipmunk/proj.qnx/.project b/chipmunk/proj.qnx/.project index 338f6d01c2..42f02724c6 100644 --- a/chipmunk/proj.qnx/.project +++ b/chipmunk/proj.qnx/.project @@ -27,7 +27,7 @@ org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/chipmunk/Device-Profile} + ${workspace_loc:/chipmunk/Device-Debug} org.eclipse.cdt.make.core.contents diff --git a/cocos2dx/cocoa/CCNS.cpp b/cocos2dx/cocoa/CCNS.cpp index fbd8aef8ae..716ce2fc3b 100644 --- a/cocos2dx/cocoa/CCNS.cpp +++ b/cocos2dx/cocoa/CCNS.cpp @@ -32,26 +32,26 @@ using namespace std; typedef std::vector strArray; // string toolkit -void split(std::string src, const char* token, strArray& vect) -{ - int nend=0; - int nbegin=0; - while(nend != -1) - { - nend = src.find(token, nbegin); - if(nend == -1) - vect.push_back(src.substr(nbegin, src.length()-nbegin)); - else - vect.push_back(src.substr(nbegin, nend-nbegin)); - nbegin = nend + strlen(token); - } +static inline void split(std::string src, const char* token, strArray& vect) +{ + int nend=0; + int nbegin=0; + while(nend != -1) + { + nend = src.find(token, nbegin); + if(nend == -1) + vect.push_back(src.substr(nbegin, src.length()-nbegin)); + else + vect.push_back(src.substr(nbegin, nend-nbegin)); + nbegin = nend + strlen(token); + } } // first, judge whether the form of the string like this: {x,y} // if the form is right,the string will be splited into the parameter strs; // or the parameter strs will be empty. // if the form is right return true,else return false. -bool splitWithForm(const char* pStr, strArray& strs) +static bool splitWithForm(const char* pStr, strArray& strs) { bool bRet = false; diff --git a/cocos2dx/platform/qnx/CCFileUtils_qnx.cpp b/cocos2dx/platform/qnx/CCFileUtils_qnx.cpp index c0c27f0924..04fe98691d 100644 --- a/cocos2dx/platform/qnx/CCFileUtils_qnx.cpp +++ b/cocos2dx/platform/qnx/CCFileUtils_qnx.cpp @@ -55,7 +55,18 @@ void CCFileUtils::setResourcePath(const char *pszResourcePath) const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath) { - return pszRelativePath; + // It works like this: if the relative path already includes the resource path + // it will be returned as it is + const std::string relPath = pszRelativePath; + if (relPath.find(s_strResourcePath) == std::string::npos) { + CCString *pRet = new CCString(); + pRet->autorelease(); + pRet->m_sString = s_strResourcePath + pszRelativePath; + return pRet->m_sString.c_str(); + } + else { + return pszRelativePath; + } } const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile) @@ -72,17 +83,22 @@ unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* psz { unsigned char * buffer = NULL; + std::string full_path = pszFileName; + + // If it is not inside resource path + if (full_path.find(s_strResourcePath) == std::string::npos) { + full_path = s_strResourcePath + pszFileName; + } + // if specify the zip file,load from it first if (s_pszZipFilePath[0] != 0) { - buffer = getFileDataFromZip(s_pszZipFilePath.c_str(), pszFileName, pSize); + buffer = getFileDataFromZip(s_pszZipFilePath.c_str(), full_path.c_str(), pSize); } // if that failed then let's try and load the file ourselves if (!buffer) { - std::string full_path = s_strResourcePath + pszFileName; - // read the file from hardware FILE *fp = fopen(full_path.c_str(), pszMode); if (fp) @@ -101,7 +117,7 @@ unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* psz { std::string title = "Notification"; std::string msg = "Get data from file("; - msg.append(pszFileName); + msg.append(full_path); if (s_pszZipFilePath[0] != 0) { msg.append(") in zip archive(").append(s_pszZipFilePath); diff --git a/cocos2dx/proj.qnx/.cproject b/cocos2dx/proj.qnx/.cproject index 5ec6fea295..98356fef5b 100644 --- a/cocos2dx/proj.qnx/.cproject +++ b/cocos2dx/proj.qnx/.cproject @@ -87,7 +87,7 @@ - + @@ -154,7 +154,7 @@ - - - - -