diff --git a/gui.pnproj b/gui.pnproj index ce3d65fd..d2cb4a7f 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/gui.pnps b/gui.pnps index 8aa31c7a..328767aa 100644 --- a/gui.pnps +++ b/gui.pnps @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/cheats/gct.cpp b/source/cheats/gct.cpp index 7ac29f14..56dd210b 100644 --- a/source/cheats/gct.cpp +++ b/source/cheats/gct.cpp @@ -175,20 +175,34 @@ int GCTCheats::openTxtfile(const char * filename) { filestr.seekg(0,ios_base::beg); getline(filestr,sGameID); + if (sGameID[sGameID.length() - 1] == '\r') + sGameID.erase(sGameID.length() - 1); + getline(filestr,sGameTitle); - filestr.ignore(); + if (sGameTitle[sGameTitle.length() - 1] == '\r') + sGameTitle.erase(sGameTitle.length() - 1); + + //filestr.ignore(); + getline(filestr,sCheatName[i]); // skip first line if file uses CRLF + if (!sGameTitle[sGameTitle.length() - 1] == '\r') + filestr.seekg(0,ios_base::beg); while (!filestr.eof()) { - getline(filestr,sCheatName[i]); + + getline(filestr,sCheatName[i]); // '\n' delimiter by default + if (sCheatName[i][sCheatName[i].length() - 1] == '\r') + sCheatName[i].erase(sCheatName[i].length() - 1); + string cheatdata; bool emptyline = false; bool isComment = false; do { - getline(filestr,str,'\n'); - //cheatdata.append(str); - - if (str == "") { + getline(filestr,str); + if (str[str.length() - 1] == '\r') + str.erase(str.length() - 1); + + if (str == "" || str[0] == '\r' || str[0] == '\n') { emptyline = true; break; } diff --git a/source/filelist.h b/source/filelist.h index 38da34d1..93e9ec60 100644 --- a/source/filelist.h +++ b/source/filelist.h @@ -62,6 +62,9 @@ extern const u32 menuin_ogg_size; extern const u8 menuout_ogg[]; extern const u32 menuout_ogg_size; +extern const u8 success_ogg[]; +extern const u32 success_ogg_size; + extern const u8 credits_button_png[]; extern const u32 credits_button_png_size; @@ -269,6 +272,9 @@ extern const u32 battery_bar_white_png_size; extern const u8 battery_red_png[]; extern const u32 battery_red_png_size; +extern const u8 battery_bar_red_png[]; +extern const u32 battery_bar_red_png_size; + extern const u8 arrow_next_png[]; extern const u32 arrow_next_png_size; diff --git a/source/images/battery_bar_red.png b/source/images/battery_bar_red.png new file mode 100644 index 00000000..bc09b4c3 Binary files /dev/null and b/source/images/battery_bar_red.png differ diff --git a/source/images/battery_red.png b/source/images/battery_red.png index bc09b4c3..458b7364 100644 Binary files a/source/images/battery_red.png and b/source/images/battery_red.png differ diff --git a/source/menu.cpp b/source/menu.cpp index 70686736..bc621811 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -323,10 +323,12 @@ int MenuDiscList() { snprintf(imgPath, sizeof(imgPath), "%sbattery.png", CFG.theme_path); GuiImageData battery(imgPath, battery_png); - snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path); - GuiImageData batteryRed(imgPath, battery_red_png); snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", CFG.theme_path); GuiImageData batteryBar(imgPath, battery_bar_png); + snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path); + GuiImageData batteryRed(imgPath, battery_red_png); + snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_red.png", CFG.theme_path); + GuiImageData batteryBarRed(imgPath, battery_bar_red_png); snprintf(imgPath, sizeof(imgPath), "%sfavIcon.png", CFG.theme_path); GuiImageData imgfavIcon(imgPath, favIcon_png); @@ -1364,11 +1366,13 @@ static int MenuInstall() { snprintf(imgPath, sizeof(imgPath), "%sbattery.png", CFG.theme_path); GuiImageData battery(imgPath, battery_png); - snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path); - GuiImageData batteryRed(imgPath, battery_red_png); - snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", CFG.theme_path); + snprintf(imgPath, sizeof(imgPath), "%sbattery_bar.png", CFG.theme_path); GuiImageData batteryBar(imgPath, battery_bar_png); - + snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path); + GuiImageData batteryRed(imgPath, battery_red_png); + snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_red.png", CFG.theme_path); + GuiImageData batteryBarRed(imgPath, battery_bar_red_png); + HaltGui(); GuiWindow w(screenwidth, screenheight); @@ -1449,7 +1453,14 @@ static int MenuInstall() { break; } else { __Menu_GetEntries(); //get the entries again + GuiSound * instsuccess = NULL; + instsuccess = new GuiSound(success_ogg, success_ogg_size, SOUND_OGG, Settings.sfxvolume); + instsuccess->SetVolume(Settings.sfxvolume); + instsuccess->SetLoop(0); + instsuccess->Play(); WindowPrompt (tr("Successfully installed:"),name,tr("OK")); + instsuccess->Stop(); + delete instsuccess; menu = MENU_DISCLIST; break; } @@ -1529,8 +1540,10 @@ static int MenuFormat() { snprintf(imgPath, sizeof(imgPath), "%smenu_button_over.png", CFG.theme_path); GuiImageData btnhomeOver(imgPath, menu_button_over_png); GuiImageData battery(battery_png); - GuiImageData batteryRed(battery_red_png); GuiImageData batteryBar(battery_bar_png); + GuiImageData batteryRed(battery_red_png); + GuiImageData batteryBarRed(battery_bar_red_png); + GuiTrigger trigA; trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index c35d89d4..4d59533b 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -710,10 +710,13 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, snprintf(imgPath, sizeof(imgPath), "%sbattery_white.png", CFG.theme_path); GuiImageData battery(imgPath, battery_white_png); - snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path); - GuiImageData batteryRed(imgPath, battery_red_png); - snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_white.png", CFG.theme_path); + snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_white.png", CFG.theme_path); GuiImageData batteryBar(imgPath, battery_bar_white_png); + snprintf(imgPath, sizeof(imgPath), "%sbattery_red.png", CFG.theme_path); + GuiImageData batteryRed(imgPath, battery_red_png); + snprintf(imgPath, sizeof(imgPath), "%sbattery_bar_red.png", CFG.theme_path); + GuiImageData batteryBarRed(imgPath, battery_bar_red_png); + #ifdef HW_RVL int i = 0, ret = 0, level; @@ -871,12 +874,15 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, if (WPAD_Probe(i, NULL) == WPAD_ERR_NONE) { // controller connected level = (userInput[i].wpad.battery_level / 100.0) * 4; if (level > 4) level = 4; - batteryImg[i]->SetTile(level); - - if (level == 0) - batteryBarImg[i]->SetImage(&batteryRed); - else + + if (level <= 1) { + batteryBarImg[i]->SetImage(&batteryBarRed); + batteryImg[i]->SetImage(&batteryRed); + } else { batteryBarImg[i]->SetImage(&batteryBar); + } + + batteryImg[i]->SetTile(level); batteryBtn[i]->SetAlpha(255); } else { // controller not connected @@ -3022,11 +3028,11 @@ int CodeDownload(const char *id) { snprintf(txtpath, sizeof(txtpath), "%s%s.txt", Settings.TxtCheatcodespath,id); char codeurl[150]; - snprintf(codeurl, sizeof(codeurl), "http://usbgecko.com/codes/codes/R/%s.txt",id); + snprintf(codeurl, sizeof(codeurl), "http://geckocodes.org/codes/R/%s.txt",id); struct block file = downloadfile(codeurl); - if (file.size == 333) { + if (file.size == 333 || file.size == 216 || file.size == 284) { strcat(codeurl, tr(" is not on the server.")); WindowPrompt(tr("Error"),codeurl,tr("Ok")); @@ -3034,7 +3040,8 @@ int CodeDownload(const char *id) { goto exit; } - if (file.data != NULL) { + if (file.data != NULL) { + FILE * pfile; pfile = fopen(txtpath, "wb"); fwrite(file.data,1,file.size,pfile); diff --git a/source/prompts/gameinfo.cpp b/source/prompts/gameinfo.cpp index 2fe20e09..f03e235c 100644 --- a/source/prompts/gameinfo.cpp +++ b/source/prompts/gameinfo.cpp @@ -204,7 +204,7 @@ int showGameInfo(char *ID) { urlBtn.SetTrigger(&trig1); gameinfoWindow.Append(&urlBtn); - char linebuf[3000] = ""; + char linebuf[XML_SYNOPSISLEN] = ""; char linebuf2[100] = ""; // enable icons for required accessories diff --git a/source/settings/SettingsPrompts.cpp b/source/settings/SettingsPrompts.cpp index 63ff4b51..cf9716d9 100644 --- a/source/settings/SettingsPrompts.cpp +++ b/source/settings/SettingsPrompts.cpp @@ -206,7 +206,8 @@ bool MenuOGG() { cfg_save_global(); } defaultBtn.ResetState(); - optionBrowser4.SetFocus(1); + if (countoggs > 0) + optionBrowser4.SetFocus(1); } if (pathBtn.GetState() == STATE_CLICKED) { diff --git a/source/sounds/success.ogg b/source/sounds/success.ogg new file mode 100644 index 00000000..bb3821e5 Binary files /dev/null and b/source/sounds/success.ogg differ diff --git a/source/xml/xml.h b/source/xml/xml.h index 1c9d275f..c235c7ce 100644 --- a/source/xml/xml.h +++ b/source/xml/xml.h @@ -15,15 +15,16 @@ extern "C" { bool LoadGameInfoFromXML(char* gameid, char* langcode); #define XML_ELEMMAX 15 +#define XML_SYNOPSISLEN 4000 struct gameXMLinfo { char id[7]; char version[50]; char region[7]; char title[200]; - char synopsis[3000]; + char synopsis[XML_SYNOPSISLEN]; char title_EN[200]; - char synopsis_EN[3000]; + char synopsis_EN[XML_SYNOPSISLEN]; char locales[XML_ELEMMAX+1][5]; int localeCnt; char developer[75];