diff --git a/GRRLIB/GRRLIB/GRRLIB_core.c b/GRRLIB/GRRLIB/GRRLIB_core.c index 0b9c246..975c73a 100644 --- a/GRRLIB/GRRLIB/GRRLIB_core.c +++ b/GRRLIB/GRRLIB/GRRLIB_core.c @@ -51,8 +51,6 @@ static bool is_setup = false; // To control entry and exit * @see GRRLIB_Exit */ int GRRLIB_Init (void) { - f32 yscale; - u32 xfbHeight; Mtx44 perspective; s8 error_code = 0; @@ -144,8 +142,8 @@ int GRRLIB_Init (void) { } // Other GX setup - yscale = GX_GetYScaleFactor(rmode->efbHeight, rmode->xfbHeight); - xfbHeight = GX_SetDispCopyYScale(yscale); + f32 yscale = GX_GetYScaleFactor(rmode->efbHeight, rmode->xfbHeight); + u32 xfbHeight = GX_SetDispCopyYScale(yscale); GX_SetDispCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight); GX_SetDispCopyDst(rmode->fbWidth, xfbHeight); GX_SetCopyFilter(rmode->aa, rmode->sample_pattern, GX_TRUE, rmode->vfilter); diff --git a/GRRLIB/GRRLIB/GRRLIB_texEdit.c b/GRRLIB/GRRLIB/GRRLIB_texEdit.c index 287304e..a22d068 100644 --- a/GRRLIB/GRRLIB/GRRLIB_texEdit.c +++ b/GRRLIB/GRRLIB/GRRLIB_texEdit.c @@ -77,18 +77,13 @@ typedef struct tagRGBQUAD { static void RawTo4x4RGBA (const u8 *src, void *dst, const u32 width, const u32 height) { - u32 block; - u32 i; - u8 c; - u8 argb; - u8 *p = (u8*)dst; - for (block = 0; block < height; block += 4) { - for (i = 0; i < width; i += 4) { + for (u32 block = 0; block < height; block += 4) { + for (u32 i = 0; i < width; i += 4) { // Alpha and Red - for (c = 0; c < 4; ++c) { - for (argb = 0; argb < 4; ++argb) { + for (u8 c = 0; c < 4; ++c) { + for (u8 argb = 0; argb < 4; ++argb) { // Alpha pixels *p++ = 255; // Red pixels @@ -97,8 +92,8 @@ void RawTo4x4RGBA (const u8 *src, void *dst, } // Green and Blue - for (c = 0; c < 4; ++c) { - for (argb = 0; argb < 4; ++argb) { + for (u8 c = 0; c < 4; ++c) { + for (u8 argb = 0; argb < 4; ++argb) { // Green pixels *p++ = src[(((i + argb) + ((block + c) * width)) * 3) + 1]; // Blue pixels @@ -188,9 +183,8 @@ GRRLIB_texImg* GRRLIB_LoadTexturePNG (const u8 *my_png) { * @return An array of palette. Memory must be deleted. */ static RGBQUAD* GRRLIB_CreatePalette (const u8 *my_bmp, u32 Size) { - u32 i = 0; RGBQUAD *Palette = calloc(Size, sizeof(RGBQUAD)); - for(u32 n=0; ndata = memalign(32, MyBitmapHeader.biWidth * MyBitmapHeader.biHeight * 4); if (my_texture->data != NULL && MyBitmapFileHeader.bfType == 0x4D42) { + u32 BufferSize; + s32 i; RGBQUAD *Palette; my_texture->w = MyBitmapHeader.biWidth; my_texture->h = MyBitmapHeader.biHeight; switch(MyBitmapHeader.biBitCount) { case 32: // RGBA images i = 54; - for(y=MyBitmapHeader.biHeight-1; y>=0; y--) { - for(x=0; x=0; y--) { + for(s32 x=0; x=0; y--) { - for(x=0; x=0; y--) { + for(s32 x=0; x=0; y--) { - for(x=0; x=0; y--) { + for(s32 x=0; x=0; y--) { - for(x=0; x> ((x % 2) ? 0 : 4)) & 0x0F; + for(s32 y=MyBitmapHeader.biHeight-1; y>=0; y--) { + for(s32 x=0; x> ((x % 2) ? 0 : 4)) & 0x0F; GRRLIB_SetPixelTotexImg(x, y, my_texture, RGBA(Palette[pal_ref].rgbRed, Palette[pal_ref].rgbGreen, @@ -320,9 +313,9 @@ GRRLIB_texImg* GRRLIB_LoadTextureBMP (const u8 *my_bmp) { } Palette = GRRLIB_CreatePalette(&my_bmp[54], 2); i = 62; // 54 + (MyBitmapHeader.biBitCount * 4) - for(y=MyBitmapHeader.biHeight-1; y>=0; y--) { - for(x=0; x> (-x%8+7)) & 0x01; + for(s32 y=MyBitmapHeader.biHeight-1; y>=0; y--) { + for(s32 x=0; x> (-x%8+7)) & 0x01; GRRLIB_SetPixelTotexImg(x, y, my_texture, RGBA(Palette[pal_ref].rgbRed, Palette[pal_ref].rgbGreen, diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB_handle.h b/GRRLIB/GRRLIB/grrlib/GRRLIB_handle.h index f8c816e..f3ac130 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB_handle.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB_handle.h @@ -51,7 +51,7 @@ void GRRLIB_SetHandle (GRRLIB_texImg *tex, const int x, const int y) { */ INLINE void GRRLIB_SetMidHandle (GRRLIB_texImg *tex, const bool enabled) { - if (enabled) { + if (enabled == true) { if (tex->tiledtex) { tex->offsetx = (((int)tex->tilew)/2); tex->offsety = (((int)tex->tileh)/2); diff --git a/examples/blending/source/main.c b/examples/blending/source/main.c index c383963..f4d5a2f 100644 --- a/examples/blending/source/main.c +++ b/examples/blending/source/main.c @@ -66,7 +66,7 @@ int main() { WPAD_SetVRes(WPAD_CHAN_0, WinW, WinH); WPAD_IR(WPAD_CHAN_0, &P1Mote); - // WiiMote IR Viewport Correction + // Wii Remote IR Viewport Correction int P1MX = P1Mote.sx - 150; int P1MY = P1Mote.sy - 150; diff --git a/examples/particle/source/main.cpp b/examples/particle/source/main.cpp index a8bbebf..ce5f14a 100644 --- a/examples/particle/source/main.cpp +++ b/examples/particle/source/main.cpp @@ -69,8 +69,8 @@ int main() { // Init GRRLIB & WiiUse GRRLIB_Init(); - u16 WinW = rmode->fbWidth; - u16 WinH = rmode->efbHeight; + const u16 WinW = rmode->fbWidth; + const u16 WinH = rmode->efbHeight; WPAD_Init(); WPAD_SetIdleTimeout( 60 * 10 ); WPAD_SetDataFormat( WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR ); @@ -98,7 +98,7 @@ int main() { // Resetting Vars GRRLIB_SetBlend( GRRLIB_BLEND_ALPHA ); - // WiiMote IR Viewport correction + // Wii Remote IR Viewport correction const int P1MX = P1Mote.sx - 150; const int P1MY = P1Mote.sy - 150; @@ -127,8 +127,8 @@ int main() { GRRLIB_DrawImg( P1MX, P1MY, GFX_Crosshair, 0, 1, 1, RGBA(255, 255, 255, 255) ); // Draw Text - GRRLIB_Rectangle( 28, 28, 280, 20, RGBA(0, 0, 0, 160), 1 ); - GRRLIB_Printf ( 32, 32, GFX_Font, 0xFFFFFFFF, 1, "Point your WiiMote on the screen." ); + GRRLIB_Rectangle( 28, 28, 292, 20, RGBA(0, 0, 0, 160), 1 ); + GRRLIB_Printf ( 32, 32, GFX_Font, 0xFFFFFFFF, 1, "Point your Wii Remote on the screen." ); GRRLIB_Rectangle( 28, 48, 200, 16, RGBA(0, 0, 0, 160), 1 ); GRRLIB_Printf ( 32, 48, GFX_Font, 0xFFFFFFFF, 1, "Number of Particle: %d", ParticleList.size() ); GRRLIB_Rectangle( 28, 64, 64, 16, RGBA(0, 0, 0, 160), 1 );