mirror of
https://github.com/dborth/snes9xgx.git
synced 2025-01-11 18:59:08 +01:00
Add support to load external background music
This commit is contained in:
parent
9e038bee04
commit
b723af3635
@ -39,6 +39,8 @@ Wii homebrew is WiiBrew (www.wiibrew.org).
|
|||||||
* Fixed Wii U GamePad support
|
* Fixed Wii U GamePad support
|
||||||
* Added ability to load external fonts and activated Japanese/Korean
|
* Added ability to load external fonts and activated Japanese/Korean
|
||||||
translations. Simply put the ko.ttf or jp.ttf in the app directory
|
translations. Simply put the ko.ttf or jp.ttf in the app directory
|
||||||
|
* Added ability to customize background music. Simply put a bg_music.ogg
|
||||||
|
in the app directory
|
||||||
* Added ability to change preview image source with + button (thanks Zalo!)
|
* Added ability to change preview image source with + button (thanks Zalo!)
|
||||||
|
|
||||||
[4.4.1 - January 4, 2019]
|
[4.4.1 - January 4, 2019]
|
||||||
|
@ -890,6 +890,35 @@ size_t LoadFont(char * filepath)
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
return loadSize;
|
return loadSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadBgMusic()
|
||||||
|
{
|
||||||
|
char filepath[MAXPATHLEN];
|
||||||
|
sprintf(filepath, "%s/bg_music.ogg", appPath);
|
||||||
|
FILE *file = fopen (filepath, "rb");
|
||||||
|
if(!file) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fseeko(file,0,SEEK_END);
|
||||||
|
size_t ogg_size = ftello(file);
|
||||||
|
|
||||||
|
if(ogg_size == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 * ogg_data = (u8 *)mem2_malloc(ogg_size);
|
||||||
|
|
||||||
|
if(!ogg_data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fseeko(file, 0, SEEK_SET);
|
||||||
|
fread (ogg_data, 1, ogg_size, file);
|
||||||
|
fclose(file);
|
||||||
|
bg_music = ogg_data;
|
||||||
|
bg_music_size = ogg_size;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -37,6 +37,7 @@ size_t LoadFile(char * rbuffer, char *filepath, size_t length, size_t buffersize
|
|||||||
size_t LoadFile(char * filepath, bool silent);
|
size_t LoadFile(char * filepath, bool silent);
|
||||||
size_t LoadSzFile(char * filepath, unsigned char * rbuffer);
|
size_t LoadSzFile(char * filepath, unsigned char * rbuffer);
|
||||||
size_t LoadFont(char *filepath);
|
size_t LoadFont(char *filepath);
|
||||||
|
void LoadBgMusic();
|
||||||
size_t SaveFile(char * buffer, char *filepath, size_t datasize, bool silent);
|
size_t SaveFile(char * buffer, char *filepath, size_t datasize, bool silent);
|
||||||
size_t SaveFile(char * filepath, size_t datasize, bool silent);
|
size_t SaveFile(char * filepath, size_t datasize, bool silent);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ static heap_cntrl mem2_heap;
|
|||||||
|
|
||||||
u32 InitMem2Manager ()
|
u32 InitMem2Manager ()
|
||||||
{
|
{
|
||||||
int size = (12*1024*1024);
|
int size = (20*1024*1024);
|
||||||
u32 level;
|
u32 level;
|
||||||
_CPU_ISR_Disable(level);
|
_CPU_ISR_Disable(level);
|
||||||
size &= ~0x1f; // round down, because otherwise we may exceed the area
|
size &= ~0x1f; // round down, because otherwise we may exceed the area
|
||||||
|
@ -98,6 +98,9 @@ static char progressMsg[201];
|
|||||||
static int progressDone = 0;
|
static int progressDone = 0;
|
||||||
static int progressTotal = 0;
|
static int progressTotal = 0;
|
||||||
|
|
||||||
|
u8 * bg_music;
|
||||||
|
u32 bg_music_size;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ResumeGui
|
* ResumeGui
|
||||||
*
|
*
|
||||||
@ -4292,7 +4295,7 @@ MainMenu (int menu)
|
|||||||
|
|
||||||
#ifndef NO_SOUND
|
#ifndef NO_SOUND
|
||||||
if(firstRun) {
|
if(firstRun) {
|
||||||
bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, SOUND_OGG);
|
bgMusic = new GuiSound(bg_music, bg_music_size, SOUND_OGG);
|
||||||
bgMusic->SetVolume(GCSettings.MusicVolume);
|
bgMusic->SetVolume(GCSettings.MusicVolume);
|
||||||
bgMusic->SetLoop(true);
|
bgMusic->SetLoop(true);
|
||||||
enterSound = new GuiSound(enter_ogg, enter_ogg_size, SOUND_OGG);
|
enterSound = new GuiSound(enter_ogg, enter_ogg_size, SOUND_OGG);
|
||||||
|
@ -23,6 +23,9 @@ void CancelAction();
|
|||||||
void ShowProgress (const char *msg, int done, int total);
|
void ShowProgress (const char *msg, int done, int total);
|
||||||
void ChangeLanguage();
|
void ChangeLanguage();
|
||||||
|
|
||||||
|
extern u8 * bg_music;
|
||||||
|
extern u32 bg_music_size;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MENU_EXIT = -1,
|
MENU_EXIT = -1,
|
||||||
|
@ -729,5 +729,12 @@ bool LoadPrefs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ChangeLanguage();
|
ChangeLanguage();
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
bg_music = (u8 * )bg_music_ogg;
|
||||||
|
bg_music_size = bg_music_ogg_size;
|
||||||
|
LoadBgMusic();
|
||||||
|
#endif
|
||||||
|
|
||||||
return prefFound;
|
return prefFound;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user