From 25056169442ac19ae236be22fe95f710ad2ee7c5 Mon Sep 17 00:00:00 2001 From: "overjoy.psm" Date: Mon, 30 Jan 2012 14:29:40 +0000 Subject: [PATCH] * (Hopefully) fixed crash in WaitMessage * (Hopefully) fixed Fanart issues * Added a way to show mem through gecko --- source/gui/video.cpp | 32 ++++++++++++++++++++------------ source/gui/video.hpp | 2 +- source/main.cpp | 2 +- source/menu/menu.cpp | 6 ++++-- source/menu/menu.hpp | 9 ++++++++- source/menu/menu_game.cpp | 16 +++++++++++++++- source/menu/menu_main.cpp | 14 ++++++++++++++ 7 files changed, 63 insertions(+), 18 deletions(-) diff --git a/source/gui/video.cpp b/source/gui/video.cpp index f683f480..e1ecb549 100644 --- a/source/gui/video.cpp +++ b/source/gui/video.cpp @@ -517,32 +517,40 @@ void CVideo::_showWaitMessages(CVideo *m) WIILIGHT_TurnOff(); } m->m_waitMessages.clear(); - gprintf("Stop showing images\n"); + //gprintf("Stop showing images\n"); m->m_showingWaitMessages = false; + m->CheckWaitThread(false); + gprintf("Stop showing images\n"); } -void CVideo::hideWaitMessage(bool force) +void CVideo::hideWaitMessage() { + gprintf("Now hide wait message\n"); m_showWaitMessage = false; - CheckWaitThread(force); } void CVideo::CheckWaitThread(bool force) { - if (force || (!m_showingWaitMessages && waitThread != LWP_THREAD_NULL)) + gprintf("Check wait thread start\n"); + if (force || !m_showingWaitMessages ) //&& waitThread != LWP_THREAD_NULL)) { - m_showWaitMessage = false; + if (waitThread != LWP_THREAD_NULL) + { + //m_showWaitMessage = false; + gprintf("Thread running. Stop it\n"); - if(LWP_ThreadIsSuspended(waitThread)) - LWP_ResumeThread(waitThread); + if(LWP_ThreadIsSuspended(waitThread)) + LWP_ResumeThread(waitThread); - LWP_JoinThread(waitThread, NULL); + LWP_JoinThread(waitThread, NULL); - SMART_FREE(waitThreadStack); - waitThread = LWP_THREAD_NULL; + SMART_FREE(waitThreadStack); + waitThread = LWP_THREAD_NULL; - m_waitMessages.clear(); + m_waitMessages.clear(); + } } + gprintf("Check wait thread end\n"); } void CVideo::waitMessage(float delay) @@ -552,7 +560,7 @@ void CVideo::waitMessage(float delay) void CVideo::waitMessage(const safe_vector &tex, float delay, bool useWiiLight) { - hideWaitMessage(true); + hideWaitMessage(); m_useWiiLight = useWiiLight; diff --git a/source/gui/video.hpp b/source/gui/video.hpp index 90b5c1fd..4f70f8fe 100644 --- a/source/gui/video.hpp +++ b/source/gui/video.hpp @@ -64,7 +64,7 @@ public: void prepareStencil(void); void renderStencil(void); int stencilVal(int x, int y); - void hideWaitMessage(bool force = false); + void hideWaitMessage(); void waitMessage(float delay); void waitMessage(const safe_vector &tex, float delay, bool useWiiLight = true); void waitMessage(const STexture &tex); diff --git a/source/main.cpp b/source/main.cpp index 9ee008f1..c367c7f2 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -20,7 +20,7 @@ extern "C" { extern void __exception_setreload(int t);} CMenu *mainMenu; extern "C" void ShowError(const wstringEx &error){mainMenu->error(error); } -extern "C" void HideWaitMessage() {mainMenu->_hideWaitMessage(true); } +extern "C" void HideWaitMessage() {mainMenu->_hideWaitMessage(); } int main(int argc, char **argv) { diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index e7984559..50317351 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -264,6 +264,8 @@ void CMenu::init(void) makedir((char *)m_wipDir.c_str()); makedir((char *)m_listCacheDir.c_str()); + m_gameList.Init(m_listCacheDir, m_settingsDir, m_loc.getString(m_curLanguage, "gametdb_code", "EN")); + // INI files m_cat.load(sfmt("%s/" CAT_FILENAME, m_settingsDir.c_str()).c_str()); string themeName = m_cfg.getString("GENERAL", "theme", "DEFAULT"); @@ -1682,9 +1684,9 @@ void CMenu::_load_installed_cioses() } } -void CMenu::_hideWaitMessage(bool force) +void CMenu::_hideWaitMessage() { - m_vid.hideWaitMessage(force); + m_vid.hideWaitMessage(); } void CMenu::_showWaitMessage() diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 8c16f686..4270e01d 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -1,6 +1,7 @@ #ifndef __MENU_HPP #define __MENU_HPP //#define SHOWMEM 1 +//#define SHOWMEMGECKO #include #include @@ -144,6 +145,12 @@ private: u32 m_mainLblLetter; #ifdef SHOWMEM u32 m_mem2FreeSize; +#endif +#ifdef SHOWMEMGECKO + unsigned int mem1old; + unsigned int mem1; + unsigned int mem2old; + unsigned int mem2; #endif u32 m_mainLblNotice; u32 m_mainBtnNext; @@ -738,7 +745,7 @@ private: safe_vector _textures(TexSet &texSet, const char *domain, const char *key); void _showWaitMessage(); public: - void _hideWaitMessage(bool force = false); + void _hideWaitMessage(); private: SmartGuiSound _sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, const u8 * snd, u32 len, string name, bool isAllocated); SmartGuiSound _sound(CMenu::SoundSet &soundSet, const char *domain, const char *key, string name); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 5bf572ac..1fe86928 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -1277,5 +1277,19 @@ void CMenu::CheckGameSoundThread(bool force) void CMenu::CheckThreads(bool force) { CheckGameSoundThread(force); - m_vid.CheckWaitThread(force); + //m_vid.CheckWaitThread(force); +#ifdef SHOWMEMGECKO + mem1 = SYS_GetArena1Size(); + mem2 = MEM2_freesize(); + if( mem1 != mem1old ) + { + mem1old = mem1; + gprintf("Mem1 Free: %u\n", mem1); + } + if( mem2 != mem2old ) + { + mem2old = mem2; + gprintf("Mem2 Free: %u\n", mem2); + } +#endif } diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index e0d9f310..f0d5ec17 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -80,6 +80,20 @@ void CMenu::_showMain(void) _hideWaitMessage(); #ifdef SHOWMEM m_btnMgr.show(m_mem2FreeSize); +#endif +#ifdef SHOWMEMGECKO + mem1 = SYS_GetArena1Size(); + mem2 = MEM2_freesize(); + if( mem1 != mem1old ) + { + mem1old = mem1; + gprintf("Mem1 Free: %u\n", mem1); + } + if( mem2 != mem2old ) + { + mem2old = mem2; + gprintf("Mem2 Free: %u\n", mem2); + } #endif m_vid.set2DViewport(m_cfg.getInt("GENERAL", "tv_width", 640), m_cfg.getInt("GENERAL", "tv_height", 480), m_cfg.getInt("GENERAL", "tv_x", 0), m_cfg.getInt("GENERAL", "tv_y", 0));