Beispiel #1
0
    //-----------------------------------------------------------------------
	DataStreamPtr ZipArchive::open(const String& filename) const
    {

        // Format not used here (always binary)
        ZZIP_FILE* zzipFile = 
            zzip_file_open(mZzipDir, filename.c_str(), ZZIP_ONLYZIP | ZZIP_CASELESS);
        if (!zzipFile)
		{
            int zerr = zzip_error(mZzipDir);
            String zzDesc = getZzipErrorDescription((zzip_error_t)zerr);
            LogManager::getSingleton().logMessage(
                mName + " - Unable to open file " + filename + ", error was '" + zzDesc + "'");
                
			// return null pointer
			return DataStreamPtr();
		}

		// Get uncompressed size too
		ZZIP_STAT zstat;
		zzip_dir_stat(mZzipDir, filename.c_str(), &zstat, ZZIP_CASEINSENSITIVE);

        // Construct & return stream
        return DataStreamPtr(new ZipDataStream(filename, zzipFile, static_cast<size_t>(zstat.st_size)));

    }
    //-----------------------------------------------------------------------
    DataStreamPtr FileSystemArchive::open(const String& filename, bool readOnly) const
    {
        String full_path = concatenate_path(mName, filename);

        // Use filesystem to determine size
        // (quicker than streaming to the end and back)
        struct stat tagStat;
		stat(full_path.c_str(), &tagStat);

        // Always open in binary mode
        std::ifstream *origStream = OGRE_NEW_T(std::ifstream, MEMCATEGORY_GENERAL)();
        origStream->open(full_path.c_str(), std::ios::in | std::ios::binary);

        // Should check ensure open succeeded, in case fail for some reason.
        if (origStream->fail())
        {
            OGRE_DELETE_T(origStream, basic_ifstream, MEMCATEGORY_GENERAL);
			OGRE_EXCEPT(Ogre::Exception::ERR_FILE_NOT_FOUND,
                "Cannot open file: " + filename,
                "FileSystemArchive::open");
        }

        // Construct return stream, tell it to delete on destroy
        FileStreamDataStream* stream = OGRE_NEW FileStreamDataStream(filename,
            origStream, tagStat.st_size, true);
        return DataStreamPtr(stream);
    }
    DataStreamPtr WriteableFileSystemArchive::open(const String& filename) const
    {
        String full_path = concatenate_path(mName, filename);

        // Use filesystem to determine size 
        // (quicker than streaming to the end and back)
        struct stat tagStat;
	int ret = stat(full_path.c_str(), &tagStat);
        assert(ret == 0 && "Problem getting file size" );

        // Always open in binary mode
        std::fstream *origStream = new std::fstream();
        origStream->open(full_path.c_str(), std::ios::in | std::ios::out | std::ios::binary);

        // Should check ensure open succeeded, in case fail for some reason.
        if (origStream->fail())
        {
            delete origStream;
            OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND,
                "Cannot open file: " + filename,
                "WriteableFileSystemArchive::open");
        }

        /// Construct return stream, tell it to delete on destroy
        WriteableFileStreamDataStream* stream = new WriteableFileStreamDataStream(filename,
            origStream, tagStat.st_size, true);
        return DataStreamPtr(stream);
    }
	//---------------------------------------------------------------------
	DataStreamPtr FileSystemArchive::create(const String& filename) const
	{
		if (isReadOnly())
		{
			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
				"Cannot create a file in a read-only archive", 
				"FileSystemArchive::remove");
		}

		String full_path = concatenate_path(mName, filename);

		// Always open in binary mode
		// Also, always include reading
		std::ios::openmode mode = std::ios::out | std::ios::binary;
		std::fstream* rwStream = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
		rwStream->open(full_path.c_str(), mode);

		// Should check ensure open succeeded, in case fail for some reason.
		if (rwStream->fail())
		{
			OGRE_DELETE_T(rwStream, basic_fstream, MEMCATEGORY_GENERAL);
			OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND,
				"Cannot open file: " + filename,
				"FileSystemArchive::create");
		}

		/// Construct return stream, tell it to delete on destroy
		FileStreamDataStream* stream = OGRE_NEW FileStreamDataStream(filename,
				rwStream, 0, true);

		return DataStreamPtr(stream);
	}
	//---------------------------------------------------------------------
	Ogre::DataStreamPtr UnicodeFileSystemArchive::create(const String& _filename) const
	{
		if (isReadOnly())
		{
			GOTHOGRE_EXCEPT(_filename << " - Cannot create a file in"
				<< " read-only archive " << getName() << ".");
		}

		WString wfullpath = getFullPath(_filename);

		// Always open in binary mode
		// Also, always include reading
		std::ios::openmode mode = std::ios::out | std::ios::binary;
		std::fstream* rwStream = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
		rwStream->open(wfullpath.c_str(), mode);

		// Should check ensure open succeeded, in case fail for some reason.
		if (rwStream->fail())
		{
			OGRE_DELETE_T(rwStream, basic_fstream, MEMCATEGORY_GENERAL);
			GOTHOGRE_EXCEPT(_filename << " - Cannot create file in"
				<< " archive " << getName() << ".");
		}

		GOTHOGRE_INFO(_filename << " - " << "Saving to"
			<< " archive " << getName() << ".");

		/// Construct return stream, tell it to delete on destroy
		FileStreamDataStream* stream = OGRE_NEW FileStreamDataStream(_filename,
				rwStream, 0, true);

		return DataStreamPtr(stream);
	}
