Pandemic in Persia
- atrueprincefanfrom18
- Site Shah
- Posts: 1786
- Joined: January 21st, 2020, 2:53 pm
- Contact:
Re: Pandemic in Persia - In Progress
YURA, are you getting the ZIP file and all the contents inside it correctly from PoPOT?
Re: Pandemic in Persia - In Progress
The author! This is the final result of the mod.... or will there be alterations again?
- atrueprincefanfrom18
- Site Shah
- Posts: 1786
- Joined: January 21st, 2020, 2:53 pm
- Contact:
Re: Pandemic in Persia - In Progress
The previous creation was perfect too, but as you and SuavePrince said, "it needs luck", so I altered it. I think it's done now, no more alterations in that level.
So, no. No more. Go ahead and play it
Re: Pandemic in Persia - In Progress
Thanks! Make a link to the final version of the mod....atrueprincefanfrom18 wrote: ↑February 26th, 2021, 6:13 pmThe previous creation was perfect too, but as you and SuavePrince said, "it needs luck", so I altered it. I think it's done now, no more alterations in that level.
So, no. No more. Go ahead and play it
- atrueprincefanfrom18
- Site Shah
- Posts: 1786
- Joined: January 21st, 2020, 2:53 pm
- Contact:
Re: Pandemic in Persia - In Progress
This post. Download from attachment if PoPOT ZIP file is not showing any contents.YURA wrote: ↑February 26th, 2021, 8:38 pmThanks! Make a link to the final version of the mod....atrueprincefanfrom18 wrote: ↑February 26th, 2021, 6:13 pmThe previous creation was perfect too, but as you and SuavePrince said, "it needs luck", so I altered it. I think it's done now, no more alterations in that level.
So, no. No more. Go ahead and play it
Re: Pandemic in Persia - In Progress
This is what I see in the ZIP from PoPOT:atrueprincefanfrom18 wrote: ↑February 26th, 2021, 6:04 pm are you getting the ZIP file and all the contents inside it correctly from PoPOT?
• Directly inside the ZIP is a folder called "0000236".
• Inside that, there are two folders, called "0000236" and "UpdatedPandemicInPersia".
• Both contain a full copy of the mod.
I see the same with the ZIP browser built into Windows 10, with Total Commander, and with 7-Zip.
What do you use to open ZIP files?
In 7-Zip, I see some differences between your attached UpdatedPandemicInPersia.zip and PoPOT's 0000236.zip:
0000236.zip
• The compression method is Deflate:Maximum.
• File permissions are -rw-rw-rw-.
• The directories have no modified date, attributes, method, characteristics, host OS, version, volume index, offset.
• The files have no characteristics.
UpdatedPandemicInPersia.zip
• The compression method is Deflate.
• File permissions are -rw-------.
• The single directory has modified date, attributes, method, characteristics, host OS, version, volume index, offset.
• The files have characteristics "UT 0x7875 : Descriptor". I don't know what that means.
Additionally, in 0000236.zip there are no separate entries for the directories, only for the contained files!
This might be why it you can't extract its contents.
The ZIP extractor you use might expect the directories to have separate entries.
Re: Pandemic in Persia - In Progress
I have looked into the source of PoPOT to see why this could be.
I see it doesn't just put the uploaded ZIP unchanged into the downloads.
Instead it extracts the ZIP and makes a new ZIP from the extracted files.
The new ZIP file is created by submit.php, by this code:
Code: Select all
$zip = new ZipArchive();
$zip->open ($sZipFile, ZipArchive::CREATE|ZipArchive::OVERWRITE);
$files = new RecursiveIteratorIterator
(new RecursiveDirectoryIterator ($sZipPath),
RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($files as $name => $file)
{
if (is_dir ($file) === FALSE)
{
$filePath = $file->getRealPath();
$relativePath = substr ($filePath, strlen ($sZipPath) + 1);
$zip->addFile ($filePath, $relativePath);
}
}
$zip->close();
• Change the LEAVES_ONLY option to SELF_FIRST, so directories are not skipped.
• Call addEmptyDir for directories, on an else branch.
If you look through the comments on the addFile page, some user examples show that they add the directory before the contained files.
The other question is, why is the mod in there twice?
The code does the following:
• Creates /tmp/0000236-tmp/ if it does not yet exist.
• Creates /tmp/0000236-tmp/0000236/ if it does not yet exist.
• Extracts the uploaded ZIP into /tmp/0000236-tmp/0000236/ .
• If there is only one thing in /tmp/0000236-tmp/0000236/ and it's a directory, then renames that directory to 0000236 .
In our case, /tmp/0000236-tmp/0000236/UpdatedPandemicInPersia/ is renamed to /tmp/0000236-tmp/0000236/0000236/ .
• Then the contents of /tmp/0000236-tmp/0000236/ are zipped.
But what happens if someone updates the same mod again, and the temp files are not deleted between the two updates?
The first three steps are the same:
• Creates /tmp/0000236-tmp/ if it does not yet exist.
• Creates /tmp/0000236-tmp/0000236/ if it does not yet exist.
• Extracts the uploaded ZIP into /tmp/0000236-tmp/0000236/ .
• But now there are *two* things in /tmp/0000236-tmp/0000236/ -- the freshly extracted UpdatedPandemicInPersia directory *and* the 0000236 directory from the previous go!
This is how they ended up in the ZIP!
At this part:
Code: Select all
$sZipTmp = '/tmp/' . $sModCode . '-tmp';
$sZipTmpF = $sZipTmp . '/' . $sModCode;
if (file_exists ($sZipTmp) === FALSE)
{
if (mkdir ($sZipTmp, 0775) === FALSE)
{ $sError = 'Cannot create "' . $sZipTmp . '".'; }
}
- atrueprincefanfrom18
- Site Shah
- Posts: 1786
- Joined: January 21st, 2020, 2:53 pm
- Contact:
Re: Pandemic in Persia - In Progress
I just use my default extractor for Ubuntu and I tried to first extract it and waited. It didn't do anything! No message, no alert, no notification.
Then I thought maybe my computer or PoPOT has some issues... So I tried creating another file good for uploading (removing apoplexy.bat, apoplexy.sh, LEVELS.BAK, QUICKSAVE.SAV and PRINCE.SAV) and gave it another name. Still after downloading, I couldn't extract it (and see the contents). I tried running this code:
Code: Select all
import requests
url = "https://www.popot.org/custom_levels/software/0000236.zip"
r = requests.get(url, stream = True)
print(r.content)
Is there any way I can fix this issue on my computer? (I tried writing the file on disk with Python (above code), but it didn't work.)
Maybe because it's downloaded from different sources (servers)? PoPOT and/or the forum's code might be modifying some permissions or something?
Re: Pandemic in Persia - In Progress
If you use the extractor from the GUI, try running it from the command line instead.atrueprincefanfrom18 wrote: ↑February 28th, 2021, 4:40 am I just use my default extractor for Ubuntu and I tried to first extract it and waited. It didn't do anything! No message, no alert, no notification.
(I think it's called file-roller.)
It might write some error message to the console, explaining why it doesn't do anything.
You could download the file manually and then open it in a hex editor to see the same.atrueprincefanfrom18 wrote: ↑February 28th, 2021, 4:40 am I tried running this code:
It printed out binary content along with file names.Code: Select all
import requests url = "https://www.popot.org/custom_levels/software/0000236.zip" r = requests.get(url, stream = True) print(r.content)
What do you mean by "didn't work"?atrueprincefanfrom18 wrote: ↑February 28th, 2021, 4:40 am (I tried writing the file on disk with Python (above code), but it didn't work.)
Did it create no file, or did it create an empty file (0 bytes)?
Or did it create a file with a size of about 675 kB, whose contents you can't extract?
You could try using a different ZIP extractor.atrueprincefanfrom18 wrote: ↑February 28th, 2021, 4:40 am Is there any way I can fix this issue on my computer?
As I wrote in my previous post, PoPOT extracts the ZIP you upload to it, and it creates a new ZIP from the contents.atrueprincefanfrom18 wrote: ↑February 28th, 2021, 4:40 am Maybe because it's downloaded from different sources (servers)? PoPOT and/or the forum's code might be modifying some permissions or something?
The main point is that PoPOT's ZIP does not contain separate entries for the directories.
(That's why the directories don't have dates, attributes, etc. in the ZIP from PoPOT.)
For example, the first entry in 0000236.zip is "0000236/0000236/LEVELS.DAT".
There is no separate entry for "0000236/0000236/" or "0000236/".
Try downloading the mod with the previous number: https://www.popot.org/custom_levels.php?mod=0000235
And also the mod with the next number: https://www.popot.org/custom_levels.php?mod=0000237
0000235.zip has an entry for the directory, the first entry is "0000235/".
0000237.zip has no entry for the directory, the first entry is "0000237/CDUNGEON.DAT".
Please try this and tell me whether you can extract these ZIPs.
Re: Pandemic in Persia - In Progress
Hi, going by what David writes (thanks for the info!), apparently the PoPOT code needs improvement.
I'll look into this today. Hopefully I'll understand what code modifications are necessary.
I'll look into this today. Hopefully I'll understand what code modifications are necessary.
Re: Pandemic in Persia - In Progress
Should be fixed now.
The attached diff image shows my solution.
Re: Pandemic in Persia - In Progress
hello everyone! The author! Tell me what MOD you can play in 236 or another...there are 2 games!? Or rename the game as 1 and 2
- atrueprincefanfrom18
- Site Shah
- Posts: 1786
- Joined: January 21st, 2020, 2:53 pm
- Contact:
Re: Pandemic in Persia - In Progress
Download from this post. Get the attachment instead of PoPOT.