Forráskód Böngészése

Bug fixes for alternative zip layout and define to toggle it on

Tim Newell 12 éve
szülő
commit
31036c4031

+ 5 - 2
Engine/source/platform/platform.cpp

@@ -29,6 +29,7 @@
 #include "app/mainLoop.h"
 #include "platform/input/event.h"
 #include "platform/typetraits.h"
+#include "core/volume.h"
 
 
 const F32 TypeTraits< F32 >::MIN = - F32_MAX;
@@ -132,8 +133,10 @@ const bool Platform::KeyboardInputExclusion::checkAgainstInput( const InputEvent
 S32 Platform::compareModifiedTimes( const char *firstPath, const char *secondPath )
 {
    FileTime firstModTime;
-   if ( !getFileTimes( firstPath, NULL, &firstModTime ) )
-      return -1;
+   if ( !getFileTimes( firstPath, NULL, &firstModTime ) ) {
+      //The reason we failed to get file times could be cause it is in a zip.  Lets check.
+      return Torque::FS::CompareModifiedTimes(firstPath, secondPath);
+   }
 
    FileTime secondModTime;
    if ( !getFileTimes( secondPath, NULL, &secondModTime ) )

+ 4 - 0
Engine/source/platform/platformVolume.cpp

@@ -70,7 +70,11 @@ bool MountZips(const String &root)
    for(S32 i = 0;i < outList.size();++i)
    {
       String &zipfile = outList[i];
+#ifdef TORQUE_ZIP_DISK_LAYOUT
+      mounted += (S32)Mount(root, new ZipFileSystem(zipfile, false));
+#else 
       mounted += (S32)Mount(root, new ZipFileSystem(zipfile, true));
+#endif
    }
 
    return mounted == outList.size();

+ 6 - 1
Engine/source/platformMac/macCarbFileio.mm

@@ -49,6 +49,8 @@
 #include "platform/profiler.h"
 #include "cinterface/cinterface.h";
 
+#include "core/volume.h"
+
 //TODO: file io still needs some work...
 
 #define MAX_MAC_PATH_LONG     2048
@@ -634,7 +636,10 @@ bool Platform::isFile(const char *path)
    // make sure we can stat the file
    struct stat statData;
    if( stat(path, &statData) < 0 )
-      return false;
+   {
+      // Since file does not exist on disk see if it exists in a zip file loaded
+      return Torque::FS::IsFile(path);
+   }
    
    // now see if it's a regular file
    if( (statData.st_mode & S_IFMT) == S_IFREG)

+ 6 - 1
Engine/source/platformWin32/winFileio.cpp

@@ -29,6 +29,7 @@
 #include "core/strings/unicode.h"
 #include "util/tempAlloc.h"
 #include "core/util/safeDelete.h"
+#include "core/volume.h"
 
 // Microsoft VC++ has this POSIX header in the wrong directory
 #if defined(TORQUE_COMPILER_VISUALC)
@@ -946,7 +947,11 @@ bool Platform::isFile(const char *pFilePath)
    FindClose(handle);
 
    if(handle == INVALID_HANDLE_VALUE)
-      return false;
+   {
+    
+      // Since file does not exist on disk see if it exists in a zip file loaded
+      return Torque::FS::IsFile(pFilePath);
+   }
 
    // if the file is a Directory, Offline, System or Temporary then FALSE
    if (findData.dwFileAttributes &

+ 5 - 1
Engine/source/platformX86UNIX/x86UNIXFileio.cpp

@@ -56,6 +56,7 @@
  #include "core/strings/stringFunctions.h"
  #include "util/tempAlloc.h"
  #include "cinterface/cinterface.h"
+ #include "core/volume.h"
 
  #if defined(__FreeBSD__)
     #include <sys/types.h>
@@ -980,7 +981,10 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
     // Get file info
     struct stat fStat;
     if (stat(pFilePath, &fStat) < 0)
-       return false;
+    {
+       // Since file does not exist on disk see if it exists in a zip file loaded
+       return Torque::FS::IsFile(pFilePath);
+    }
 
     // if the file is a "regular file" then true
     if ( (fStat.st_mode & S_IFMT) == S_IFREG)

+ 5 - 0
Templates/Empty PhysX/source/torqueConfig.h

@@ -73,6 +73,11 @@
 /// the root of the path.  Requires the virtual mount system to be active.
 //#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
 
+//Uncomment this define if you want to use the alternative zip support where you can 
+//define your directories and files inside the zip just like you would on disk
+//instead of the default zip support that treats the zip as an extra directory.
+//#define TORQUE_ZIP_DISK_LAYOUT
+
 /// Define me if you don't want Torque to compile dso's
 #define TORQUE_NO_DSO_GENERATION
 

+ 5 - 0
Templates/Empty/source/torqueConfig.h

@@ -73,6 +73,11 @@
 /// the root of the path.  Requires the virtual mount system to be active.
 //#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
 
+//Uncomment this define if you want to use the alternative zip support where you can 
+//define your directories and files inside the zip just like you would on disk
+//instead of the default zip support that treats the zip as an extra directory.
+//#define TORQUE_ZIP_DISK_LAYOUT
+
 /// Define me if you don't want Torque to compile dso's
 #define TORQUE_NO_DSO_GENERATION
 

+ 5 - 0
Templates/Full PhysX/source/torqueConfig.h

@@ -73,6 +73,11 @@
 /// the root of the path.  Requires the virtual mount system to be active.
 //#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
 
+//Uncomment this define if you want to use the alternative zip support where you can 
+//define your directories and files inside the zip just like you would on disk
+//instead of the default zip support that treats the zip as an extra directory.
+//#define TORQUE_ZIP_DISK_LAYOUT
+
 /// Define me if you don't want Torque to compile dso's
 #define TORQUE_NO_DSO_GENERATION
 

+ 5 - 0
Templates/Full/source/torqueConfig.h

@@ -73,6 +73,11 @@
 /// the root of the path.  Requires the virtual mount system to be active.
 //#define TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
 
+//Uncomment this define if you want to use the alternative zip support where you can 
+//define your directories and files inside the zip just like you would on disk
+//instead of the default zip support that treats the zip as an extra directory.
+//#define TORQUE_ZIP_DISK_LAYOUT
+
 /// Define me if you don't want Torque to compile dso's
 #define TORQUE_NO_DSO_GENERATION