Support multiple instances with separate configs

This commit is contained in:
wiidev 2023-01-01 17:00:30 +00:00
parent 15aabd4f53
commit c3a65d572c
37 changed files with 77 additions and 194 deletions

View File

@ -2337,9 +2337,6 @@ msgstr "Aktualizace"
msgid "Update Files" msgid "Update Files"
msgstr "Zaktualizuj soubory" msgstr "Zaktualizuj soubory"
msgid "Update Path"
msgstr "Cesta pro aktualizaci"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Zaktualizuj vsechny jazykové soubory" msgstr "Zaktualizuj vsechny jazykové soubory"

View File

@ -2337,9 +2337,6 @@ msgstr "Opdatér"
msgid "Update Files" msgid "Update Files"
msgstr "Opdatér filer" msgstr "Opdatér filer"
msgid "Update Path"
msgstr "Sti til opdateringer"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Opdatér alle sprogfiler" msgstr "Opdatér alle sprogfiler"

View File

@ -2337,9 +2337,6 @@ msgstr "Updaten"
msgid "Update Files" msgid "Update Files"
msgstr "Bestanden Updaten" msgstr "Bestanden Updaten"
msgid "Update Path"
msgstr "Updatelocatie"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Alle taalbestanden updaten" msgstr "Alle taalbestanden updaten"

View File

@ -2337,9 +2337,6 @@ msgstr ""
msgid "Update Files" msgid "Update Files"
msgstr "" msgstr ""
msgid "Update Path"
msgstr ""
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "" msgstr ""

View File

@ -2337,9 +2337,6 @@ msgstr "Päivitä"
msgid "Update Files" msgid "Update Files"
msgstr "Päivitä tiedostot" msgstr "Päivitä tiedostot"
msgid "Update Path"
msgstr "Päivityspolku"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Päivitä kaikki kielitiedostot" msgstr "Päivitä kaikki kielitiedostot"

View File

@ -2337,9 +2337,6 @@ msgstr "Mise à jour"
msgid "Update Files" msgid "Update Files"
msgstr "MàJ Fichiers" msgstr "MàJ Fichiers"
msgid "Update Path"
msgstr "Dossier de mise à jour"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Mise à jour des fichiers de langue" msgstr "Mise à jour des fichiers de langue"

View File

@ -2337,9 +2337,6 @@ msgstr "Update"
msgid "Update Files" msgid "Update Files"
msgstr "Aktualisieren" msgstr "Aktualisieren"
msgid "Update Path"
msgstr "Updates"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Sprachdateien aktualisieren" msgstr "Sprachdateien aktualisieren"

View File

@ -2337,9 +2337,6 @@ msgstr "Aναβάθμιση"
msgid "Update Files" msgid "Update Files"
msgstr "Αναβάθμιση αρχείων" msgstr "Αναβάθμιση αρχείων"
msgid "Update Path"
msgstr "Μονοπάτι αρχείων αναβάθμισης."
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Αναβάθμιση όλων των μεταφράσεων" msgstr "Αναβάθμιση όλων των μεταφράσεων"

View File

@ -2340,9 +2340,6 @@ msgstr "Frissítés"
msgid "Update Files" msgid "Update Files"
msgstr "Fájlok frissítése" msgstr "Fájlok frissítése"
msgid "Update Path"
msgstr "Frissítés Útvonala"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Minden nyelvi fájl frissítése" msgstr "Minden nyelvi fájl frissítése"

View File

@ -2340,9 +2340,6 @@ msgstr "Aggiornamenti"
msgid "Update Files" msgid "Update Files"
msgstr "Aggiorna i files" msgstr "Aggiorna i files"
msgid "Update Path"
msgstr "Percorso aggiornamenti"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Aggiorna tutte le traduzioni" msgstr "Aggiorna tutte le traduzioni"

View File

@ -2340,9 +2340,6 @@ msgstr "更新"
msgid "Update Files" msgid "Update Files"
msgstr "すべて更新" msgstr "すべて更新"
msgid "Update Path"
msgstr "GXのdol"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "全言語ファイルを更新" msgstr "全言語ファイルを更新"

