Make wrapping a lua and its sidecar actually work.
--- a/hedgewars/uScript.pas Fri Apr 27 11:19:23 2018 -0400
+++ b/hedgewars/uScript.pas Thu May 17 20:04:07 2018 -0400
@@ -3406,7 +3406,7 @@
if f = nil then
exit;
-hedgewarsMountPackage(Str2PChar(copy(s, 1, length(s)-4)+'.hwp'));
+hedgewarsMountPackage(Str2PChar(copy(s, 3, length(s)-6)+'.hwp'));
physfsReaderSetBuffer(@buf);
if Pos('Locale/',s) <> 0 then
--- a/misc/libphysfs/archiver_zip.c Fri Apr 27 11:19:23 2018 -0400
+++ b/misc/libphysfs/archiver_zip.c Thu May 17 20:04:07 2018 -0400
@@ -468,6 +468,7 @@
finfo->io = zip_get_io(origfinfo->io, NULL, finfo->entry);
GOTO_IF_MACRO(!finfo->io, ERRPASS, failed);
+ initializeZStream(&finfo->stream);
if (finfo->entry->compression_method != COMPMETH_NONE)
{
finfo->buffer = (PHYSFS_uint8 *) allocator.Malloc(ZIP_READBUFSIZE);
--- a/misc/libphyslayer/hwpacksmounter.c Fri Apr 27 11:19:23 2018 -0400
+++ b/misc/libphyslayer/hwpacksmounter.c Thu May 17 20:04:07 2018 -0400
@@ -37,20 +37,37 @@
PHYSFS_DECL void hedgewarsMountPackage(char * fileName)
{
int fileNameLength = strlen(fileName);
+ int dirLength = 0;
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);
+ dirLength = strlen(dir);
+ if (dirLength > 4)
+ {
+ if (strcmp(dir + dirLength - 4, ".hwp") == 0)
+ {
+ char * uniqName = (char *)malloc(strlen(dir) + fileNameLength + 2);
+ strcpy(uniqName, dir);
+ strcat(uniqName, ",");
+ strcat(uniqName, fileName);
+ PHYSFS_mountHandle(PHYSFS_openRead(fileName), uniqName, NULL, 0);
+ free(uniqName);
+ }
+ else
+ {
+ char * fullPath = (char *)malloc(strlen(dir) + fileNameLength + 2);
+ strcpy(fullPath, dir);
+ strcat(fullPath, "/");
+ strcat(fullPath, fileName);
- PHYSFS_mount(fullPath, NULL, 0);
+ PHYSFS_mount(fullPath, NULL, 0);
- free(fullPath);
+ free(fullPath);
+ }
+ }
}
}
}