Pack executable file?

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,284
Is there a way to pack resources folder into the .exe on the Windows platform? I would like to have only one exeutable with all the
textfiles, images and sounds inside it.
 

dawlane

Well-known member
CX Code Contributor
Tutorial Author
Joined
Jun 21, 2017
Messages
1,040
No. The only image you can store in a Windows exe is the icon.
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,284
No. The only image you can store in a Windows exe is the icon.
But of course that's wrong, Iv'e used standalone executables forever. You can embed whatever you want.
I have a technique so I can hide everything but I need to unpack it into a folder which they don't do either to my knowledge
maybe there's a way to use temporary hidden places but it feels a bit adhoc to solve it like that.
 

dawlane

Well-known member
CX Code Contributor
Tutorial Author
Joined
Jun 21, 2017
Messages
1,040
But of course that's wrong, Iv'e used standalone executables forever. You can embed whatever you want.
For Cerberus only the icon can be embedded. A Windows executable requires a resource file to embed other data. Cerberus doesn't have the code for a Windows specific application to handle resources in that way.
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,284
Okay an software installer might do the trick, or, I guess you could also make the game into a portable app.

My current solution is to create everything in cerberus code, the problem then is that the exe will create a folder called appname.data beside the executable the first time you run it. It's kinda ugly. I am not sure I can direct the folder to any name and any place but if that is out of the question then an Install-maker or portable-mkaer might be good choices.
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,284
On macOS I can actually write inside the "exe", and put the files you want inside there. I usually use the CX standard folder for internal files somewhere in that .app folderstructure. That way you have one single .app file that is permanently protected will all resoureces. But you can't do this for LInux and Windows to my knowledge. I really want to find a solution dfor Windows.
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,284
Or.. maybe it's possible, you just use internal to unpack them and CX knows where it puts those in whatever platform.

Come to think of it I think I've dones this, I feel stupid now. I will put up some code later if someone wants to know how after I have done that. In a year or two. I think I did it with sound on the forum already, there is working code.
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,284
Here's the relevant code I have already made to embed text graphics and sound inside executables on any platform

(windows macos Linux Android I think ios works too but i have not tries ios)


 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,284
Thanks for NSIS installer tip, that's good to know!
 

SLotman

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jul 3, 2017
Messages
239
You can always use stuff like UPX or molebox to pack everything into an exe - but usually anti-virus software will raise all sorts of flags and alarms about it.

I miss something like the zipstream module we had in Blitzmax. But the multiplatform nature of Cerberus make it impossible to work everywhere.
 
Top Bottom