Ran the formatter, and manually fixed things I didn't like that it did.

This commit is contained in:
Ryan Myers
2021-10-28 10:18:37 -04:00
parent f29aa383e0
commit f3cf9491ce
39 changed files with 2064 additions and 2217 deletions
+3 -3
View File
@@ -1,14 +1,14 @@
IndentWidth: 4
Language: Cpp
UseTab: Never
ColumnLimit: 132
ColumnLimit: 0
PointerAlignment: Right
BreakBeforeBraces: Attach
SpaceAfterCStyleCast: false
Cpp11BracedListStyle: false
IndentCaseLabels: true
BinPackArguments: true
BinPackParameters: true
BinPackArguments: false
BinPackParameters: false
AlignAfterOpenBracket: Align
AlignOperands: true
BreakBeforeTernaryOperators: true
+17 -17
View File
@@ -22,18 +22,18 @@ s32 *gAssetsLookupTable;
// These are both defined in the generated dkr.ld file.
extern u8 __ASSETS_LUT_START, __ASSETS_LUT_END; // __ASSETS_LUT_START = 0xECB60, _END = 0xECC30
void func_80076BA0(void) {
u32 assetTableSize;
osCreateMesgQueue(&D_80124278, &D_80124238, 16);
osCreateMesgQueue(&D_80124220, &D_80124218, 1);
osCreatePiManager((OSPri) 150, &D_80124278, &D_80124238, 16);
osCreatePiManager((OSPri)150, &D_80124278, &D_80124238, 16);
assetTableSize = &__ASSETS_LUT_END - &__ASSETS_LUT_START;
gAssetsLookupTable = (s32*)allocate_from_main_pool_safe(assetTableSize, COLOR_TAG_GRAY);
gAssetsLookupTable = (s32 *)allocate_from_main_pool_safe(assetTableSize, COLOR_TAG_GRAY);
func_80071478(gAssetsLookupTable);
dmacopy(&__ASSETS_LUT_START, gAssetsLookupTable, assetTableSize);
}
/**
* Returns the memory address containing an asset section loaded from ROM.
*/
@@ -49,7 +49,7 @@ s32 *load_asset_section_from_rom(u32 assetIndex) {
index = assetIndex + gAssetsLookupTable;
start = *index;
size = *(index + 1) - start;
out = (s32*)allocate_from_main_pool_safe(size, COLOR_TAG_GRAY);
out = (s32 *)allocate_from_main_pool_safe(size, COLOR_TAG_GRAY);
if (out == NULL) {
return NULL;
}
@@ -73,20 +73,20 @@ u8 *load_compressed_asset_from_rom(u32 assetIndex, s32 arg1) {
if (gAssetsLookupTable[0] < assetIndex) {
return NULL;
}
assetIndex++;
index = assetIndex + gAssetsLookupTable;
start = *index;
size = *(index + 1) - start;
temp_v0_2 = (u8*)allocate_from_main_pool_safe(8, COLOR_TAG_WHITE);
temp_v0_2 = (u8 *)allocate_from_main_pool_safe(8, COLOR_TAG_WHITE);
temp_a0 = start + &__ASSETS_LUT_END;
dmacopy(temp_a0, temp_v0_2, 8);
sp2C = byteswap32(temp_v0_2) + arg1;
free_from_memory_pool(temp_v0_2);
temp_v0_3 = (u8*)allocate_from_main_pool_safe(sp2C + arg1, COLOR_TAG_GRAY);
temp_v0_3 = (u8 *)allocate_from_main_pool_safe(sp2C + arg1, COLOR_TAG_GRAY);
if (temp_v0_3 == NULL) {
return NULL;
}
@@ -126,11 +126,11 @@ s32 load_asset_section_from_rom_to_address(u32 assetIndex, s32 *address) {
s32 load_asset_to_address(u32 assetIndex, s32 *address, s32 assetOffset, s32 size) {
s32 *index;
s32 start;
if (size == 0 || gAssetsLookupTable[0] < assetIndex) {
return 0;
}
assetIndex++;
index = assetIndex + gAssetsLookupTable;
start = *index + assetOffset;
@@ -144,11 +144,11 @@ s32 load_asset_to_address(u32 assetIndex, s32 *address, s32 assetOffset, s32 siz
u8 *get_rom_offset_of_asset(u32 assetIndex, s32 assetOffset) {
s32 *index;
s32 start;
if (gAssetsLookupTable[0] < assetIndex) {
return NULL;
}
assetIndex++;
index = assetIndex + gAssetsLookupTable;
start = *index + assetOffset;
@@ -164,7 +164,7 @@ s32 get_size_of_asset_section(u32 assetIndex) {
if (gAssetsLookupTable[0] < assetIndex) {
return 0;
}
assetIndex++;
index = assetIndex + gAssetsLookupTable;
return *(index + 1) - *index;
@@ -181,7 +181,7 @@ void dmacopy(u32 romOffset, u32 ramAddress, s32 numBytes) {
osInvalDCache(ramAddress, numBytes);
numBytesToDMA = MAX_TRANSFER_SIZE;
while(numBytes > 0) {
while (numBytes > 0) {
if (numBytes < numBytesToDMA) {
numBytesToDMA = numBytes;
}
+130 -143
View File
File diff suppressed because it is too large Load Diff
+48 -56
View File
@@ -45,7 +45,7 @@ ScreenViewport gScreenViewports[4] = {
s32 D_800DD134 = 0;
// Not sure about the typing here
s16 D_800DD138[8] = {
s16 D_800DD138[8] = {
0, 0, 0, -1, -1, 0, 0, 0
};
@@ -73,7 +73,6 @@ Vp D_800DD148[20] = {
{ 0, 0, 0x01FF, 0, 0, 0, 0x01FF, 0 },
};
unk8011D510 D_800DD288 = {
0, 0, 0, 0, 1.0f, 0.0f, 0.0f, -281.0f,
};
@@ -110,8 +109,8 @@ s32 D_80120CF0[6];
s32 D_80120D08;
s32 D_80120D0C;
f32 gCurCamFOV;
s8 D_80120D14;
u8 D_80120D15;
s8 D_80120D14;
u8 D_80120D15;
s32 D_80120D18;
s32 D_80120D1C;
s32 D_80120D20[2];
@@ -132,7 +131,7 @@ Matrix D_801210A0;
OSMesgQueue *D_801210E0[6];
OSMesg *D_801210F8;
OSMesg D_801210FC;
OSContStatus status;
OSContStatus status;
s32 D_80121108[2]; //Padding?
unk80121110 D_80121110[8];
u16 D_80121140[4];
@@ -146,10 +145,10 @@ extern s32 D_B0000578;
void func_80065EA0(void) {
s32 i, j;
for(i = 0; i < 5; i++) {
for (i = 0; i < 5; i++) {
D_80120D70[i] = &D_80120DA0[i];
};
for(j = 0; j < 8; j++) {
for (j = 0; j < 8; j++) {
D_80120CE4 = j;
func_800663DC(200, 200, 200, 0, 0, 180);
};
@@ -202,15 +201,13 @@ f32 get_current_camera_fov(void) {
void update_camera_fov(f32 camFieldOfView) {
if (CAMERA_MIN_FOV < camFieldOfView && camFieldOfView < CAMERA_MAX_FOV && camFieldOfView != gCurCamFOV) {
gCurCamFOV = camFieldOfView;
guPerspectiveF(D_80120EE0, &perspNorm[5], camFieldOfView,
CAMERA_ASPECT, CAMERA_NEAR, CAMERA_FAR, CAMERA_SCALE);
guPerspectiveF(D_80120EE0, &perspNorm[5], camFieldOfView, CAMERA_ASPECT, CAMERA_NEAR, CAMERA_FAR, CAMERA_SCALE);
func_8006F870(D_80120EE0, D_80120FE0);
}
}
void func_80066194(void) {
guPerspectiveF(D_80120EE0, &perspNorm[5], CAMERA_DEFAULT_FOV,
CAMERA_ASPECT, CAMERA_NEAR, CAMERA_FAR, CAMERA_SCALE);
guPerspectiveF(D_80120EE0, &perspNorm[5], CAMERA_DEFAULT_FOV, CAMERA_ASPECT, CAMERA_NEAR, CAMERA_FAR, CAMERA_SCALE);
func_8006F870(D_80120EE0, D_80120FE0);
}
@@ -270,11 +267,11 @@ f32 func_80066348(f32 arg0, f32 arg1, f32 arg2) {
f32 temp_f2, temp_f0, temp_f14;
phi_v1 = D_80120CE4;
if (D_80120D14 != 0) {
phi_v1 += 4;
}
temp_f0 = arg2 - D_80120AC0[phi_v1].z_position;
temp_f2 = arg0 - D_80120AC0[phi_v1].x_position;
temp_f14 = arg1 - D_80120AC0[phi_v1].y_position;
@@ -282,18 +279,18 @@ f32 func_80066348(f32 arg0, f32 arg1, f32 arg2) {
}
void func_800663DC(s32 xPos, s32 yPos, s32 zPos, s32 arg3, s32 arg4, s32 arg5) {
D_80120AC0[D_80120CE4].unk4 = (s16) (arg3 * 0xB6);
D_80120AC0[D_80120CE4].x_position = (f32) xPos;
D_80120AC0[D_80120CE4].y_position = (f32) yPos;
D_80120AC0[D_80120CE4].z_position = (f32) zPos;
D_80120AC0[D_80120CE4].unk2 = (s16) (arg4 * 0xB6);
D_80120AC0[D_80120CE4].unk4 = (s16)(arg3 * 0xB6);
D_80120AC0[D_80120CE4].x_position = (f32)xPos;
D_80120AC0[D_80120CE4].y_position = (f32)yPos;
D_80120AC0[D_80120CE4].z_position = (f32)zPos;
D_80120AC0[D_80120CE4].unk2 = (s16)(arg4 * 0xB6);
D_80120AC0[D_80120CE4].unk38 = (u16)0;
D_80120AC0[D_80120CE4].unk24 = 0.0f;
D_80120AC0[D_80120CE4].unk28 = 0.0f;
D_80120AC0[D_80120CE4].unk2C = 0.0f;
D_80120AC0[D_80120CE4].unk30 = 0.0f;
D_80120AC0[D_80120CE4].unk1C = 160.0f;
D_80120AC0[D_80120CE4].unk0 = (s16) (arg5 * 0xB6);
D_80120AC0[D_80120CE4].unk0 = (s16)(arg5 * 0xB6);
D_80120AC0[D_80120CE4].unk3B = D_800DD2F8[D_80120CE4];
}
@@ -324,7 +321,7 @@ s32 func_8006652C(s32 arg0) {
} else {
gNumberOfViewports = 0;
}
switch(gNumberOfViewports) {
switch (gNumberOfViewports) {
case VIEWPORTS_COUNT_1_PLAYER:
D_80120CE8 = 1;
break;
@@ -364,7 +361,7 @@ void func_80066610(void) {
s32 i;
D_800DD134 = 1 - D_800DD134;
for(i = 0; i < 4; i++) {
for (i = 0; i < 4; i++) {
if (gScreenViewports[i].flags & 4) {
gScreenViewports[i].flags &= ~1;
} else if (gScreenViewports[i].flags & 2) {
@@ -448,7 +445,7 @@ void func_80066940(s32 viewPortIndex, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
s32 phi_a1;
s32 phi_a2;
s32 phi_a3;
widthAndHeight = get_video_width_and_height_as_s32();
width = widthAndHeight & 0xFFFF;
// Placement issues with the height variable.
@@ -606,8 +603,8 @@ void func_80066CDC(Gfx **dlist, s32 arg1) {
if (osTvType == TV_TYPE_PAL) {
sp58 = 0x91;
}
switch(gNumberOfViewports) {
switch (gNumberOfViewports) {
case VIEWPORTS_COUNT_1_PLAYER:
phi_t3 = sp58;
if (osTvType == TV_TYPE_PAL) {
@@ -644,27 +641,23 @@ void func_80066CDC(Gfx **dlist, s32 arg1) {
case VIEWPORTS_COUNT_4_PLAYERS:
sp58 = sp58 >> 1;
sp54 = temp_a2 >> 1;
switch(D_80120CE4) {
switch (D_80120CE4) {
case 0:
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0.0f, 0.0f,
(temp_a2 - (temp_t1 >> 8)), (temp_a3 - (temp_t0 >> 7)));
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0.0f, 0.0f, (temp_a2 - (temp_t1 >> 8)), (temp_a3 - (temp_t0 >> 7)));
phi_t5 = 0;
phi_t4 = 0;
case 1:
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, (temp_a2 + (temp_t1 >> 8)), 0,
((temp_a2 * 2) - (temp_t1 >> 8)), (temp_a3 - (temp_t0 >> 7)));
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, (temp_a2 + (temp_t1 >> 8)), 0, ((temp_a2 * 2) - (temp_t1 >> 8)), (temp_a3 - (temp_t0 >> 7)));
phi_t5 = 0;
phi_t4 = temp_a2;
break;
case 2:
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, temp_a3 + (temp_t0 >> 7),
temp_a2 - (temp_t1 >> 8), (temp_a3 * 2) - (temp_t0 >> 7));
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, temp_a3 + (temp_t0 >> 7), temp_a2 - (temp_t1 >> 8), (temp_a3 * 2) - (temp_t0 >> 7));
phi_t5 = temp_a3;
phi_t4 = 0;
break;
case 3:
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, temp_a2 + (temp_t1 >> 8), temp_a3 + (temp_t0 >> 7),
(temp_a2 * 2) - (temp_t1 >> 8), (temp_a3 * 2) - (temp_t0 >> 7));
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, temp_a2 + (temp_t1 >> 8), temp_a3 + (temp_t0 >> 7), (temp_a2 * 2) - (temp_t1 >> 8), (temp_a3 * 2) - (temp_t0 >> 7));
phi_t5 = temp_a3;
phi_t4 = temp_a2;
break;
@@ -687,7 +680,7 @@ void func_80066CDC(Gfx **dlist, s32 arg1) {
phi_t3 = sp54;
break;
}
if (osTvType == TV_TYPE_PAL) {
sp4C -= 4;
}
@@ -701,7 +694,6 @@ void func_80066CDC(Gfx **dlist, s32 arg1) {
GLOBAL_ASM("asm/non_matchings/camera/func_80066CDC.s")
#endif
GLOBAL_ASM("asm/non_matchings/camera/func_80067A3C.s")
GLOBAL_ASM("asm/non_matchings/camera/func_80067D3C.s")
@@ -713,7 +705,7 @@ void func_80067F2C(Gfx **dlist, s32 *arg1) {
u32 widthAndHeight;
s32 width, height;
s32 i, j;
widthAndHeight = get_video_width_and_height_as_s32();
height = widthAndHeight >> 0x10;
width = widthAndHeight & 0xFFFF;
@@ -723,16 +715,16 @@ void func_80067F2C(Gfx **dlist, s32 *arg1) {
D_800DD148[D_80120CE4 + 5].vp.vscale[1] = width * 2;
D_800DD148[D_80120CE4 + 5].vp.vtrans[0] = width * 2;
D_800DD148[D_80120CE4 + 5].vp.vtrans[1] = height * 2;
gSPViewport((*dlist)++, (u8*)&D_800DD148[D_80120CE4 + 5] + 0x80000000);
gSPViewport((*dlist)++, (u8 *)&D_800DD148[D_80120CE4 + 5] + 0x80000000);
fast3d_cmd((*dlist)++, 0x1000040, (u32)(*arg1 + 0x80000000));
*arg1 += 0x40;
D_80120D1C = 0;
D_80120D08 = 0;
i = 0;
while(i < 4) { // for loop doesn't match here.
while (i < 4) { // for loop doesn't match here.
j = 0;
while(j < 4) {
while (j < 4) {
D_80120F20[i][j] = D_800DD2B8[i][j];
j++;
}
@@ -745,7 +737,7 @@ void func_8006807C(Gfx **dlist, s32 *arg1) {
func_8006F768(&D_80121060, &D_80120EE0, &D_80120F20);
func_8006FE74(D_80120D70[0], &D_800DD2A0);
func_8006F768(D_80120D70[0], &D_80120F20, &D_80121060);
func_8006F870(D_80121060, (s32*)*arg1); // This doesn't look right. Need to check this!
func_8006F870(D_80121060, (s32 *)*arg1); // This doesn't look right. Need to check this!
fast3d_cmd((*dlist)++, 0x1000040, (u32)(*arg1 + 0x80000000));
*arg1 += 0x40;
D_80120D1C = 0;
@@ -763,9 +755,9 @@ void func_80068158(Gfx **dlist, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
D_800DD148[D_80120CE4].vp.vtrans[1] = arg4 * 4;
D_800DD148[D_80120CE4].vp.vscale[0] = tempArg1 * 4;
D_800DD148[D_80120CE4].vp.vscale[1] = arg2 * 4;
gSPViewport((*dlist)++, (u8*)&D_800DD148[D_80120CE4] + 0x80000000);
gSPViewport((*dlist)++, (u8 *)&D_800DD148[D_80120CE4] + 0x80000000);
} else {
gSPViewport((*dlist)++, (u8*)&D_800DD148[D_80120CE4 + 10 + (D_800DD134 * 5)] + 0x80000000);
gSPViewport((*dlist)++, (u8 *)&D_800DD148[D_80120CE4 + 10 + (D_800DD134 * 5)] + 0x80000000);
}
}
@@ -788,11 +780,11 @@ void func_800682AC(Gfx **dlist) {
void func_80068408(Gfx **dlist, s32 *arg1) {
func_800705F8(D_80120D70[D_80120D1C], 0.0f, 0.0f, 0.0f);
func_8006F768(D_80120D70[D_80120D1C], &D_80120F20, &D_80121060);
func_8006F870(D_80121060, (s32*)*arg1); // This doesn't look right. Need to check this!
func_8006F870(D_80121060, (s32 *)*arg1); // This doesn't look right. Need to check this!
D_80120D88[D_80120D1C] = *arg1;
fast3d_cmd((*dlist)++, ((((D_80120D08 << 6) & 0xFF) << 0x10) | 0x1000000) | 0x40, (u32)(*arg1 + 0x80000000));
*arg1 += 0x40;
}
@@ -851,7 +843,7 @@ void func_80069E14(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
f32 temp_f14;
f32 temp_f2;
s32 i;
for (i = 0; i <= gNumberOfViewports; i++) {
temp_f0 = arg0 - D_80120AC0[i].x_position;
temp_f2 = arg1 - D_80120AC0[i].y_position;
@@ -865,7 +857,7 @@ void func_80069E14(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
void func_80069F28(f32 arg0) {
s32 i;
for(i = 0; i <= gNumberOfViewports; i++) {
for (i = 0; i <= gNumberOfViewports; i++) {
D_80120AC0[i].unk30 = arg0;
}
}
@@ -875,8 +867,8 @@ void func_80069F28(f32 arg0) {
void func_80069F64(s16 *mtx) {
s32 i, j;
s32 val;
for(i = 0; i < 4; i++) {
for(j = 0; j < 4; j++) {
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
val = mtx[i * 4 + j];
rmonPrintf("%x.", val);
val = mtx[((i + 4) * 4 + j)]; // Issue here.
@@ -893,9 +885,9 @@ GLOBAL_ASM("asm/non_matchings/camera/func_80069F64.s")
// Unused. Prints/Displays a 4x4 floating-point matrix.
void func_8006A03C(f32 *mtx) {
s32 i, j;
for(i = 0; i < 4; i++) {
for(j = 0; j < 4; j++) {
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
rmonPrintf("%f ", mtx[i * 4 + j]);
}
rmonPrintf("\n");
@@ -924,7 +916,7 @@ s32 func_8006A10C(void) {
return 0;
}
if (!bitpattern) { }
if (!bitpattern) {}
D_800DD300 = 1;
@@ -935,7 +927,7 @@ GLOBAL_ASM("asm/non_matchings/camera/func_8006A1C4.s")
void func_8006A434(void) {
s32 i;
for(i = 0; i < 4; i++) {
for (i = 0; i < 4; i++) {
D_80121150[i] = i;
}
}
@@ -943,12 +935,12 @@ void func_8006A434(void) {
void func_8006A458(s8 *activePlayers) {
s32 i;
s32 temp = 0;
for(i = 0; i < 4; i++) {
for (i = 0; i < 4; i++) {
if (activePlayers[i]) {
D_80121150[temp++] = i;
}
}
for(i = 0; i < 4; i++) {
for (i = 0; i < 4; i++) {
if (!activePlayers[i]) {
D_80121150[temp++] = i;
}
+10 -10
View File
@@ -16,7 +16,7 @@ s32 *D_800DE440 = 0;
u8 gN64FontCodes[68] = "\0 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#'*+,-./:=?@";
s32 D_800DE488 = 0; // Currently unknown, might be a different type.
s32 D_800DE488 = 0; // Currently unknown, might be a different type.
s32 D_800DE48C = 0;
/*******************************/
@@ -54,7 +54,7 @@ const char D_800E7714[] = "WARNING : No Eprom\n";
const char D_800E7728[] = "WARNING : No Eprom\n";
const char D_800E773C[] = "DKRACING-GHOSTS"; // Used in func_80074B34
const u8 D_800E774C[4] = { 0, 0, 0, 0 }; // Used in func_80074B34, but I'm confused to what this is for.
const u8 D_800E774C[4] = { 0, 0, 0, 0 }; // Used in func_80074B34, but I'm confused to what this is for.
const char D_800E7750[] = "warning: corrupt ghost\n";
/*********************************/
@@ -144,7 +144,7 @@ s32 func_80073F5C(s32 arg0, s32 arg1) {
size = get_s32_256(); // 256 bytes
sp2C = allocate_from_main_pool_safe(size, COLOR_TAG_WHITE);
*((s32*)sp2C) = 0x47414D44; //'GAMD';
*((s32 *)sp2C) = 0x47414D44; //'GAMD';
func_800732E8(arg1, sp2C + 4);
phi_v1 = func_80073C5C(arg0, 3, &sp30);
if (phi_v1 == 0) {
@@ -168,7 +168,7 @@ s32 func_80074148(s32 arg0, Settings *arg1) {
sp24 = get_s32_512(); // 512 bytes
sp2C = allocate_from_main_pool_safe(sp24, COLOR_TAG_WHITE);
*((s32*)sp2C) = 0x54494D44; // TIMD
*((s32 *)sp2C) = 0x54494D44; // TIMD
func_800738A4(arg1, sp2C + 4);
phi_v1 = func_80073C5C(arg0, 4, &sp30);
if (phi_v1 == 0) {
@@ -202,7 +202,7 @@ s32 func_8007497C(u64 *arg0) {
*arg0 >>= 8;
*arg0 |= (s64)((s32)func_8007480C(*arg0)) << 56;
if (func_8006EAC0() == 0) {
osEepromWrite(func_8006A100(), 0xF, (u8*)arg0);
osEepromWrite(func_8006A100(), 0xF, (u8 *)arg0);
}
return 1;
}
@@ -217,11 +217,11 @@ s16 func_80074A4C(GhostHeader *ghostHeader) {
s16 len;
s16 sum;
s32 temp;
sum = 0;
len = (ghostHeader->nodeCount * sizeof(GhostDataFrame)) + sizeof(GhostHeader);
for(i = sizeof(GhostHeader); i < len; i++) {
sum += ((u8*)ghostHeader)[i];
for (i = sizeof(GhostHeader); i < len; i++) {
sum += ((u8 *)ghostHeader)[i];
}
return sum;
}
@@ -235,7 +235,7 @@ void func_80074AA8(GhostHeader *ghostHeader, s16 characterID, s16 time, s16 node
ghostHeader->unk3 = 0;
ghostHeader->time = time;
ghostHeader->nodeCount = nodeCount;
bcopy(dest, (u8*)ghostHeader + 8, nodeCount * sizeof(GhostDataFrame));
bcopy(dest, (u8 *)ghostHeader + 8, nodeCount * sizeof(GhostDataFrame));
ghostHeader->checksum = func_80074A4C(ghostHeader);
}
@@ -431,7 +431,7 @@ s32 func_80076AF4(s32 controllerIndex, s32 fileNum) {
ret = 6;
data = allocate_from_main_pool_safe(0x100, COLOR_TAG_BLACK);
if (read_data_from_controller_pak(controllerIndex, fileNum, (u8 *)data, 0x100) == 0) {
switch(*data) {
switch (*data) {
case 0x47414D44: //'GAMD': // Game Data?
ret = 3;
break;
+27 -27
View File
@@ -27,15 +27,15 @@ s32 *D_800E31C8[2] = { NULL, NULL };
s32 D_800E31D0[2] = { 0, 0 };
Gfx D_800E31D8[] = {
gsDPPipeSync(),
gsDPPipeSync(),
gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetTextureLOD(G_TL_TILE),
gsDPSetTextureLUT(G_TT_NONE),
gsDPSetTextureDetail(G_TD_CLAMP),
gsDPSetTextureDetail(G_TD_CLAMP),
gsDPSetTexturePersp(G_TP_NONE),
gsDPSetTextureFilter(G_TF_BILERP),
gsDPSetTextureConvert(G_TC_FILT),
gsDPSetAlphaCompare(G_AC_NONE),
gsDPSetTextureConvert(G_TC_FILT),
gsDPSetAlphaCompare(G_AC_NONE),
gsDPSetRenderMode(G_RM_CLD_SURF, G_RM_CLD_SURF2),
gsSPEndDisplayList(),
};
@@ -295,7 +295,7 @@ s32 func_800C0494(s32 arg0) {
} else if (arg0 >= 6) {
arg0 = 5;
}
if (D_800E31AC != 0) {
if (D_800E31B0 == 0) {
D_800E31AC = -1;
@@ -360,7 +360,7 @@ void render_fade_transition(s32 dlist, s32 arg1, s32 arg2) {
render_fade_disabled(dlist, arg1, arg2);
break;
}
func_80066CDC(dlist, arg1);
}
}
@@ -380,10 +380,10 @@ void func_800C0724(void) {
void func_800C0780(FadeTransition *transition) {
if (transition->type & 0x80) {
D_8012A750 = 255.0f;
D_8012A754 = -255.0f / (f32) D_800E31B0;
D_8012A754 = -255.0f / (f32)D_800E31B0;
} else {
D_8012A750 = 0.0f;
D_8012A754 = 255.0f / (f32) D_800E31B0;
D_8012A754 = 255.0f / (f32)D_800E31B0;
}
D_800E31AC = 1;
}
@@ -429,7 +429,7 @@ void render_fade_circle(Gfx **dlist, s32 arg1, s32 arg2) {
u8 *addr, *addr2;
func_8007B3D0(dlist);
gSPDisplayList((*dlist)++, D_800E3648);
addr = (D_800E31C0[D_800E31D0[0]] + 0x80000000);
addr = (D_800E31C0[D_800E31D0[0]] + 0x80000000);
addr2 = (D_800E31C8[D_800E31D0[0]] + 0x80000000);
gDkrVertices((*dlist)++, (s32)addr, ((s32)addr & 6) | 0x88, 0xA6);
gDkrTriangles((*dlist)++, (s32)addr2, 16, TRIN_DISABLE_TEXTURE);
@@ -486,27 +486,27 @@ GLOBAL_ASM("asm/non_matchings/fade_transition/func_800C2640.s")
#ifdef NON_MATCHING
void func_800C27A0(s32 arg0) {
//do {
if (D_800E31B0 > 0) {
gLastFadeRed += D_8012A744 * arg0;
gLastFadeGreen += D_8012A748 * arg0;
gLastFadeBlue += D_8012A74C * arg0;
if (arg0 >= D_800E31B0) {
gLastFadeRed = gCurFadeRed << 16;
gLastFadeGreen = gCurFadeGreen << 16;
gLastFadeBlue = gCurFadeBlue << 16;
D_800E31B0 = 0;
arg0 -= D_800E31B0;
} else {
D_800E31B0 -= arg0;
}
if (D_800E31B0 > 0) {
gLastFadeRed += D_8012A744 * arg0;
gLastFadeGreen += D_8012A748 * arg0;
gLastFadeBlue += D_8012A74C * arg0;
if (arg0 >= D_800E31B0) {
gLastFadeRed = gCurFadeRed << 16;
gLastFadeGreen = gCurFadeGreen << 16;
gLastFadeBlue = gCurFadeBlue << 16;
D_800E31B0 = 0;
arg0 -= D_800E31B0;
} else {
D_800E31B4 -= arg0;
if (D_800E31B4 != 0xFFFF) {
if ((D_800E31B4 & 0xFFFF) <= 0) {
D_800E31B4 = 0;
}
D_800E31B0 -= arg0;
}
} else {
D_800E31B4 -= arg0;
if (D_800E31B4 != 0xFFFF) {
if ((D_800E31B4 & 0xFFFF) <= 0) {
D_800E31B4 = 0;
}
}
}
//} while(1 == 0);
}
#else
+54 -47
View File
@@ -8,17 +8,17 @@
/************ .data ************/
Gfx D_800E3690[] = {
gsDPPipeSync(),
gsDPPipeSync(),
gsDPSetTextureLOD(G_TL_TILE),
gsDPSetTextureLUT(G_TT_NONE),
gsDPSetAlphaCompare(G_AC_NONE),
gsSPClearGeometryMode(G_ZBUFFER | G_FOG),
gsDPPipeSync(),
gsSPClearGeometryMode(G_ZBUFFER | G_FOG),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
// Unused?
Gfx D_800E36C8[][2] = {
Gfx D_800E36C8[][2] = {
{
gsDPSetCombineMode(DKR_CC_UNK11, DKR_CC_UNK11),
gsDPSetOtherMode(DKR_OMH_1CYC_POINT_NOPERSP, DKR_OML_COMMON | G_RM_XLU_SURF | G_RM_XLU_SURF2),
@@ -33,8 +33,16 @@ s8 D_800E36E8 = 0;
// Descending powers of 10
s32 gDescPowsOf10[9] = {
1000000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10,
};
1000000000,
100000000,
10000000,
1000000,
100000,
10000,
1000,
100,
10,
};
s8 D_800E3710[48] = {
4, FALSE, 0, FALSE, 1,
@@ -64,24 +72,24 @@ s32 D_8012A7F8;
s32 D_8012A7FC;
/******************************/
void load_fonts(void) {
s32 *fontAssetData;
s32 i;
fontAssetData = load_asset_section_from_rom(ASSET_BINARY_44);
gFonts = (FontData*)(fontAssetData); // ???
gFonts = (FontData *)(fontAssetData); // ???
gNumberOfFonts = *(fontAssetData);
gFonts = (FontData*)(fontAssetData + 1);
gFonts = (FontData *)(fontAssetData + 1);
for (i = 0; i < gNumberOfFonts; i++) {
gFonts[i].unk28[0] = 0;
}
D_8012A7E8 = allocate_from_main_pool_safe(unk8012A7E8_TOTAL_SIZE + unk8012A7EC_TOTAL_SIZE, COLOR_TAG_YELLOW);
D_8012A7EC = (unk8012A7EC*)((u8*)D_8012A7E8 + unk8012A7E8_TOTAL_SIZE);
D_8012A7EC = (unk8012A7EC *)((u8 *)D_8012A7E8 + unk8012A7E8_TOTAL_SIZE);
for (i = 0; i < unk8012A7E8_COUNT; i++) {
(*D_8012A7E8)[i].xpos = 0;
(*D_8012A7E8)[i].ypos = 0;
@@ -205,7 +213,7 @@ TextureHeader *func_800C4318(s32 font, u8 arg1) {
return NULL;
}
}
// @bug: No return statement. The function will return whatever happens to be in v0
// @bug: No return statement. The function will return whatever happens to be in v0
// before this function was called.
}
@@ -229,11 +237,11 @@ void set_text_background_color(s32 red, s32 green, s32 blue, s32 alpha) {
}
// Unused?
void func_800C4404(Gfx** displayList, char *text, s32 alignmentFlags) {
void func_800C4404(Gfx **displayList, char *text, s32 alignmentFlags) {
func_800C45A4(displayList, &(*D_8012A7E8)[0], text, alignmentFlags, 1.0f);
}
void draw_text(Gfx** displayList, s32 xpos, s32 ypos, char *text, s32 alignmentFlags) {
void draw_text(Gfx **displayList, s32 xpos, s32 ypos, char *text, s32 alignmentFlags) {
unk8012A7E8 *temp = &(*D_8012A7E8)[0];
temp->xpos = (xpos == -0x8000) ? temp->unkC >> 1 : xpos;
temp->ypos = (ypos == -0x8000) ? temp->unkE >> 1 : ypos;
@@ -241,7 +249,7 @@ void draw_text(Gfx** displayList, s32 xpos, s32 ypos, char *text, s32 alignmentF
}
// Unused?
void func_800C44C0(Gfx** displayList, s32 arg1, char *text, s32 alignmentFlags) {
void func_800C44C0(Gfx **displayList, s32 arg1, char *text, s32 alignmentFlags) {
if (arg1 >= 0 && arg1 < 8) {
unk8012A7E8 *temp = &D_8012A7E8[arg1];
func_800C45A4(displayList, temp, text, alignmentFlags, 1.0f);
@@ -249,7 +257,7 @@ void func_800C44C0(Gfx** displayList, s32 arg1, char *text, s32 alignmentFlags)
}
// Unused?
void func_800C4510(Gfx** displayList, s32 arg1, s32 xpos, s32 ypos, char *text, s32 alignmentFlags) {
void func_800C4510(Gfx **displayList, s32 arg1, s32 xpos, s32 ypos, char *text, s32 alignmentFlags) {
if (arg1 >= 0 && arg1 < 8) {
unk8012A7E8 *temp = &D_8012A7E8[arg1];
temp->xpos = (xpos == -0x8000) ? temp->unkC >> 1 : xpos;
@@ -266,7 +274,7 @@ s32 func_800C4DA0(u8 *text, s32 x, s32 font) {
s32 diffX, thisDiffX;
FontData *fontData;
FontCharData *fontCharData;
if (text == NULL) {
return 0;
}
@@ -275,7 +283,7 @@ s32 func_800C4DA0(u8 *text, s32 x, s32 font) {
font = (*D_8012A7E8)[0].font;
}
fontData = &gFonts[font];
while(*text != '\0') {
while (*text != '\0') {
u8 ch = *text;
thisDiffX = diffX;
if ((ch < 0x21) || (ch >= 0x80)) {
@@ -311,18 +319,18 @@ void func_800C4EDC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
temp->xpos = 0;
temp->ypos = 0;
if (arg1 < arg3) {
temp->unk4 = (s16) arg1;
temp->unk8 = (s16) arg3;
temp->unk4 = (s16)arg1;
temp->unk8 = (s16)arg3;
} else {
temp->unk8 = (s16) arg1;
temp->unk4 = (s16) arg3;
temp->unk8 = (s16)arg1;
temp->unk4 = (s16)arg3;
}
if (arg2 < arg4) {
temp->unk6 = (s16) arg2;
temp->unkA = (s16) arg4;
temp->unk6 = (s16)arg2;
temp->unkA = (s16)arg4;
} else {
temp->unkA = (s16) arg2;
temp->unk6 = (s16) arg4;
temp->unkA = (s16)arg2;
temp->unk6 = (s16)arg4;
}
temp->unkC = (temp->unk8 - temp->unk4) + 1;
temp->unkE = (temp->unkA - temp->unk6) + 1;
@@ -338,7 +346,6 @@ void func_800C4F7C(s32 arg0, s32 font) {
}
}
void func_800C4FBC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
if (arg0 > 0 && arg0 < 8) {
unk8012A7E8 *temp = &D_8012A7E8[arg0];
@@ -408,7 +415,7 @@ void func_800C5428(s32 arg0, unk8012A7E8_24 *arg1) {
unk8012A7E8 *temp;
unk8012A7E8_24 *temp_24;
unk8012A7E8_24 **temp_24_ptr;
temp = &D_8012A7E8[arg0];
temp_24_ptr = &temp->unk24;
temp_24 = temp->unk24;
@@ -425,11 +432,11 @@ void func_800C5428(s32 arg0, unk8012A7E8_24 *arg1) {
void func_800C5494(s32 arg0) {
unk8012A7E8 *temp;
unk8012A7E8_24 *temp_24, *temp_24_2;
temp = &D_8012A7E8[arg0];
temp_24 = temp->unk24;
if (temp_24 != NULL) {
temp_24_2 = temp_24; // This seems redundant.
temp_24_2 = temp_24; // This seems redundant.
while (temp_24_2 != NULL) {
temp_24_2->unk01 = 0xFF;
temp_24_2 = temp_24_2->unk1C;
@@ -442,14 +449,14 @@ void func_800C5494(s32 arg0) {
void func_800C54E8(s32 arg0, unk800C54E8 *arg1, s32 arg2, s32 arg3, s32 arg4) {
FontData *fontData;
unk8012A7E8 *temp;
temp = &D_8012A7E8[arg0];
if(arg1 != NULL){
if (arg1 != NULL) {
if (arg1->unk19 != 0xFF) {
fontData = &gFonts[arg1->unk19];
if(arg4 != 4) {
switch(arg4) {
if (arg4 != 4) {
switch (arg4) {
case 1:
arg3 *= fontData->unk22;
break;
@@ -505,8 +512,8 @@ void func_800C56FC(s32 arg0, s32 arg1, s32 arg2) {
D_800E36E8 = 0;
}
}
for(i = 1; i < 8; i++) {
for (i = 1; i < 8; i++) {
if ((*D_8012A7E8)[i].unk1E & 0x8000) {
if ((*D_8012A7E8)[i].unk1E & 0x4000) {
func_800C5B58(arg0, arg1, arg2, i);
@@ -518,21 +525,21 @@ void func_800C56FC(s32 arg0, s32 arg1, s32 arg2) {
}
#ifdef NON_MATCHING
void s32_to_string(char** outString, s32 number) {
void s32_to_string(char **outString, s32 number) {
u8 digit;
s32 i;
s32 hasDigit; // boolean
s32 div;
// Check for a negative number
if (number < 0) {
if (number < 0) {
**outString = '-';
number = -number;
(*outString)++;
}
// Loop through digit places.
for(i = 0; i < 9; i++){
for (i = 0; i < 9; i++) {
hasDigit = FALSE;
digit = '0';
if (number >= gDescPowsOf10[i]) {
@@ -580,12 +587,12 @@ void func_800C5B58(Gfx **dlist, s32 *arg1, s32 *arg2, s32 arg3) {
s32 x0, x1;
char sp6C[256];
s32 y0, y1;
temp = &D_8012A7E8[arg3];
if (temp->unk13 != 0) {
gSPDisplayList((*dlist)++, &D_800E3690);
gDkrDmaDisplayList((*dlist)++, ((u8*)&D_800E36C8[1]) + 0x80000000, 2);
gDkrDmaDisplayList((*dlist)++, ((u8 *)&D_800E36C8[1]) + 0x80000000, 2);
gDPSetEnvColor((*dlist)++, 0, 0, 0, 0);
if ((temp->unk8 - temp->unk4) < 10 || (temp->unkA - temp->unk6) < 10) {
render_fill_rectangle(dlist, temp->unk4 - 2, temp->unk6 - 2, temp->unk8 + 2, temp->unkA + 2);
+3 -4
View File
@@ -81,7 +81,6 @@ void func_800C2AB4(void) {
func_800C5494(6);
}
void func_800C2AF4(s32 arg0) {
D_800E3680 = arg0;
}
@@ -96,7 +95,7 @@ void func_800C2F1C(s32 arg0) {
if (D_8012A7B6 != 0) {
if (D_8012A7AC <= 0) {
D_8012A7A8 -= arg0 * D_8012A7AA;
if ((s32) D_8012A7A8 < 0) {
if ((s32)D_8012A7A8 < 0) {
D_8012A7A8 = 0;
D_8012A7B6 = 0;
func_800C5620(6);
@@ -120,7 +119,7 @@ void func_800C2F1C(s32 arg0) {
void func_800C3048(void) {
D_8012A78C = -1;
D_8012A780 = (u8*)allocate_from_main_pool_safe(0x800, COLOR_TAG_GREEN);
D_8012A780 = (u8 *)allocate_from_main_pool_safe(0x800, COLOR_TAG_GREEN);
D_8012A798.unk0 = D_8012A780 + 0x80;
D_8012A798.unk4 = D_8012A798.unk0 + 0x3C0;
D_8012A7A4 = 0;
@@ -135,7 +134,7 @@ void func_800C30CC(void) {
free_from_memory_pool(D_8012A780);
D_800E3670 = 0;
D_8012A789 = 0;
for(i = 0; i < 10; i++) {
for (i = 0; i < 10; i++) {
func_8009CFB0();
};
func_800C2AB4();
+4 -4
View File
@@ -22,8 +22,8 @@ s32 D_8012AAD8;
/******************************/
void func_800C6170(void) {
D_800E3760 = (huft*)allocate_from_main_pool_safe(0x2800, COLOR_TAG_BLACK);
gAssetAddress = (s32*)allocate_from_main_pool_safe(0x10, COLOR_TAG_BLACK);
D_800E3760 = (huft *)allocate_from_main_pool_safe(0x2800, COLOR_TAG_BLACK);
gAssetAddress = (s32 *)allocate_from_main_pool_safe(0x10, COLOR_TAG_BLACK);
}
/**
@@ -51,11 +51,11 @@ s32 get_asset_uncompressed_size(s32 assetIndex, s32 assetOffset) {
* Returns the pointer to the decompressed data.
*/
u8 *gzip_inflate(u8 *compressedInput, u8 *decompressedOutput) {
gzip_inflate_input = compressedInput + 5; // The compression header is 5 bytes.
gzip_inflate_input = compressedInput + 5; // The compression header is 5 bytes.
gzip_inflate_output = decompressedOutput;
gzip_num_bits = 0;
gzip_bit_buffer = 0;
while(gzip_inflate_block() != 0) {} // Keep calling gzip_inflate_block() until it returns 0.
while (gzip_inflate_block() != 0) {} // Keep calling gzip_inflate_block() until it returns 0.
return decompressedOutput;
}
+3 -5
View File
@@ -33,21 +33,21 @@ s32 D_8011F918[1130];
void main(void) {
osInitialize();
osCreateThread(&gThread1, 1, (OSId) &func_80065D98, 0, &gThread1StackPointer, (OSPri) 0);
osCreateThread(&gThread1, 1, (OSId)&func_80065D98, 0, &gThread1StackPointer, (OSPri)0);
osStartThread(&gThread1);
}
#ifdef NON_MATCHING
void func_80065D98(s32 arg0) {
func_800B6F50();
osCreateThread(&D_8011F910, 3, (OSId) &thread3_main, 0, &D_8011F758, (OSPri) 10);
osCreateThread(&D_8011F910, 3, (OSId)&thread3_main, 0, &D_8011F758, (OSPri)10);
D_8011D758[2049] = 0;
D_8011D758[2048] = 0;
D_8011D758[1] = 0;
D_8011D758[0] = 0;
osStartThread(&D_8011F910);
osSetThreadPri(NULL, 0);
while(1){}
while (1) {}
}
#else
GLOBAL_ASM("asm/non_matchings/main/func_80065D98.s")
@@ -71,5 +71,3 @@ void func_80065E30(void) {
#else
GLOBAL_ASM("asm/non_matchings/main/func_80065E30.s")
#endif
+46 -48
View File
@@ -30,7 +30,7 @@ const char D_800E7488[] = "Unable to record %d slots, colours overflowed table.\
MemoryPool gMemoryPools[4];
#ifndef _ALIGN16
#define _ALIGN16(val) ((val) & 0xFFFFFFF0) + 0x10
#define _ALIGN16(val) ((val)&0xFFFFFFF0) + 0x10
#endif
s32 gNumberOfMemoryPools;
@@ -53,7 +53,7 @@ extern MemoryPoolSlot gMainMemoryPool;
*/
void init_main_memory_pool(void) {
gNumberOfMemoryPools = -1;
if(1) {
if (1) {
// Create the main memory pool.
new_memory_pool(&gMainMemoryPool, RAM_END - (s32)(&gMainMemoryPool), MAIN_POOL_SLOT_COUNT);
}
@@ -84,20 +84,20 @@ MemoryPoolSlot *new_memory_pool(MemoryPoolSlot *slots, s32 poolSize, s32 numSlot
MemoryPool *pool;
MemoryPoolSlot *firstSlot;
unk80070BE4_8_0 *temp3;
pool = &gMemoryPools[++gNumberOfMemoryPools];
pool->maxNumSlots = numSlots;
pool->curNumSlots = 0;
pool->slots = slots;
pool->size = poolSize;
for(i = 0; i < pool->maxNumSlots; i++) {
for (i = 0; i < pool->maxNumSlots; i++) {
slots[i].index = i;
}
firstSlot = pool->slots;
temp3 = (unk80070BE4_8_0 *)&slots[numSlots];
if((s32)temp3 & 0xF) {
if ((s32)temp3 & 0xF) {
firstSlot->unk0 = (unk80070BE4_8_0 *)_ALIGN16((s32)temp3);
} else {
firstSlot->unk0 = temp3;
@@ -106,9 +106,9 @@ MemoryPoolSlot *new_memory_pool(MemoryPoolSlot *slots, s32 poolSize, s32 numSlot
firstSlot->flags = 0;
firstSlot->prevIndex = -1;
firstSlot->nextIndex = -1;
pool->curNumSlots++;
return pool->slots;
}
#else
@@ -147,7 +147,7 @@ MemoryPoolSlot *allocate_from_memory_pool(s32 memoryPoolIndex, s32 size, u32 col
s32 phi_a2;
s32 phi_s0;
s32 *sp28;
sp28 = func_8006F510();
pool = &gMemoryPools[memoryPoolIndex];
if (pool->curNumSlots + 1 == pool->maxNumSlots) {
@@ -159,7 +159,7 @@ MemoryPoolSlot *allocate_from_memory_pool(s32 memoryPoolIndex, s32 size, u32 col
phi_a0 = 0;
phi_a2 = 0x7FFFFFFF; // INT_MAX
phi_s0 = -1;
while(phi_a0 != -1) {
while (phi_a0 != -1) {
curSlot = &pool->slots[phi_a0];
if (!curSlot->flags && curSlot->size >= size && curSlot->size < phi_a2) {
phi_s0 = phi_a0;
@@ -182,7 +182,7 @@ GLOBAL_ASM("asm/non_matchings/memory/allocate_from_memory_pool.s")
void *allocate_from_pool_containing_slots(MemoryPoolSlot *slots, s32 size) {
s32 i;
for(i = gNumberOfMemoryPools; i != 0; i--) {
for (i = gNumberOfMemoryPools; i != 0; i--) {
if (slots == gMemoryPools[i].slots) {
return allocate_from_memory_pool(i, size, 0);
}
@@ -206,16 +206,16 @@ void *allocate_at_address_in_main_pool(s32 size, u8 *address, u32 colorTag) {
size = _ALIGN16(size); // The size of the pool should be 16-byte aligned
}
slots = gMemoryPools[0].slots;
while(s0 != -1) {
while (s0 != -1) {
curSlot = &slots[s0];
if (curSlot->flags == 0) {
if ((address >= (u8*)curSlot->unk0) && (((u8*)curSlot->unk0 + curSlot->size) >= (address + size))) {
if (address == (u8*)curSlot->unk0) {
if ((address >= (u8 *)curSlot->unk0) && (((u8 *)curSlot->unk0 + curSlot->size) >= (address + size))) {
if (address == (u8 *)curSlot->unk0) {
allocate_memory_pool_slot(0, s0, size, 1, 0, colorTag);
func_8006F53C(sp38);
return curSlot->unk0;
} else {
s0 = allocate_memory_pool_slot(0, s0, address - (u8*)curSlot->unk0, 0, 1, colorTag);
s0 = allocate_memory_pool_slot(0, s0, address - (u8 *)curSlot->unk0, 0, 1, colorTag);
allocate_memory_pool_slot(0, s0, size, 1, 0, colorTag);
func_8006F53C(sp38);
return slots[s0].unk0;
@@ -267,10 +267,10 @@ void free_from_memory_pool(void *data) {
void clear_free_queue(void) {
s32 i;
s32 *sp28;
sp28 = func_8006F510();
for(i = 0; i < gFreeQueueCount;) {
for (i = 0; i < gFreeQueueCount;) {
gFreeQueue[i].unk4--;
if (gFreeQueue[i].unk4 == 0) {
free_slot_containing_address(gFreeQueue[i].dataAddress);
@@ -281,7 +281,7 @@ void clear_free_queue(void) {
i++;
}
}
func_8006F53C(sp28);
}
@@ -294,9 +294,9 @@ void free_slot_containing_address(u8 *address) {
poolIndex = get_memory_pool_index_containing_address(address);
slots = gMemoryPools[poolIndex].slots;
for(slotIndex = 0; slotIndex != -1; slotIndex = slot->nextIndex) {
for (slotIndex = 0; slotIndex != -1; slotIndex = slot->nextIndex) {
slot = &slots[slotIndex];
if (address == (u8*)slot->unk0) {
if (address == (u8 *)slot->unk0) {
if (slot->flags == 1 || slot->flags == 4) {
free_memory_pool_slot(poolIndex, slotIndex);
}
@@ -314,10 +314,10 @@ void func_80071314(void) {
s32 slotIndex;
sp40 = func_8006F510();
for (poolIndex = gNumberOfMemoryPools; poolIndex != -1; poolIndex--) {
pool = &gMemoryPools[poolIndex];
for(slotIndex = 0; slotIndex != -1; slotIndex = slot->nextIndex) {
for (slotIndex = 0; slotIndex != -1; slotIndex = slot->nextIndex) {
slot = &pool->slots[slotIndex];
if (slot->flags == 1) {
free_memory_pool_slot(poolIndex, slotIndex);
@@ -352,9 +352,9 @@ s32 func_80071478(u8 *address) {
sp18 = func_8006F510();
pool = &gMemoryPools[get_memory_pool_index_containing_address(address)];
slotIndex = 0;
while(slotIndex != -1) {
while (slotIndex != -1) {
slot = slotIndex + pool->slots; // `slot = &pool->slots[slotIndex];` does not match.
if (address == (u8*)slot->unk0) {
if (address == (u8 *)slot->unk0) {
if (slot->flags == 1 || slot->flags == 4) {
slot->flags |= 2;
func_8006F53C(sp18);
@@ -376,9 +376,9 @@ s32 func_80071538(u8 *address) {
sp18 = func_8006F510();
pool = &gMemoryPools[get_memory_pool_index_containing_address(address)];
slotIndex = 0;
while(slotIndex != -1) {
while (slotIndex != -1) {
slot = slotIndex + pool->slots; // `slot = &pool->slots[slotIndex];` does not match.
if (address == (u8*)slot->unk0) {
if (address == (u8 *)slot->unk0) {
if (slot->flags & 2) {
slot->flags ^= 2;
func_8006F53C(sp18);
@@ -398,12 +398,12 @@ s32 get_memory_pool_index_containing_address(u8 *address) {
s32 i;
MemoryPool *pool;
for(i = gNumberOfMemoryPools; i > 0; i--) {
for (i = gNumberOfMemoryPools; i > 0; i--) {
pool = &gMemoryPools[i];
if ((u8*)pool->slots >= address) {
if ((u8 *)pool->slots >= address) {
continue;
}
if(address < pool->size + (u8*)pool->slots) {
if (address < pool->size + (u8 *)pool->slots) {
break;
}
}
@@ -428,9 +428,9 @@ void free_memory_pool_slot(s32 poolIndex, s32 slotIndex) {
nextSlot = &slots[nextIndex];
prevSlot = &slots[prevIndex];
slot->flags = 0;
if (nextIndex != -1) {
if(nextSlot->flags == 0) {
if (nextSlot->flags == 0) {
slot->size += nextSlot->size;
tempNextIndex = nextSlot->nextIndex;
slot->nextIndex = tempNextIndex;
@@ -442,7 +442,7 @@ void free_memory_pool_slot(s32 poolIndex, s32 slotIndex) {
}
}
if (prevIndex != -1) {
if(prevSlot->flags == 0) {
if (prevSlot->flags == 0) {
prevSlot->size += slot->size;
tempNextIndex = slot->nextIndex;
prevSlot->nextIndex = tempNextIndex;
@@ -482,7 +482,7 @@ s32 allocate_memory_pool_slot(s32 memoryPoolIndex, s32 slotIndex, s32 size, s32
newIndex = pool->slots[pool->curNumSlots].index;
pool->curNumSlots++;
newSlot = &pool->slots[newIndex];
newSlot->unk0 = ((u8*)slot->unk0) + size;
newSlot->unk0 = ((u8 *)slot->unk0) + size;
newSlot->size = slotSize - size;
newSlot->flags = newSlotIsTaken;
futureIndex = slot->nextIndex;
@@ -500,14 +500,13 @@ s32 allocate_memory_pool_slot(s32 memoryPoolIndex, s32 slotIndex, s32 size, s32
GLOBAL_ASM("asm/non_matchings/memory/allocate_memory_pool_slot.s")
#endif
/**
* Returns the passed in address aligned to the next 16-byte boundary.
*/
u8 *align16(u8 *address) {
s32 remainder = (s32)address & 0xF;
if (remainder > 0) {
address = (u8*)(((s32)address - remainder) + 16);
address = (u8 *)(((s32)address - remainder) + 16);
}
return address;
}
@@ -519,7 +518,7 @@ u8 *align16(u8 *address) {
u8 *align8(u8 *address) {
s32 remainder = (s32)address & 0x7;
if (remainder > 0) {
address = (u8*)(((s32)address - remainder) + 8);
address = (u8 *)(((s32)address - remainder) + 8);
}
return address;
}
@@ -531,7 +530,7 @@ u8 *align8(u8 *address) {
u8 *align4(u8 *address) {
s32 remainder = (s32)address & 0x3;
if (remainder > 0) {
address = (u8*)(((s32)address - remainder) + 4);
address = (u8 *)(((s32)address - remainder) + 4);
}
return address;
}
@@ -542,7 +541,7 @@ GLOBAL_ASM("asm/non_matchings/memory/func_800718A4.s")
s32 get_memory_color_tag_count(s32 arg0) {
s32 i, count;
count = 0;
for(i = 0; i < 80; i++) { // Issue with this loop
for (i = 0; i < 80; i++) { // Issue with this loop
if ((gMemoryPools[0].slots[i].flags) && (arg0 == gMemoryPools[0].slots[i].colorTag)) {
count++;
}
@@ -588,18 +587,17 @@ void render_memory_color_tags(void) {
}
#ifdef NON_MATCHING
// Unused. Does nothing?
// Unused. Does nothing?
void func_80071C74(void) {
s32 i, flags;
MemoryPool *pool;
MemoryPoolSlot *slot;
for(i = 0; i <= gNumberOfMemoryPools; i++) {
for (i = 0; i <= gNumberOfMemoryPools; i++) {
pool = &gMemoryPools[i];
slot = &pool->slots[0];
while(slot->nextIndex != -1) {
if(slot->flags) { // I don't know how to get this to appear.
while (slot->nextIndex != -1) {
if (slot->flags) { // I don't know how to get this to appear.
}
slot = &pool->slots[slot->nextIndex];
}
@@ -609,10 +607,10 @@ void func_80071C74(void) {
GLOBAL_ASM("asm/non_matchings/memory/func_80071C74.s")
#endif
// Unused. Does nothing?
// Unused. Does nothing?
void func_80071CE8(void) {
s32 i;
for(i = gNumberOfMemoryPools; i != -1; i--) {
for (i = gNumberOfMemoryPools; i != -1; i--) {
// Nothing here. There might've been a printf or something similar.
}
}
+732 -786
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -60,11 +60,11 @@ void func_8005F850(void) {
D_8011D63C = load_asset_section_from_rom(ASSET_OBJECT_ANIMATIONS_TABLE);
D_8011D644 = allocate_from_main_pool_safe(0xC00, COLOR_TAG_GREEN);
D_8011D640 = 0;
// Anti-tamper check.
checksum = 0;
for (i = 0; i < D_800DCEA4; i++) {
checksum += *(u8*)(((s32)&func_80024D54) + i);
checksum += *(u8 *)(((s32)&func_80024D54) + i);
}
if (checksum != D_800DCEA0) {
func_8005C25C();
+38 -38
View File
@@ -76,18 +76,18 @@ unk800E2D08 D_800E2D08[5] = {
};
unk800E2D58 D_800E2D58[5] = {
{ 0x0000, 0x01FF, 0x01FF },
{ 0x0000, 0x01FF, 0x01FF },
{ 0x0000, 0x0000, 0x01FF },
{ 0x0000, 0x0000, 0x01FF },
{ 0x0000, 0x01FF, 0x01FF },
{ 0x0000, 0x01FF, 0x01FF },
{ 0x0000, 0x0000, 0x01FF },
{ 0x0000, 0x0000, 0x01FF },
{ 0x0000, 0x01FF, 0x01FF },
};
// Are these just Triangles?
unk800E2D08 D_800E2D78[8] = {
{ 0x0000, 0x0105, 0x0000, 0x0000, 0x0080, 0x0000, 0x0080, 0x01FF },
{ 0x0000, 0x0504, 0x0000, 0x0000, 0x0080, 0x01FF, 0x0000, 0x01FF },
{ 0x0001, 0x0206, 0x0080, 0x0000, 0x0100, 0x0000, 0x0100, 0x01FF },
{ 0x0000, 0x0105, 0x0000, 0x0000, 0x0080, 0x0000, 0x0080, 0x01FF },
{ 0x0000, 0x0504, 0x0000, 0x0000, 0x0080, 0x01FF, 0x0000, 0x01FF },
{ 0x0001, 0x0206, 0x0080, 0x0000, 0x0100, 0x0000, 0x0100, 0x01FF },
{ 0x0001, 0x0605, 0x0080, 0x0000, 0x0100, 0x01FF, 0x0080, 0x01FF },
{ 0x0002, 0x0307, 0x0100, 0x0000, 0x0180, 0x0000, 0x0180, 0x01FF },
{ 0x0002, 0x0706, 0x0100, 0x0000, 0x0180, 0x01FF, 0x0100, 0x01FF },
@@ -118,7 +118,7 @@ s32 D_800E2E54 = 0;
s32 D_800E2E58 = 0;
s32 D_800E2E5C = 0;
s32 *D_800E2E60 = NULL;
s32 D_800E2E64 = 0;
s32 D_800E2E64 = 0;
s16 D_800E2E68[6] = {
0, 8,
@@ -273,23 +273,23 @@ void func_800AE490(void) {
#ifdef NON_MATCHING
void init_particle_assets(void) {
s32 i;
func_800AE490();
gParticlesAssetTable = load_asset_section_from_rom(ASSET_PARTICLES_TABLE);
for(gParticlesAssetTableCount = -1; (s32)gParticlesAssetTable[gParticlesAssetTableCount + 1] != -1; gParticlesAssetTableCount++){
for (gParticlesAssetTableCount = -1; (s32)gParticlesAssetTable[gParticlesAssetTableCount + 1] != -1; gParticlesAssetTableCount++) {
}
gParticlesAssets = load_asset_section_from_rom(ASSET_PARTICLES);
for(i = 0; i < gParticlesAssetTableCount; i++) {
gParticlesAssetTable[i] = (u8*)gParticlesAssets + (s32)gParticlesAssetTable[i];
for (i = 0; i < gParticlesAssetTableCount; i++) {
gParticlesAssetTable[i] = (u8 *)gParticlesAssets + (s32)gParticlesAssetTable[i];
}
gParticleBehaviorsAssetTable = load_asset_section_from_rom(ASSET_PARTICLE_BEHAVIORS_TABLE);
for(gParticleBehaviorsAssetTableCount = -1; (s32)gParticleBehaviorsAssetTable[gParticleBehaviorsAssetTableCount + 1] != -1; gParticleBehaviorsAssetTableCount++){
for (gParticleBehaviorsAssetTableCount = -1; (s32)gParticleBehaviorsAssetTable[gParticleBehaviorsAssetTableCount + 1] != -1; gParticleBehaviorsAssetTableCount++) {
}
gParticleBehaviorsAssets = load_asset_section_from_rom(ASSET_PARTICLE_BEHAVIORS);
for(i = 0; i < gParticleBehaviorsAssetTableCount; i++) {
gParticleBehaviorsAssetTable[i] = (u8*)gParticleBehaviorsAssets + (s32)gParticleBehaviorsAssetTable[i];
if((s32)gParticleBehaviorsAssetTable[i]->unk9C != -1) {
for (i = 0; i < gParticleBehaviorsAssetTableCount; i++) {
gParticleBehaviorsAssetTable[i] = (u8 *)gParticleBehaviorsAssets + (s32)gParticleBehaviorsAssetTable[i];
if ((s32)gParticleBehaviorsAssetTable[i]->unk9C != -1) {
gParticleBehaviorsAssetTable[i]->unk9C = get_misc_asset(gParticleBehaviorsAssetTable[i]->unk9C);
}
}
@@ -306,12 +306,12 @@ void func_800AEE14(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) {
Vertex *temp;
Triangle *tri;
s16 *temp2;
arg0->unk4 = 3;
arg0->unk8 = *arg1;
temp = *arg1;
temp2 = &D_800E2E68;
for(i = 0; i < 3; i++) {
for (i = 0; i < 3; i++) {
temp->x = temp2[0];
temp->y = temp2[1];
temp2 += 2;
@@ -339,12 +339,12 @@ void func_800AEEB8(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) {
Vertex *temp;
Triangle *tri;
s16 *temp2;
arg0->unk4 = 4;
arg0->unk8 = *arg1;
temp = *arg1;
temp2 = &D_800E2E74;
for(i = 0; i < 4; i++) {
for (i = 0; i < 4; i++) {
temp->x = temp2[0];
temp->y = temp2[1];
temp2 += 2;
@@ -373,20 +373,20 @@ void func_800AEEB8(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) {
tri[1].vi1 = 2;
tri[1].vi2 = 1;
tri[1].uv2.v = 0;
tri+=2;
tri += 2;
*arg2 = tri;
}
void func_800AEF88(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) {
s32 i;
Vertex *temp;
arg0->unk4 = 6;
arg0->unk6 = 4;
arg0->unk8 = *arg1;
arg0->unkC = *arg2;
temp = *arg1;
for(i = 0; i < 6; i++) {
for (i = 0; i < 6; i++) {
temp->r = 255;
temp->g = 255;
temp->b = 255;
@@ -399,13 +399,13 @@ void func_800AEF88(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) {
void func_800AF024(unk800AF024 *arg0, Vertex **arg1, Triangle **arg2) {
s32 i;
Vertex *temp;
arg0->unk4 = 8;
arg0->unk6 = 8;
arg0->unk8 = *arg1;
arg0->unkC = *arg2;
temp = *arg1;
for(i = 0; i < 16; i++) {
for (i = 0; i < 16; i++) {
temp->r = 255;
temp->g = 255;
temp->b = 255;
@@ -438,7 +438,7 @@ void func_800AF0F0(Object *obj) {
Object_44 *temp_v0;
Object_44_C *temp_v1;
s16 temp_t8, temp_t1;
temp_v0 = obj->unk44;
temp_v1 = temp_v0->unkC;
temp_t8 = (temp_v0->unk0->unk0 - 1) << 5;
@@ -479,7 +479,7 @@ void func_800AF29C(unk800AF29C *arg0, s32 arg1, s32 arg2, s16 arg3, s16 arg4, s1
ParticleBehavior *temp_v1;
s32 temp_v0_2;
s32 flags;
temp_v1 = gParticleBehaviorsAssetTable[arg1];
arg0->unk8 = arg2;
arg0->unk18 = arg3;
@@ -487,9 +487,9 @@ void func_800AF29C(unk800AF29C *arg0, s32 arg1, s32 arg2, s16 arg3, s16 arg4, s1
arg0->unk1A = arg4;
arg0->unk1C = arg5;
arg0->unk1E = 0;
flags = temp_v1->flags;
if (flags & 0x4000) {
arg0->unk4 = 0x4000;
arg0->unk6 = 0;
@@ -505,7 +505,7 @@ void func_800AF29C(unk800AF29C *arg0, s32 arg1, s32 arg2, s16 arg3, s16 arg4, s1
} else {
arg0->unk7 = 0xFF;
}
arg0->unkB.unkC_400.unkC = (s32*)allocate_from_main_pool_safe(arg0->unk7 * 4, 0x80808080);
arg0->unkB.unkC_400.unkC = (s32 *)allocate_from_main_pool_safe(arg0->unk7 * 4, 0x80808080);
arg0->unkB.unkC_400.unk10 = temp_v1->unk14;
arg0->unkB.unkC_400.unk12 = temp_v1->unk16;
arg0->unkB.unkC_400.unk14 = temp_v1->unk22;
@@ -526,14 +526,14 @@ void func_800AF29C(unk800AF29C *arg0, s32 arg1, s32 arg2, s16 arg3, s16 arg4, s1
// Should be functionally equivalent.
void func_800AF404(s32 arg0) {
s32 i;
D_800E2E28 = (D_800E2E28 + (arg0 * 64)) & 0x1FF;
for(i = 0; i < 5; i++) {
for (i = 0; i < 5; i++) {
D_800E2D08[i].unk6 = D_800E2D58[i].unk0 + D_800E2E28;
D_800E2D08[i].unkA = D_800E2D58[i].unk2 + D_800E2E28;
D_800E2D08[i].unkE = D_800E2D58[i].unk4 + D_800E2E28;
}
for(i = 0; i < 8; i++) {
for (i = 0; i < 8; i++) {
D_800E2D78[i].unk6 = D_800E2DF8[i].unk0 + D_800E2E28;
D_800E2D78[i].unkA = D_800E2DF8[i].unk2 + D_800E2E28;
D_800E2D78[i].unkE = D_800E2DF8[i].unk4 + D_800E2E28;
@@ -549,7 +549,7 @@ void func_800AF6E4(Object *obj, s32 arg1) {
Object_6C *obj6C;
obj6C = &obj->unk6C[arg1];
obj6C->unk4 &= 0x7FFF;
obj->unk1A--;
}
@@ -568,7 +568,7 @@ GLOBAL_ASM("asm/non_matchings/particles/func_800B2040.s")
void func_800B2260(unk800B2260 *arg0) {
unk800B2260_C *temp_v0;
s32 i;
if (arg0->unk4 & 0x400) {
if (arg0->unkC != NULL) {
for (i = 0; i < arg0->unk6; i++) {
@@ -590,13 +590,13 @@ GLOBAL_ASM("asm/non_matchings/particles/func_800B22FC.s")
void func_800B263C(unk800B2260_C *arg0) {
unk800B2260 *temp_v0;
s32 i;
temp_v0 = (unk800B2260 *)arg0->unk70;
if (temp_v0 != NULL) {
if (temp_v0->unk6 != 0) {
if (arg0 == temp_v0->unkC[arg0->unk74]) {
temp_v0->unk6--;
for(i = arg0->unk74; i < temp_v0->unk6; i++) {
for (i = arg0->unk74; i < temp_v0->unk6; i++) {
temp_v0->unkC[i] = temp_v0->unkC[i + 1];
temp_v0->unkC[i]->unk74 = i;
}
+4 -4
View File
@@ -31,15 +31,15 @@ u8 D_800E2EF4[196] = {
};
Gfx D_800E2FB8[] = {
gsDPPipeSync(),
gsDPPipeSync(),
gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetTextureLOD(G_TL_TILE),
gsDPSetTextureLUT(G_TT_NONE),
gsDPSetTextureDetail(G_TD_CLAMP),
gsDPSetTextureDetail(G_TD_CLAMP),
gsDPSetTexturePersp(G_TP_NONE),
gsDPSetTextureFilter(G_TF_BILERP),
gsDPSetTextureConvert(G_TC_FILT),
gsDPSetAlphaCompare(G_AC_NONE),
gsDPSetTextureConvert(G_TC_FILT),
gsDPSetAlphaCompare(G_AC_NONE),
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
gsDPSetEnvColor(255, 255, 255, 255),
gsDPSetPrimColor(0, 0, 0, 0, 0, 0),
+18 -20
View File
@@ -19,17 +19,17 @@ u8 *load_screen(s32 screenIndex) {
u8 *someAddr;
s32 screenTableCount, start, size;
s32 *screenTable;
screenTable = (u8 *)load_asset_section_from_rom(ASSET_SCREENS_TABLE);
screenTableCount = 0;
while(screenTable[screenTableCount] != -1) {
while (screenTable[screenTableCount] != -1) {
screenTableCount++;
}
screenTableCount--;
// screenTableCount will always be 0 in vanilla DKR,
// screenTableCount will always be 0 in vanilla DKR,
// since there are no screen assets in the ROM.
if (screenTableCount == 0) {
free_from_memory_pool(screenTable);
@@ -39,14 +39,14 @@ u8 *load_screen(s32 screenIndex) {
rmonPrintf("SCREEN: No out of range!!\n");
screenIndex = 0;
}
start = screenTable[screenIndex];
size = screenTable[screenIndex + 1] - start;
someAddr = allocate_from_main_pool_safe(size, COLOR_TAG_BLUE);
load_asset_to_address(ASSET_SCREENS, someAddr, start, size);
free_from_memory_pool(screenTable);
return someAddr;
}
}
@@ -57,27 +57,25 @@ u8 *load_screen(s32 screenIndex) {
*/
void render_screen(Gfx **dlist, u8 *screenAddress) {
s32 y_pos;
gDkrDmaDisplayList((*dlist)++, (u32)&gRdpSetModeScreenAsset + 0x80000000,
numberOfGfxCommands(gRdpSetModeScreenAsset));
gDkrDmaDisplayList((*dlist)++, (u32)&gRdpSetModeScreenAsset + 0x80000000, numberOfGfxCommands(gRdpSetModeScreenAsset));
// Screen header is 16 bytes.
screenAddress += 16;
// Draw each 320x6 RGBA16 slice until the screen image is fully drawn.
y_pos = 0;
while(y_pos != SCREEN_HEIGHT) {
while (y_pos != SCREEN_HEIGHT) {
// Load the texture.
gDPLoadTextureBlockS((*dlist)++, screenAddress + 0x80000000, G_IM_FMT_RGBA, G_IM_SIZ_16b,
gDPLoadTextureBlockS((*dlist)++, screenAddress + 0x80000000, G_IM_FMT_RGBA, G_IM_SIZ_16b,
SCREEN_WIDTH, SCREEN_HEIGHT_PART, 0, G_TX_CLAMP, G_TX_CLAMP, 0, 0, 0, 0);
// Draw the texture.
gSPTextureRectangle((*dlist)++, 0, ((y_pos) << 2), SCREEN_WIDTH << 2,
gSPTextureRectangle((*dlist)++, 0, ((y_pos) << 2), SCREEN_WIDTH << 2,
((y_pos + SCREEN_HEIGHT_PART) << 2), 0, 0, 0, 1 << 12, 1 << 10);
// Advance to the next slice.
screenAddress += SCREEN_WIDTH * SCREEN_HEIGHT_PART * 2;
y_pos += SCREEN_HEIGHT_PART;
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
#include "stacks.h"
// This file only contains .bss variables and needs to be located just before
// This file only contains .bss variables and needs to be located just before
// waves.c; that is why this is "located" at 0x800B7D1F.
/************ .bss ************/
+16 -17
View File
@@ -681,7 +681,7 @@ Gfx D_800DF1A8[][2] = {
gsDPSetCombineMode(DKR_CC_UNK7, DKR_CC_UNK8),
gsDPSetOtherMode(DKR_OMH_2CYC_BILERP, DKR_OML_COMMON | G_RM_NOOP | G_RM_OPA_SURF2),
},
{
{
gsDPSetCombineMode(DKR_CC_UNK7, DKR_CC_UNK8),
gsDPSetOtherMode(DKR_OMH_2CYC_BILERP, DKR_OML_COMMON | G_RM_NOOP | G_RM_AA_OPA_SURF2),
},
@@ -793,7 +793,7 @@ Gfx D_800DF1A8[][2] = {
gsDPSetCombineMode(DKR_CC_UNK7, DKR_CC_UNK8),
gsDPSetOtherMode(DKR_OMH_2CYC_BILERP, DKR_OML_COMMON | G_RM_FOG_SHADE_A | G_RM_XLU_SURF2),
},
{
{
gsDPSetCombineMode(DKR_CC_UNK7, DKR_CC_UNK8),
gsDPSetOtherMode(DKR_OMH_2CYC_BILERP, DKR_OML_COMMON | G_RM_FOG_SHADE_A | G_RM_AA_XLU_SURF2),
},
@@ -808,7 +808,7 @@ Gfx D_800DF1A8[][2] = {
};
Gfx D_800DF3A8[] = {
gsDPPipeSync(),
gsDPPipeSync(),
gsDPSetTextureLOD(G_TL_TILE),
gsDPSetTextureLUT(G_TT_NONE),
gsDPSetAlphaCompare(G_AC_NONE),
@@ -817,7 +817,7 @@ Gfx D_800DF3A8[] = {
};
Gfx D_800DF3D8[] = {
gsDPPipeSync(),
gsDPPipeSync(),
gsDPSetTextureLOD(G_TL_TILE),
gsDPSetTextureLUT(G_TT_NONE),
gsDPSetAlphaCompare(G_AC_NONE),
@@ -836,14 +836,13 @@ Gfx D_800DF410[][2] = {
gsDPSetOtherMode(DKR_OMH_1CYC_BILERP, DKR_OML_COMMON | G_RM_ZB_CLD_SURF | G_RM_ZB_CLD_SURF2),
},
{
gsDPSetCombineMode(DKR_CC_UNK9, G_CC_PASS2),
gsDPSetCombineMode(DKR_CC_UNK9, G_CC_PASS2),
gsDPSetOtherMode(DKR_OMH_2CYC_BILERP, DKR_OML_COMMON | G_RM_ZB_CLD_SURF | G_RM_ZB_CLD_SURF2),
},
};
/*******************************/
/************ .rodata ************/
const char D_800E7B30[] = "Error: Texture no %x out of range on load. !!\n";
@@ -961,7 +960,7 @@ TextureHeader *load_texture(s32 arg0) {
assetSize = D_80126320[assetTable][assetIndex + 1] - assetOffset;
load_asset_to_address(assetSection, gTempTextureHeader, assetOffset, 0x28);
numberOfTextures = (gTempTextureHeader->header.numOfTextures >> 8) & 0xFFFF;
if (!gTempTextureHeader->header.isCompressed) {
tex = allocate_from_main_pool((numberOfTextures * 0x60) + assetSize, gTexColorTag);
if (tex == NULL) {
@@ -1012,15 +1011,15 @@ TextureHeader *load_texture(s32 arg0) {
}
D_80126344 = 0;
texTemp = tex;
alignedAddress = align16((u8*)((s32)texTemp + assetSize));
for(i = 0; i < numberOfTextures; i++) {
alignedAddress = align16((u8 *)((s32)texTemp + assetSize));
for (i = 0; i < numberOfTextures; i++) {
build_tex_display_list(texTemp, alignedAddress);
if (paletteOffset >= 0) {
texTemp->ciPaletteOffset = paletteOffset;
alignedAddress += 0x30; // I'm guessing it takes 6 f3d commands to load the palette
}
alignedAddress += 0x60; // I'm guessing it takes 12 f3d commands to load the texture
texTemp = (TextureHeader*)((s32)texTemp + texTemp->textureSize);
texTemp = (TextureHeader *)((s32)texTemp + texTemp->textureSize);
}
if (gCiPalettesSize >= 0x280) {
return NULL;
@@ -1040,7 +1039,7 @@ void free_texture(TextureHeader *tex) {
if (tex != NULL) {
tex->numberOfInstances--;
if ((tex->numberOfInstances & 0xFF) <= 0) {
for(i = 0; i < gNumberOfLoadedTextures; i++) {
for (i = 0; i < gNumberOfLoadedTextures; i++) {
if (tex == gTextureCache[i].texture) {
free_from_memory_pool(tex);
gTextureCache[i].id = -1;
@@ -1065,7 +1064,7 @@ TextureHeader *func_8007B380(s32 arg0) {
return 0;
}
// Regalloc issue here
if (gTextureCache[arg0].texture == (TextureHeader*)-1) {
if (gTextureCache[arg0].texture == (TextureHeader *)-1) {
return 0;
}
return gTextureCache[arg0].texture;
@@ -1246,7 +1245,7 @@ void func_8007F1E8(unk8007F1E8 *arg0) {
arg0->unk11 = arg0->unk15;
arg0->unk12 = arg0->unk16;
arg0->unk13 = arg0->unk17;
for(i = 0; i < arg0->unk0; i++) {
for (i = 0; i < arg0->unk0; i++) {
arg0->unkC += arg0->unk18[i].unk0;
}
}
@@ -1266,7 +1265,7 @@ void init_pulsating_light_data(PulsatingLightData *data) {
void update_pulsating_light_data(PulsatingLightData *data, s32 timeDelta) {
s32 thisFrameIndex, nextFrameIndex;
if (data->numberFrames > 1) {
data->time += timeDelta;
while (data->time >= data->totalTime) {
@@ -1284,9 +1283,9 @@ void update_pulsating_light_data(PulsatingLightData *data, s32 timeDelta) {
if (nextFrameIndex >= data->numberFrames) {
nextFrameIndex = 0;
}
data->outColorValue = data->frames[thisFrameIndex].value +
((data->frames[nextFrameIndex].value * data->time) / data->frames[thisFrameIndex].time);
data->outColorValue = data->frames[thisFrameIndex].value +
((data->frames[nextFrameIndex].value * data->time) / data->frames[thisFrameIndex].time);
}
}
+21 -21
View File
@@ -98,14 +98,14 @@ void func_800B6F40(s32 arg0, s32 arg1, s32 arg2) {
#ifdef NON_MATCHING
void func_800B6F50(void) {
s32 i;
// Almost matching, just have an issue with argument 4.
// The -O2 compiler is too smart. :(
osCreateThread(&D_801295E0, 0, thread0_Main, 0, &D_801295E0, 255);
osStartThread(&D_801295E0);
for(i = 0; i < 3; i++) {
for (i = 0; i < 3; i++) {
D_80129FB0[i] = -1;
}
}
@@ -117,14 +117,14 @@ GLOBAL_ASM("asm/non_matchings/thread0_epc/func_800B6F50.s")
void thread0_Main(s32 arg0) { // Has regalloc issues
s32 sp34;
s32 s0 = 0;
osCreateMesgQueue(&D_80129790, &D_801297A8, 8);
osSetEventMesg(12, &D_80129790, 8);
osSetEventMesg(10, &D_80129790, 2);
osCreatePiManager(150, &D_801297E8, &D_801297C8, 8);
while(1) {
while(1) {
while (1) {
while (1) {
osRecvMesg(&D_80129790, &sp34, 1);
if (!(get_filtered_cheats() & CHEAT_EPC_LOCK_UP_DISPLAY)) {
continue;
@@ -146,7 +146,7 @@ GLOBAL_ASM("asm/non_matchings/thread0_epc/thread0_Main.s")
void func_800B70D0(void) {
OSThread *node = __osGetActiveQueue();
while(node->priority != -1) {
while (node->priority != -1) {
if (node->priority == 0) {
node->context.sr &= 0xFFFF00FE;
node->context.sr |= 0x6C01;
@@ -201,7 +201,7 @@ void func_800B7460(s32 *epc, s32 size, s32 mask) {
}
}
func_800766D4(0, -1, &D_800E8EE8, &D_800E8EF0, &sp40, 0x800);
while(1); // Infinite loop; waiting for the player to reset the console?
while (1); // Infinite loop; waiting for the player to reset the console?
}
}
#endif
@@ -219,7 +219,7 @@ s32 func_800B76DC(void) {
u8 *sp420[256];
u8 *sp220[128];
u8 *dataFromControllerPak[128];
if (D_800E3020 != -1) {
return D_800E3020;
} else {
@@ -227,8 +227,7 @@ s32 func_800B76DC(void) {
if ((func_800758DC(controllerIndex) == 0) && //Rumble pack check?
(func_800764E8(controllerIndex, &D_800E8EF4, &D_800E8EFC, &fileNum) == 0) &&
(read_data_from_controller_pak(controllerIndex, fileNum, &dataFromControllerPak,
sizeof(dataFromControllerPak) * MAXCONTROLLERS) == 0))
{
sizeof(dataFromControllerPak) * MAXCONTROLLERS) == 0)) {
bcopy(&dataFromControllerPak, &gEpcInfo, sizeof(dataFromControllerPak) - 80); //Why less 80 (0x50)?
bcopy(&sp220, &D_801299B0, sizeof(sp220));
bcopy(&sp420, &D_80129BB0, sizeof(sp420));
@@ -250,7 +249,6 @@ void func_800B77D4(s32 arg0) {
}
}
#if 1
GLOBAL_ASM("asm/non_matchings/thread0_epc/render_epc_lock_up_display.s")
#else
@@ -262,11 +260,11 @@ void render_epc_lock_up_display(void) {
sp50[0] = D_800E302C[0]; // "setup"
sp50[1] = D_800E302C[1]; // "control"
sp50[2] = D_800E302C[2]; // "print"
s3 = 0;
set_render_printf_position(0x10, 0x20);
switch (D_800E3024) {
case 0:
D_80129FB0[0] = gEpcInfo.unk130;
@@ -278,7 +276,7 @@ void render_epc_lock_up_display(void) {
render_printf(" cause\t\t0x%08x\n", gEpcInfo.cause);
render_printf(" sr\t\t0x%08x\n", gEpcInfo.sr);
render_printf(" badvaddr\t0x%08x\n", gEpcInfo.badvaddr);
for(i = 0; i < 3; i++) {
for (i = 0; i < 3; i++) {
if (D_80129FB0[i] != -1) {
if (s3 == 0) {
s3 = 1;
@@ -301,7 +299,7 @@ void render_epc_lock_up_display(void) {
} else { // gEpcInfo.cause == -1
render_printf(" epc\t\t0x%08x\n", gEpcInfo.epc);
render_printf(" cause\t\tmmAlloc(%d,0x%8x)\n", gEpcInfo.a0, gEpcInfo.a1);
for(i = 0; i < 3; i++) {
for (i = 0; i < 3; i++) {
if (D_80129FB0[i] != -1) {
if (s3 == 0) {
s3 = 1;
@@ -318,8 +316,10 @@ void render_epc_lock_up_display(void) {
break;
default:
for (i = 0; i < 16; i++) {
render_printf(" %08x %08x %08x\n",
D_801299B0[i - 1], D_801299B0[i - 1 + 16], D_801299B0[i - 1 + 32]);
render_printf(" %08x %08x %08x\n",
D_801299B0[i - 1],
D_801299B0[i - 1 + 16],
D_801299B0[i - 1 + 32]);
}
break;
case 4:
+3 -3
View File
@@ -29,7 +29,7 @@ s32 D_8012ACC0[1305]; // Unused? Might be another stack.
// Currently defined in osViMgr.c
// There are a few stacks defined next to each other. Maybe they are in their own separate file?
extern void *gThread30Stack;
extern void *gThread30Stack;
/*****************************/
@@ -99,11 +99,11 @@ s32 set_level_to_load_in_background(s32 levelId, s32 cutsceneId) {
*/
void thread30(void *arg) {
OSMesg mesg = 0;
while(TRUE){
while (TRUE) {
// Wait for a signal from the main thread
do {
osRecvMesg(&gThread30MesgQueue, &mesg, 1);
} while(mesg != (OSMesg)OS_MESG_TYPE_LOOPBACK);
} while (mesg != (OSMesg)OS_MESG_TYPE_LOOPBACK);
// -1 means there won't be any racers loaded.
load_level_for_menu(gThread30LevelIdToLoad, -1, gThread30CutsceneIdToLoad);
gThread30NeedToLoadLevel = FALSE;

Some files were not shown because too many files have changed in this diff Show More