From 117dad5271c44fef9446a17927b04a5feece2076 Mon Sep 17 00:00:00 2001 From: "lustar.mii" Date: Sun, 9 Aug 2009 06:11:35 +0000 Subject: [PATCH] Fixed endless rumble that sometimes happened when clicking on SD icon and hopefully fixed it on other places (583). Fixed code dump on language update prompt (842), theme that didn't apply to some buttons (837, from Virale), background music that didn't resume after disc installation (844). --- source/menu.cpp | 13 ++++++++++++- source/prompts/PromptWindows.cpp | 6 +++--- source/prompts/filebrowser.cpp | 10 ++++++---- source/settings/Settings.cpp | 4 ++++ source/settings/SettingsPrompts.cpp | 13 ++++++++----- source/settings/cfg.c | 2 ++ 6 files changed, 35 insertions(+), 13 deletions(-) diff --git a/source/menu.cpp b/source/menu.cpp index bc621811..3b3aa9e0 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -839,7 +839,9 @@ int MenuDiscList() { } //if(isSdInserted()) { if (isInserted(bootDevice)) { - CFG_Load(); + HaltGui(); // to fix endless rumble when clicking on the SD icon when rumble is disabled because rumble is set to on in Global_Default() + CFG_Load(); + ResumeGui(); } sdcardBtn.ResetState(); menu = MENU_DISCLIST; @@ -1454,6 +1456,8 @@ static int MenuInstall() { } else { __Menu_GetEntries(); //get the entries again GuiSound * instsuccess = NULL; + s32 thetimeofbg = bgMusic->GetPlayTime(); + bgMusic->Stop(); instsuccess = new GuiSound(success_ogg, success_ogg_size, SOUND_OGG, Settings.sfxvolume); instsuccess->SetVolume(Settings.sfxvolume); instsuccess->SetLoop(0); @@ -1461,6 +1465,13 @@ static int MenuInstall() { WindowPrompt (tr("Successfully installed:"),name,tr("OK")); instsuccess->Stop(); delete instsuccess; + if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) { + bgMusic->Play(); + } else { + bgMusic->PlayOggFile(Settings.ogg_path); + } + bgMusic->SetPlayTime(thetimeofbg); + SetVolumeOgg(255*(Settings.volume/100.0)); menu = MENU_DISCLIST; break; } diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 4d59533b..7e404df2 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -76,7 +76,7 @@ int OnScreenKeyboard(char * var, u32 maxlen, int min) { GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume); GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume); - char imgPath[50]; + char imgPath[100]; snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path); GuiImageData btnOutline(imgPath, button_dialogue_box_png); @@ -441,7 +441,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume); GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume); - char imgPath[50]; + char imgPath[100]; snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path); GuiImageData btnOutline(imgPath, button_dialogue_box_png); snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path); @@ -3115,7 +3115,7 @@ HBCWindowPrompt(const char *name, const char *coder, const char *version, GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume); GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume); - char imgPath[50]; + char imgPath[100]; snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path); GuiImageData btnOutline(imgPath, button_dialogue_box_png); snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path); diff --git a/source/prompts/filebrowser.cpp b/source/prompts/filebrowser.cpp index 8d8feb41..cdb0357a 100644 --- a/source/prompts/filebrowser.cpp +++ b/source/prompts/filebrowser.cpp @@ -286,8 +286,10 @@ main: folderBtn.SetImage(&folderImg); folderBtn.SetTrigger(&trigA); folderBtn.SetEffectGrow(); - - GuiImageData btnOutline(button_dialogue_box_png); + + char imgPath[100]; + snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path); + GuiImageData btnOutline(imgPath, button_dialogue_box_png); GuiText ExitBtnTxt("Cancel", 24, (GXColor) {0, 0, 0, 255}); GuiImage ExitBtnImg(&btnOutline); if (Settings.wsprompt == yes) { @@ -296,7 +298,7 @@ main: } GuiButton ExitBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); ExitBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); - ExitBtn.SetPosition(-55, -35); + ExitBtn.SetPosition(-40, -35); ExitBtn.SetLabel(&ExitBtnTxt); ExitBtn.SetImage(&ExitBtnImg); ExitBtn.SetTrigger(&trigA); @@ -323,7 +325,7 @@ main: okBtnTxt.SetWidescreen(CFG.widescreen); okBtnImg.SetWidescreen(CFG.widescreen); } - GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 45, -35, &trigA, &btnSoundOver, &btnClick,1); + GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 40, -35, &trigA, &btnSoundOver, &btnClick,1); okBtn.SetLabel(&okBtnTxt); GuiFileBrowser fileBrowser(396, 248); diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp index dbce208f..552cec20 100644 --- a/source/settings/Settings.cpp +++ b/source/settings/Settings.cpp @@ -1376,7 +1376,9 @@ int MenuSettings() { // if(isSdInserted()) { if (isInserted(bootDevice)) { cfg_save_global(); + HaltGui(); CFG_Load(); + ResumeGui(); } else { WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK")); } @@ -1580,7 +1582,9 @@ int MenuSettings() { remove(GXGlobal_cfg); } gettextCleanUp(); + HaltGui(); CFG_Load(); + ResumeGui(); menu = MENU_SETTINGS; pageToDisplay = 0; } diff --git a/source/settings/SettingsPrompts.cpp b/source/settings/SettingsPrompts.cpp index cf9716d9..4e464d0a 100644 --- a/source/settings/SettingsPrompts.cpp +++ b/source/settings/SettingsPrompts.cpp @@ -471,12 +471,13 @@ int MenuLanguageSelect() { sprintf(Settings.language_path, "notset"); cfg_save_global(); gettextCleanUp(); - //lang_default(); + HaltGui(); CFG_Load(); + ResumeGui(); returnhere = 2; } defaultBtn.ResetState(); - optionBrowser4.SetFocus(1); + //optionBrowser4.SetFocus(1); // commented out to prevent crash } else if (updateBtn.GetState() == STATE_CLICKED) { @@ -526,8 +527,8 @@ int MenuLanguageSelect() { break; } } - updateBtn.ResetState(); - optionBrowser4.SetFocus(1); + updateBtn.ResetState(); + //optionBrowser4.SetFocus(1); // commented out to prevent crash } else if (pathBtn.GetState() == STATE_CLICKED) { @@ -577,7 +578,9 @@ int MenuLanguageSelect() { WindowPrompt(tr("File not found."),tr("Loading standard language."),tr("OK")); } gettextCleanUp(); - CFG_Load(); + HaltGui(); + CFG_Load(); + ResumeGui(); returnhere = 2; break; } else { diff --git a/source/settings/cfg.c b/source/settings/cfg.c index 25c3a0c1..e8ac475a 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -1647,6 +1647,8 @@ bool CFG_forget_game_num(u8 *id) { void CFG_Load(void) { +// GUI should be stopped at the time of calling CFG_Load() to prevent default settings from having any effect + char pathname[200]; // bool ret = false;