Author Topic: BIN2BAS64 GUI  (Read 429 times)

Offline SpriggsySpriggs

  • Forum Regular
  • Posts: 153
  • DIM JohnSilver AS LONG, yarn AS STRING
    • My GitHub
BIN2BAS64 GUI
« on: May 11, 2020, 03:56:56 PM »
I made a program a while back on Github using Inform by @FellippeHeitor and the BIN2BAS program that @Dav changed to work with QB64. It gives a GUI front for changing a binary file to a BAS file to include at runtime. I've used it extensively for my own programs to $INCLUDE PowerShell scripts that I want to keep with the executable. Here is the link to the project if anyone wants to download it and use it. It should be the most updated version that I've got out there.
https://github.com/SpriggsySpriggs/BIN2BAS64

Offline FellippeHeitor

  • QB64 Developer
  • Forum Resident
  • Posts: 2131
  • LET IT = BE
    • QB64.org
Re: BIN2BAS64 GUI
« Reply #1 on: May 11, 2020, 06:46:14 PM »
Interesting. I do wanna try it. The package is missing 'Convert to Binary.frm'.

Offline SpriggsySpriggs

  • Forum Regular
  • Posts: 153
  • DIM JohnSilver AS LONG, yarn AS STRING
    • My GitHub
Re: BIN2BAS64 GUI
« Reply #2 on: May 12, 2020, 07:35:24 AM »
The package is missing 'Convert to Binary.frm'.
Ah! So sorry! That package has been up in github for so long now and I missed that! Thank you for catching that!

Offline Dav

  • Forum Regular
  • Posts: 201
Re: BIN2BAS64 GUI
« Reply #3 on: May 12, 2020, 11:56:38 AM »
Cool!  I updated the BIN2BAS program to use _DEFLATE/INFLATE to ouput MUCH smaller BAS code.  I'll post it soon.

- Dav

Offline FellippeHeitor

  • QB64 Developer
  • Forum Resident
  • Posts: 2131
  • LET IT = BE
    • QB64.org
Re: BIN2BAS64 GUI
« Reply #4 on: May 12, 2020, 11:59:35 AM »
Great news, Dav!

Offline FellippeHeitor

  • QB64 Developer
  • Forum Resident
  • Posts: 2131
  • LET IT = BE
    • QB64.org
Re: BIN2BAS64 GUI
« Reply #5 on: May 12, 2020, 01:02:08 PM »
@SpriggsySpriggs Just tried it now with the full code. Good job integrating it with InForm! Thanks for sharing.

Offline SpriggsySpriggs

  • Forum Regular
  • Posts: 153
  • DIM JohnSilver AS LONG, yarn AS STRING
    • My GitHub
Re: BIN2BAS64 GUI
« Reply #6 on: May 13, 2020, 11:17:04 AM »
The best thing about it too is that now Dav posted a version that utilizes the _DEFLATE$ and _INFLATE$ methods and I've been testing that today. It looks like it is working quite well! I'm going to update my Github either later today or tomorrow with the updated stuff.

Offline Dav

  • Forum Regular
  • Posts: 201
Re: BIN2BAS64 GUI
« Reply #7 on: May 13, 2020, 11:50:25 AM »
I think I better update the BAS encoder code again to workaround the forum problem that messes with source code that uses @.  I'll try to do that today.

 - Dav

Offline SpriggsySpriggs

  • Forum Regular
  • Posts: 153
  • DIM JohnSilver AS LONG, yarn AS STRING
    • My GitHub
Re: BIN2BAS64 GUI
« Reply #8 on: May 14, 2020, 08:54:04 AM »
I have updated my Github using the _DEFLATE$ and _INFLATE$ methods that Dav showed in his code snippet. I'm very pleased with how well it works.

Offline SpriggsySpriggs

  • Forum Regular
  • Posts: 153
  • DIM JohnSilver AS LONG, yarn AS STRING
    • My GitHub
Re: BIN2BAS64 GUI
« Reply #9 on: May 18, 2020, 02:36:22 PM »
I've now updated my code to reflect Dav's BASIMAGE code that he posted. The user can now select to either convert a binary to a bas file or an image to MEM.
It can be downloaded at https://github.com/SpriggsySpriggs/BIN2BAS64
Here is a screenshot of how it works currently:
 
« Last Edit: May 18, 2020, 02:37:49 PM by SpriggsySpriggs »

Offline SpriggsySpriggs

  • Forum Regular
  • Posts: 153
  • DIM JohnSilver AS LONG, yarn AS STRING
    • My GitHub
Re: BIN2BAS64 GUI
« Reply #10 on: May 19, 2020, 11:41:52 AM »
MAJOR UPDATE 05-19-2020:
Now both BIN2BAS and PIC2MEM generate a non-conflicting function name. To use the BIN2BAS file you generate, INCLUDE it as a BM in the bottom of your program and call the sub elsewhere to generate the file. For instance,
Code: QB64: [Select]
  1. __file 'This calls the sub named "file" that generates the file if it does not exist
  2. '$INCLUDE:'file.ico.BM'
To use the PIC2MEM function output, INCLUDE the .MEM file in the bottom like you would for a BM then use the function name as an image handle in your program. Example:
Code: QB64: [Select]
  1. SCREEN __smiley& 'The function call returns the image handle of the picture "smiley"
  2. '$INCLUDE:'smiley.png.MEM'
I'm using the embedded photos from the PIC2MEM function in the buttons of my InForm program by assigning
Code: QB64: [Select]
  1. Control(ControlID).HelperCanvas = __imageHandle&

I've done a whole lot of testing with this program. I decided against using my own WPF Message Boxes since they run slow depending on the startup folder directory and machine speed. Native will just be better for this since this will also not show a message box ever as long as someone doesn't try to open something besides what the filter allows. The generated files and functions should all be compatible with OPTION _EXPLICIT as well.
« Last Edit: May 19, 2020, 11:48:29 AM by SpriggsySpriggs »