2016-08-06 06:59:41 +00:00
|
|
|
/*
|
|
|
|
VitaShell
|
|
|
|
Copyright (C) 2015-2016, TheFloW
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FILE_H__
|
|
|
|
#define __FILE_H__
|
|
|
|
|
|
|
|
#define MAX_PATH_LENGTH 1024
|
|
|
|
#define MAX_NAME_LENGTH 256
|
|
|
|
#define MAX_SHORT_NAME_LENGTH 64
|
|
|
|
#define MAX_MOUNT_POINT_LENGTH 16
|
|
|
|
|
|
|
|
#define TRANSFER_SIZE 64 * 1024
|
|
|
|
|
|
|
|
#define HOME_PATH "home"
|
|
|
|
#define DIR_UP ".."
|
|
|
|
|
|
|
|
enum FileTypes {
|
|
|
|
FILE_TYPE_UNKNOWN,
|
|
|
|
FILE_TYPE_BMP,
|
2016-09-04 10:55:15 +00:00
|
|
|
FILE_TYPE_INI,
|
2016-08-06 06:59:41 +00:00
|
|
|
FILE_TYPE_JPEG,
|
2016-08-08 21:31:41 +00:00
|
|
|
FILE_TYPE_MP3,
|
2016-09-04 10:55:15 +00:00
|
|
|
FILE_TYPE_PNG,
|
2016-09-01 16:20:47 +00:00
|
|
|
FILE_TYPE_SFO,
|
2016-09-04 10:55:15 +00:00
|
|
|
FILE_TYPE_TXT,
|
2016-08-06 06:59:41 +00:00
|
|
|
FILE_TYPE_VPK,
|
2016-09-04 10:55:15 +00:00
|
|
|
FILE_TYPE_XML,
|
2016-08-06 06:59:41 +00:00
|
|
|
FILE_TYPE_ZIP,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum SortFlags {
|
|
|
|
SORT_NONE,
|
|
|
|
SORT_BY_NAME_AND_FOLDER,
|
|
|
|
};
|
|
|
|
|
2016-09-06 19:19:21 +00:00
|
|
|
enum MoveFlags {
|
|
|
|
MOVE_INTEGRATE = 0x1, // Integrate directories
|
|
|
|
MOVE_REPLACE = 0x2, // Replace files
|
|
|
|
};
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
typedef struct FileListEntry {
|
|
|
|
struct FileListEntry *next;
|
|
|
|
struct FileListEntry *previous;
|
|
|
|
char name[MAX_NAME_LENGTH];
|
2016-08-23 12:50:39 +00:00
|
|
|
int name_length;
|
2016-08-06 06:59:41 +00:00
|
|
|
int is_folder;
|
|
|
|
int type;
|
|
|
|
SceOff size;
|
2016-08-23 12:50:39 +00:00
|
|
|
SceDateTime time;
|
|
|
|
int reserved[16];
|
2016-08-06 06:59:41 +00:00
|
|
|
} FileListEntry;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
FileListEntry *head;
|
|
|
|
FileListEntry *tail;
|
|
|
|
int length;
|
|
|
|
char path[MAX_PATH_LENGTH];
|
|
|
|
int files;
|
|
|
|
int folders;
|
|
|
|
} FileList;
|
|
|
|
|
2016-09-05 20:05:05 +00:00
|
|
|
int allocateReadFile(char *file, void **buffer);
|
2016-08-06 06:59:41 +00:00
|
|
|
int ReadFile(char *file, void *buf, int size);
|
|
|
|
int WriteFile(char *file, void *buf, int size);
|
|
|
|
|
2016-08-08 21:31:41 +00:00
|
|
|
int getFileSize(char *pInputFileName);
|
2016-09-06 23:52:33 +00:00
|
|
|
int getFileSha1(char *pInputFileName, uint8_t *pSha1Out, uint64_t *value, uint64_t max, void (*SetProgress)(uint64_t value, uint64_t max), int (* cancelHandler)());
|
2016-08-26 19:08:43 +00:00
|
|
|
int getPathInfo(char *path, uint64_t *size, uint32_t *folders, uint32_t *files);
|
|
|
|
int removePath(char *path, uint64_t *value, uint64_t max, void (* SetProgress)(uint64_t value, uint64_t max), int (* cancelHandler)());
|
|
|
|
int copyFile(char *src_path, char *dst_path, uint64_t *value, uint64_t max, void (* SetProgress)(uint64_t value, uint64_t max), int (* cancelHandler)());
|
|
|
|
int copyPath(char *src_path, char *dst_path, uint64_t *value, uint64_t max, void (* SetProgress)(uint64_t value, uint64_t max), int (* cancelHandler)());
|
2016-09-06 19:19:21 +00:00
|
|
|
int movePath(char *src_path, char *dst_path, int flags, uint64_t *value, uint64_t max, void (* SetProgress)(uint64_t value, uint64_t max), int (* cancelHandler)());
|
2016-08-06 06:59:41 +00:00
|
|
|
|
|
|
|
int getFileType(char *file);
|
|
|
|
|
|
|
|
int getNumberMountPoints();
|
|
|
|
char **getMountPoints();
|
|
|
|
|
|
|
|
FileListEntry *fileListFindEntry(FileList *list, char *name);
|
|
|
|
FileListEntry *fileListGetNthEntry(FileList *list, int n);
|
2016-09-04 13:30:39 +00:00
|
|
|
int fileListGetNumberByName(FileList *list, char *name);
|
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
void fileListAddEntry(FileList *list, FileListEntry *entry, int sort);
|
|
|
|
int fileListRemoveEntry(FileList *list, FileListEntry *entry);
|
|
|
|
int fileListRemoveEntryByName(FileList *list, char *name);
|
2016-09-04 13:30:39 +00:00
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
void fileListEmpty(FileList *list);
|
2016-09-04 13:30:39 +00:00
|
|
|
|
2016-08-06 06:59:41 +00:00
|
|
|
int fileListGetEntries(FileList *list, char *path);
|
|
|
|
|
2016-08-08 21:31:41 +00:00
|
|
|
#endif
|