mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-25 00:02:20 +00:00
Format code
This commit is contained in:
parent
483a2f53e4
commit
2c71ad2cd9
3 changed files with 35 additions and 14 deletions
2
.github/workflows/doc.yml
vendored
2
.github/workflows/doc.yml
vendored
|
@ -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 }}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Change Log
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
|
|
|
@ -80,33 +80,41 @@ int GRRLIB_Init (void) {
|
|||
// 16:9 and 4:3 Screen Adjustment for Wii
|
||||
if (CONF_GetAspectRatio() == CONF_ASPECT_16_9) {
|
||||
rmode->viWidth = 678;
|
||||
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 678)/2; // This probably needs to consider PAL
|
||||
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 678) / 2; // This probably needs to consider PAL
|
||||
} else { // 4:3
|
||||
rmode->viWidth = 672;
|
||||
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 672)/2;
|
||||
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 672) / 2;
|
||||
}
|
||||
#else
|
||||
// GameCube
|
||||
rmode->viWidth = 672;
|
||||
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 672)/2;
|
||||
rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - 672) / 2;
|
||||
#endif
|
||||
|
||||
// --
|
||||
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();
|
||||
|
|
Loading…
Reference in a new issue