It is currently Thu Nov 21, 2019 9:59 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Include non-images in the executable
PostPosted: Thu Dec 13, 2018 11:34 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 652
Location: Portugal
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: Include non-images in the executable
PostPosted: Thu Dec 13, 2018 11:40 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 04, 2013 5:28 pm
Posts: 333
:?:

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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Include non-images in the executable
PostPosted: Thu Dec 13, 2018 11:52 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 652
Location: Portugal
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 :oops:

It just refers the INCLUDE command but no examples.


Top
 Profile  
Reply with quote  
 Post subject: Re: Include non-images in the executable
PostPosted: Thu Dec 13, 2018 6:04 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 10, 2017 6:17 pm
Posts: 288
Location: Germany
This is what i do for arbitrary binary data.

Code:
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).

_________________
webpage


Top
 Profile  
Reply with quote  
 Post subject: Re: Include non-images in the executable
PostPosted: Thu Dec 13, 2018 6:25 pm 
Offline
User
User

Joined: Sat Jun 23, 2018 5:21 pm
Posts: 99
Hello:

Code:
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.



Top
 Profile  
Reply with quote  
 Post subject: Re: Include non-images in the executable
PostPosted: Fri Dec 14, 2018 3:05 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Mar 10, 2013 3:01 pm
Posts: 652
Location: Portugal
Thanks, my friends!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: captain_skank and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye