]> git.jsancho.org Git - c-irrlicht.git/commitdiff
IFileSystem and IFileArchive
authorJavier Sancho <jsf@jsancho.org>
Sun, 20 Oct 2019 14:38:29 +0000 (16:38 +0200)
committerJavier Sancho <jsf@jsancho.org>
Sun, 20 Oct 2019 14:38:29 +0000 (16:38 +0200)
Makefile.am
include/IFileArchive.h [new file with mode: 0644]
include/IFileSystem.h [new file with mode: 0644]
include/IrrlichtDevice.h
include/cirrlicht.h
src/IFileSystem.cpp [new file with mode: 0644]
src/IrrlichtDevice.cpp

index b2da572c0de96075d46eaacc14e8ab0967c18200..336eacd32fdfd2841ee3d7ae81a7b566d0ace573 100644 (file)
@@ -3,6 +3,7 @@ lib_LTLIBRARIES = libCIrrlicht.la
 libCIrrlicht_la_SOURCES = \
   src/CIrrlicht.cpp \
   src/IAnimatedMeshSceneNode.cpp \
+  src/IFileSystem.cpp \
   src/IGUIEnvironment.cpp \
   src/IrrlichtDevice.cpp \
   src/ISceneManager.cpp \
@@ -19,6 +20,8 @@ pkginclude_HEADERS = \
   include/IAnimatedMeshMD2.h \
   include/IAnimatedMeshSceneNode.h \
   include/ICameraSceneNode.h \
+  include/IFileArchive.h \
+  include/IFileSystem.h \
   include/IGUIElement.h \
   include/IGUIEnvironment.h \
   include/IGUIStaticText.h \
diff --git a/include/IFileArchive.h b/include/IFileArchive.h
new file mode 100644 (file)
index 0000000..b3bcc2f
--- /dev/null
@@ -0,0 +1,56 @@
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+   Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+   This file is part of c-irrlicht.
+
+   c-irrlicht is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 3 of the
+   License, or (at your option) any later version.
+
+   c-irrlicht is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with guile-irrlicht.  If not, see
+   <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __C_I_FILE_ARCHIVE_H_INCLUDED__
+#define __C_I_FILE_ARCHIVE_H_INCLUDED__
+
+#include <irrlicht/irrTypes.h>
+
+typedef enum
+  {
+   //! A PKZIP archive
+   EFAT_ZIP     = MAKE_IRR_ID('Z','I','P', 0),
+
+   //! A gzip archive
+   EFAT_GZIP    = MAKE_IRR_ID('g','z','i','p'),
+
+   //! A virtual directory
+   EFAT_FOLDER  = MAKE_IRR_ID('f','l','d','r'),
+
+   //! An ID Software PAK archive
+   EFAT_PAK     = MAKE_IRR_ID('P','A','K', 0),
+
+   //! A Nebula Device archive
+   EFAT_NPK     = MAKE_IRR_ID('N','P','K', 0),
+
+   //! A Tape ARchive
+   EFAT_TAR     = MAKE_IRR_ID('T','A','R', 0),
+
+   //! A wad Archive, Quake2, Halflife
+   EFAT_WAD     = MAKE_IRR_ID('W','A','D', 0),
+
+   //! The type of this archive is unknown
+   EFAT_UNKNOWN = MAKE_IRR_ID('u','n','k','n')
+  } irr_io_E_FILE_ARCHIVE_TYPE;
+
+typedef void irr_io_IFileArchive;
+
+#endif
diff --git a/include/IFileSystem.h b/include/IFileSystem.h
new file mode 100644 (file)
index 0000000..7b278d0
--- /dev/null
@@ -0,0 +1,45 @@
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+   Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+   This file is part of c-irrlicht.
+
+   c-irrlicht is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 3 of the
+   License, or (at your option) any later version.
+
+   c-irrlicht is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with guile-irrlicht.  If not, see
+   <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __C_I_FILE_SYSTEM_H_INCLUDED__
+#define __C_I_FILE_SYSTEM_H_INCLUDED__
+
+#include "IFileArchive.h"
+
+typedef void irr_io_IFileSystem;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+  int irr_io_addFileArchive(irr_io_IFileSystem* filesystem,
+                            const char* filename,
+                            int ignoreCase,
+                            int ignorePaths,
+                            irr_io_E_FILE_ARCHIVE_TYPE archiveType,
+                            const char* password,
+                            irr_io_IFileArchive** retArchive);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index df717e759771957e86d4f62605d047eec04fd696..72620c690cdddbdff2d2a4dec587d91fd7b5e9d4 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef __C_IRRLICHT_DEVICE_H_INCLUDED__
 #define __C_IRRLICHT_DEVICE_H_INCLUDED__
 
+#include "IFileSystem.h"
 #include "IGUIEnvironment.h"
 #include "ISceneManager.h"
 #include "IVideoDriver.h"
@@ -32,6 +33,9 @@ typedef void irr_IrrlichtDevice;
 extern "C" {
 #endif
 
+  irr_io_IFileSystem*
+  irr_getFileSystem(irr_IrrlichtDevice* device);
+
   irr_gui_IGUIEnvironment*
   irr_getGUIEnvironment(irr_IrrlichtDevice* device);
 
index a7a46226418e3d318a99d688cc7809fc271c3d7a..3901e083fdf5861cf378a39fe7c62916c89d7601 100644 (file)
@@ -28,6 +28,8 @@
 #include "IAnimatedMeshMD2.h"
 #include "IAnimatedMeshSceneNode.h"
 #include "ICameraSceneNode.h"
+#include "IFileArchive.h"
+#include "IFileSystem.h"
 #include "IGUIEnvironment.h"
 #include "IGUIElement.h"
 #include "IGUIStaticText.h"
diff --git a/src/IFileSystem.cpp b/src/IFileSystem.cpp
new file mode 100644 (file)
index 0000000..1cc7689
--- /dev/null
@@ -0,0 +1,43 @@
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+   Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+   This file is part of c-irrlicht.
+
+   c-irrlicht is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 3 of the
+   License, or (at your option) any later version.
+
+   c-irrlicht is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with guile-irrlicht.  If not, see
+   <http://www.gnu.org/licenses/>.
+*/
+
+#include <irrlicht/irrlicht.h>
+#include "IFileSystem.h"
+
+extern "C" {
+  int irr_io_addFileArchive(irr_io_IFileSystem* filesystem,
+                            const char* filename,
+                            int ignoreCase,
+                            int ignorePaths,
+                            irr_io_E_FILE_ARCHIVE_TYPE archiveType,
+                            const char* password,
+                            irr_io_IFileArchive** retArchive)
+  {
+    return ((irr::io::IFileSystem*)filesystem)
+      ->addFileArchive(filename,
+                       ignoreCase,
+                       ignorePaths,
+                       (irr::io::E_FILE_ARCHIVE_TYPE)archiveType,
+                       password,
+                       (irr::io::IFileArchive**)retArchive);
+  }
+
+}
index b877d256624208b9274cbc80c5a1ee6a1e528a61..98c4afb340ee644ea3be1294fbececc6b1815932 100644 (file)
 #include "IrrlichtDevice.h"
 
 extern "C" {
+  irr_io_IFileSystem*
+  irr_getFileSystem(irr_IrrlichtDevice* device)
+  {
+    return ((irr::IrrlichtDevice*)device)->getFileSystem();
+  }
+
   irr_gui_IGUIEnvironment*
   irr_getGUIEnvironment(irr_IrrlichtDevice* device)
   {