PR Matches (#706)

* Commit unpr'd matches

* fix compile
This commit is contained in:
MegaMech
2025-05-08 15:00:53 -06:00
committed by GitHub
parent 8dfb7e7fd5
commit daab4f501f
25 changed files with 332 additions and 2356 deletions
+19 -23
View File
@@ -755,27 +755,31 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
seqPlayer->scriptState.pc = sequenceData;
}
#ifdef NON_MATCHING
// https://decomp.me/scratch/5FBUM
// There is some wild bullshit going on in this function
// It is an unholy cross between SM64's EU and Shindou
// verions of this function, with the for loop towards
// the bottom resembling stuff from bank_load_async
#ifdef VERSION_EU
GLOBAL_ASM("asm/eu_nonmatchings/audio_init.s")
#else
extern u8 _audio_banksSegmentRomStart;
extern u8 _audio_tablesSegmentRomStart;
extern u8 _instrument_setsSegmentRomStart;
extern u8 _sequencesSegmentRomStart;
/**
* There is some wild bullshit going on in this function
* It is an unholy cross between SM64's EU and Shindou
* verions of this function, with the for loop towards
* the bottom resembling stuff from bank_load_async
*/
void audio_init(void) {
s32 i;
UNUSED s32 pad[2];
s32 j;
UNUSED s32 pad2[6];
u32 sp60[2];
UNUSED s32 pad1[2];
UNUSED s32 pad[6];
s32 j, k;
s32 aaa;
u32 sp60[2];
UNUSED s32 lim2, lim3;
s32 size;
UNUSED u64* ptr64;
u64* ptr64;
UNUSED void *data;
UNUSED s32 one = 1;
u8* test;
@@ -788,10 +792,7 @@ void audio_init(void) {
#ifdef TARGET_N64
// It seems boot.s doesn't clear the .bss area for audio, so do it here.
ptr64 = (u64*) ((u8*) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer));
for (i = ((uintptr_t) &gAudioGlobalsEndMarker -
(uintptr_t) ((u64*) ((u8*) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer)))) /
8;
i >= 0; i--) {
for (k = ((uintptr_t) &gAudioGlobalsEndMarker - (uintptr_t) ((u64 *)((u8 *) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer))) ) / 8; k >= 0; k--) {
*ptr64++ = 0;
}
#endif
@@ -812,6 +813,7 @@ void audio_init(void) {
break;
}
port_eu_init();
if (k) {} // fake
for (i = 0; i < NUMAIBUFFERS; i++) {
gAiBufferLengths[i] = 0xa0;
}
@@ -878,10 +880,4 @@ void audio_init(void) {
init_sequence_players();
gAudioLoadLock = 0x76557364;
}
#else
#ifdef VERSION_EU
GLOBAL_ASM("asm/eu_nonmatchings/audio_init.s")
#else
GLOBAL_ASM("asm/non_matchings/audio/load/audio_init.s")
#endif
#endif
+4 -4
View File
@@ -364,13 +364,13 @@ s16 gGPCurrentRaceCharacterIdByRank[8];
s16 D_8018CF90;
s16 D_8018CF98[8];
s16 D_8018CFA8;
s8 D_8018CFAC[4];
u8 D_8018CFAC[4];
s16 D_8018CFB0;
s8 D_8018CFB4[4];
u8 D_8018CFB4[4];
s16 D_8018CFB8;
s8 D_8018CFBC[4];
u8 D_8018CFBC[4];
s16 D_8018CFC0;
s8 D_8018CFC4[4];
u8 D_8018CFC4[4];
s16 D_8018CFC8;
f32 D_8018CFCC;
s16 D_8018CFD0;
+4 -4
View File
@@ -454,10 +454,10 @@ extern s16 D_8018CFC0;
extern s16 D_8018CFC8;
extern s16 D_8018CFD0;
extern s16 D_8018CFD8;
extern s8 D_8018CFAC[];
extern s8 D_8018CFB4[];
extern s8 D_8018CFBC[];
extern s8 D_8018CFC4[];
extern u8 D_8018CFAC[];
extern u8 D_8018CFB4[];
extern u8 D_8018CFBC[];
extern u8 D_8018CFC4[];
extern s16 D_8018CFE0;
extern f32 D_8018CFE4;
extern s16 D_8018CFE8;
+79 -124
View File
@@ -172,7 +172,7 @@ void func_8006EF60(void) {
// clang-format on
}
void course_mini_map_settings(void) {
void track_minimap_settings(void) {
D_801655C8 = 0;
xOrientation = 1.0f;
if (gIsMirrorMode != 0) {
@@ -418,16 +418,12 @@ void func_8006F8CC(void) {
}
}
#ifdef NON_MATCHING
// Major register allocation problems in the first for-loop
// Smaller issues elsewhere, probably some one line, multiple variable assignment shenanigans going on
// https://decomp.me/scratch/ohbAc
void func_8006FA94(void) {
s32 var_a0;
Player* player;
s32 i;
Player *player;
func_8006F8CC();
course_mini_map_settings();
track_minimap_settings();
osSetTime(0);
D_8018D170 = 0;
D_8018D190 = 0;
@@ -437,117 +433,93 @@ void func_8006FA94(void) {
D_801657E2 = 0;
D_80165730 = 0;
D_801658FE = 0;
/*
D_801657E5 = 0;
D_801657E3 = D_801657E5;
D_801657E1 = D_801657E3;
*/
D_801657E1 = D_801657E3 = D_801657E5 = 0;
/*
D_80165658->unk8 = 0;
D_80165658->unk4 = 0;
D_80165658->unk0 = 0;
*/
D_80165658[0] = D_80165658[1] = D_80165658[2] = 0;
/*
D_801658D6 = 0;
D_801658E4 = D_801658D6;
D_801658F4 = D_801658E4;
D_801658EC = D_801658F4;
D_801658DC = D_801658EC;
D_801658CE = D_801658DC;
D_801658C6 = D_801658CE;
D_801658BC = D_801658C6;
*/
D_801658BC = D_801658C6 = D_801658CE = D_801658DC = D_801658EC = D_801658F4 = D_801658E4 = D_801658D6 = 0;
switch (gPlayerCount) { /* irregular */
case 1:
switch (gPlayerCount) {
case 1:
if (gModeSelection == 0) {
D_8018D114 = 0;
D_8018D178 = 150;
D_8018D180 = 240;
} else {
D_8018D114 = 1;
D_8018D178 = 10;
D_8018D180 = 0;
}
break;
case 2:
if (gScreenModeSelection == 1) {
if (gModeSelection == 0) {
D_8018D114 = 0;
D_8018D114 = 2;
D_8018D178 = 150;
D_8018D180 = 240;
} else {
D_8018D114 = 1;
D_8018D178 = 10;
D_8018D180 = 0;
}
break;
case 2:
if (gScreenModeSelection == 1) {
if (gModeSelection == 0) {
D_8018D114 = 2;
D_8018D178 = 150;
D_8018D180 = 240;
D_8018D2AC = 60;
} else if (gModeSelection == 2) {
D_8018D114 = 3;
D_8018D178 = 30;
D_8018D180 = 30;
D_8018D2AC = 60;
} else {
D_8018D114 = 4;
D_8018D178 = 40;
D_8018D180 = 40;
D_8018D2AC = 60;
}
} else if (gModeSelection == 0) {
D_8018D114 = 5;
D_8018D2AC = 60;
} else if (gModeSelection == 2) {
D_8018D114 = 6;
} else {
D_8018D114 = 7;
}
break;
case 3:
if (gModeSelection == 2) {
D_8018D114 = 8;
D_8018D178 = 100;
D_8018D180 = 150;
D_8018D2AC = 60;
} else {
D_8018D114 = 9;
D_8018D178 = 100;
D_8018D180 = 150;
D_8018D2AC = 60;
}
break;
case 4:
if (gModeSelection == 2) {
D_8018D114 = 10;
D_8018D114 = 3;
D_8018D178 = 30;
D_8018D180 = 30;
D_8018D2AC = 10;
D_8018D2AC = 60;
} else {
D_8018D114 = 11;
D_8018D178 = 30;
D_8018D180 = 30;
D_8018D2AC = 10;
D_8018D114 = 4;
D_8018D178 = 40;
D_8018D180 = 40;
D_8018D2AC = 60;
}
break;
} else if (gModeSelection == 0) {
D_8018D114 = 5;
} else if (gModeSelection == 2) {
D_8018D114 = 6;
} else {
D_8018D114 = 7;
}
break;
case 3:
if (gModeSelection == 2) {
D_8018D114 = 8;
D_8018D178 = 0x00000064;
D_8018D180 = 0x00000096;
D_8018D2AC = 0x0000003C;
} else {
D_8018D114 = 9;
D_8018D178 = 0x00000064;
D_8018D180 = 0x00000096;
D_8018D2AC = 0x0000003C;
}
break;
case 4:
if (gModeSelection == 2) {
D_8018D114 = 0x0000000A;
D_8018D178 = 0x0000001E;
D_8018D180 = 0x0000001E;
D_8018D2AC = 0x0000000A;
} else {
D_8018D114 = 0x0000000B;
D_8018D178 = 0x0000001E;
D_8018D180 = 0x0000001E;
D_8018D2AC = 0x0000000A;
}
break;
}
if (gEnableDebugMode == 0) {
D_8016576A = 0;
D_8016579C = 0;
}
for (var_a0 = 0; var_a0 < gPlayerCount; var_a0++) {
D_8018CFBC[var_a0] = 0;
D_8018CFAC[var_a0] = 0;
D_8018CFC4[var_a0] = 0;
D_8018CFB4[var_a0] = 0;
for (i = 0; i < gPlayerCount; i++) {
D_8018CFC4[i] = D_8018CFAC[i] = D_8018CFBC[i] = 0;
D_8018CFB4[i] = 0;
}
D_8018D204 = 1;
D_8018D1FC = 0;
D_8018D224 = 0;
D_8018D1F0 = D_8018D1F8 = 0;
D_8018D228 = 0xFF;
/*
D_80165628 = 0;
D_80165618 = 0;
D_80165608 = D_80165618;
D_801655F8 = D_80165618;
D_801655E8 = D_80165618;
D_801655D8 = D_80165618;
*/
D_801655D8 = D_801655E8 = D_801655F8 = D_80165608 = D_80165618 = D_80165628 = 0;
D_8018D160 = 0;
D_8018D1DC = 0;
@@ -556,46 +528,29 @@ void func_8006FA94(void) {
D_8018D1A0 = 0;
D_8018D168 = 0;
D_801656F0 = 0;
D_801657B2 = 0;
D_801657D8 = D_801657B2;
D_8018D214 = D_801657D8;
gHUDDisable = D_8018D214;
D_801657AE = gHUDDisable;
D_801657AE = gHUDDisable = D_8018D214 = D_801657D8 = D_801657B2 = 0;
D_8018D20C = 0;
D_8018D2F8 = 0;
D_8018D2F0 = D_8018D2F8;
D_8018D2F0 = D_8018D2F8 = 0;
D_8018D320 = 3;
D_8018D2AC = 0;
D_8018D2BC = 0;
D_8018D2B4 = D_8018D2BC;
D_8018D2A4 = D_8018D2B4;
D_8018D2C8[0] = 0;
D_8018D2C8[1] = 0;
D_8018D2C8[2] = 0;
D_8018D2C8[3] = 0;
D_8018D2A4 = D_8018D2B4 = D_8018D2BC = 0;
D_8018D2C8[0] = D_8018D2C8[1] = D_8018D2C8[2] = D_8018D2C8[3] = 0;
D_8016581C = 0;
D_8016580C = 0;
D_80165814 = 0;
D_80165804 = 0;
D_801657FC = 0;
D_8018D18C = -1;
D_8018D184 = D_8018D18C;
D_8018D16C = D_8018D18C;
D_8018D17C = D_8018D18C;
D_8018D174 = D_8018D18C;
D_8018D174 = D_8018D17C = D_8018D16C = D_8018D184 = D_8018D18C = -1;
player = gPlayerOne;
for (var_a0 = 0; var_a0 < NUM_PLAYERS; var_a0++) {
D_8018D0F0[var_a0] = D_8018D050[var_a0] = -32.0f;
D_8018CE10[var_a0].unk_04[0] = D_8018CE10[var_a0].unk_04[1] = D_8018CE10[var_a0].unk_04[2] = 0.0f;
D_8018CF50[var_a0] = var_a0;
D_8018CF28[var_a0] = player;
for (i = 0; i < NUM_PLAYERS; i++) {
D_8018D0F0[i] = D_8018D050[i] = -32.0f;
D_8018CE10[i].unk_04[0] = D_8018CE10[i].unk_04[1] = D_8018CE10[i].unk_04[2] = 0.0f;
D_8018CF50[i] = i;
D_8018CF28[i] = player;
player->unk_040 = -1;
player++;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_8006FA94.s")
#endif
void func_80070148(void) {
s32 var_s0;
+1 -1
View File
@@ -13,7 +13,7 @@ void load_mario_kart_64_logo(void);
void init_item_window(s32);
void func_8006EEE8(s32);
void func_8006EF60(void);
void course_mini_map_settings(void);
void track_minimap_settings(void);
void func_8006F824(s32);
void func_8006F8CC(void);
void func_8006FA94(void);
+50 -53
View File
@@ -81,48 +81,47 @@ void func_800AF9E4(Vtx* arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4, s16 arg5,
gSP1Triangle(gDisplayListHead++, 3, 2, 1, 0);
}
void func_800AFC54(Vtx* arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4[3]);
#ifdef NON_MATCHING
// guess on Vtx type?
void func_800AFC54(Vtx* arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4[3]) {
Vtx *a1, *a2, *a3;
s32 saved1, saved2, saved3;
f32 res;
s32 a, b, c, d, e, f;
f32 f14, f16, f18;
void func_800AFC54(Vtx* vtx, s32 a, s32 b, s32 c, Vec3s out) {
s32 varA0;
s32 varA2;
s32 varA4;
s32 varB0;
s32 varB2;
s32 varB4;
s32 varC0;
s32 varC2;
s32 varC4;
f32 dx;
f32 dy;
f32 dz;
f32 length;
a1 = &arg0[arg1];
a2 = &arg0[arg2];
a3 = &arg0[arg3];
varA0 = (vtx + a)->v.ob[0];
varA2 = (vtx + a)->v.ob[1];
varA4 = (vtx + a)->v.ob[2];
saved1 = a2->v.ob[0];
saved2 = a2->v.ob[1];
saved3 = a2->v.ob[2];
varB0 = (vtx + b)->v.ob[0];
varB2 = (vtx + b)->v.ob[1];
varB4 = (vtx + b)->v.ob[2];
a = saved2 - a1->v.ob[1];
e = saved3 - a1->v.ob[2];
d = a3->v.ob[1] - saved2;
b = a3->v.ob[2] - saved3;
f = a3->v.ob[0] - saved1;
c = saved1 - a1->v.ob[0];
varC0 = (vtx + c)->v.ob[0];
varC2 = (vtx + c)->v.ob[1];
varC4 = (vtx + c)->v.ob[2];
f14 = ((a) * (b)) - ((e) * (d));
f16 = ((e) * (f)) - ((c) * (b));
f18 = ((c) * (d)) - ((a) * (f));
dx = ((varB2 - varA2) * (varC4 - varB4)) - ((varB4 - varA4) * (varC2 - varB2));
dy = ((varB4 - varA4) * (varC0 - varB0)) - ((varB0 - varA0) * (varC4 - varB4));
dz = ((varB0 - varA0) * (varC2 - varB2)) - ((varB2 - varA2) * (varC0 - varB0));
length = sqrtf((dx * dx) + (dy * dy) + (dz * dz));
res = sqrtf(SQ(f14) + SQ(f16) + SQ(f18));
if (res < 0.001) {
res = 0.001;
if (length < 0.001) {
length = 0.001;
}
arg4[0] = f14 * (f32) (1.0 / res) * 120.0f;
arg4[1] = f16 * (f32) (1.0 / res) * 120.0f;
arg4[2] = f18 * (f32) (1.0 / res) * 120.0f;
length = 1.0 / length;
out[0] = (dx * length) * 120.0f;
out[1] = (dy * length) * 120.0f;
out[2] = (dz * length) * 120.0f;
}
#else
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800AFC54.s")
#endif
void func_800AFE00(Vtx* arg0, Vec3s* arg1, s32 arg2, s32 arg3) {
s32 idx1;
@@ -163,32 +162,33 @@ void func_800AFF58(Vtx* arg0) {
}
}
#ifdef NON_MATCHING
// Credit to SpazzyLemon for the updated and better attempt
void func_800B0004(void) {
Vtx* vtxs;
s32 res1, res2;
UNUSED u32 pad[0x5];
s32 i, j;
Vtx *vtxs;
s32 res1;
s32 res2;
UNUSED u32 pad[0x4];
s32 i;
s32 j;
s32 k;
s16 idx;
idx = 4;
gSPLight(gDisplayListHead++, VIRTUAL_TO_PHYSICAL2(&D_800E8688), LIGHT_1);
gSPLight(gDisplayListHead++, VIRTUAL_TO_PHYSICAL2(&D_800E8680), LIGHT_2);
gSPNumLights(gDisplayListHead++, NUMLIGHTS_1);
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH);
gDPSetCombineLERP(gDisplayListHead++, PRIMITIVE, 0, SHADE, 0, 0, 0, 0, SHADE, PRIMITIVE, 0, SHADE, 0, 0, 0, 0,
SHADE);
gDPSetCombineLERP(gDisplayListHead++, PRIMITIVE, 0, SHADE, 0, 0, 0, 0, SHADE, PRIMITIVE, 0, SHADE, 0, 0, 0, 0, SHADE);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING);
vtxs = D_8018EDB4 % 2 ? D_8018EDB8 : D_8018EDBC;
vtxs = (D_8018EDB4 % 2) ? (D_8018EDB8) : (D_8018EDBC);
D_8018EDB2 = 0x9C0;
for (i = 0; i < 10; i++) {
for (j = 0; j < 12; j++) {
res1 = sins(D_8018EDB0 - (j * D_8018EDB2)) * 84.0f * j * 0.18f;
res2 = sins(D_8018EDB0 - ((j + 1) * D_8018EDB2)) * 84.0f * (j + 1) * 0.18f;
func_800AF9E4(&(&vtxs[j * 4])[i * 48], j, i, 84, res1, res2, (j * 84), 84);
for (k = 0, j = 0; j < 12; j++, k += 84) {
res1 = ((sins(D_8018EDB0 - (j * D_8018EDB2)) * 84.0f) * j) * 0.18f;
res2 = ((sins(D_8018EDB0 - ((j + 1) * D_8018EDB2)) * 84.0f) * (j + 1)) * 0.18f;
func_800AF9E4(&(&vtxs[j * idx])[i * 48], j, i, 84, res1, res2, k, 84);
}
}
func_800AFF58(vtxs);
D_8018EDB0 += D_8018EDB2;
++D_8018EDB4;
@@ -196,6 +196,3 @@ void func_800B0004(void) {
gSPNumLights(gDisplayListHead++, NUMLIGHTS_1);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
}
#else
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B0004.s")
#endif
+1
View File
@@ -6,5 +6,6 @@
/* Function Prototypes */
void func_800AF9B0(void);
void func_800B0004(void);
void func_800AFC54(Vtx* vtx, s32 a, s32 b, s32 c, Vec3s out);
#endif /* CODE_800AF9B0_H */
+116 -93
View File
@@ -1817,61 +1817,67 @@ void update_player(s32 playerId) {
GLOBAL_ASM("asm/non_matchings/cpu_vehicles_camera_path/update_player.s")
#endif
#ifdef NON_MATCHING
// Lots of work left to do, might be funtionally accurate?
void func_8000B140(s32 playerId) {
UNUSED f32 stackPadding0;
UNUSED f32 stackPadding1;
UNUSED f32 stackPadding2;
UNUSED f32 stackPadding3;
UNUSED f32 stackPadding4;
UNUSED f32 stackPadding5;
UNUSED f32 stackPadding6;
UNUSED f32 stackPadding7;
f32 temp_f0_2;
s32 i;
f32 temp_f12;
f32 temp_f14;
s32 j;
f32 temp_f16;
f32 temp_ft2;
s16 currPathPoint;
s16 temp_v1_2;
f32 temp_f22;
f32 temp_f2;
f32 temp_f0_2;
f32 var_f18;
f32 var_f20;
s32 pad[5];
s16 spB0[8];
UNUSED f32 stackPadding8;
f32 stackPadding8;
s16 sp9C[8];
UNUSED f32 stackPadding9;
f32 stackPadding9;
f32 temp_f2;
f32 sp74[8];
s32 temp_a1_2;
s16 temp_v1_2;
s16 currPathPoint;
s32 j;
s32 i;
Player* player;
player = &gPlayers[playerId];
if (player->effects & UNKNOWN_EFFECT_0x10)
if (player->effects & UNKNOWN_EFFECT_0x10) {
return;
}
if (D_801630E8[playerId] == 1)
if (D_801630E8[playerId] == 1) {
return;
if (D_801630E8[playerId] == -1)
}
if (D_801630E8[playerId] == -1) {
return;
if (gTrackPositionFactor[playerId] < -1.0f)
}
if (gTrackPositionFactor[playerId] < -1.0f) {
return;
if (gTrackPositionFactor[playerId] > 1.0f)
}
if (gTrackPositionFactor[playerId] > 1.0f) {
return;
}
// Exclude heavyweights
if (player->characterId == WARIO)
if (player->characterId == WARIO) {
return;
if (player->characterId == BOWSER)
}
if (player->characterId == BOWSER) {
return;
if (player->characterId == DK)
}
if (player->characterId == DK) {
return;
// Skip if player has starman
if (player->effects & STAR_EFFECT)
}
// Skip if player has star
if (player->effects & STAR_EFFECT) {
return;
}
currPathPoint = gNearestPathPointByPlayerId[playerId];
temp_f22 = (player->speed / 18.0f) * 216.0f;
@@ -1879,6 +1885,7 @@ void func_8000B140(s32 playerId) {
sp9C[i] = -1;
spB0[i] = 0x03E8;
}
if (D_80163010[playerId] > 0) {
D_80163010[playerId]--;
if (D_80163010[playerId] <= 0) {
@@ -1886,76 +1893,92 @@ void func_8000B140(s32 playerId) {
}
}
j = 0;
for (i = 0; (j < 2) && (i < 8); i++) {
if (i == playerId)
continue;
player = &gPlayers[i];
if (!(player->type & PLAYER_EXISTS))
continue;
temp_f2 = (temp_f22) -5.0f;
temp_v1_2 = gNearestPathPointByPlayerId[i];
temp_f0_2 = (player->speed / 18.0f) * 216.0f;
if (temp_f0_2 < temp_f2) {
if (is_path_point_in_range(temp_v1_2, currPathPoint, 0U, 0x0014U, gSelectedPathCount) > 0) {
temp_a1_2 = temp_v1_2 - currPathPoint;
sp9C[j] = i;
if (temp_a1_2 > 0) {
spB0[j] = temp_a1_2;
} else {
spB0[j] = (temp_v1_2 + gSelectedPathCount) - currPathPoint;
i = 0;
while (i < 8) {
if (i != playerId) {
player = &gPlayers[i];
if ((player->type & PLAYER_EXISTS)) {
temp_v1_2 = gNearestPathPointByPlayerId[i];
temp_f0_2 = (player->speed / 18.0f) * 216.0f;
temp_f2 = temp_f22 - 5.0f;
if (temp_f0_2 < temp_f2) {
if (is_path_point_in_range(temp_v1_2, currPathPoint, 0, 0x0014U, gSelectedPathCount) > 0) {
temp_a1_2 = temp_v1_2 - currPathPoint;
sp9C[j] = i;
if (temp_a1_2 > 0) {
spB0[j] = temp_a1_2;
} else {
spB0[j] = (temp_v1_2 + gSelectedPathCount) - currPathPoint;
}
sp74[j] = temp_f2 - temp_f0_2;
j++;
}
}
}
}
i++;
if (j >= 2) {
break;
}
}
if (j == 0) {
return;
}
var_f18 = 1.0f;
var_f20 = -1.0f;
for (i = 0; i < j; i++) {
temp_f2 = gTrackPositionFactor[sp9C[i]];
if ((temp_f2 > (-1.0f)) && (temp_f2 < 1.0f)) {
temp_f12 = temp_ft2 = ((0.2f * (20.0f / (spB0[i] + 20.0f))) * ((sp74[i]) + 10.0f)) / 20.0f;
if ((var_f18 == 1.0f) && (var_f20 == (-1.0f))) {
var_f18 = temp_f2 - temp_f12;
var_f20 = temp_f2 + temp_f12;
} else {
temp_f14 = temp_f2 - temp_f12;
temp_f16 = temp_f2 + temp_f12;
if ((temp_f14 < var_f18) && (temp_f16 > var_f18)) {
var_f18 = temp_f14;
}
if ((temp_f16 > var_f20) && (temp_f14 < var_f20)) {
var_f20 = temp_f16;
}
sp74[j] = temp_f2 - temp_f0_2;
j += 1;
}
}
}
if (j != 0) {
var_f18 = 1.0f;
var_f20 = -1.0f;
for (i = 0; i < j; i++) {
temp_f2 = gTrackPositionFactor[sp9C[i]];
if ((temp_f2 > -1.0f) && (temp_f2 < 1.0f)) {
temp_f12 = sp74[i] + 10.0f;
temp_f12 *= 0.2f * (20.0f / (spB0[i] + 20.0f));
temp_f12 /= 20.0f;
if ((var_f18 == 1.0f) && (var_f20 == -1.0f)) {
var_f18 = temp_f2 - temp_f12;
var_f20 = temp_f2 + temp_f12;
} else {
temp_f14 = temp_f2 - temp_f12;
temp_f16 = temp_f2 + temp_f12;
if ((temp_f14 < 1.0f) && (temp_f16 > 1.0f)) {
var_f18 = temp_f14;
}
if ((temp_f16 > -1.0f) && (temp_f14 < -1.0f)) {
var_f20 = temp_f16;
}
}
}
}
if (!(var_f20 < var_f18) && !(gTrackPositionFactor[playerId] < var_f18) &&
!(var_f20 < gTrackPositionFactor[playerId])) {
if (var_f20 > 1.0f) {
var_f20 = 1.0f;
}
if (var_f18 < -1.0f) {
var_f18 = -1.0f;
}
if ((var_f18 + 1.0f) < (1.0f - var_f20)) {
D_80163010[playerId] = 0x003C;
D_80162FF8[playerId] = 1;
D_80163090[playerId] = var_f20;
} else {
D_80163010[playerId] = 0x003C;
D_80162FF8[playerId] = 2;
D_80163090[playerId] = var_f18;
}
}
if (var_f20 < var_f18) {
return;
}
if (gTrackPositionFactor[playerId] < var_f18) {
return;
}
if (var_f20 < gTrackPositionFactor[playerId]) {
return;
}
if (var_f20 > 1.0f) {
var_f20 = 1.0f;
}
if (var_f18 < (-1.0f)) {
var_f18 = -1.0f;
}
if ((var_f18 + 1.0f) < (1.0f - var_f20)) {
D_80163010[playerId] = 0x003C;
D_80162FF8[playerId] = 1;
D_80163090[playerId] = var_f20;
} else {
D_80163010[playerId] = 0x003C;
D_80162FF8[playerId] = 2;
D_80163090[playerId] = var_f18;
}
}
#else
GLOBAL_ASM("asm/non_matchings/cpu_vehicles_camera_path/func_8000B140.s")
#endif
// utils track position
+12 -12
View File
@@ -301,14 +301,14 @@ ThwompSpawn gThomwpSpawns150CC[] = {
{ 0x0596, 0xf92f, 0x0006, 0x0000 }, { 0x082a, 0xf9f2, 0x0005, 0x0000 }, { 0x073a, 0xf9f2, 0x0005, 0x0001 },
};
f32 D_800E594C[][2] = {
{ -8.0, 8.0 },
{ 8.0, 8.0 },
{ 0.0, 0.0 },
{ 8.0, -8.0 },
{ -8.0, -8.0 },
f32 D_800E594C[] = {
-8.0, 8.0,
8.0, 8.0,
0.0, 0.0,
8.0, -8.0,
-8.0, -8.0,
// This feels super fake, but it matches
{ -0.0, 0.0 },
-0.0, 0.0,
};
s16 D_800E597C[] = { 0x0000, 0x0000, 0x4000, 0x8000, 0x8000, 0xc000 };
@@ -445,11 +445,11 @@ s8 D_800E5DB4[] = {
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
YVFlagPoleSpawn D_800E5DF4[] = {
{ { 0xfc7a, 0x0046, 0xfa82 }, 0x3800 },
{ { 0xfc4c, 0x0046, 0xfa03 }, 0x3800 },
{ { 0xf786, 0x0000, 0x02d3 }, 0x0400 },
{ { 0xf76f, 0x0000, 0x02f9 }, 0x0400 },
s16 D_800E5DF4[] = {
0xfc7a, 0x0046, 0xfa82, 0x3800,
0xfc4c, 0x0046, 0xfa03, 0x3800,
0xf786, 0x0000, 0x02d3, 0x0400,
0xf76f, 0x0000, 0x02f9, 0x0400,
};
HegdehogSpawn gHedgehogSpawns[] = {
+2 -2
View File
@@ -35,7 +35,7 @@ extern s16 D_800E57F8[];
extern ThwompSpawn gThomwpSpawns50CC[];
extern ThwompSpawn gThwompSpawns100CCExtra[];
extern ThwompSpawn gThomwpSpawns150CC[];
extern f32 D_800E594C[][2];
extern f32 D_800E594C[];
extern u64 D_800E5974;
extern s16 D_800E597C[];
extern SplineData D_800E5988;
@@ -48,7 +48,7 @@ extern SplineData D_800E5D78;
extern SplineData* D_800E5D9C[];
extern SplineData* D_800E5DB0;
extern s8 D_800E5DB4[];
extern YVFlagPoleSpawn D_800E5DF4[];
extern s16 D_800E5DF4[];
extern HegdehogSpawn gHedgehogSpawns[];
extern Vec3s gHedgehogPatrolPoints[];
extern SnowmanSpawn gSnowmanSpawns[];
+21 -26
View File
@@ -1764,54 +1764,49 @@ void func_8004C628(s32 arg0, s32 arg1, u32 arg2, u32 arg3, u8* texture) {
gSPDisplayList(gDisplayListHead++, D_0D007EB8);
}
#ifdef NON_MATCHING
// https://decomp.me/scratch/TqXqn
// There's a weird fakematch concerning `xPos`, don't know that to make of. Can't quite get it over the finish line
// though
void render_texture_tile_rgba32_block(s16 x, s16 y, u8* texture, u32 width, u32 height) {
s32 texSizeLess;
s32 i;
s32 yPos;
s32 xPos;
s32 texBlockCount;
s32 centerY;
s32 centerX;
s32 numTextureBlocks;
u32 texSize;
s32 heightDiv;
s32 realCount;
s32 size;
u8* textureCopy;
xPos = x - (width / 2);
yPos = y - (height / 2);
centerX = x - (width / 2);
centerY = y - (height / 2);
textureCopy = texture;
gSPDisplayList(gDisplayListHead++, D_0D007EF8);
gDPSetRenderMode(gDisplayListHead++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
texSize = width * height * 4;
texBlockCount = texSize / 4096;
numTextureBlocks = texSize / 4096;
if (texSize % 4096) {
texBlockCount++;
numTextureBlocks++;
}
heightDiv = height / texBlockCount;
realCount = texBlockCount;
for (i = 0; i < realCount; i++) {
heightDiv = height / numTextureBlocks;
size = numTextureBlocks;
for (i = 0; i < size; i++) {
load_texture_tile_rgba32_nomirror(textureCopy, width, heightDiv);
render_texture_rectangle_wrap(xPos, yPos, width, heightDiv, 1);
texSizeLess = texSize - (width * heightDiv * 4);
render_texture_rectangle_wrap(centerX, centerY, width, heightDiv, 1);
textureCopy += (width * heightDiv * 4);
texSizeLess = texSize - (width * heightDiv * 4);
if (texSizeLess < 0) {
heightDiv = texSize / width;
} else {
texSize = texSizeLess;
texSize -= (width * heightDiv * 4);
}
// Weird fakematch that is a HUGE improvement
xPos += yPos * 0;
yPos += heightDiv;
}
centerY += heightDiv;
}
gSPDisplayList(gDisplayListHead++, D_0D007EB8);
// FAKE
centerX++;
centerX--;
}
#else
void render_texture_tile_rgba32_block(s16 x, s16 y, u8* texture, u32 width, u32 height);
GLOBAL_ASM("asm/non_matchings/render_objects/render_texture_tile_rgba32_block.s")
#endif
void render_game_logo(s16 x, s16 y) {
render_texture_tile_rgba32_block(x, y, gGameLogoAddress, 256, 128);
+1 -1
View File
@@ -208,7 +208,7 @@ void func_8004BB34(void);
void func_8004BB3C(s32, s32, s32, s32, f32);
void func_8004BD14(s32, s32, u32, u32, s32, u8*, u8*);
void func_8004C6FC(s16, s16, u8*, u32, u32);
void render_texture_tile_rgba32_block(s16 x, s16 y, u8* texture, u32 width, u32 height);
void func_8004C024(s16, s16, s16, u16, u16, u16, u16);
void func_8004C148(s16, s16, s16, u16, u16, u16, u16);
+10 -18
View File
@@ -472,7 +472,6 @@ void func_800B559C(s32 arg0) {
bestRecord->bestThreelaps[0], 0x38);
}
#ifdef NON_MATCHING
/**
* This one is weird. Its some type of checksum calculator, seemingly for the
* best time trial records. But the number of bytes it operates over is
@@ -482,26 +481,19 @@ void func_800B559C(s32 arg0) {
*
* But only unknown bytes 7 and 8 ever get set, so why the extra 3, and why in chunks of 17?
**/
s32 func_800B578C(s32 arg0) {
u8* var_a2;
s32 var_a0;
s32 var_v0;
s32 var_v1;
var_a2 = &gSaveData.onlyBestTimeTrialRecords[arg0].bestThreelaps[0][0];
var_v1 = 0;
for (var_v0 = 0; var_v0 < 3;) {
++var_v0;
for (var_a0 = 0; var_a0 != 0x11; var_a0++) {
if (var_a0) {}
var_v1 += (((*var_a2++) + 1) * var_v0) + var_a0;
u8 func_800B578C(s32 arg0) {
u8* times = (u8*)&gSaveData.onlyBestTimeTrialRecords[arg0];
s32 checksum = 0;
s32 i;
s32 j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 0x11; j++) {
checksum += (times[i * 0x11 + j] + 1) * (i + 1) + j;
}
var_a2 += 0x11;
}
return (var_v1 % 256) & 0xFF;
return (checksum % 256);
}
#else
GLOBAL_ASM("asm/non_matchings/save/func_800B578C.s")
#endif
s32 func_800B5888(s32 arg0) {
s32 tmp = gSaveData.onlyBestTimeTrialRecords[arg0].unknownBytes[6] + 90;
+1 -1
View File
@@ -59,7 +59,7 @@ s32 is_cc_mode_complete(s32);
s32 has_unlocked_extra_mode(void);
s32 has_completed_extra_mode(void);
void func_800B559C(s32);
s32 func_800B578C(s32);
u8 func_800B578C(s32);
s32 func_800B5888(s32);
s32 func_800B58C4(s32);
void update_save_data_backup(void);
+8 -25
View File
@@ -6035,31 +6035,23 @@ void func_80080DE4(s32 arg0) {
}
}
#ifdef NON_MATCHING
// https://decomp.me/scratch/YMJDJ
// No idea what the problem is
void func_80080E8C(s32 objectIndex1, s32 objectIndex2, s32 arg2) {
u16 anAngle;
f32 thing0;
f32 thing1;
f32* temp_v1;
f32 thing0;
init_object(objectIndex1, arg2);
temp_v1 = D_800E594C[arg2];
gObjectList[objectIndex1].unk_0D5 = 2;
anAngle = gObjectList[objectIndex2].direction_angle[1];
thing1 = func_800416D8(temp_v1[1], temp_v1[0], anAngle);
thing0 = func_80041724(temp_v1[1], temp_v1[0], anAngle);
thing1 = func_800416D8(D_800E594C[arg2 * 2 + 1], D_800E594C[arg2 * 2 + 0], anAngle);
thing0 = func_80041724(D_800E594C[arg2 * 2 + 1], D_800E594C[arg2 * 2 + 0], anAngle);
gObjectList[objectIndex1].origin_pos[0] = gObjectList[objectIndex2].pos[0] + thing0;
gObjectList[objectIndex1].origin_pos[1] = gObjectList[objectIndex2].surfaceHeight - 9.0;
gObjectList[objectIndex1].origin_pos[2] = gObjectList[objectIndex2].pos[2] + thing1;
anAngle = D_800E597C[arg2] + gObjectList[objectIndex2].direction_angle[1];
anAngle = gObjectList[objectIndex2].direction_angle[1] + D_800E597C[arg2];
gObjectList[objectIndex1].velocity[0] = sins(anAngle) * 0.6;
gObjectList[objectIndex1].velocity[2] = coss(anAngle) * 0.6;
}
#else
GLOBAL_ASM("asm/non_matchings/update_objects/func_80080E8C.s")
#endif
void func_80080FEC(s32 arg0) {
s32 objectIndex;
@@ -6752,24 +6744,15 @@ void update_crabs(void) {
}
}
#ifdef NON_MATCHING
// https://decomp.me/scratch/PYAg4
// Stack issue caused by the `test` variable, but removing it causes much, much larger differences
void func_80082F1C(s32 objectIndex, s32 arg1) {
YVFlagPoleSpawn* test;
gObjectList[objectIndex].model = (Gfx*) d_course_yoshi_valley_unk5;
gObjectList[objectIndex].vertex = (Vtx*) d_course_yoshi_valley_unk4;
gObjectList[objectIndex].model = (Gfx*)d_course_yoshi_valley_unk5;
gObjectList[objectIndex].vertex = (Vtx*)d_course_yoshi_valley_unk4;
gObjectList[objectIndex].sizeScaling = 0.027f;
if (test->rot && test->rot) {}
test = &D_800E5DF4[arg1];
object_next_state(objectIndex);
set_obj_origin_pos(objectIndex, test->pos[0] * xOrientation, test->pos[1], test->pos[2]);
set_obj_origin_pos(objectIndex, D_800E5DF4[arg1 * 4 + 0] * xOrientation, D_800E5DF4[arg1 * 4 + 1], D_800E5DF4[arg1 * 4 + 2]);
set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f);
set_obj_direction_angle(objectIndex, 0U, test->rot, 0U);
set_obj_direction_angle(objectIndex, 0U, D_800E5DF4[arg1 * 4 + 3], 0U);
}
#else
GLOBAL_ASM("asm/non_matchings/update_objects/func_80082F1C.s")
#endif
void func_80083018(s32 objectIndex, s32 arg1) {
switch (gObjectList[objectIndex].state) {