View File

@ -2340,9 +2340,6 @@ msgstr "업데이트"
msgid "Update Files" msgid "Update Files"
msgstr "파일 업데이트" msgstr "파일 업데이트"
msgid "Update Path"
msgstr "경로 업데이트"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "모든 언어 파일 업데이트" msgstr "모든 언어 파일 업데이트"

View File

@ -2337,9 +2337,6 @@ msgstr "Oppdater"
msgid "Update Files" msgid "Update Files"
msgstr "Oppdater filer" msgstr "Oppdater filer"
msgid "Update Path"
msgstr "Oppdatering sti"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Oppdater alle språkfiler" msgstr "Oppdater alle språkfiler"

View File

@ -2337,9 +2337,6 @@ msgstr "Aktualizacja"
msgid "Update Files" msgid "Update Files"
msgstr "Zaktualizuj pliki" msgstr "Zaktualizuj pliki"
msgid "Update Path"
msgstr "Sciezka aktualizacji"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Zaktualizuj wszystkie pliki jezykowe" msgstr "Zaktualizuj wszystkie pliki jezykowe"

View File

@ -2337,9 +2337,6 @@ msgstr "Atualizações"
msgid "Update Files" msgid "Update Files"
msgstr "Atualizar arquivos" msgstr "Atualizar arquivos"
msgid "Update Path"
msgstr "Atualização"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Atualizar todos os arquivos de Idioma" msgstr "Atualizar todos os arquivos de Idioma"

View File

@ -2337,9 +2337,6 @@ msgstr "Actualizações"
msgid "Update Files" msgid "Update Files"
msgstr "Actualizar ficheiros" msgstr "Actualizar ficheiros"
msgid "Update Path"
msgstr "Cam. Actualização"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Actualizar todos os ficheiros de Idioma" msgstr "Actualizar todos os ficheiros de Idioma"

View File

@ -2337,9 +2337,6 @@ msgstr "Обновление"
msgid "Update Files" msgid "Update Files"
msgstr "Обновить файлы" msgstr "Обновить файлы"
msgid "Update Path"
msgstr "Путь к обновлениям"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Обновить все языковые файлы" msgstr "Обновить все языковые файлы"

View File

@ -2337,9 +2337,6 @@ msgstr "升级"
msgid "Update Files" msgid "Update Files"
msgstr "升级文件" msgstr "升级文件"
msgid "Update Path"
msgstr "升级文件存放路径"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "升级全部语言文件" msgstr "升级全部语言文件"

View File

@ -2337,9 +2337,6 @@ msgstr "Actualizar"
msgid "Update Files" msgid "Update Files"
msgstr "Archivos" msgstr "Archivos"
msgid "Update Path"
msgstr "Ruta Actualización"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Actualizar todos los archivos de Idiomas" msgstr "Actualizar todos los archivos de Idiomas"

View File

@ -2337,9 +2337,6 @@ msgstr "Uppdatera"
msgid "Update Files" msgid "Update Files"
msgstr "Uppdatera Filer" msgstr "Uppdatera Filer"
msgid "Update Path"
msgstr "Sökväg till uppdatering"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Uppdatera alla språk-filer" msgstr "Uppdatera alla språk-filer"

View File

@ -2337,9 +2337,6 @@ msgstr "更新"
msgid "Update Files" msgid "Update Files"
msgstr "更新檔案" msgstr "更新檔案"
msgid "Update Path"
msgstr "更新路徑"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "更新所有語言檔案" msgstr "更新所有語言檔案"

View File

@ -2337,9 +2337,6 @@ msgstr "อัพเดท"
msgid "Update Files" msgid "Update Files"
msgstr "อัพเดทไฟล์" msgstr "อัพเดทไฟล์"
msgid "Update Path"
msgstr "ที่อยู่ Update"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "อัพเดทภาษาทั้งหมด" msgstr "อัพเดทภาษาทั้งหมด"

View File

