Binary Data Plugin

0 favourites
  • 6 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • Just a quick question, as I've failed to find much online to help point me in the right direction...

    My goal is to:

    - load a Binary Data object with specific values from an external binary file

    - see them displayed as HEX using a text object tp verify they're correct

    - write them to a new external binary file

    What is the best approach to accomplishing this? I've noticed that simply including the source bin as a project file, requesting it through AJAX, saving it to the Binary Data buffer (UTF-8 Text seems to be the only option?), loading it into a text object (I've made my own decimal to hex conversion function) appears to function as expected, however, when I then try to write the binary data to a new file externally using AJAX, my file nearly doubles in size...

    What am I missing here?

    Thanks in advance!

    (Ideally I'd like to be able to write the bytes directly into the Binary Data object using either %00000000 Binary or #FF Hex... I don't suppose this is coming down the pipe any time soon is it?)

  • Looks like you can't load a file as binary with the AJAX plugin, only text. You have to use javascript to do it yourself: request the file as a blob, convert blob to dataUrl, and finally extract the base64 from that. Then you can load that into the binary plugin.

    At least you can save a binary file with the browser invoke download action with BinaryData.GetURL.

    Converting to a from a hex value is fairly straightforward so I added some functions. Doing similar things for 8bit binary values should be fairly straightforward too.

    dropbox.com/s/sfy2n75oo9s5dq7/binary_save_load.c3p

  • Looks like you can't load a file as binary with the AJAX plugin, only text

    No, this is possible in C3. You request a file with AJAX and then set response binary to BinaryData object.

  • Ah, cool, didn't notice that. Things really are all over the place. On the plus side I now know how to do one more thing without construct.

  • > Looks like you can't load a file as binary with the AJAX plugin, only text

    No, this is possible in C3. You request a file with AJAX and then set response binary to BinaryData object.

    AWESOME!!! This is EXACTLY what I needed!! Thank you!! I can now:

    - load a binary file

    - pass it into an array as uint8

    - convert the uint8 values into HEX/Binary as needed for editing

    - edit said values at whichever addresses I need to

    - store them back as uint8 into the array

    - save the array to a destination binary data object

    - export it out back into my file system for external use

    This is fantastic. Like... a game changer for me. Seriously, thank you SO much for replying!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello Friends,

    Need help...

    I try to set VideoRecorder with BinaryData via AJAX...

    and got this errors...

    Try to Construct] AJAX request to 'blob:https://preview.construct.net/156367e6-c601-4074-b3cf-5564a2d5641f' (tag 'pb') failed: ProgressEvent

    10x :)

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)