- fixed a minor issue with wiiware/vc banners and gamesound.

- minor change to path manager.
This commit is contained in:
Fledge68 2021-10-01 17:55:38 -05:00
parent a05d0b3e25
commit d7e552fd44
4 changed files with 22 additions and 33 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -81,10 +81,16 @@ void Banner::SetBanner(u8 *bnr, u32 bnr_size, bool custom, bool alloc)
if(memcmp(imetmd5, md5, 16) == 0 || custom)
this->imet = imet;
else
{
imet = NULL;
gprintf("Invalid md5, banner not valid\n");
}
}
else
else
{
imet = NULL;
gprintf("Invalid signature found, banner not valid\n");
}
}
void Banner::ClearBanner()

View File

@ -1145,14 +1145,9 @@ void * CMenu::_gameSoundThread(void *obj)
if(cached_bnr_file == NULL && custom_bnr_file == NULL)
fsop_WriteFile(cached_banner, CurrentBanner.GetBannerFile(), CurrentBanner.GetBannerFileSize());
//load and init banner
m_banner.LoadBanner(m->m_wbf1_font, m->m_wbf2_font);
//get sound from wii, channel, or custom banner and load it to play with the banner
u32 sndSize = 0;
u8 *soundBin = CurrentBanner.GetFile("sound.bin", &sndSize);
CurrentBanner.ClearBanner();// got sound.bin and banner for displaying is loaded so no longer need current banner.
if(soundBin != NULL && (GameHdr->type != TYPE_GC_GAME || m->m_gc_play_banner_sound))
{
if(memcmp(&((IMD5Header *)soundBin)->fcc, "IMD5", 4) == 0)
@ -1160,13 +1155,10 @@ void * CMenu::_gameSoundThread(void *obj)
u32 newSize = 0;
u8 *newSound = DecompressCopy(soundBin, sndSize, &newSize);
free(soundBin);// no longer needed, now using decompressed newSound
if(newSound == NULL || newSize == 0 || !m->m_gameSound.Load(newSound, newSize))
{
if(newSound != NULL && newSize != 0)
m->m_gameSound.Load(newSound, newSize);
else
m->m_gameSound.FreeMemory();// frees newSound
m_banner.DeleteBanner();// the same as UnloadBanner
m->m_soundThrdBusy = false;
return NULL;
}
}
else
m->m_gameSound.Load(soundBin, sndSize);
@ -1174,19 +1166,18 @@ void * CMenu::_gameSoundThread(void *obj)
if(m->m_gameSound.IsLoaded())
m->m_gamesound_changed = true;
else
{
m->m_gameSound.FreeMemory();// frees soundBin
m_banner.DeleteBanner();
}
}
else
else // no sound.bin or gc banner sound disabled
{
if(soundBin != NULL)
free(soundBin);
//gprintf("WARNING: No sound found in banner!\n");
m->m_gamesound_changed = true;
m->m_gameSound.FreeMemory();// frees previous game sound
}
//load and init banner here after getting game sound so that DecompressCopy() doesn't conflict with the DecompressCopy() in AnimatedBanner.cpp
m_banner.LoadBanner(m->m_wbf1_font, m->m_wbf2_font);
CurrentBanner.ClearBanner();
m->m_soundThrdBusy = false;
return NULL;
}

View File

@ -175,9 +175,8 @@ void CMenu::_Paths(void)
{
_hidePaths();
currentPartition = m_cfg.getInt(WII_DOMAIN, "partition", USB1);
string gameDir(fmt(wii_games_dir, DeviceName[currentPartition]));
path = _FolderExplorer(gameDir.c_str());
if(strlen(path) > 0)
path = _FolderExplorer(fmt(wii_games_dir, DeviceName[currentPartition]));
if(strlen(path) > 6)// "usb1:/"
{
if(strncmp(path, "sd:/", 4) == 0)
m_cfg.setInt(WII_DOMAIN, "partition", 0);
@ -186,12 +185,9 @@ void CMenu::_Paths(void)
const char *partval = &path[3];
m_cfg.setInt(WII_DOMAIN, "partition", atoi(partval));
}
char tmpPath[64];
strcpy(tmpPath, "%s");
strcat(tmpPath, strchr(path, ':'));
tmpPath[63] = '\0';
string tmpPath = "%s" + string(strchr(path, ':'));
m_cfg.setString(WII_DOMAIN, "wii_games_dir", tmpPath);
strcpy(wii_games_dir, tmpPath);
strcpy(wii_games_dir, tmpPath.c_str());
m_cfg.setBool(WII_DOMAIN, "update_cache", true);
if(m_current_view & COVERFLOW_WII)
m_refreshGameList = true;
@ -202,9 +198,8 @@ void CMenu::_Paths(void)
{
_hidePaths();
currentPartition = m_cfg.getInt(GC_DOMAIN, "partition", USB1);
string gameDir(fmt(gc_games_dir, DeviceName[currentPartition]));
path = _FolderExplorer(gameDir.c_str());
if(strlen(path) > 0)
path = _FolderExplorer(fmt(gc_games_dir, DeviceName[currentPartition]));
if(strlen(path) > 6)// "usb1:/"
{
if(strncmp(path, "sd:/", 4) == 0)
m_cfg.setInt(GC_DOMAIN, "partition", 0);
@ -214,12 +209,9 @@ void CMenu::_Paths(void)
const char *partval = &path[3];
m_cfg.setInt(GC_DOMAIN, "partition", atoi(partval));
}
char tmpPath[64];
strcpy(tmpPath, "%s");
strcat(tmpPath, strchr(path, ':'));
tmpPath[63] = '\0';
string tmpPath = "%s" + string(strchr(path, ':'));
m_cfg.setString(GC_DOMAIN, "gc_games_dir", tmpPath);
strcpy(gc_games_dir, tmpPath);
strcpy(gc_games_dir, tmpPath.c_str());
m_cfg.setBool(GC_DOMAIN, "update_cache", true);
if(m_current_view & COVERFLOW_GAMECUBE)
m_refreshGameList = true;