diff options
author | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-07-27 21:30:10 +0200 |
---|---|---|
committer | Rémi Calixte <remicalixte.rmc@gmail.com> | 2021-07-27 21:30:10 +0200 |
commit | a46463e4c6ca40cfc96dd47a7a28c11275a22ea6 (patch) | |
tree | 9650e92bbc70f0729119edb2346cc3c931f95d21 /arm9/src | |
parent | 68d7aa47cc52ef822220e0e35890863d7cad479f (diff) |
decompile unk_02005CFC.s
Diffstat (limited to 'arm9/src')
-rw-r--r-- | arm9/src/pokemon.c | 12 | ||||
-rw-r--r-- | arm9/src/unk_020040F4.c | 9 | ||||
-rw-r--r-- | arm9/src/unk_020051F4.c | 2 | ||||
-rw-r--r-- | arm9/src/unk_02005CFC.c | 181 |
4 files changed, 194 insertions, 10 deletions
diff --git a/arm9/src/pokemon.c b/arm9/src/pokemon.c index 29075833..bd6c702a 100644 --- a/arm9/src/pokemon.c +++ b/arm9/src/pokemon.c @@ -18,6 +18,12 @@ #include "constants/moves.h" #include "constants/sinnoh_dex.h" #include "constants/trainer_classes.h" +#include "unk_020051F4.h" + +extern void FUN_02005E80(u8); +extern void FUN_02005E90(u32 param0, u32 param1, u32 param2, u32 param3); +extern u32 FUN_02005F14(s32 param0); + #pragma thumb on @@ -3303,14 +3309,14 @@ void LoadWotbl_HandleAlternateForme(int species, int forme, u16 * wotbl) ReadWholeNarcMemberByIdPair(wotbl, NARC_POKETOOL_PERSONAL_WOTBL, ResolveMonForme(species, forme)); } -void FUN_02069FB0(u32 r7, u32 r5, u32 r4, u32 r6, u32 sp18, u32 sp1C, u32 sp20) +void FUN_02069FB0(u32 r7, u32 r5, u16 r4, u32 r6, u32 sp18, u32 sp1C, u32 sp20) { if (r4 == SPECIES_CHATOT) { if (!FUN_02005F14((int)r5)) { FUN_02005E80(1); - FUN_020056AC((int)r5, (int)r4, (int)r6, (int)sp18, (int)sp20); + FUN_020056AC(r5, r4, r6, sp18, sp20); } else { @@ -3321,7 +3327,7 @@ void FUN_02069FB0(u32 r7, u32 r5, u32 r4, u32 r6, u32 sp18, u32 sp1C, u32 sp20) } else { - FUN_020056AC((int)r5, (int)r4, (int)r6, (int)sp18, (int)sp20); + FUN_020056AC(r5, r4, r6, sp18, sp20); } } diff --git a/arm9/src/unk_020040F4.c b/arm9/src/unk_020040F4.c index 5713ddf0..3436fe68 100644 --- a/arm9/src/unk_020040F4.c +++ b/arm9/src/unk_020040F4.c @@ -3,6 +3,7 @@ #include "OS_cache.h" #include "sound.h" #include "unk_0202F150.h" +#include "SPI_mic.h" u32 UNK_021C3DD8[2]; @@ -22,9 +23,6 @@ extern void NNS_SndArcPlayerStartSeqEx(u32 *, u32, s32, s32, u32); extern u16 NNS_SndPlayerCountPlayingSeqByPlayerNo(int); extern u32 NNS_SndPlayerGetSeqNo(u32 *); extern u32 NNS_SndArcGetBankInfo(u32); -extern u32 MIC_StartAutoSampling(u32); -extern u32 MIC_StopAutoSampling(); -extern u32 MIC_DoSamplingAsync(u32 param0, u32 param1, u32 param2, u32 param3); extern u32 NNS_SndWaveOutAllocChannel(u32); extern void NNS_SndWaveOutFreeChannel(u32); extern u32 NNS_SndWaveOutStart(u32, u32, void *, u32, u32, u32, u32, s32, u32, s32); @@ -650,14 +648,13 @@ THUMB_FUNC u16 FUN_02004900(u32 param0) return *ptr; } -THUMB_FUNC u32 GF_MIC_StartAutoSampling(u32 param0) +THUMB_FUNC u32 GF_MIC_StartAutoSampling(struct MIC_SamplingData *param0) { return MIC_StartAutoSampling(param0); } -THUMB_FUNC u32 GF_MIC_StopAutoSampling(u32 param0) +THUMB_FUNC u32 GF_MIC_StopAutoSampling() { -#pragma unused(param0) GetSoundDataPointer(); return MIC_StopAutoSampling(); } diff --git a/arm9/src/unk_020051F4.c b/arm9/src/unk_020051F4.c index 6da250d5..64cab171 100644 --- a/arm9/src/unk_020051F4.c +++ b/arm9/src/unk_020051F4.c @@ -14,7 +14,7 @@ extern void NNS_SndPlayerStopSeqAll(u32); extern void NNS_SndPlayerStopSeq(u32 *, u32); extern void NNS_SndPlayerSetTrackPan(u32 *, u32, u32); extern u32 FUN_02005D48(u32, u32, u32, u32); -extern void FUN_02005E80(u32); +extern void FUN_02005E80(u8); extern void FUN_02005DFC(); extern void *FUN_0201B6C8(u32 *); diff --git a/arm9/src/unk_02005CFC.c b/arm9/src/unk_02005CFC.c new file mode 100644 index 00000000..bc34f2a3 --- /dev/null +++ b/arm9/src/unk_02005CFC.c @@ -0,0 +1,181 @@ +#include "global.h" +#include "unk_02005CFC.h" +#include "SPI_mic.h" +#include "math_util.h" +#include "proto.h" +#include "sav_chatot.h" +#include "sound.h" +#include "unk_020040F4.h" +#include "unk_020051F4.h" + +THUMB_FUNC BOOL FUN_02005CFC() +{ + if (*(u8 *)FUN_02003D38(29) == 1 && FUN_02004ABC(14) == 0) + { + FUN_02005DFC(); + + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_02005D20(struct SaveChatotSoundClip *param0) +{ + u8 *r4 = FUN_02003D38(30); + + if (!Chatot_exists(param0)) + { + return FALSE; + } + + if (*r4 != 1) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC u32 FUN_02005D48(struct SaveChatotSoundClip *param0, u32 param1, s32 param2, s32 param3) +{ +#pragma unused(param1) + + s8 *st0 = FUN_02004DB4(); + u8 *st4 = FUN_02003D38(29); + + if (!FUN_02005D20(param0)) + { + return 0; + } + + FUN_02005614(0); + FUN_02005DFC(); + FUN_02004984(14); + u16 r4 = (u16)(LCRandom() % 8192); + + Chatot_Decode(st0, Chatot_GetData(param0)); + + struct UnkStruct_020040F4_1 st8; + + st8.unk00 = FUN_02004930(14); + st8.unk04 = 0; + st8.unk08 = FUN_02004DB4(); + st8.unk0c = 0; + st8.unk10 = 0; + st8.unk14 = 2000; + st8.unk18 = 2000; + st8.unk20 = (u32)(r4 + 0x8000); + st8.unk24 = param3 / 2 + 64; + st8.unk1c = param2; + + u32 res = FUN_02004A6C(&st8, 14); + FUN_02004AF8(14, param2); + *st4 = 1; + FUN_02005E80(0); + + return res; +} + +THUMB_FUNC void FUN_02005DFC() +{ + u8 *r5 = FUN_02003D38(15); + u8 *r4 = FUN_02003D38(29); + + if (*r5 == 1) + { + FUN_02004C3C(14); + FUN_02004A04(14); + } + + *r4 = 0; +} + +THUMB_FUNC u32 FUN_02005E28() +{ + struct MIC_SamplingData st0; + + st0.unk00 = 2; + st0.unk04 = FUN_02004DB4(); + st0.unk08 = 2000; + if ((st0.unk08 & 0x1f) != 0) + { + st0.unk08 &= ~0x1f; + } + st0.unk0c = 0x4174; + st0.unk10 = 0; + st0.unk14 = 0; + st0.unk18 = 0; + + return GF_MIC_StartAutoSampling(&st0); +} + +THUMB_FUNC void FUN_02005E64() +{ + GF_MIC_StopAutoSampling(); +} + +THUMB_FUNC void FUN_02005E6C(struct SaveChatotSoundClip *param0) +{ + Chatot_Encode(param0, FUN_02004DB4()); +} + +THUMB_FUNC void FUN_02005E80(u8 param0) +{ + *(u8 *)FUN_02003D38(30) = param0; +} + +THUMB_FUNC void FUN_02005E90(struct SaveChatotSoundClip *param0, u32 param1, s32 param2, s32 param3) +{ + struct SaveChatotSoundClip **r0 = FUN_02003D38(35); + u32 ret; + if (param0 == 0) + { + ret = FUN_02005D48(*r0, param1, param2, param3); + } + else + { + ret = FUN_02005D48(param0, param1, param2, param3); + } + + if (ret == 0) + { + FUN_02005E80(1); + FUN_020056AC(0, SPECIES_CHATOT, param3, param2, 11); + } +} + +THUMB_FUNC u32 FUN_02005EE0(struct SaveChatotSoundClip *param0) +{ + if (!Chatot_exists(param0)) + { + return 0; + } + + s8 r0 = Chatot_GetData(param0)[15]; + if (r0 < -30) + { + return 1; + } + else if (r0 >= 30 && r0 < 128) + { + return 2; + } + + return 0; +} + +THUMB_FUNC u32 FUN_02005F14(s32 param0) +{ + switch (param0) + { + case 0: + case 1: + case 5: + case 11: + case 12: + return 1; + default: + return 0; + } +} |