-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.c
More file actions
141 lines (121 loc) · 2.26 KB
/
Copy pathMain.c
File metadata and controls
141 lines (121 loc) · 2.26 KB
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
140
141
/**
* JBDS main entry point
*/
// Utilities to make development easier
#include "Utils.h"
// NitroFS access
#include "nitrofs.h"
// Effects!
#include "effects.h"
// Sound!
#include <maxmod9.h>
#include "music.h"
int main()
{
// Turn on everything.
POWCNT1 = POWCNT1_ALL;
irqEnable( IRQ_VBLANK );
// Init NitroFS for data loading.
nitroFSInitAdv( BINARY_NAME );
mmInitDefault( "nitro:/zik/music.bin" );
mmLoad( MOD_LIGHTMUSIC3_SHORT );
mmStart( MOD_LIGHTMUSIC3_SHORT, MM_PLAY_ONCE );
#ifdef DEBUG
consoleDemoInit();
iprintf( "Debug mode.\n" );
#endif
// Main loop
u32 t = 0;
u32 t_switch = 0;
u8 effect = 0;
u8 result = 0;
effect0_init();
effect0_update( t );
while( 1 ) {
t++;
t_switch++;
switch( effect ) {
// Single effect
case 0:
result = effect0_update( t );
if( result != 0 ) {
t = 0;
effect++;
effect1_init();
effect1_update( t );
effect0_destroy();
}
break;
case 1:
result = effect1_update( t );
if( result != 0 ) {
t = 0;
effect++;
effect1_destroy();
effect2_init();
effect2_update( t );
}
break;
case 2:
result = effect2_update( t );
if( result != 0 ) {
t = 0;
effect++;
effect2_destroy();
effect3_init();
effect3_update( t );
}
break;
case 3:
result = effect3_update( t );
if( result != 0 ) {
t = 0;
effect++;
effect3_destroy();
effect4_init();
effect4_update( t );
}
break;
case 4:
result = effect4_update( t );
if( result != 0 ) {
t = 0;
effect++;
effect4_destroy();
effect5_init();
effect5_update( t );
}
break;
case 5:
result = effect5_update( t );
if( result != 0 ) {
t = 0;
effect++;
effect5_destroy();
effect6_init();
effect6_update( t );
}
break;
case 6:
result = effect6_update( t );
if( result != 0 ) {
t = 0;
effect++;
effect6_destroy();
effect7_init();
effect7_update( t );
}
break;
case 7:
effect7_update( t );
break;
default:
/* Nada */
break;
}
// 60fps, or less if in DOUBLETHREEDEE MODE, or doing fancy
// things like that, the effect in question should know.
swiWaitForVBlank();
}
return 0;
}