Author Topic: BIN2BAS64 GUI  (Read 4105 times)

0 Members and 1 Guest are viewing this topic.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • 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
Shuwatch!

FellippeHeitor

  • Guest
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 Resident
  • Posts: 1145
  • Larger than life
    • 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!
Shuwatch!

Offline Dav

  • Forum Resident
  • Posts: 792
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

FellippeHeitor

  • Guest
Re: BIN2BAS64 GUI
« Reply #4 on: May 12, 2020, 11:59:35 am »
Great news, Dav!

FellippeHeitor

  • Guest
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 Resident
  • Posts: 1145
  • Larger than life
    • 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.
Shuwatch!

Offline Dav

  • Forum Resident
  • Posts: 792
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 Resident
  • Posts: 1145
  • Larger than life
    • 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.
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • 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:
 
pic2mem demo.png
« Last Edit: May 18, 2020, 02:37:49 pm by SpriggsySpriggs »
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • 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&
pic2mem demo.png

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 »
Shuwatch!