diff --git a/gui.pnproj b/gui.pnproj
index 474de74a..a67b85a7 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/fatmounter.c b/source/fatmounter.c
index 6c9a1ca2..a4e0b104 100644
--- a/source/fatmounter.c
+++ b/source/fatmounter.c
@@ -34,10 +34,6 @@ void USBDevice_deInit() {
fatUnmount("USB:/");
}
-int isSdInserted() {
- return __io_sdhc.isInserted() || __io_wiisd.isInserted();
-}
-
int isInserted(const char *path) {
if (!strncmp(path, "USB:", 4))
return 1;
@@ -48,10 +44,10 @@ int SDCard_Init() {
//closing all open Files write back the cache and then shutdown em!
fatUnmount("SD:/");
//right now mounts first FAT-partition
- if (fatMount("SD", &__io_sdhc, 0, CACHE, SDHC_SECTOR_SIZE))
+ if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS))
+ return 1;
+ else if (fatMount("SD", &__io_sdhc, 0, CACHE, SDHC_SECTOR_SIZE))
return 1;
- else if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS))
- return 1;
return -1;
}
diff --git a/source/fatmounter.h b/source/fatmounter.h
index e35faf41..b53c52a8 100644
--- a/source/fatmounter.h
+++ b/source/fatmounter.h
@@ -7,7 +7,6 @@ extern "C" {
int USBDevice_Init();
void USBDevice_deInit();
- int isSdInserted();
int isInserted(const char *path);
int SDCard_Init();
void SDCard_deInit();
diff --git a/source/fonts/font.ttf b/source/fonts/font.ttf
index d4c461ca..01ce5816 100644
Binary files a/source/fonts/font.ttf and b/source/fonts/font.ttf differ
diff --git a/source/menu.cpp b/source/menu.cpp
index 7b175588..f8eb4c6a 100644
--- a/source/menu.cpp
+++ b/source/menu.cpp
@@ -1062,7 +1062,6 @@ int MenuDiscList() {
startat = gameCarousel->GetSelectedOption();
offset = gameCarousel->GetOffset();
}
- //if(isSdInserted()) {
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();
@@ -1074,7 +1073,6 @@ int MenuDiscList() {
}
else if (DownloadBtn.GetState() == STATE_CLICKED) {
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
choice = WindowPrompt(tr("Cover Download"), 0, tr("Normal Covers"), tr("3D Covers"), tr("Disc Images"), tr("Back")); // ask for download choice
if (choice != 0) {
@@ -1133,7 +1131,6 @@ int MenuDiscList() {
else if (favoriteBtn.GetState() == STATE_CLICKED) {
Settings.fave=!Settings.fave;
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
cfg_save_global();
}
@@ -1228,7 +1225,6 @@ int MenuDiscList() {
else if (abcBtn.GetState() == STATE_CLICKED) {
if (Settings.sort != all) {
Settings.sort=all;
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
cfg_save_global();
}
@@ -1243,7 +1239,6 @@ int MenuDiscList() {
else if (countBtn.GetState() == STATE_CLICKED) {
if (Settings.sort != pcount) {
Settings.sort=pcount;
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
cfg_save_global();
}
diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp
index 254e7eb8..7fa8ffa5 100644
--- a/source/prompts/PromptWindows.cpp
+++ b/source/prompts/PromptWindows.cpp
@@ -18,6 +18,7 @@
#include "network/networkops.h"
#include "network/http.h"
#include "prompts/PromptWindows.h"
+#include "prompts/gameinfo.h"
#include "mload/mload.h"
#include "fatmounter.h"
#include "listfiles.h"
@@ -1380,7 +1381,6 @@ int GameWindowPrompt() {
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
}
else if (btnFavorite1.GetState() == STATE_CLICKED) {//switch favorite
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id, 1);
SetFavoriteImages(&btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4, &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
@@ -1388,7 +1388,6 @@ int GameWindowPrompt() {
btnFavorite1.ResetState();
}
else if (btnFavorite2.GetState() == STATE_CLICKED) {//switch favorite
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id, 2);
SetFavoriteImages(&btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4, &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
@@ -1396,7 +1395,6 @@ int GameWindowPrompt() {
btnFavorite2.ResetState();
}
else if (btnFavorite3.GetState() == STATE_CLICKED) {//switch favorite
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id, 3);
SetFavoriteImages(&btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4, &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
@@ -1404,7 +1402,6 @@ int GameWindowPrompt() {
btnFavorite3.ResetState();
}
else if (btnFavorite4.GetState() == STATE_CLICKED) {//switch favorite
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id, 4);
SetFavoriteImages(&btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4, &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
@@ -1412,7 +1409,6 @@ int GameWindowPrompt() {
btnFavorite4.ResetState();
}
else if (btnFavorite5.GetState() == STATE_CLICKED) {//switch favorite
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
SetFavorite(&btnFavorite1, &btnFavorite2, &btnFavorite3, &btnFavorite4, &btnFavorite5, header->id, 5);
SetFavoriteImages(&btnFavoriteImg1, &btnFavoriteImg2, &btnFavoriteImg3, &btnFavoriteImg4, &btnFavoriteImg5, &imgFavorite, &imgNotFavorite);
@@ -1823,7 +1819,7 @@ bool SearchMissingImages(int choice2) {
__Menu_GetEntries();
ResumeGui();
- if (cntMissFiles > 0) { //&& !IsNetworkInit()) {
+ if (cntMissFiles > 0) {
NetworkInitPrompt();
}
@@ -1837,6 +1833,10 @@ bool SearchMissingImages(int choice2) {
* NetworkInitPrompt
***************************************************************************/
bool NetworkInitPrompt() {
+
+ if (IsNetworkInit())
+ return true;
+
bool success = true;
GuiWindow promptWindow(472,320);
@@ -2548,23 +2548,9 @@ int ProgressUpdateWindow() {
}
//make the URL to get XML based on our games
- char XMLurl[3540]; // NET_BUFFER_SIZE in http.c needs to be set to size of XMLurl + 40
- char filename[10];
- __Menu_GetEntries(1);
- snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s&ID=",Settings.db_language);
- unsigned int i;
- for (i = 0; i < gameCnt ; i++) {
- struct discHdr* header = &gameList[i];
- if (i<500) {
- //snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]);
- //strncat(XMLurl,filename,3);
- snprintf(filename,sizeof(filename),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
- strncat(XMLurl,filename,6);
- if ((i!=gameCnt-1)&&(i<500))
- strncat(XMLurl, ",",1);
- }
- }
- __Menu_GetEntries();
+ char XMLurl[3540];
+ build_XML_URL(XMLurl,sizeof(XMLurl));
+
if (IsNetworkInit() && ret >= 0) {
updatemode = WindowPrompt(tr("What do you want to update?"), 0, "USBLoader GX", tr("WiiTDB Files"), tr("Languagefile"), tr("Cancel"));
@@ -2868,23 +2854,9 @@ int ProgressUpdateWindow() {
}
//make the URL to get XML based on our games
- char XMLurl[3540];
- char filename[10];
- __Menu_GetEntries(1);
- snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s&ID=",Settings.db_language);
- unsigned int i;
- for (i = 0; i < gameCnt ; i++) {
- struct discHdr* header = &gameList[i];
- if (i<500) {
- //snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]);
- //strncat(XMLurl, filename,3 );
- snprintf(filename,sizeof(filename),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
- strncat(XMLurl,filename,6);
- if ((i!=gameCnt-1)&&(i<500))
- strncat(XMLurl, ",",1);
- }
- }
- __Menu_GetEntries();
+ char XMLurl[3540];
+ build_XML_URL(XMLurl,sizeof(XMLurl));
+
char dolpath[150];
// char dolpathsuccess[150];//use coverspath as a folder for the update wad so we dont make a new folder and have to delete it
snprintf(dolpath, sizeof(dolpath), "%sULNR.wad", Settings.covers_path);
diff --git a/source/prompts/gameinfo.cpp b/source/prompts/gameinfo.cpp
index 2f5230c7..3a1c416e 100644
--- a/source/prompts/gameinfo.cpp
+++ b/source/prompts/gameinfo.cpp
@@ -1086,26 +1086,10 @@ bool save_XML_URL() { // save xml url as as txt file for people without wifi
sleep(1);
return false;
}
- //make sure that all games are added to the gamelist
- __Menu_GetEntries(1);
-
- char XMLurl[3540];
- char filename[10];
-
- snprintf(XMLurl,sizeof(XMLurl),"http://wiitdb.com/wiitdb.zip?LANG=%s&ID=", Settings.db_language);
- unsigned int i;
- for (i = 0; i < gameCnt ; i++) {
- struct discHdr* header = &gameList[i];
- if (i<500) {
- //snprintf(filename,sizeof(filename),"%c%c%c", header->id[1], header->id[2], header->id[3]);
- //strncat(XMLurl, filename,3 );
- snprintf(filename,sizeof(filename),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
- strncat(XMLurl,filename,6);
- if ((i!=gameCnt-1)&&(i<500))
- strncat(XMLurl, ",",1);
- }
- }
-
+
+ char XMLurl[3540];
+ build_XML_URL(XMLurl,sizeof(XMLurl));
+
fprintf(f, "# USB Loader Has Saved this file\n");
fprintf(f, "# This URL was created based on your list of games and language settings.\n");
fclose(f);
@@ -1118,7 +1102,6 @@ bool save_XML_URL() { // save xml url as as txt file for people without wifi
fclose(f);
- __Menu_GetEntries();
return true;
}
@@ -1129,3 +1112,24 @@ void MemInfoPrompt()
strlcpy(meminfotxt,MemInfo(),sizeof(meminfotxt));
WindowPrompt(0,meminfotxt, tr("OK"));
}
+
+
+void build_XML_URL(char *XMLurl, int XMLurlsize) {
+ __Menu_GetEntries(1);
+ // NET_BUFFER_SIZE in http.c needs to be set to size of XMLurl + 40
+ char url[3540];
+ char filename[10];
+ snprintf(url,sizeof(url),"http://wiitdb.com/wiitdb.zip?LANG=%s&ID=", Settings.db_language);
+ unsigned int i;
+ for (i = 0; i < gameCnt ; i++) {
+ struct discHdr* header = &gameList[i];
+ if (i<500) {
+ snprintf(filename,sizeof(filename),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
+ strncat(url,filename,6);
+ if ((i!=gameCnt-1)&&(i<500))
+ strncat(url, ",",1);
+ }
+ }
+ strlcpy(XMLurl,url,XMLurlsize);
+ __Menu_GetEntries();
+}
diff --git a/source/prompts/gameinfo.h b/source/prompts/gameinfo.h
index c8bc701e..4f46670b 100644
--- a/source/prompts/gameinfo.h
+++ b/source/prompts/gameinfo.h
@@ -9,6 +9,7 @@
#define _GAMEINFO_H_
int showGameInfo(char *ID);
+void build_XML_URL(char *XMLurl, int XMLurlsize);
bool save_XML_URL();
bool save_gamelist(int txt);
void MemInfoPrompt();
diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp
index 6c19a1a1..6fcd66cd 100644
--- a/source/settings/Settings.cpp
+++ b/source/settings/Settings.cpp
@@ -551,7 +551,6 @@ int MenuSettings() {
switch (ret)
{
case 0:
- //if(isSdInserted()) {
if (isInserted(bootDevice)) {
if ( Settings.godmode == 1) {
w.SetEffect(EFFECT_FADE, -20);
@@ -1130,7 +1129,6 @@ int MenuSettings() {
switch (ret)
{
case 0:
- //if(isSdInserted())
if (isInserted(bootDevice)) {
w.SetEffect(EFFECT_FADE, -20);
while (w.GetEffect()>0) usleep(50);
@@ -1293,7 +1291,6 @@ int MenuSettings() {
strncat (entered, "/", 1);
strlcpy(Settings.covers_path, entered, sizeof(Settings.covers_path));
WindowPrompt(tr("Cover Path Changed"),0,tr("OK"));
- // if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
}
@@ -1319,7 +1316,6 @@ int MenuSettings() {
strncat (entered, "/", 1);
strlcpy(Settings.covers2d_path, entered, sizeof(Settings.covers2d_path));
WindowPrompt(tr("Cover Path Changed"),0,tr("OK"));
- // if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
}
@@ -1345,7 +1341,6 @@ int MenuSettings() {
strncat (entered, "/", 1);
strlcpy(Settings.disc_path, entered, sizeof(Settings.disc_path));
WindowPrompt(tr("Disc Path Changed"),0,tr("OK"));
- // if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
}
@@ -1370,7 +1365,6 @@ int MenuSettings() {
strncat (entered, "/", 1);
strlcpy(CFG.theme_path, entered, sizeof(CFG.theme_path));
WindowPrompt(tr("Theme Path Changed"),0,tr("OK"));
- // if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
} else {
@@ -1430,7 +1424,6 @@ int MenuSettings() {
strncat (entered, "/", 1);
strlcpy(Settings.titlestxt_path, entered, sizeof(Settings.titlestxt_path));
WindowPrompt(tr("WiiTDB Path changed."),0,tr("OK"));
- // if(isSdInserted()) {
if (isInserted(bootDevice)) {
cfg_save_global();
HaltGui();
@@ -1524,7 +1517,6 @@ int MenuSettings() {
strncat (entered, "/", 1);
strlcpy(Settings.dolpath, entered, sizeof(Settings.dolpath));
WindowPrompt(tr("DOL path changed"),0,tr("OK"));
- // if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
}
@@ -1550,7 +1542,6 @@ int MenuSettings() {
strncat (entered, "/", 1);
strlcpy(Settings.homebrewapps_path, entered, sizeof(Settings.homebrewapps_path));
WindowPrompt(tr("Homebrew Appspath changed"),0,tr("OK"));
- // if(!isSdInserted()) {
if (!isInserted(bootDevice)) {
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
}
@@ -1601,7 +1592,6 @@ int MenuSettings() {
w.Remove(&MainButton2);
w.Remove(&MainButton3);
w.Remove(&MainButton4);
-// if(isSdInserted() && Settings.godmode) {
if (isInserted(bootDevice) && Settings.godmode) {
w.Remove(&optionBrowser2);
w.Remove(&backBtn);
@@ -1639,7 +1629,6 @@ int MenuSettings() {
if (Settings.godmode) {
int choice = WindowPrompt(tr("Are you sure?"), 0, tr("Yes"), tr("Cancel"));
if (choice == 1) {
-// if(isSdInserted())
if (isInserted(bootDevice)) {
char GXGlobal_cfg[26];
sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
@@ -1692,7 +1681,6 @@ int MenuSettings() {
else if (backBtn.GetState() == STATE_CLICKED) {
//Add the procedure call to save the global configuration
-// if(isSdInserted()) {
if (isInserted(bootDevice)) {
cfg_save_global();
}
diff --git a/source/settings/SettingsPrompts.cpp b/source/settings/SettingsPrompts.cpp
index e30266ad..5590bd70 100644
--- a/source/settings/SettingsPrompts.cpp
+++ b/source/settings/SettingsPrompts.cpp
@@ -232,7 +232,6 @@ bool MenuOGG() {
strncat (entered, "/", 1);
strlcpy(Settings.oggload_path, entered, sizeof(Settings.oggload_path));
WindowPrompt(tr("Backgroundmusic Path changed."),0,tr("OK"));
-// if(isSdInserted()) {
if (isInserted(bootDevice)) {
if (!strcmp("", Settings.oggload_path)) {
sprintf(Settings.ogg_path, "notset");
@@ -549,7 +548,6 @@ int MenuLanguageSelect() {
strncat (entered, "/", 1);
strlcpy(Settings.languagefiles_path, entered, sizeof(Settings.languagefiles_path));
WindowPrompt(tr("Languagepath changed."),0,tr("OK"));
-// if(isSdInserted()) {
if (isInserted(bootDevice)) {
cfg_save_global();
returnhere = 1;
@@ -569,7 +567,6 @@ int MenuLanguageSelect() {
if (ret>=0) {
choice = WindowPrompt(tr("Do you want to change language?"), 0, tr("Yes"), tr("Cancel"));
if (choice == 1) {
-// if(isSdInserted()) {
if (isInserted(bootDevice)) {
snprintf(Settings.language_path, sizeof(Settings.language_path), "%s%s", Settings.languagefiles_path, GetFileName(ret));
cfg_save_global();