3dphotoshoot

annotate 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
rev   line source
nuclear@16 1 #include <fcntl.h>
nuclear@15 2 #include <android/asset_manager.h>
nuclear@16 3 #include "assman.h"
nuclear@16 4 #include "native_glue.h"
nuclear@16 5 #include "amain.h"
nuclear@15 6
nuclear@16 7 ass_file *ass_fopen(const char *fname)
nuclear@15 8 {
nuclear@16 9 AAsset *ass;
nuclear@16 10
nuclear@16 11 if(!(ass = AAssetManager_open(app->activity->assetManager, fname, O_RDONLY))) {
nuclear@16 12 return 0;
nuclear@16 13 }
nuclear@16 14 return (ass_file*)ass;
nuclear@15 15 }
nuclear@16 16
nuclear@16 17 void ass_fclose(ass_file *fp)
nuclear@16 18 {
nuclear@16 19 AAsset_close((AAsset*)fp);
nuclear@16 20 }
nuclear@16 21
nuclear@16 22 long ass_fseek(ass_file *fp, long offs, int whence)
nuclear@16 23 {
nuclear@16 24 return AAsset_seek((AAsset*)fp, offs, whence);
nuclear@16 25 }
nuclear@16 26
nuclear@16 27 size_t ass_fread(void *buf, size_t size, size_t count, ass_file *fp)
nuclear@16 28 {
nuclear@16 29 return AAsset_read((AAsset*)fp, buf, size * count) / size;
nuclear@16 30 }