How to include binaries in EXE?

Previous topic - Next topic

Sokurah

In BlitzMax you can do this;

QuoteIncbin "res\backdrop.jpg"
Global BackdropGFX:TImage = LoadImage ("IncBin::res\backdrop.jpg")

Is there a way to embed binaries into the EXE file so you don't need external ressources?

Edit: I just read about the "ShoeBox-Standalone" proggy but it's hardly a usable option since it's not guaranteed to work across all platforms.
Anyway, I'm mostly interrested in how to do it on the iPhone.
Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

Qube

I thought with iPhone apps everything is automatically included in the <appname>.app file after it's built in XCode?

Sokurah

Quote from: Qube on 2009-Aug-26
I thought with iPhone apps everything is automatically included in the <appname>.app file after it's built in XCode?

Aha, didn't consider that. :)

Still, an easy way of doing it at compile-time under Windows would be great too.
Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

Ian Price

I love "incbin" too. :(

Shoebox is indeed a pain (it's a hassle to do and doesn't work with all files on all systems) I don't even bother using it nowadays. It does have a use, and is important to keep in however, but like you I prefer BlitzMax's method of including media.
I came. I saw. I played.

Kitty Hello

ah. I see. It's sort of packing a file as a memory array. I put it on my todo.

Shoebox, however _is_ x-platform and the standalone method works on all platforms. Bit it's a pain to build, I agree. Maybe you can make a macro for that...

doimus

Shoebox is great for bigger apps, with lots of assets, etc.

This include-into-exe thingy is good for small games for example, so we could fit it all into exe and distribute it. Perfect for retro remakes!
(That's the only thing I liked about DarkBasic, it had include-into-exe option...)

Ian Price

doimus: Why do you think incbin is only good for small apps? You don't magically have thousands of media files appear at once - you incbin them as you create them, so it doesn't matter how large the file is or how many assets it has.

And Gernot, some media does not work on all platforms - I couldn't get MP3 to shoebox for GP2X IIRC. That was a while ago though and it might work now; I've just not tried since. I seem to recall creating a topic here about it.

Ah, yes - here it is - http://www.glbasic.com/forum/index.php?topic=1589.0  And I'm still waiting for the reply ;) :P
I came. I saw. I played.

Hatonastick

#7
Quote from: Kitty Hello on 2009-Aug-27
ah. I see. It's sort of packing a file as a memory array. I put it on my todo.

Shoebox, however _is_ x-platform and the standalone method works on all platforms. Bit it's a pain to build, I agree. Maybe you can make a macro for that...
I think you'll find that the way BlitzMax does it is use a resource compiler to turn the INCBIN file into a something that can be linked with the main executable, then the FindResource and LoadResource API's are used to access the embedded files.  Problem is this is all windows specific.  No idea if you can do this under Linux with something in the GNU line ie. whether there's a cross platform way of doing this.

eg.  Have a look at the Raw Data Resources section of this webpage to see what I'm talking about:
http://www.jorgon.freeserve.co.uk/ResourceFrame.htm

Edit:  Never mind, there's got to be a better way.

doimus

@Ian - I meant include into binary is especially good for small apps (and for bigger ones as well, of course).

I occasionally make horrible, crappy, joke-games which I then send to people via email etc...  This would be perfect for that.

Another, more useful thing would be using it for presentations or slideshows.

MrTAToad

The other advantage of having everything in an executable is, of course, less files for things to go wrong with.