minor changes

This commit is contained in:
Christopher Roy Bratusek 2013-01-04 19:05:37 +01:00
parent c1dfc6e6d9
commit 3d57adc65a
4 changed files with 63 additions and 19 deletions

View File

@ -120,6 +120,8 @@ void AvailableCategorySave(string pfad)
// Zeilenumbruch nach Kategorie
out << endl;
}
out.close();
#else
ISFS_Delete(pfad.c_str());
ISFS_CreateFile(pfad.c_str(), 0, 3, 3, 3);

View File

@ -20,8 +20,6 @@ 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);
@ -30,6 +28,8 @@ void load()
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
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";

View File

@ -1,6 +1,7 @@
#include "main.h"
#include <dirent.h>
#include <sstream>
#include <fstream>
#include "xprintf.h"
extern const u8 banner_bin[];
@ -51,7 +52,64 @@ bool folder_exists()
void save()
{
#if !defined(STBOOT) || !defined(STBOOTVWII)
#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
@ -78,7 +136,6 @@ void save()
if (file > 0)
{
#endif
int last_category;
string last_category_name;
@ -93,12 +150,7 @@ void save()
last_category_name = Settings.category_name;
}
#if !defined(STBOOT) || !defined(STBOOTVWII)
stringstream save_settings;
#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;
@ -130,8 +182,6 @@ void save()
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();
@ -175,14 +225,6 @@ 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);