Feature Suggesion? Remove zip from the file system

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Catprog
Posts: 164
Joined: Wed Jan 31, 2007 9:07 am
Contact:

Feature Suggesion? Remove zip from the file system

Post by Catprog »

I have an idea for a feature.

Currently you can add zip,pak and folders to the file system.

How about adding a way to remove them.

I would try it out but It won't compile (I don't have the direct 8 SDK)

Probably something like this.

Blue new pseudo-code

CFileSystem.cpp:

Code: Select all

bool CFileSystem::addZipFileArchive(const c8* filename, bool ignoreCase, bool ignorePaths)
{
	IReadFile* file = createReadFile(filename);
	if (file)
	{
		CZipReader* zr = new CZipReader(file, ignoreCase, ignorePaths);

		
		if (zr)
			ZipFileSystems.push_back(zr);

			[color=blue]Store the index of zr and the filename here[/color]

rest of method
}

[color=blue]CFileSystem::removeZipFileArchive(const c8* filename, bool ignoreCase, bool ignorePaths) { find the index of the zip archive in  ZipFileSystems  and remove it } [/color]
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

To compile Irrlicht without Direct3D8, comment out the #define _IRR_COMPILE_WITH_DIRECT3D_8_ in IrrCompileConfig.h
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
JPulham
Posts: 320
Joined: Sat Nov 19, 2005 12:06 pm

Post by JPulham »

This would be more useful. Considering if a 'level' consists of a zip containing models and a texture directory there may be ambiguity between levels(assuming the same textures would be used across several related levels), resulting in conflicts/errors. Although it isn't a major problem it would be nice :D
pushpork
Catprog
Posts: 164
Joined: Wed Jan 31, 2007 9:07 am
Contact:

Post by Catprog »

Code: Select all

void CFileSystem::removeAllZipFileArchive(){
	ZipFileSystems.clear() ;
}

the problem is

TerrainRendering.exe has triggered a breakpoint

on this line

Code: Select all

Device->getFileSystem()->removeAllZipFileArchive();
Any ideas

EDIT:



Ran again and it gave me the line in the dll

Code: Select all

_IRR_DEBUG_BREAK_IF(index>=used || count<1 || index+count>used)
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

Maybe a feature like specifying where to check for the file first would be good. Like, you open Zip1 and Zip2, and they both contain data\TheTex.jpg, and you address it like data\TheTex.jpg@Zip1.zip, or something like that. Or just adding a function to switch the top-priority source, like FS->setTopPrio("default") (to unselect zip's) or FS->setTopPrio("Zip1"). sortof.
If you don't have anything nice to say, don't say anything at all.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

i think using zip files as folders would be the best idea, so it's file.zip/tex.png.
also, an interface for any kind of custom folders including pak/zip would be nice too. then we can just have addArchive, removeArchive, and addArchiveLoader to add external types.
not really very high up on the development priorities though i'm afraid. perhaps one of you guys would like to attempt it?
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

Heh, make a site somewhere with things you'd like others(who has spare time) to do. :)
If you don't have anything nice to say, don't say anything at all.
JPulham
Posts: 320
Joined: Sat Nov 19, 2005 12:06 pm

Post by JPulham »

I already implemented this for a game. I added a u32 pointer parameter that returned the index of the zip file in the list. Its by no means a full system, but it works for now... :?
we need to decide the best way to remove the system. Maybe map file names to 'zip files' and remove them by name rather than index.
Also... a system to shut down any read files that are accessing the system first, before deallocating memory.

Basically, it needs some thought and work to get it working perfectly. :D
pushpork
Post Reply