Main Menu

News:

SyntaxBoom, now with pwetty syntax highlighted code boxes! \o/ 

https://www.syntaxboom.com/forum/index.php?topic=96

Shoutbox

Jackdaw

Today at 20:00:40
Going to have to try bourbon and beans. That should be an explosive combination.

Baggey

Today at 13:15:42
I sometimes mix a chicken vindaloo and a Tika Masala together. Awesome  :P

Dabzy

Today at 05:49:34
And doing the act was the realisation I went for an indian when out... 20mins I was in the thunderbox waiting for me back chaff to cool down!

Dabzy

Today at 05:48:11
When I was on my "Year On The Blur", aka drinking after getting divorced, I was minging one night, couldnt remember getting home. Anyway, next day, went to work, and needed a poo...

GfK

2025-10-15, 21:39:05
I overdosed on jelly babies once and my arse was like the shooty gun bit at the start of James Bond

Amon

2025-10-15, 20:16:38
lol

Jackdaw

2025-10-15, 19:40:48
Never had a Phall or a tinderloo. But I have heard that your backside feels like that map at the start of every episode of Bonanza.

GfK

2025-10-15, 19:22:25
Never confuse phall with phallus

Baggey

2025-10-15, 18:30:58
My mate ate a phall one night. Even that was to hot for me. I bet he suffered in the morning!  :-[

Dabzy

2025-10-15, 18:02:52
I like nice and toasty bit of fire in my bait as well, I used to eat really red hot gear, but nowadays if I do... Heartburn happens! :(

Members
Stats
  • Total Posts: 1,811
  • Total Topics: 224
  • Online today: 26
  • Online ever: 232 (Oct 08, 2025, 09:18 AM)
Users Online
  • Users: 2
  • Guests: 5
  • Total: 7
  • ando
Welcome to SyntaxBoom. Please login or sign up.

Recent

IncBin

Started by Baggey, Jul 02, 2025, 05:12 AM

Previous topic - Next topic

Baggey

Any one give me an idea of the usage of incBin.

I assume it's some way of loading graphics music etc.. in away someone else cant pinch your underlying code?
Running a Pc that just aint. Faster nough. I7-4Ghz, 32Gb Ram, 4Gb Nvidia, 2 x 1Tb SSD's, 2 x 24" LCD's

RETRO everything!

Jesus was only famous because of his Dad

Jackdaw

If you've dug yourself into a hole. Just keep digging. You're bound to come out the other side eventually.

_PJ_

Essentially, it is a way of packing external assets [any kind of filetype] into your executable.
Of course, it will inflate the size of exe and you can only have hardcoded static paths to those files.

It can mitigate the end users' ability to examine/steal/edit those assets, but if they're particularly shrewd wityh the right tools, they might still be able to grab the binary data and recreate the individual files - it will be very labour intensive for them, so may be enough of a deterrent for all but the most peristent - depends on the potential for rewards I guess...

_

To use IncBin it really is a s simple as:


Incbin "C:\Program Files\BlitzMax\samples\aaronkoolen\AStar\mountain.png"

Local I:TImage=LoadImage("Incbin::C:\Program Files\BlitzMax\samples\aaronkoolen\AStar\mountain.png")



Baggey

QuoteIt can mitigate the end users' ability to examine/steal/edit those assets, but if they're particularly shrewd wityh the right tools, they might still be able to grab the binary data and recreate the individual files - it will be very labour intensive for them
:o

Are saying even just an .exe could be stripped for internal working code  :-X

Baggey
Running a Pc that just aint. Faster nough. I7-4Ghz, 32Gb Ram, 4Gb Nvidia, 2 x 1Tb SSD's, 2 x 24" LCD's

RETRO everything!

Jesus was only famous because of his Dad

_PJ_

Quote from: Baggey on Jul 12, 2025, 07:28 AMAre saying even just an .exe could be stripped for internal working code  :-X

Baggey

Anything is decrypotable/decompilable - it's jsut a matter of effort & time (and maybe tools too)

_PJ_

 :o
UPDATE! Possibly Important!


I thought I'd mention this here. Just identified an issue with using IncBin in a program compiled for Windows

Althoyugh everything works fine during testing and running the executable from its development locaiton - once this is installed to the %PROGRAMFILES% or %PROGRAMFILES(x86)% as a "registered software installaiton" The executable will exit immediately.

I suspect this si some "security measure" by Windows ( Smart Screen or somesuch ? ) but even disabling the Windows Defender stuff did not prevent the crash.

As soon as I removed the IncBin, instead using actual paths to actual file and installed the executable along with the dependency files everything worked.

Midimaster

I cannot confirm this statement. Since years I use INCBIN and never had problems with installations on customers computers.

Can you send us an example code how you used INCBIN, and describe how you use the files? What was the runtime error message?

Did you try to execute a file, which is INCBINed? Something like:
OpenURL "incbin::manual.pdf"
This will not work!


I have a suspicion:
Count your INCBIN statements in the code and the count the files, which you now install with the installer.

I guess it points to a file you forgot to INCBIN. And as long as you start the app from the development dir, the forgotten file was still next to the EXE and found...

_PJ_

Quote from: Midimaster on Oct 13, 2025, 09:53 PMI cannot confirm this statement. Since years I use INCBIN and never had problems with installations on customers computers.

Can you send us an example code how you used INCBIN, and describe how you use the files? What was the runtime error message?

This is a very recent development. Previously it worked without issue and nothing from the BlitzMax code side of things has changed, nor had the number of files / their location. [ I have upodated BMax NG source and other areas of the program but have not touched this IncBin part in many months ]

There was no error message, instead the entire program just exited to desktop when running as a compiled installation.
When testing, however, it worked just fine.


I was using the incbin command in combination with the language.ini files for MaxGUI localisation
the relevant snippets are:

These files are correctly matched in the development environment
' Package files into executable binary
	Incbin "F:\bb\BMax64\WIP\Project\Localisation\Deutsch.ini"
	Incbin "F:\bb\BMax64\WIP\Project\Localisation\English.ini"
	Incbin "F:\bb\BMax64\WIP\Project\Localisation\Francais.ini"
	Incbin "F:\bb\BMax64\WIP\Project\Localisation\Svenska.ini"

Function GetLocalisationRoot:String()
	Local Path:String=APP_ROOT+APPLOCALISATION_DIR+"/"

	Return Path
End Function

APP_ROOT is defined earrlier and essentially the installation location with slash suffix "/"
APPLOCALISATION_DIR is "Localisation"


Here is the snippet for when the incbinned files are actually used.
Function LoadLocalisations()
	'LANG_ENGLISH=LoadLanguage(LOCALISATION_ROOT+"English.ini")
	LANG_ENGLISH=LoadLanguage("Incbin::"+LOCALISATION_ROOT+"English.ini")
	SetLanguageName(LANG_ENGLISH,"English")
	
	LANG_FRENCH=LoadLanguage("Incbin::"+LOCALISATION_ROOT+"Francais.ini")	
	SetLanguageName(LANG_FRENCH,"French")
	
	LANG_GERMAN=LoadLanguage("Incbin::"+LOCALISATION_ROOT+"Deutsch.ini")	
	SetLanguageName(LANG_GERMAN,"German")
			
	LANG_SWEDISH=LoadLanguage("Incbin::"+LOCALISATION_ROOT+"Svenska.ini")	
	SetLanguageName(LANG_SWEDISH,"Swedish")
	
	'KNOWN ISSUE: Panel Name remains unchanged until redrawn - this is low prio.
End Function

Removing ther IncBin and Reverting to distributing the files with the executable and loading them as 'normal' resovled the issue.

Midimaster

#8
I simulated your example (also with the TMaxGuiLanguage stuff) and the EXE works on C: and D: and also in the windows PROGRAMS folder as expected


Please test this on C: and F: and also in the PROGRAMS  folder:
SuperStrict
Import MaxGUI.Drivers
' files are in    F:\bb\BMax64\WIP\Project\Localisation\

Graphics 300,200
Incbin "F:\bb\BMax64\WIP\Project\Localisation\English.ini"
Local Path:String = "Daten\"
Path = "incbin::F:\bb\BMax64\WIP\Project\Localisation\"
Global Language:TMaxGuiLanguage =  LoadLanguage:TMaxGuiLanguage(path + "English.ini")

If Language=Null RuntimeError "no language loaded"

Repeat
    Cls
    DrawText "Hello", 100,100
    Flip
Until AppTerminate()

And I can also tell you, that I often used INCBIN together with TMaxGuiLanguage in apps I gave to customers and we never had problems.

Do you know, that INCBIN handles strings CASE sensitive? Maybe you have one capital letter anywhere in your file names or paths and somewhere else you used it without this capital letter?



Midimaster

#9
next idea:

you write:
' Package files into executable binary
    Incbin "F:\bb\BMax64\WIP\Project\Localisation\Deutsch.ini"

and then...
Function GetLocalisationRoot:String()
    Local Path:String=APP_ROOT+APPLOCALISATION_DIR+"/"

two questions here:

Can you post the code two lines where you defined APP_ROOT and APPLOCALISATION_DIR?

for INCBIN reading you need to use the exact same string, which you used in the INCBIN code line:
F:\bb\BMax64\WIP\Project\Localisation\Deutsch.ini

even when the EXE is now in PROGRAMS, the loading path still needs to be:
LANG_GERMAN=LoadLanguage("Incbin::"+ F:\bb\BMax64\WIP\Project\Localisation\Deutsch.ini")

Add a simple PRINT...
Function GetLocalisationRoot:String()
	Local Path:String=APP_ROOT+APPLOCALISATION_DIR+"/"
	Print Path
... to your code and compare if the strings are really identic.