Help : Importing Project from Android to QNX

Hi all , I’m already create a game in Android using cocos2d-1.0.1-x-0.10.0 and I’m trying to port it into QNX project.
so here is my step :

  1. creating new QNX project in cocos2d-1.0.1-x-0.11.0
  2. copy and paste the classes (without the appdelegate and android.mk) and resources from the Android project
  3. edit my QNX classes (Android.mk and AppDelegate.cpp)
  4. set the Build Configuration into simulator
  5. build the project without error

but when I try to run the project in the simulator it’s installed but can’t open.
any help ?

thanks

Did you run helloworld and tests projects successfully on blackberry simulator?
BTW, You should use VMPlayer to run the simulator.

thanks James for the quick reply

yes I’ve already run the Helloworld and the tests projects in the simulator successfully.
and I’ve found that when I’m trying to call
bool z;
z = CCUserDefault::sharedUserDefault()->getBoolForKey(“xxx”); in my init()
the simulator got crash

are my steps correct ?

thanks

Could you find where it crashed?

this is my cpp :

#include “SceneMenu.h”
#include “CCUserDefault.h”

#define MUSIC_FILE “loop2.mp3”

USING_NS_CC;

CCMenuItemImage **btnStart ,**btnGallery , **btnSound ,
**btnMan , **btnWoman ,**btnback;
CCMenu* pMenu;

bool isMute;

using namespace CocosDenshion;

CCScene* SceneMenu::scene()
{
// ‘scene’ is an autorelease object
CCScene scene = CCScene::node;
// ‘layer’ is an autorelease object
SceneMenu
layer = SceneMenu::node();

// add layer as a child to scene
scene->addChild(layer);

isMute = CCUserDefault::sharedUserDefault()->getBoolForKey(“isMute”);

if(!isMute){
SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(std::string(CCFileUtils::fullPathFromRelativePath(MUSIC_FILE)).c_str());
SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(0.5);
if(!SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying()){
CCLog(“play background music”);
SimpleAudioEngine::sharedEngine()>playBackgroundMusic).c_str, true);
}
}
// return the scene
return scene;
}
bool SceneMenu::init
{
CCSize size = CCDirector::sharedDirector
>getWinSize;
if )
{
return false;
}
CCSprite* pSprite = CCSprite::spriteWithFile;
pSprite~~>setPosition );
this~~>addChild(pSprite, 0);

return true;
}

this my .h file :

#ifndef SceneMenu_SCENE_H
#define SceneMenu_SCENE_H

#include “cocos2d.h”
#include “SceneGame.h”
#include “SimpleAudioEngine.h”

using namespace cocos2d;

class SceneMenu : public CCLayer
{
public:
// Here’s a difference. Method ‘init’ in cocos2d-x returns bool, instead of returning ‘id’ in cocos2d-iphone
virtual bool init();

// there’s no ‘id’ in cpp, so we recommand to return the exactly class pointer
static CCScene* scene();

// a selector callback
virtual void menuCloseCallback(CCObject* pSender);

void initBtn();
void initBtn2();

// implement the “static node()” method manually
LAYER_NODE_FUNC(SceneMenu);
};

when I call isMute = CCUserDefault::sharedUserDefault()->getBoolForKey(“isMute”); in the cpp file the simulator crash

any help ?

thanks

