Windows Unzip issues

boi513

Member
I have code that unzips a file and stores png files in a folder. I also have 2 files to be extracted. 1 file works fine. The second will not extract. Both only contain .png files.
I tried using tiny png to make the files smaller because i remember reading that game maker poops itself if your png files are some how wrong. this did not help.
The attached files are from the two zipped files. the fire ball icon unzips. the other does not.

GML:
function unzip_parts() {
    var p_file_name
    
    p_file_name = file_find_first( "assets/*.prt", 0)

    if ( p_file_name != "" ){     //make sure p_file_name is not empty
    var num = zip_unzip("assets/" + p_file_name, "images/");
    if num <= 0{
       show_debug_message("Extraction Failed!");
       }
    }

    p_file_name = file_find_next()
    if ( p_file_name != "" )
    {var num = zip_unzip("assets/" + p_file_name,"images/*");
    if num <= 0
       {
       show_debug_message("Extraction Failed!");
       }
    }


}
 

Attachments

TsukaYuriko

☄️
Forum Staff
Moderator
Verify that the second unzip actually runs.

What is the console output when you run this code?

Also, what is that asterisk doing in the second extract path? (var num = zip_unzip("assets/" + p_file_name,"images/*");)
 

boi513

Member
Console output is below.

Run game
Options: Z:/Infinite_R_7E12E1CC_5BD9FE3\MainOptions.json
[Debugger]target=127.0.0.1,yydebug="Y:/Infinite_Road_55167ECD_VM\Infinite Road.yydebug"
X://windows/Runner.exe -game "Y:/Infinite_Road_55167ECD_VM\Infinite Road.win"
Attempting to set gamepadcount to 12
DirectX11: Using hardware device
Start debug server
Creating Debugger server port:6509
[DbgServer]6509
Collision Event time(microsecs)=19
Waiting for debugger to connect...
Client(-1) Connected: 127.0.0.1
Debugger connected
500 code buffers added (19426)
Unable to open Y:\Infinite_Road_55167ECD_VM\assets\Human.prt for decompression
Extraction Failed!
Total memory used = 12362220(0x00bca1ec) bytes

As for the asterisk, I typed this code while reading the manual and it was long enough ago that I just dont know anymore and it has not caused me any problems. . . yet
 

TsukaYuriko

☄️
Forum Staff
Moderator
Does removing the asterisk make a difference?

Does the code work as expected with a different file, then? For example, a copy of the file that works, but with a different name?
 

boi513

Member
Removing the asterisk does not make a difference.

I have also tried changing the file names like you stated and that too did not change anything. This is why I think it could be a mysterious difference between the two attached png files.
 

TsukaYuriko

☄️
Forum Staff
Moderator
I didn't suggest changing the file name of the file that doesn't work, but to test whether removing the file that doesn't work and making a copy of the file that does work... works. This is intended to check whether it is actually the file itself that is causing issues or the code that's processing it.

Alternatively, re-save and re-zip both of the files in question. Don't go out of your way to compress them, as obscure compression will be more likely to be unreadable by GM. When saved the same way, this should either make both of them work or make both of them not work.
 

boi513

Member
I see. I used 7zip to extract and recompress the file that was working and now it too does not work.

Is there something I can do about this?
 

TsukaYuriko

☄️
Forum Staff
Moderator
What is the actual format you're compressing these files as? I see in your code that you rename them to .prt, but what is the original compression format? zip? 7z? rar? tar.gz? GameMaker supports zip, and only that.

If you're already using zip compression, try changing the compression settings. Chances are the specific method of compression you're using (and by that I mean more than just the file type) isn't supported.
 

boi513

Member
i use a program called 7 zip. I have no idea about the compression details. didnt know it mattered. I can check when I get home from work. Any suggestions in the mean time?
 

TsukaYuriko

☄️
Forum Staff
Moderator
Then you're likely using the 7z format when you should be using the zip format. Not much more to say about that. One is supported, the other isn't.
 
Top