Additional Platform Support

Additional Platform Support
0.0 0


I spent a few hours this weekend getting the Marmalade platform working with cocos2d-2.0-rc2-x-2.0.1

Enclosed is a diff report showing which files changed, there were not very many, mostly in the platform/marmalade and associated projects.

All the tests are working as shown in the screen shots.

I’m not sure if it should be part of the official branch or should I store these changes somewhere else?


marmalade1.png (117.4 KB)

Marmalade2.png (52.0 KB) (16.1 KB)


Can you make this available somewhere?



I will try to fork the cocos2d-x again on github and make this available to anyone that wants it, I did this before but I am a little rusty on git now, I use subversion most of the time.

It won’t be until this weekend that I will have time.



Great, thanks :slight_smile:


Hello, new forum member here. Thanks for putting the effort into this, Francis. I’m looking forward to using 2.0 with Marmalade. I’d be happy to be a test dummy.


I have been extremely busy this weekend so haven’t had a chance to figure out github again.

I did put the updated code here :

It doesn’t support curl or tifff files yet but everything else seems to work in the tests.

One problem I had was Marmalade system includes their package for libjpeg which was older than the one required by cocos2d-x.

To fix this, I added the latest jpeg code to the cocos2d-x project for Marmalade and commented out libjpeg in the Marmalade/6.0/modules/iwutil/iwutil.mkf so that the old version isn’t included also. I asked the question on the Marmalade forum an it is here:

If you have any problems building the HelloWorld or Tests then let me know.




Downloaded. I’ll play around with it this week and try some Marmalade builds.

Looks like end of August is the earliest that libjpeg conflict would be resolved on the Marmalade side, assuming they stick to their release schedule.



Forked cocos2d-x in github, made a marmalade_support branch from the latest release tag, committed and pushed styck’s changes, and added a few trivial commits.

After commmenting out libjpeg from Marmalade/6.0/modules/iwutil/iwutil.mkf, I was able to successfully build HelloWorld and tests from MSVC 10 in x86, Debug and Release. In the Debug build, both projects fail the same runtime assertion twice on startup, listed below, but both seem to mostly work afterward.

IwAssert failure:
Channel: IW_GL
File: IwGLShaderCache.cpp
Line: 427
Expression: g_IwGLAllowNegativeLocations || (location >= 0)
Message: Negative location (–1) passed to glUniform. This is allowed by the OpenGL ES 2.x spec and will be ignored, but may indicate problems in the application. Use [GL] AllowNegativeUniformLocation=1 to disable this warning.

ParticleTest fails a couple more assertions and then crashes. A cursory browse of some of the other tests suggests they’re working; I’ll try running them all and comparing behavior to the win32 project.

Both HelloWorld and tests crash with an unhandled exception on close.

Building for GCC (ARM) results in some failures. One was easy to fix (name conflict between a log2 macro in Marmalade and a log2 function in ActionsTest), but there is at least one problem that may be non-trivial to solve. Marmalade #defines INLINE, and both libjpeg8d and libxml2 expect to use INLINE with their own definition. This produces the following errors/warnings in my environment:

e:/cocos2d-x/cocos2dx/platform/third_party/marmalade/libjpeg8d/jchuff.c(306): error : duplicate ‘static’
(and similar errors elsewhere in the file)
e:/cocos2d-x/cocos2dx/platform/third_party/marmalade/libxml2/sources/HTMLparser.c(621): warning : “INLINE” redefined
e:/marmalade/6.0/s3e/h/s3eTypes.h(317) : note: this is the location of the previous definition

I’m also getting an error about not finding arm/arch.h, but I’m going to assume that’s a problem with my build environment until I can prove otherwise.

Will see how much of this I can solve this week.


I was able to get my app to compile for an arm release with a few quick fixes.

In neon_matrix_impl.h I added “|| defined I3D_ARCH_ARM”

#ifdef arm
#if defined ANDROID || defined I3D_ARCH_ARM
// android don’t have arm/arch.h but it defines arm
#include “arm/arch.h”
#endif //ANDROID
#endif // arm

And for the project I defined S3E_NO_INLINE, although we problem only want to do this for the libjpeg and libxml.

For the iPhone deployment, I was able to run the generated .s3e file in my iphone\release\intermediate_files and my app ran perfectly with no errors.

For the Android deployment I copied the .apk file to my Kindle Fire and the game came up but with and orientation problem. This was fixed with in the app.icf with DispFixRot=Portrait (note, the 0,1,2 are deprecated)

I will visit the tests this weekend.




Hi, Francis. I reduced the platforms coz the folder structure and API set must be improved before expanding new platforms.
We just finished the adjustments a few days ago. Please checkout the last version on github. The folder structure is more clear than before.
Please pull request directly to github, I will merge it.
If possible , please add some auto-build scripts for marmalade port, which will make continious-integration easier.


I updated the github fork at

In general the tests are working. I was looking at the Windows support and saw the setDesignResolutionSize() and thought that would be nice for marmalade too but haven’t got that working yet.

A bit more testing is in order before a pull request.




Hi, I’m new to CoCos-2dx and Marmalade. I downloaded from the github fork and was able to run the helloworld.mkb and it didn’t crash but the text did not display. In the debug it said it could not find the file and path for the arial.ttf font. Is this a known issue or is there something I need to do to fix it on my machine?

Thank you,
Barret Hudson


I just recreated what you are seeing. The HelloWorld\Resources directory is where th font is being looked for. If you want to get rid of the error you can copy the arial.ttf font from tests/Resources/fonts/ to the HelloWorld\Resources

Build the tests project by double clicking on tests\proj.marmalade\test.mkb to see evertyhing that is currently working.

I think the structure of the cocos2d-x directories are changing again so I will need to find some time to sort it out again.



Thanks for the response Francis. I figured the issue was just getting the .ttf in the rite place, I just couldn’t figure out where the file path was specified. How did you determine where it was looking for the .ttf file in case I encounter a similar problem in the future?



The location where a cocos2d-x program looks for fonts and images is the same for all cocos2d-x projects, /Resources by default.



Ahhhh good to know, thanks for the info.



Hi, thank you for making this work!
I have just one issue with the device orientation:
When I set DispFixRot=FixedLandscape, the image is not rotated but the aspect ratio is changed.

Do you have any suggestions to fix this?



Hi Thomas, this is one area that needs additional time to look at. I had to set things one way for the Marmalade simulator and another way when I deployed to the device, so something was messed up but I was never able to find it.

The work around was just to set either landscape/portrait and width/height until it looks like the way you expect it to, so basically a hack.

I haven’t used Marmalade in a month or so and will need to revist when I have time.



Thanks for your response,
It behaves a bit differently on my side:
I always get the same result on the Marmalade simulator and on my device (iOS).
Portrait works as expected, but not Landscape.
Changing the width/height and landscape/portrait won’t work for me, as the drawing is never rotated.

I will try to find out what is going on the next time I work on my marmalade project.



I made a small fix for the device orientation issue and submitted a pull request to:

It works fine for me on iOS and marmalade simulator.