3dphotoshoot

view src/android/assman.c @ 16:c6952cc82cca

asset manager, android version
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 09 Jun 2015 18:38:33 +0300
parents 2d48f65da357
children aef7f51f6397
line source
1 #include <fcntl.h>
2 #include <android/asset_manager.h>
3 #include "assman.h"
4 #include "native_glue.h"
5 #include "amain.h"
7 ass_file *ass_fopen(const char *fname)
8 {
9 AAsset *ass;
11 if(!(ass = AAssetManager_open(app->activity->assetManager, fname, O_RDONLY))) {
12 return 0;
13 }
14 return (ass_file*)ass;
15 }
17 void ass_fclose(ass_file *fp)
18 {
19 AAsset_close((AAsset*)fp);
20 }
22 long ass_fseek(ass_file *fp, long offs, int whence)
23 {
24 return AAsset_seek((AAsset*)fp, offs, whence);
25 }
27 size_t ass_fread(void *buf, size_t size, size_t count, ass_file *fp)
28 {
29 return AAsset_read((AAsset*)fp, buf, size * count) / size;
30 }