@ -2337,9 +2337,6 @@ msgstr "Güncelleme"
msgid "Update Files" msgid "Update Files"
msgstr "Dosyaları Güncelle" msgstr "Dosyaları Güncelle"
msgid "Update Path"
msgstr "Güncelleme Yolu"
msgid "Update all Language Files" msgid "Update all Language Files"
msgstr "Tüm Dil Dosyalarını Güncelle" msgstr "Tüm Dil Dosyalarını Güncelle"

View File

@ -218,6 +218,21 @@ bool StartUpProcess::USBSpinUp()
int StartUpProcess::Run(int argc, char *argv[]) int StartUpProcess::Run(int argc, char *argv[])
{ {
// A normal launch should always have the first arg be the path
char *ptr = strrchr(argv[0], '/');
if (ptr && (argv[0][2] == ':' || argv[0][3] == ':'))
{
*ptr = 0;
// HBC doesn't specify the USB port
if (strncmp(argv[0], "usb", 3) == 0)
{
snprintf(Settings.BootDevice, sizeof(Settings.BootDevice), "usb1");
snprintf(Settings.ConfigPath, sizeof(Settings.ConfigPath), "usb1:%s/", argv[0] + 4);
}
else if (strncmp(argv[0], "sd", 2) == 0)
snprintf(Settings.ConfigPath, sizeof(Settings.ConfigPath), "%s/", argv[0]);
gprintf("Loader path: %s\n", Settings.ConfigPath);
}
int quickGameBoot = ParseArguments(argc, argv); int quickGameBoot = ParseArguments(argc, argv);
StartUpProcess Process; StartUpProcess Process;

View File

@ -931,7 +931,7 @@ int GameBrowseMenu::MainLoop()
gprintf("\tgameCntBtn clicked\n"); gprintf("\tgameCntBtn clicked\n");
gamecntBtn->ResetState(); gamecntBtn->ResetState();
int choice = WindowPrompt(0, fmt("%s %sGameList ?", tr( "Save Game List to" ), Settings.update_path), "TXT", "CSV", tr( "Back" )); int choice = WindowPrompt(0, fmt("%s %sGameList ?", tr( "Save Game List to" ), Settings.ConfigPath), "TXT", "CSV", tr( "Back" ));
if (choice) if (choice)
{ {
if (save_gamelist(choice == 2)) if (save_gamelist(choice == 2))

View File

@ -412,7 +412,7 @@ void ImageDownloader::DownloadImage(const char *url, const char *gameID, const c
void ImageDownloader::CreateCSVLog() void ImageDownloader::CreateCSVLog()
{ {
char path[200]; char path[200];
snprintf(path, sizeof(path), "%s/MissingImages.csv", Settings.update_path); snprintf(path, sizeof(path), "%s/MissingImages.csv", Settings.ConfigPath);
FILE *f = fopen(path, "wb"); FILE *f = fopen(path, "wb");
if(!f) return; if(!f) return;

View File

@ -145,7 +145,7 @@ static void UpdateIconPng()
downloadfile("https://raw.githubusercontent.com/wiidev/usbloadergx/updates/icon.png", &file); downloadfile("https://raw.githubusercontent.com/wiidev/usbloadergx/updates/icon.png", &file);
if (file.size > 0) if (file.size > 0)
{ {
snprintf(iconpath, sizeof(iconpath), "%sicon.png", Settings.update_path); snprintf(iconpath, sizeof(iconpath), "%sicon.png", Settings.ConfigPath);
FILE *pfile = fopen(iconpath, "wb"); FILE *pfile = fopen(iconpath, "wb");
if (pfile) if (pfile)
{ {
@ -163,7 +163,7 @@ static void UpdateMetaXml()
downloadfile("https://raw.githubusercontent.com/wiidev/usbloadergx/updates/meta.xml", &file); downloadfile("https://raw.githubusercontent.com/wiidev/usbloadergx/updates/meta.xml", &file);
if (file.size > 0) if (file.size > 0)
{ {
snprintf(xmlpath, sizeof(xmlpath), "%smeta.xml", Settings.update_path); snprintf(xmlpath, sizeof(xmlpath), "%smeta.xml", Settings.ConfigPath);
FILE *pfile = fopen(xmlpath, "wb"); FILE *pfile = fopen(xmlpath, "wb");
if (pfile) if (pfile)
{ {
@ -217,8 +217,8 @@ static int ApplicationDownload(void)
snprintf(tmppath, sizeof(tmppath), "%s/ULNR.wad", Settings.BootDevice); snprintf(tmppath, sizeof(tmppath), "%s/ULNR.wad", Settings.BootDevice);
#else #else
char realpath[250]; char realpath[250];
snprintf(realpath, sizeof(realpath), "%sboot.dol", Settings.update_path); snprintf(realpath, sizeof(realpath), "%sboot.dol", Settings.ConfigPath);
snprintf(tmppath, sizeof(tmppath), "%sboot.tmp", Settings.update_path); snprintf(tmppath, sizeof(tmppath), "%sboot.tmp", Settings.ConfigPath);
#endif #endif
int ret = DownloadFileToPath(DownloadURL.c_str(), tmppath); int ret = DownloadFileToPath(DownloadURL.c_str(), tmppath);
@ -282,12 +282,6 @@ int UpdateApp()
return -1; return -1;
} }
if (!CreateSubfolder(Settings.update_path))
{
WindowPrompt(tr("Error:"), tr("Can't create directory"), tr("OK"));
return -1;
}
int choice = WindowPrompt(tr("What do you want to update?"), 0, "USB Loader GX", tr("WiiTDB.xml"), tr("Language Files"), tr("Cancel")); int choice = WindowPrompt(tr("What do you want to update?"), 0, "USB Loader GX", tr("WiiTDB.xml"), tr("Language Files"), tr("Cancel"));
if (choice == 0) if (choice == 0)
return 0; return 0;

View File

@ -1118,14 +1118,13 @@ char *readable_size(float size, char *buf)
bool save_gamelist(bool bCSV) // save gamelist bool save_gamelist(bool bCSV) // save gamelist
{ {
mainWindow->SetState(STATE_DISABLED); mainWindow->SetState(STATE_DISABLED);
CreateSubfolder(Settings.update_path);
// Save the game list // Save the game list
char tmp[256]; char tmp[256];
if(bCSV) if(bCSV)
snprintf(tmp, sizeof(tmp), "%sGameList.csv", Settings.update_path); snprintf(tmp, sizeof(tmp), "%sGameList.csv", Settings.ConfigPath);
else else
snprintf(tmp, sizeof(tmp), "%sGameList.txt", Settings.update_path); snprintf(tmp, sizeof(tmp), "%sGameList.txt", Settings.ConfigPath);
FILE *f = fopen(tmp, "w"); FILE *f = fopen(tmp, "w");
if (!f) if (!f)

View File

@ -175,8 +175,6 @@ bool CGameSettings::Save()
if(ptr) if(ptr)
ptr[0] = 0; ptr[0] = 0;
CreateSubfolder(filepath);
FILE * f = fopen(ConfigPath.c_str(), "w"); FILE * f = fopen(ConfigPath.c_str(), "w");
if (!f) return false; if (!f) return false;

View File

@ -138,9 +138,6 @@ bool CGameStatistics::Save()
if(ptr) if(ptr)
ptr[0] = 0; ptr[0] = 0;
if(!CreateSubfolder(filepath))
return false;
FILE * f = fopen(ConfigPath.c_str(), "w"); FILE * f = fopen(ConfigPath.c_str(), "w");
if (!f) return false; if (!f) return false;

View File

@ -44,7 +44,7 @@ CSettings::CSettings()
{ {
CONF_Init(); CONF_Init();
strcpy(BootDevice, "sd:"); strcpy(BootDevice, "sd:");
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/", BootDevice); snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/", BootDevice);
this->SetDefault(); this->SetDefault();
FirstTimeRun = true; FirstTimeRun = true;
} }
@ -61,9 +61,8 @@ void CSettings::SetDefault()
snprintf(disc_path, sizeof(disc_path), "%simages/disc/", ConfigPath); snprintf(disc_path, sizeof(disc_path), "%simages/disc/", ConfigPath);
snprintf(titlestxt_path, sizeof(titlestxt_path), "%s", ConfigPath); snprintf(titlestxt_path, sizeof(titlestxt_path), "%s", ConfigPath);
snprintf(languagefiles_path, sizeof(languagefiles_path), "%slanguage/", ConfigPath); snprintf(languagefiles_path, sizeof(languagefiles_path), "%slanguage/", ConfigPath);
snprintf(update_path, sizeof(update_path), "%s/apps/usbloader_gx/", BootDevice); snprintf(BNRCachePath, sizeof(BNRCachePath), "%scache_bnr/", ConfigPath);
snprintf(BNRCachePath, sizeof(BNRCachePath), "%s/apps/usbloader_gx/cache_bnr/", BootDevice); snprintf(GameHeaderCachePath, sizeof(GameHeaderCachePath), "%scache/", ConfigPath);
snprintf(GameHeaderCachePath, sizeof(GameHeaderCachePath), "%s/apps/usbloader_gx/cache/", BootDevice);
snprintf(homebrewapps_path, sizeof(homebrewapps_path), "%s/apps/", BootDevice); snprintf(homebrewapps_path, sizeof(homebrewapps_path), "%s/apps/", BootDevice);
snprintf(Cheatcodespath, sizeof(Cheatcodespath), "%s/codes/", BootDevice); snprintf(Cheatcodespath, sizeof(Cheatcodespath), "%s/codes/", BootDevice);
snprintf(TxtCheatcodespath, sizeof(TxtCheatcodespath), "%s/txtcodes/", BootDevice); snprintf(TxtCheatcodespath, sizeof(TxtCheatcodespath), "%s/txtcodes/", BootDevice);
@ -317,8 +316,6 @@ bool CSettings::Save()
char filedest[300]; char filedest[300];
snprintf(filedest, sizeof(filedest), "%sGXGlobal.cfg", ConfigPath); snprintf(filedest, sizeof(filedest), "%sGXGlobal.cfg", ConfigPath);
if(!CreateSubfolder(ConfigPath)) return false;
FILE * file = fopen(filedest, "w"); FILE * file = fopen(filedest, "w");
if (!file) return false; if (!file) return false;
@ -367,7 +364,6 @@ bool CSettings::Save()
fprintf(file, "ogg_path = %s\n", ogg_path); fprintf(file, "ogg_path = %s\n", ogg_path);
fprintf(file, "wiilight = %d\n", wiilight); fprintf(file, "wiilight = %d\n", wiilight);
fprintf(file, "gameDisplay = %d\n", gameDisplay); fprintf(file, "gameDisplay = %d\n", gameDisplay);
fprintf(file, "update_path = %s\n", update_path);
fprintf(file, "homebrewapps_path = %s\n", homebrewapps_path); fprintf(file, "homebrewapps_path = %s\n", homebrewapps_path);
fprintf(file, "BNRCachePath = %s\n", BNRCachePath); fprintf(file, "BNRCachePath = %s\n", BNRCachePath);
fprintf(file, "GameHeaderCachePath = %s\n", GameHeaderCachePath); fprintf(file, "GameHeaderCachePath = %s\n", GameHeaderCachePath);
@ -1271,11 +1267,6 @@ bool CSettings::SetSetting(char *name, char *value)
strlcpy(ogg_path, value, sizeof(ogg_path)); strlcpy(ogg_path, value, sizeof(ogg_path));
return true; return true;
} }
else if (strcmp(name, "update_path") == 0)
{
strlcpy(update_path, value, sizeof(update_path));
return true;
}
else if (strcmp(name, "homebrewapps_path") == 0) else if (strcmp(name, "homebrewapps_path") == 0)
{ {
strlcpy(homebrewapps_path, value, sizeof(homebrewapps_path)); strlcpy(homebrewapps_path, value, sizeof(homebrewapps_path));
@ -1497,63 +1488,42 @@ bool CSettings::SetSetting(char *name, char *value)
bool CSettings::FindConfig() bool CSettings::FindConfig()
{ {
bool found = false;
char CheckDevice[73];
char CheckPath[300]; char CheckPath[300];
std::string device(ConfigPath);
char *ptr = strchr(device.c_str(), ':');
if (ptr)
{
*ptr = 0;
snprintf(BootDevice, sizeof(BootDevice), "%s:", device.c_str());
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
// Enumerate the devices supported by libogc. FILE *fp = fopen(CheckPath, "ab+");
for (int i = SD; (i < MAXDEVICES) && !found; ++i) if (fp)
{
fclose(fp);
return true;
}
}
// Enumerate the devices supported by libogc
char CheckDevice[73];
for (int i = SD; i < MAXDEVICES; ++i)
{ {
snprintf(CheckDevice, sizeof(CheckDevice), "%s:", DeviceName[i]); snprintf(CheckDevice, sizeof(CheckDevice), "%s:", DeviceName[i]);
// Check for the config file in the apps directory
if(!found)
{
// Check for the config file in the apps directory.
strlcpy(BootDevice, CheckDevice, sizeof(BootDevice)); strlcpy(BootDevice, CheckDevice, sizeof(BootDevice));
snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/", BootDevice); snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/", BootDevice);
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath); snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
found = CheckFile(CheckPath);
} FILE *fp = fopen(CheckPath, "ab+");
if(!found) if (fp)
{ {
// Check for the config file in the config directory. fclose(fp);
strlcpy(BootDevice, CheckDevice, sizeof(BootDevice)); return true;
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/", BootDevice);
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
found = CheckFile(CheckPath);
} }
} }
FILE * testFp = NULL; return false;
//! No existing config so try to find a place where we can write it too
for (int i = SD; (i < MAXDEVICES) && !found; ++i)
{
sprintf(CheckDevice, "%s:", DeviceName[i]);
if (!found)
{
// Check if we can write to the apps directory.
strlcpy(BootDevice, CheckDevice, sizeof(BootDevice));
snprintf(ConfigPath, sizeof(ConfigPath), "%s/apps/usbloader_gx/", BootDevice);
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
testFp = fopen(CheckPath, "wb");
found = (testFp != NULL);
if(testFp) fclose(testFp);
}
if (!found)
{
// Check if we can write to the config directory.
strlcpy(BootDevice, CheckDevice, sizeof(BootDevice));
snprintf(ConfigPath, sizeof(ConfigPath), "%s/config/", BootDevice);
CreateSubfolder(ConfigPath);
snprintf(CheckPath, sizeof(CheckPath), "%sGXGlobal.cfg", ConfigPath);
testFp = fopen(CheckPath, "wb");
found = (testFp != NULL);
if(testFp) fclose(testFp);
}
}
return found;
} }
void CSettings::ParseLine(char *line) void CSettings::ParseLine(char *line)

View File

@ -78,7 +78,6 @@ class CSettings
char BcaCodepath[100]; char BcaCodepath[100];
char WipCodepath[100]; char WipCodepath[100];
char dolpath[100]; char dolpath[100];
char update_path[100];
char homebrewapps_path[100]; char homebrewapps_path[100];
char WDMpath[100]; char WDMpath[100];
char WiinnertagPath[100]; char WiinnertagPath[100];

View File

@ -50,7 +50,6 @@ CustomPathsSM::CustomPathsSM()
Options->SetName(Idx++, tr("Disc Artwork Path")); Options->SetName(Idx++, tr("Disc Artwork Path"));
Options->SetName(Idx++, tr("Theme Path")); Options->SetName(Idx++, tr("Theme Path"));
Options->SetName(Idx++, tr("Titles Path")); Options->SetName(Idx++, tr("Titles Path"));
Options->SetName(Idx++, tr("Update Path"));
Options->SetName(Idx++, tr("GCT Cheatcodes Path")); Options->SetName(Idx++, tr("GCT Cheatcodes Path"));
Options->SetName(Idx++, tr("TXT Cheatcodes Path")); Options->SetName(Idx++, tr("TXT Cheatcodes Path"));
Options->SetName(Idx++, tr("DOL Path")); Options->SetName(Idx++, tr("DOL Path"));
@ -94,9 +93,6 @@ void CustomPathsSM::SetOptionValues()
//! Settings: Titles Path //! Settings: Titles Path
Options->SetValue(Idx++, Settings.titlestxt_path); Options->SetValue(Idx++, Settings.titlestxt_path);
//! Settings: Update Path
Options->SetValue(Idx++, Settings.update_path);
//! Settings: GCT Cheatcodes Path //! Settings: GCT Cheatcodes Path
Options->SetValue(Idx++, Settings.Cheatcodespath); Options->SetValue(Idx++, Settings.Cheatcodespath);
@ -217,13 +213,6 @@ int CustomPathsSM::GetMenuInternal()
} }
} }
//! Settings: Update Path
else if (ret == ++Idx)
{
titleTxt->SetText(tr( "Update Path" ));
ChangePath(Settings.update_path, sizeof(Settings.update_path));
}
//! Settings: GCT Cheatcodes Path //! Settings: GCT Cheatcodes Path
else if (ret == ++Idx) else if (ret == ++Idx)
{ {

View File

@ -600,7 +600,7 @@ int FeatureSettingsMenu::GetMenuInternal()
if(WindowPrompt(tr( "EmuNAND WAD Manager" ), fmt(tr("%i WAD file(s) not processed!"), wadList->GetFilecount()), tr("Save List"), tr( "OK" ))) if(WindowPrompt(tr( "EmuNAND WAD Manager" ), fmt(tr("%i WAD file(s) not processed!"), wadList->GetFilecount()), tr("Save List"), tr( "OK" )))
{ {
char path[200]; char path[200];
snprintf(path, sizeof(path), "%s/wad_manager_errors.txt", Settings.update_path); snprintf(path, sizeof(path), "%s/wad_manager_errors.txt", Settings.ConfigPath);
FILE *f = fopen(path, "a"); FILE *f = fopen(path, "a");
if(f) if(f)

View File

@ -25,12 +25,12 @@ distribution.
#include "settings/CSettings.h" #include "settings/CSettings.h"
#include "svnrev.h" #include "svnrev.h"
int updateMetaXML (void) int updateMetaXML()
{ {
HomebrewXML MetaXML; HomebrewXML MetaXML;
char filepath[255]; char filepath[255];
snprintf(filepath, sizeof(filepath), "%s/meta.xml", Settings.update_path); snprintf(filepath, sizeof(filepath), "%smeta.xml", Settings.ConfigPath);
if(!MetaXML.LoadHomebrewXMLData(filepath)) if (!MetaXML.LoadHomebrewXMLData(filepath))
return 0; return 0;
char line[50]; char line[50];
@ -47,22 +47,19 @@ int updateMetaXML (void)
return ret; return ret;
} }
int editMetaArguments (void) int editMetaArguments()
{ {
char metapath[255] = ""; char metapath[255] = "";
char metatmppath[255] = ""; char metatmppath[255] = "";
snprintf(metapath, sizeof(metapath), "%smeta.xml", Settings.ConfigPath);
snprintf(metapath, sizeof(metapath), "%s/meta.xml", Settings.update_path); snprintf(metatmppath, sizeof(metatmppath), "%smeta.tmp", Settings.ConfigPath);
snprintf(metatmppath, sizeof(metatmppath), "%s/meta.tmp", Settings.update_path);
FILE *source = fopen(metapath, "rb"); FILE *source = fopen(metapath, "rb");
if(!source) if (!source)
{
return 0; return 0;
}
FILE *destination = fopen(metatmppath, "wb"); FILE *destination = fopen(metatmppath, "wb");
if(!destination) if (!destination)
{ {
fclose(source); fclose(source);
return 0; return 0;
@ -73,20 +70,20 @@ int editMetaArguments (void)
while (fgets(line, max_line_size, source) != NULL) while (fgets(line, max_line_size, source) != NULL)
{ {
// delete commented lines // delete commented lines
if( strstr(line, " <!-- remove this line to enable arguments") != NULL || if (strstr(line, " <!-- remove this line to enable arguments") != NULL ||
strstr(line, " remove this line to enable arguments -->") != NULL) strstr(line, " remove this line to enable arguments -->") != NULL)
{ {
strcpy(line, ""); strcpy(line, "");
} }
// delete commented lines (old version) // delete commented lines (old version)
if( strstr(line, "<!-- // remove this line to enable arguments") != NULL || if (strstr(line, "<!-- // remove this line to enable arguments") != NULL ||
strstr(line, "// remove this line to enable arguments -->") != NULL) strstr(line, "// remove this line to enable arguments -->") != NULL)
{ {
strcpy(line, ""); strcpy(line, "");
} }
// generate argurments // generate argurments
if(strstr(line, "<arguments>") != NULL) if (strstr(line, "<arguments>") != NULL)
{ {
fputs(line, destination); fputs(line, destination);
snprintf(line, max_line_size, " <arg>--bootios=%d</arg>\n", Settings.BootIOS); snprintf(line, max_line_size, " <arg>--bootios=%d</arg>\n", Settings.BootIOS);
@ -96,14 +93,14 @@ int editMetaArguments (void)
snprintf(line, max_line_size, " <arg>--mountusb=%d</arg>\n", Settings.USBAutoMount); snprintf(line, max_line_size, " <arg>--mountusb=%d</arg>\n", Settings.USBAutoMount);
fputs(line, destination); fputs(line, destination);
while(strstr(line, "</arguments>") == NULL) while (strstr(line, "</arguments>") == NULL)
{ {
fgets(line, max_line_size, source); // advance one line fgets(line, max_line_size, source); // advance one line
if(feof(source)) if (feof(source))
{ {
fclose(source); fclose(source);
fclose(destination); fclose(destination);
delete [] line; delete[] line;
return 0; return 0;
} }
} }
@ -113,7 +110,7 @@ int editMetaArguments (void)
fclose(source); fclose(source);
fclose(destination); fclose(destination);
delete [] line; delete[] line;
if(CopyFile(metatmppath, metapath) <0) if(CopyFile(metatmppath, metapath) <0)
return 0; return 0;

View File

@ -24,7 +24,7 @@
#ifndef _META_H_ #ifndef _META_H_
#define _META_H_ #define _META_H_
int updateMetaXML(void); int updateMetaXML();
int editMetaArguments(void); int editMetaArguments();
#endif #endif

View File

@ -239,7 +239,7 @@ void Sys_LoadHBC(void)
bool RebootApp(void) bool RebootApp(void)
{ {
// be sure to use current settings as arguments // Be sure to use current settings as arguments
editMetaArguments(); editMetaArguments();
#ifdef FULLCHANNEL #ifdef FULLCHANNEL
@ -251,12 +251,12 @@ bool RebootApp(void)
// Load meta.xml arguments // Load meta.xml arguments
char filepath[255]; char filepath[255];
HomebrewXML MetaXML; HomebrewXML MetaXML;
snprintf(filepath, sizeof(filepath), "%s/meta.xml", Settings.update_path); snprintf(filepath, sizeof(filepath), "%smeta.xml", Settings.ConfigPath);
MetaXML.LoadHomebrewXMLData(filepath); MetaXML.LoadHomebrewXMLData(filepath);
u8 *buffer = NULL; u8 *buffer = NULL;
u32 filesize = 0; u32 filesize = 0;
snprintf(filepath, sizeof(filepath), "%s/boot.dol", Settings.update_path); snprintf(filepath, sizeof(filepath), "%sboot.dol", Settings.ConfigPath);
LoadFileToMem(filepath, &buffer, &filesize); LoadFileToMem(filepath, &buffer, &filesize);
if(!buffer) if(!buffer)
{ {
@ -299,12 +299,6 @@ void ScreenShot()
// Create the full pathname. // Create the full pathname.
snprintf(fullPath, sizeof(fullPath), "%s%s", Settings.ConfigPath, filename); snprintf(fullPath, sizeof(fullPath), "%s%s", Settings.ConfigPath, filename);
if(!CreateSubfolder(Settings.ConfigPath))
{
gprintf("Can't create screenshot folder\n");
return;
}
TakeScreenshot(fullPath); TakeScreenshot(fullPath);
} }