mirror of
https://gitlab.com/Nanolx/homebrewfilter.git
synced 2024-11-01 07:05:10 +01:00
add code for saving settings in standalone version back (not yet tested)
This commit is contained in:
parent
048eaf2caf
commit
241e82e930
@ -10,6 +10,44 @@ 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);
|
||||
@ -61,11 +99,27 @@ 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;
|
||||
}
|
||||
#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);
|
||||
@ -73,7 +127,7 @@ void AvailableCategorySave(string pfad)
|
||||
{
|
||||
stringstream save_category;
|
||||
|
||||
// alle Kategorien durchlaufen außer "Alle"
|
||||
// alle Kategorien durchlaufen auer "Alle"
|
||||
for(int i = 1; i < (signed)AvailableCategory.categories.size(); i++)
|
||||
{
|
||||
// Kategorie speichern
|
||||
@ -98,6 +152,7 @@ void AvailableCategorySave(string pfad)
|
||||
ISFS_Write(file, pbuf, sizeof(char) *psize);
|
||||
}
|
||||
ISFS_Close(file);
|
||||
#endif
|
||||
}
|
||||
|
||||
int KategorieNr(string Kategorie)
|
||||
@ -157,7 +212,7 @@ void KategorieVerschieben(string Kategorie1, bool vor, string Kategorie2)
|
||||
int a = KategorieNr(Kategorie1);
|
||||
if(a != -1 && Kategorie1 != Kategorie2)
|
||||
{
|
||||
// apps temporär speichen und Kategorie entfernen
|
||||
// apps temporr speichen und Kategorie entfernen
|
||||
vector<string> temp_apps = AvailableCategory.apps[a];
|
||||
KategorieEntfernen(Kategorie1);
|
||||
|
||||
@ -187,7 +242,7 @@ void KategorieVerschieben(string Kategorie1, bool vor, string Kategorie2)
|
||||
AvailableCategory.apps[i +1] = AvailableCategory.apps[i];
|
||||
// apps leeren
|
||||
AvailableCategory.apps[a].clear();
|
||||
// apps befüllen
|
||||
// apps befllen
|
||||
for(int i = 0; i < (signed)temp_apps.size(); i++)
|
||||
AvailableCategory.apps[a].push_back(temp_apps[i]);
|
||||
}
|
||||
@ -200,12 +255,12 @@ void AppEinfuegen(string Kategorie, string App)
|
||||
if((signed)App.find_last_of("/") != -1)
|
||||
App.erase(0,App.find_last_of("/") +1);
|
||||
|
||||
// kategorie auswählen
|
||||
// kategorie auswhlen
|
||||
|
||||
int i = KategorieNr(Kategorie);
|
||||
if(i != -1)
|
||||
{
|
||||
// überprüfen, ob App in Kategorie ist
|
||||
// berprfen, ob App in Kategorie ist
|
||||
bool found = false;
|
||||
for(int x = 0; x < (signed)AvailableCategory.apps[i].size(); x++)
|
||||
{
|
||||
@ -225,11 +280,11 @@ void AppEntfernen(string Kategorie, string App)
|
||||
App.erase(0,App.find_last_of("/") +1);
|
||||
std::transform(App.begin(),App.end(),App.begin(),::tolower); // in kleinebuchstaben umwandeln
|
||||
|
||||
// Kategorie auswählen
|
||||
// Kategorie auswhlen
|
||||
int i = KategorieNr(Kategorie);
|
||||
if(i != -1)
|
||||
{
|
||||
// überprüfen, ob App in Kategorie ist
|
||||
// berprfen, ob App in Kategorie ist
|
||||
vector<string>::iterator pos = find(AvailableCategory.apps[i].begin(), AvailableCategory.apps[i].end(), App);
|
||||
if ( pos != AvailableCategory.apps[i].end() )
|
||||
AvailableCategory.apps[i].erase(pos);
|
||||
@ -248,11 +303,11 @@ void AppVerschieben(string Kategorie, string AppOrdner1, bool vor, string AppOrd
|
||||
if((signed)AppOrdner2.find_last_of("/") != -1)
|
||||
AppOrdner2.erase(0,AppOrdner2.find_last_of("/") +1);
|
||||
|
||||
// Kategorie auswählen
|
||||
// Kategorie auswhlen
|
||||
int i = KategorieNr(Kategorie);
|
||||
if(i != -1 && AppOrdner1 != AppOrdner2)
|
||||
{
|
||||
// überprüfen, ob App in Kategorie ist
|
||||
// berprfen, ob App in Kategorie ist
|
||||
vector<string>::iterator pos = find(AvailableCategory.apps[i].begin(), AvailableCategory.apps[i].end(), AppOrdner1);
|
||||
if ( pos != AvailableCategory.apps[i].end() )
|
||||
AvailableCategory.apps[i].erase(pos);
|
||||
|
@ -19,20 +19,38 @@ string get_setting(string source, string search)
|
||||
|
||||
void load()
|
||||
{
|
||||
s32 fd;
|
||||
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()
|
||||
#else
|
||||
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";
|
||||
Settings.settings_dat = "/title/00010001/54484246/data/settings.dat";
|
||||
#endif
|
||||
|
||||
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)
|
||||
ISFS_Close(fd);
|
||||
@ -42,6 +60,7 @@ void load()
|
||||
file_size = ISFS_Read(fd, filearray_settings, filestats_settings.file_length);
|
||||
|
||||
ISFS_Close(fd);
|
||||
#endif
|
||||
|
||||
if(file_size >= 0)
|
||||
{
|
||||
@ -165,6 +184,16 @@ 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);
|
||||
@ -174,7 +203,7 @@ void load()
|
||||
file_size = ISFS_Read(fd, filearray_appios, filestats_appios.file_length);
|
||||
|
||||
ISFS_Close(fd);
|
||||
|
||||
#endif
|
||||
if(file_size >= 0)
|
||||
{
|
||||
string line;
|
||||
|
@ -51,6 +51,7 @@ bool folder_exists()
|
||||
|
||||
void save()
|
||||
{
|
||||
#if !defined(STBOOT) || !defined(STBOOTVWII)
|
||||
s32 file;
|
||||
|
||||
// create save banner
|
||||
@ -74,8 +75,10 @@ void save()
|
||||
|
||||
ISFS_CreateFile(Settings.settings_dat.c_str(), 0, 3, 3, 3);
|
||||
file = ISFS_Open(Settings.settings_dat.c_str(), ISFS_OPEN_RW);
|
||||
|
||||
if (file > 0)
|
||||
{
|
||||
#endif
|
||||
int last_category;
|
||||
string last_category_name;
|
||||
|
||||
@ -90,37 +93,44 @@ void save()
|
||||
last_category_name = Settings.category_name;
|
||||
}
|
||||
|
||||
#if !defined(STBOOT) || !defined(STBOOTVWII)
|
||||
stringstream save_settings;
|
||||
save_settings << "theme = \"" << Options.theme << "\"" << endl;
|
||||
save_settings << "language = \"" << Options.language << "\"" << endl;
|
||||
save_settings << "font = \"" << Options.font << "\"" << endl;
|
||||
#else
|
||||
ofstream save_settings;
|
||||
save_settings.open(Settings.ios_dat.c_str());
|
||||
#endif
|
||||
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 = \"" << 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;
|
||||
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;
|
||||
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 << "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;
|
||||
|
||||
#if !defined(STBOOT) || !defined(STBOOTVWII)
|
||||
|
||||
char *pbuf = NULL;
|
||||
unsigned int psize = save_settings.str().size();
|
||||
@ -165,7 +175,16 @@ void save()
|
||||
ISFS_Write(file, pbuf, sizeof(char) *psize);
|
||||
}
|
||||
ISFS_Close(file);
|
||||
#else
|
||||
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();
|
||||
#endif
|
||||
// save category
|
||||
AvailableCategorySave(Settings.dir_dat);
|
||||
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
42-
|
||||
end
|
||||
end
|
||||
|
@ -1,22 +0,0 @@
|
||||
//rev42:
|
||||
- changed default options:
|
||||
* disable checking for new version automatically
|
||||
* enable sd-card debug logging
|
||||
- added option for choosing whether bootmii boot2 is
|
||||
installed (adds "Load BootMii (Boot2)" in Exit-Prompt
|
||||
- black-listed v65280 of IOS254 (if that version is
|
||||
installed there's no "Load BootMii (IOS)" anymore in Exit-Prompt
|
||||
- ensure 'Launch Priiloader' is only shown if Priiloader
|
||||
is really installed (in some cases it could appear even
|
||||
if Priiloader hasn't been installed)
|
||||
- fixed a bug that caused black-screen then returning into
|
||||
HBF from app loaded with <ahb_access/>
|
||||
- build separate vWii-version using FIX94s NAND-Loader (still using
|
||||
modified Waninkoko NAND-Loader on real Wii)
|
||||
- build using libruntimeiospatch 1.3
|
||||
- vWii version does disable functions not applicable von vWii
|
||||
- installer now falls back to IOS236 if there's no HW_AHBPROT access
|
||||
- SDCardGecko (Debugfile) is now stored on general settings device
|
||||
(no more hardcoded to SD Card)
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user