Skip to content

Commit

Permalink
take: Decompile effsub.c
Browse files Browse the repository at this point in the history
  • Loading branch information
entriphy committed Jul 18, 2024
1 parent 7fb982e commit 3b667b1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.
60 changes: 55 additions & 5 deletions src/take/effsub.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,63 @@
#include "common.h"
#include "view.h"
#include "motsys.h"
#include "take/effsub.h"
#include "take/view.h"
#include "take/motsys.h"
#include "take/object.h"

typedef struct { // 0xc
/* 0x0 */ SFXOBJ *pObj;
/* 0x4 */ s32 field_0x4;
/* 0x8 */ u32 fr;
} D_395CD8_struct;

static s32 D_3FBCD8 = 0;
static D_395CD8_struct D_395CD8[25] = {};

extern u32 Vu0PrgEff __attribute__((section(".vutext")));

void func_00205E38(SFXOBJ *pObj) {
u32 var_a3 = GameGbl.fr - 1;
s32 i;

for (i = 0; i < 25 && D_395CD8[i].fr != GameGbl.fr; i++);
if (i == 25) {
D_3FBCD8 = 0;
for (i = 0; i < 25; i++) {
if (D_395CD8[i].pObj != NULL && D_395CD8[i].fr != var_a3 && D_395CD8[i].fr != GameGbl.fr) {
D_395CD8[i].pObj = NULL;
}
}
}

for (i = 0; i < 25; i++) {
if (D_395CD8[i].pObj == pObj && D_395CD8[i].fr == var_a3) {
D_395CD8[i].fr = GameGbl.fr;
D_3FBCD8 += pObj->DrawWorkCnt;
return;
}
}

for (i = 0; i < 25; i++) {
if (D_395CD8[i].pObj == NULL) {
D_395CD8[i].pObj = pObj;
D_395CD8[i].fr = GameGbl.fr;
D_3FBCD8 += pObj->DrawWorkCnt;
break;
}
}
}

void SetKlWorldIp(SFXOBJ *pObj) {
SetMotionWorldIp(pObj->pMot, klwipsp);
}

void Vu0EffProgTrans() {
// TODO
sceDmaSync(pDma.Vif0, 0, 0);
DPUT_D0_QWC(0);
DPUT_D0_TADR((u32)&Vu0PrgEff & 0xFFFFFFF);
DPUT_D_STAT(1);
FlushCache(WRITEBACK_DCACHE);
DPUT_D0_CHCR(0x145);
sceDmaSync(pDma.Vif0, 0, 0);
}

f32 _Sqrt(f32 x) {
Expand All @@ -23,4 +73,4 @@ f32 _Sqrt(f32 x) {
: : "f" (x), "f" (ret));

return ret;
}
}
1 change: 1 addition & 0 deletions src/take/effsub.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "take.h"

extern void func_00205E38(SFXOBJ *pObj);
extern void SetKlWorldIp(SFXOBJ *pObj);
extern void Vu0EffProgTrans();
extern f32 _Sqrt(f32 x);
Expand Down

0 comments on commit 3b667b1

Please sign in to comment.