mirror of
https://github.com/joel16/VitaShell.git
synced 2024-11-23 11:49:40 +00:00
Finished compression feature.
This commit is contained in:
parent
36e8c98c7a
commit
6ef0c2f2a4
1
UI2.c
1
UI2.c
@ -1062,7 +1062,6 @@ static int dialogSteps() {
|
||||
// With refresh
|
||||
case DIALOG_STEP_COPIED:
|
||||
case DIALOG_STEP_DELETED:
|
||||
case DIALOG_STEP_EXPORTED:
|
||||
if (msg_result == MESSAGE_DIALOG_RESULT_NONE || msg_result == MESSAGE_DIALOG_RESULT_FINISHED) {
|
||||
refresh = 1;
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
|
@ -264,13 +264,13 @@ int extractArchivePath(char *src, char *dst, FileProcessParam *param) {
|
||||
}
|
||||
}
|
||||
|
||||
if (written != read) {
|
||||
if (written < 0) {
|
||||
free(buf);
|
||||
|
||||
sceIoClose(fddst);
|
||||
archiveFileClose(fdsrc);
|
||||
|
||||
return (written < 0) ? written : -1;
|
||||
return written;
|
||||
}
|
||||
|
||||
seek += written;
|
||||
|
19
file.c
19
file.c
@ -178,9 +178,6 @@ int getPathInfo(char *path, uint64_t *size, uint32_t *folders, uint32_t *files,
|
||||
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
if (strcmp(dir.d_name, ".") == 0 || strcmp(dir.d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
char *new_path = malloc(strlen(path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
|
||||
@ -245,9 +242,6 @@ int removePath(char *path, FileProcessParam *param) {
|
||||
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
if (strcmp(dir.d_name, ".") == 0 || strcmp(dir.d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
char *new_path = malloc(strlen(path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
|
||||
@ -380,13 +374,13 @@ int copyFile(char *src_path, char *dst_path, FileProcessParam *param) {
|
||||
}
|
||||
}
|
||||
|
||||
if (written != read) {
|
||||
if (written < 0) {
|
||||
free(buf);
|
||||
|
||||
sceIoClose(fddst);
|
||||
sceIoClose(fdsrc);
|
||||
|
||||
return (written < 0) ? written : -1;
|
||||
return written;
|
||||
}
|
||||
|
||||
seek += written;
|
||||
@ -458,9 +452,6 @@ int copyPath(char *src_path, char *dst_path, FileProcessParam *param) {
|
||||
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
if (strcmp(dir.d_name, ".") == 0 || strcmp(dir.d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
char *new_src_path = malloc(strlen(src_path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", dir.d_name);
|
||||
|
||||
@ -554,9 +545,6 @@ int movePath(char *src_path, char *dst_path, int flags, FileProcessParam *param)
|
||||
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
if (strcmp(dir.d_name, ".") == 0 || strcmp(dir.d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
char *new_src_path = malloc(strlen(src_path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_src_path, MAX_PATH_LENGTH, "%s%s%s", src_path, hasEndSlash(src_path) ? "" : "/", dir.d_name);
|
||||
|
||||
@ -877,9 +865,6 @@ int fileListGetDirectoryEntries(FileList *list, char *path) {
|
||||
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
if (strcmp(dir.d_name, ".") == 0 || strcmp(dir.d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
FileListEntry *entry = malloc(sizeof(FileListEntry));
|
||||
|
||||
strcpy(entry->name, dir.d_name);
|
||||
|
@ -426,9 +426,6 @@ int exportPath(char *path, uint32_t *songs, uint32_t *pictures, FileProcessParam
|
||||
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
if (strcmp(dir.d_name, ".") == 0 || strcmp(dir.d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
char *new_path = malloc(strlen(path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
|
||||
|
115
main.c
115
main.c
@ -62,6 +62,7 @@ static FileList file_list, mark_list, copy_list, install_list;
|
||||
|
||||
// Paths
|
||||
static char cur_file[MAX_PATH_LENGTH], archive_path[MAX_PATH_LENGTH], install_path[MAX_PATH_LENGTH];
|
||||
static char focus_name[MAX_NAME_LENGTH];
|
||||
|
||||
// Position
|
||||
static int base_pos = 0, rel_pos = 0;
|
||||
@ -143,7 +144,7 @@ DIR_UP_RETURN:
|
||||
dirUpCloseArchive();
|
||||
}
|
||||
|
||||
void focusOnFilename(char *name) {
|
||||
void setFocusOnFilename(char *name) {
|
||||
int name_pos = fileListGetNumberByName(&file_list, name);
|
||||
if (name_pos < file_list.length) {
|
||||
while (1) {
|
||||
@ -722,7 +723,6 @@ int contextMenuEnterCallback(int pos, void* context) {
|
||||
}
|
||||
|
||||
// Empty copy list at first
|
||||
if (copy_list.length > 0)
|
||||
fileListEmpty(©_list);
|
||||
|
||||
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
|
||||
@ -982,7 +982,7 @@ void initFtp() {
|
||||
}
|
||||
|
||||
int dialogSteps() {
|
||||
int refresh = 0;
|
||||
int refresh = REFRESH_MODE_NONE;
|
||||
|
||||
int msg_result = updateMessageDialog();
|
||||
int ime_result = updateImeDialog();
|
||||
@ -998,27 +998,80 @@ int dialogSteps() {
|
||||
|
||||
break;
|
||||
|
||||
// With refresh
|
||||
case DIALOG_STEP_COPIED:
|
||||
case DIALOG_STEP_CANCELLED:
|
||||
refresh = REFRESH_MODE_NORMAL;
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
break;
|
||||
|
||||
case DIALOG_STEP_DELETED:
|
||||
case DIALOG_STEP_EXPORTED:
|
||||
case DIALOG_STEP_COMPRESSED:
|
||||
if (msg_result == MESSAGE_DIALOG_RESULT_NONE || msg_result == MESSAGE_DIALOG_RESULT_FINISHED) {
|
||||
refresh = 1;
|
||||
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
|
||||
|
||||
// Empty mark list if on marked entry
|
||||
if (fileListFindEntry(&mark_list, file_entry->name)) {
|
||||
fileListEmpty(&mark_list);
|
||||
}
|
||||
|
||||
refresh = REFRESH_MODE_NORMAL;
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DIALOG_STEP_CANCELLED:
|
||||
refresh = 1;
|
||||
case DIALOG_STEP_COMPRESSED:
|
||||
if (msg_result == MESSAGE_DIALOG_RESULT_NONE || msg_result == MESSAGE_DIALOG_RESULT_FINISHED) {
|
||||
FileListEntry *file_entry = fileListGetNthEntry(&file_list, base_pos + rel_pos);
|
||||
|
||||
// Empty mark list if on marked entry
|
||||
if (fileListFindEntry(&mark_list, file_entry->name)) {
|
||||
fileListEmpty(&mark_list);
|
||||
}
|
||||
|
||||
// The name of the newly created zip
|
||||
char *name = (char *)getImeDialogInputTextUTF8();
|
||||
|
||||
// Mark that entry
|
||||
FileListEntry *mark_entry = malloc(sizeof(FileListEntry));
|
||||
strcpy(mark_entry->name, name);
|
||||
mark_entry->name_length = strlen(name);
|
||||
fileListAddEntry(&mark_list, mark_entry, SORT_NONE);
|
||||
|
||||
// Focus
|
||||
strcpy(focus_name, name);
|
||||
|
||||
refresh = REFRESH_MODE_SETFOCUS;
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DIALOG_STEP_COPIED:
|
||||
case DIALOG_STEP_MOVED:
|
||||
if (msg_result == MESSAGE_DIALOG_RESULT_NONE || msg_result == MESSAGE_DIALOG_RESULT_FINISHED) {
|
||||
// Empty mark list
|
||||
fileListEmpty(&mark_list);
|
||||
|
||||
// Copy copy list to mark list
|
||||
FileListEntry *copy_entry = copy_list.head;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < copy_list.length; i++) {
|
||||
FileListEntry *mark_entry = malloc(sizeof(FileListEntry));
|
||||
memcpy(mark_entry, copy_entry, sizeof(FileListEntry));
|
||||
fileListAddEntry(&mark_list, mark_entry, SORT_NONE);
|
||||
|
||||
// Next
|
||||
copy_entry = copy_entry->next;
|
||||
}
|
||||
|
||||
// Focus
|
||||
strcpy(focus_name, copy_list.head->name);
|
||||
|
||||
// Empty copy list when moved
|
||||
if (dialog_step == DIALOG_STEP_MOVED)
|
||||
fileListEmpty(©_list);
|
||||
refresh = 1;
|
||||
|
||||
refresh = REFRESH_MODE_SETFOCUS;
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
}
|
||||
|
||||
@ -1051,12 +1104,12 @@ int dialogSteps() {
|
||||
|
||||
case DIALOG_STEP_FTP:
|
||||
if (msg_result == MESSAGE_DIALOG_RESULT_YES) {
|
||||
refresh = 1;
|
||||
refresh = REFRESH_MODE_NORMAL;
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
} else if (msg_result == MESSAGE_DIALOG_RESULT_NO) {
|
||||
powerUnlock();
|
||||
ftpvita_fini();
|
||||
refresh = 1;
|
||||
refresh = REFRESH_MODE_NORMAL;
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
}
|
||||
|
||||
@ -1072,7 +1125,7 @@ int dialogSteps() {
|
||||
|
||||
dialog_step = DIALOG_STEP_COPYING;
|
||||
|
||||
SceUID thid = sceKernelCreateThread("copy_thread", (SceKernelThreadEntry)copy_thread, 0x40, 0x10000, 0, 0, NULL);
|
||||
SceUID thid = sceKernelCreateThread("copy_thread", (SceKernelThreadEntry)copy_thread, 0x40, 0x100000, 0, 0, NULL);
|
||||
if (thid >= 0)
|
||||
sceKernelStartThread(thid, sizeof(CopyArguments), &args);
|
||||
}
|
||||
@ -1098,7 +1151,7 @@ int dialogSteps() {
|
||||
|
||||
dialog_step = DIALOG_STEP_DELETING;
|
||||
|
||||
SceUID thid = sceKernelCreateThread("delete_thread", (SceKernelThreadEntry)delete_thread, 0x40, 0x10000, 0, 0, NULL);
|
||||
SceUID thid = sceKernelCreateThread("delete_thread", (SceKernelThreadEntry)delete_thread, 0x40, 0x100000, 0, 0, NULL);
|
||||
if (thid >= 0)
|
||||
sceKernelStartThread(thid, sizeof(DeleteArguments), &args);
|
||||
}
|
||||
@ -1124,7 +1177,7 @@ int dialogSteps() {
|
||||
|
||||
dialog_step = DIALOG_STEP_EXPORTING;
|
||||
|
||||
SceUID thid = sceKernelCreateThread("export_thread", (SceKernelThreadEntry)export_thread, 0x40, 0x10000, 0, 0, NULL);
|
||||
SceUID thid = sceKernelCreateThread("export_thread", (SceKernelThreadEntry)export_thread, 0x40, 0x100000, 0, 0, NULL);
|
||||
if (thid >= 0)
|
||||
sceKernelStartThread(thid, sizeof(ExportArguments), &args);
|
||||
}
|
||||
@ -1156,7 +1209,7 @@ int dialogSteps() {
|
||||
if (res < 0) {
|
||||
errorDialog(res);
|
||||
} else {
|
||||
refresh = 1;
|
||||
refresh = REFRESH_MODE_NORMAL;
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
}
|
||||
}
|
||||
@ -1180,7 +1233,7 @@ int dialogSteps() {
|
||||
if (res < 0) {
|
||||
errorDialog(res);
|
||||
} else {
|
||||
refresh = 1;
|
||||
refresh = REFRESH_MODE_NORMAL;
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
}
|
||||
}
|
||||
@ -1207,7 +1260,7 @@ int dialogSteps() {
|
||||
initMessageDialog(MESSAGE_DIALOG_PROGRESS_BAR, language_container[COMPRESSING]);
|
||||
dialog_step = DIALOG_STEP_COMPRESSING;
|
||||
|
||||
SceUID thid = sceKernelCreateThread("compress_thread", (SceKernelThreadEntry)compress_thread, 0x40, 0x10000, 0, 0, NULL);
|
||||
SceUID thid = sceKernelCreateThread("compress_thread", (SceKernelThreadEntry)compress_thread, 0x40, 0x100000, 0, 0, NULL);
|
||||
if (thid >= 0)
|
||||
sceKernelStartThread(thid, sizeof(CompressArguments), &args);
|
||||
}
|
||||
@ -1241,7 +1294,7 @@ int dialogSteps() {
|
||||
dialog_step = DIALOG_STEP_HASHING;
|
||||
|
||||
// Create a thread to run out actual sum
|
||||
SceUID thid = sceKernelCreateThread("hash_thread", (SceKernelThreadEntry)hash_thread, 0x40, 0x10000, 0, 0, NULL);
|
||||
SceUID thid = sceKernelCreateThread("hash_thread", (SceKernelThreadEntry)hash_thread, 0x40, 0x100000, 0, 0, NULL);
|
||||
if (thid >= 0)
|
||||
sceKernelStartThread(thid, sizeof(HashArguments), &args);
|
||||
}
|
||||
@ -1268,7 +1321,7 @@ int dialogSteps() {
|
||||
args.file = install_path;
|
||||
|
||||
// Focus
|
||||
focusOnFilename(entry->name);
|
||||
setFocusOnFilename(entry->name);
|
||||
|
||||
// Remove entry
|
||||
fileListRemoveEntry(&install_list, entry);
|
||||
@ -1278,7 +1331,7 @@ int dialogSteps() {
|
||||
|
||||
dialog_step = DIALOG_STEP_INSTALLING;
|
||||
|
||||
SceUID thid = sceKernelCreateThread("install_thread", (SceKernelThreadEntry)install_thread, 0x40, 0x10000, 0, 0, NULL);
|
||||
SceUID thid = sceKernelCreateThread("install_thread", (SceKernelThreadEntry)install_thread, 0x40, 0x100000, 0, 0, NULL);
|
||||
if (thid >= 0)
|
||||
sceKernelStartThread(thid, sizeof(InstallArguments), &args);
|
||||
}
|
||||
@ -1303,7 +1356,7 @@ int dialogSteps() {
|
||||
}
|
||||
|
||||
dialog_step = DIALOG_STEP_NONE;
|
||||
refresh = 1;
|
||||
refresh = REFRESH_MODE_NORMAL;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1322,7 +1375,7 @@ int dialogSteps() {
|
||||
|
||||
dialog_step = DIALOG_STEP_EXTRACTING;
|
||||
|
||||
SceUID thid = sceKernelCreateThread("update_extract_thread", (SceKernelThreadEntry)update_extract_thread, 0x40, 0x10000, 0, 0, NULL);
|
||||
SceUID thid = sceKernelCreateThread("update_extract_thread", (SceKernelThreadEntry)update_extract_thread, 0x40, 0x100000, 0, 0, NULL);
|
||||
if (thid >= 0)
|
||||
sceKernelStartThread(thid, 0, NULL);
|
||||
}
|
||||
@ -1529,7 +1582,7 @@ BEGIN_SHELL_UI:
|
||||
lastdir[i] = ch2;
|
||||
|
||||
refreshFileList();
|
||||
focusOnFilename(p + 1);
|
||||
setFocusOnFilename(p + 1);
|
||||
|
||||
strcpy(file_list.path, lastdir);
|
||||
|
||||
@ -1559,7 +1612,7 @@ BEGIN_SHELL_UI:
|
||||
if (!Change_UI) {
|
||||
readPad();
|
||||
|
||||
int refresh = 0;
|
||||
int refresh = REFRESH_MODE_NONE;
|
||||
|
||||
// Control
|
||||
if (dialog_step == DIALOG_STEP_NONE) {
|
||||
@ -1580,14 +1633,18 @@ BEGIN_SHELL_UI:
|
||||
|
||||
// Refresh on app resume
|
||||
if (event.systemEvent == SCE_APPMGR_SYSTEMEVENT_ON_RESUME) {
|
||||
refresh = 1;
|
||||
refresh = REFRESH_MODE_NORMAL;
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
if (refresh != REFRESH_MODE_NONE) {
|
||||
// Refresh lists
|
||||
refreshFileList();
|
||||
refreshMarkList();
|
||||
refreshCopyList();
|
||||
|
||||
// Focus
|
||||
if (refresh == REFRESH_MODE_SETFOCUS)
|
||||
setFocusOnFilename(focus_name);
|
||||
}
|
||||
|
||||
// Start drawing
|
||||
@ -1831,7 +1888,7 @@ int main(int argc, const char *argv[]) {
|
||||
initTextContextMenuWidth();
|
||||
|
||||
// Automatic network update
|
||||
SceUID thid = sceKernelCreateThread("network_update_thread", (SceKernelThreadEntry)network_update_thread, 0x10000100, 0x10000, 0, 0, NULL);
|
||||
SceUID thid = sceKernelCreateThread("network_update_thread", (SceKernelThreadEntry)network_update_thread, 0x10000100, 0x100000, 0, 0, NULL);
|
||||
if (thid >= 0)
|
||||
sceKernelStartThread(thid, 0, NULL);
|
||||
|
||||
|
7
main.h
7
main.h
@ -142,6 +142,12 @@
|
||||
|
||||
#define BIG_BUFFER_SIZE 16 * 1024 * 1024
|
||||
|
||||
enum RefreshModes {
|
||||
REFRESH_MODE_NONE,
|
||||
REFRESH_MODE_NORMAL,
|
||||
REFRESH_MODE_SETFOCUS,
|
||||
};
|
||||
|
||||
enum DialogSteps {
|
||||
DIALOG_STEP_NONE,
|
||||
|
||||
@ -174,7 +180,6 @@ enum DialogSteps {
|
||||
DIALOG_STEP_EXPORT_QUESTION,
|
||||
DIALOG_STEP_EXPORT_CONFIRMED,
|
||||
DIALOG_STEP_EXPORTING,
|
||||
DIALOG_STEP_EXPORTED,
|
||||
|
||||
DIALOG_STEP_INSTALL_QUESTION,
|
||||
DIALOG_STEP_INSTALL_CONFIRMED,
|
||||
|
77
makezip.c
77
makezip.c
@ -43,8 +43,6 @@ uLong filetime(const char *filename, tm_zip *tmzip, uLong *dostime) {
|
||||
}
|
||||
|
||||
int zipAddFile(zipFile zf, char *path, int filename_start, FileProcessParam *param) {
|
||||
debugPrintf("%s %s\n", __FUNCTION__, path);
|
||||
|
||||
int res;
|
||||
|
||||
// Get information about the file on disk so we can store it in zip
|
||||
@ -66,7 +64,7 @@ int zipAddFile(zipFile zf, char *path, int filename_start, FileProcessParam *par
|
||||
char filename[MAX_PATH_LENGTH];
|
||||
strcpy(filename, path + filename_start);
|
||||
|
||||
int level = 9;
|
||||
int level = Z_DEFAULT_COMPRESSION;
|
||||
|
||||
res = zipOpenNewFileInZip3_64(zf, filename, &zi,
|
||||
NULL, 0, NULL, 0, NULL,
|
||||
@ -113,13 +111,13 @@ int zipAddFile(zipFile zf, char *path, int filename_start, FileProcessParam *par
|
||||
break;
|
||||
|
||||
int written = zipWriteInFileInZip(zf, buf, read);
|
||||
if (written != read) {
|
||||
if (written < 0) {
|
||||
free(buf);
|
||||
|
||||
sceIoClose(fd);
|
||||
zipCloseFileInZip(zf);
|
||||
|
||||
return (written < 0) ? written : -1;
|
||||
return written;
|
||||
}
|
||||
|
||||
seek += written;
|
||||
@ -150,11 +148,63 @@ int zipAddFile(zipFile zf, char *path, int filename_start, FileProcessParam *par
|
||||
return 1;
|
||||
}
|
||||
|
||||
int zipAddPath(zipFile zf, char *path, int filename_start, FileProcessParam *param) {
|
||||
debugPrintf("%s %s\n", __FUNCTION__, path);
|
||||
int zipAddFolder(zipFile zf, char *path, int filename_start, FileProcessParam *param) {
|
||||
int res;
|
||||
|
||||
// Get information about the file on disk so we can store it in zip
|
||||
zip_fileinfo zi;
|
||||
memset(&zi, 0, sizeof(zip_fileinfo));
|
||||
filetime(path, &zi.tmz_date, &zi.dosDate);
|
||||
|
||||
// Size
|
||||
SceIoStat stat;
|
||||
memset(&stat, 0, sizeof(SceIoStat));
|
||||
res = sceIoGetstat(path, &stat);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
// Open new file in zip
|
||||
char filename[MAX_PATH_LENGTH];
|
||||
strcpy(filename, path + filename_start);
|
||||
addEndSlash(filename);
|
||||
|
||||
int level = Z_DEFAULT_COMPRESSION;
|
||||
|
||||
res = zipOpenNewFileInZip3_64(zf, filename, &zi,
|
||||
NULL, 0, NULL, 0, NULL,
|
||||
(level != 0) ? Z_DEFLATED : 0,
|
||||
level, 0,
|
||||
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||
NULL, 0, 0);
|
||||
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
if (param) {
|
||||
if (param->value)
|
||||
(*param->value)++;
|
||||
|
||||
if (param->SetProgress)
|
||||
param->SetProgress(param->value ? *param->value : 0, param->max);
|
||||
|
||||
if (param->cancelHandler && param->cancelHandler()) {
|
||||
zipCloseFileInZip(zf);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
zipCloseFileInZip(zf);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int zipAddPath(zipFile zf, char *path, int filename_start, FileProcessParam *param) {
|
||||
SceUID dfd = sceIoDopen(path);
|
||||
if (dfd >= 0) {
|
||||
int ret = zipAddFolder(zf, path, filename_start, param);
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
|
||||
int res = 0;
|
||||
|
||||
do {
|
||||
@ -163,9 +213,6 @@ int zipAddPath(zipFile zf, char *path, int filename_start, FileProcessParam *par
|
||||
|
||||
res = sceIoDread(dfd, &dir);
|
||||
if (res > 0) {
|
||||
if (strcmp(dir.d_name, ".") == 0 || strcmp(dir.d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
char *new_path = malloc(strlen(path) + strlen(dir.d_name) + 2);
|
||||
snprintf(new_path, MAX_PATH_LENGTH, "%s%s%s", path, hasEndSlash(path) ? "" : "/", dir.d_name);
|
||||
|
||||
@ -179,7 +226,8 @@ int zipAddPath(zipFile zf, char *path, int filename_start, FileProcessParam *par
|
||||
|
||||
free(new_path);
|
||||
|
||||
if (ret <= 0) {
|
||||
// Some folders are protected and return 0x80010001. Bypass them
|
||||
if (ret <= 0 && ret != 0x80010001) {
|
||||
sceIoDclose(dfd);
|
||||
return ret;
|
||||
}
|
||||
@ -252,11 +300,12 @@ int compress_thread(SceSize args_size, CompressArguments *args) {
|
||||
}
|
||||
|
||||
// Check memory card free space
|
||||
/* if (checkMemoryCardFreeSpace(size))
|
||||
double guessed_size = (double)size * 0.7f;
|
||||
if (checkMemoryCardFreeSpace((uint64_t)guessed_size))
|
||||
goto EXIT;
|
||||
*/
|
||||
|
||||
// Update thread
|
||||
thid = createStartUpdateThread(size);
|
||||
thid = createStartUpdateThread(size + folders);
|
||||
|
||||
// Remove process
|
||||
uint64_t value = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user