In order to keep the space down, I thought I would archive my meshes together with their textures into a tar.gz, embed that into the program, and then just point the archive reader to that spot in memory.
Creating a file pointer from the memory is easy:
- Code: Select all
IFileSystem* fs = m_device->getFileSystem();
IReadFile* file = fs->createMemoryReadFile(&resources::axes_tar_gz, resources::axes_tar_gz_len, "axes.tar.gz", false);
But there doesn't seem to be an interface to actually read the archive file after that. There only seems to be one function to do that:
- Code: Select all
IFileSystem::addFileArchive (const path &filename, bool ignoreCase=true, bool ignorePaths=true, E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN, const core::stringc &password="")
I gave figured I would give it a try and started by checking to see if the file system could find the file I added.
- Code: Select all
if(fs->existFile("axes.tar.gz"))
std::cout << "Irrlicht file system seems to see axes.tar.gz" << std::endl;
else
std::cout << "Irrlicht file system can't find axes.tar.gz" << std::endl;
existFile returns false (i.e "Irrlicht file system can't find axes.tar.gz"). I also tried calling
- Code: Select all
fs->setFileListSystem(irr::io::FILESYSTEM_VIRTUAL);
But the result was unchanged.
Is there any way to do what I want, or is this a feature that has not been implemented, and will require a lot of work to fix. I don't mind patching the source if I have to, but I'd prefer going the easy way. So here are the questions:
1. When a memory file is loaded, is it added to the virtual file system?
2. If not, is there a way to manually add it to the file system?
3. If not, how difficult will it be do add that functionality (and where will the modifications need to be? CFileSystem.cpp?
4. If it's too difficult, is there a way to retrieve an IArchiveLoader by EArchiveType? The IArchiveLoader interface seems to be able to read from an IReadFile* so if I can get a pointer to the right IArchiveLoader, then that should provide me with what I need, because I can use the IArchiveLoader directly.
