35 lines
1.5 KiB
C++
35 lines
1.5 KiB
C++
/* ================================================================
|
|
FIO functionality
|
|
----------------
|
|
fio.cpp/fio.hpp provide functionality for accessing files within RtB. File access is generally assumed to be C-style *FILE.
|
|
|
|
If any file is attempted to be read or written to, fio.hpp should be included first.
|
|
================================================================ */
|
|
#ifndef FIO_HPP
|
|
#define FIO_HPP
|
|
#include <stdio.h>
|
|
#include <string>
|
|
size_t fileToMem(const char *filename, char **buffer);
|
|
/* ======== Asset data access ======== */
|
|
size_t asset_fileToMem(const char *filename, char **buffer);
|
|
FILE *asset_fopen(const char *filename, const char *mode);
|
|
/* ======== Android apk access ======== */
|
|
#ifdef __ANDROID__
|
|
#include <jni.h>
|
|
#include <android/asset_manager.h>
|
|
#include <android/asset_manager_jni.h>
|
|
extern std::string android_app_dir;
|
|
extern std::string android_ext_dir;
|
|
extern "C" AAssetManager* android_asset_manager;
|
|
extern "C" {
|
|
void apk_set_asset_manager(AAssetManager* manager);
|
|
FILE *apk_fopen(const char *filename, const char *mode);
|
|
AAssetDir* apk_openDir(const char *dir);
|
|
JNIEXPORT void JNICALL Java_com_polymathic_RtB_RtB_setAssetManager(JNIEnv* env, jobject obj, jobject assetManager);
|
|
JNIEXPORT void JNICALL Java_com_polymathic_RtB_RtB_setAppDirectory(JNIEnv* env, jobject obj, jstring app_dir);
|
|
JNIEXPORT void JNICALL Java_com_polymathic_RtB_RtB_setExtDirectory(JNIEnv* env, jobject obj, jstring ext_dir);
|
|
AAssetManager *getAAssetManager();
|
|
}
|
|
#endif
|
|
#endif
|