This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
198 lines (195 loc) · 4.51 KB
/
main.c
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/* Beatbox - main.c
* Copyright (c) 2011 Tanner Babcock */
#include <oslib/oslib.h>
#include <pspsdk.h>
#include <psputils.h>
#include <time.h>
#include <stdio.h>
#include "main.h"
PSP_MODULE_INFO("Beatbox by Babkock", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(-2048);
void BBmsg(int x, int y, const char *str) {
int z;
for (z = 0; z != 3; z++) {
oslStartDrawing();
oslDrawString(x, y, str);
oslEndDrawing();
oslSyncFrame();
}
return;
}
void BBinit(void) {
oslInit(0);
oslInitGfx(OSL_PF_8888, 1);
oslInitConsole();
oslInitAudio();
BBloadfiles();
if (!sound.one || !sound.two || !sound.three || !sound.four || !sound.five ||
!sound.six || !sound.seven || !sound.eight) {
BBmsg(10, 40, "ERROR: one or more sound files missing, exiting...");
oslEndGfx();
oslQuit();
}
BBcolorsetswitch(WHITE);
oslSetBkColor(RGBA(0, 0, 0, 0));
musica = (pspSdkLoadStartModule("music.prx", PSP_MEMORY_PARTITION_KERNEL));
return;
}
int main(void) {
BBinit();
int foo;
oslCls();
int x;
for (x = 0; !osl_quit && x != 2; x++) {
oslStartDrawing();
if (!splash) {
oslDrawFillRect(0, 0, 480, 272, RGBA(0, 0, 0, 255));
oslDrawString(10, 10, "- Part of -");
oslDrawString(10, 30, "NPT\'S PSP GENESIS COMPETITION");
oslDrawString(10, 50, "Presented by");
oslDrawString(10, 60, "psp-hacks.com");
oslDrawString(200, 60, "pspgen.com");
oslDrawString(10, 70, "wololo.net");
oslDrawString(200, 70, "exophase.com");
oslDrawString(10, 80, "gamegaz.jp");
oslDrawString(200, 80, "pspcustomfirmware.com");
oslDrawString(10, 90, "daxhordes.org");
oslDrawString(200, 90, "pspslimhacks.com");
} else
oslDrawImage(splash);
oslEndDrawing();
oslSyncFrame();
} sceKernelDelayThread(2000000);
oslCls();
while (!osl_quit) {
oslStartDrawing();
oslReadKeys();
if (!intro) {
oslDrawFillRect(0, 0, 480, 272, RGBA(0, 0, 0, 0));
oslDrawString(10, 10, "Beatbox 2 by Babkock");
oslDrawString(10, 20, "Press X to start jamming.");
oslDrawString(10, 30, "Press O to quit.");
} else
oslDrawImage(intro);
if (osl_keys->pressed.cross) {
foo = TRUE;
break;
} if (osl_keys->pressed.circle) {
foo = FALSE;
break;
} oslEndDrawing();
oslSyncFrame();
}
if (foo == FALSE) {
oslEndGfx();
oslQuit();
return 0;
} soundset = ROCK;
metronomeb = FALSE;
menuoption = METRONOMEM;
mode = FOURKEY;
colorsb = TRUE;
start = sceKernelLibcClock();
oslCls();
while (!osl_quit) {
oslStartDrawing();
oslReadKeys();
oslCls();
current = sceKernelLibcClock();
d = (current - start);
oslDrawImage(bgimage);
if (d <= 2000000) {
/* go away after two seconds */
oslDrawImageXY(babkock, 0, 0);
oslDrawImageXY(options, 0, 245);
}
if (colorsb == TRUE)
BBdrawgrid();
if (osl_keys->pressed.start) {
BBpause();
start = sceKernelLibcClock();
}
if (osl_keys->held.select)
BBmusic();
if (osl_keys->pressed.cross) {
if (mode == FOURKEY)
oslPlaySound(sound.one, 0);
else
oslPlaySound(sound.five, 4);
if (colors.five == FALSE)
colors.five++;
else
colors.five--;
}
/* Four key mode uses the same sounds for cross and down,
* square and left, etc. */
if (osl_keys->pressed.circle) {
if (mode == FOURKEY)
oslPlaySound(sound.two, 1);
else
oslPlaySound(sound.six, 5);
if (colors.six == FALSE)
colors.six++;
else
colors.six--;
}
if (osl_keys->pressed.square) {
if (mode == FOURKEY)
oslPlaySound(sound.four, 3);
else if (metronomeb == FALSE)
oslPlaySound(sound.eight, 7);
else
oslPlaySound(sound.eight, 6);
if (colors.eight == FALSE)
colors.eight++;
else
colors.eight--;
}
if (osl_keys->pressed.triangle) {
if (mode == FOURKEY)
oslPlaySound(sound.three, 2);
else
oslPlaySound(sound.seven, 6);
if (colors.seven == FALSE)
colors.seven++;
else
colors.seven--;
}
if (osl_keys->pressed.down) {
oslPlaySound(sound.one, 0);
if (colors.one == FALSE)
colors.one++;
else
colors.one--;
}
if (osl_keys->pressed.right) {
oslPlaySound(sound.two, 1);
if (colors.two == FALSE)
colors.two++;
else
colors.two--;
}
if (osl_keys->pressed.left) {
oslPlaySound(sound.four, 3);
if (colors.four == FALSE)
colors.four++;
else
colors.four--;
}
if (osl_keys->pressed.up) {
oslPlaySound(sound.three, 2);
if (colors.three == FALSE)
colors.three++;
else
colors.three--;
}
oslAudioVSync();
oslEndDrawing();
oslSyncFrame();
}
sceKernelUnloadModule(musica);
oslEndGfx();
oslQuit();
return 0;
}