Beispiel #6
0
    //-----------------------------------------------------------------------
    DataStreamPtr FileSystemArchive::open(const String& filename) const
    {
#if (_MSC_VER >= 1400)
		//	std::locale langLocale("");
		//	std::locale::global(langLocale);
		setlocale( LC_CTYPE, "" );
#endif
        String full_path = concatenate_path(mName, filename);

        // Use filesystem to determine size 
        // (quicker than streaming to the end and back)
        struct stat tagStat;
	int ret = stat(full_path.c_str(), &tagStat);
        assert(ret == 0 && "Problem getting file size" );

        // Always open in binary mode
        std::ifstream *origStream = OGRE_NEW_T(std::ifstream, MEMCATEGORY_GENERAL)();
        origStream->open(full_path.c_str(), std::ios::in | std::ios::binary);

        // Should check ensure open succeeded, in case fail for some reason.
        if (origStream->fail())
        {
            OGRE_DELETE_T(origStream, basic_ifstream, MEMCATEGORY_GENERAL);
            OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND,
                "Cannot open file: " + filename,
                "FileSystemArchive::open");
        }

        /// Construct return stream, tell it to delete on destroy
        FileStreamDataStream* stream = OGRE_NEW FileStreamDataStream(filename,
            origStream, tagStat.st_size, true);
        return DataStreamPtr(stream);
    }
    //-----------------------------------------------------------------------
    DataStreamPtr FileSystemArchive::open(const String& filename, bool readOnly) const
    {
		String full_path = concatenate_path(mName, filename);

		// Use filesystem to determine size 
		// (quicker than streaming to the end and back)
		struct stat tagStat;
		int ret = stat(full_path.c_str(), &tagStat);
		assert(ret == 0 && "Problem getting file size" );
        (void)ret;  // Silence warning

		// Always open in binary mode
		// Also, always include reading
		std::ios::openmode mode = std::ios::in | std::ios::binary;
		std::istream* baseStream = 0;
		std::ifstream* roStream = 0;
		std::fstream* rwStream = 0;

		if (!readOnly && isReadOnly())
		{
			mode |= std::ios::out;
			rwStream = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
			rwStream->open(full_path.c_str(), mode);
			baseStream = rwStream;
		}
		else
		{
			roStream = OGRE_NEW_T(std::ifstream, MEMCATEGORY_GENERAL)();
			roStream->open(full_path.c_str(), mode);
			baseStream = roStream;
		}


		// Should check ensure open succeeded, in case fail for some reason.
		if (baseStream->fail())
		{
			OGRE_DELETE_T(roStream, basic_ifstream, MEMCATEGORY_GENERAL);
			OGRE_DELETE_T(rwStream, basic_fstream, MEMCATEGORY_GENERAL);
			OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND,
				"Cannot open file: " + filename,
				"FileSystemArchive::open");
		}

		/// Construct return stream, tell it to delete on destroy
		FileStreamDataStream* stream = 0;
		if (rwStream)
		{
			// use the writeable stream 
			stream = OGRE_NEW FileStreamDataStream(filename,
				rwStream, (size_t)tagStat.st_size, true);
		}
		else
		{
			// read-only stream
			stream = OGRE_NEW FileStreamDataStream(filename,
				roStream, (size_t)tagStat.st_size, true);
		}
		return DataStreamPtr(stream);
    }
    //---------------------------------------------------------------------
	void DeflateStream::init()
	{
		mpZStream = OGRE_ALLOC_T(z_stream, 1, MEMCATEGORY_GENERAL);
		mpZStream->zalloc = OgreZalloc;
		mpZStream->zfree = OgreZfree;
		
		if (getAccessMode() == READ)
		{
			mpTmp = (unsigned char*)OGRE_MALLOC(OGRE_DEFLATE_TMP_SIZE, MEMCATEGORY_GENERAL);
			size_t restorePoint = mCompressedStream->tell();
			// read early chunk
			mpZStream->next_in = mpTmp;
			mpZStream->avail_in = mCompressedStream->read(mpTmp, OGRE_DEFLATE_TMP_SIZE);
			
			if (inflateInit(mpZStream) != Z_OK)
			{
				mIsCompressedValid = false;
			}
			else
				mIsCompressedValid = true;
			
			if (mIsCompressedValid)
			{
				// in fact, inflateInit on some implementations doesn't try to read
				// anything. We need to at least read something to test
				Bytef testOut[4];
				size_t savedIn = mpZStream->avail_in;
				mpZStream->avail_out = 4;
				mpZStream->next_out = testOut;
				if (inflate(mpZStream, Z_SYNC_FLUSH) != Z_OK)
					mIsCompressedValid = false;
				// restore for reading
				mpZStream->avail_in = savedIn;
				mpZStream->next_in = mpTmp;

				inflateReset(mpZStream);
			}

			if (!mIsCompressedValid)
			{
				// Not compressed data!
				// Fail gracefully, fall back on reading the underlying stream direct
				destroy();
				mCompressedStream->seek(restorePoint);
			}				
		}
		else 
		{
			// Write to temp file
			char tmpname[L_tmpnam];
			tmpnam(tmpname);
			mTempFileName = tmpname;
			std::fstream *f = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
			f->open(tmpname, std::ios::binary | std::ios::out);
			mTmpWriteStream = DataStreamPtr(OGRE_NEW FileStreamDataStream(f));
			
		}

	}
    //-----------------------------------------------------------------------
    DataStreamPtr ZipArchive::open(const String& filename, bool readOnly)
    {
        // zziplib is not threadsafe
        OGRE_LOCK_AUTO_MUTEX;
        String lookUpFileName = filename;

        // Format not used here (always binary)
        ZZIP_FILE* zzipFile = 
            zzip_file_open(mZzipDir, lookUpFileName.c_str(), ZZIP_ONLYZIP | ZZIP_CASELESS);
        if (!zzipFile) // Try if we find the file
        {
            const Ogre::FileInfoListPtr fileNfo = findFileInfo(lookUpFileName, true);
            if (fileNfo->size() == 1) // If there are more files with the same do not open anyone
            {
                Ogre::FileInfo info = fileNfo->at(0);
                lookUpFileName = info.path + info.basename;
                zzipFile = zzip_file_open(mZzipDir, lookUpFileName.c_str(), ZZIP_ONLYZIP | ZZIP_CASELESS); // When an error happens here we will catch it below
            }
        }

        if (!zzipFile)
        {
            int zerr = zzip_error(mZzipDir);
            String zzDesc = getZzipErrorDescription((zzip_error_t)zerr);
            LogManager::getSingleton().logMessage(
                mName + " - Unable to open file " + lookUpFileName + ", error was '" + zzDesc + "'", LML_CRITICAL);
                
            // return null pointer
            return DataStreamPtr();
        }

        // Get uncompressed size too
        ZZIP_STAT zstat;
        zzip_dir_stat(mZzipDir, lookUpFileName.c_str(), &zstat, ZZIP_CASEINSENSITIVE);

        // Construct & return stream
        return DataStreamPtr(OGRE_NEW ZipDataStream(lookUpFileName, zzipFile, static_cast<size_t>(zstat.st_size)));

    }
