by admin

Cocos2d-x 3.8 rc0 is released!

August 31, 2015 in Android, C++, News, Programming by admin

cocos2dx-logovia cocos2d-x forums:

Very excited to announce the v3.8 RC0 version

Highlights and API changes of v3.8

As promised, Cocos2d-x v3.8 have greatly improved the stability and API friendliness. On one side, we continue to improve 3D capacity by providing 3D physics collider, skybox background brush and key frame event callback in Animate3D. On another side, we have refined several core modules, including UI system, AudioEngine, FileUtils, Bindings Generator, etc.

Here is some highlighted improvements:

  1. 3D Module
    • Added 3D physics collider
    • Supported setting camera background brushes with color/depth/skybox
    • Added key frame event Callback in Animate3D
    • Added light map support in Terrain
  2. UI System
    • Reimplemented and enhanced EditBox on Android
    • Added ScrollViewBar for displaying a scroll bar at the side of ScrollView (JSB/Lua ready)
    • Added RadioButton widget (JSB/Lua ready)
    • Added HANYI FullType font support
  3. AudioEngine
    • AudioEngine supported audio preloading
    • Bound new AudioEngine in JSB
  4. FileUtils
    • Added a set of file writing APIs: writeStringToFile, writeDataToFile, writeValueMapToFile, writeValueVectorToFile
  5. Others
    • Improved Bindings Generator tool
    • Merged JSB test project into cocos2d test project
    • framework: Support generate prebuilt libs of engine with debug mode
    • console: Supported new portrait projects from templates

Follow this link for more informations

by admin

Raspberry PI hang instruction

August 31, 2015 in Code Snippets, Programming, Raspberry PI, Security by admin

raspberry-NASSource from here

While writing my own assembler for ARM, I realized that an instruction fuzzer can spot some funky results on real CPUs. Undefined behaviour is a known topic for some ancient CPUs like z80, where many undefined instructions have been analyzed and exploited in order to achieve some performance tricks for the demoscene.

But undefined behaviour on modern SOCs and CPUs is not really a known topic for several reasons. First one is that there are several manufacturers and models for every single architecture, and in addition, the microcode is not documented and distributed in encrypted form, so understand what an instruction really does is hard.

This is also a problem for compilers and handwritten assembly optimizations which tend to require several fall-back implementations depending on the CPU model because the same instruction performs different on different chips.

As long as ARM is a fixed-length instruction length (except for Thumb2, which is quite easy to handle), it makes fuzzing those instructions easier than say x86. By understanding how instructions are composed you can quickly reduce the amount of instructions to fuzz.

And this is how I found 4 bytes that hang the RPI CPU; this undefined instruction doesn’t requires special privileges, so any user can execute it and brick the board. Requiring a hardware reset to bring it back to life.

A tiny ELF can be cooked with rabin2:

$ rabin2 -a arm -b32 -C elf:fedeffe7 killrpi

Radare2 allows us to quickly check that instruction with different disassemblers.

$ for a in arm arm.gnu arm.winedbg ; do rasm2 -a $a -b 32 -d fedeffe7 ; done 
    trap ; 
    <UNDEFINED> 0xe7ffdefe 
    ldrbt sp,

This doesn’t seems to show us anything useful, so let’s go deeper with the documentation:

So we can now decompose the bits of that instruction in order to understand what it is supposed to be doing:

BYTES: E7 FF DE FE 

E    7     F    F  D  E F    E 
1110 011 1 1111 [imm12] 1111 [imm4] 

So, acording to this documentation, that instruction is decoded as UDF, which is a variety of instructions that are undefined by definition and are used by debuggers to set breakpoints.

But, why only that specific construction hangs the board? Digging a bit in Google looks like this sequence is used by the Angel Debugger, which is a hardware debugger that is attached to the board using the JTAG connector and that specific core seems to enforce that exception to wait for reply.

The only way to bring it back to live is by unplugging and plugging back the power.

