on decrease-android-validity help sign in
32 lines 1.1 kB history raw
1{-# LANGUAGE ForeignFunctionInterface #-}
3module Obelisk.ExecutableConfig.Internal.AssetManager where
5#include <jni.h>
6#include <android/asset_manager.h>
7#include <android/asset_manager_jni.h>
9import Data.Int
10import Foreign.C.String
11import Foreign.C.Types
12import Foreign.Ptr
14newtype JObject = JObject { unJObject :: Ptr JObject }
16newtype AAssetManager = AAssetManager { unAAssetManager :: Ptr AAssetManager }
18newtype AAsset = AAsset { unAAsset :: Ptr AAsset }
20foreign import ccall "ExecutableConfig_getAssets" getAssets :: IO JObject
22foreign import ccall "ExecutableConfig_aassetManagerFromJava" assetManagerFromJava :: JObject -> IO AAssetManager
24foreign import ccall "ExecutableConfig_freeAssetManager" freeAssetManager :: JObject -> IO ()
26foreign import ccall "AAssetManager_open" assetManager_open :: AAssetManager -> CString -> CInt -> IO AAsset
28foreign import ccall "AAsset_getBuffer" asset_getBuffer :: AAsset -> IO (Ptr CChar)
30foreign import ccall "AAsset_getLength" asset_getLength :: AAsset -> IO #{type off_t}
32foreign import ccall "AAsset_close" asset_close :: AAsset -> IO ()