Beispiel #10
0
    //-----------------------------------------------------------------------
    DataStreamPtr ZipArchive::open(const String& filename, bool readOnly) const
    {
        // zziplib is not threadsafe
        OGRE_LOCK_AUTO_MUTEX;
        String lookUpFileName = filename;

#if OGRE_RESOURCEMANAGER_STRICT
        const int flags = 0;
#else
        const int flags = ZZIP_CASELESS;
#endif

        // Format not used here (always binary)
        ZZIP_FILE* zzipFile =
            zzip_file_open(mZzipDir, lookUpFileName.c_str(), ZZIP_ONLYZIP | flags);

#if !OGRE_RESOURCEMANAGER_STRICT
        if (!zzipFile) // Try if we find the file
        {
            String basename, path;
            StringUtil::splitFilename(lookUpFileName, basename, path);
            const FileInfoListPtr fileNfo = findFileInfo(basename, true);
            if (fileNfo->size() == 1) // If there are more files with the same do not open anyone
            {
                Ogre::FileInfo info = fileNfo->at(0);
                lookUpFileName = info.path + info.basename;
                zzipFile = zzip_file_open(mZzipDir, lookUpFileName.c_str(), ZZIP_ONLYZIP | flags); // When an error happens here we will catch it below
            }
        }
#endif

        if (!zzipFile)
        {
            int zerr = zzip_error(mZzipDir);
            String zzDesc = getZzipErrorDescription((zzip_error_t)zerr);

            OGRE_EXCEPT(Exception::ERR_FILE_NOT_FOUND,
                    mName+ " Cannot open file: " + lookUpFileName + " - "+zzDesc, "ZipArchive::open");
        }

        // Get uncompressed size too
        ZZIP_STAT zstat;
        zzip_dir_stat(mZzipDir, lookUpFileName.c_str(), &zstat, flags);

        // Construct & return stream
        return DataStreamPtr(OGRE_NEW ZipDataStream(lookUpFileName, zzipFile, static_cast<size_t>(zstat.st_size)));

    }
	DataStreamPtr AndroidArchive::open(const Ogre::String &filename, bool readOnly) const
	{
		DataStreamPtr stream;
		
		size_t i = mFile.findChunk(filename);
		if(i != ACPFile::INVALID_INDEX)
		{
			ACPChunk *chunk = mFile.getChunk(i);
			if(chunk->getCompressed())
				chunk->uncompress();
			
			stream = DataStreamPtr(new MemoryDataStream(chunk->getBuffer(), chunk->getSize(), false, readOnly));
		}
		
		return stream;
	}
