| 130 | } |
| 131 | |
| 132 | int refreshApp(const char *app_path) |
| 133 | { |
| 134 | char work_bin_path[MAX_PATH_LENGTH]; |
| 135 | int res; |
| 136 | |
| 137 | snprintf(work_bin_path, MAX_PATH_LENGTH, "%s/sce_sys/package/work.bin", app_path); |
| 138 | |
| 139 | // Remove work.bin for custom homebrews |
| 140 | if (isCustomHomebrew(work_bin_path)) { |
| 141 | sceIoRemove(work_bin_path); |
| 142 | } else if (!checkFileExist(work_bin_path)) { |
| 143 | // If available, restore work.bin from licenses.db |
| 144 | void *sfo_buffer = NULL; |
| 145 | char sfo_path[MAX_PATH_LENGTH], contentid[50]; |
| 146 | snprintf(sfo_path, MAX_PATH_LENGTH, "%s/sce_sys/param.sfo", app_path); |
| 147 | int sfo_size = allocateReadFile(sfo_path, &sfo_buffer); |
| 148 | if (sfo_size > 0) { |
| 149 | getSfoString(sfo_buffer, "CONTENT_ID", contentid, sizeof(contentid)); |
| 150 | uint8_t* rif = query_rif(LICENSE_DB, contentid); |
| 151 | if (rif != NULL) { |
| 152 | int fh = sceIoOpen(work_bin_path, SCE_O_WRONLY | SCE_O_CREAT, 0777); |
| 153 | if (fh > 0) { |
| 154 | sceIoWrite(fh, rif, RIF_SIZE); |
| 155 | sceIoClose(fh); |
| 156 | } |
| 157 | free(rif); |
| 158 | } |
| 159 | } |
| 160 | free(sfo_buffer); |
| 161 | } |
| 162 | |
| 163 | // Promote vita app/vita dlc/vita patch (if needed) |
| 164 | res = promoteApp(app_path); |
| 165 | return (res < 0) ? res : 1; |
| 166 | } |
| 167 | |
| 168 | // target_type should be either SCE_S_IFREG for files or SCE_S_IFDIR for directories |
| 169 | int parse_dir_with_callback(int target_type, const char* path, void(*callback)(void*, const char*, const char*), void* data) |
no test coverage detected