Added __PHYSFS_platformInit() and __PHYSFS_platformDeinit().
authorRyan C. Gordon <icculus@icculus.org>
Sun, 24 Mar 2002 06:36:48 +0000
changeset 130 2deec3eb7430
parent 129 28340d5fe57b
child 131 69b093825303
Added __PHYSFS_platformInit() and __PHYSFS_platformDeinit().
CHANGELOG
physfs.c
physfs_internal.h
platform/unix.c
--- a/CHANGELOG	Thu Mar 21 04:03:38 2002 +0000
+++ b/CHANGELOG	Sun Mar 24 06:36:48 2002 +0000
@@ -70,6 +70,7 @@
            "write" functions to get data from a "const" buffer. Added an
            "extras" dir, which currently contains PhysFS->SDL_RWops glue code.
 03202002 - Patched platform/win32.c to compile.
+03242002 - Added __PHYSFS_platformInit() and __PHYSFS_platformDeinit().
 
 --ryan. (icculus@clutteredmind.org)
 
--- a/physfs.c	Thu Mar 21 04:03:38 2002 +0000
+++ b/physfs.c	Sun Mar 24 06:36:48 2002 +0000
@@ -362,6 +362,7 @@
 
     BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0);
     BAIL_IF_MACRO(argv0 == NULL, ERR_INVALID_ARGUMENT, 0);
+    BAIL_IF_MACRO(!__PHYSFS_platformInit(), NULL, 0);
 
     baseDir = calculateBaseDir(argv0);
     BAIL_IF_MACRO(baseDir == NULL, NULL, 0);
@@ -438,6 +439,7 @@
 int PHYSFS_deinit(void)
 {
     BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0);
+    BAIL_IF_MACRO(!__PHYSFS_platformDeinit(), NULL, 0);
 
     closeFileHandleList(&openWriteList);
     BAIL_IF_MACRO(!PHYSFS_setWriteDir(NULL), ERR_FILES_STILL_OPEN, 0);
--- a/physfs_internal.h	Thu Mar 21 04:03:38 2002 +0000
+++ b/physfs_internal.h	Sun Mar 24 06:36:48 2002 +0000
@@ -319,6 +319,27 @@
  */
 extern const char *__PHYSFS_platformDirSeparator;
 
+
+/*
+ * Initialize the platform. This is called when PHYSFS_init() is called from
+ *  the application. You can use this to (for example) determine what version
+ *  of Windows you're running.
+ *
+ * Return zero if there was a catastrophic failure (which prevents you from
+ *  functioning at all), and non-zero otherwise.
+ */
+int __PHYSFS_platformInit(void);
+
+/*
+ * Deinitialize the platform. This is called when PHYSFS_deinit() is called
+ *  from the application. You can use this to clean up anything you've
+ *  allocated in your platform driver.
+ *
+ * Return zero if there was a catastrophic failure (which prevents you from
+ *  functioning at all), and non-zero otherwise.
+ */
+int __PHYSFS_platformDeinit(void);
+
 /*
  * Platform implementation of PHYSFS_getCdRomDirs()...
  *  See physfs.h. The retval should be freeable via PHYSFS_freeList().
--- a/platform/unix.c	Thu Mar 21 04:03:38 2002 +0000
+++ b/platform/unix.c	Sun Mar 24 06:36:48 2002 +0000
@@ -59,6 +59,19 @@
 const char *__PHYSFS_platformDirSeparator = "/";
 
 
+int __PHYSFS_platformInit(void)
+{
+    return(1);  /* always succeed. */
+} /* __PHYSFS_platformInit */
+
+
+int __PHYSFS_platformDeinit(void)
+{
+    return(1);  /* always succeed. */
+} /* __PHYSFS_platformDeinit */
+
+
+
 #if (defined __DARWIN__)
 
 char **__PHYSFS_platformDetectAvailableCDs(void)