Beispiel #12
0
    //---------------------------------------------------------------------
    DataStreamPtr STBIImageCodec::encode(MemoryDataStreamPtr& input, Codec::CodecDataPtr& pData) const
    {
        if(mType != "png") {
            OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
                        "currently only encoding to PNG supported",
                        "STBIImageCodec::encode" ) ;
        }

        ImageData* pImgData = static_cast<ImageData*>(pData.getPointer());
        int channels = PixelUtil::getComponentCount(pImgData->format);

        int len;
        uchar *data = stbi_write_png_to_mem(input->getPtr(), pImgData->width*channels,
                pImgData->width, pImgData->height, channels, &len);

        if (!data) {
            OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR,
                "Error encoding image: " + String(stbi_failure_reason()),
                "STBIImageCodec::encode");
        }

        return DataStreamPtr(new MemoryDataStream(data, len, true));
    }
Pixmap GLXConfigurator::CreateBackdrop(Window rootWindow, int depth) {
	int bpl;
	/* Find out number of bytes per pixel */
	switch(depth) {
	default:
		LogManager::getSingleton().logMessage("GLX backdrop: Unsupported bit depth");
		/* Unsupported bit depth */
		return 0;
	case 15:
	case 16:
		bpl = 2; break;
	case 24:
	case 32:
		bpl = 4; break;
	}
	/* Create background pixmap */
	unsigned char *data = 0; // Must be allocated with malloc

	try {
        String imgType = "png";
        Image img;
        MemoryDataStream *imgStream;
        DataStreamPtr imgStreamPtr;

        // Load backdrop image using OGRE
        imgStream = new MemoryDataStream((void*)GLX_backdrop_data, sizeof(GLX_backdrop_data), false);
        imgStreamPtr = DataStreamPtr(imgStream);
		img.load(imgStreamPtr, imgType);

        PixelBox src = img.getPixelBox(0, 0);

		// Convert and copy image
		data = (unsigned char*)malloc(mWidth * mHeight * bpl); // Must be allocated with malloc

        PixelBox dst(src, bpl == 2 ? PF_B5G6R5 : PF_A8R8G8B8, data );

        PixelUtil::bulkPixelConversion(src, dst);
	} catch(Exception &e) {
		// Could not find image; never mind
		LogManager::getSingleton().logMessage("WARNING: Can not load backdrop for config dialog. " + e.getDescription(), LML_TRIVIAL);
		return 0;
	}

	GC context = XCreateGC (mDisplay, rootWindow, 0, NULL);

	/* put my pixmap data into the client side X image data structure */
	XImage *image = XCreateImage (mDisplay, NULL, depth, ZPixmap, 0,
		(char*)data,
		mWidth, mHeight, 8,
		mWidth*bpl);
#if OGRE_ENDIAN == OGRE_ENDIAN_BIG
	image->byte_order = MSBFirst;
#else
    image->byte_order = LSBFirst;
#endif

	/* tell server to start managing my pixmap */
	Pixmap rv = XCreatePixmap(mDisplay, rootWindow, mWidth,
		mHeight, depth);

	/* copy from client to server */
	XPutImage(mDisplay, rv, context, image, 0, 0, 0, 0,
	 	mWidth, mHeight);

	/* free up the client side pixmap data area */
	XDestroyImage(image); // also cleans data
	XFreeGC(mDisplay, context);

	return rv;
}
Beispiel #14
0
    //---------------------------------------------------------------------
    void DeflateStream::init()
    {
        mZStream = OGRE_ALLOC_T(z_stream, 1, MEMCATEGORY_GENERAL);
        mZStream->zalloc = OgreZalloc;
        mZStream->zfree = OgreZfree;
        
        if (getAccessMode() == READ)
        {
            mTmp = (unsigned char*)OGRE_MALLOC(OGRE_DEFLATE_TMP_SIZE, MEMCATEGORY_GENERAL);
            size_t restorePoint = mCompressedStream->tell();
            // read early chunk
            mZStream->next_in = mTmp;
            mZStream->avail_in = static_cast<uint>(mCompressedStream->read(mTmp, getAvailInForSinglePass()));
            
            if (inflateInit(mZStream) != Z_OK)
            {
                mIsCompressedValid = false;
            }
            else
                mIsCompressedValid = true;
            
            if (mIsCompressedValid)
            {
                // in fact, inflateInit on some implementations doesn't try to read
                // anything. We need to at least read something to test
                Bytef testOut[4];
                size_t savedIn = mZStream->avail_in;
                mZStream->avail_out = 4;
                mZStream->next_out = testOut;
                if (inflate(mZStream, Z_SYNC_FLUSH) != Z_OK)
                    mIsCompressedValid = false;
                // restore for reading
                mZStream->avail_in = static_cast<uint>(savedIn);
                mZStream->next_in = mTmp;

                inflateReset(mZStream);
            }

            if (!mIsCompressedValid)
            {
                // Not compressed data!
                // Fail gracefully, fall back on reading the underlying stream direct
                destroy();
                mCompressedStream->seek(restorePoint);
            }               
        }
        else 
        {
            if(mTempFileName.empty())
            {
                // Write to temp file
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
                char* tmpname = _tempnam(".", "ogre");
                if (!tmpname)
                {
                    // Having no file name here will cause various problems later.
                    OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, "Temporary file name generation failed.", "DeflateStream::init");
                }
                else
                {
                    mTempFileName = tmpname;
                    free(tmpname);
                }
#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
                mTempFileName = macTempFileName();
#else
                char tmpname[] = "/tmp/ogreXXXXXX";
                if (mkstemp(tmpname) == -1)
                    OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, "Temporary file name generation failed.", "DeflateStream::init");

                mTempFileName = tmpname;
#endif
            }

            std::fstream *f = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
            f->open(mTempFileName.c_str(), std::ios::binary | std::ios::out);
            mTmpWriteStream = DataStreamPtr(OGRE_NEW FileStreamDataStream(f));
            
        }

    }
    //-----------------------------------------------------------------------
	Ogre::DataStreamPtr UnicodeFileSystemArchive::open(const String& _filename, bool _readOnly) const
    {
		WString wfullpath = getFullPath(_filename);

		// Use filesystem to determine size 
		// (quicker than streaming to the end and back)
		struct _stat tagStat;
		int ret = _wstat(wfullpath.c_str(), &tagStat);
		if(ret != 0)
		{
			GOTHOGRE_EXCEPT(_filename << " - Problem getting file size"
				<< " (archive " << getName() << ").");
		}

		// Always open in binary mode
		// Also, always include reading
		std::ios::openmode mode = std::ios::in | std::ios::binary;
		std::istream* baseStream = 0;
		std::ifstream* roStream = 0;
		std::fstream* rwStream = 0;

		if (_readOnly)
		{
			roStream = OGRE_NEW_T(std::ifstream, MEMCATEGORY_GENERAL)();
			roStream->open(wfullpath.c_str(), mode);
			baseStream = roStream;
		}
		else
		{
			if (isReadOnly())
			{
				GOTHOGRE_EXCEPT(_filename << " - Cannot open a file for writing in"
					<< " read-only archive " << getName() << ".");
			}
			mode |= std::ios::out;
			rwStream = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
			rwStream->open(wfullpath.c_str(), mode);
			baseStream = rwStream;
		}

		// Should check ensure open succeeded, in case fail for some reason.
		if (baseStream->fail())
		{
			OGRE_DELETE_T(roStream, basic_ifstream, MEMCATEGORY_GENERAL);
			OGRE_DELETE_T(rwStream, basic_fstream, MEMCATEGORY_GENERAL);
			GOTHOGRE_EXCEPT(_filename << " - Cannot open file in"
				<< " archive " << getName() << ".");
		}

		GOTHOGRE_INFO(_filename << " - " << (_readOnly ? "Loading from" : "Saving to")
			<< " archive " << getName() << ".");

		/// Construct return stream, tell it to delete on destroy
		FileStreamDataStream* stream = 0;
		if (rwStream)
		{
			// use the writeable stream 
			stream = OGRE_NEW FileStreamDataStream(_filename,
				rwStream, tagStat.st_size, true);
		}
		else
		{
			// read-only stream
			stream = OGRE_NEW FileStreamDataStream(_filename,
				roStream, tagStat.st_size, true);
		}
		return DataStreamPtr(stream);
    }
