-removed a few unneeded emu nand lines

-added option to enable overwrite miis and system config on emu
nand with the ones from real nand (disabled by default)
This commit is contained in:
fix94.1 2012-07-22 19:18:00 +00:00
parent 89404ce0e2
commit f9a38eff01
5 changed files with 25 additions and 36 deletions

View File

@ -606,7 +606,7 @@ s32 Nand::__DumpNandFile(const char *source, const char *dest)
}
if(fsop_FileExist(dest))
remove(dest);
fsop_deleteFile(dest);
FILE *file = fopen(dest, "wb");
if (!file)
@ -781,19 +781,7 @@ void Nand::CreatePath(const char *path, ...)
break;
}
DIR *d;
d = opendir(folder);
if(!d)
{
gprintf("Creating folder: \"%s\"\n", folder);
fsop_MakeFolder(folder);
}
else
{
gprintf("Folder \"%s\" exists\n", folder);
closedir(d);
}
fsop_MakeFolder(folder);
free(folder);
}
va_end(args);
@ -929,28 +917,24 @@ s32 Nand::CreateConfig(const char *path)
fake = false;
showprogress = false;
bzero(cfgpath, MAX_FAT_PATH+1);
bzero(settxtpath, MAX_FAT_PATH+1);
memset(cfgpath, 0, sizeof(cfgpath));
snprintf(cfgpath, sizeof(cfgpath), "%s%s", path, SYSCONFPATH);
snprintf(settxtpath, sizeof(settxtpath), "%s%s", path, TXTPATH);
snprintf(settxtpath, sizeof(settxtpath), "%s%s", path, TXTPATH);
__DumpNandFile(SYSCONFPATH, cfgpath);
memset(settxtpath, 0, sizeof(settxtpath));
snprintf(settxtpath, sizeof(settxtpath), "%s%s", path, TXTPATH);
__DumpNandFile(TXTPATH, settxtpath);
return 0;
return 0;
}
s32 Nand::PreNandCfg(const char *path, bool miis)
s32 Nand::PreNandCfg(const char *path, bool miis, bool realconfig)
{
CreatePath(path);
CreatePath("%s/shared2", path);
CreatePath("%s/shared2/sys", path);
if(miis)
{
CreatePath("%s/shared2/menu", path);
CreatePath("%s/shared2/menu/FaceLib", path);
}
CreatePath("%s/shared2/menu", path);
CreatePath("%s/shared2/menu/FaceLib", path);
CreatePath("%s/title", path);
CreatePath("%s/title/00000001", path);
CreatePath("%s/title/00000001/00000002", path);
@ -961,16 +945,21 @@ s32 Nand::PreNandCfg(const char *path, bool miis)
fake = false;
showprogress = false;
snprintf(dest, sizeof(dest), "%s%s", path, SYSCONFPATH);
__DumpNandFile(SYSCONFPATH, dest);
snprintf(dest, sizeof(dest), "%s%s", path, TXTPATH);
__DumpNandFile(TXTPATH, dest);
if(realconfig)
{
snprintf(dest, sizeof(dest), "%s%s", path, SYSCONFPATH);
__DumpNandFile(SYSCONFPATH, dest);
snprintf(dest, sizeof(dest), "%s%s", path, TXTPATH);
__DumpNandFile(TXTPATH, dest);
}
if(miis)
{
snprintf(dest, sizeof(dest), "%s%s", path, MIIPATH);
__DumpNandFile(MIIPATH, dest);
}
return 0;
return 0;
}
s32 Nand::Do_Region_Change(string id)

View File

@ -76,7 +76,7 @@ class Nand
void CreateTitleTMD(const char *path, dir_discHdr *hdr);
s32 CreateConfig(const char *path);
s32 PreNandCfg(const char *path, bool miis);
s32 PreNandCfg(const char *path, bool miis, bool realconfig);
s32 Do_Region_Change(string id);
s32 FlashToNAND(const char *source, const char *dest, dump_callback_t i_dumper, void *i_data);
s32 DoNandDump(const char *source, const char *dest, dump_callback_t i_dumper, void *i_data);

View File

@ -353,7 +353,7 @@ void fsop_deleteFolder(char *source)
unlink(source);
}
void fsop_deleteFile(char *source)
void fsop_deleteFile(const char *source)
{
if(fsop_FileExist(source))
{

View File

@ -17,7 +17,7 @@ bool fsop_DirExist(char *path);
void fsop_MakeFolder(char *path);
bool fsop_CopyFile(char *source, char *target, progress_callback_t spinner, void *spinner_data);
bool fsop_CopyFolder(char *source, char *target, progress_callback_t spinner, void *spinner_data);
void fsop_deleteFile(char *source);
void fsop_deleteFile(const char *source);
void fsop_deleteFolder(char *source);
#endif

View File

@ -2058,7 +2058,7 @@ bool CMenu::_loadChannelList(void)
{
char basepath[64];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[currentPartition], emuPath.c_str());
Nand::Instance()->PreNandCfg(basepath, m_cfg.getBool("NAND", "miis_from_real", true));
Nand::Instance()->PreNandCfg(basepath, m_cfg.getBool("NAND", "real_nand_miis", false), m_cfg.getBool("NAND", "real_nand_config", false));
first = false;
}
string nandpath = sfmt("%s:%s/", DeviceName[currentPartition], emuPath.empty() ? "" : emuPath.c_str());