游戏引擎如何在不编译的情况下创建可删除文件? [英] how a game engine create a excutable file without compiling?

查看:74
本文介绍了游戏引擎如何在不编译的情况下创建可删除文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

这是一个多问题

我正在开发gameengine项目,我想知道

我的应用程序如何创建新的exe来自现有exe的文件可以运行游戏

i意味着我希望我的应用程序可以更改exe和应用程序名称以及公司名称等的图标,并将一些额外的数据添加到其结尾并阅读它

(我的意思是修复访问denid错误以打开正在运行的exe)

i永远不要让编译器使exe真的很难

这是我的一个问题我把代码放在下面

这个项目尝试打开gameengine.exe,其中gameengine.exe是我执行游戏引擎的名称



< pre lang =c ++> #pragma once
#include < stdio.h >

nam espace gameengine {

使用 命名空间系统;
使用 命名空间 System :: ComponentModel;
使用 命名空间 System :: Collections;
使用 命名空间 System :: Windows :: Forms;
使用 命名空间 System :: Data;
使用 命名空间 System :: Drawing;

/// < 摘要 >
/// Form1的摘要
///
/// 警告:如果更改此类的名称,您需要更改
/// 资源文件名属性托管资源编译器工具
/// 与此类所依赖的所有.resx文件相关联。否则,
/// 设计师将无法与本地化的$ b正常交互$ b /// 与此表单相关联的资源。
/// < / summary >
public ref class Form1: public System :: Windows :: Forms :: Form
{
public
Form1( void
{
InitializeComponent();
//
// TODO:在此处添加构造函数代码
//
}

受保护
/// < 摘要 >
/// 清理正在使用的所有资源。
/// < / summary >
~Form1()
{
if (components)
{
delete 组件;
}
}

私人
// / < 摘要 >
/// 必需的设计变量。
/// < / summary >
System :: ComponentModel :: Container ^ components ;

#pragma region Windows窗体设计器生成的代码
/// < 摘要 >
/// Designer支持所需的方法 - 执行不使用代码编辑器修改
/// 此方法的内容。
/// < / summary >
void InitializeComponent( void
{
this - > ; SuspendLayout();
//
// Form1
//
- > AutoScaleDimensions = System :: Drawing :: SizeF( 6 13 );
- > AutoScaleMode = System :: Windows :: Forms :: AutoScaleMode :: Font;
- > ClientSize = System :: Drawing :: Size( 284 262 );
- >名称= L Form1\" 中;
- > Text = L Form1\" 中;
- >加载+ = gcnew System :: EventHandler( this ,& Form1 :: Form1_Load);
- > ResumeLayout( false );

}
#pragma endregion
private : System :: Void Form1_Load(System :: Object ^ sender,System :: EventArgs ^ e){
FILE * p = fopen( gameengine.exe rb); // 这是我的问题
}
};
}



谢谢大家

解决方案

我不知道这个特定的引擎是如何工作的,但是我很确定它确实使用了编译。事情是这样的:一些编译器,以及MSBuild.EXE带有.NET(可再发行)网络。而且,顺便说一句,这意味着不需要Visual Studio来构建项目;可以使用MSBuild构建C#和VB.NET项目的解决方案。 Studio本身不会编译这些项目。 .NET FCL需要这些编译器的存在,因为它包含Code DOM,它特别允许从代码DOM树的源代码编译.NET代码,在运行时加载并执行它。



这并不意味着程序的自我修改。自修改代码是一种远离主导现代编程范式的概念。有关详细信息,请参阅: http://en.wikipedia.org/wiki/Self-modifying_code [< a href =http://en.wikipedia.org/wiki/Self-modifying_codetarget =_ blanktitle =New Window> ^ ]。



在.NET中,在Windows中(在Linux中,* NIX以及更多),这些平台的原生代码永远不会被修改。大多数CPU通常都支持修改已加载代码的可能性,因此在物理上是不可能的。



在运行期间在流程中添加一些代码不是修改现有的加载代码。此功能可用于构建插件体系结构,其中插件在运行时期间动态加载(在同一运行时期间初步构建)。尽管(在.NET中)卸载它们特别困难,但是通过卸载整个应用程序域可以解决这个问题。如果您有兴趣,我可以参考我过去非常详细的答案。你需要吗?



-SA


非常感谢我的朋友们>
所以游戏引擎有一个编译器是吗?

真正的问题是当我向游戏开发者发布我的第一个游戏引擎时

他们想要建立一个游戏那个和游戏引擎将预编译的可执行文件复制到游戏文件夹但exe的图标是我的图标,他们必须用可视化的stadio资源编辑器打开exe文件并更改图标并保存。我想在引擎复制exe文件然后将图标更改为游戏deverlopers最爱图标。

hi there
its a multi question
im working on gameengine project and i want to know
how my application can create new exe file from existing exe which can run the game
i mean i want my application can change icon of exe and application name and company name and etc and put some extra data to end of that and read it
(i mean fix access denid error to open running exe)
i never want make a compiler to make exe its realy hard
this is one of my question i put code below
this project try to open gameengine.exe which "gameengine.exe" is name of my execution game engine

#pragma once
#include <stdio.h>

namespace gameengine {

    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    /// <summary>
    /// Summary for Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    ///          'Resource File Name' property for the managed resource compiler tool
    ///          associated with all .resx files this class depends on.  Otherwise,
    ///          the designers will not be able to interact properly with localized
    ///          resources associated with this form.
    /// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        Form1(void)
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
        }

    protected:
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }

    private:
        /// <summary>
        /// Required designer variable.
        /// </summary>
        System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        void InitializeComponent(void)
        {
            this->SuspendLayout();
            //
            // Form1
            //
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(284, 262);
            this->Name = L"Form1";
            this->Text = L"Form1";
            this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
            this->ResumeLayout(false);

        }
#pragma endregion
    private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
                 FILE *p=fopen("gameengine.exe","rb");//this is my problem
             }
    };
}


thanks everyone

解决方案

I have no idea how this particular engine works, but I''m pretty certain that it does use compilation. Here is the thing: some compilers, along with MSBuild.EXE come with .NET (redistributable) network. And, by the way, it means that Visual Studio is not needed to build projects; a solution with C# and VB.NET projects can be built with MSBuild. Studio itself does not compile those projects. And the presence of those compilers is required by .NET FCL, because it includes Code DOM which allows, in particular, to compile .NET code from source of from code DOM tree, load and execute it during runtime.

And it does not mean self-modification of the program. Self-modifying code is the conception which goes quite far from dominating modern programming paradigms. For more detail, please see: http://en.wikipedia.org/wiki/Self-modifying_code[^].

In .NET, in Windows (in Linux, *NIX and a lot more), the code native to these platforms is never modified. The lack of the possibility to modify already loaded code is usually supported by the most CPUs, so it is physically impossible.

Adding some code in the process during runtime is not modification of existing loaded code. This feature can be used to build plug-in architecture where the plug-ins are loaded (preliminary built during the same runtime or not) dynamically during runtime. Unloading of them is specifically difficult though (in .NET), but this problem is solved through unloading of whole Application Domains. If you are interested, I can reference a good number of my past very detailed answers on this topic. Do you need that?

—SA


thank you very much my friends
so the game engine have a compiler yes?
the real problem is when i release my first game engine to game developers
they want build a game with that and game engine copy precompiled executable file to game folder but icon of exe is my icon and they must open exe file with visual stadio resource editor and change icon and save.i want when engine copy the exe file then change icon to game deverlopers favorite icon.


这篇关于游戏引擎如何在不编译的情况下创建可删除文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