*Branch GRRMOD*

Could now be compiled with latest version of GRRLIB/libogc, example still needs to be updated
This commit is contained in:
Crayon2000 2011-05-20 21:37:37 +00:00
parent 7092599b47
commit 37f4fe28aa

View file

@ -25,9 +25,9 @@ THE SOFTWARE.
* Inline functions for manipulating pixels in textures. * Inline functions for manipulating pixels in textures.
*/ */
#define _SHIFTL(v, s, w) \ #define _SHIFTL(v, s, w) \
((u32) (((u32)(v) & ((0x01 << (w)) - 1)) << (s))) ((u32) (((u32)(v) & ((0x01 << (w)) - 1)) << (s)))
#define _SHIFTR(v, s, w) \ #define _SHIFTR(v, s, w) \
((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1))) ((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1)))
/** /**
@ -78,11 +78,11 @@ void GRRLIB_SetPixelTotexImg (const int x, const int y,
*/ */
INLINE INLINE
u32 GRRLIB_GetPixelFromFB (int x, int y) { u32 GRRLIB_GetPixelFromFB (int x, int y) {
u32 regval,val; u32 regval,val;
regval = 0xc8000000|(_SHIFTL(x,2,10)); regval = 0xc8000000|(_SHIFTL(x,2,10));
regval = (regval&~0x3FF000)|(_SHIFTL(y,12,10)); regval = (regval&~0x3FF000)|(_SHIFTL(y,12,10));
val = *(u32*)regval; val = *(u32*)regval;
return RGBA(_SHIFTR(val,16,8), _SHIFTR(val,8,8), val&0xff, _SHIFTR(val,24,8)); return RGBA(_SHIFTR(val,16,8), _SHIFTR(val,8,8), val&0xff, _SHIFTR(val,24,8));
} }
@ -95,9 +95,9 @@ u32 GRRLIB_GetPixelFromFB (int x, int y) {
*/ */
INLINE INLINE
void GRRLIB_SetPixelToFB (int x, int y, u32 pokeColor) { void GRRLIB_SetPixelToFB (int x, int y, u32 pokeColor) {
u32 regval; u32 regval;
regval = 0xc8000000|(_SHIFTL(x,2,10)); regval = 0xc8000000|(_SHIFTL(x,2,10));
regval = (regval&~0x3FF000)|(_SHIFTL(y,12,10)); regval = (regval&~0x3FF000)|(_SHIFTL(y,12,10));
*(u32*)regval = _SHIFTL(A(pokeColor),24,8) | _SHIFTL(R(pokeColor),16,8) | _SHIFTL(G(pokeColor),8,8) | (B(pokeColor)&0xff); *(u32*)regval = _SHIFTL(A(pokeColor),24,8) | _SHIFTL(R(pokeColor),16,8) | _SHIFTL(G(pokeColor),8,8) | (B(pokeColor)&0xff);
} }