diff --git a/asm/non_matchings/particles/func_800AF134.s b/asm/non_matchings/particles/func_800AF134.s deleted file mode 100644 index d425e215..00000000 --- a/asm/non_matchings/particles/func_800AF134.s +++ /dev/null @@ -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 - diff --git a/generate_ctx.sh b/generate_ctx.sh index d78e9143..24c8afc7 100755 --- a/generate_ctx.sh +++ b/generate_ctx.sh @@ -1,4 +1,4 @@ #!/bin/bash -find include/ src/ lib/ -type f -name "*.h" | sed -e 's/.*/#include "\0"/' > ctx_includes.c +find include/ src/ -type f -name "*.h" | sed -e 's/.*/#include "\0"/' > ctx_includes.c python3 tools/python/m2ctx.py ctx_includes.c diff --git a/include/viint.h b/include/viint.h index 608e16a4..74cee418 100644 --- a/include/viint.h +++ b/include/viint.h @@ -1,6 +1,6 @@ #ifndef _VIINT_H #define _VIINT_H -#include +#include "libultra_internal.h" #define OS_TV_TYPE_PAL 0 #define OS_TV_TYPE_NTSC 1 diff --git a/lib/src/os/viint.h b/lib/src/os/viint.h deleted file mode 100644 index 74cee418..00000000 --- a/lib/src/os/viint.h +++ /dev/null @@ -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 diff --git a/src/particles.c b/src/particles.c index b1a99e39..f383ef7e 100644 --- a/src/particles.c +++ b/src/particles.c @@ -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;