diff --git a/GRRLIB/GRRLIB/GRRLIB_3D.c b/GRRLIB/GRRLIB/GRRLIB_3D.c index 2dc571b..5607f64 100644 --- a/GRRLIB/GRRLIB/GRRLIB_3D.c +++ b/GRRLIB/GRRLIB/GRRLIB_3D.c @@ -1,5 +1,5 @@ /*------------------------------------------------------------------------------ -Copyright (c) 2009-2017 The GRRLIB Team +Copyright (c) 2009-2019 The GRRLIB Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -388,7 +388,7 @@ void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled, u32 col) theta1 = theta + ringDelta; cosTheta1 = cos(theta1); sinTheta1 = sin(theta1); - if(filled) { + if(filled == true) { GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2*(nsides+1)); } else { @@ -437,7 +437,7 @@ void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled, u32 col) { lat1 = M_PI * (-0.5F + (f32) i / lats); z1 = sin(lat1); zr1 = cos(lat1); - if(filled) { + if(filled == true) { GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2*(longs+1)); } else { @@ -495,7 +495,7 @@ void GRRLIB_DrawCube(f32 size, bool filled, u32 col) { v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2; for (i = 5; i >= 0; i--) { - if(filled) { + if(filled == true) { GX_Begin(GX_QUADS, GX_VTXFMT0, 4); } else { @@ -513,7 +513,7 @@ void GRRLIB_DrawCube(f32 size, bool filled, u32 col) { GX_Position3f32(v[faces[i][3]][0], v[faces[i][3]][1], v[faces[i][3]][2]); GX_Normal3f32(n[i][0], n[i][1], n[i][2]); GX_Color1u32(col); - if(!filled) { + if(filled == false) { GX_Position3f32(v[faces[i][0]][0], v[faces[i][0]][1], v[faces[i][0]][2]); GX_Normal3f32(n[i][0], n[i][1], n[i][2]); GX_Color1u32(col); @@ -534,7 +534,7 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) { int i; f32 dx, dy; - if(filled) { + if(filled == true) { GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d+1)); } else { @@ -552,7 +552,7 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) { } GX_End(); - if(filled) { + if(filled == true) { GX_Begin(GX_TRIANGLEFAN, GX_VTXFMT0, d+2); } else { @@ -568,7 +568,7 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) { } GX_End(); - if(filled) { + if(filled == true) { GX_Begin(GX_TRIANGLEFAN, GX_VTXFMT0, d+2); } else { @@ -597,7 +597,7 @@ void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) { int i; f32 dx, dy; - if(filled) { + if(filled == true) { GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d+1)); } else { @@ -615,7 +615,7 @@ void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) { } GX_End(); - if(filled) { + if(filled == true) { GX_Begin(GX_TRIANGLEFAN, GX_VTXFMT0, d+2); } else { @@ -650,7 +650,7 @@ void GRRLIB_DrawTessPanel(f32 w, f32 wstep, f32 h, f32 hstep, bool filled, u32 c tmp = ((w/wstep)*2)+2; for ( y = -tmpy ; y <= tmpy ; y+=hstep ) { - if(filled) { + if(filled == true) { GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, tmp); } else { diff --git a/GRRLIB/GRRLIB/GRRLIB_core.c b/GRRLIB/GRRLIB/GRRLIB_core.c index f5cfd9b..5241144 100644 --- a/GRRLIB/GRRLIB/GRRLIB_core.c +++ b/GRRLIB/GRRLIB/GRRLIB_core.c @@ -1,5 +1,5 @@ /*------------------------------------------------------------------------------ -Copyright (c) 2009-2017 The GRRLIB Team +Copyright (c) 2009-2019 The GRRLIB Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -109,8 +109,12 @@ int GRRLIB_Init (void) { // Clear the background to opaque black and clears the z-buffer GX_SetCopyClear((GXColor){ 0, 0, 0, 0 }, GX_MAX_Z24); - if (rmode->aa) GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR); // Set 16 bit RGB565 - else GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR); // Set 24 bit Z24 + if (rmode->aa) { + GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR); // Set 16 bit RGB565 + } + else { + GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR); // Set 24 bit Z24 + } // Other GX setup yscale = GX_GetYScaleFactor(rmode->efbHeight, rmode->xfbHeight); @@ -187,7 +191,7 @@ int GRRLIB_Init (void) { */ void GRRLIB_Exit (void) { static bool done = false; - if (done || !is_setup) { + if (done == true || is_setup == false) { return; } else { diff --git a/GRRLIB/GRRLIB/GRRLIB_fbAdvanced.c b/GRRLIB/GRRLIB/GRRLIB_fbAdvanced.c index 084b9ee..e5f1e11 100644 --- a/GRRLIB/GRRLIB/GRRLIB_fbAdvanced.c +++ b/GRRLIB/GRRLIB/GRRLIB_fbAdvanced.c @@ -1,5 +1,5 @@ /*------------------------------------------------------------------------------ -Copyright (c) 2009-2017 The GRRLIB Team +Copyright (c) 2009-2019 The GRRLIB Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -50,6 +50,10 @@ void GRRLIB_Circle (const f32 x, const f32 y, const f32 radius, ncolor[a] = color; } - if (!filled) GRRLIB_GXEngine(v, ncolor, 36, GX_LINESTRIP ); - else GRRLIB_GXEngine(v, ncolor, 36, GX_TRIANGLEFAN); + if (filled == false) { + GRRLIB_GXEngine(v, ncolor, 36, GX_LINESTRIP ); + } + else { + GRRLIB_GXEngine(v, ncolor, 36, GX_TRIANGLEFAN); + } } diff --git a/GRRLIB/GRRLIB/GRRLIB_fileIO.c b/GRRLIB/GRRLIB/GRRLIB_fileIO.c index f296967..94e5c53 100644 --- a/GRRLIB/GRRLIB/GRRLIB_fileIO.c +++ b/GRRLIB/GRRLIB/GRRLIB_fileIO.c @@ -36,7 +36,7 @@ THE SOFTWARE. * - -3 : FileReadError. * - >0 : FileLength. */ -int GRRLIB_LoadFile(const char* filename, unsigned char* *data) { +int GRRLIB_LoadFile(const char* filename, u8* *data) { int len; FILE *fd; @@ -79,7 +79,7 @@ int GRRLIB_LoadFile(const char* filename, unsigned char* *data) { */ GRRLIB_texImg* GRRLIB_LoadTextureFromFile(const char *filename) { GRRLIB_texImg *tex; - unsigned char *data; + u8 *data; // return NULL it load fails if (GRRLIB_LoadFile(filename, &data) <= 0) { diff --git a/GRRLIB/GRRLIB/GRRLIB_gecko.c b/GRRLIB/GRRLIB/GRRLIB_gecko.c index ee245f3..ed4587c 100644 --- a/GRRLIB/GRRLIB/GRRLIB_gecko.c +++ b/GRRLIB/GRRLIB/GRRLIB_gecko.c @@ -1,5 +1,5 @@ /*------------------------------------------------------------------------------ -Copyright (c) 2009-2017 The GRRLIB Team +Copyright (c) 2009-2019 The GRRLIB Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -31,13 +31,15 @@ static bool geckoinit = false; * @return bool true=everything worked, false=problems occurred. */ bool GRRLIB_GeckoInit() { - u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1); + s32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1); if (geckoattached) { usb_flush(EXI_CHANNEL_1); geckoinit = true; return true; } - else return false; + else { + return false; + } } /** @@ -49,7 +51,9 @@ void GRRLIB_GeckoPrintf (const char *text, ...) { int size; char tmp[1024]; - if (!geckoinit) return; + if (geckoinit == false) { + return; + } va_list argp; va_start(argp, text); diff --git a/GRRLIB/GRRLIB/GRRLIB_snapshot.c b/GRRLIB/GRRLIB/GRRLIB_snapshot.c index 5ac5715..03793eb 100644 --- a/GRRLIB/GRRLIB/GRRLIB_snapshot.c +++ b/GRRLIB/GRRLIB/GRRLIB_snapshot.c @@ -36,7 +36,7 @@ void GRRLIB_Screen2Texture (int posx, int posy, GRRLIB_texImg *tex, bool clear) GX_CopyTex(tex->data, GX_FALSE); GX_PixModeSync(); GRRLIB_FlushTex(tex); - if(clear) { + if(clear == true) { GX_CopyDisp(xfb[!fb], GX_TRUE); } } diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h b/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h index fb1f4fe..6dc5217 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h @@ -88,8 +88,7 @@ void GRRLIB_Circle (const f32 x, const f32 y, const f32 radius, //------------------------------------------------------------------------------ // GRRLIB_fileIO - File I/O (SD Card) -int GRRLIB_LoadFile (const char* filename, - unsigned char* *data); +int GRRLIB_LoadFile (const char* filename, u8* *data); GRRLIB_texImg* GRRLIB_LoadTextureFromFile (const char* filename); bool GRRLIB_ScrShot (const char* filename);