LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
lg_file_ops.h
1 /*
2  * LibGame - Copyright (C) Emmanuel Thomas-Maurin 2011-2024
3  * All rights reserved
4  */
5 
6 #ifndef LG_FILE_OPS_H
7 #define LG_FILE_OPS_H
8 
9 #ifdef ANDROID_V
10  #define OPEN_ASSET_FILE lg_open_android_asset
11 
12  #define GET_ASSET_SIZE lg_get_android_asset_size
13 
14  #define READ_ASSET_FILE lg_read_from_android_asset
15 
16  #define CLOSE_ASSET_FILE lg_close_android_asset
17 #else
18  #define OPEN_ASSET_FILE lg_open_file
19 
20  #define GET_ASSET_SIZE lg_get_file_size
21 
22  #define READ_ASSET_FILE lg_read_from_bfile
23 
24  #define CLOSE_ASSET_FILE lg_close_file
25 #endif
26 
27 void *lg_open_file(const char *, const char *);
28 
29 long long lg_get_file_size(const char *);
30 
31 int lg_read_from_bfile(const char *, void *, size_t);
32 
33 int lg_write_to_bfile(const char *, void *, size_t);
34 
35 void lg_close_file(FILE *);
36 
37 /* For Android assets */
38 void *lg_open_android_asset(const char *, const char *);
39 
40 long long lg_get_android_asset_size(const char *);
41 
42 int lg_read_from_android_asset(const char *, void *, size_t);
43 
44 void lg_close_android_asset(void *);
45 
46 /* NUA */
47 char *lg_getline_from_str(const char *);
48 
49 #endif /* LG_FILE_OPS_H */
lg_open_android_asset
void * lg_open_android_asset(const char *path, const char *unused)
Definition: lg_file_ops.c:167
lg_read_from_android_asset
int lg_read_from_android_asset(const char *path, void *data, size_t size)
Definition: lg_file_ops.c:214
lg_getline_from_str
char * lg_getline_from_str(const char *str)
Definition: lg_file_ops.c:263
lg_open_file
void * lg_open_file(const char *path, const char *mode_str)
Definition: lg_file_ops.c:32
lg_write_to_bfile
int lg_write_to_bfile(const char *path, void *data, size_t size)
Definition: lg_file_ops.c:128
lg_close_file
void lg_close_file(FILE *fp)
Definition: lg_file_ops.c:155
lg_close_android_asset
void lg_close_android_asset(void *rwops)
Definition: lg_file_ops.c:248
lg_get_android_asset_size
long long lg_get_android_asset_size(const char *path)
Definition: lg_file_ops.c:188
lg_get_file_size
long long lg_get_file_size(const char *path)
Definition: lg_file_ops.c:65
lg_read_from_bfile
int lg_read_from_bfile(const char *path, void *data, size_t size)
Definition: lg_file_ops.c:91