link radio

This commit is contained in:
Prakxo
2024-06-07 20:01:51 +02:00
parent b25c5d38b2
commit 14380e22b1
5 changed files with 55 additions and 2 deletions
+3
View File
@@ -48,6 +48,9 @@ jaudio_NES/rhythm.c:
.sdata: [0x80217bd0, 0x80217bd8]
.sbss: [0x802183a0, 0x802183b0]
.sdata2: [0x80218d60, 0x80218d78]
jaudio_NES/radio.c:
.text: [0x800165ec, 0x8001676c]
.sdata2: [0x80218d78, 0x80218d88]
jaudio_NES/aictrl.c:
.text: [0x80017e80, 0x80018640]
.rodata: [0x800aa500, 0x800aa518]
+1
View File
@@ -635,6 +635,7 @@ JAUDIO_FUNC_ALIGN_32_TUS = [
JAUDIO_USER_TUS = [
"verysimple.c",
"melody.c",
"radio.c",
"rhythm.c"
]
+1 -1
View File
@@ -7,7 +7,7 @@
extern "C" {
#endif
extern void Na_GetRadioCounter(void*);
extern void Na_GetKappaCounter(void*);
#ifdef __cplusplus
}
+7 -1
View File
@@ -3,11 +3,17 @@
#include "types.h"
typedef struct radio_ {
/* 0x000 */ s8 unk0;
/* 0x004 */ f32 unk4;
/* 0x008 */ u16 tempo;
} radio;
#ifdef __cplusplus
extern "C" {
#endif
extern void Na_GetKappaCounter(void*);
extern s16 Na_GetRadioCounter(radio* radio);
#ifdef __cplusplus
}
+43
View File
@@ -0,0 +1,43 @@
#include "jaudio_NES/radio.h"
#include "jaudio_NES/game64.h"
#include "jaudio_NES/audiowork.h"
s16 Na_GetRadioCounter(radio* radio) {
int unk16;
u16 tempo = 0;
group* group = nullptr;
int unused = 0;
if (AG.groups[sou_now_bgm_handle].flags.enabled != 0 && AG.groups[sou_now_bgm_handle].seq_id == 0xDA) {
group = &(AG.groups)[sou_now_bgm_handle];
} else {
return -1;
}
unk16 = group->unk016;
(void)unused;
if (unk16 < 0x2E8) {
radio->unk0 = 0;
} else {
unk16 -= 0x2E8;
radio->unk0 = (s8)(unk16 / 0x300);
unk16 = unk16 - (radio->unk0 * 0x300);
radio->unk0++;
}
if (radio->unk0 == 9) {
radio->unk4 = unk16 / 216.0f;
} else {
radio->unk4 = unk16 / 768.0f;
}
radio->tempo = AG.groups[sou_now_bgm_handle].tempo / 48;
tempo = radio->tempo;
return 0;
}