Merge pull request #176 from Ryan-Myers/clang-format-test2

Ran clang format, and manually tweaked results to remove it's bad interpretations
This commit is contained in:
David Benepe
2021-10-28 20:26:43 -04:00
committed by GitHub
47 changed files with 2258 additions and 2477 deletions
+23
View File
@@ -0,0 +1,23 @@
IndentWidth: 4
Language: Cpp
UseTab: Never
ColumnLimit: 0
PointerAlignment: Right
BreakBeforeBraces: Attach
SpaceAfterCStyleCast: false
Cpp11BracedListStyle: false
IndentCaseLabels: true
BinPackArguments: false
BinPackParameters: false
AlignAfterOpenBracket: Align
AlignOperands: true
BreakBeforeTernaryOperators: true
BreakBeforeBinaryOperators: None
AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlignEscapedNewlines: Left
AlignTrailingComments: true
SortIncludes: false
+5
View File
@@ -0,0 +1,5 @@
Checks: '-*,readability-braces-around-statements'
WarningsAsErrors: ''
HeaderFilterRegex: '(src|include)\/.*\.h$'
FormatStyle: 'file'
CheckOptions:
@@ -1,49 +0,0 @@
glabel func_800AF134
/* 0AFD34 800AF134 3C0E800E */ lui $t6, %hi(gParticlesAssetTableCount) # $t6, 0x800e
/* 0AFD38 800AF138 8DCE2CE8 */ lw $t6, %lo(gParticlesAssetTableCount)($t6)
/* 0AFD3C 800AF13C 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0AFD40 800AF140 00CE082A */ slt $at, $a2, $t6
/* 0AFD44 800AF144 AFBF001C */ sw $ra, 0x1c($sp)
/* 0AFD48 800AF148 14200002 */ bnez $at, .L800AF154
/* 0AFD4C 800AF14C AFA7002C */ sw $a3, 0x2c($sp)
/* 0AFD50 800AF150 00003025 */ move $a2, $zero
.L800AF154:
/* 0AFD54 800AF154 3C0F800E */ lui $t7, %hi(gParticleBehaviorsAssetTableCount) # $t7, 0x800e
/* 0AFD58 800AF158 8DEF2CF4 */ lw $t7, %lo(gParticleBehaviorsAssetTableCount)($t7)
/* 0AFD5C 800AF15C 3C18800E */ lui $t8, %hi(gParticleBehaviorsAssetTable) # $t8, 0x800e
/* 0AFD60 800AF160 00AF082A */ slt $at, $a1, $t7
/* 0AFD64 800AF164 14200002 */ bnez $at, .L800AF170
/* 0AFD68 800AF168 00000000 */ nop
/* 0AFD6C 800AF16C 00002825 */ move $a1, $zero
.L800AF170:
/* 0AFD70 800AF170 8F182CFC */ lw $t8, %lo(gParticleBehaviorsAssetTable)($t8)
/* 0AFD74 800AF174 0005C880 */ sll $t9, $a1, 2
/* 0AFD78 800AF178 84890008 */ lh $t1, 8($a0)
/* 0AFD7C 800AF17C 03194021 */ addu $t0, $t8, $t9
/* 0AFD80 800AF180 8D020000 */ lw $v0, ($t0)
/* 0AFD84 800AF184 14C90005 */ bne $a2, $t1, .L800AF19C
/* 0AFD88 800AF188 00000000 */ nop
/* 0AFD8C 800AF18C 8C8A0000 */ lw $t2, ($a0)
/* 0AFD90 800AF190 00000000 */ nop
/* 0AFD94 800AF194 104A000F */ beq $v0, $t2, .L800AF1D4
/* 0AFD98 800AF198 8FBF001C */ lw $ra, 0x1c($sp)
.L800AF19C:
/* 0AFD9C 800AF19C AFA40020 */ sw $a0, 0x20($sp)
/* 0AFDA0 800AF1A0 AFA50024 */ sw $a1, 0x24($sp)
/* 0AFDA4 800AF1A4 0C02C898 */ jal func_800B2260
/* 0AFDA8 800AF1A8 AFA60028 */ sw $a2, 0x28($sp)
/* 0AFDAC 800AF1AC 87AB0032 */ lh $t3, 0x32($sp)
/* 0AFDB0 800AF1B0 87AC0036 */ lh $t4, 0x36($sp)
/* 0AFDB4 800AF1B4 8FA40020 */ lw $a0, 0x20($sp)
/* 0AFDB8 800AF1B8 8FA50024 */ lw $a1, 0x24($sp)
/* 0AFDBC 800AF1BC 8FA60028 */ lw $a2, 0x28($sp)
/* 0AFDC0 800AF1C0 87A7002E */ lh $a3, 0x2e($sp)
/* 0AFDC4 800AF1C4 AFAB0010 */ sw $t3, 0x10($sp)
/* 0AFDC8 800AF1C8 0C02BCA7 */ jal func_800AF29C
/* 0AFDCC 800AF1CC AFAC0014 */ sw $t4, 0x14($sp)
/* 0AFDD0 800AF1D0 8FBF001C */ lw $ra, 0x1c($sp)
.L800AF1D4:
/* 0AFDD4 800AF1D4 27BD0020 */ addiu $sp, $sp, 0x20
/* 0AFDD8 800AF1D8 03E00008 */ jr $ra
/* 0AFDDC 800AF1DC 00000000 */ nop
Executable
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
FORMAT_OPTS="-i -style=file"
TIDY_OPTS="-p . --fix --fix-errors"
COMPILER_OPTS="-fno-builtin -std=gnu90 -Iinclude -Isrc -D_LANGUAGE_C -DNON_MATCHING"
shopt -s globstar
if (( $# > 0 )); then
echo "Formatting file(s) $*"
echo "Running clang-format..."
clang-format-11 ${FORMAT_OPTS} "$@"
echo "Running clang-tidy..."
clang-tidy ${TIDY_OPTS} "$@" -- ${COMPILER_OPTS} &> /dev/null
echo "Adding missing final new lines..."
sed -i -e '$a\' "$@"
echo "Done formatting file(s) $*"
exit
fi
echo "Formatting C files. This will take a bit"
echo "Running clang-format..."
clang-format ${FORMAT_OPTS} src/**/*.c
echo "Running clang-tidy..."
#clang-tidy ${TIDY_OPTS} src/**/*.c -- ${COMPILER_OPTS} &> /dev/null
echo "Adding missing final new lines..."
find src/ -type f -name "*.c" -exec sed -i -e '$a\' {} \;
echo "Done formatting all files."
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef _VIINT_H
#define _VIINT_H
#include <PR/os_internal.h>
#include "libultra_internal.h"
#define OS_TV_TYPE_PAL 0
#define OS_TV_TYPE_NTSC 1
-70
View File
@@ -1,70 +0,0 @@
#ifndef _VIINT_H
#define _VIINT_H
#include "libultra_internal.h"
#define OS_TV_TYPE_PAL 0
#define OS_TV_TYPE_NTSC 1
#define OS_TV_TYPE_MPAL 2
//TODO: figure out what this is
#define VI_STATE_01 0x01
#define VI_STATE_XSCALE_UPDATED 0x02
#define VI_STATE_YSCALE_UPDATED 0x04
#define VI_STATE_08 0x08 //related to control regs changing
#define VI_STATE_10 0x10 //swap buffer
#define VI_STATE_BLACK 0x20 //probably related to a black screen
#define VI_STATE_REPEATLINE 0x40 //repeat line?
#define VI_STATE_FADE 0x80 //fade
#define VI_CTRL_ANTIALIAS_MODE_3 0x00300 /* Bit [9:8] anti-alias mode */
#define VI_CTRL_ANTIALIAS_MODE_2 0x00200 /* Bit [9:8] anti-alias mode */
#define VI_CTRL_ANTIALIAS_MODE_1 0x00100 /* Bit [9:8] anti-alias mode */
#define VI_SCALE_MASK 0xfff //see rcp scale_x/scale_y
#define VI_2_10_FPART_MASK 0x3ff
#define VI_SUBPIXEL_SH 0x10
#define BURST(hsync_width, color_width, vsync_width, color_start) \
(hsync_width | (color_width << 8) | (vsync_width << 16) | (color_start << 20))
#define WIDTH(v) v
#define VSYNC(v) v
#define HSYNC(duration, leap) (duration | (leap << 16))
#define LEAP(upper, lower) ((upper << 16) | lower)
#define START(start, end) ((start << 16) | end)
#define FTOFIX(val, i, f) ((u32)(val * (f32)(1 << f)) & ((1 << (i + f)) - 1))
#define F210(val) FTOFIX(val, 2, 10)
#define SCALE(scaleup, off) (F210((1.0f / (f32)scaleup)) | (F210((f32)off) << 16))
#define VCURRENT(v) v //seemingly unused
#define ORIGIN(v) v
#define VINTR(v) v
#define HSTART START
typedef struct
{
/* 0x0 */ f32 factor;
/* 0x4 */ u16 offset;
/* 0x8 */ u32 scale;
} __OSViScale;
typedef struct
{
/* 0x0 */ u16 state;
/* 0x2 */ u16 retraceCount;
/* 0x4 */ void *framep;
/* 0x8 */ OSViMode *modep;
/* 0xC */ u32 control;
/* 0x10 */ OSMesgQueue *msgq;
/* 0x14 */ OSMesg msg;
/* 0x18 */ __OSViScale x;
/* 0x24 */ __OSViScale y;
} __OSViContext;
void __osViSwapContext(void);
extern __OSViContext *__osViCurr;
extern __OSViContext *__osViNext;
__OSViContext *__osViGetCurrentContext(void);
void __osViInit(void);
#endif
+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
+58 -66
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.
@@ -589,7 +586,7 @@ void func_80066CDC(Gfx **dlist, s32 arg1) {
gScreenViewports[D_80120CE4].upperLeftY,
gScreenViewports[D_80120CE4].lowerRightX,
gScreenViewports[D_80120CE4].lowerRightY
)
);
func_80068158(dlist, 0, 0, 0, 0);
if (arg1 != 0) {
func_80067D3C(dlist, arg1);
@@ -606,14 +603,14 @@ 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) {
phi_t3 = sp58 - 0x12;
}
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_t1, temp_t0)
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_t1, temp_t0);
sp4C = temp_a2;
break;
case VIEWPORTS_COUNT_2_PLAYERS:
@@ -623,19 +620,19 @@ void func_80066CDC(Gfx **dlist, s32 arg1) {
if (osTvType == TV_TYPE_PAL) {
phi_t3 = temp_v0_6 - 0xC;
}
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_t1, (temp_a3 - (temp_t0 >> 7)))
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_t1, (temp_a3 - (temp_t0 >> 7)));
} else {
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, (temp_a3 + (temp_t0 >> 7)), temp_t1, (temp_t0 - (temp_t0 >> 7)))
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, (temp_a3 + (temp_t0 >> 7)), temp_t1, (temp_t0 - (temp_t0 >> 7)));
phi_t3 = temp_a3 + (temp_t0 >> 2);
}
sp4C = temp_a2;
break;
case VIEWPORTS_COUNT_3_PLAYERS:
if (D_80120CE4 == 0) {
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_a2 - (temp_t1 >> 8), temp_t0)
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_a2 - (temp_t1 >> 8), temp_t0);
phi_a1 = temp_t1 >> 2;
} else {
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, temp_a2 + (temp_t1 >> 8), 0, temp_t1 - (temp_t1 >> 8), temp_t0)
gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, temp_a2 + (temp_t1 >> 8), 0, temp_t1 - (temp_t1 >> 8), temp_t0);
phi_a1 = temp_a2 + (temp_t1 >> 2);
}
sp4C = phi_a1;
@@ -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)
fast3d_cmd((*dlist)++, 0x1000040, (u32)(*arg1 + 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,8 +737,8 @@ 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!
fast3d_cmd((*dlist)++, 0x1000040, (u32)(*arg1 + 0x80000000))
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;
D_80120D08 = 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);
}
}
@@ -776,7 +768,7 @@ void func_800682AC(Gfx **dlist) {
height = widthAndHeight >> 0x10;
width = widthAndHeight & 0xFFFF;
if (!(gScreenViewports[D_80120CE4].flags & 1)) {
gDPSetScissor((*dlist)++, G_SC_NON_INTERLACE, 0, 0, width - 1, height - 1)
gDPSetScissor((*dlist)++, G_SC_NON_INTERLACE, 0, 0, width - 1, height - 1);
func_80068158(dlist, width >> 1, height >> 1, width >> 1, height >> 1);
} else {
func_80067A3C(dlist);
@@ -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))
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;
+58 -58
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;
}
@@ -392,10 +392,10 @@ GLOBAL_ASM("asm/non_matchings/fade_transition/func_800C0834.s")
void render_fade_fullscreen(Gfx **dlist, s32 arg1, s32 arg2) {
s32 screenSize = get_video_width_and_height_as_s32();
gSPDisplayList((*dlist)++, D_800E31D8)
gDPSetPrimColor((*dlist)++, 0, 0, gCurFadeRed, gCurFadeGreen, gCurFadeBlue, gCurFadeAlpha)
gDPSetCombineMode((*dlist)++, G_CC_PRIMITIVE, G_CC_PRIMITIVE)
gDPFillRectangle((*dlist)++, 0, 0, screenSize & 0x3FF, (screenSize >> 16) & 0x3FF)
gSPDisplayList((*dlist)++, D_800E31D8);
gDPSetPrimColor((*dlist)++, 0, 0, gCurFadeRed, gCurFadeGreen, gCurFadeBlue, gCurFadeAlpha);
gDPSetCombineMode((*dlist)++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gDPFillRectangle((*dlist)++, 0, 0, screenSize & 0x3FF, (screenSize >> 16) & 0x3FF);
func_8007B3D0(dlist);
}
@@ -404,20 +404,20 @@ GLOBAL_ASM("asm/non_matchings/fade_transition/func_800C1130.s")
void render_fade_barndoor_horizontal(Gfx **dlist, s32 arg1, s32 arg2) {
func_8007B3D0(dlist);
gSPDisplayList((*dlist)++, D_800E3648)
gSPDisplayList((*dlist)++, D_800E3648);
// TODO: Need to clean this up.
gDkrVertices((*dlist)++, (s32)D_800E31C0[D_800E31D0[0]] + 0x80000000, (((s32)D_800E31C0[D_800E31D0[0]] + 0x80000000) & 6) | 0x58, 0x70)
gDkrTriangles((*dlist)++, (s32)D_800E31C8[D_800E31D0[0]] + 0x80000000, 8, TRIN_DISABLE_TEXTURE)
gDkrVertices((*dlist)++, (s32)D_800E31C0[D_800E31D0[0]] + 0x80000000, (((s32)D_800E31C0[D_800E31D0[0]] + 0x80000000) & 6) | 0x58, 0x70);
gDkrTriangles((*dlist)++, (s32)D_800E31C8[D_800E31D0[0]] + 0x80000000, 8, TRIN_DISABLE_TEXTURE);
func_8007B3D0(dlist);
}
// This is exactly the same as render_fade_barndoor_horizontal; I wonder what gets changed then?
void render_fade_barndoor_vertical(Gfx **dlist, s32 arg1, s32 arg2) {
func_8007B3D0(dlist);
gSPDisplayList((*dlist)++, D_800E3648)
gSPDisplayList((*dlist)++, D_800E3648);
// TODO: Need to clean this up.
gDkrVertices((*dlist)++, (s32)D_800E31C0[D_800E31D0[0]] + 0x80000000, (((s32)D_800E31C0[D_800E31D0[0]] + 0x80000000) & 6) | 0x58, 0x70)
gDkrTriangles((*dlist)++, (s32)D_800E31C8[D_800E31D0[0]] + 0x80000000, 8, TRIN_DISABLE_TEXTURE)
gDkrVertices((*dlist)++, (s32)D_800E31C0[D_800E31D0[0]] + 0x80000000, (((s32)D_800E31C0[D_800E31D0[0]] + 0x80000000) & 6) | 0x58, 0x70);
gDkrTriangles((*dlist)++, (s32)D_800E31C8[D_800E31D0[0]] + 0x80000000, 8, TRIN_DISABLE_TEXTURE);
func_8007B3D0(dlist);
}
@@ -428,23 +428,23 @@ GLOBAL_ASM("asm/non_matchings/fade_transition/func_800C1EE8.s")
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);
gSPDisplayList((*dlist)++, D_800E3648);
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)
gDkrVertices((*dlist)++, (s32)addr, ((s32)addr & 6) | 0x88, 0xA6);
gDkrTriangles((*dlist)++, (s32)addr2, 16, TRIN_DISABLE_TEXTURE);
addr += 0xB4;
addr2 += 0x100;
gDkrVertices((*dlist)++, (s32)addr, ((s32)addr & 6) | 0x88, 0xA6)
gDkrTriangles((*dlist)++, (s32)addr2, 16, TRIN_DISABLE_TEXTURE)
gDkrVertices((*dlist)++, (s32)addr, ((s32)addr & 6) | 0x88, 0xA6);
gDkrTriangles((*dlist)++, (s32)addr2, 16, TRIN_DISABLE_TEXTURE);
addr += 0xB4;
addr2 += 0x100;
gDkrVertices((*dlist)++, (s32)addr, ((s32)addr & 6) | 0x88, 0xA6)
gDkrTriangles((*dlist)++, (s32)addr2, 16, TRIN_DISABLE_TEXTURE)
gDkrVertices((*dlist)++, (s32)addr, ((s32)addr & 6) | 0x88, 0xA6);
gDkrTriangles((*dlist)++, (s32)addr2, 16, TRIN_DISABLE_TEXTURE);
addr += 0xB4;
addr2 += 0x100;
gDkrVertices((*dlist)++, (s32)addr, ((s32)addr & 6) | 0x88, 0xA6)
gDkrTriangles((*dlist)++, (s32)addr2, 16, TRIN_DISABLE_TEXTURE)
gDkrVertices((*dlist)++, (s32)addr, ((s32)addr & 6) | 0x88, 0xA6);
gDkrTriangles((*dlist)++, (s32)addr2, 16, TRIN_DISABLE_TEXTURE);
func_8007B3D0(dlist);
}
#else
@@ -455,15 +455,15 @@ GLOBAL_ASM("asm/non_matchings/fade_transition/render_fade_circle.s")
void render_fade_waves(Gfx **dlist, s32 arg1, s32 arg2) {
s32 i;
func_8007B3D0(dlist);
gSPDisplayList((*dlist)++, D_800E3648)
gSPDisplayList((*dlist)++, D_800E3648);
for(i = 0; i < 6; i++) {
s32 index = D_800E31D0[0] + i;
if(i != 1 && i != 4) {
gDkrVertices((*dlist)++, (s32)D_800E31C0[index] + 0x80000000, (((s32)D_800E31C0[index] + 0x80000000) & 6) | 0x78, 0x94)
gDkrTriangles((*dlist)++, (s32)D_800E31C8[index] + 0x80000000, 14, TRIN_DISABLE_TEXTURE)
gDkrVertices((*dlist)++, (s32)D_800E31C0[index] + 0x80000000, (((s32)D_800E31C0[index] + 0x80000000) & 6) | 0x78, 0x94);
gDkrTriangles((*dlist)++, (s32)D_800E31C8[index] + 0x80000000, 14, TRIN_DISABLE_TEXTURE);
} else {
gDkrVertices((*dlist)++, (s32)D_800E31C0[index] + 0x80000000, (((s32)D_800E31C0[index] + 0x80000000) & 6) | 0x68, 0x82)
gDkrTriangles((*dlist)++, (s32)D_800E31C8[index] + 0x80000000, 12, TRIN_DISABLE_TEXTURE)
gDkrVertices((*dlist)++, (s32)D_800E31C0[index] + 0x80000000, (((s32)D_800E31C0[index] + 0x80000000) & 6) | 0x68, 0x82);
gDkrTriangles((*dlist)++, (s32)D_800E31C8[index] + 0x80000000, 12, TRIN_DISABLE_TEXTURE);
}
}
func_8007B3D0(dlist);
@@ -474,10 +474,10 @@ GLOBAL_ASM("asm/non_matchings/fade_transition/render_fade_waves.s")
void render_fade_barndoor_diagonal(Gfx **dlist, s32 arg1, s32 arg2) {
func_8007B3D0(dlist);
gSPDisplayList((*dlist)++, D_800E3648)
gSPDisplayList((*dlist)++, D_800E3648);
// TODO: Need to clean this up.
gDkrVertices((*dlist)++, (s32)D_800E31C0[D_800E31D0[0]] + 0x80000000, (((s32)D_800E31C0[D_800E31D0[0]] + 0x80000000) & 6) | 0x48, 0x5E)
gDkrTriangles((*dlist)++, (s32)D_800E31C8[D_800E31D0[0]] + 0x80000000, 6, TRIN_DISABLE_TEXTURE)
gDkrVertices((*dlist)++, (s32)D_800E31C0[D_800E31D0[0]] + 0x80000000, (((s32)D_800E31C0[D_800E31D0[0]] + 0x80000000) & 6) | 0x48, 0x5E);
gDkrTriangles((*dlist)++, (s32)D_800E31C8[D_800E31D0[0]] + 0x80000000, 6, TRIN_DISABLE_TEXTURE);
func_8007B3D0(dlist);
}
@@ -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
@@ -515,9 +515,9 @@ GLOBAL_ASM("asm/non_matchings/fade_transition/func_800C27A0.s")
void render_fade_disabled(Gfx **dlist, s32 arg1, s32 arg2) {
s32 screenSize = get_video_width_and_height_as_s32();
gSPDisplayList((*dlist)++, D_800E31D8)
gDPSetPrimColor((*dlist)++, 0, 0, (gLastFadeRed >> 16), (gLastFadeGreen >> 16), (gLastFadeBlue >> 16), 255)
gDPSetCombineMode((*dlist)++, G_CC_PRIMITIVE, G_CC_PRIMITIVE)
gDPFillRectangle((*dlist)++, 0, 0, screenSize & 0x3FF, (screenSize >> 16) & 0x3FF)
gSPDisplayList((*dlist)++, D_800E31D8);
gDPSetPrimColor((*dlist)++, 0, 0, (gLastFadeRed >> 16), (gLastFadeGreen >> 16), (gLastFadeBlue >> 16), 255);
gDPSetCombineMode((*dlist)++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gDPFillRectangle((*dlist)++, 0, 0, screenSize & 0x3FF, (screenSize >> 16) & 0x3FF);
func_8007B3D0(dlist);
}
+59 -52
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,13 +587,13 @@ 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)
gDPSetEnvColor((*dlist)++, 0, 0, 0, 0)
gSPDisplayList((*dlist)++, &D_800E3690);
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);
} else {
@@ -595,8 +602,8 @@ void func_800C5B58(Gfx **dlist, s32 *arg1, s32 *arg2, s32 arg3) {
render_fill_rectangle(dlist, temp->unk8 - 2, temp->unk6 + 2, temp->unk8 + 2, temp->unkA - 2);
render_fill_rectangle(dlist, temp->unk4 - 2, temp->unkA - 2, temp->unk8 + 2, temp->unkA + 2);
}
gDPPipeSync((*dlist)++)
gDPSetEnvColor((*dlist)++, temp->unk10, temp->unk11, temp->unk12, temp->unk13)
gDPPipeSync((*dlist)++);
gDPSetEnvColor((*dlist)++, temp->unk10, temp->unk11, temp->unk12, temp->unk13);
for (i = 0; D_800E3710[i] >= 0; i += 5) {
x0 = D_800E3710[i] + temp->unk4;
y0 = (D_800E3710[i + 1]) ? D_800E3710[i + 2] + temp->unkA : D_800E3710[i + 2] + temp->unk6;
@@ -604,7 +611,7 @@ void func_800C5B58(Gfx **dlist, s32 *arg1, s32 *arg2, s32 arg3) {
y1 = (D_800E3710[i + 3]) ? D_800E3710[i + 4] + temp->unkA : D_800E3710[i + 4] + temp->unk6;
render_fill_rectangle(dlist, x0, y0, x1, y1);
}
gDPPipeSync((*dlist)++)
gDPPipeSync((*dlist)++);
}
if (arg1 != NULL && arg2 != NULL) {
if (!D_800E36E8) {
+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.
}
}
+738 -792
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();
+43 -48
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;
@@ -451,25 +451,20 @@ void func_800AF0F0(Object *obj) {
temp_v1->unk1C = temp_t8;
}
#ifdef NON_MATCHING
void func_800AF134(unk800B2260 *arg0, s32 arg1, s32 arg2, s16 arg3, s16 arg4, s16 arg5) {
ParticleBehavior *temp;
if (arg2 >= gParticlesAssetTableCount) {
arg2 = 0;
}
if (arg1 >= gParticleBehaviorsAssetTableCount) {
arg1 = 0;
}
// Minor issue with these if statements.
if (arg0->unk8 == arg2) {
if(arg0->unk0 != gParticleBehaviorsAssetTable[arg1]) {
func_800B2260(arg0);
func_800AF29C(arg0, arg1, arg2, arg3, arg4, arg5);
}
temp = gParticleBehaviorsAssetTable[arg1];
if ((arg0->unk8 != arg2) || (temp != arg0->unk0)) {
func_800B2260(arg0);
func_800AF29C(arg0, arg1, arg2, arg3, arg4, arg5);
}
}
#else
GLOBAL_ASM("asm/non_matchings/particles/func_800AF134.s")
#endif
void func_800AF1E0(unk800AF29C *arg0, s32 arg1, s32 arg2) {
ParticleBehavior *temp_v0;
@@ -484,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;
@@ -492,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;
@@ -510,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;
@@ -531,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;
@@ -554,7 +549,7 @@ void func_800AF6E4(Object *obj, s32 arg1) {
Object_6C *obj6C;
obj6C = &obj->unk6C[arg1];
obj6C->unk4 &= 0x7FFF;
obj->unk1A--;
}
@@ -573,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++) {
@@ -595,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;
}

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