mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-24 04:09:15 +01:00
-added support for banners without existing sound
This commit is contained in:
parent
0e5a5b4abd
commit
e685842c59
@ -1533,6 +1533,7 @@ u32 gameSoundThreadStackSize = (u32)32768;
|
||||
void CMenu::_gameSoundThread(CMenu *m)
|
||||
{
|
||||
m->m_gameSoundHdr = m->m_cf.getHdr();
|
||||
m->m_gamesound_changed = false;
|
||||
|
||||
if(m->m_cf.getHdr()->type == TYPE_PLUGIN)
|
||||
{
|
||||
@ -1566,6 +1567,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
cached_bnr_file = (u8*)malloc(cached_bnr_size);
|
||||
if(cached_bnr_file == NULL)
|
||||
{
|
||||
m->m_gameSound->FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
m->m_gameSoundHdr = NULL;
|
||||
return;
|
||||
@ -1605,6 +1607,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
custom_bnr_file = (u8*)malloc(custom_bnr_size);
|
||||
if(custom_bnr_file == NULL)
|
||||
{
|
||||
m->m_gameSound->FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
m->m_gameSoundHdr = NULL;
|
||||
return;
|
||||
@ -1613,7 +1616,6 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
m->m_gamesound_changed = false;
|
||||
u32 sndSize = 0;
|
||||
u8 *soundBin = NULL;
|
||||
|
||||
@ -1626,8 +1628,9 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
m_banner->LoadBanner(banner, &m->m_vid, m_wbf1_font.get(), m_wbf2_font.get());
|
||||
soundBin = banner->GetFile((char *)"sound.bin", &sndSize);
|
||||
}
|
||||
if(banner == NULL || soundBin == NULL || sndSize == 0)
|
||||
else
|
||||
{
|
||||
m->m_gameSound->FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
m->m_gameSoundHdr = NULL;
|
||||
delete banner;
|
||||
@ -1640,15 +1643,15 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
fclose(fp);
|
||||
}
|
||||
delete banner;
|
||||
|
||||
if(soundBin != NULL)
|
||||
{
|
||||
if(((IMD5Header *)soundBin)->fcc == 'IMD5')
|
||||
{
|
||||
u32 newSize = 0;
|
||||
u8 *newSound = DecompressCopy(soundBin, sndSize, &newSize);
|
||||
if(newSound == NULL || newSize == 0 || !m->m_gameSound->Load(newSound, newSize))
|
||||
{
|
||||
if(newSound != NULL)
|
||||
free(newSound);
|
||||
m->m_gameSound->FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
m->m_gameSoundHdr = NULL;
|
||||
return;
|
||||
@ -1661,7 +1664,17 @@ void CMenu::_gameSoundThread(CMenu *m)
|
||||
if(m->m_gameSound->IsLoaded())
|
||||
m->m_gamesound_changed = true;
|
||||
else
|
||||
{
|
||||
m->m_gameSound->FreeMemory();
|
||||
m_banner->DeleteBanner();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gprintf("WARNING: No sound found in banner!\n");
|
||||
m->m_gamesound_changed = true;
|
||||
m->m_gameSound->FreeMemory();
|
||||
}
|
||||
m->m_gameSoundHdr = NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user