diff --git a/gui.pnproj b/gui.pnproj index 211cf725..b333d5ee 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/apploader.c b/source/apploader.c index 3ee503cf..6b25d522 100644 --- a/source/apploader.c +++ b/source/apploader.c @@ -217,7 +217,7 @@ bool Search_and_patch_Video_Modes(void *Address, u32 Size, GXRModeObj* Table[]) return found; } -s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch) +s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring) { app_entry appldr_entry; app_init appldr_init; @@ -307,7 +307,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch) /*GAME HOOK - FISHEARS*/ dogamehooks(dst,len); - + if (vipatch) vidolpatcher(dst,len); @@ -315,6 +315,10 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch) /*LANGUAGE PATCH - FISHEARS*/ langpatcher(dst,len); + /*Thanks to WiiPower*/ + if(patchcountrystring == 1) + PatchCountryStrings(dst, len); + DCFlushRange(dst, len); } /* Set entry point from apploader */ diff --git a/source/apploader.h b/source/apploader.h index 5481bbb9..c1d75c00 100644 --- a/source/apploader.h +++ b/source/apploader.h @@ -5,6 +5,6 @@ typedef void (*entry_point)(void); /* Prototypes */ -s32 Apploader_Run(entry_point *, u8, u8, u8); +s32 Apploader_Run(entry_point *, u8, u8, u8, u8); #endif diff --git a/source/cfg.c b/source/cfg.c index 0e5daf22..ba08ff06 100644 --- a/source/cfg.c +++ b/source/cfg.c @@ -935,6 +935,13 @@ void global_cfg_set(char *name, char *val) } return; } + else if (strcmp(name, "patchcountrystrings") == 0) { + int i; + if (sscanf(val, "%d", &i) == 1) { + Settings.patchcountrystrings = i; + } + return; + } else if (strcmp(name, "gameDisplay") == 0) { int i; if (sscanf(val, "%d", &i) == 1) { @@ -1001,12 +1008,11 @@ bool cfg_parsefile(char *fname, void (*set_func)(char*, char*)) char line[200]; //printf("opening(%s)\n", fname); - f = fopen(fname, "rt"); + f = fopen(fname, "r"); if (!f) { //printf("error opening(%s)\n", fname); return false; } - while (fgets(line, sizeof(line), f)) { // lines starting with # are comments if (line[0] == '#') continue; @@ -1022,7 +1028,7 @@ bool cfg_parsetitlefile(char *fname, void (*set_func)(char*, char*, u8)) char line[200]; //printf("opening(%s)\n", fname); - f = fopen(fname, "rt"); + f = fopen(fname, "r"); if (!f) { //printf("error opening(%s)\n", fname); return false; @@ -1110,7 +1116,7 @@ bool cfg_save_global()// save global settings mkdir("SD:/config", 0777); } FILE *f; - f = fopen("SD:/config/GXGlobal.cfg", "wt"); + f = fopen("SD:/config/GXGlobal.cfg", "w"); if (!f) { printf("Error saving %s\n", "GXGlobal.cfg"); sleep(1); @@ -1120,7 +1126,7 @@ bool cfg_save_global()// save global settings fprintf(f, "# Note: This file is automatically generated\n"); fclose(f); /* Closing and reopening because of a write issue we are having right now */ - f = fopen("SD:/config/GXGlobal.cfg", "wt"); + f = fopen("SD:/config/GXGlobal.cfg", "w"); fprintf(f, "# USB Loader global settings file\n"); fprintf(f, "# Note: This file is automatically generated\n"); fprintf(f, "video = %d\n ", Settings.video); @@ -1161,6 +1167,7 @@ bool cfg_save_global()// save global settings fprintf(f, "wiilight = %d\n ", Settings.wiilight); fprintf(f, "gameDisplay = %d\n ", Settings.gameDisplay); fprintf(f, "update_path = %s\n ", CFG.update_path); + fprintf(f, "patchcountrystrings = %d\n ", Settings.patchcountrystrings); fclose(f); return true; } @@ -1280,18 +1287,23 @@ bool cfg_load_game_num() return cfg_parsefile("SD:/config/GXGameFavorites.cfg", &game_set_num); } -bool cfg_save_games()// save per game setings +bool cfg_save_games() { FILE *f; int i; mkdir("SD:/config/", 0777); - f = fopen("SD:/config/GXGameSettings.cfg", "wt"); + f = fopen("SD:/config/GXGameSettings.cfg", "w"); if (!f) { printf("Error saving %s\n", "GXGameSettings.cfg"); sleep(1); return false; } fprintf(f, "# USB Loader settings file\n"); + fprintf(f, "# note: this file is automatically generated\n"); + fclose(f); + /* Closing and reopening because of a write issue we are having right now */ + f = fopen("SD:/config/GXGameSettings.cfg", "w"); + fprintf(f, "# USB Loader settings file\n"); fprintf(f, "# note: this file is automatically generated\n"); fprintf(f, "# Num Games: %d\n", num_saved_games); for (i=0; i= 4) + { + if (Addr[0] == SearchPattern[0] && Addr[1] == SearchPattern[1] && Addr[2] == SearchPattern[2] && Addr[3] == SearchPattern[3]) + { + //*Addr = PatchData[0]; + Addr += 1; + *Addr = PatchData[1]; + Addr += 1; + *Addr = PatchData[2]; + Addr += 1; + //*Addr = PatchData[3]; + Addr += 1; + Size -= 4; + } else + { + Addr += 4; + Size -= 4; + } + } +} diff --git a/source/disc.h b/source/disc.h index b80807ce..f52e1e71 100644 --- a/source/disc.h +++ b/source/disc.h @@ -46,8 +46,9 @@ void __Disc_SetLowMem(void); s32 Disc_SetUSB(u8 *, int ios222); s32 Disc_ReadHeader(void *); s32 Disc_IsWii(void); -s32 Disc_BootPartition(u64, u8, u8, u8); -s32 Disc_WiiBoot(u8, u8, u8); +s32 Disc_BootPartition(u64, u8, u8, u8, u8); +s32 Disc_WiiBoot(u8, u8, u8, u8); +void PatchCountryStrings(void *Address, int Size); #ifdef __cplusplus } diff --git a/source/language.c b/source/language.c index d80c38ad..3f34525a 100644 --- a/source/language.c +++ b/source/language.c @@ -132,7 +132,7 @@ snprintf(LANGUAGE.Loadingstandardlanguage, sizeof(LANGUAGE.Loadingstandardlangua snprintf(LANGUAGE.Loadingstandardmusic, sizeof(LANGUAGE.Loadingstandardmusic), "Loading standard music."); snprintf(LANGUAGE.Lock, sizeof(LANGUAGE.Lock), "Lock"); snprintf(LANGUAGE.LockConsole, sizeof(LANGUAGE.LockConsole), "Lock Console"); -snprintf(LANGUAGE.MP3Menu, sizeof(LANGUAGE.MP3Menu), "MP3 Menu"); +snprintf(LANGUAGE.Patchcountrystrings, sizeof(LANGUAGE.Patchcountrystrings), "Patch Country Strings"); snprintf(LANGUAGE.Missingfiles, sizeof(LANGUAGE.Missingfiles), "Missing files"); snprintf(LANGUAGE.Networkiniterror, sizeof(LANGUAGE.Networkiniterror), "Network init error"); snprintf(LANGUAGE.Neither, sizeof(LANGUAGE.Neither), "Neither"); @@ -664,8 +664,8 @@ void language_set(char *name, char *val) strcopy(LANGUAGE.LockConsole, val, sizeof(LANGUAGE.LockConsole)); return; } - if (strcmp(name, "MP3Menu") == 0) { - strcopy(LANGUAGE.MP3Menu, val, sizeof(LANGUAGE.MP3Menu)); + if (strcmp(name, "Patchcountrystrings") == 0) { + strcopy(LANGUAGE.Patchcountrystrings, val, sizeof(LANGUAGE.Patchcountrystrings)); return; } if (strcmp(name, "Missingfiles") == 0) { diff --git a/source/language.h b/source/language.h index 245b99b6..22d10b37 100644 --- a/source/language.h +++ b/source/language.h @@ -116,7 +116,7 @@ struct LANGUAGE char Loadingstandardmusic[80]; char Lock[30]; char LockConsole[50]; - char MP3Menu[40]; + char Patchcountrystrings[80]; char Missingfiles[50]; char Networkiniterror[50]; char Neither[40]; diff --git a/source/libwiigui/gui_gamebrowser.cpp b/source/libwiigui/gui_gamebrowser.cpp index 9de8f91b..d6984592 100644 --- a/source/libwiigui/gui_gamebrowser.cpp +++ b/source/libwiigui/gui_gamebrowser.cpp @@ -48,7 +48,7 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co bgGameImg = new GuiImage(bgGames); bgGameImg->SetParent(this); bgGameImg->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); - + maxTextWidth = bgGameImg->GetWidth() - 24 - 4; snprintf(imgPath, sizeof(imgPath), "%sbg_options_entry.png", themePath); @@ -128,13 +128,13 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co gameTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); gameTxt[i]->SetPosition(24,0); gameTxt[i]->SetMaxWidth(maxTextWidth, GuiText::DOTTED); - - + + gameTxtOver[i] = new GuiText(get_title(&gameList[i]), 20, (GXColor){THEME.gameText_r, THEME.gameText_g, THEME.gameText_b, 0xff}); gameTxtOver[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); gameTxtOver[i]->SetPosition(24,0); gameTxtOver[i]->SetMaxWidth(maxTextWidth, GuiText::SCROLL); - + gameBg[i] = new GuiImage(bgGamesEntry); game[i] = new GuiButton(width-28,GAMESELECTSIZE); @@ -146,7 +146,7 @@ GuiGameBrowser::GuiGameBrowser(int w, int h, struct discHdr * l, int gameCnt, co game[i]->SetRumble(false); game[i]->SetTrigger(trigA); game[i]->SetSoundClick(btnSoundClick); - + gameIndex[i] = i; } UpdateListEntries(); @@ -243,7 +243,7 @@ int GuiGameBrowser::GetClickedOption() } int GuiGameBrowser::GetSelectedOption() -{ +{ int found = -1; for(int i=0; i 0) { scrollbarBoxBtn->ScrollIsOn(1); - if (position2 > position1) + if (position2 > position1) { prev = this->FindMenuItem(gameIndex[selectedItem], -1); @@ -629,7 +629,7 @@ void GuiGameBrowser::Update(GuiTrigger * t) } if(old_listOffset != listOffset) UpdateListEntries(); - + if(updateCB) updateCB(this); } @@ -642,6 +642,7 @@ void GuiGameBrowser::Reload(struct discHdr * l, int count) scrollbaron = (gameCnt > pagesize) ? 1 : 0; selectedItem = 0; listOffset = 0; + focus = 1; UpdateListEntries(); for(int i=0; i +#include +#include +#include +#include +#include +#include + +#include "listfiles.h" + + +char filename[80]; + + +s32 filenamescmp(const void *a, const void *b) +{ + /* Compare strings */ + return stricmp((char *)a, (char *)b); +} + +int GetFiles(char * filespath) +{ + +int countfiles = 0; + +struct stat st; +DIR_ITER* dir; +dir = diropen (filespath); + +if (dir == NULL) //If empty + { + return 0; + } + else + { + while (dirnext(dir,filename,&st) == 0) + { + if ((st.st_mode & S_IFDIR) == 0) + { + // st.st_mode & S_IFDIR indicates a directory + snprintf(alldirfiles[countfiles], 70, "%s", filename); + countfiles++; + } + } + } + + qsort(alldirfiles, countfiles, sizeof(char[70]), filenamescmp); + +return countfiles; +} diff --git a/source/listfiles.h b/source/listfiles.h new file mode 100644 index 00000000..dd3a5159 --- /dev/null +++ b/source/listfiles.h @@ -0,0 +1,18 @@ +#ifndef _LISTFILES_H_ +#define _LISTFILES_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +char alldirfiles[300][70]; + +int GetFiles(char * filespath); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/main.cpp b/source/main.cpp index 49ab08aa..30434325 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -101,6 +101,7 @@ DefaultSettings() Settings.qboot = no; Settings.unicodefix = 0; Settings.wiilight = 1; + Settings.patchcountrystrings = 0; CFG_LoadGlobal(); } @@ -135,9 +136,7 @@ main(int argc, char *argv[]) if (ret2 < 0) { printf("ERROR: cIOS could not be loaded!"); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); - } - - fatInit(1, true); + } SDCard_Init(); diff --git a/source/menu.cpp b/source/menu.cpp index 4f41ef0f..10136637 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -40,7 +40,7 @@ #include "libwiigui/gui_customoptionbrowser.h" #include "libwiigui/gui_gamebrowser.h" #include "libwiigui/gui_diskcover.h" -#include "mp3s.h" +#include "listfiles.h" #include "fatmounter.h" #include "updater.h" @@ -3609,9 +3609,13 @@ static int MenuDiscList() carouselBtn.SetImage(&carouselBtnImg_g); carouselBtn.SetAlpha(180); } + HaltGui(); + mainWindow->Remove(&w); Settings.gameDisplay=list; gameBrowser.Reload(gameList, gameCnt); // initialize before append mainWindow->Append(&gameBrowser); + mainWindow->Append(&w); + ResumeGui(); listBtn.SetImage(&listBtnImg); listBtn.SetAlpha(255); if(CFG.widescreen) @@ -3665,9 +3669,13 @@ static int MenuDiscList() carouselBtn.SetImage(&carouselBtnImg_g); carouselBtn.SetAlpha(180); } + HaltGui(); + mainWindow->Remove(&w); Settings.gameDisplay=grid; gameGrid.Reload(gameList, gameCnt); // initialize before append mainWindow->Append(&gameGrid); + mainWindow->Append(&w); + ResumeGui(); gridBtn.SetImage(&gridBtnImg); gridBtn.SetAlpha(255); if(CFG.widescreen) @@ -3718,9 +3726,13 @@ static int MenuDiscList() mainWindow->Remove(&gameGrid); gridBtn.SetImage(&gridBtnImg_g); gridBtn.SetAlpha(180); + HaltGui(); + mainWindow->Remove(&w); Settings.gameDisplay=carousel; gameCarousel.Reload(gameList, gameCnt); // initialize before append mainWindow->Append(&gameCarousel); + mainWindow->Append(&w); + ResumeGui(); carouselBtn.SetImage(&carouselBtnImg); carouselBtn.SetAlpha(255); if(CFG.widescreen) @@ -4042,7 +4054,7 @@ static int MenuDiscList() break; } - // if we have used the network or cios222 we need to reload the disklist + // if we have used the network or cios222 we need to reload the disklist if(networkisinitialized == 1 || ios2 == 1 || Settings.cios == ios222) { @@ -4088,6 +4100,7 @@ static int MenuDiscList() LANGUAGE.Failedtoboot, text, LANGUAGE.ok,0,0,0); + } else { menu = MENU_EXIT; @@ -4615,7 +4628,7 @@ static int MenuSettings() options2.SetName(4, "%s",LANGUAGE.Backgroundmusic); options2.SetName(5, "%s",LANGUAGE.Wiilight); options2.SetName(6, "%s",LANGUAGE.Updatepath); - options2.SetName(7, "%s",LANGUAGE.MP3Menu); + options2.SetName(7, "%s",LANGUAGE.Patchcountrystrings); options2.SetName(8, "%s",LANGUAGE.Defaultsettings); } @@ -5000,6 +5013,8 @@ static int MenuSettings() Settings.unicodefix = 0; if ( Settings.wiilight > 2 ) Settings.wiilight = 0; + if ( Settings.patchcountrystrings > 1) + Settings.patchcountrystrings = 0; options2.SetValue(0, "%s", CFG.titlestxt_path); @@ -5024,7 +5039,10 @@ static int MenuSettings() else if (Settings.wiilight == 2) options2.SetValue(5,"%s",LANGUAGE.OnlyInstall); options2.SetValue(6, "%s", CFG.update_path); - options2.SetValue(7, "not working!"); + + if (Settings.patchcountrystrings == 0) options2.SetValue(7,"%s",LANGUAGE.OFF); + else if (Settings.patchcountrystrings == 1) options2.SetValue(7,"%s",LANGUAGE.ON); + options2.SetValue(8, " "); ret = optionBrowser2.GetClickedOption(); @@ -5135,13 +5153,8 @@ static int MenuSettings() Settings.wiilight++; break; case 7: - if(isSdInserted()) - { - menu = MENU_MP3; - pageToDisplay = 0; - } else - WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtousethatoption, LANGUAGE.ok, 0,0,0); - break; + Settings.patchcountrystrings++; + break; case 6: if ( CFG.godmode == 1) { @@ -5819,7 +5832,7 @@ int MenuOGG() char fullpath[150]; char shortpath[35]; - int countmp3 = GetFiles(CFG.oggload_path); + int countoggs = GetFiles(CFG.oggload_path); if(!strcmp("", CFG.oggload_path)) { sprintf(shortpath, "%s", LANGUAGE.Standard); @@ -5848,12 +5861,13 @@ int MenuOGG() oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP); oggmenubackground.SetPosition(0, 0); - GuiText backBtnTxt(LANGUAGE.Back , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); + GuiText backBtnTxt(LANGUAGE.Back , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes){ backBtnTxt.SetWidescreen(CFG.widescreen); - backBtnImg.SetWidescreen(CFG.widescreen);}////// + backBtnImg.SetWidescreen(CFG.widescreen); + } GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); backBtn.SetPosition(-180, 400); @@ -5865,11 +5879,11 @@ int MenuOGG() backBtn.SetTrigger(&trigB); backBtn.SetEffectGrow(); - customOptionList options2(countmp3); + customOptionList options2(countoggs); - for (cnt = 0; cnt < countmp3; cnt++) { + for (cnt = 0; cnt < countoggs; cnt++) { char tmp[30]; - snprintf(tmp , 30, "%s", mp3files[cnt]); + snprintf(tmp , 30, "%s", alldirfiles[cnt]); options2.SetValue(cnt, "%s", tmp); options2.SetName(cnt,"%i.", cnt+1); } @@ -5961,7 +5975,7 @@ int MenuOGG() { if (backBtn.GetState() == STATE_CLICKED) { - if(nothingchanged == 1 && countmp3 > 0) { + if(nothingchanged == 1 && countoggs > 0) { if(!strcmp("", CFG.oggload_path) || !strcmp("notset", CFG.ogg_path)) { bgMusic->Play(); } else { @@ -6008,7 +6022,7 @@ int MenuOGG() WindowPrompt(LANGUAGE.NoSDcardinserted, LANGUAGE.InsertaSDCardtosave, LANGUAGE.ok, 0,0,0); } } - if(countmp3 > 0) { + if(countoggs > 0) { optionBrowser4.SetFocus(1); } pathBtn.ResetState(); @@ -6017,9 +6031,9 @@ int MenuOGG() ret = optionBrowser4.GetClickedOption(); if(ret>=0) { - choice = WindowPrompt(LANGUAGE.Setasbackgroundmusic,mp3files[ret],LANGUAGE.Yes,LANGUAGE.No,0,0); + choice = WindowPrompt(LANGUAGE.Setasbackgroundmusic,alldirfiles[ret],LANGUAGE.Yes,LANGUAGE.No,0,0); if(choice == 1) { - snprintf(fullpath,150,"%s%s",CFG.oggload_path,mp3files[ret]); + snprintf(fullpath,150,"%s%s",CFG.oggload_path,alldirfiles[ret]); choice = bgMusic->PlayOggFile(fullpath); if(choice < 0) { WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0); @@ -6036,11 +6050,11 @@ int MenuOGG() optionBrowser4.SetFocus(1); } - if (playBtn.GetState() == STATE_CLICKED && countmp3 > 0) { - if(countmp3 > 0) { + if (playBtn.GetState() == STATE_CLICKED && countoggs > 0) { + if(countoggs > 0) { ret = optionBrowser4.GetSelectedOption(); songPlaying=ret; - snprintf(fullpath, 150,"%s%s", CFG.oggload_path,mp3files[ret]); + snprintf(fullpath, 150,"%s%s", CFG.oggload_path,alldirfiles[ret]); choice = bgMusic->PlayOggFile(fullpath); if(choice < 0) { WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0); @@ -6059,10 +6073,10 @@ int MenuOGG() } if(nextBtn.GetState() == STATE_CLICKED){ - if(countmp3 > 0) { + if(countoggs > 0) { songPlaying++; - if (songPlaying>(countmp3 - 1)){songPlaying=0;} - snprintf(fullpath,150,"%s%s", CFG.oggload_path,mp3files[songPlaying]); + if (songPlaying>(countoggs - 1)){songPlaying=0;} + snprintf(fullpath,150,"%s%s", CFG.oggload_path,alldirfiles[songPlaying]); choice = bgMusic->PlayOggFile(fullpath); if(choice < 0) { WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0); @@ -6079,10 +6093,10 @@ int MenuOGG() nextBtn.ResetState(); } if(prevBtn.GetState() == STATE_CLICKED) { - if(countmp3 > 0) { + if(countoggs > 0) { songPlaying--; - if (songPlaying<0){songPlaying=(countmp3 - 1);} - snprintf(fullpath,150,"%s%s", CFG.oggload_path,mp3files[songPlaying]); + if (songPlaying<0){songPlaying=(countoggs - 1);} + snprintf(fullpath,150,"%s%s", CFG.oggload_path,alldirfiles[songPlaying]); choice = bgMusic->PlayOggFile(fullpath); if(choice < 0) { WindowPrompt(LANGUAGE.Notasupportedformat, LANGUAGE.Loadingstandardmusic, LANGUAGE.ok, 0,0,0); @@ -6099,7 +6113,7 @@ int MenuOGG() prevBtn.ResetState(); } if(stopBtn.GetState() == STATE_CLICKED) { - if(countmp3 > 0) { + if(countoggs > 0) { StopOgg(); nothingchanged = 1; optionBrowser4.SetFocus(1); @@ -6116,221 +6130,6 @@ int MenuOGG() return menu; } -/**************************************************************************** - * MenuMp3 - ***************************************************************************/ -int MenuMp3() -{ - int menu = MENU_NONE, cnt = 0; - int ret = 0; - int scrollon, i = 0; - char imgPath[100]; - - GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol); - GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol); - - GuiTrigger trigA; - trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); - - char mp3path[30] = "SD:/mp3/"; - char fullpath[110]; - int countmp3 = GetFiles(mp3path); - - customOptionList options2(countmp3); - - for (cnt = 0; cnt < countmp3; cnt++) { - char tmp[30]; - snprintf(tmp , 30, "%s", mp3files[cnt]); - options2.SetValue(cnt, "%s", tmp); - options2.SetName(cnt,"%i.", cnt+1); - } - // options2.length = cnt; - - snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path); - GuiImageData btnOutline(imgPath, button_dialogue_box_png); - if(cnt < 9) { - scrollon = 0; - } else { - scrollon = 1; - } - GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 85); - optionBrowser4.SetPosition(0, 90); - optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - - GuiText cancelBtnTxt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); - cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); - GuiImage cancelBtnImg(&btnOutline); - if (Settings.wsprompt == yes){ - cancelBtnTxt.SetWidescreen(CFG.widescreen); - cancelBtnImg.SetWidescreen(CFG.widescreen);} - GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); - cancelBtn.SetScale(0.9); - cancelBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - cancelBtn.SetPosition(210, 400); - cancelBtn.SetLabel(&cancelBtnTxt); - cancelBtn.SetImage(&cancelBtnImg); - cancelBtn.SetSoundOver(&btnSoundOver); - cancelBtn.SetTrigger(&trigA); - cancelBtn.SetEffectGrow(); - - int songPlaying=0; - - GuiTrigger trigHome; - trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0); - GuiTrigger trigL; - trigL.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT); - GuiTrigger trigR; - trigR.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT); - GuiTrigger trigMinus; - trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0); - GuiTrigger trigPlus; - trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0); - - snprintf(imgPath, sizeof(imgPath), "%sarrow_next.png", CFG.theme_path); - GuiImageData next(imgPath, arrow_next_png); - snprintf(imgPath, sizeof(imgPath), "%sarrow_previous.png", CFG.theme_path); - GuiImageData prev(imgPath, arrow_previous_png); - snprintf(imgPath, sizeof(imgPath), "%smp3_stop.png", CFG.theme_path); - GuiImageData stop(imgPath, mp3_stop_png); - snprintf(imgPath, sizeof(imgPath), "%smp3_pause.png", CFG.theme_path); - GuiImageData pause(imgPath, mp3_pause_png); - snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path); - GuiImageData play(imgPath, startgame_arrow_right_png); - - GuiImage nextBtnImg(&next); - GuiButton nextBtn(next.GetWidth(), next.GetHeight()); - nextBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - nextBtn.SetPosition(100, 400); - nextBtn.SetImage(&nextBtnImg); - nextBtn.SetSoundOver(&btnSoundOver); - nextBtn.SetSoundClick(&btnClick); - nextBtn.SetTrigger(&trigA); - nextBtn.SetTrigger(&trigR); - nextBtn.SetEffectGrow(); - - GuiImage prevBtnImg(&prev); - prevBtnImg.SetWidescreen(CFG.widescreen); - GuiButton prevBtn(prev.GetWidth(), prev.GetHeight()); - prevBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - prevBtn.SetPosition(-100, 400); - prevBtn.SetImage(&prevBtnImg); - prevBtn.SetSoundOver(&btnSoundOver); - prevBtn.SetSoundClick(&btnClick); - prevBtn.SetTrigger(&trigA); - prevBtn.SetTrigger(&trigL); - prevBtn.SetEffectGrow(); - - GuiImage playBtnImg(&play); - playBtnImg.SetWidescreen(CFG.widescreen); - GuiButton playBtn(play.GetWidth(), play.GetHeight()); - playBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - playBtn.SetPosition(42, 400); - playBtn.SetImage(&playBtnImg); - playBtn.SetSoundOver(&btnSoundOver); - playBtn.SetSoundClick(&btnClick); - playBtn.SetTrigger(&trigA); - playBtn.SetTrigger(&trigPlus); - playBtn.SetEffectGrow(); - - GuiImage stopBtnImg(&stop); - stopBtnImg.SetWidescreen(CFG.widescreen); - GuiButton stopBtn(stop.GetWidth(), stop.GetHeight()); - stopBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - stopBtn.SetPosition(-27, 400); - stopBtn.SetImage(&stopBtnImg); - stopBtn.SetSoundOver(&btnSoundOver); - stopBtn.SetSoundClick(&btnClick); - stopBtn.SetTrigger(&trigA); - stopBtn.SetTrigger(&trigMinus); - stopBtn.SetEffectGrow(); - - GuiImage pauseBtnImg(&pause); - pauseBtnImg.SetWidescreen(CFG.widescreen); - - HaltGui(); - GuiWindow w(screenwidth, screenheight); - w.Append(&cancelBtn); - w.Append(&playBtn); - w.Append(&playBtn); - w.Append(&nextBtn); - w.Append(&prevBtn); - w.Append(&stopBtn); - mainWindow->Append(&optionBrowser4); - mainWindow->Append(&w); - - ResumeGui(); - - while(menu == MENU_NONE) - { - if (cancelBtn.GetState() == STATE_CLICKED) - { - menu = MENU_DISCLIST; - CloseMp3(); - bgMusic->Play(); - break; - } - - ret = optionBrowser4.GetClickedOption(); - - for(i = 0; i < countmp3; i++) { - if(i == ret) { - sprintf(fullpath,"%s%s", mp3path,mp3files[ret]); - PlayMp3(fullpath); - songPlaying=ret; - SetMp3Volume(127); - } - } - - if (playBtn.GetState() == STATE_CLICKED) { - StopMp3(); - ret = optionBrowser4.GetSelectedOption(); - songPlaying=ret; - sprintf(fullpath,"%s%s", mp3path,mp3files[ret]); - PlayMp3(fullpath); - SetMp3Volume(127); - playBtn.ResetState(); - - } - - if(nextBtn.GetState() == STATE_CLICKED) - { - StopMp3(); - songPlaying++; - if (songPlaying>(countmp3 - 1)){songPlaying=0;} - sprintf(fullpath,"%s%s", mp3path,mp3files[songPlaying]); - PlayMp3(fullpath); - SetMp3Volume(127); - nextBtn.ResetState(); - } - if(prevBtn.GetState() == STATE_CLICKED) - { - StopMp3(); - songPlaying--; - if (songPlaying<0){songPlaying=(countmp3 - 1);} - sprintf(fullpath,"%s%s", mp3path,mp3files[songPlaying]); - PlayMp3(fullpath); - SetMp3Volume(127); - prevBtn.ResetState(); - } - if(stopBtn.GetState() == STATE_CLICKED) - { StopMp3(); - stopBtn.ResetState(); - playBtn.SetImage(&playBtnImg); - //break; - } - } - - HaltGui(); - w.Remove(&playBtn); - w.Remove(&nextBtn); - w.Remove(&prevBtn); - w.Remove(&stopBtn); - mainWindow->Remove(&optionBrowser4); - mainWindow->Remove(&w); - ResumeGui(); - -return menu; -} /**************************************************************************** * MainMenu ***************************************************************************/ @@ -6399,9 +6198,6 @@ int MainMenu(int menu) case MENU_DISCLIST: currentMenu = MenuDiscList(); break; - case MENU_MP3: - currentMenu = MenuMp3(); - break; case MENU_OGG: currentMenu = MenuOGG(); break; @@ -6539,7 +6335,7 @@ int MainMenu(int menu) break; } - u32 videoselected = 0; + u8 videoselected = 0; switch(videoChoice) { @@ -6557,17 +6353,20 @@ int MainMenu(int menu) case ntsc: videoselected = 3; + break; case systemdefault: videoselected = 4; break; + case patch: videoselected = 5; break; + default: - videoselected = 3; + videoselected = 0; break; } @@ -6604,9 +6403,8 @@ int MainMenu(int menu) } int ret = 0; - ret = Disc_WiiBoot(videoselected, cheat, vipatch); + ret = Disc_WiiBoot(videoselected, cheat, vipatch, Settings.patchcountrystrings); if (ret < 0) { - printf("%s (ret = %d)\n",LANGUAGE.Error, ret); ExitApp(); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); } diff --git a/source/menu.h b/source/menu.h index f25b9692..47b1a0f2 100644 --- a/source/menu.h +++ b/source/menu.h @@ -25,8 +25,7 @@ enum MENU_INSTALL, MENU_CHECK, MENU_GAME_SETTINGS, - MENU_OGG, - MENU_MP3 + MENU_OGG }; #endif diff --git a/source/mp3s.c b/source/mp3s.c deleted file mode 100644 index 6a879835..00000000 --- a/source/mp3s.c +++ /dev/null @@ -1,140 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mp3s.h" - -char filename[80]; - -//Files -FILE* pFile; - - -s32 my_reader(void *fp,void *dat, s32 size) -{ - return fread(dat, 1, size, fp); -} - - -void StopMp3() -{ - if(MP3Player_IsPlaying()) { - MP3Player_Stop(); - } -} - -void CloseMp3() { - - if(MP3Player_IsPlaying()) { - MP3Player_Stop(); - } - fclose(pFile); -} - -void SetMp3Volume(u32 vol) -{ - MP3Player_Volume(vol); -} - -int PlayMp3(char * path) { - - if(!MP3Player_IsPlaying()) { - MP3Player_Init(); - } else { - StopMp3(); - } - - pFile = fopen (path, "r"); - MP3Player_PlayFile(pFile, my_reader, NULL); - return 1; -} - -/* -int PlayMp3(char * path) -{ - - - if(!MP3Player_IsPlaying()) { - MP3Player_Init(); - } else { - MP3Player_Stop(); - } - long lSize = 0; - char * buffermp3 = NULL; - size_t resultmp3; - - pFile = fopen (path, "r"); - - //Check that pFile exist - if (pFile!=NULL) - { - // obtain file size: - fseek (pFile , 0 , SEEK_END); - lSize = ftell (pFile); - rewind (pFile); - - // allocate memory to contain the whole file: - buffermp3 = (char*) malloc (sizeof(char)*lSize); - if (buffermp3 == NULL) {fputs (" Memory error",stderr); exit (2);} - - // copy the file into the buffer: - resultmp3 = fread (buffermp3,1,lSize,pFile); - if (resultmp3 != lSize) {fputs (" Reading error",stderr); exit (3);} - - - fclose (pFile); - } - - if (buffermp3 != NULL) - { - MP3Player_PlayBuffer(buffermp3,lSize,NULL); - return 1; - } - -return 0; -} -*/ - -s32 filenamescmp(const void *a, const void *b) -{ - /* Compare strings */ - return stricmp((char *)a, (char *)b); -} - -int GetFiles(char * mp3path) -{ -int countmp3 = 0; - -struct stat st; -DIR_ITER* dir; -dir = diropen (mp3path); - -if (dir == NULL) //If empty - { - return 0; - } - else - { - while (dirnext(dir,filename,&st) == 0) - { - if ((st.st_mode & S_IFDIR) == 0) - { - // st.st_mode & S_IFDIR indicates a directory - sprintf(mp3files[countmp3], "%s", filename); - countmp3++; - } - } - } - - qsort(mp3files, countmp3, sizeof(char[70]), filenamescmp); - -return countmp3; -} diff --git a/source/mp3s.h b/source/mp3s.h deleted file mode 100644 index a5a06aeb..00000000 --- a/source/mp3s.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _MP3S_H_ -#define _MP3S_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -char mp3files[300][70]; - -void StopMp3(); -void SetMp3Volume(u32 vol); -int PlayMp3(char * path); -int OpenMp3(char * path); -void CloseMp3(); -int GetFiles(char * mp3path); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/source/oggplayer.c b/source/oggplayer.c index 38b10af6..b709857b 100644 --- a/source/oggplayer.c +++ b/source/oggplayer.c @@ -25,7 +25,6 @@ */ #include "oggplayer.h" -#include "mp3s.h" #include #include #include diff --git a/source/sys.c b/source/sys.c index 727a73c1..39b6371d 100644 --- a/source/sys.c +++ b/source/sys.c @@ -62,6 +62,8 @@ int Sys_IosReload(int IOS) USBStorage_Deinit(); + __IOS_ShutdownSubsystems(); + ret = IOS_ReloadIOS(IOS); if(ret < 0) { @@ -73,7 +75,7 @@ int Sys_IosReload(int IOS) WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight); - if(IOS == 249 || IOS == 222 || IOS == 223) { + if(IOS == 249 || IOS == 222) { ret = WBFS_Init(WBFS_DEVICE_USB); ret = Disc_Init(); ret = WBFS_Open();