I also faced this problem. It crashes in CCFileUtils::getWriteablePath() that is called when CCUserDefault is initialized.
I will investigate this further but it takes so long to run a debug session (

Hi all

I’m running tests project UserDefaultTest with QNX Simulator and it got crash too ,

it only show * init value** without the string , double and the other value in the console

anybody got the same problem ?

Ok, I will try to find out what the problem is. :slight_smile:
Henry Jaya wrote:

Hi all
>
I’m running tests project UserDefaultTest with QNX Simulator and it got crash too ,
>
it only show * init value** without the string , double and the other value in the console
>
anybody got the same problem ?

Hi, all,
I tested this issue on both simulator and device. No crash appeared.
And the result is as follows:

libEGL info: use DRM for display 40000001
libEGL debug: searching for pipe module vmwgfx_drv
libEGL debug: expanded path /usr/lib/graphics/vmware/libpipe_vmwgfx_drv.so
libEGL debug: loaded /usr/lib/graphics/vmware/libpipe_vmwgfx_drv.so
libEGL debug: the best driver is Gallium (score 100)
libEGL debug: loading mapi module HwGLESv1_CM
libEGL debug: loaded /usr/lib/graphics/vmware/libHwGLESv1_CM.so
libEGL debug: searching for st module HwGLESv1_CM
libEGL debug: loaded /usr/lib/graphics/vmware/libst_HwGLESv1_CM.so
AL_INVALID_NAME in resumeBackgroundMusic
cocos2d-x debug info [********************** init value ***********************]
cocos2d-x debug info [string is value1]
cocos2d-x debug info [double is 2.400000]
cocos2d-x debug info [integer is 10]
cocos2d-x debug info [float is 2.300000]
cocos2d-x debug info [bool is true]
cocos2d-x debug info [********************** after change value ***********************]
cocos2d-x debug info [string is value2]
cocos2d-x debug info [double is 2.600000]
cocos2d-x debug info [integer is 11]
cocos2d-x debug info [float is 2.500000]
cocos2d-x debug info [bool is false]

BTW, I use 1.0 release sdk. :slight_smile:

Hi James Thanks for the quick reply

I’m also use 1.0 release sdk with latest release of cocos2d-x

which version of cocos2d-x you use?
latest release or latest code on github?

thanks

I tested it by using cocos2d-1.0.1-x-0.11.0, it crashed. Please try the latest code on the github. Website is https://github.com/cocos2d/cocos2d-x. Thanks.

I found that this issue have been resolved in the latest code.
You should hack the function below:

std::string CCFileUtils::getWriteablePath()
{
    // Let's write it in the current working directory's data folder
    char cwd[FILENAME_MAX];

    getcwd(cwd, FILENAME_MAX - 1);
    cwd[FILENAME_MAX-1] = '\0'; // this line, original is cwd[FILENAME_MAX] = '\0', out of bound error.

    std::string path = cwd;
    path += "/data/";

    return path;
}

Hi James many thanks for your help

I’m just download the latest code on the github
and I run the tests project UserDefaultTest it working fine,
however when I try to build the Helloworld project I got this build error in my console
(the same thing happen when I’m create a new cocos2d-x qnx project)

this is the error :

* Build of configuration Simulator for project HelloWorld*

* Internal Builder is used for build*
qcc o HelloWorld main.o Classes\HelloWorldScene.o Classes\AppDelegate.olcocos2dx lCocosDenshionlGLESv1_CM lbpslcurl lmmrndclientlstrm lgrskialOpenAL lalutlcurl lasoundlxml2 V4.4.2,gcc_ntox86_cppw1 ~~lang-c++~~g ~~Wl,~~z,relro ~~Wl,~~z,now LC:/blackberry/target/qnx6/…/target-override/x86/libLC:/blackberry/target/qnx6/…/target-override/x86/usr/lib L…/…/…/cocos2dx/proj.qnx/SimulatorL…/…/…/CocosDenshion/proj.qnx/Simulator L…/…/…/cocos2dx/platform/third_party/qnx/libraries/x86Wl,…/…/…/Box2D/proj.qnx/Simulator/libBox2D.a -Wl,…/…/…/chipmunk/proj.qnx/Simulator/libchipmunk.a
…/…/…/CocosDenshion/proj.qnx/Simulator/libCocosDenshion.so: undefined reference to `ov_clear’
…/…/…/CocosDenshion/proj.qnx/Simulator/libCocosDenshion.so: undefined reference to `ov_info’
…/…/…/CocosDenshion/proj.qnx/Simulator/libCocosDenshion.so: undefined reference to `ov_pcm_total’
…/…/…/CocosDenshion/proj.qnx/Simulator/libCocosDenshion.so: undefined reference to `ov_test’
…/…/…/CocosDenshion/proj.qnx/Simulator/libCocosDenshion.so: undefined reference to `ov_read’
…/…/…/CocosDenshion/proj.qnx/Simulator/libCocosDenshion.so: undefined reference to `ov_fopen’
cc: C:/blackberry/host/win32/x86/usr/bin/ntox86-ld caught signal 1
Build error occurred, build is stopped
Time consumed: 244 ms.

thanks

The code on github is not stable. So please use the latest release version, and hack the code above by yourself.

yes, it’s working now

thank you very much James