From ea882fb46d55916c60667fc73823a3437a7c8d40 Mon Sep 17 00:00:00 2001 From: Random <28494085+Random0666@users.noreply.github.com> Date: Sat, 21 Mar 2020 19:09:05 +0100 Subject: [PATCH 1/2] Decompiled code_800ACE70.c `code_800ACE70` : OK --- asm/code_800ACE70.s | 121 -------------------------------------- data/code_800ACE70.data.s | 20 ------- include/variables.h | 4 -- spec | 3 +- src/code/code_800ACE70.c | 109 ++++++++++++++++++++++++++++++++++ 5 files changed, 110 insertions(+), 147 deletions(-) delete mode 100644 asm/code_800ACE70.s delete mode 100644 data/code_800ACE70.data.s create mode 100644 src/code/code_800ACE70.c diff --git a/asm/code_800ACE70.s b/asm/code_800ACE70.s deleted file mode 100644 index 0aa384aba7..0000000000 --- a/asm/code_800ACE70.s +++ /dev/null @@ -1,121 +0,0 @@ -.include "macro.inc" - -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 # allow use of 64-bit general purposee registers - -.section .text - -.align 4 - -glabel func_800ACE70 -/* B24010 800ACE70 240200FF */ li $v0, 255 -/* B24014 800ACE74 AC800000 */ sw $zero, ($a0) -/* B24018 800ACE78 AC800004 */ sw $zero, 4($a0) -/* B2401C 800ACE7C A0820008 */ sb $v0, 8($a0) -/* B24020 800ACE80 A0820009 */ sb $v0, 9($a0) -/* B24024 800ACE84 A082000A */ sb $v0, 0xa($a0) -/* B24028 800ACE88 03E00008 */ jr $ra -/* B2402C 800ACE8C A082000B */ sb $v0, 0xb($a0) - -glabel func_800ACE90 -/* B24030 800ACE90 03E00008 */ jr $ra -/* B24034 800ACE94 AFA40000 */ sw $a0, ($sp) - -glabel func_800ACE98 -/* B24038 800ACE98 8CA20000 */ lw $v0, ($a1) -/* B2403C 800ACE9C 00803025 */ move $a2, $a0 -/* B24040 800ACEA0 3C03E700 */ lui $v1, 0xe700 -/* B24044 800ACEA4 00402025 */ move $a0, $v0 -/* B24048 800ACEA8 AC830000 */ sw $v1, ($a0) -/* B2404C 800ACEAC AC800004 */ sw $zero, 4($a0) -/* B24050 800ACEB0 24420008 */ addiu $v0, $v0, 8 -/* B24054 800ACEB4 00402025 */ move $a0, $v0 -/* B24058 800ACEB8 3C0EEE00 */ lui $t6, 0xee00 -/* B2405C 800ACEBC 240FFFFF */ li $t7, -1 -/* B24060 800ACEC0 AC8F0004 */ sw $t7, 4($a0) -/* B24064 800ACEC4 AC8E0000 */ sw $t6, ($a0) -/* B24068 800ACEC8 8CD80004 */ lw $t8, 4($a2) -/* B2406C 800ACECC 24420008 */ addiu $v0, $v0, 8 -/* B24070 800ACED0 24070001 */ li $a3, 1 -/* B24074 800ACED4 14F80007 */ bne $a3, $t8, .L800ACEF4 -/* B24078 800ACED8 00402025 */ move $a0, $v0 -/* B2407C 800ACEDC 3C080050 */ lui $t0, (0x005003C0 >> 16) # lui $t0, 0x50 -/* B24080 800ACEE0 350803C0 */ ori $t0, (0x005003C0 & 0xFFFF) # ori $t0, $t0, 0x3c0 -/* B24084 800ACEE4 3C19ED00 */ lui $t9, 0xed00 -/* B24088 800ACEE8 AC990000 */ sw $t9, ($a0) -/* B2408C 800ACEEC AC880004 */ sw $t0, 4($a0) -/* B24090 800ACEF0 24420008 */ addiu $v0, $v0, 8 -.L800ACEF4: -/* B24094 800ACEF4 8CC40000 */ lw $a0, ($a2) -/* B24098 800ACEF8 3C0A8013 */ lui $t2, %hi(D_8012AC40) # $t2, 0x8013 -/* B2409C 800ACEFC 254AAC40 */ addiu $t2, %lo(D_8012AC40) # addiu $t2, $t2, -0x53c0 -/* B240A0 800ACF00 1087000C */ beq $a0, $a3, .L800ACF34 -/* B240A4 800ACF04 3C09DE00 */ lui $t1, 0xde00 -/* B240A8 800ACF08 24010002 */ li $at, 2 -/* B240AC 800ACF0C 1081000E */ beq $a0, $at, .L800ACF48 -/* B240B0 800ACF10 3C0BFA00 */ lui $t3, 0xfa00 -/* B240B4 800ACF14 24010003 */ li $at, 3 -/* B240B8 800ACF18 10810018 */ beq $a0, $at, .L800ACF7C -/* B240BC 800ACF1C 3C0FF900 */ lui $t7, 0xf900 -/* B240C0 800ACF20 24010004 */ li $at, 4 -/* B240C4 800ACF24 10810022 */ beq $a0, $at, .L800ACFB0 -/* B240C8 800ACF28 3C09F800 */ lui $t1, 0xf800 -/* B240CC 800ACF2C 1000002D */ b .L800ACFE4 -/* B240D0 800ACF30 00402025 */ move $a0, $v0 -.L800ACF34: -/* B240D4 800ACF34 00402025 */ move $a0, $v0 -/* B240D8 800ACF38 AC890000 */ sw $t1, ($a0) -/* B240DC 800ACF3C AC8A0004 */ sw $t2, 4($a0) -/* B240E0 800ACF40 10000027 */ b .L800ACFE0 -/* B240E4 800ACF44 24420008 */ addiu $v0, $v0, 8 -.L800ACF48: -/* B240E8 800ACF48 00402025 */ move $a0, $v0 -/* B240EC 800ACF4C AC8B0000 */ sw $t3, ($a0) -/* B240F0 800ACF50 8CCC0008 */ lw $t4, 8($a2) -/* B240F4 800ACF54 24420008 */ addiu $v0, $v0, 8 -/* B240F8 800ACF58 3C0E8013 */ lui $t6, %hi(D_8012AC58) # $t6, 0x8013 -/* B240FC 800ACF5C AC8C0004 */ sw $t4, 4($a0) -/* B24100 800ACF60 00402025 */ move $a0, $v0 -/* B24104 800ACF64 25CEAC58 */ addiu $t6, %lo(D_8012AC58) # addiu $t6, $t6, -0x53a8 -/* B24108 800ACF68 3C0DDE00 */ lui $t5, 0xde00 -/* B2410C 800ACF6C AC8D0000 */ sw $t5, ($a0) -/* B24110 800ACF70 AC8E0004 */ sw $t6, 4($a0) -/* B24114 800ACF74 1000001A */ b .L800ACFE0 -/* B24118 800ACF78 24420008 */ addiu $v0, $v0, 8 -.L800ACF7C: -/* B2411C 800ACF7C 00402025 */ move $a0, $v0 -/* B24120 800ACF80 AC8F0000 */ sw $t7, ($a0) -/* B24124 800ACF84 8CD80008 */ lw $t8, 8($a2) -/* B24128 800ACF88 24420008 */ addiu $v0, $v0, 8 -/* B2412C 800ACF8C 3C088013 */ lui $t0, %hi(D_8012AC00) # $t0, 0x8013 -/* B24130 800ACF90 AC980004 */ sw $t8, 4($a0) -/* B24134 800ACF94 00402025 */ move $a0, $v0 -/* B24138 800ACF98 2508AC00 */ addiu $t0, %lo(D_8012AC00) # addiu $t0, $t0, -0x5400 -/* B2413C 800ACF9C 3C19DE00 */ lui $t9, 0xde00 -/* B24140 800ACFA0 AC990000 */ sw $t9, ($a0) -/* B24144 800ACFA4 AC880004 */ sw $t0, 4($a0) -/* B24148 800ACFA8 1000000D */ b .L800ACFE0 -/* B2414C 800ACFAC 24420008 */ addiu $v0, $v0, 8 -.L800ACFB0: -/* B24150 800ACFB0 00402025 */ move $a0, $v0 -/* B24154 800ACFB4 AC890000 */ sw $t1, ($a0) -/* B24158 800ACFB8 8CCA0008 */ lw $t2, 8($a2) -/* B2415C 800ACFBC 24420008 */ addiu $v0, $v0, 8 -/* B24160 800ACFC0 3C0C8013 */ lui $t4, %hi(D_8012AC28) # $t4, 0x8013 -/* B24164 800ACFC4 AC8A0004 */ sw $t2, 4($a0) -/* B24168 800ACFC8 00402025 */ move $a0, $v0 -/* B2416C 800ACFCC 258CAC28 */ addiu $t4, %lo(D_8012AC28) # addiu $t4, $t4, -0x53d8 -/* B24170 800ACFD0 3C0BDE00 */ lui $t3, 0xde00 -/* B24174 800ACFD4 AC8B0000 */ sw $t3, ($a0) -/* B24178 800ACFD8 AC8C0004 */ sw $t4, 4($a0) -/* B2417C 800ACFDC 24420008 */ addiu $v0, $v0, 8 -.L800ACFE0: -/* B24180 800ACFE0 00402025 */ move $a0, $v0 -.L800ACFE4: -/* B24184 800ACFE4 AC830000 */ sw $v1, ($a0) -/* B24188 800ACFE8 AC800004 */ sw $zero, 4($a0) -/* B2418C 800ACFEC 24420008 */ addiu $v0, $v0, 8 -/* B24190 800ACFF0 03E00008 */ jr $ra -/* B24194 800ACFF4 ACA20000 */ sw $v0, ($a1) diff --git a/data/code_800ACE70.data.s b/data/code_800ACE70.data.s deleted file mode 100644 index f3e9e74c73..0000000000 --- a/data/code_800ACE70.data.s +++ /dev/null @@ -1,20 +0,0 @@ -.include "macro.inc" - -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 # allow use of 64-bit general purposee registers - -.section .data - -glabel D_8012AC00 - .incbin "baserom.z64", 0xBA1DA0, 0x28 - -glabel D_8012AC28 - .incbin "baserom.z64", 0xBA1DC8, 0x18 - -glabel D_8012AC40 - .incbin "baserom.z64", 0xBA1DE0, 0x18 - -glabel D_8012AC58 - .incbin "baserom.z64", 0xBA1DF8, 0x38 diff --git a/include/variables.h b/include/variables.h index b12c078d56..64c5d20761 100644 --- a/include/variables.h +++ b/include/variables.h @@ -565,10 +565,6 @@ extern Scene gSceneTable[110]; extern u8 gLetterTLUT[4][32]; // original name: "moji_tlut" extern u8 gFontFF[]; // original name: "font_ff" //extern ? D_8012ABF0; -//extern ? D_8012AC00; -//extern ? D_8012AC28; -//extern ? D_8012AC40; -//extern ? D_8012AC58; //extern ? D_8012AC90; //extern ? D_8012ACA0; //extern ? D_8012AD20; diff --git a/spec b/spec index 8c6f404508..379b4b9f22 100644 --- a/spec +++ b/spec @@ -383,8 +383,7 @@ beginseg include "build/src/code/z_view.o" include "build/data/z_view.data.o" include "build/src/code/z_vimode.o" - include "build/asm/code_800ACE70.o" - include "build/data/code_800ACE70.data.o" + include "build/src/code/code_800ACE70.o" include "build/src/code/z_vismono.o" include "build/asm/code_800AD920.o" include "build/src/code/z_vr_box.o" diff --git a/src/code/code_800ACE70.c b/src/code/code_800ACE70.c new file mode 100644 index 0000000000..d7a50a1574 --- /dev/null +++ b/src/code/code_800ACE70.c @@ -0,0 +1,109 @@ +#include + +typedef struct +{ + /* 0x00 */ u32 type; + /* 0x04 */ u32 setScissor; + /* 0x08 */ union + { + Color_RGBA8 c; + u32 rgba; + } color; + /* 0x0C */ u32 unk_0C; +} struct_801664F0; + +Gwords D_8012AC00[] = +{ + gsDPSetOtherMode(0, G_RM_VISCVG | G_RM_VISCVG2 | G_ZS_PRIM), + gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), + gsDPPipeSync(), + gsDPSetBlendColor(0, 0, 0, 8), + gsSPEndDisplayList(), +}; + +Gwords D_8012AC28[] = +{ + gsDPSetOtherMode(0, GBL_c1(3, 1, 1, 1) | GBL_c2(3, 1, 1, 1) | IM_RD | FORCE_BL | G_ZS_PRIM), + gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), + gsSPEndDisplayList(), +}; + +Gwords D_8012AC40[] = +{ + gsDPSetOtherMode(0, GBL_c1(0, 3, 1, 1) | GBL_c2(0, 3, 1, 1) | IM_RD | FORCE_BL | G_ZS_PRIM), + gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), + gsSPEndDisplayList(), +}; + +Gwords D_8012AC58[] = +{ + gsDPSetCombineLERP(K5, K5, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, K5, K5, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE), + gsDPSetOtherMode(G_CD_DISABLE | G_AD_NOTPATTERN, G_ZS_PRIM | IM_RD | CVG_DST_WRAP | CVG_DST_FULL | FORCE_BL | GBL_c1(0, 0, 1, 0) | GBL_c2(0, 0, 1, 0)), + gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), + gsDPSetOtherMode(0, GBL_c1(0, 3, 1, 1) | GBL_c2(0, 3, 1, 1) | IM_RD | FORCE_BL | G_ZS_PRIM), + gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), + gsSPEndDisplayList(), +}; + +//Init func +void func_800ACE70(struct_801664F0* this) +{ + this->type = 0; + this->setScissor = false; + this->color.c.r = 0xFF; + this->color.c.g = 0xFF; + this->color.c.b = 0xFF; + this->color.c.a = 0xFF; +} + +//Destroy func +void func_800ACE90(struct_801664F0* this) +{ + +} + +//Update func +void func_800ACE98(struct_801664F0* this, Gfx** gfxp) +{ + Gfx* gfx; + + gfx = *gfxp; + + gDPPipeSync(gfx++); + gDPSetPrimDepth(gfx++, -1, -1); + + if (this->setScissor == true) + { + gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + } + + switch(this->type) + { + case 1: + { + gSPDisplayList(gfx++, D_8012AC40); + break; + } + case 2: + { + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba); + gSPDisplayList(gfx++, D_8012AC58); + break; + } + case 3: + { + gDPSetColor(gfx++, G_SETBLENDCOLOR, this->color.rgba); + gSPDisplayList(gfx++, D_8012AC00); + break; + } + case 4: + { + gDPSetColor(gfx++, G_SETFOGCOLOR, this->color.rgba); + gSPDisplayList(gfx++, D_8012AC28); + break; + } + } + + gDPPipeSync(gfx++); + *gfxp = gfx; +} From ec8889dc63ebcf89d63360cf078570f2b166f7c4 Mon Sep 17 00:00:00 2001 From: Random <28494085+Random0666@users.noreply.github.com> Date: Sat, 21 Mar 2020 21:40:18 +0100 Subject: [PATCH 2/2] Changes in PR #19 - Replaced old `gsDPSetOtherMode`s with gfxdis' output - Replaced `Gwords` with `Gfx` --- src/code/code_800ACE70.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/code/code_800ACE70.c b/src/code/code_800ACE70.c index d7a50a1574..9f606cffac 100644 --- a/src/code/code_800ACE70.c +++ b/src/code/code_800ACE70.c @@ -12,35 +12,57 @@ typedef struct /* 0x0C */ u32 unk_0C; } struct_801664F0; -Gwords D_8012AC00[] = +Gfx D_8012AC00[] = { - gsDPSetOtherMode(0, G_RM_VISCVG | G_RM_VISCVG2 | G_ZS_PRIM), + gsDPSetOtherMode( + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | + G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2), gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), gsDPPipeSync(), gsDPSetBlendColor(0, 0, 0, 8), gsSPEndDisplayList(), }; -Gwords D_8012AC28[] = +Gfx D_8012AC28[] = { - gsDPSetOtherMode(0, GBL_c1(3, 1, 1, 1) | GBL_c2(3, 1, 1, 1) | IM_RD | FORCE_BL | G_ZS_PRIM), + gsDPSetOtherMode( + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | + G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG,G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)), gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), gsSPEndDisplayList(), }; -Gwords D_8012AC40[] = +Gfx D_8012AC40[] = { - gsDPSetOtherMode(0, GBL_c1(0, 3, 1, 1) | GBL_c2(0, 3, 1, 1) | IM_RD | FORCE_BL | G_ZS_PRIM), + gsDPSetOtherMode( + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | + G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), + gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), gsSPEndDisplayList(), }; -Gwords D_8012AC58[] = +Gfx D_8012AC58[] = { gsDPSetCombineLERP(K5, K5, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, K5, K5, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE), - gsDPSetOtherMode(G_CD_DISABLE | G_AD_NOTPATTERN, G_ZS_PRIM | IM_RD | CVG_DST_WRAP | CVG_DST_FULL | FORCE_BL | GBL_c1(0, 0, 1, 0) | GBL_c2(0, 0, 1, 0)), + gsDPSetOtherMode( + G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | + G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2), gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), - gsDPSetOtherMode(0, GBL_c1(0, 3, 1, 1) | GBL_c2(0, 3, 1, 1) | IM_RD | FORCE_BL | G_ZS_PRIM), + gsDPSetOtherMode( + G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | + G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), gsSPEndDisplayList(), };