Blackberry: buildfix.
Give up on supporting multiple libpng. FindPNG doesn't report the specific include dir it uses and the library name doesn't always match. So use libpng17 on Linux/Blackberry too.
Fix a few warnings, mostly type comparisons.
Scale bits better in MakePixelTexture().
Implement a very basic stencil upload.

This is not fast or efficient, but works.
Fix exit replacement hooks.
Fix Star Ocean movement problems due to memcpy.

It needs to handle overlap correctly, ugh.
Hook Star Ocean's function to upload stencil data.

Hurray, it seems to work properly.
Add support for 4444/5551/8888 stencil upload.
Disable the last shader properly.
Upload stencil by bit rather than by value.

Still not the most optimal way, probably, but this was an easy change.