Page 1 of 1
Include non-images in the executable
Posted: Thu Dec 13, 2018 11:34 am
by marcoagpinto
Hello!
Is there a way of compiling and have files get built-in into the executable?
I am thinking about .txt files and others.
For example:
x3d/header.txt
x3d/footer.txt
To create x3d files, I open both files above and append them at the start and end of my data, but it would be great if I could store them in the executable.
Is it possible?
Thanks!
Re: Include non-images in the executable
Posted: Thu Dec 13, 2018 11:40 am
by DontTalkToMe
Where is the problem with the fact it's not an image ?
You can do it the same way: IncludeBinary "name.txt"
Then you Peek* or CopyMemory() from the right memory address using a label and read back.
Re: Include non-images in the executable
Posted: Thu Dec 13, 2018 11:52 am
by marcoagpinto
DontTalkToMe wrote:
Where is the problem with the fact it's not an image ?
You can do it the same way: IncludeBinary "name.txt"
Then you Peek* or CopyMemory() from the right memory address using a label and read back.
Buaaaaaaaaaa... I was looking at the PB help and it doesn't explain how to convert to string an included UTF-8 text file
It just refers the INCLUDE command but no examples.
Re: Include non-images in the executable
Posted: Thu Dec 13, 2018 6:04 pm
by Bitblazer
This is what i do for arbitrary binary data.
Code: Select all
DataSection
SomeBinaryData:
IncludeBinary "somedata.bin"
SomeBinaryDataEnd:
Data.l 0
EndDataSection
; to get the size of the data
Size.i = ?SomeBinaryDataEnd - ?SomeBinaryData
For Text, you could just use Peeks(?SomeBinaryData).
Re: Include non-images in the executable
Posted: Thu Dec 13, 2018 6:25 pm
by ccode
Hello:
Code: Select all
Restore Txt
l.i = MemoryStringLength(?Txt, #PB_UTF8)
Debug l
Debug PeekS(?Txt, l, #PB_UTF8)
DataSection
Txt:
IncludeBinary "ReadMeUTF8"
EndDataSection
;Create a File: "ReadMeUTF8"
;Example-Text:
; Ich bin eine UTF-Text-Datei.
; I am a UTF text file.
; Je suis un fichier texte UTF.
; Ek is 'n UTF-tekslêer.
; Jeg er en UTF-tekstfil.
; 我是一个UTF文本文件。
; Mi estas UTF-dosiero-dosiero.
; Is comhad téacs UTF mé.
; Jestem plikiem tekstowym UTF.
; Jsem textový soubor UTF.
; 私はUTFテキストファイルです。
; Είμαι ένα αρχείο κειμένου UTF.
; Я текстовый файл UTF.
; Ik ben een UTF-tekstbestand.
; Ben bir UTF metin dosyasıyım.
; Ik bin in UTF-teksttriem.
Re: Include non-images in the executable
Posted: Fri Dec 14, 2018 3:05 pm
by marcoagpinto
Thanks, my friends!
Re: Include non-images in the executable
Posted: Fri May 22, 2020 7:58 pm
by minimy
; Ich bin eine UTF-Text-Datei.
; I am a UTF text file.
; Je suis un fichier texte UTF.
; Ek is 'n UTF-tekslêer.
; Jeg er en UTF-tekstfil.
; 我是一个UTF文本文件。
; Mi estas UTF-dosiero-dosiero.
; Is comhad téacs UTF mé.
; Jestem plikiem tekstowym UTF.
; Jsem textový soubor UTF.
; 私はUTFテキストファイルです。
; Είμαι ένα αρχείο κειμένου UTF.
; Я текстовый файл UTF.
; Ik ben een UTF-tekstbestand.
; Ben bir UTF metin dosyasıyım.
; Ik bin in UTF-teksttriem.
; Yo soy un archivo UTF
Little spanish please..