Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added background music in emulator main menu.
  • Loading branch information
Rinnegatamante committed Nov 10, 2021
1 parent f98727d commit 8ad3962
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Binary file added Data/DaedalusX64/Resources/bg.ogg
Binary file not shown.
2 changes: 2 additions & 0 deletions Source/CMakeLists.txt
Expand Up @@ -132,6 +132,8 @@ target_link_libraries(${PROJECT_NAME}.elf
ssl
crypto
speexdsp
soloud
pthread
)

vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME}.elf UNSAFE)
Expand Down
27 changes: 26 additions & 1 deletion Source/SysVita/main.cpp
Expand Up @@ -38,6 +38,8 @@
#include "Utility/Timer.h"
#include "UI/Menu.h"
#include "minizip/unzip.h"
#include "soloud.h"
#include "soloud_wavstream.h"

#define NET_INIT_SIZE 1*1024*1024
#define MAX_ROM_SIZE 64*1024*1024
Expand Down Expand Up @@ -978,10 +980,33 @@ int main(int argc, char* argv[]) {
gUseRendererLegacy = gSwapUseRendererLegacy;
} else if (gStandaloneMode) {
rom = nullptr;

bool has_bg_music = true;
char music_file[256];
char *fmt[2] = {
"ogg",
"wav"
};
SoLoud::Soloud audio_engine;
SoLoud::WavStream bg_mus;
audio_engine.init();
sprintf(music_file, "%sbg.%s", DAEDALUS_VITA_PATH("Resources/"), fmt[0]);
if (bg_mus.load(music_file)) {
sprintf(music_file, "%sbg.%s", DAEDALUS_VITA_PATH("Resources/"), fmt[1]);
if (bg_mus.load(music_file)) {
has_bg_music = false;
}
}
if (has_bg_music) {
bg_mus.setLooping(true);
audio_engine.playBackground(bg_mus);
}
do {
rom = DrawRomSelector(false);
} while (rom == nullptr);

if (has_bg_music)
bg_mus.stop();
audio_engine.deinit();
char pre_launch[32], post_launch[32];
extractSubstrings(lang_strings[STR_ROM_LAUNCH], "?ROMNAME?", pre_launch, post_launch);
sprintf(boot_params, "%s%s%s", pre_launch, rom, post_launch); // Re-using boot_params to save some memory
Expand Down

0 comments on commit 8ad3962

Please sign in to comment.