DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Last post Author Topic: How to bundle a game's source file and its interpreter into a single EXE  (Read 27,788 times)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
I'll whip up those files for you now, Hollow.
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

« Last Edit: May 25, 2007, 09:04 PM by kyrathaba »

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Hollowlife, here is the dummy interpreter EXE and the text file similating a game file.  Unzip, then open folder and run the EXE.  You'll see my intentions.  If you can provide source code on wrapping these two inside an EXE, I'll have learned two useful things today :>
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

hollowlife1987

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 92
    • Participated in NANY Challenge Three Times
Ok, just give me a few minutes

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Take your time, I'm on no timetable.  Besides, I'm at the mercy of your samaritanism ;>
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

hollowlife1987

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 92
    • Participated in NANY Challenge Three Times
You have the source to the interpreter exe right?

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Yeah, I'll upload the entire dummy project.
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

hollowlife1987

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 92
    • Participated in NANY Challenge Three Times
Ok, you have the code to compile an exe now all you need to do is add a the script to that exe as a resource.

Then when you run the newly created exe you use open the resource and run the script directly from memory

Here are some code snippets on how to do what I just explain (note I don't know much about compiling .net code from .net so your on your own on how to use a resource file when you compile it)

To make the .resources file that you compile into the newly created exe
Code: (csharp)
ResourceWriter rw = new ResourceWriter("app.resources");
byte[] data = File.ReadAllBytes(scriptFile);

rw.AddResource("script", data);
rw.Close();

And to read the resource and do something with it
Code: (csharp)
ResourceManager rm = new ResourceManager("app", Assembly.GetExecutingAssembly());
byte[] data = (byte[])rm.GetObject("script");

UTF8Encoding encoder = new UTF8Encoding();
string text = encoder.GetString(data);

Console.WriteLine(text);

Hope that is of some help if you still need help I'll write a sample program I couldn't do it tonight because something came up.

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Very helpful.  Thanks Hollowlife :>
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

hollowlife1987

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 92
    • Participated in NANY Challenge Three Times
Your very welcome :)

Original address: https://www.donationcoder.com/forum/index.php?topic=8640.0