Author Topic: How to include binaries in EXE?  (Read 4532 times)

Offline Sokurah

  • Mr. Polyvector
  • ***
  • Posts: 177
    • View Profile
How to include binaries in EXE?
« on: 2009-Aug-26 »
In BlitzMax you can do this;

Quote
Incbin "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.
« Last Edit: 2009-Aug-26 by Sokurah »
Website: Tardis remakes / Mostly remakes of Arcade and ZX Spectrum games. All freeware. :-)
Twitter: Sokurah

Offline Qube

  • Mr. Polyvector
  • ***
  • Posts: 157
    • View Profile
Re: How to include binaries in EXE?
« Reply #1 on: 2009-Aug-26 »
I thought with iPhone apps everything is automatically included in the <appname>.app file after it's built in XCode?

Offline Sokurah

  • Mr. Polyvector
  • ***
  • Posts: 177
    • View Profile
Re: How to include binaries in EXE?
« Reply #2 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

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4176
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: How to include binaries in EXE?
« Reply #3 on: 2009-Aug-27 »
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.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: How to include binaries in EXE?
« Reply #4 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...

Offline doimus

  • Dr. Type
  • ****
  • Posts: 284
    • View Profile
Re: How to include binaries in EXE?
« Reply #5 on: 2009-Aug-27 »
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...)

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4176
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: How to include binaries in EXE?
« Reply #6 on: 2009-Aug-27 »
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

  • Guest
Re: How to include binaries in EXE?
« Reply #7 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.
« Last Edit: 2009-Aug-27 by Hatonastick »

Offline doimus

  • Dr. Type
  • ****
  • Posts: 284
    • View Profile
Re: How to include binaries in EXE?
« Reply #8 on: 2009-Aug-27 »
@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

  • Guest
Re: How to include binaries in EXE?
« Reply #9 on: 2009-Aug-28 »
The other advantage of having everything in an executable is, of course, less files for things to go wrong with.