diff --git a/Engine/source/platform/platform.cpp b/Engine/source/platform/platform.cpp index 57032b531..28174a922 100644 --- a/Engine/source/platform/platform.cpp +++ b/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 ) ) diff --git a/Engine/source/platform/platformVolume.cpp b/Engine/source/platform/platformVolume.cpp index 6f3c0ec78..526e5d0a3 100644 --- a/Engine/source/platform/platformVolume.cpp +++ b/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(); diff --git a/Engine/source/platformMac/macCarbFileio.mm b/Engine/source/platformMac/macCarbFileio.mm index 9b95d67fc..ed26ff2ef 100644 --- a/Engine/source/platformMac/macCarbFileio.mm +++ b/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) diff --git a/Engine/source/platformWin32/winFileio.cpp b/Engine/source/platformWin32/winFileio.cpp index 255c8b83a..0d9c7c132 100644 --- a/Engine/source/platformWin32/winFileio.cpp +++ b/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 & diff --git a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp b/Engine/source/platformX86UNIX/x86UNIXFileio.cpp index aed6a1afe..680faf822 100644 --- a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp +++ b/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 @@ -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) diff --git a/Templates/Empty PhysX/source/torqueConfig.h b/Templates/Empty PhysX/source/torqueConfig.h index 1281cc825..7a8a8a44f 100644 --- a/Templates/Empty PhysX/source/torqueConfig.h +++ b/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 diff --git a/Templates/Empty/source/torqueConfig.h b/Templates/Empty/source/torqueConfig.h index 1281cc825..7a8a8a44f 100644 --- a/Templates/Empty/source/torqueConfig.h +++ b/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 diff --git a/Templates/Full PhysX/source/torqueConfig.h b/Templates/Full PhysX/source/torqueConfig.h index 5f56d06a1..1e39f8926 100644 --- a/Templates/Full PhysX/source/torqueConfig.h +++ b/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 diff --git a/Templates/Full/source/torqueConfig.h b/Templates/Full/source/torqueConfig.h index 888f1321e..1bbdc6721 100644 --- a/Templates/Full/source/torqueConfig.h +++ b/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