fix for corrupted graphics when manipulating config files
[open-ps2-loader.git] / include / util.h
blobd6cb48e9c3f378f001925ca92680b361fda3641e
1 #ifndef __UTIL_H
2 #define __UTIL_H
4 #include <gsToolkit.h>
6 int getFileSize(int fd);
7 int openFile(char* path, int mode);
8 void* readFile(char* path, int align, int* size);
9 void checkCreateDir(char* path);
10 int listDir(char* path, char* separator, int maxElem,
11 int (*readEntry)(int index, char *path, char* separator, char* name, unsigned int mode));
13 typedef struct {
14 int fd;
15 int mode;
16 char* buffer;
17 unsigned int size;
18 unsigned int available;
19 char* lastPtr;
20 short allocResult;
21 } file_buffer_t;
23 file_buffer_t* openFileBuffer(char* fpath, int mode, short allocResult, unsigned int size);
24 int readFileBuffer(file_buffer_t* readContext, char** outBuf);
25 void writeFileBuffer(file_buffer_t* fileBuffer, char* inBuf, int size);
26 void closeFileBuffer(file_buffer_t* fileBuffer);
28 inline int max(int a, int b);
29 inline int min(int a, int b);
30 int fromHex(char digit);
31 char toHex(int digit);
33 #endif