diff --git a/hedgewars/uScript.pas b/hedgewars/uScript.pas --- a/hedgewars/uScript.pas +++ b/hedgewars/uScript.pas @@ -3478,7 +3478,7 @@ f:= pfsOpenRead(s); if f = nil then exit; -hedgewarsMountPackage(Str2PChar(copy(s, 1, length(s)-4)+'.hwp')); +hedgewarsMountPackage(Str2PChar(copy(s, 2, length(s)-5)+'.hwp')); physfsReaderSetBuffer(@buf); if Pos('Locale/',s) <> 0 then diff --git a/misc/libphysfs/physfs.c b/misc/libphysfs/physfs.c --- a/misc/libphysfs/physfs.c +++ b/misc/libphysfs/physfs.c @@ -1714,14 +1714,19 @@ int PHYSFS_mountHandle(PHYSFS_File *file { int retval = 0; PHYSFS_Io *io = NULL; - +printf("Debug\n"); BAIL_IF_MACRO(file == NULL, PHYSFS_ERR_INVALID_ARGUMENT, 0); +printf("Debug2\n"); io = __PHYSFS_createHandleIo(file); +printf("Debug3\n"); BAIL_IF_MACRO(!io, ERRPASS, 0); +printf("Debug4\n"); retval = doMount(io, fname, mountPoint, appendToPath); +printf("Debug5 %d\n", retval); if (!retval) { +printf("Debug6\n"); /* docs say not to destruct in case of failure, so cheat. */ io->opaque = NULL; io->destroy(io); @@ -2342,6 +2347,8 @@ void PHYSFS_enumerateFilesCallback(const int PHYSFS_exists(const char *fname) { + if (PHYSFS_getRealDir(fname) != NULL) + printf("%s - %s\n",PHYSFS_getRealDir(fname),fname); return (PHYSFS_getRealDir(fname) != NULL); } /* PHYSFS_exists */ diff --git a/misc/libphyslayer/hwpacksmounter.c b/misc/libphyslayer/hwpacksmounter.c --- a/misc/libphyslayer/hwpacksmounter.c +++ b/misc/libphyslayer/hwpacksmounter.c @@ -37,20 +37,43 @@ PHYSFS_DECL void hedgewarsMountPackages( PHYSFS_DECL void hedgewarsMountPackage(char * fileName) { int fileNameLength = strlen(fileName); + int dirLength = 0; + printf("fileName: %s\n",fileName); if (fileNameLength > 4) if (strcmp(fileName + fileNameLength - 4, ".hwp") == 0) { const char * dir = PHYSFS_getRealDir(fileName); if(dir) { - char * fullPath = (char *)malloc(strlen(dir) + fileNameLength + 2); - strcpy(fullPath, dir); - strcat(fullPath, "/"); - strcat(fullPath, fileName); + printf("dir: %s\n",fileName); + dirLength = strlen(dir); + if (dirLength > 4) + { + if (strcmp(dir + dirLength - 4, ".hwp") == 0) + { + printf("attempting handle mount: %s\n",fileName); + PHYSFS_File* physDir = PHYSFS_openRead(fileName); + if (!physDir) printf(PHYSFS_getLastError()); + + PHYSFS_mountHandle(physDir, "XYZZY", NULL, 0); - PHYSFS_mount(fullPath, NULL, 0); +char **i; +for (i = PHYSFS_getSearchPath(); *i != NULL; i++) + printf("[%s] is in the search path.\n", *i); + } + else + { + char * fullPath = (char *)malloc(strlen(dir) + fileNameLength + 2); + strcpy(fullPath, dir); + strcat(fullPath, "/"); + strcat(fullPath, fileName); - free(fullPath); + printf("attempting normal mount: %s\n",fullPath); + PHYSFS_mount(fullPath, NULL, 0); + + free(fullPath); + } + } } } }