From 518ba479b254355daffdb51e1dc6a60577d1ac5c Mon Sep 17 00:00:00 2001 From: "miigotu@hotmail.com" Date: Sun, 10 Jul 2011 08:24:12 +0000 Subject: [PATCH] *Force cache update when installing or removing a game from inside wiiflow. *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 --- source/loader/wbfs_ext.c | 5 ++++- source/menu/menu.cpp | 1 + source/menu/menu_wbfs.cpp | 4 +++- source/music/gui_sound.cpp | 20 ++++++++++++++++---- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/source/loader/wbfs_ext.c b/source/loader/wbfs_ext.c index ea86ca7..3aeba7b 100644 --- a/source/loader/wbfs_ext.c +++ b/source/loader/wbfs_ext.c @@ -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; } diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 637eab3..50ba58b 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -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); diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp index 9852985..9c423a0 100644 --- a/source/menu/menu_wbfs.cpp +++ b/source/menu/menu_wbfs.cpp @@ -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); diff --git a/source/music/gui_sound.cpp b/source/music/gui_sound.cpp index d308b07..eac1bb5 100644 --- a/source/music/gui_sound.cpp +++ b/source/music/gui_sound.cpp @@ -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; @@ -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); }