LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024-2025 ETMSoftware
lg_android_assets.c File Reference

Functions

void * jni_get_android_asset (const char *path, size_t *size)
 
int jni_free_android_asset ()
 
int jni_free_all ()
 

Detailed Description

 === Android Assets stuff ===

 Android specific - no op funcs on Linux

Function Documentation

◆ jni_get_android_asset()

void* jni_get_android_asset ( const char *  path,
size_t *  size 
)

Access Android Assets

If asset found, return addr of buffer and set buffer size

WARNING #1: must call jni_free_android_asset() afterwards, when done with buffer (ie read)

WARNING #2: rational: JNI spec: "a JVM is required to store ONLY 16 LOCAL REFS AT THE SAME TIME, and may refuse to create more"

Make sure to ckeck out: https://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html

◆ jni_free_android_asset()

int jni_free_android_asset ( )

Close Android Assets

Must be called when done with jni_get_android_asset()

Also, should always check exit status

◆ jni_free_all()

int jni_free_all ( )

Delete JNI global refs on Android