![]() |
|
Embedding and Extracting MANY files ! - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Embedding and Extracting MANY files ! (/showthread.php?tid=4111) |
Embedding and Extracting MANY files ! - ahenry3068 - 11-14-2025 I am developing a conversion utility for the X16 that pipes two other conversion utilities together for the final output. The file formats are fairly obscure (these are for the 8 bit Commander X16 platform) The sequence is MIDI FILE --> VGM FILE --> ZSM FILE ( ZSM is currently Commander X16 only VGM is an old chiptune format used by Many arcade machines. ) I already have this setup and working as a Bash Script. The code to do the task is relatively straight forward. I'm mainly writing the QB64PE shell program to increase ease of use and allow renaming of the output file. I want to embed the utilities I depend on in the Main Executable & extract them on first run. I know how to do this. The problem is that one of the utilities (mid2vgm) depends on it's own assets folder with 130+ individual instrument files !. I could go through the tedium of an EMBED for each individual file. I don't want to do this !. I also don't want to introduce any other dependencies for my app (such as Winzip or other !) I want the extraction to be handled entirely in my own code ! Is there a way to do this efficiently ! Has someone else ran into similiar ! RE: Embedding and Extracting MANY files ! - bplus - 11-14-2025 Seems like this has been discussed already? RE: Embedding and Extracting MANY files ! - ahenry3068 - 11-14-2025 (11-14-2025, 07:10 PM)bplus Wrote: Seems like this has been discussed already? If so I would like to know where the thread is ? There can be a bit of a needle and haystack issue when searching through here ! RE: Embedding and Extracting MANY files ! - madscijr - 11-14-2025 (11-14-2025, 05:12 PM)ahenry3068 Wrote: The file formats are fairly obscure (these are for the 8 bit Commander X16 platform) If you get this working, I'd be very interested in seeing your code that parses the MIDI file, as a basis for a utility to convert from MIDI to tab-delimited text and back... RE: Embedding and Extracting MANY files ! - ahenry3068 - 11-14-2025 (11-14-2025, 07:28 PM)madscijr Wrote:(11-14-2025, 05:12 PM)ahenry3068 Wrote: The file formats are fairly obscure (these are for the 8 bit Commander X16 platform) I don't want to get your hopes up. That part is taken care of by the midi2vgm program (*that is what I'm trying to embed*) I don't have the source for that ! (11-14-2025, 07:28 PM)madscijr Wrote:(11-14-2025, 05:12 PM)ahenry3068 Wrote: The file formats are fairly obscure (these are for the 8 bit Commander X16 platform) If you have any 6502 assembly language experience the Commander X16 program MELODIUS does Midi parsing and playback. It's source is on GitHub The developers tag is MooingLemur. RE: Embedding and Extracting MANY files ! - Dav - 11-14-2025 Hmm, was thinking, maybe you could make a bas program to generate all that embed code so you don't have to type it all out, then paste it in your code maybe something like: Code: (Select All)
If that output is valid, you could output it to a file to grab and paste in your program. I guess you may have to come up with a better naming method for the handle name. - Dav RE: Embedding and Extracting MANY files ! - Petr - 11-14-2025 I would go this route (if it's only one folder) to make two groups of files to be inserted (via BASE64, if it were via BASE85, move the characters two to the right to avoid quotes and not confuse the DATA command) and then when unpacking from the EXE, do it in such a way that before unpacking it, you move the string back two characters) (this complication is eliminated with BASE64) and then: First unpack the files that don't have their own folder. Then via QB64PE command MKDIR create a folder, switch to it with the CHDIR command and do the same as in the previous case with the second set of files. Then via CHDIR ".." you return back. However, I am now studying @DAV's suggestion, because the resulting EXE file size would be smaller, but the condition must be met that each file must be called in the source for the compiler to include it. Then it can be written to harddrive via _WriteFile. I have never used it (Base64 yes), I will look into it. RE: Embedding and Extracting MANY files ! - madscijr - 11-14-2025 (11-14-2025, 07:33 PM)ahenry3068 Wrote: I don't want to get your hopes up. That part is taken care of by the midi2vgm program (*that is what I'm trying to embed*) I don't have the source for that ! Thanks for explaining - no worries, I just figured it was worth asking. I do (or rather, did) have some experience playing with 6502 assembly back in the day making little routines for games on the Commodore 64, but that's now 40 years ago, LoL. Back during Covid, I had a pet project where I made a working 6502 assembler in MS Excel. I quickly realized that programming assembly, and for the C64, was a hell of a lot more tedious than I remembered! (Actually that helped motivate me to look for an alternate programming platform for making simple PC games, which led me to QB64. Much better for my purposes!) Anyway, thanks and good luck with your project. RE: Embedding and Extracting MANY files ! - Petr - 11-14-2025 Code: (Select All)
So you need to write a program that creates strings like this: "$Embed filename, pointer" for all files in a folder with a directory and subdirectory in the form of an array. Then you put that in the source code. I would try one subfolder with one file first... RE: Embedding and Extracting MANY files ! - bplus - 11-14-2025 https://qb64phoenix.com/forum/showthread.php?tid=4022&pid=36610#pid36610 Oh I was remembering loading and embedding multiple image files. I don't know a file is a file, just a bunch of ones and zeros, no? |