diff --git a/source/ngc/fileop.cpp b/source/ngc/fileop.cpp index dea0c71..3c648d9 100644 --- a/source/ngc/fileop.cpp +++ b/source/ngc/fileop.cpp @@ -534,7 +534,7 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent) u32 nextread = 0; while(offset < size) { - if(size - offset > 1024*512) nextread = 1024*512; + if(size - offset > 4*1024) nextread = 4*1024; else nextread = size-offset; ShowProgress ("Loading...", offset, size); readsize = fread (rbuffer + offset, 1, nextread, file); // read in next chunk @@ -621,7 +621,7 @@ SaveFile (char * buffer, char *filepath, u32 datasize, int method, bool silent) u32 writesize, nextwrite; while(written < datasize) { - if(datasize - written > 16*1024) nextwrite=16*1024; + if(datasize - written > 4*1024) nextwrite=4*1024; else nextwrite = datasize-written; writesize = fwrite (buffer+written, 1, nextwrite, file); if(writesize != nextwrite) break; // write failure diff --git a/source/ngc/gui/gui_filebrowser.cpp b/source/ngc/gui/gui_filebrowser.cpp index 20dd518..c118c92 100644 --- a/source/ngc/gui/gui_filebrowser.cpp +++ b/source/ngc/gui/gui_filebrowser.cpp @@ -100,7 +100,7 @@ GuiFileBrowser::GuiFileBrowser(int w, int h) for(int i=0; iSetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); gameListText[i]->SetPosition(5,0); diff --git a/source/ngc/gui/gui_savebrowser.cpp b/source/ngc/gui/gui_savebrowser.cpp index dd89e0b..586c961 100644 --- a/source/ngc/gui/gui_savebrowser.cpp +++ b/source/ngc/gui/gui_savebrowser.cpp @@ -163,7 +163,7 @@ void GuiSaveBrowser::SetFocus(int f) for(int i=0; iResetState(); - if(f == 1) + if(f == 1 && selectedItem >= 0) saveBtn[selectedItem]->SetState(STATE_SELECTED); } @@ -334,7 +334,7 @@ void GuiSaveBrowser::Update(GuiTrigger * t) } else if(listOffset+i < saves->length) { - if(saveBtn[i]->GetState() == STATE_DISABLED) + if(saveBtn[i]->GetState() == STATE_DISABLED || !saveBtn[i]->IsVisible()) { saveBtn[i]->SetVisible(true); saveBtn[i]->SetState(STATE_DEFAULT); @@ -379,12 +379,17 @@ void GuiSaveBrowser::Update(GuiTrigger * t) saveBtn[i]->SetState(STATE_DISABLED); } - if(focus) + if(i != selectedItem && saveBtn[i]->GetState() == STATE_SELECTED) + saveBtn[i]->ResetState(); + else if(focus && i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT) + saveBtn[selectedItem]->SetState(STATE_SELECTED, t->chan); + + if(t->wpad.ir.valid && !saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y) + && saveBtn[i]->GetState() == STATE_SELECTED) { - if(i != selectedItem && saveBtn[i]->GetState() == STATE_SELECTED) - saveBtn[i]->ResetState(); - else if(i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT) - saveBtn[selectedItem]->SetState(STATE_SELECTED, t->chan); + saveBtn[i]->ResetState(); + if(selectedItem == i) + selectedItem = -1; } saveBtn[i]->Update(t); diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 8f84fa7..e6d9fbe 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -227,7 +227,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, const ch static void * EmulatorUpdate (void *arg) { - sleep(5); + sleep(3); bool installUpdate = WindowPrompt( "Update Available", "An update is available!", @@ -491,7 +491,7 @@ ShowProgress (const char *msg, int done, int total) void ShowAction (const char *msg) { - if(showProgress != 2) + if(showProgress != 0) CancelAction(); // wait for previous progress window to finish strncpy(progressMsg, msg, 200); @@ -830,25 +830,6 @@ static void WindowCredits(void * ptr) ***************************************************************************/ static int MenuGameSelection() { - #ifdef HW_RVL - ShutoffRumble(); - #endif - - // populate initial directory listing - if(OpenGameList() <= 0) - { - int choice = WindowPrompt( - "Error", - "Games directory is inaccessible on selected load device.", - "Retry", - "Check Settings"); - - if(choice) - return MENU_GAMESELECTION; - else - return MENU_SETTINGS_FILE; - } - int menu = MENU_NONE; GuiText titleTxt("Choose Game", 28, (GXColor){255, 255, 255, 255}); @@ -861,7 +842,6 @@ static int MenuGameSelection() GuiImageData iconSettings(icon_settings_png); GuiImageData btnOutline(button_png); GuiImageData btnOutlineOver(button_over_png); - GuiTrigger trigA; if(GCSettings.WiimoteOrientation) trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); @@ -913,6 +893,7 @@ static int MenuGameSelection() GuiFileBrowser gameBrowser(424, 248); gameBrowser.SetPosition(50, 108); + ResetBrowser(); HaltGui(); btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); @@ -922,57 +903,82 @@ static int MenuGameSelection() mainWindow->Append(&buttonWindow); ResumeGui(); - while(menu == MENU_NONE) + #ifdef HW_RVL + ShutoffRumble(); + #endif + + // populate initial directory listing + if(OpenGameList() <= 0) { - usleep(THREAD_SLEEP); + int choice = WindowPrompt( + "Error", + "Games directory is inaccessible on selected load device.", + "Retry", + "Check Settings"); - // update gameWindow based on arrow buttons - // set MENU_EXIT if A button pressed on a game - for(int i=0; iSetState(STATE_SELECTED); + gameBrowser.TriggerUpdate(); + + while(menu == MENU_NONE) { - if(gameBrowser.gameList[i]->GetState() == STATE_CLICKED) + usleep(THREAD_SLEEP); + + // update gameWindow based on arrow buttons + // set MENU_EXIT if A button pressed on a game + for(int i=0; iResetState(); - // check corresponding browser entry - if(browserList[browser.selIndex].isdir || IsSz()) + if(gameBrowser.gameList[i]->GetState() == STATE_CLICKED) { - bool res; - - if(IsSz()) - res = BrowserLoadSz(GCSettings.LoadMethod); - else - res = BrowserChangeFolder(GCSettings.LoadMethod); - - if(res) + gameBrowser.gameList[i]->ResetState(); + // check corresponding browser entry + if(browserList[browser.selIndex].isdir || IsSz()) { - gameBrowser.ResetState(); - gameBrowser.gameList[0]->SetState(STATE_SELECTED); - gameBrowser.TriggerUpdate(); + bool res; + + if(IsSz()) + res = BrowserLoadSz(GCSettings.LoadMethod); + else + res = BrowserChangeFolder(GCSettings.LoadMethod); + + if(res) + { + gameBrowser.ResetState(); + gameBrowser.gameList[0]->SetState(STATE_SELECTED); + gameBrowser.TriggerUpdate(); + } + else + { + menu = MENU_GAMESELECTION; + break; + } } else { - menu = MENU_GAMESELECTION; - break; + #ifdef HW_RVL + ShutoffRumble(); + #endif + mainWindow->SetState(STATE_DISABLED); + if(BrowserLoadFile(GCSettings.LoadMethod)) + menu = MENU_EXIT; + else + mainWindow->SetState(STATE_DEFAULT); } } - else - { - #ifdef HW_RVL - ShutoffRumble(); - #endif - mainWindow->SetState(STATE_DISABLED); - if(BrowserLoadFile(GCSettings.LoadMethod)) - menu = MENU_EXIT; - else - mainWindow->SetState(STATE_DEFAULT); - } } - } - if(settingsBtn.GetState() == STATE_CLICKED) - menu = MENU_SETTINGS; - else if(exitBtn.GetState() == STATE_CLICKED) - ExitRequested = 1; + if(settingsBtn.GetState() == STATE_CLICKED) + menu = MENU_SETTINGS; + else if(exitBtn.GetState() == STATE_CLICKED) + ExitRequested = 1; + } } HaltGui(); mainWindow->Remove(&titleTxt); diff --git a/source/ngc/networkop.cpp b/source/ngc/networkop.cpp index 232bf6e..8d5632e 100644 --- a/source/ngc/networkop.cpp +++ b/source/ngc/networkop.cpp @@ -207,8 +207,6 @@ void InitializeNetwork(bool silent) ErrorPrompt(msg); } } - if(!silent) - CancelAction(); inNetworkInit = false; } @@ -279,8 +277,6 @@ ConnectShare (bool silent) { networkShareInit = true; } - if(!silent) - CancelAction(); } if(!networkShareInit && !silent) diff --git a/source/ngc/preferences.cpp b/source/ngc/preferences.cpp index f7537d2..b5d9388 100644 --- a/source/ngc/preferences.cpp +++ b/source/ngc/preferences.cpp @@ -196,6 +196,7 @@ preparePrefsData (int method) createXMLSetting("ExitAction", "Exit Action", toStr(GCSettings.ExitAction)); createXMLSetting("MusicVolume", "Music Volume", toStr(GCSettings.MusicVolume)); createXMLSetting("SFXVolume", "Sound Effects Volume", toStr(GCSettings.SFXVolume)); + createXMLSetting("Rumble", "Rumble", toStr(GCSettings.Rumble)); createXMLSection("Controller", "Controller Settings"); @@ -371,7 +372,7 @@ static void loadXMLPaletteFromSection(gamePalette &pal) if(tmp) pal.palette[12] = strtoul(tmp, NULL, 16); tmp = mxmlElementGetAttr(item, "c2"); if(tmp) pal.palette[13] = strtoul(tmp, NULL, 16); - } + } const char *use = mxmlElementGetAttr(section, "use"); if (use) { if (atoi(use)==0) pal.use = 0; @@ -466,6 +467,7 @@ decodePrefsData (int method) loadXMLSetting(&GCSettings.ExitAction, "ExitAction"); loadXMLSetting(&GCSettings.MusicVolume, "MusicVolume"); loadXMLSetting(&GCSettings.SFXVolume, "SFXVolume"); + loadXMLSetting(&GCSettings.Rumble, "Rumble"); // Controller Settings @@ -592,7 +594,7 @@ decodePalsData (int method) item = mxmlFindElement(xml, xml, "palette", NULL, NULL, MXML_DESCEND); for (section = mxmlFindElement(item, xml, "game", NULL, NULL, MXML_DESCEND); section; - section = mxmlFindElement(section, xml, "game", NULL, NULL, MXML_NO_DESCEND)) + section = mxmlFindElement(section, xml, "game", NULL, NULL, MXML_NO_DESCEND)) { loadedPalettes++; } @@ -607,12 +609,12 @@ decodePalsData (int method) int i = 0; for (section = mxmlFindElement(item, xml, "game", NULL, NULL, MXML_DESCEND); section; - section = mxmlFindElement(section, xml, "game", NULL, NULL, MXML_NO_DESCEND)) + section = mxmlFindElement(section, xml, "game", NULL, NULL, MXML_NO_DESCEND)) { loadXMLPaletteFromSection(palettes[i]); i++; } - + } mxmlDelete(xml); } @@ -963,7 +965,7 @@ static void AddPalette(gamePalette pal, const char *gameName) { InfoPrompt(msg); palettes[loadedPalettes] = pal; strncpy(palettes[loadedPalettes].gameName, gameName, 17); - loadedPalettes++; + loadedPalettes++; } bool SavePalette(bool silent, const char *gameName) { @@ -980,7 +982,7 @@ bool SavePalette(bool silent, const char *gameName) { InfoPrompt(msg); if(prefFound && palettes) { - for (int i=0; i