如何从原生code Android的扩展文件的文件数据 [英] How to get file data from Android expansion file in native code

查看:299
本文介绍了如何从原生code Android的扩展文件的文件数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用Android NDK的安卓游戏。

I am developing an Android game using the Android NDK.

对于所有应用体重超过50MB,扩展文件是必要的。我已经实现了扩展文件的下载并检查它的存在。我现在需要从.obb文件中的文件中读取。我该怎么做这在本机(C ++)的一面?

As for all apps weighing over 50mb, an expansion file is necessary. I have implemented the downloading of the expansion file and checking that it exists. I now need to read from a file within the .obb file. How do I do this on the native (C++) side?

推荐答案

看看<机器人/ storage_manager.h> - 有用于安装,卸载的功能,让你的OBB文件的路径:

Check out <android/storage_manager.h> - there are functions for mounting, unmounting, and getting the path of your obb file:

/**
 * Attempts to mount an OBB file. This is an asynchronous operation.
 */
void AStorageManager_mountObb(AStorageManager* mgr, const char* filename, const char* key,
    AStorageManager_obbCallbackFunc cb, void* data);

/**
 * Attempts to unmount an OBB file. This is an asynchronous operation.
 */
void AStorageManager_unmountObb(AStorageManager* mgr, const char* filename, const int force,
    AStorageManager_obbCallbackFunc cb, void* data);

/**
 * Check whether an OBB is mounted.
 */
int AStorageManager_isObbMounted(AStorageManager* mgr, const char* filename);

/**
 * Get the mounted path for an OBB.
 */
const char* AStorageManager_getMountedObbPath(AStorageManager* mgr, const char* filename);

然后,你应该能够对文件进行操作,你通常会。

Then you should be able to manipulate files as you normally would.

这篇关于如何从原生code Android的扩展文件的文件数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