Compiling media into your exe?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
CodyCer0
Posts: 41
Joined: Mon Dec 08, 2008 3:07 am

Compiling media into your exe?

Post by CodyCer0 »

A long time ago I saw an answer to this but I didn't quite understand the code at the time. But the guy had some code that could compile all the media such as 3d models textures and other images into your project. Anyone know how to do this anymore?

If you do can you please say something because I sure don't know how I would do this :? lol
grassblade
Posts: 27
Joined: Mon Jan 09, 2006 11:17 am

Post by grassblade »

Perhaps this link may be of help to you. It is about using resources.
http://www.codeproject.com/KB/cpp/dynar ... ct=1295732
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

Check out: BuiltInFont.h

And here's the link to the Bin2H software:
http://deadnode.org/sw/bin2h/

P.S
Should be fixed in the header file.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
CodyCer0
Posts: 41
Joined: Mon Dec 08, 2008 3:07 am

um...

Post by CodyCer0 »

Did you guys understand that I was asking how do I literally put the media in the exe!? Like storing it into the actual exe and pulling it up from that storage from then on. I have found a code on how to do it before but I never got it to work. I think it was something to do with ill-matched versions of something.

But does someone know a code that actually stores graphics such as jpg,bmps, and meshes such as b3d, 3ds, md2 into the exe itself.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Why would you want to do this? It makes the .exe much bigger for no reason. And if you think it's secure, think again. If anybody really wants the resources in that program, they can decompile it or they could just take the data straight from the video card.
CodyCer0
Posts: 41
Joined: Mon Dec 08, 2008 3:07 am

I want to do it because...

Post by CodyCer0 »

Not because I want files protected only, but because it would make it better for users as far as keeping everything where it needs to be... You know in case some dumbazz deletes a file or effs it up in some way.

Thats why...

Plus it stops dummies from being able to steal the files. Sure the smart people can do it, but the dumb ones can't or just aren't going to waste their time with it.
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

There are tools that read the ressources of a file and can extract them with one click. So senseless.

However ressources is the keyword you need.
In Visual Studio for example (only the Standard Version and above) you simply add a ressource to your project (Project -> Add item). And then load it with some WinAPI functions (google is your friend). Of course this is not platform indepent. I haven't heard about a way to do this in Linux.

Oh and one thing should be mentioned:
The more and bigger ressources there are in an exe the longer it takes to load. This is because ALL (and I mean ALL) ressources will be loaded when the exe is executed. Even the ressources you don't need at the startup.

So you see storing your media files in a seperate folder/archive/whatever has only advantages. And you can prevent the *really* stupid people from stealing your media by simply changing the extension of your media archive from zip to data for example.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

CodyCer0 wrote:Did you guys understand that I was asking how do I literally put the media in the exe!? Like storing it into the actual exe and pulling it up from that storage from then on. I have found a code on how to do it before but I never got it to work. I think it was something to do with ill-matched versions of something.

But does someone know a code that actually stores graphics such as jpg,bmps, and meshes such as b3d, 3ds, md2 into the exe itself.
Did you miss my post or what?
MasterGod wrote:Check out: BuiltInFont.h

And here's the link to the Bin2H software:
http://deadnode.org/sw/bin2h/

P.S
Should be fixed in the header file.
Irrlicht does it with a bmp.
I did it in my engine with a 3ds mesh, exactly the same way..

What else do you need?
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Eigen
Competition winner
Posts: 375
Joined: Fri Jan 27, 2006 2:01 pm
Location: Estonia
Contact:

Post by Eigen »

You could try Mole Box which packages the application and all of its supplementary files into a single efficient executable file, which runs without extracting packed files to the hard drive

This just a trial version, of course. You may be able to find something like that freeware.

But as other have said, this only protects your files from normal users.
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

The way I'm suggesting is much more easier and it's exactly what you asked for.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
CodyCer0
Posts: 41
Joined: Mon Dec 08, 2008 3:07 am

Post by CodyCer0 »

MasterGod wrote:The way I'm suggesting is much more easier and it's exactly what you asked for.
Sorry I should of commented back, I tried the link where he said "Download the tool from here." And it gave me a single exe, I ran it and nothing happened, it just closes right away... :?
loki1985
Posts: 214
Joined: Thu Mar 31, 2005 2:36 pm

Post by loki1985 »

lol. both responses you got before complaining where exactly fitting your question, the first one being about the advanced way, the second one about the simple way.

you really should start reading what people post.

and about the EXE: this is a commandline executable, you really should learn how to use these :roll:
CodyCer0
Posts: 41
Joined: Mon Dec 08, 2008 3:07 am

Post by CodyCer0 »

MasterGod wrote:The way I'm suggesting is much more easier and it's exactly what you asked for.
Ok I got it running now, not from a guide on how to use commandline exe's, just troubleshooted my way into running it right.

But my question is how would I be able to put this into practice with irrlicht. How would I manage to um like use the value created from this exe to have this act as a replacement for the actual file itself?
CodyCer0
Posts: 41
Joined: Mon Dec 08, 2008 3:07 am

Post by CodyCer0 »

loki1985 wrote:lol. both responses you got before complaining where exactly fitting your question, the first one being about the advanced way, the second one about the simple way.

you really should start reading what people post.

and about the EXE: this is a commandline executable, you really should learn how to use these :roll:
About that, I was asleep and or at school at the time these posts were made...
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

CodyCer0 wrote:
MasterGod wrote:The way I'm suggesting is much more easier and it's exactly what you asked for.
Sorry I should of commented back, I tried the link where he said "Download the tool from here." And it gave me a single exe, I ran it and nothing happened, it just closes right away... :?
Dude, read the text on the main page:
Usage

Download the tool from here.

You must give the input file as the first argument; optionally you may specify the output filename (otherwise this defaults to the input filename with the extension changed to .h), the variable name, and the switch -nosize to suppress the creation of a variable representing the size of the data block created.

...

Example

bin2h bin2h.exe bin2h.h -nosize

This will create a file, bin2h.h, which defines a variable of type unsigned char [] named bin2h, but will not define the variable bin2h_size which would otherwise indicate the size of that array.
The example creates a header file of the bin2h program itself. This header contains an array of the binary data of the data you wish to save.
It could be another executable file (like in the example) or it can be a jpeg image.

Got it?
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
Post Reply