Beispiel #16
0
bool ConfigDialog::createWindow ()
{
    // Create the dialog window
    mDialog = gtk_dialog_new_with_buttons (
        "OGRE Engine Setup", NULL, GTK_DIALOG_MODAL,
        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
         NULL);
    mOKButton = gtk_dialog_add_button (GTK_DIALOG (mDialog), GTK_STOCK_OK, GTK_RESPONSE_OK);
    gtk_window_set_position (GTK_WINDOW (mDialog), GTK_WIN_POS_CENTER);
    gtk_window_set_resizable (GTK_WINDOW (mDialog), FALSE);
    gtk_widget_show (GTK_DIALOG (mDialog)->vbox);

    GtkWidget *vbox = gtk_vbox_new (FALSE, 5);
    gtk_widget_show (vbox);
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (mDialog)->vbox), vbox, TRUE, TRUE, 0);

    // Unpack the image and create a GtkImage object from it
    try
    {
        static String imgType ("png");
        Image img;
        MemoryDataStream *imgStream;
        DataStreamPtr imgStreamPtr;

        imgStream = new MemoryDataStream (GLX_backdrop_data, sizeof (GLX_backdrop_data), false);
        imgStreamPtr = DataStreamPtr (imgStream);
        img.load (imgStreamPtr, imgType);

        PixelBox src = img.getPixelBox (0, 0);

        size_t width = img.getWidth ();
        size_t height = img.getHeight ();

        // Convert and copy image -- must be allocated with malloc
        uint8 *data = (uint8 *)malloc (width * height * 4);
        // Keep in mind that PixelBox does not free the data - this is ok
        // as gtk takes pixel data ownership in gdk_pixbuf_new_from_data
        PixelBox dst (src, PF_A8B8G8R8, data);

        PixelUtil::bulkPixelConversion (src, dst);

        GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data (
            (const guchar *)dst.data, GDK_COLORSPACE_RGB,
            true, 8, width, height, width * 4,
            backdrop_destructor, NULL);
        GtkWidget *ogre_logo = gtk_image_new_from_pixbuf (pixbuf);

        gdk_pixbuf_unref (pixbuf);

        gtk_widget_show (ogre_logo);
        gtk_box_pack_start (GTK_BOX (vbox), ogre_logo, FALSE, FALSE, 0);
    }
    catch (Exception &e)
    {
        // Could not decode image; never mind
        LogManager::getSingleton().logMessage("WARNING: Failed to decode Ogre logo image");
    }

    GtkWidget *rs_hbox = gtk_hbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox), rs_hbox, FALSE, TRUE, 0);

    GtkWidget *rs_label = gtk_label_new ("Rendering subsystem:");
    gtk_widget_show (rs_label);
    gtk_box_pack_start (GTK_BOX (rs_hbox), rs_label, TRUE, TRUE, 5);
    gtk_label_set_justify (GTK_LABEL (rs_label), GTK_JUSTIFY_RIGHT);
    gtk_misc_set_alignment (GTK_MISC (rs_label), 1, 0.5);

    GtkWidget *rs_cb = gtk_combo_box_new_text ();
    gtk_widget_show (rs_cb);
    gtk_box_pack_start (GTK_BOX (rs_hbox), rs_cb, TRUE, TRUE, 5);

    g_signal_connect (G_OBJECT (rs_cb), "changed", G_CALLBACK (rendererChanged), this);

    // Add all available renderers to the combo box
    const RenderSystemList &renderers = Root::getSingleton ().getAvailableRenderers ();
    uint idx = 0, sel_renderer_idx = 0;
    for (RenderSystemList::const_iterator r = renderers.begin(); r != renderers.end (); r++, idx++)
    {
        gtk_combo_box_append_text (GTK_COMBO_BOX (rs_cb), (*r)->getName ().c_str ());
        if (mSelectedRenderSystem == *r)
            sel_renderer_idx = idx;
    }
    // Don't show the renderer choice combobox if there's just one renderer
    if (idx > 1)
        gtk_widget_show (rs_hbox);
 
    GtkWidget *ro_frame = gtk_frame_new (NULL);
    gtk_widget_show (ro_frame);
    gtk_box_pack_start (GTK_BOX (vbox), ro_frame, TRUE, TRUE, 0);

    GtkWidget *ro_label = gtk_label_new ("Renderer options:");
    gtk_widget_show (ro_label);
    gtk_frame_set_label_widget (GTK_FRAME (ro_frame), ro_label);
    gtk_label_set_use_markup (GTK_LABEL (ro_label), TRUE);

    mParamTable = gtk_table_new (0, 0, FALSE);
    gtk_widget_show (mParamTable);
    gtk_container_add (GTK_CONTAINER (ro_frame), mParamTable);

    gtk_combo_box_set_active (GTK_COMBO_BOX (rs_cb), sel_renderer_idx);

    return true;
}
	DataStreamPtr APKFileSystemArchive::create(const Ogre::String &filename) const
	{
		return DataStreamPtr();
	}
	DataStreamPtr AndroidArchive::create(const Ogre::String &filename) const
	{
		return DataStreamPtr();
	}