diff --git a/config/rel_slices.yml b/config/rel_slices.yml index a0ed46cf..db835be1 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -10,11 +10,14 @@ m_fbdemo.c: .text: [0x803A0350, 0x803A0ABC] .rodata: [0x80641F40, 0x80641F60] .data: [0x80652AA0, 0x80652AD0] -#m_fbdemo_wipe1.c: some rodata is 8 bytes long, when it should be 4 +#m_fbdemo_triforce.c: +# .text: [0x803A0ABC, 0x803A0F00] +# .rodata: [0x80641F60, 0x80641FA0] +#m_fbdemo_wipe1.c: #some rodata is 8 bytes long, when it should be 4 # .text: [0x803A0F00, 0x803A12F8] # .rodata: [0x80641FA0, 0x80641FC0] # .data: [0x80652AD0, 0x80653558] -#m_fbdemo_fade.c: data content mismatch +#m_fbdemo_fade.c: #data content mismatch # .text: [0x803A12F8, 0x803A1508] # .rodata: [0x80641FC0, 0x80641FD8] # .data: [0x80653558, 0x806535A0] diff --git a/include/dataobject.h b/include/dataobject.h index bf0f15e2..1acdd1cf 100644 --- a/include/dataobject.h +++ b/include/dataobject.h @@ -16,6 +16,13 @@ extern u8 FONT_nes_tex_cursor[]; extern u8 FONT_nes_tex_next[]; extern u8 FONT_nes_tex_choice[]; + +extern u8 ef_wipe1_modelT[]; +extern u8 ef_wipe2_modelT[]; +extern u8 ef_wipe3_modelT[]; + + + #ifdef __cplusplus } #endif diff --git a/include/m_fbdemo_fade.h b/include/m_fbdemo_fade.h index eeb38638..cc4a5f17 100644 --- a/include/m_fbdemo_fade.h +++ b/include/m_fbdemo_fade.h @@ -21,6 +21,6 @@ extern void fbdemo_fade_move(TransitionFade*, int); extern void fbdemo_fade_startup(TransitionFade*); extern void fbdemo_fade_settype(TransitionFade*, int); extern void fbdemo_fade_setcolor_rgba8888(TransitionFade*, u32); -extern void fbdemo_fade_is_finish(TransitionFade*); +extern u8 fbdemo_fade_is_finish(TransitionFade*); #endif \ No newline at end of file diff --git a/include/m_fbdemo_triforce.h b/include/m_fbdemo_triforce.h new file mode 100644 index 00000000..ec5a371f --- /dev/null +++ b/include/m_fbdemo_triforce.h @@ -0,0 +1,30 @@ +#ifndef M_FBDEMO_TRIFORCE_H +#define M_FBDEMO_TRIFORCE_H + +#include "types.h" +#include "PR/mbi.h" +#include "libu64/u64types.h" + +typedef struct { + /* 0x00 */ int txt; + /* 0x04 */ int frame; + /* 0x08 */ u8 direction; + /* 0x09 */ u8 textureno; + /* 0x0A */ s8 finished; + /* 0x0B */ u8 tmp; + /* 0x0C */ u16 normal; + /* 0x0E*/ u8 temp2[2]; + /* 0x10 */ Mtx perspmtx; + /* 0x50 */ Mtx lookatmtx; +} TransitionTriforce; // size = 0x90; + +extern void fbdemo_triforce_startup(TransitionTriforce*); +extern TransitionTriforce* fbdemo_triforce_init(TransitionTriforce*); +extern void fbdemo_triforce_move(TransitionTriforce*, int); +extern void fbdemo_triforce_draw(TransitionTriforce*, Gfx**); +extern s8 fbdemo_triforce_is_finish(TransitionTriforce*); +extern void fbdemo_triforce_settype(TransitionTriforce*, int); +extern void fbdemo_fade_setcolor_rgba8888(void); + + +#endif \ No newline at end of file diff --git a/include/m_fbdemo_wipe1.h b/include/m_fbdemo_wipe1.h index 3cf45f7a..acf89f61 100644 --- a/include/m_fbdemo_wipe1.h +++ b/include/m_fbdemo_wipe1.h @@ -21,9 +21,9 @@ typedef struct { extern TransitionWipe* fbdemo_wipe1_init(TransitionWipe*); extern void fbdemo_wipe1_move(TransitionWipe*, int); -extern void fbdemo_wipe1_draw(TransitionWipe* Gfx**); +extern void fbdemo_wipe1_draw(TransitionWipe*, Gfx**); extern void fbdemo_wipe1_startup(TransitionWipe*); extern void fbdemo_wipe1_settype(TransitionWipe*, int); extern void fbdemo_wipe1_setcolor_rgba8888(TransitionWipe*, u32); -extern void fbdemo_wipe1_is_finish(TransitionWipe*); +extern u8 fbdemo_wipe1_is_finish(TransitionWipe*); #endif \ No newline at end of file diff --git a/include/m_rcp.h b/include/m_rcp.h index fe22dcdd..df98dcfa 100644 --- a/include/m_rcp.h +++ b/include/m_rcp.h @@ -11,8 +11,7 @@ extern "C" { extern Gfx* gfx_gSPTextureRectangle1(Gfx* gfx, u32 ulx, u32 uly, u32 lrx, u32 lry, int tile, int s, int t, int dsdx, int dtdy); extern Gfx* gfx_gDPFillRectangle1(Gfx* gfx, u32 ulx, u32 uly, u32 lrx, u32 lry); extern Gfx* gfx_gDPFillRectangleF(Gfx* gfx, u32 ulx, u32 uly, u32 lrx, u32 lry); -extern Gfx* gfx_tex_scroll2(Gfx** gfxpp, u32 x, u32 y, s32 width, s32 height); - +extern Gfx* gfx_tex_scroll2(Gfx** gfxpp, u32 x, u32 y, int width, int height); #ifdef __cplusplus } diff --git a/rel/m_fbdemo_triforce.c b/rel/m_fbdemo_triforce.c new file mode 100644 index 00000000..bd0642bb --- /dev/null +++ b/rel/m_fbdemo_triforce.c @@ -0,0 +1,99 @@ +#include "m_fbdemo_triforce.h" +#include "dataobject.h" +#include "libultra/libultra.h" +#include "libultra/gu.h" +#include "m_rcp.h" +#include "gfxalloc.h" + +void fbdemo_triforce_startup(TransitionTriforce* this){ + + this->finished = 0; + + if(this->direction != 0){ + this->txt = 0; + } + else{ + this->txt = 0x224; + } + + guPerspective(&this->perspmtx, &this->normal, 60.0f, 1.33f, 10.0f, 12800.0f, 1.0f); + guLookAt(&this->lookatmtx, 0.0f,0.0f, 400.0f, 0.0f, 0.0f, 0.0f, 0.0f,1.0f, 0.0f); +} + +TransitionTriforce* fbdemo_triforce_init(TransitionTriforce* this){ + + bzero(this, sizeof(TransitionTriforce)); + return this; +} + +void fbdemo_triforce_move(TransitionTriforce* this, int updaterate){ + int d; + f32 t; + t = (1.0f - (this->txt / 548.0f)); + if((this->textureno == 1) || (this->textureno == 2)){ + d = 0.5f * (14.0f + (12.0f * t)); + } + else{ + d = 0.5f * (14.0f + (16.0f * t)); + } + + if(this->direction != 0){ + this->txt += d; + if(this->txt >= 548){ + this->txt = 548; + this->finished = TRUE; + } + } + else { + this->txt -= d; + if(this->txt <= 0){ + this->txt = 0; + this->finished = TRUE; + } + } +} + +void fbdemo_triforce_draw(TransitionTriforce* this, Gfx** gfxP){ + Gfx* gfx = *gfxP; + Gfx* t; + Gfx* scroll; + + gDPPipeSync(gfx++); + scroll = gfx_tex_scroll2(&gfx, this->txt, 0, 16, 4); + gSPSegment(gfx++, 0x9, scroll); + gSPMatrix(gfx++, &this->perspmtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPPerspNormalize(gfx++, this->normal); + gSPMatrix(gfx++, &this->lookatmtx, G_MTX_MUL | G_MTX_PROJECTION); + t = gfxalloc(&gfx, 0x40); + guScale((Mtx*)t, 0.019f, 0.019f, 1.0f); + + gSPMatrix(gfx++, t, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + switch(this->textureno){ + case 0: + gSPDisplayList(gfx++, ef_wipe1_modelT); + break; + case 1: + gSPDisplayList(gfx++, ef_wipe2_modelT); + break; + case 2: + gSPDisplayList(gfx++, ef_wipe3_modelT); + break; + } + gDPPipeSync(gfx++); + *gfxP = gfx; +} + +s8 fbdemo_triforce_is_finish(TransitionTriforce* this){ + return this->finished; +} + +void fbdemo_triforce_settype(TransitionTriforce* this, int type){ + this->textureno = ((type & 0x80) != 0) ? 1 : ((type & 0x40) != 0 ? 2 : 0); + this->direction = (type & 0xF) != 1; +} + + +void fbdemo_triforce_setcolor_rgba8888(void){ + +} \ No newline at end of file