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)
|
void CMenu::_gameSoundThread(CMenu *m)
|
||||||
{
|
{
|
||||||
m->m_gameSoundHdr = m->m_cf.getHdr();
|
m->m_gameSoundHdr = m->m_cf.getHdr();
|
||||||
|
m->m_gamesound_changed = false;
|
||||||
|
|
||||||
if(m->m_cf.getHdr()->type == TYPE_PLUGIN)
|
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);
|
cached_bnr_file = (u8*)malloc(cached_bnr_size);
|
||||||
if(cached_bnr_file == NULL)
|
if(cached_bnr_file == NULL)
|
||||||
{
|
{
|
||||||
|
m->m_gameSound->FreeMemory();
|
||||||
m_banner->DeleteBanner();
|
m_banner->DeleteBanner();
|
||||||
m->m_gameSoundHdr = NULL;
|
m->m_gameSoundHdr = NULL;
|
||||||
return;
|
return;
|
||||||
@ -1605,6 +1607,7 @@ void CMenu::_gameSoundThread(CMenu *m)
|
|||||||
custom_bnr_file = (u8*)malloc(custom_bnr_size);
|
custom_bnr_file = (u8*)malloc(custom_bnr_size);
|
||||||
if(custom_bnr_file == NULL)
|
if(custom_bnr_file == NULL)
|
||||||
{
|
{
|
||||||
|
m->m_gameSound->FreeMemory();
|
||||||
m_banner->DeleteBanner();
|
m_banner->DeleteBanner();
|
||||||
m->m_gameSoundHdr = NULL;
|
m->m_gameSoundHdr = NULL;
|
||||||
return;
|
return;
|
||||||
@ -1613,7 +1616,6 @@ void CMenu::_gameSoundThread(CMenu *m)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m->m_gamesound_changed = false;
|
|
||||||
u32 sndSize = 0;
|
u32 sndSize = 0;
|
||||||
u8 *soundBin = NULL;
|
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());
|
m_banner->LoadBanner(banner, &m->m_vid, m_wbf1_font.get(), m_wbf2_font.get());
|
||||||
soundBin = banner->GetFile((char *)"sound.bin", &sndSize);
|
soundBin = banner->GetFile((char *)"sound.bin", &sndSize);
|
||||||
}
|
}
|
||||||
if(banner == NULL || soundBin == NULL || sndSize == 0)
|
else
|
||||||
{
|
{
|
||||||
|
m->m_gameSound->FreeMemory();
|
||||||
m_banner->DeleteBanner();
|
m_banner->DeleteBanner();
|
||||||
m->m_gameSoundHdr = NULL;
|
m->m_gameSoundHdr = NULL;
|
||||||
delete banner;
|
delete banner;
|
||||||
@ -1640,28 +1643,38 @@ void CMenu::_gameSoundThread(CMenu *m)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
delete banner;
|
delete banner;
|
||||||
|
if(soundBin != NULL)
|
||||||
if(((IMD5Header *)soundBin)->fcc == 'IMD5')
|
|
||||||
{
|
{
|
||||||
u32 newSize = 0;
|
if(((IMD5Header *)soundBin)->fcc == 'IMD5')
|
||||||
u8 *newSound = DecompressCopy(soundBin, sndSize, &newSize);
|
|
||||||
if(newSound == NULL || newSize == 0 || !m->m_gameSound->Load(newSound, newSize))
|
|
||||||
{
|
{
|
||||||
if(newSound != NULL)
|
u32 newSize = 0;
|
||||||
free(newSound);
|
u8 *newSound = DecompressCopy(soundBin, sndSize, &newSize);
|
||||||
m_banner->DeleteBanner();
|
if(newSound == NULL || newSize == 0 || !m->m_gameSound->Load(newSound, newSize))
|
||||||
m->m_gameSoundHdr = NULL;
|
{
|
||||||
return;
|
m->m_gameSound->FreeMemory();
|
||||||
|
m_banner->DeleteBanner();
|
||||||
|
m->m_gameSoundHdr = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
free(soundBin);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m->m_gameSound->Load(soundBin, sndSize);
|
||||||
|
|
||||||
|
if(m->m_gameSound->IsLoaded())
|
||||||
|
m->m_gamesound_changed = true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m->m_gameSound->FreeMemory();
|
||||||
|
m_banner->DeleteBanner();
|
||||||
}
|
}
|
||||||
free(soundBin);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m->m_gameSound->Load(soundBin, sndSize);
|
{
|
||||||
|
gprintf("WARNING: No sound found in banner!\n");
|
||||||
if(m->m_gameSound->IsLoaded())
|
|
||||||
m->m_gamesound_changed = true;
|
m->m_gamesound_changed = true;
|
||||||
else
|
m->m_gameSound->FreeMemory();
|
||||||
m_banner->DeleteBanner();
|
}
|
||||||
m->m_gameSoundHdr = NULL;
|
m->m_gameSoundHdr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user