Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 78
Registered: ‎12-12-2012
My Device: playbook
My Carrier: free
Accepted Solution

Discover Gamepad SegFault

Hello,

 

I have implemented gamepad support but a SegFault occured when I call my discoverControllers function. It is the same as in gamepad sample (which work great).

 

If I do not connect my steel series gamepad at start and connect after then a device event is catched and controller is correctly loaded. And I can use it.

 

What can I have wrong in discoverControllers?

 

The game crash or return error when I call

int deviceCount;
    SCREEN_API(screen_get_context_property_iv(screen_ctx, SCREEN_PROPERTY_DEVICE_COUNT, &deviceCount), "SCREEN_PROPERTY_DEVICE_COUNT");

screen_device_t* devices = (screen_device_t*)calloc(deviceCount, sizeof(screen_device_t));
    SCREEN_API(screen_get_context_property_pv(screen_ctx, SCREEN_PROPERTY_DEVICES, (void**)devices), "SCREEN_PROPERTY_DEVICES");

 

 

I call discover only when all screen config are done.

 

Developer
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: Discover Gamepad SegFault

if you are getting crash then can you post stack trace as well.

Developer
Posts: 78
Registered: ‎12-12-2012
My Device: playbook
My Carrier: free

Re: Discover Gamepad SegFault

Hi,

 

i found my bugs. I call my screen_ctx that I have declare static in a bad scope.

Developer
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: Discover Gamepad SegFault

Great, Glad to hear that you solved your problem.
Developer
Posts: 78
Registered: ‎12-12-2012
My Device: playbook
My Carrier: free

Re: Discover Gamepad SegFault

Thanks,

 

to all dev, 2 days (which 1 to find my bug) to add gamepad support on my native code. It is not so difficult and very cool to play with a gamepad.