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
/
files.c
65 lines (63 loc) · 2.73 KB
/
files.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
/* Beatbox - files.c
* Copyright (c) 2011 Tanner Babcock */
#include <oslib/oslib.h>
#include <pspsdk.h>
#include "main.h"
#include "files.h"
void setUpVirtualFileMenu(void) {
OSL_VIRTUALFILENAME ram_files[] = {
{"ram:/babkock.png", (void*)babkock_data, sizeof(babkock_data), &VF_MEMORY},
{"ram:/background.png", (void*)background_data, sizeof(background_data), &VF_MEMORY},
{"ram:/intro.png", (void*)intro_data, sizeof(intro_data), &VF_MEMORY},
{"ram:/options.png", (void*)options_data, sizeof(options_data), &VF_MEMORY},
{"ram:/splash.png", (void*)splash_data, sizeof(splash_data), &VF_MEMORY}};
oslAddVirtualFileList(ram_files, oslNumberof(ram_files));
}
void BBloadfiles(void) {
musexist = TRUE;
BBmsg(10, 10, "Loading virtual files to RAM...");
setUpVirtualFileMenu();
BBmsg(10, 20, "Loading rock sound set...");
sound.one = oslLoadSoundFile("sounds/rock_1.wav", OSL_FMT_NONE);
sound.two = oslLoadSoundFile("sounds/rock_2.wav", OSL_FMT_NONE);
sound.three = oslLoadSoundFile("sounds/rock_3.wav", OSL_FMT_NONE);
sound.four = oslLoadSoundFile("sounds/rock_4.wav", OSL_FMT_NONE);
sound.five = oslLoadSoundFile("sounds/rock_5.wav", OSL_FMT_NONE);
sound.six = oslLoadSoundFile("sounds/rock_6.wav", OSL_FMT_NONE);
sound.seven = oslLoadSoundFile("sounds/rock_7.wav", OSL_FMT_NONE);
sound.eight = oslLoadSoundFile("sounds/rock_8.wav", OSL_FMT_NONE);
BBmsg(10, 30, "Loading metronome...");
metronome = oslLoadSoundFile("sounds/metronome.wav", OSL_FMT_NONE);
BBmsg(10, 40, "Loading images from RAM...");
bgimage = oslLoadImageFile("ram:/background.png", OSL_IN_RAM, OSL_PF_5551);
intro = oslLoadImageFile("ram:/intro.png", OSL_IN_RAM, OSL_PF_5551);
babkock = oslLoadImageFile("ram:/babkock.png", OSL_IN_RAM, OSL_PF_5551);
options = oslLoadImageFile("ram:/options.png", OSL_IN_RAM, OSL_PF_5551);
splash = oslLoadImageFile("ram:/splash.png", OSL_IN_RAM, OSL_PF_5551);
BBmsg(10, 50, "Checking for music PRX config...");
musicconfig = fopen("ms0:/seplugins/music_conf.txt", "r");
if (musicconfig == NULL) {
while (!osl_quit) {
oslStartDrawing();
oslReadKeys();
oslDrawString(10, 70, "ms0:/seplugins/music_conf.txt doesn\'t exist. You will not be able to");
oslDrawString(10, 80, "use the in-game music plugin without it. Would you like to write a");
oslDrawString(10, 90, "default configuration file? (X - yes, O - no)");
if (osl_keys->pressed.cross) {
fclose(musicconfig);
musicconfig = fopen("ms0:/seplugins/music_conf.txt", "w");
BBmsg(10, 100, "Writing default music PRX config...");
fwrite(mcdata, sizeof(mcdata), 1, musicconfig);
fclose(musicconfig);
break;
} if (osl_keys->pressed.circle) {
musexist = FALSE;
break;
}
oslEndDrawing();
oslSyncFrame();
}
} else
fclose(musicconfig);
return;
}