Skip to content

Commit

Permalink
*Force cache update when installing or removing a game from inside wi…
Browse files Browse the repository at this point in the history
…iflow.

*Add-on to r-win's change in gui_sound.cpp so that null allocations don't happen with LZ77 compressed sounds as well.

git-svn-id: https://wiiflow-advanced.googlecode.com/svn/trunk@379 43c7226f-5572-e80b-0314-b0280708705f
  • Loading branch information
miigotu@hotmail.com committed Jul 10, 2011
1 parent a258ee2 commit 518ba47
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
5 changes: 4 additions & 1 deletion source/loader/wbfs_ext.c
Expand Up @@ -217,9 +217,12 @@ s32 WBFS_Ext_AddGame(progress_callback_t spinner, void *spinner_data)
hdd = part; // used by spinner
s32 ret = wbfs_add_disc(part, __WBFS_ReadDVD, NULL, spinner, spinner_data, ONLY_GAME_PARTITION, 0);
hdd = old_hdd;
wbfs_trim(part);

if(ret == 0) wbfs_trim(part);

WBFS_Ext_ClosePart(part);

if(ret < 0) WBFS_Ext_RemoveGame(NULL, gamepath);

return ret < 0 ? ret : 0;
}
Expand Down
1 change: 1 addition & 0 deletions source/menu/menu.cpp
Expand Up @@ -1495,6 +1495,7 @@ bool CMenu::_loadChannelList(void)

bool CMenu::_loadList(void)
{
m_cf.clear();
m_gameList.clear();

gprintf("Loading items of view %d\n", m_current_view);
Expand Down
4 changes: 3 additions & 1 deletion source/menu/menu_wbfs.cpp
Expand Up @@ -223,7 +223,9 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
_hideWBFS();
if (done && (op == CMenu::WO_REMOVE_GAME || op == CMenu::WO_ADD_GAME))
{
m_cf.clear();
m_gameList.SetLanguage(m_curLanguage);
m_gameList.Update();

_loadList();
_initCF();
m_cf.findId(cfPos.c_str(), true);
Expand Down
20 changes: 16 additions & 4 deletions source/music/gui_sound.cpp
Expand Up @@ -414,6 +414,7 @@ u8 * uncompressLZ77(const u8 *inBuf, u32 inLength, u32 * size)
return NULL;

u32 uncSize = le32(((const u32 *)inBuf)[1] << 8);
if(uncSize <= 0) return 0;

const u8 *inBufEnd = inBuf + inLength;
inBuf += 8;
Expand Down Expand Up @@ -461,18 +462,29 @@ u8 * uncompressLZ77(const u8 *inBuf, u32 inLength, u32 * size)
void GuiSound::UncompressSoundbin(const u8 * snd, int len, bool isallocated)
{
const u8 * file = snd+32;

length = len-32;
if (length <= 0) return;

if(*((u32 *) file) == 'LZ77')
{
u32 size = 0;
sound = uncompressLZ77(file, len-32, &size);
sound = uncompressLZ77(file, length, &size);
if (!sound)
{
length = 0;
return;
}
length = size;
}
else
{
length = len-32;
if (length <= 0) return;
sound = (u8 *) malloc(length);
if (!sound) return;
if (!sound)
{
length = 0;
return;
}
memcpy(sound, file, length);
}

Expand Down

0 comments on commit 518ba47

Please sign in to comment.