/* Boots the CFW, generating caches and applying patches as-needed to the specified FIRM
*/
-int boot_firm(const char *firm_path, const char *prepatch_path, const char* module_path);
+int boot_firm(const char* firm_path, const char* prepatch_path, const char* module_path);
/* Loads a firmware off disk, returning it. The memory should be free()'d when done, unless you plan to boot.
*/
int
prepatch_firm(const char* firm_path, const char* prepatch_path, const char* module_path)
{
+ FILE* test = cropen(prepatch_path, "r");
+ if (test) {
+ // Already exists.
+ crclose(test);
+ return 0;
+ }
+
size_t size = 0;
firm_h* firm = load_firm(firm_path, &size);
int
boot_firm(const char* firm_path, const char* prepatch_path, const char* module_path)
{
+ firm_h* firm;
+
size_t size = 0;
- firm_h* firm = load_firm(firm_path, &size);
+ firm = load_firm(firm_path, &size);
if (firm == NULL)
return 1;
generate_patch_cache(void)
{
// Remove cache
- rrmdir(PATH_LOADER_CACHE);
+ rrmdir(PATH_TEMP);
+ f_mkdir(PATH_TEMP);
f_mkdir(PATH_LOADER_CACHE);
recurse_call(PATH_PATCHES, patch_cache_func);