Jump to content

Bug Open File Zip on Lua App Crash.


Yue
 Share

Go to solution Solved by Josh,

Recommended Posts

Strange.

I just uploaded a new update that removes the folder part of the path and uses ChangeDir() before loading the package. Only the editor is updated.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Let's get lower level with this. Please copy your ultra.zip file to your desktop and run this code:

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    WString path = GetPath(PATH_DESKTOP) + "/ultra.zip";

    int errorp = 0;
    auto zipper = zip_open(path.c_str(), ZIP_RDONLY, &errorp);
    if (not zipper)
    {
        Print("Error: Failed to load zip file. Error " + String(errorp));
    }
    else
    {
        Print("OK");
    }

    return 0;
}

 

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

14 minutes ago, Josh said:

Let's get lower level with this. Please copy your ultra.zip file to your desktop and run this code:

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    WString path = GetPath(PATH_DESKTOP) + "/ultra.zip";

    int errorp = 0;
    auto zipper = zip_open(path.c_str(), ZIP_RDONLY, &errorp);
    if (not zipper)
    {
        Print("Error: Failed to load zip file. Error " + String(errorp));
    }
    else
    {
        Print("OK");
    }

    return 0;
}

image.thumb.png.9f3536721b6ee1284e5f3932ae158f69.png

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

Please try this:

#include "UltraEngine.h"

using namespace UltraEngine;

ZIP_EXTERN zip_int64_t
zip_source_make_command_bitmap2(zip_source_cmd_t cmd0, ...) {
    zip_int64_t bitmap;
    va_list ap;

    bitmap = ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd0);
    
    va_start(ap, cmd0);
    for (;;) {
        int cmd = va_arg(ap, int);
        if (cmd < 0) {
            break;
        }
        bitmap |= ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd);
    }
    va_end(ap);

    return bitmap;
}

int main(int argc, const char* argv[])
{
    /*WString path = GetPath(PATH_DESKTOP) + "/ultra.zip";
    int errorp = 0;
    auto zipper = zip_open(path.c_str(), ZIP_RDONLY, &errorp);
    if (not zipper)
    {
        Print("Error: Failed to load zip file. Error " + String(errorp));
    }
    else
    {
        Print("OK");
    }*/

    Print("1");

    zip_source_make_command_bitmap2(ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, ZIP_SOURCE_SUPPORTS_REOPEN, -1);
    Print("2");

    zip_source_make_command_bitmap(ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, ZIP_SOURCE_SUPPORTS_REOPEN, -1);
    Print("3");

    return 0;
}

 

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Okay, those two functions are the exact same code. I suspect there is some preprocessor define that doesn't match in the main project and in the static lib. I will try compiling libzip straight into the Ultra source code instead of as a separate static lib.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

In the current build, libzip was compiled into the engine from source, not as a static lib. @Yue Please let me know the result when you use the editor with a project that contains a zip file.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

The editor loads already in the lua script project even if the zip file is in the root directory, and the console confirms that the zip file is loaded, both in Ultra Engine Pro and Ultra Engine Lua.

image.thumb.png.a35aef34a0f851f1b54580410d4c006a.png

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

So is the editor working correctly? Can you browse through the contents of the zip file and load files from inside it?

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

image.thumb.png.364e3c613bcdd6e6257737605f2f4316.png

 

 Yes, in the editor it works correctly, before if I had the zip file in the root directory of the project it did not load the editor. By clicking on the zip file I have access to the content of the Ultra.zip file.

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

2 minutes ago, Josh said:

What about C++?

image.thumb.png.98619a4628856bfc1829379912fbd5a5.png

 

Run Perfect. 

Note: When the editor is started with Zip files in the root directory, these files cannot be deleted, as they are being used by the editor.

  • Like 1

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...