diff --git a/include/PR/gbi.h b/include/PR/gbi.h index 632ca3cafc..5cfe317852 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -2599,11 +2599,11 @@ _DW({ \ gsSPLoadUcodeEx((uc_start), (uc_dstart), SP_UCODE_DATA_SIZE) #define gSPLoadUcodeL(pkt, ucode) \ - gSPLoadUcode((pkt), OS_K0_TO_PHYSICAL(&##ucode##TextStart), \ - OS_K0_TO_PHYSICAL(&##ucode##DataStart)) + gSPLoadUcode((pkt), OS_K0_TO_PHYSICAL(&ucode##TextStart), \ + OS_K0_TO_PHYSICAL(&ucode##DataStart)) #define gsSPLoadUcodeL(ucode) \ - gsSPLoadUcode(OS_K0_TO_PHYSICAL(&##ucode##TextStart), \ - OS_K0_TO_PHYSICAL(&##ucode##DataStart)) + gsSPLoadUcode(OS_K0_TO_PHYSICAL(&ucode##TextStart), \ + OS_K0_TO_PHYSICAL(&ucode##DataStart)) #endif #ifdef F3DEX_GBI_2 diff --git a/include/color.h b/include/color.h index b0b4d2cb0d..d0cdb62f58 100644 --- a/include/color.h +++ b/include/color.h @@ -51,4 +51,6 @@ typedef union { u16 rgba; } Color_RGBA16; +#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0)) + #endif diff --git a/include/functions.h b/include/functions.h index bd8e09181d..1287431cef 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2168,7 +2168,7 @@ void func_80140E80(void* param_1); // void func_80140EA0(void); // void func_80140EAC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_80141008(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); -// void func_8014116C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); +void func_8014116C(Gfx** gfxP, u16* arg1, u16* arg2, s32 width, s32 height, s32 arg5); // void func_801411B4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); // void func_80141200(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_8014151C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); diff --git a/include/ultra64.h b/include/ultra64.h index 6ffb26ff68..ad2bc24633 100644 --- a/include/ultra64.h +++ b/include/ultra64.h @@ -14,6 +14,7 @@ #include "ultra64/rdp.h" #include "ultra64/rsp.h" #include "ultra64/r4300.h" +#include "ultra64/ucode.h" #include "ultra64/vi.h" #endif diff --git a/include/ultra64/ucode.h b/include/ultra64/ucode.h new file mode 100644 index 0000000000..8a1d89037e --- /dev/null +++ b/include/ultra64/ucode.h @@ -0,0 +1,31 @@ +#ifndef ULTRA64_UCODE_H +#define ULTRA64_UCODE_H + +#include "PR/ultratypes.h" + +#define SP_DRAM_STACK_SIZE8 0x400 +#define SP_DRAM_STACK_SIZE64 (SP_DRAM_STACK_SIZE8 >> 3) + +#define SP_UCODE_SIZE 0x1000 + +#define SP_UCODE_DATA_SIZE 0x800 + +extern u64 rspbootTextStart[]; +extern u64 rspbootTextEnd[]; + +extern u64 aspMainTextStart[]; +extern u64 aspMainTextEnd[]; +extern u64 aspMainDataStart[]; +extern u64 aspMainDataEnd[]; + +extern u64 gspF3DZEX2_NoN_PosLight_fifoTextStart[]; +extern u64 gspF3DZEX2_NoN_PosLight_fifoTextEnd[]; +extern u64 gspF3DZEX2_NoN_PosLight_fifoDataStart[]; +extern u64 gspF3DZEX2_NoN_PosLight_fifoDataEnd[]; + +extern u64 gspS2DEX2_fifoTextStart[]; +extern u64 gspS2DEX2_fifoTextEnd[]; +extern u64 gspS2DEX2_fifoDataStart[]; +extern u64 gspS2DEX2_fifoDataEnd[]; + +#endif diff --git a/spec b/spec index 9441dc0112..d9ebf99cee 100644 --- a/spec +++ b/spec @@ -3237,8 +3237,7 @@ beginseg name "ovl_fbdemo_wipe5" compress include "build/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.o" - include "build/data/ovl_fbdemo_wipe5/ovl_fbdemo_wipe5.data.o" - include "build/data/ovl_fbdemo_wipe5/ovl_fbdemo_wipe5.reloc.o" + include "build/src/overlays/fbdemos/ovl_fbdemo_wipe5/ovl_fbdemo_wipe5_reloc.o" endseg beginseg diff --git a/src/code/graph.c b/src/code/graph.c index 869740e4b3..8edc979d46 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -174,8 +174,8 @@ retry: task->ucodeBootSize = SysUcode_GetUCodeBootSize(); task->ucode = SysUcode_GetUCode(); task->ucodeData = SysUcode_GetUCodeData(); - task->ucodeSize = 0x1000; - task->ucodeDataSize = 0x800; + task->ucodeSize = SP_UCODE_SIZE; + task->ucodeDataSize = SP_UCODE_DATA_SIZE; task->dramStack = (u64*)gGfxSPTaskStack; task->dramStackSize = sizeof(gGfxSPTaskStack); task->outputBuff = gGfxSPTaskOutputBufferPtr; diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 7b9254ccd3..ad592a40ef 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -24,22 +24,22 @@ extern u64 njpgdspMainDataStart[]; */ void Jpeg_ScheduleDecoderTask(JpegContext* jpegCtx) { static OSTask_t sJpegTask = { - M_NJPEGTASK, // type - 0, // flags - NULL, // ucode_boot - 0, // ucode_boot_size - njpgdspMainTextStart, // ucode - 0x1000, // ucode_size - njpgdspMainDataStart, // ucode_data - 0x800, // ucode_data_size - NULL, // dram_stack - 0, // dram_stack_size - NULL, // output_buff - NULL, // output_buff_size - NULL, // data_ptr - sizeof(JpegTaskData), // data_size - NULL, // yield_data_ptr - 0x200, // yield_data_size + M_NJPEGTASK, // type + 0, // flags + NULL, // ucode_boot + 0, // ucode_boot_size + njpgdspMainTextStart, // ucode + SP_UCODE_SIZE, // ucode_size + njpgdspMainDataStart, // ucode_data + SP_UCODE_DATA_SIZE, // ucode_data_size + NULL, // dram_stack + 0, // dram_stack_size + NULL, // output_buff + NULL, // output_buff_size + NULL, // data_ptr + sizeof(JpegTaskData), // data_size + NULL, // yield_data_ptr + sizeof(jpegCtx->workBuf->yieldData), // yield_data_size }; JpegWork* workBuf = jpegCtx->workBuf; diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c index 0ed80c066d..a3839bc400 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c @@ -6,6 +6,8 @@ #include "z_fbdemo_wipe5.h" +#define THIS ((TransitionWipe5*)thisx) + void* TransitionWipe5_Init(void* thisx); void TransitionWipe5_Destroy(void* thisx); void TransitionWipe5_Update(void* thisx, s32 updateRate); @@ -16,37 +18,129 @@ void TransitionWipe5_SetColor(void* thisx, u32 color); void TransitionWipe5_SetEnvColor(void* thisx, u32 color); s32 TransitionWipe5_IsDone(void* thisx); -#if 0 TransitionInit TransitionWipe5_InitVars = { - TransitionWipe5_Init, - TransitionWipe5_Destroy, - TransitionWipe5_Update, - TransitionWipe5_Draw, - TransitionWipe5_Start, - TransitionWipe5_SetType, - TransitionWipe5_SetColor, - TransitionWipe5_SetEnvColor, - TransitionWipe5_IsDone, + TransitionWipe5_Init, TransitionWipe5_Destroy, TransitionWipe5_Update, + TransitionWipe5_Draw, TransitionWipe5_Start, TransitionWipe5_SetType, + TransitionWipe5_SetColor, TransitionWipe5_SetEnvColor, TransitionWipe5_IsDone, }; -#endif +void TransitionWipe5_Start(void* thisx) { + TransitionWipe5* this = THIS; -extern u16 D_0F000000[]; + this->isDone = false; + switch (this->unk_12) { + case 0: + this->unk_08 = 0.02f; + break; + case 1: + this->unk_08 = 0.05f; + break; + default: + this->unk_08 = 0.2f; + break; + } + switch (this->unk_11) { + case 0: + this->primColor.rgba = RGBA8(0, 0, 0, 255); + break; + case 1: + this->primColor.rgba = RGBA8(160, 160, 160, 255); + break; + default: + this->primColor.rgba = RGBA8(160, 160, 160, 255); + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe5/TransitionWipe5_Start.s") +void* TransitionWipe5_Init(void* thisx) { + TransitionWipe5* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe5/TransitionWipe5_Init.s") + bzero(this, sizeof(TransitionWipe5)); + return this; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe5/TransitionWipe5_Destroy.s") +void TransitionWipe5_Destroy(void* thisx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe5/TransitionWipe5_Update.s") +void TransitionWipe5_Update(void* thisx, s32 updateRate) { + TransitionWipe5* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe5/TransitionWipe5_Draw.s") + if (this->unk_10 == 0) { + this->isDone = true; + } else { + this->unk_0C += (this->unk_08 * 3.0f) / updateRate; + if (this->unk_0C >= 1.0f) { + this->unk_0C = 1.0f; + this->isDone = true; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe5/TransitionWipe5_IsDone.s") +void TransitionWipe5_Draw(void* thisx, Gfx** gfxP) { + Gfx* gfx = *gfxP; + s32 width = gScreenWidth; + s32 height = gScreenHeight; + s32 sp50 = D_801FBB90; + TransitionWipe5* this = THIS; + s32 alpha = (1.0f - this->unk_0C) * 255.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe5/TransitionWipe5_SetType.s") + gDPPipeSync(gfx++); + gSPLoadUcodeL(gfx++, gspS2DEX2_fifo); + if (this->unk_10 == 0) { + gDPSetOtherMode(gfx++, + 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_COPY | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); + func_8014116C(&gfx, D_0F000000, sp50, width, height, 1); + } else { + if (alpha == 255) { + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | 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_OPA_SURF | G_RM_OPA_SURF2); + } else { + gDPSetOtherMode(gfx++, + G_AD_NOISE | G_CD_NOISE | G_CK_NONE | G_TC_FILT | 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); + } + gDPSetEnvColor(gfx++, 255, 255, 255, alpha); + gDPSetCombineLERP(gfx++, TEXEL0, 0, ENVIRONMENT, 0, 0, 0, 0, ENVIRONMENT, TEXEL0, 0, ENVIRONMENT, 0, 0, 0, 0, + ENVIRONMENT); + func_8014116C(&gfx, sp50, D_0F000000, width, height, 0); + } + gDPPipeSync(gfx++); + gSPLoadUcode(gfx++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); + *gfxP = gfx; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe5/TransitionWipe5_SetColor.s") +s32 TransitionWipe5_IsDone(void* thisx) { + TransitionWipe5* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_wipe5/TransitionWipe5_SetEnvColor.s") + return this->isDone; +} + +void TransitionWipe5_SetType(void* thisx, s32 type) { + TransitionWipe5* this = THIS; + + if (type & 0x80) { + this->unk_11 = 0; + this->unk_12 = type & 1; + } else if (type == 1) { + this->unk_10 = 1; + } else { + this->unk_10 = 0; + } +} + +void TransitionWipe5_SetColor(void* thisx, u32 color) { + TransitionWipe5* this = THIS; + + this->primColor.rgba = color; +} + +void TransitionWipe5_SetEnvColor(void* thisx, u32 color) { + TransitionWipe5* this = THIS; + + this->envColor.rgba = color; +} diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h index d5f882dec4..d5cd9137d8 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h @@ -4,7 +4,14 @@ #include "global.h" typedef struct { - /* 0x0000 */ char unk_0[0x14]; + /* 0x00 */ Color_RGBA8_u32 primColor; + /* 0x04 */ Color_RGBA8_u32 envColor; + /* 0x08 */ f32 unk_08; + /* 0x0C */ f32 unk_0C; + /* 0x10 */ u8 unk_10; + /* 0x11 */ u8 unk_11; + /* 0x12 */ u8 unk_12; + /* 0x13 */ u8 isDone; } TransitionWipe5; // size = 0x14 #endif