]> Chaos Git - corbenik/corbenik.git/commitdiff
Skip repatch of TWL / AGB unless reconfigured
authorchaoskagami <chaos.kagami@gmail.com>
Tue, 27 Dec 2016 05:10:45 +0000 (00:10 -0500)
committerchaoskagami <chaos.kagami@gmail.com>
Tue, 27 Dec 2016 05:10:45 +0000 (00:10 -0500)
include/firm/firm.h
source/firm/firm.c
source/patcher.c

index df233aed97006820b378f204619cf5c2cd312b8c..ea32a2fe909e916c1e053196f8097a0e7a2deedf 100644 (file)
@@ -37,7 +37,7 @@ int prepatch_firm(const char *path, const char *prepatch_path, const char* modul
 
 /* 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.
  */
index f0b7b5b6d90f86b064449e775b178eaaa6e79cce..f45d9dc4c58f1a8d2336bd926aa7e6d62ba88371 100644 (file)
@@ -128,6 +128,13 @@ load_firm(const char *path, size_t *size_out)
 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);
 
@@ -162,8 +169,10 @@ prepatch_firm(const char* firm_path, const char* prepatch_path, const char* modu
 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;
index a91d3455711c3a638a5dff75416d1cf6493822ef..99f89b6e15dcd3a2a9f3e4c3562bd9346b249afc 100644 (file)
@@ -36,7 +36,8 @@ int
 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);