This bug only affects all the models of the first Raspberry PI. The RPI2 is not affected, as well as other ARM devices (phones and tablets) I tried… but maybe, other instructions provoke similar behavior :)

Follow the original link for more information.

C++ Internals :: STL vector, Part I

August 5, 2015 in C++, Programming, Uncategorized by Adrian Marius

c++Today is a great day to disembowel something. How’s about a well-known std::vector? You think there is nothing more you can learn about it? Believe me, you’re wrong.

In this series of three articles we are going to check:

what is std::vector and how it works (suppress a yawn)
vector’s growth factor
VC++ Debug’s “aux object”
new C++11’s methods
miscellaneous things

 

std::vector is the most famous sequence container in C++ world that encapsulates dynamic size arrays. Other sequence containers you might be aware of arestd::forward_list (since C++11), std::list, std::deque and std::array(since C++11). But the scope of this article is std::vector. So, let’s get started.

The items in std::vector are stored contiguously in memory:

A gentle introduction to shaders in Unity3D

June 19, 2015 in Programming by Adrian Marius

We can safely say that Unity3D has made game development easier for a lot of people. Something where it still has a long way to go is, with no doubt, shader coding. Often surrounded by mystery, a shader is a program specifically made to run on a GPU. It is, ultimately, what draws the triangles of your 3D models. Learning how to code shaders is essential if you want to give a special look to your game

 

http://www.alanzucconi.com/2015/06/10/a-gentle-introduction-to-shaders-in-unity3d/

 

shader theory

OpenGL API Documentation

June 19, 2015 in OpenGL by Adrian Marius

Here is OpenGL API Documentation

 

http://docs.gl/

Python on Android

May 5, 2015 in Android, Programming by Adrian Marius

android-logoThere are an increasing number of resources about different ways of running Python on Android. Kivy (and its subprojects) are commonly mentioned, as one of the most mature and popular ways to do so, but one thing that gets less attention is the details of what you can do with Python itself once it’s running on the device – what are the limitations of this? Can we use any Python module? What about calling Android APIs, can we perform all of the functions of a Java application? These are all somewhat leading questions, they are things addressed by Kivy or its associated projects, and in this post I’ll summarise some of the most interesting and important details.

 

http://kivy.org/planet/2015/04/python-on%C2%A0android/

Modern OpenGL 08 – Even More Lighting: Directional Lights, Spotlights, & Multiple Lights

April 30, 2015 in OpenGL by Adrian Marius

In this article, we will be adding directional lights, spotlights, and allowing for multiple lights instead of just one. This is the final article on lighting – at least for a while.

Implementing Hello Triangle in Mantle

April 19, 2015 in Uncategorized by Adrian Marius

mantle-powered-by-amdThe specification and drivers for Vulkan, Khronos’ next generation graphics API, are expected to be released later this year. However, we can get a head start on learning how this new API will work by learning from the project that it evolved from: Mantle.

 

https://medium.com/@Overv/implementing-hello-triangle-in-mantle-4302450fbcd2

Nick Desaulniers – Raw WebGL

April 19, 2015 in OpenGL, Uncategorized by Adrian Marius

New web developers have trouble distinguishing jQuery from JavaScript. We frequently point developers to three.js for doing 3D on the web, but what is raw WebGL and what tools do we have for debugging 3D web applications?

Slides Here: http://nickdesaulniers.github.io/RawWebGL/#/

 

Collision detection (part 2)

January 19, 2015 in Programming by Adrian Marius

Last time, we discussed collision detection in general and surveyed some techniques for narrow phase collision detection.  In this article we will go into more detail on broad phase collision detection for closed axis-aligned boxes.  In the late 1970’s and early 1980’s, this problem attracted an enormous amount of attention due to its applications in VLSI design, resulting in many efficient algorithms and data structures.  Here we survey some of the general approaches to this problem and review some analytical results.

Skip to toolbar