Format code

This commit is contained in:
Crayon2000 2020-03-08 23:54:09 -04:00
parent 483a2f53e4
commit 2c71ad2cd9
3 changed files with 35 additions and 14 deletions

View file

@ -29,7 +29,7 @@ jobs:
mv latex/refman.pdf doc/PDF-documentation.pdf
- name: Deploy to GitHub Pages
uses: maxheld83/ghpages@v0.2.1
uses: maxheld83/ghpages@v0.3.0
env:
BUILD_DIR: ./doc
GH_PAT: ${{ secrets.GH_PAT }}

View file

@ -1,4 +1,4 @@
# Change Log
# Changelog
All notable changes to this project will be documented in this file.

View file

@ -95,18 +95,26 @@ int GRRLIB_Init (void) {
VIDEO_Configure(rmode);
// Get some memory to use for a "double buffered" frame buffer
if ( !(xfb[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode))) ) return -1;
if ( !(xfb[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode))) ) return -1;
if ( !(xfb[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode))) ) {
return -1;
}
if ( !(xfb[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode))) ) {
return -1;
}
VIDEO_SetNextFramebuffer(xfb[fb]); // Choose a frame buffer to start with
VIDEO_Flush(); // flush the frame to the TV
VIDEO_WaitVSync(); // Wait for the TV to finish updating
// If the TV image is interlaced it takes two passes to display the image
if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
if (rmode->viTVMode & VI_NON_INTERLACE) {
VIDEO_WaitVSync();
}
// The FIFO is the buffer the CPU uses to send commands to the GPU
if ( !(gp_fifo = memalign(32, DEFAULT_FIFO_SIZE)) ) return -1;
if ( !(gp_fifo = memalign(32, DEFAULT_FIFO_SIZE)) ) {
return -1;
}
memset(gp_fifo, 0, DEFAULT_FIFO_SIZE);
GX_Init(gp_fifo, DEFAULT_FIFO_SIZE);
@ -179,10 +187,14 @@ int GRRLIB_Init (void) {
atexit(GRRLIB_Exit);
// Initialise the filing system
if (!fatInitDefault()) error_code = -2;
if (fatInitDefault() == false) {
error_code = -2;
}
// Initialise TTF
if (GRRLIB_InitTTF()) error_code = -3;
if (GRRLIB_InitTTF() != 0) {
error_code = -3;
}
VIDEO_SetBlack(false); // Enable video output
return error_code;
@ -216,9 +228,18 @@ void GRRLIB_Exit (void) {
GX_AbortFrame();
// Free up memory allocated for frame buffers & FIFOs
if (xfb[0] != NULL) { free(MEM_K1_TO_K0(xfb[0])); xfb[0] = NULL; }
if (xfb[1] != NULL) { free(MEM_K1_TO_K0(xfb[1])); xfb[1] = NULL; }
if (gp_fifo != NULL) { free(gp_fifo); gp_fifo = NULL; }
if (xfb[0] != NULL) {
free(MEM_K1_TO_K0(xfb[0]));
xfb[0] = NULL;
}
if (xfb[1] != NULL) {
free(MEM_K1_TO_K0(xfb[1]));
xfb[1] = NULL;
}
if (gp_fifo != NULL) {
free(gp_fifo);
gp_fifo = NULL;
}
// Done with TTF
GRRLIB_ExitTTF();