n64decomp / mk64

A speedy Mario Kart 64 decompilation, brought to you by the cousin of a tame racing driver.
633 stars 72 forks source link

EU builds fail compilation in audio/external.c #541

Open tsunamistate opened 9 months ago

tsunamistate commented 9 months ago

Environment:

eu-1.0 and eu-final builds fail compilation when trying to compile src/audio/external.c Error logs:

Compiling: src/audio/external.c -> build/eu-final/src/audio/external.o
src/audio/external.c: In function 'func_800C3478':
src/audio/external.c:1128:5: warning: statement with no effect [-Wunused-value]
 1128 |     for(D_800EA1E8; D_800EA1E4 != D_800EA1E8;) {
      |     ^~~
src/audio/external.c:1129:9: warning: implicit declaration of function 'func_800C2A2C'; did you mean 'func_8009CA2C'? [-Wimplicit-function-declaration]
 1129 |         func_800C2A2C(D_80192CD0[D_800EA1E8++]);
      |         ^~~~~~~~~~~~~
      |         func_8009CA2C
src/audio/external.c: In function 'func_800C357C':
src/audio/external.c:1147:18: warning: comparison of integer expressions of different signedness: 's32' {aka 'int'} and 'u32' {aka 'unsigned int'} [-Wsign-compare]
 1147 |         if (arg0 == D_80192CD0[i]) {
      |                  ^~
src/audio/external.c: In function 'func_800C357C_eu':
src/audio/external.c:1163:18: warning: comparison of integer expressions of different signedness: 's32' {aka 'int'} and 'u32' {aka 'unsigned int'} [-Wsign-compare]
 1163 |         if (arg0 == (D_80192CD0[i] & arg1)) {
      |                  ^~
src/audio/external.c: In function 'delete_sound_from_bank':
src/audio/external.c:1743:9: warning: unused variable 'stackPadding' [-Wunused-variable]
 1743 |     s32 stackPadding;
      |         ^~~~~~~~~~~~
src/audio/external.c: In function 'func_800C4FE4':
src/audio/external.c:2035:9: warning: unused variable 'cmd' [-Wunused-variable]
 2035 |     u32 cmd;
      |         ^~~
src/audio/external.c: In function 'func_800C550C':
src/audio/external.c:2136:26: warning: passing argument 2 of 'func_800C5384' makes pointer from integer without a cast [-Wint-conversion]
 2136 |         func_800C5384(i, arg0);
      |                          ^~~~
      |                          |
      |                          s32 {aka int}
src/audio/external.c:2098:34: note: expected 'f32 *' {aka 'float *'} but argument is of type 's32' {aka 'in'}
 2098 | void func_800C5384(u8 arg0, f32 *arg1) {
      |                             ~~~~~^~~~
src/audio/external.c: In function 'func_800C6108':
src/audio/external.c:2417:13: warning: the address of 'D_800E9EC4' will always evaluate as 'true' [-Waddres]
 2417 |         if (D_800E9EC4) {} // ?
      |             ^~~~~~~~~~
src/audio/external.c:2453:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
 2453 |     if ((D_800E9EE4[playerId] > 0.5f) || (D_800E9EE4[playerId] < -0.5f))
      |     ^~
src/audio/external.c:2458:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
 2458 |         D_800E9F7C[playerId].unk_0C = D_800E9EC4[playerId] + D_800E9ED4[playerId] + D_800E9F34[playerId];
      |         ^~~~~~~~~~
src/audio/external.c: At top level:
src/audio/external.c:2459:7: error: expected identifier or '(' before 'else'
 2459 |     } else {
      |       ^~~~
src/audio/external.c:2463:5: error: expected identifier or '(' before 'if'
 2463 |     if (D_800E9F7C[playerId].unk_0C < 0.0f) {
      |     ^~
src/audio/external.c:2467:5: error: expected identifier or '(' before 'if'
 2467 |     if (D_800E9F7C[playerId].unk_0C > 4.0f) {
      |     ^~
src/audio/external.c:2470:16: error: 'playerId' undeclared here (not in a function); did you mean 'Player'?
 2470 |     D_800E9EC4[playerId] = D_800E9F7C[playerId].unk_0C;
      |                ^~~~~~~~
      |                Player
src/audio/external.c:2470:5: warning: data definition has no type or storage class
 2470 |     D_800E9EC4[playerId] = D_800E9F7C[playerId].unk_0C;
      |     ^~~~~~~~~~
src/audio/external.c:2470:5: warning: type defaults to 'int' in declaration of 'D_800E9EC4' [-Wimplicit-int]
src/audio/external.c:2471:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
 2471 |     D_800E9F7C[playerId].unk_38 = (D_800E9F7C[playerId].unk_0C / 1.5f) + 0.4f;
      |                         ^
src/audio/external.c:2472:1: error: expected identifier or '(' before '}' token
 2472 | }
      | ^
src/audio/external.c: In function 'func_800C76C0':
src/audio/external.c:3005:29: error: break statement not within loop or switch
 3005 |                             break;
      |                             ^~~~~
src/audio/external.c:3007:21: error: break statement not within loop or switch
 3007 |                     break;
      |                     ^~~~~
src/audio/external.c:3008:17: error: case label not within a switch statement
 3008 |                 case BATTLE:
      |                 ^~~~
src/audio/external.c:3038:21: error: break statement not within loop or switch
 3038 |                     break;
      |                     ^~~~~
src/audio/external.c:3039:17: error: 'default' label not within a switch statement
 3039 |                 default:
      |                 ^~~~~~~
src/audio/external.c:3040:21: error: break statement not within loop or switch
 3040 |                     break;
      |                     ^~~~~
src/audio/external.c: At top level:
src/audio/external.c:3043:9: error: expected identifier or '(' before 'if'
 3043 |         if (D_800E9EA4[playerId] == 0x0000001E) {
      |         ^~
src/audio/external.c:3076:9: error: expected identifier or '(' before 'switch'
 3076 |         switch (gModeSelection) {                        /* switch 4; irregular */
      |         ^~~~~~
src/audio/external.c:3138:5: error: expected identifier or '(' before '}' token
 3138 |     }
      |     ^
src/audio/external.c:3139:1: error: expected identifier or '(' before '}' token
 3139 | }
      | ^
src/audio/external.c: In function 'func_800C9060':
src/audio/external.c:3378:88: warning: pointer targets in passing argument 6 of 'play_sound' differ in signedness [-Wpointer-sign]
 3378 |                 play_sound(arg1, D_800E9F7C[arg0].pos, arg0, &D_800EA1D4, &D_800EA1D4, &D_800E9F7C[arg0].unk_14);
      |                                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                        |
      |                                                                                        s8 * {aka signed char *}
src/audio/external.c:1522:82: note: expected 'u8 *' {aka 'unsigned char *'} but argument is of type 's8 *' {aka 'signed char *'}
 1522 | void play_sound(u32 soundBits, f32 *position, u8 arg2, f32 *arg3, f32 *arg4, u8 *arg5) {
      |                                                                              ~~~~^~~~
src/audio/external.c: In function 'func_800C9D0C':
src/audio/external.c:3609:19: warning: passing argument 1 of 'func_800C550C' makes integer from pointer without a cast [-Wint-conversion]
 3609 |     func_800C550C(func_800C21E8(gPlayers[playerId].pos, gPlayers[playerId].characterId + 0x31028000);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                   |
      |                   f32 * {aka float *}
src/audio/external.c:2130:24: note: expected 's32' {aka 'int'} but argument is of type 'f32 *' {aka 'float '}
 2130 | void func_800C550C(s32 arg0) {
      |                    ~~~~^~~~
src/audio/external.c: In function 'func_800CA984':
src/audio/external.c:3857:45: warning: passing argument 2 of 'func_800C1C88' from incompatible pointer type [-Wincompatible-pointer-types]
 3857 |             temp_v0_2 = func_800C1C88(arg0, &gPlayers[arg0].pos, D_800EA1C8, &gPlayers[arg0].unk_098, (u8) i, 0x31029008U);
      |                                             ^~~~~~~~~~~~~~~~~~~
      |                                             |
      |                                             f32 (*)[3] {aka float (*)[3]}
In file included from src/audio/external.c:6:
src/audio/external.h:200:40: note: expected 'f32 *' {aka 'float *'} but argument is of type 'f32 (*)[3]' {aka 'float (*)[3]'}
  200 | struct Unk_8018EFD8 *func_800C1C88(u8, Vec3f, Vec3f, f32*, u8, u32);
      |                                        ^~~~~
src/audio/external.c: In function 'func_800CAB4C':
src/audio/external.c:3873:8: warning: unused variable 'temp_v0' [-Wunused-variable]
 3873 |     u8 temp_v0;
      |        ^~~~~~~
src/audio/external.c:3872:9: warning: unused variable 'temp_v1' [-Wunused-variable]
 3872 |     u8 *temp_v1;
      |         ^~~~~~~
make: *** [Makefile:571: build/eu-final/src/audio/external.o] Error 1

us version compiles without errors The error is the same for both eu-1.0 and eu-final

alyxdeburca commented 9 months ago

After giving the code a (cursory) read, I'm struggling too see what the issue is to be honest. @MegaMech do you see anything in the code that could be an issue? I'll take another look once I'm finished work if you don't. Could be some strange compiler bug

MegaMech commented 9 months ago

I think we have a syntax error in the code wherein building US does not fail because the bad syntax is behind an ifdef.