1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#include "z64voice.h"
#include "padmgr.h"
OSVoiceDictionary sVoiceDictionary = {
{
// "atonanjikan" - "How many hours"
{ 'ア', 'ト', 'ナ', 'ン', 'ジ', 'カ', 'ン' },
// "haichīzu" - "say cheese"
{ 'ハ', 'イ', 'チ', 'ー', 'ズ' },
// "okirō" - "wake up"
{ 'オ', 'キ', 'ロ', 'ー' },
// "osuwari" - "sit"
{ 'オ', 'ス', 'ワ', 'リ' },
// "miruku" - "milk"
{ 'ミ', 'ル', 'ク' },
// "haiyā" - "hiya!"
{ 'ハ', 'イ', 'ヤ', 'ー' },
},
VOICE_WORD_ID_MAX, // number of words
};
u8 D_801D8E3C = 0;
OSVoiceData* sVoiceData = NULL;
u16 sTopScoreWordId = VOICE_WORD_ID_NONE;
u8 D_801D8E48 = 0;
// Relation to voice initialization
void AudioVoice_Noop(void) {
}
void func_801A4EB8(void) {
u8* voiceMaskPattern;
OSMesgQueue* serialEventQueue;
s32 index;
u8 sp38[1];
u8 i;
if (D_801D8E3C != 0) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
osVoiceStopReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
}
voiceMaskPattern = AudioVoice_GetVoiceMaskPattern();
for (i = 0; i < 1; i++) {
sp38[i] = voiceMaskPattern[i];
}
if (func_801A5228(&sVoiceDictionary) == 0) {
for (i = 0; i < VOICE_WORD_ID_MAX; i++) {
index = i / 8;
if (((sp38[index] >> (i % 8)) & 1) == 1) {
AudioVoice_InitWordImplAlt(i);
}
}
func_801A53E8(800, 2, VOICE_WARN_TOO_SMALL, 500, 2000);
D_801D8E3C = 1;
}
}
void AudioVoice_ResetWord(void) {
s32 errorCode;
OSMesgQueue* serialEventQueue;
AudioVoice_InitWordImplAlt(VOICE_WORD_ID_NONE);
if (D_801D8E3C != 0) {
serialEventQueue = PadMgr_VoiceAcquireSerialEventQueue();
osVoiceStopReadData(&gVoiceHandle);
PadMgr_VoiceReleaseSerialEventQueue(serialEventQueue);
errorCode = func_801A5228(&sVoiceDictionary);
AudioVoice_InitWordImplAlt(VOICE_WORD_ID_NONE);
if (errorCode == 0) {
func_801A53E8(800, 2, VOICE_WARN_TOO_SMALL, 500, 2000);
D_801D8E3C = 1;
}
AudioVoice_InitWord(VOICE_WORD_ID_HIYA);
AudioVoice_InitWord(VOICE_WORD_ID_CHEESE);
}
}
void AudioVoice_InitWord(u16 wordId) {
if ((D_801D8E3C != 0) && (wordId < VOICE_WORD_ID_MAX)) {
AudioVoice_InitWordImpl(wordId);
}
}
// Unused
void AudioVoice_InitWordAlt(u16 wordId) {
if ((D_801D8E3C != 0) && (wordId < VOICE_WORD_ID_MAX)) {
AudioVoice_InitWordImplAlt(wordId);
}
}
u16 AudioVoice_GetWord(void) {
return sTopScoreWordId;
}
// Unused
u8 func_801A510C(void) {
return D_801D8E3C;
}
void AudioVoice_Update(void) {
if (D_801D8E3C & 2) {
D_801D8E3C &= 1;
func_801A4EB8();
}
if (D_801D8E3C != 0) {
if (func_801A5808() != 0) {
D_801D8E48++;
if (D_801D8E48 == 10) {
D_801D8E3C = 0;
sTopScoreWordId = VOICE_WORD_ID_NONE;
return;
}
} else {
D_801D8E48 = 0;
}
sVoiceData = func_801A5390();
if (sVoiceData != 0) {
sTopScoreWordId = sVoiceData->answer[0];
} else {
sTopScoreWordId = VOICE_WORD_ID_NONE;
}
}
}
|