Skip to content

Commit 3f21355

Browse files
Fix: Resolve linker error and compiler warning
This commit addresses a linker error and a compiler warning that appeared in previous builds: 1. **Linker Error for `gs_font_print`**: - I resolved an "undefined reference to `gs_font_print`" linker error. - The call to `gs_font_print` recently added to the `error_message` function in `main.c` (for displaying numerical error codes) was removed. - This was necessary because the `gs_font_print` function is not defined in `gs.c` or linked from an external library in this project. - While this removes the on-screen display of numerical error codes, it allows the program to compile and link successfully. 2. **Compiler Warning for `mcport`**: - I addressed a warning in `main.c` stating that "`mcport` might be used uninitialized". - `mcport` is now initialized to `0` at its declaration in the `main` function. This ensures it always has a defined value before use, silencing the warning. These changes should allow the project to compile and link cleanly, enabling further testing of the runtime installation behavior.
1 parent 87200f1 commit 3f21355

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

main.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,16 +1087,14 @@ void error_message(int iz)
10871087
// This means iz=5,7,8 currently won't show a specific message here beyond the generic 'error' BMP.
10881088
default:
10891089
// No specific message for this error code, generic error BMP is already shown.
1090-
// We will print the numerical code below.
1090+
// Numerical error code printing removed to avoid gs_font_print undefined reference.
10911091
break;
10921092
}
10931093

1094-
// Display the numerical error code
1095-
char err_code_str[32];
1096-
sprintf(err_code_str, "Error Code: %d", iz);
1097-
// Y chosen to be below the typical MensajeX bitmaps.
1098-
// X chosen to be roughly centered for "Error Code: XX" (approx 14 chars, 8px/char ~112px; (640-112)/2 = 264)
1099-
gs_font_print(264, 390, 1, 0x00E0E0E0, err_code_str);
1094+
// Numerical error code display removed due to linker errors with gs_font_print.
1095+
// char err_code_str[32];
1096+
// sprintf(err_code_str, "Error Code: %d", iz);
1097+
// gs_font_print(264, 390, 1, 0x00E0E0E0, err_code_str);
11001098
}
11011099

11021100
// Waits for a specific controller key press (or any key if 'key' is -1).
@@ -1129,7 +1127,7 @@ int main(int argc, char *argv[])
11291127
int fdn, icontype;
11301128
unsigned long int ROM_VERSION = 0x170;
11311129
VMode = NTSC; // Default video mode
1132-
int mcport, state; // mcport: selected memory card slot; state: current state of the application
1130+
int mcport = 0, state; // mcport: selected memory card slot; state: current state of the application
11331131
int key; // Stores controller input
11341132

11351133
// Initialize PS2 hardware and basic services (IOP, SIF, FileIO, MC, PAD)

0 commit comments

Comments
 (0)