3dphotoshoot

diff 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 diff
     1.1 --- a/src/android/assman.c	Sun Jun 07 20:40:37 2015 +0300
     1.2 +++ b/src/android/assman.c	Tue Jun 09 18:38:33 2015 +0300
     1.3 @@ -1,5 +1,30 @@
     1.4 +#include <fcntl.h>
     1.5  #include <android/asset_manager.h>
     1.6 +#include "assman.h"
     1.7 +#include "native_glue.h"
     1.8 +#include "amain.h"
     1.9  
    1.10 -void *ass_open(const char *fname)
    1.11 +ass_file *ass_fopen(const char *fname)
    1.12  {
    1.13 +	AAsset *ass;
    1.14 +
    1.15 +	if(!(ass = AAssetManager_open(app->activity->assetManager, fname, O_RDONLY))) {
    1.16 +		return 0;
    1.17 +	}
    1.18 +	return (ass_file*)ass;
    1.19  }
    1.20 +
    1.21 +void ass_fclose(ass_file *fp)
    1.22 +{
    1.23 +	AAsset_close((AAsset*)fp);
    1.24 +}
    1.25 +
    1.26 +long ass_fseek(ass_file *fp, long offs, int whence)
    1.27 +{
    1.28 +	return AAsset_seek((AAsset*)fp, offs, whence);
    1.29 +}
    1.30 +
    1.31 +size_t ass_fread(void *buf, size_t size, size_t count, ass_file *fp)
    1.32 +{
    1.33 +	return AAsset_read((AAsset*)fp, buf, size * count) / size;
    1.34 +}