2020-01-03 20:05:16 +01:00
|
|
|
// Copyright (C) 2012 Joerg Henrichs
|
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
|
|
|
#ifndef __C_ANDROID_ASSET_FILE_ARCHIVE_H_INCLUDED__
|
|
|
|
#define __C_ANDROID_ASSET_FILE_ARCHIVE_H_INCLUDED__
|
|
|
|
|
|
|
|
|
|
|
|
#include "IrrCompileConfig.h"
|
|
|
|
|
|
|
|
#ifdef _IRR_COMPILE_ANDROID_ASSET_READER_
|
|
|
|
|
|
|
|
|
|
|
|
#include "IReadFile.h"
|
|
|
|
#include "IFileArchive.h"
|
|
|
|
#include "CFileList.h"
|
|
|
|
|
|
|
|
#include <android/native_activity.h>
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace io
|
|
|
|
{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Android asset file system written August 2012 by J.Henrichs (later reworked by others).
|
|
|
|
*/
|
|
|
|
class CAndroidAssetFileArchive : public virtual IFileArchive,
|
|
|
|
virtual CFileList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
CAndroidAssetFileArchive(AAssetManager *assetManager, bool ignoreCase, bool ignorePaths);
|
|
|
|
|
|
|
|
//! destructor
|
|
|
|
virtual ~CAndroidAssetFileArchive();
|
|
|
|
|
|
|
|
//! opens a file by file name
|
2023-04-22 23:30:14 +02:00
|
|
|
virtual IReadFile* createAndOpenFile(const io::path& filename) IRR_OVERRIDE;
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! opens a file by index
|
2023-04-22 23:30:14 +02:00
|
|
|
virtual IReadFile* createAndOpenFile(u32 index) IRR_OVERRIDE;
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! returns the list of files
|
2023-04-22 23:30:14 +02:00
|
|
|
virtual const IFileList* getFileList() const IRR_OVERRIDE;
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! get the archive type
|
2023-04-22 23:30:14 +02:00
|
|
|
virtual E_FILE_ARCHIVE_TYPE getType() const IRR_OVERRIDE;
|
2020-01-03 20:05:16 +01:00
|
|
|
|
2021-08-27 21:26:01 +02:00
|
|
|
//! Add a directory to read files from. Since the Android
|
2020-01-03 20:05:16 +01:00
|
|
|
//! API does not return names of directories, they need to
|
|
|
|
//! be added manually.
|
2023-04-22 23:30:14 +02:00
|
|
|
virtual void addDirectoryToFileList(const io::path &filename) IRR_OVERRIDE;
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
//! return the name (id) of the file Archive
|
2021-08-27 21:26:01 +02:00
|
|
|
virtual const io::path& getArchiveName() const IRR_OVERRIDE {return Path;}
|
2020-01-03 20:05:16 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
//! Android's asset manager
|
|
|
|
AAssetManager *AssetManager;
|
|
|
|
|
|
|
|
}; // CAndroidAssetFileArchive
|
|
|
|
|
|
|
|
} // end namespace io
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
#endif // _IRR_COMPILE_ANDROID_ASSET_READER_
|
|
|
|
#endif // __C_ANDROID_ASSET_READER_H_INCLUDED__
|
|
|
|
|