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).

This commit is contained in:
lustar.mii 2009-08-09 06:11:35 +00:00
parent dd1700db8e
commit 117dad5271
6 changed files with 35 additions and 13 deletions

View File

@ -839,7 +839,9 @@ int MenuDiscList() {
} }
//if(isSdInserted()) { //if(isSdInserted()) {
if (isInserted(bootDevice)) { if (isInserted(bootDevice)) {
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(); CFG_Load();
ResumeGui();
} }
sdcardBtn.ResetState(); sdcardBtn.ResetState();
menu = MENU_DISCLIST; menu = MENU_DISCLIST;
@ -1454,6 +1456,8 @@ static int MenuInstall() {
} else { } else {
__Menu_GetEntries(); //get the entries again __Menu_GetEntries(); //get the entries again
GuiSound * instsuccess = NULL; GuiSound * instsuccess = NULL;
s32 thetimeofbg = bgMusic->GetPlayTime();
bgMusic->Stop();
instsuccess = new GuiSound(success_ogg, success_ogg_size, SOUND_OGG, Settings.sfxvolume); instsuccess = new GuiSound(success_ogg, success_ogg_size, SOUND_OGG, Settings.sfxvolume);
instsuccess->SetVolume(Settings.sfxvolume); instsuccess->SetVolume(Settings.sfxvolume);
instsuccess->SetLoop(0); instsuccess->SetLoop(0);
@ -1461,6 +1465,13 @@ static int MenuInstall() {
WindowPrompt (tr("Successfully installed:"),name,tr("OK")); WindowPrompt (tr("Successfully installed:"),name,tr("OK"));
instsuccess->Stop(); instsuccess->Stop();
delete instsuccess; 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; menu = MENU_DISCLIST;
break; break;
} }

View File

@ -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 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); 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); snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png); 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 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); 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); snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png); GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path); 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 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); 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); snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png); GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path); snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);

View File

@ -287,7 +287,9 @@ main:
folderBtn.SetTrigger(&trigA); folderBtn.SetTrigger(&trigA);
folderBtn.SetEffectGrow(); 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}); GuiText ExitBtnTxt("Cancel", 24, (GXColor) {0, 0, 0, 255});
GuiImage ExitBtnImg(&btnOutline); GuiImage ExitBtnImg(&btnOutline);
if (Settings.wsprompt == yes) { if (Settings.wsprompt == yes) {
@ -296,7 +298,7 @@ main:
} }
GuiButton ExitBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); GuiButton ExitBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
ExitBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); ExitBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
ExitBtn.SetPosition(-55, -35); ExitBtn.SetPosition(-40, -35);
ExitBtn.SetLabel(&ExitBtnTxt); ExitBtn.SetLabel(&ExitBtnTxt);
ExitBtn.SetImage(&ExitBtnImg); ExitBtn.SetImage(&ExitBtnImg);
ExitBtn.SetTrigger(&trigA); ExitBtn.SetTrigger(&trigA);
@ -323,7 +325,7 @@ main:
okBtnTxt.SetWidescreen(CFG.widescreen); okBtnTxt.SetWidescreen(CFG.widescreen);
okBtnImg.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); okBtn.SetLabel(&okBtnTxt);
GuiFileBrowser fileBrowser(396, 248); GuiFileBrowser fileBrowser(396, 248);

View File

@ -1376,7 +1376,9 @@ int MenuSettings() {
// if(isSdInserted()) { // if(isSdInserted()) {
if (isInserted(bootDevice)) { if (isInserted(bootDevice)) {
cfg_save_global(); cfg_save_global();
HaltGui();
CFG_Load(); CFG_Load();
ResumeGui();
} else { } else {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK")); WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
} }
@ -1580,7 +1582,9 @@ int MenuSettings() {
remove(GXGlobal_cfg); remove(GXGlobal_cfg);
} }
gettextCleanUp(); gettextCleanUp();
HaltGui();
CFG_Load(); CFG_Load();
ResumeGui();
menu = MENU_SETTINGS; menu = MENU_SETTINGS;
pageToDisplay = 0; pageToDisplay = 0;
} }

View File

@ -471,12 +471,13 @@ int MenuLanguageSelect() {
sprintf(Settings.language_path, "notset"); sprintf(Settings.language_path, "notset");
cfg_save_global(); cfg_save_global();
gettextCleanUp(); gettextCleanUp();
//lang_default(); HaltGui();
CFG_Load(); CFG_Load();
ResumeGui();
returnhere = 2; returnhere = 2;
} }
defaultBtn.ResetState(); defaultBtn.ResetState();
optionBrowser4.SetFocus(1); //optionBrowser4.SetFocus(1); // commented out to prevent crash
} }
else if (updateBtn.GetState() == STATE_CLICKED) { else if (updateBtn.GetState() == STATE_CLICKED) {
@ -527,7 +528,7 @@ int MenuLanguageSelect() {
} }
} }
updateBtn.ResetState(); updateBtn.ResetState();
optionBrowser4.SetFocus(1); //optionBrowser4.SetFocus(1); // commented out to prevent crash
} }
else if (pathBtn.GetState() == STATE_CLICKED) { else if (pathBtn.GetState() == STATE_CLICKED) {
@ -577,7 +578,9 @@ int MenuLanguageSelect() {
WindowPrompt(tr("File not found."),tr("Loading standard language."),tr("OK")); WindowPrompt(tr("File not found."),tr("Loading standard language."),tr("OK"));
} }
gettextCleanUp(); gettextCleanUp();
HaltGui();
CFG_Load(); CFG_Load();
ResumeGui();
returnhere = 2; returnhere = 2;
break; break;
} else { } else {

View File

@ -1647,6 +1647,8 @@ bool CFG_forget_game_num(u8 *id) {
void CFG_Load(void) { 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]; char pathname[200];
// bool ret = false; // bool ret = false;