diff --git a/main/source/Tools/category.cpp b/main/source/Tools/category.cpp index a590133..d8711d6 100644 --- a/main/source/Tools/category.cpp +++ b/main/source/Tools/category.cpp @@ -11,44 +11,6 @@ CategoryAvailable AvailableCategory; // einlesen void AvailableCategoryLoad(string pfad) { -#if defined(STBOOT) || defined(STBOOTVWII) - string line, quelltext, temp; - ifstream in(pfad.c_str()); - while(getline(in, line)) - quelltext = quelltext + line; - - int Anzahl = 0; - for (int i = 0; (unsigned)i < quelltext.size(); i++) - { - temp = quelltext[i]; - if(strcmp(temp.c_str(),"[") == 0) - Anzahl++; - } - - AvailableCategory.categories.clear(); - AvailableCategory.categories.push_back(tr(Settings.category_name_all)); - // alle Kategorien durchlaufen - for(int i=1; i < Anzahl +1; i++) - { - AvailableCategory.apps[i].clear(); - // Kategorie durchsuchen - temp = quelltext.erase(0,quelltext.find("[") +1); - AvailableCategory.categories.push_back(quelltext.substr(0, quelltext.find("]"))); - temp = quelltext.erase(0,quelltext.find("]") +1); - if((signed)temp.find("[") != -1) - temp.erase(temp.find("[")); - - // alle Apps auflisten - while((signed)temp.find("*") != -1) - { - string temp2 = temp.erase(0,temp.find("*") +1); - temp2 = temp2.erase(temp.find("*")); - transform(temp2.begin(), temp2.end(), temp2.begin(),::tolower); // in kleinebuchstaben umwandeln - AvailableCategory.apps[i].push_back(temp2); - temp.erase(0,temp.find("*") +1); - } - } -#else s32 fd; static fstats filestats ATTRIBUTE_ALIGN(32); static u8 filearray[1024] ATTRIBUTE_ALIGN(32); @@ -100,29 +62,11 @@ void AvailableCategoryLoad(string pfad) temp.erase(0,temp.find("*") +1); } } -#endif } // speichern void AvailableCategorySave(string pfad) { -#if defined(STBOOT) || defined(STBOOTVWII) - ofstream out(pfad.c_str()); - // alle Kategorien durchlaufen auer "Alle" - - for(int i = 1; i < (signed)AvailableCategory.categories.size(); i++) - { - // Kategorie speichern - out << "[" << AvailableCategory.categories[i] << "]" << endl; - // alle Apps auflisten und speichern - for(int x = 0; x < (signed)AvailableCategory.apps[i].size(); x++) - out << "*" << AvailableCategory.apps[i][x] << "*" << endl; - // Zeilenumbruch nach Kategorie - out << endl; - } - - out.close(); -#else ISFS_Delete(pfad.c_str()); ISFS_CreateFile(pfad.c_str(), 0, 3, 3, 3); s32 file = ISFS_Open(pfad.c_str(), ISFS_OPEN_RW); @@ -155,7 +99,6 @@ void AvailableCategorySave(string pfad) ISFS_Write(file, pbuf, sizeof(char) *psize); } ISFS_Close(file); -#endif } int KategorieNr(string Kategorie) diff --git a/main/source/Tools/load.cpp b/main/source/Tools/load.cpp index d8b1e11..8cc38c9 100644 --- a/main/source/Tools/load.cpp +++ b/main/source/Tools/load.cpp @@ -20,16 +20,16 @@ string get_setting(string source, string search) void load() { u32 file_size; + static fstats filestats_settings ATTRIBUTE_ALIGN(32); + static fstats filestats_appios ATTRIBUTE_ALIGN(32); static u8 filearray_settings[1024] ATTRIBUTE_ALIGN(32); static u8 filearray_appios[1024] ATTRIBUTE_ALIGN(32); #if defined(STBOOT) || defined(STBOOTVWII) - Settings.ios_dat = (Settings.device_dat + ":/config/HBF/appios.dat").c_str(); - Settings.dir_dat = (Settings.device_dat + ":/config/HBF/list.dat").c_str(); - Settings.settings_dat = (Settings.device_dat + ":/config/HBF/settings.dat").c_str(); + Settings.ios_dat = "/title/00010001/48424630/data/appios.dat"; + Settings.dir_dat = "/title/00010001/48424630/data/list.dat"; + Settings.settings_dat = "/title/00010001/48424630/data/settings.dat"; #else - static fstats filestats_settings ATTRIBUTE_ALIGN(32); - static fstats filestats_appios ATTRIBUTE_ALIGN(32); Settings.ios_dat = "/title/00010001/54484246/data/appios.dat"; Settings.dir_dat = "/title/00010001/54484246/data/list.dat"; Settings.settings_dat = "/title/00010001/54484246/data/settings.dat"; @@ -38,18 +38,6 @@ void load() AvailableCategoryLoad(Settings.dir_dat); // get settings -#if defined(STBOOT) || defined(STBOOTVWII) - FILE *fd = NULL; - fd = fopen((Settings.settings_dat).c_str(), "rb"); - - if(fd) - { - fseek (fd , 0, SEEK_END); - file_size = ftell (fd); - rewind (fd); - } - -#else s32 fd; fd = ISFS_Open(Settings.settings_dat.c_str(), ISFS_OPEN_READ); if (fd <= 0) @@ -60,7 +48,6 @@ void load() file_size = ISFS_Read(fd, filearray_settings, filestats_settings.file_length); ISFS_Close(fd); -#endif if(file_size >= 0) { @@ -184,16 +171,6 @@ void load() } // get appios -#if defined(STBOOT) || defined(STBOOTVWII) - fd = fopen((Settings.ios_dat).c_str(), "rb"); - - if(fd) - { - fseek (fd , 0, SEEK_END); - file_size = ftell (fd); - rewind (fd); - } -#else fd = ISFS_Open(Settings.ios_dat.c_str(), ISFS_OPEN_READ); if (fd <= 0) ISFS_Close(fd); @@ -203,7 +180,7 @@ void load() file_size = ISFS_Read(fd, filearray_appios, filestats_appios.file_length); ISFS_Close(fd); -#endif + if(file_size >= 0) { string line; diff --git a/main/source/Tools/save.cpp b/main/source/Tools/save.cpp index e82b9b3..0d3793a 100644 --- a/main/source/Tools/save.cpp +++ b/main/source/Tools/save.cpp @@ -52,69 +52,14 @@ bool folder_exists() void save() { -#if defined(STBOOT) || defined(STBOOTVWII) - ofstream save_settings; - save_settings.open(Settings.ios_dat.c_str()); - - int last_category; - string last_category_name; - - if(Options.last_category > 0) - { - last_category = 1; - last_category_name = AvailableCategory.categories[Options.last_category - 1]; - } - else - { - last_category = 0; - last_category_name = Settings.category_name; - } - - save_settings << "theme = \"" << Options.theme << "\"" << endl; - save_settings << "language = \"" << Options.language << "\"" << endl; - save_settings << "font = \"" << Options.font << "\"" << endl; - save_settings << "slide_effect = \"" << Options.slide_effect << "\"" << endl; - save_settings << "last_category = \"" << last_category << "\"" << endl; - save_settings << "last_category_name = \"" << last_category_name << "\"" << endl; - save_settings << "last_app_name = \"" << Settings.startingAppName << "\"" << endl; - save_settings << "apps_nr = \"" << Options.apps << "\"" << endl; - save_settings << "quick_start = \"" << Options.quick_start << "\"" << endl; - save_settings << "show_all = \"" << Options.show_all << "\"" << endl; - save_settings << "sdgecko = \"" << Options.sdgecko << "\"" << endl; -#ifndef VWII - save_settings << "bootmii_boot2 = \"" << Options.bootmii_boot2 << "\"" << endl; -#endif - save_settings << "navigation = \"" << Options.navigation << "\"" << endl; - save_settings << "network = \"" << Options.network << "\"" << endl; - save_settings << "wifigecko = \"" << Options.wifigecko << "\"" << endl; - save_settings << "newrevtext = \"" << Options.newrevtext << "\"" << endl; - save_settings << "code = \"" << Settings.code << "\"" << endl; - save_settings << "grid = \"" << Settings.grid << "\"" << endl; - save_settings << "device = \"" << Settings.device << "\"" << endl; - save_settings << "device_dat = \"" << Settings.device_dat << "\"" << endl; - save_settings << "device_icon = \"" << Options.device_icon << "\"" << endl; - save_settings << "wiiload_ahb = \"" << Options.wiiload_ahb << "\"" << endl; - save_settings << "wiiload_ios = \"" << Options.wiiload_ios << "\"" << endl; - save_settings << "system = \"" << Settings.system << "\"" << endl; - save_settings << "top = \"" << Settings.top << "\"" << endl; - save_settings << "bottom = \"" << Settings.bottom << "\"" << endl; - save_settings << "left = \"" << Settings.left << "\"" << endl; - save_settings << "right = \"" << Settings.right << "\"" << endl; - - save_settings.close(); - - ofstream outfile; - outfile.open(Settings.ios_dat.c_str()); - for(int i = 0; i < (signed)appios.size(); i++) - outfile << appios[i].foldername << " = " << appios[i].ios << endl; - outfile.close(); - -#else s32 file; // create save banner +#if defined(STBOOT) || defined(STBOOTVWII) + string save_banner_path = "/title/00010001/48424630/data/banner.bin"; +#else string save_banner_path = "/title/00010001/54484246/data/banner.bin"; - +#endif file = ISFS_Open(save_banner_path.c_str(), ISFS_OPEN_READ); if (file <= 0) { @@ -225,7 +170,7 @@ void save() ISFS_Write(file, pbuf, sizeof(char) *psize); } ISFS_Close(file); -#endif + // save category AvailableCategorySave(Settings.dir_dat);