游戏王残局简化版

ygopro_编译.md at [20ef700ee0]
Login

ygopro_编译.md at [20ef700ee0]

File script/ygopro_编译.md artifact a1bd5718ba part of check-in 20ef700ee0


# ygopro_编译

## 前言

来,走起,我们来编译一个小且可用的 ygopro 。

功能不求全,<b>只要有</b>残局功能就够了。

## 新建文件夹

万事第一步,先新建个文件夹……

然后,不做了,等一年后再来看,进度 0%,哈哈,这才是正常轨迹。

上面虽然是玩笑话,但也估摸着是我的真实经历,只不过我这个拖延王<b>拖延了</b>大概六年。

好了,给这个文件夹改名吧。

我则取名叫:

~~~
ygopro
~~~

## 编译器

编译时,一个<b>很麻烦</b>的东西就是编译器。

很长一段时间,我都不知道到哪里去下编译器,也不知道编译器的名字叫什么。

像这种基础性的东西难道不应该有某某一个人把它们汇总起来让人随便下吗?

后来我发现,诶,还真有,但那人的网站在百度上很难搜。

现在的搜索引擎,早不名副其实了。

我们要下载的编译器叫 msvc ,准确点,应该叫 MSVC 。

不过我懒得换大小写,后文直接叫 msvc 了。

msvc 是一家叫微软的公司出的,这公司现在很鸡贼,把 msvc 的下载页面给隐藏了,狂推 vs 的下载。

~~~
https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools
~~~

下载下来之后,会有一个 exe ,直接进行执行。

然后就会有一大堆东西让你选,你挑着系统 sdk 与 c++编译工具安装就行了。

但这里会冒出来一个大问题:

下不动!

网络问题,我还真没法解决。

中国的网络封锁太强,自己看情况想办法绕过去吧。

就算我这写了一点解决网络问题的方法,以现在的封锁趋势,过一段时间也就不能用了。

不过,你还是有可能下得动的,因为彻底封死网络会伤某些人的心,所以现在是采用人群分化的方法来封锁网络,顺便还能挑起人群之间的内部矛盾。

安装好编译器之后,桌面上又没快捷方式,不知道该怎么打开。

这时应该打开 windows 的搜索功能,用快捷键就能打开了,我用的是 win8.1 系统,可以用 win+s 组合键打开。

然后输入:

~~~
comm
~~~

你查字典大概是查不到这单词的,因为这是我记不住那个完整名称而记下来的简写。

全名应该是「命令行」这三个字的英文版。

你输入这单词之后会出现一堆黑框框,选「不带 x64 」的黑框框打开。

你这样打开之后,看起来它仅仅只是打开个 cmd 控制台而已,其实它调用了一堆脚本来设置各组件的环境变量。

比较可惜的是,这些它设置的环境变量它不会告诉你,这就导致很多人其实做了无用功去重复做了这些脚本已经帮他们做好的事。

到这里,编译器就准备好了。

而且它也设置了 32 位的环境。

## lua

先下载 lua 的源码:

~~~
https://www.lua.org/download.html
~~~

直接下最新版本。

顺便一说, lua5.3 有 bug ,性能也不如 lua5.4 。

下完之后,解压,会出现一大堆文件,别怕。

先在 ygopro 下建一个文件夹:

~~~
lib
~~~

现在的目录结构是:

~~~
ygopro
|——|—— lib
~~~

再建一个文件夹:

~~~
ygopro
|—— lib
|——|—— lua
~~~

把 lua 源码的 src 文件夹复制过来:

~~~
ygopro
|—— lib
|——|—— lua
|——|——|—— src
~~~

注意哦,不是光把文件复制过来就可以了,你自己本身也需要对这些源码的特性有一个基本的了解。

比如 lua 的这个源码,就需要删除两个文件:

~~~
lua.c
luac.c
~~~

这是因为这两个文件里都有主函数。

这里要特别讲一下,什么叫主函数。

主函数就是应用程序的入口函数,相当于一座城堡的大门,想进城堡旅游,就得进门,不然进不去的。

有些人学程序学四个学期了仍然不知道什么是主函数,这其实都很正常,因为各人有各人的局限性。

好了,接下来就要开始编译了。

你也许会奇怪,这不是 lua 吗?

又不是 ygopro 。

怎么现在就要开始编译了?

编译其实分两步,一步是编译,一步是连接。

我们先编译,等到了最后再进行连接。

打开之前下载的 msvc ,把它的目录转到 ygopro ,然后输入:

~~~
cl
~~~

然后应该会报错。

加个参数:

~~~
cl /c ./lib/lua/src/*.c
~~~

那个梅花号是通配符,这样子会把那个目录下的所有后缀名为「 c 」的文件都给编译了。

也许你会奇怪,这就编译完了?

原来编译这么简单。

别人都封装好了,当然简单了。

其实就这么简单的事,窗户纸不捅破,就一直<b>做不了</b>。

接下来,我们开优化:

~~~
cl /O2 /c ./lib/lua/src/*.c
~~~

代码速度慢一点,没啥大关系,还有编译器优化可以帮我们。

接下来讲点底层。

电脑里其实啥也没有,只有 01 ,我再强调一下,「 0 」、「 1 」。

那这些 01 是怎么运行的?

01 根本就运行不了,必须有东西承载着它们,而承载它们的那个东西理所应当就是计算机的底层吧?

你可以把那个东西看成是一个开关,它明显有两种状态,一种是开,一种关。

于是我们可以「把开叫做 0 ,把关叫做 1 」,也可以「把开叫做 1 ,把关叫做 0 」

但这样子,我们人与人之间就不好互相交流了,于是有些组织就给这些名字定了规范。

好了,你现在已经把 01 与实物联系起来了,懂了。

然后再把刚才的忘掉。

因为刚才这个模型虽然合理,但其实是用来描述继电器的。

计算机内部使用的是半导体——它会有一个高电平,一个低电平。

于是我们可以像把开关的开关状态与 01 联系起来一样,把半导体的电平高低状态与 01 联系起来。

这个所谓的电平具体是指啥,我已经忘了,不过总不外乎是「电压」、「电流」这些与电相关的量度。

你小时候家里经常停电吗?

如果有过停电或电烧电器的经历,那么应该会有「电不稳定」的印象。

电平受制于电的不稳定,所以它是不精确的。

电平是低于某个临界点,就属于低电平,高于某个临界点,就属于高电平。

这个临界点是人定的。

接下来,不讲底层了。

01 往上可以组建逻辑门,而汇编编程语言可以指导逻辑门的运行。

但问题在于各个商家给逻辑门定的汇编语言是不一样的,于是我们需要一个通用的汇编语言,而这就是 c 语言的别称——「便携式汇编语言」。

一门编程语言可以大致分为三部分:

语法、标准库、自定义库。

lua 会用到 c 语言的标准库,而我们从上面的过程可以看到系统肯定会有 c 语言标准库。

加个参数:

~~~
cl /MD /O2 /c ./lib/lua/src/*.c
~~~

这样子, lua 就会采用系统自带的 c 语言标准库了。

但仅仅是这样子还不行,因为 ygopro 不是一个纯 c 语言的项目。

这里的 lua 需要采用 cpp ,也就是 c++的方式进行编译:

~~~
cl /TP /MD /O2 /c ./lib/lua/src/*.c
~~~

然后由于 cpp 的特性,你会收到一堆报错,此时编译器会提醒你再加个参数:

~~~
cl /EHsc /TP /MD /O2 /c ./lib/lua/src/*.c
~~~

好,大功告成,这就算把 lua 编译完了。

不过,这时候,你的目录下会有一大堆的 obj 文件,不好看。

于是输入:

~~~
lib /OUT:lua.lib *.obj
~~~

这就把所有的 obj 文件合成了一个文件了。

所以可以把 obj 文件全部删了:

~~~
del *.obj
~~~

也就是说,我们由一堆文件中编译出了一个文件:

~~~
lua.lib
~~~

## sqlite3

接下来,我们需要下载一个很厉害的软件,作者是理查德·希普。

这一回应该不会遇到网络问题了:

~~~
https://www.sqlite.org/index.html
~~~

虽然,这一回我们不会再遇到网络问题,但可能会遇到这个网站的质疑:

你到底是不是<b>人</b>?

这是因为有些中国人恶意进攻这个网站,于是理查德专门把防范机器人的机制加强了。

把解压后的目录复制过来:

~~~
ygopro
|—— lib
|——|—— lua
|——|——|—— src
|——|—— sqlite3
~~~

然后编译:

~~~
cl /MD /O2 /c ./lib/sqlite3/*.c
~~~

然后再连接与清理一下即可。

其实 sqlite3 非常强,但是 ygopro 并没有对它擅加利用,这一点也体现在,你看这次的编译非常简单吧。

编译简单是因为没有设置那些解放 sqlite3 力量的宏。

## freetype

下载:

~~~
http://www.freetype.org
~~~

目录结构:

~~~
ygopro
|—— lib
|——|—— lua
|——|——|—— src
|——|—— sqlite3
|——|—— freetype
|——|——|—— src
|——|——|—— include
|——|——|—— builds
~~~

编译:

~~~
cl /MD /O2 /c /D FT2_BUILD_LIBRARY -I ./lib/freetype/include
~~~

可以发现,上面添加了头文件所在的文件夹。

但奇怪的是,怎么没看到 c 文件?

因为这一次要编译的文件太多了:

~~~
str["freetype_文件表"] = {

"src/autofit/autofit.c"
, "src/base/ftbase.c"
, "src/base/ftbbox.c"
, "src/base/ftbdf.c"
, "src/base/ftbitmap.c"
, "src/base/ftcid.c"
, "src/base/ftfstype.c"
, "src/base/ftgasp.c"
, "src/base/ftglyph.c"
, "src/base/ftgxval.c"
, "src/base/ftinit.c"
, "src/base/ftmm.c"
, "src/base/ftotval.c"
, "src/base/ftpatent.c"
, "src/base/ftpfr.c"
, "src/base/ftstroke.c"
, "src/base/ftsynth.c"
, "src/base/fttype1.c"
, "src/base/ftwinfnt.c"
, "src/bdf/bdf.c"
, "src/cache/ftcache.c"
, "src/cff/cff.c"
, "src/cid/type1cid.c"
, "src/gzip/ftgzip.c"
, "src/lzw/ftlzw.c"
, "src/pcf/pcf.c"
, "src/pfr/pfr.c"
, "src/psaux/psaux.c"
, "src/pshinter/pshinter.c"
, "src/psnames/psmodule.c"
, "src/raster/raster.c"
, "src/sfnt/sfnt.c"
, "src/sdf/sdf.c"
, "src/smooth/smooth.c"
, "src/truetype/truetype.c"
, "src/type1/type1.c"
, "src/type42/type42.c"
, "src/winfonts/winfnt.c"
, "src/svg/ftsvg.c"
, "builds/windows/ftsystem.c"
, "builds/windows/ftdebug.c"
}
~~~

## 细节

大致的流程基本讲清了,接下来就是细节:

~~~
local str = {}
local fun = {}

local coroutine = _G.coroutine
local debug = _G.debug
local io = _G.io
local math = _G.math
local os = _G.os
local package = _G.package
local string = _G.string
local table = _G.table

local lfs = _G.lfs

--底层--------------------

fun["lua_预处理"] = function() --{
  
  str["lua_目录"] = lfs.currentdir() .. "/lib/lua/src"
  
  os.remove(str["lua_目录"] .. "/lua.c")
  
  os.remove(str["lua_目录"] .. "/luac.c")
  
  os.remove(str["lua_目录"] .. "/Makefile")
  
  str["lua_编译参数"] = "cl "
  .. "/MD "
  .. "/O2 "
  .. "/c "
  .. "/TP "
  .. "/EHsc "
  
  end --}
  
fun["lua_编译"] = function() --{
  
  os.execute(str["lua_编译参数"] .. "./lib/lua/src/*.c")
  
  os.execute("lib /OUT:lua.lib *.obj")
  
  end --}
  
fun["lua_清理"] = function() --{
  
  os.execute("del *.obj")
  
  end --}
  
fun["sqlite3_预处理"] = function() --{
  
  str["sqlite3_编译参数"] = "cl "
  .. "/MD "
  .. "/O2 "
  .. "/c "
  
  end --}
  
fun["sqlite3_编译"] = function() --{
  
  os.execute(str["sqlite3_编译参数"] .. "./lib/sqlite3/*.c")
  
  os.execute("lib /OUT:sqlite3.lib *.obj")
  
  end --}
  
fun["sqlite3_清理"] = function() --{
  
  os.execute("del *.obj")
  
  end --}
  
fun["freetype_预处理"] = function() --{
  
  str["freetype_编译参数"] = "cl "
  .. "/MD "
  .. "/O2 "
  .. "/c "
  .. "/wd 4819 "
  .. "/D FT2_BUILD_LIBRARY "
  .. "-I " .. lfs.currentdir() .. "/lib/freetype/include "
  
  str["freetype_文件表"] = {
    
    "src/autofit/autofit.c"
    , "src/base/ftbase.c"
    , "src/base/ftbbox.c"
    , "src/base/ftbdf.c"
    , "src/base/ftbitmap.c"
    , "src/base/ftcid.c"
    , "src/base/ftfstype.c"
    , "src/base/ftgasp.c"
    , "src/base/ftglyph.c"
    , "src/base/ftgxval.c"
    , "src/base/ftinit.c"
    , "src/base/ftmm.c"
    , "src/base/ftotval.c"
    , "src/base/ftpatent.c"
    , "src/base/ftpfr.c"
    , "src/base/ftstroke.c"
    , "src/base/ftsynth.c"
    , "src/base/fttype1.c"
    , "src/base/ftwinfnt.c"
    , "src/bdf/bdf.c"
    , "src/cache/ftcache.c"
    , "src/cff/cff.c"
    , "src/cid/type1cid.c"
    , "src/gzip/ftgzip.c"
    , "src/lzw/ftlzw.c"
    , "src/pcf/pcf.c"
    , "src/pfr/pfr.c"
    , "src/psaux/psaux.c"
    , "src/pshinter/pshinter.c"
    , "src/psnames/psmodule.c"
    , "src/raster/raster.c"
    , "src/sfnt/sfnt.c"
    , "src/sdf/sdf.c"
    , "src/smooth/smooth.c"
    , "src/truetype/truetype.c"
    , "src/type1/type1.c"
    , "src/type42/type42.c"
    , "src/winfonts/winfnt.c"
    , "src/svg/ftsvg.c"
    , "builds/windows/ftsystem.c"
    , "builds/windows/ftdebug.c"
    }
    
  end --}
  
fun["freetype_编译"] = function() --{
  
  for i = 1, #str["freetype_文件表"] do --{
    
    os.execute(str["freetype_编译参数"]
    .. "./lib/freetype/"
    .. str["freetype_文件表"][i])
    
    end --}
    
  os.execute("lib /OUT:freetype.lib *.obj")
  
  end --}
  
fun["freetype_清理"] = function() --{
  
  os.execute("del *.obj")
  
  end --}
  
fun["libevent_预处理"] = function() --{
  
  str["libevent_编译参数"] = "cl "
  .. "/MD "
  .. "/O2 "
  .. "/c "
  .. "/D EVENT__HAVE_STDINT_H "
  .. "-I " .. lfs.currentdir() .. "/lib/event/include "
  .. "-I " .. lfs.currentdir() .. "/lib/event/compat "
  
  str["libevent_文件移动参数"] = "robocopy "
  .. lfs.currentdir() .. "/lib/event/WIN32-Code/nmake "
  .. lfs.currentdir() .. "/lib/event/include "
  .. "/xx "
  .. "/E "
  
  str["libevent_文件表"] = {
    
    "event.c"
    , "evthread.c"
    , "buffer.c"
    , "bufferevent.c"
    , "bufferevent_sock.c"
    , "bufferevent_filter.c"
    , "bufferevent_pair.c"
    , "listener.c"
    , "bufferevent_ratelim.c"
    , "evmap.c"
    , "log.c"
    , "evutil.c"
    , "evutil_rand.c"
    , "evutil_time.c"
    , "strlcpy.c"
    , "signal.c"
    , "event_tagging.c"
    , "http.c"
    , "evdns.c"
    , "evrpc.c"
    , "win32select.c"
    , "evthread_win32.c"
    , "buffer_iocp.c"
    , "event_iocp.c"
    , "bufferevent_async.c"
    , "WIN32-Code/getopt_long.c"
    , "WIN32-Code/getopt.c"
    }
    
  end --}
  
fun["libevent_编译"] = function() --{
  
  os.execute(str["libevent_文件移动参数"])
  
  for i = 1, #str["libevent_文件表"] do --{
    
    os.execute(str["libevent_编译参数"]
    .. "./lib/event/"
    .. str["libevent_文件表"][i])
    
    end --}
    
  os.execute("lib /OUT:event.lib *.obj")
  
  end --}
  
fun["libevent_清理"] = function() --{
  
  os.execute("del *.obj")
  
  end --}
  
fun["irrlicht_预处理"] = function() --{
  
  str["irrlicht_编译参数"] = "cl "
  .. "/MD "
  .. "/O2 "
  .. "/c "
  .. "/wd 4819 "
  .. "/EHsc "
  .. "/D UNICODE "
  .. "/D _IRR_STATIC_LIB_ "
  .. "/D _IRR_WCHAR_FILESYSTEM "
  .. "/D NO_IRR_COMPILE_WITH_DIRECT3D_9_ "
  .. "/D NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ "
  .. "-I " .. lfs.currentdir() .. "/lib/irrlicht/include "
  .. "-I " .. lfs.currentdir() .. "/lib/irrlicht/source/Irrlicht "
  .. "-I " .. lfs.currentdir() .. "/lib/irrlicht/source/Irrlicht/jpeglib "
  .. "-I " .. lfs.currentdir() .. "/lib/irrlicht/source/Irrlicht/libpng "
  .. "-I " .. lfs.currentdir() .. "/lib/irrlicht/source/Irrlicht/zlib "
  
  str["irrlicht_文件表"] = {
    
    "source/Irrlicht/CCgMaterialRenderer.cpp"
    , "source/Irrlicht/CD3D9CgMaterialRenderer.cpp"
    , "source/Irrlicht/CDefaultSceneNodeAnimatorFactory.cpp"
    , "source/Irrlicht/CDefaultSceneNodeFactory.cpp"
    , "source/Irrlicht/CGeometryCreator.cpp"
    , "source/Irrlicht/CMeshCache.cpp"
    , "source/Irrlicht/CMeshManipulator.cpp"
    , "source/Irrlicht/COpenGLCgMaterialRenderer.cpp"
    , "source/Irrlicht/CSceneManager.cpp"
    , "source/Irrlicht/C3DSMeshFileLoader.cpp"
    , "source/Irrlicht/CSMFMeshFileLoader.cpp"
    , "source/Irrlicht/CAnimatedMeshHalfLife.cpp"
    , "source/Irrlicht/CAnimatedMeshMD2.cpp"
    , "source/Irrlicht/CAnimatedMeshMD3.cpp"
    , "source/Irrlicht/CB3DMeshFileLoader.cpp"
    , "source/Irrlicht/CBSPMeshFileLoader.cpp"
    , "source/Irrlicht/CColladaFileLoader.cpp"
    , "source/Irrlicht/CCSMLoader.cpp"
    , "source/Irrlicht/CDMFLoader.cpp"
    , "source/Irrlicht/CIrrMeshFileLoader.cpp"
    , "source/Irrlicht/CLMTSMeshFileLoader.cpp"
    , "source/Irrlicht/CLWOMeshFileLoader.cpp"
    , "source/Irrlicht/CMD2MeshFileLoader.cpp"
    , "source/Irrlicht/CMD3MeshFileLoader.cpp"
    , "source/Irrlicht/CMS3DMeshFileLoader.cpp"
    , "source/Irrlicht/CMY3DMeshFileLoader.cpp"
    , "source/Irrlicht/COBJMeshFileLoader.cpp"
    , "source/Irrlicht/COCTLoader.cpp"
    , "source/Irrlicht/COgreMeshFileLoader.cpp"
    , "source/Irrlicht/CPLYMeshFileLoader.cpp"
    , "source/Irrlicht/CQ3LevelMesh.cpp"
    , "source/Irrlicht/CSkinnedMesh.cpp"
    , "source/Irrlicht/CSTLMeshFileLoader.cpp"
    , "source/Irrlicht/CXMeshFileLoader.cpp"
    , "source/Irrlicht/CAnimatedMeshSceneNode.cpp"
    , "source/Irrlicht/CBillboardSceneNode.cpp"
    , "source/Irrlicht/CBoneSceneNode.cpp"
    , "source/Irrlicht/CCameraSceneNode.cpp"
    , "source/Irrlicht/CCubeSceneNode.cpp"
    , "source/Irrlicht/CDummyTransformationSceneNode.cpp"
    , "source/Irrlicht/CEmptySceneNode.cpp"
    , "source/Irrlicht/CLightSceneNode.cpp"
    , "source/Irrlicht/CMeshSceneNode.cpp"
    , "source/Irrlicht/COctreeSceneNode.cpp"
    , "source/Irrlicht/CQuake3ShaderSceneNode.cpp"
    , "source/Irrlicht/CShadowVolumeSceneNode.cpp"
    , "source/Irrlicht/CSkyBoxSceneNode.cpp"
    , "source/Irrlicht/CSkyDomeSceneNode.cpp"
    , "source/Irrlicht/CSphereSceneNode.cpp"
    , "source/Irrlicht/CTerrainSceneNode.cpp"
    , "source/Irrlicht/CTextSceneNode.cpp"
    , "source/Irrlicht/CVolumeLightSceneNode.cpp"
    , "source/Irrlicht/CWaterSurfaceSceneNode.cpp"
    , "source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp"
    , "source/Irrlicht/CParticleAttractionAffector.cpp"
    , "source/Irrlicht/CParticleBoxEmitter.cpp"
    , "source/Irrlicht/CParticleCylinderEmitter.cpp"
    , "source/Irrlicht/CParticleFadeOutAffector.cpp"
    , "source/Irrlicht/CParticleGravityAffector.cpp"
    , "source/Irrlicht/CParticleMeshEmitter.cpp"
    , "source/Irrlicht/CParticlePointEmitter.cpp"
    , "source/Irrlicht/CParticleRingEmitter.cpp"
    , "source/Irrlicht/CParticleRotationAffector.cpp"
    , "source/Irrlicht/CParticleScaleAffector.cpp"
    , "source/Irrlicht/CParticleSphereEmitter.cpp"
    , "source/Irrlicht/CParticleSystemSceneNode.cpp"
    , "source/Irrlicht/CMetaTriangleSelector.cpp"
    , "source/Irrlicht/COctreeTriangleSelector.cpp"
    , "source/Irrlicht/CSceneCollisionManager.cpp"
    , "source/Irrlicht/CTerrainTriangleSelector.cpp"
    , "source/Irrlicht/CTriangleBBSelector.cpp"
    , "source/Irrlicht/CTriangleSelector.cpp"
    , "source/Irrlicht/CSceneLoaderIrr.cpp"
    , "source/Irrlicht/CSceneNodeAnimatorCameraFPS.cpp"
    , "source/Irrlicht/CSceneNodeAnimatorCameraMaya.cpp"
    , "source/Irrlicht/CSceneNodeAnimatorCollisionResponse.cpp"
    , "source/Irrlicht/CSceneNodeAnimatorDelete.cpp"
    , "source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp"
    , "source/Irrlicht/CSceneNodeAnimatorFlyStraight.cpp"
    , "source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp"
    , "source/Irrlicht/CSceneNodeAnimatorRotation.cpp"
    , "source/Irrlicht/CSceneNodeAnimatorTexture.cpp"
    , "source/Irrlicht/CColladaMeshWriter.cpp"
    , "source/Irrlicht/CIrrMeshWriter.cpp"
    , "source/Irrlicht/COBJMeshWriter.cpp"
    , "source/Irrlicht/CPLYMeshWriter.cpp"
    , "source/Irrlicht/CSTLMeshWriter.cpp"
    , "source/Irrlicht/CVideoModeList.cpp"
    , "source/Irrlicht/CSoftwareDriver.cpp"
    , "source/Irrlicht/CSoftwareTexture.cpp"
    , "source/Irrlicht/CTRFlat.cpp"
    , "source/Irrlicht/CTRFlatWire.cpp"
    , "source/Irrlicht/CTRGouraud.cpp"
    , "source/Irrlicht/CTRGouraudWire.cpp"
    , "source/Irrlicht/CTRTextureFlat.cpp"
    , "source/Irrlicht/CTRTextureFlatWire.cpp"
    , "source/Irrlicht/CTRTextureGouraud.cpp"
    , "source/Irrlicht/CTRTextureGouraudAdd.cpp"
    , "source/Irrlicht/CTRTextureGouraudNoZ.cpp"
    , "source/Irrlicht/CTRTextureGouraudWire.cpp"
    , "source/Irrlicht/CZBuffer.cpp"
    , "source/Irrlicht/COpenGLDriver.cpp"
    , "source/Irrlicht/COpenGLExtensionHandler.cpp"
    , "source/Irrlicht/COpenGLNormalMapRenderer.cpp"
    , "source/Irrlicht/COpenGLParallaxMapRenderer.cpp"
    , "source/Irrlicht/COpenGLShaderMaterialRenderer.cpp"
    , "source/Irrlicht/COpenGLSLMaterialRenderer.cpp"
    , "source/Irrlicht/COpenGLTexture.cpp"
    , "source/Irrlicht/CD3D8Driver.cpp"
    , "source/Irrlicht/CD3D8NormalMapRenderer.cpp"
    , "source/Irrlicht/CD3D8ParallaxMapRenderer.cpp"
    , "source/Irrlicht/CD3D8ShaderMaterialRenderer.cpp"
    , "source/Irrlicht/CD3D8Texture.cpp"
    , "source/Irrlicht/CColorConverter.cpp"
    , "source/Irrlicht/CFPSCounter.cpp"
    , "source/Irrlicht/CImage.cpp"
    , "source/Irrlicht/CNullDriver.cpp"
    , "source/Irrlicht/CImageWriterBMP.cpp"
    , "source/Irrlicht/CImageWriterJPG.cpp"
    , "source/Irrlicht/CImageWriterPCX.cpp"
    , "source/Irrlicht/CImageWriterPNG.cpp"
    , "source/Irrlicht/CImageWriterPPM.cpp"
    , "source/Irrlicht/CImageWriterPSD.cpp"
    , "source/Irrlicht/CImageWriterTGA.cpp"
    , "source/Irrlicht/CImageLoaderBMP.cpp"
    , "source/Irrlicht/CImageLoaderDDS.cpp"
    , "source/Irrlicht/CImageLoaderJPG.cpp"
    , "source/Irrlicht/CImageLoaderPCX.cpp"
    , "source/Irrlicht/CImageLoaderPNG.cpp"
    , "source/Irrlicht/CImageLoaderPPM.cpp"
    , "source/Irrlicht/CImageLoaderPSD.cpp"
    , "source/Irrlicht/CImageLoaderRGB.cpp"
    , "source/Irrlicht/CImageLoaderTGA.cpp"
    , "source/Irrlicht/CImageLoaderWAL.cpp"
    , "source/Irrlicht/CD3D9Driver.cpp"
    , "source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp"
    , "source/Irrlicht/CD3D9NormalMapRenderer.cpp"
    , "source/Irrlicht/CD3D9ParallaxMapRenderer.cpp"
    , "source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp"
    , "source/Irrlicht/CD3D9Texture.cpp"
    , "source/Irrlicht/CBurningShader_Raster_Reference.cpp"
    , "source/Irrlicht/CDepthBuffer.cpp"
    , "source/Irrlicht/CSoftwareDriver2.cpp"
    , "source/Irrlicht/CSoftwareTexture2.cpp"
    , "source/Irrlicht/CTRGouraud2.cpp"
    , "source/Irrlicht/CTRGouraudAlpha2.cpp"
    , "source/Irrlicht/CTRGouraudAlphaNoZ2.cpp"
    , "source/Irrlicht/CTRNormalMap.cpp"
    , "source/Irrlicht/CTRStencilShadow.cpp"
    , "source/Irrlicht/CTRTextureBlend.cpp"
    , "source/Irrlicht/CTRTextureDetailMap2.cpp"
    , "source/Irrlicht/CTRTextureGouraud2.cpp"
    , "source/Irrlicht/CTRTextureGouraudAdd2.cpp"
    , "source/Irrlicht/CTRTextureGouraudAddNoZ2.cpp"
    , "source/Irrlicht/CTRTextureGouraudAlpha.cpp"
    , "source/Irrlicht/CTRTextureGouraudAlphaNoZ.cpp"
    , "source/Irrlicht/CTRTextureGouraudNoZ2.cpp"
    , "source/Irrlicht/CTRTextureGouraudVertexAlpha2.cpp"
    , "source/Irrlicht/CTRTextureLightMap2_Add.cpp"
    , "source/Irrlicht/CTRTextureLightMap2_M1.cpp"
    , "source/Irrlicht/CTRTextureLightMap2_M2.cpp"
    , "source/Irrlicht/CTRTextureLightMap2_M4.cpp"
    , "source/Irrlicht/CTRTextureLightMapGouraud2_M4.cpp"
    , "source/Irrlicht/CTRTextureWire2.cpp"
    , "source/Irrlicht/IBurningShader.cpp"
    , "source/Irrlicht/CLogger.cpp"
    , "source/Irrlicht/COSOperator.cpp"
    , "source/Irrlicht/Irrlicht.cpp"
    , "source/Irrlicht/os.cpp"
    , "source/Irrlicht/lzma/LzmaDec.c"
    , "source/Irrlicht/zlib/adler32.c"
    , "source/Irrlicht/zlib/compress.c"
    , "source/Irrlicht/zlib/crc32.c"
    , "source/Irrlicht/zlib/deflate.c"
    , "source/Irrlicht/zlib/inffast.c"
    , "source/Irrlicht/zlib/inflate.c"
    , "source/Irrlicht/zlib/inftrees.c"
    , "source/Irrlicht/zlib/trees.c"
    , "source/Irrlicht/zlib/uncompr.c"
    , "source/Irrlicht/zlib/zutil.c"
    , "source/Irrlicht/jpeglib/jaricom.c"
    , "source/Irrlicht/jpeglib/jcapimin.c"
    , "source/Irrlicht/jpeglib/jcapistd.c"
    , "source/Irrlicht/jpeglib/jcarith.c"
    , "source/Irrlicht/jpeglib/jccoefct.c"
    , "source/Irrlicht/jpeglib/jccolor.c"
    , "source/Irrlicht/jpeglib/jcdctmgr.c"
    , "source/Irrlicht/jpeglib/jchuff.c"
    , "source/Irrlicht/jpeglib/jcinit.c"
    , "source/Irrlicht/jpeglib/jcmainct.c"
    , "source/Irrlicht/jpeglib/jcmarker.c"
    , "source/Irrlicht/jpeglib/jcmaster.c"
    , "source/Irrlicht/jpeglib/jcomapi.c"
    , "source/Irrlicht/jpeglib/jcparam.c"
    , "source/Irrlicht/jpeglib/jcprepct.c"
    , "source/Irrlicht/jpeglib/jcsample.c"
    , "source/Irrlicht/jpeglib/jctrans.c"
    , "source/Irrlicht/jpeglib/jdapimin.c"
    , "source/Irrlicht/jpeglib/jdapistd.c"
    , "source/Irrlicht/jpeglib/jdarith.c"
    , "source/Irrlicht/jpeglib/jdatadst.c"
    , "source/Irrlicht/jpeglib/jdatasrc.c"
    , "source/Irrlicht/jpeglib/jdcoefct.c"
    , "source/Irrlicht/jpeglib/jdcolor.c"
    , "source/Irrlicht/jpeglib/jddctmgr.c"
    , "source/Irrlicht/jpeglib/jdhuff.c"
    , "source/Irrlicht/jpeglib/jdinput.c"
    , "source/Irrlicht/jpeglib/jdmainct.c"
    , "source/Irrlicht/jpeglib/jdmarker.c"
    , "source/Irrlicht/jpeglib/jdmaster.c"
    , "source/Irrlicht/jpeglib/jdmerge.c"
    , "source/Irrlicht/jpeglib/jdpostct.c"
    , "source/Irrlicht/jpeglib/jdsample.c"
    , "source/Irrlicht/jpeglib/jdtrans.c"
    , "source/Irrlicht/jpeglib/jerror.c"
    , "source/Irrlicht/jpeglib/jfdctflt.c"
    , "source/Irrlicht/jpeglib/jfdctfst.c"
    , "source/Irrlicht/jpeglib/jfdctint.c"
    , "source/Irrlicht/jpeglib/jidctflt.c"
    , "source/Irrlicht/jpeglib/jidctfst.c"
    , "source/Irrlicht/jpeglib/jidctint.c"
    , "source/Irrlicht/jpeglib/jmemmgr.c"
    , "source/Irrlicht/jpeglib/jmemnobs.c"
    , "source/Irrlicht/jpeglib/jquant1.c"
    , "source/Irrlicht/jpeglib/jquant2.c"
    , "source/Irrlicht/jpeglib/jutils.c"
    , "source/Irrlicht/libpng/png.c"
    , "source/Irrlicht/libpng/pngerror.c"
    , "source/Irrlicht/libpng/pngget.c"
    , "source/Irrlicht/libpng/pngmem.c"
    , "source/Irrlicht/libpng/pngpread.c"
    , "source/Irrlicht/libpng/pngread.c"
    , "source/Irrlicht/libpng/pngrio.c"
    , "source/Irrlicht/libpng/pngrtran.c"
    , "source/Irrlicht/libpng/pngrutil.c"
    , "source/Irrlicht/libpng/pngset.c"
    , "source/Irrlicht/libpng/pngtrans.c"
    , "source/Irrlicht/libpng/pngwio.c"
    , "source/Irrlicht/libpng/pngwrite.c"
    , "source/Irrlicht/libpng/pngwtran.c"
    , "source/Irrlicht/libpng/pngwutil.c"
    , "source/Irrlicht/aesGladman/aescrypt.cpp"
    , "source/Irrlicht/aesGladman/aeskey.cpp"
    , "source/Irrlicht/aesGladman/aestab.cpp"
    , "source/Irrlicht/aesGladman/fileenc.cpp"
    , "source/Irrlicht/aesGladman/hmac.cpp"
    , "source/Irrlicht/aesGladman/prng.cpp"
    , "source/Irrlicht/aesGladman/pwd2key.cpp"
    , "source/Irrlicht/aesGladman/sha1.cpp"
    , "source/Irrlicht/aesGladman/sha2.cpp"
    , "source/Irrlicht/bzip2/blocksort.c"
    , "source/Irrlicht/bzip2/bzcompress.c"
    , "source/Irrlicht/bzip2/bzlib.c"
    , "source/Irrlicht/bzip2/crctable.c"
    , "source/Irrlicht/bzip2/decompress.c"
    , "source/Irrlicht/bzip2/huffman.c"
    , "source/Irrlicht/bzip2/randtable.c"
    , "source/Irrlicht/CIrrDeviceConsole.cpp"
    , "source/Irrlicht/CIrrDeviceFB.cpp"
    , "source/Irrlicht/CIrrDeviceLinux.cpp"
    , "source/Irrlicht/CIrrDeviceSDL.cpp"
    , "source/Irrlicht/CIrrDeviceStub.cpp"
    , "source/Irrlicht/CIrrDeviceWin32.cpp"
    , "source/Irrlicht/CIrrDeviceWinCE.cpp"
    , "source/Irrlicht/CAttributes.cpp"
    , "source/Irrlicht/CFileList.cpp"
    , "source/Irrlicht/CFileSystem.cpp"
    , "source/Irrlicht/CLimitReadFile.cpp"
    , "source/Irrlicht/CMemoryFile.cpp"
    , "source/Irrlicht/CMountPointReader.cpp"
    , "source/Irrlicht/CNPKReader.cpp"
    , "source/Irrlicht/CPakReader.cpp"
    , "source/Irrlicht/CReadFile.cpp"
    , "source/Irrlicht/CTarReader.cpp"
    , "source/Irrlicht/CWADReader.cpp"
    , "source/Irrlicht/CWriteFile.cpp"
    , "source/Irrlicht/CXMLReader.cpp"
    , "source/Irrlicht/CXMLWriter.cpp"
    , "source/Irrlicht/CZipReader.cpp"
    , "source/Irrlicht/irrXML.cpp"
    , "source/Irrlicht/CDefaultGUIElementFactory.cpp"
    , "source/Irrlicht/CGUIButton.cpp"
    , "source/Irrlicht/CGUICheckBox.cpp"
    , "source/Irrlicht/CGUIColorSelectDialog.cpp"
    , "source/Irrlicht/CGUIComboBox.cpp"
    , "source/Irrlicht/CGUIContextMenu.cpp"
    , "source/Irrlicht/CGUIEditBox.cpp"
    , "source/Irrlicht/CGUIEnvironment.cpp"
    , "source/Irrlicht/CGUIFileOpenDialog.cpp"
    , "source/Irrlicht/CGUIFont.cpp"
    , "source/Irrlicht/CGUIImage.cpp"
    , "source/Irrlicht/CGUIImageList.cpp"
    , "source/Irrlicht/CGUIInOutFader.cpp"
    , "source/Irrlicht/CGUIListBox.cpp"
    , "source/Irrlicht/CGUIMenu.cpp"
    , "source/Irrlicht/CGUIMeshViewer.cpp"
    , "source/Irrlicht/CGUIMessageBox.cpp"
    , "source/Irrlicht/CGUIModalScreen.cpp"
    , "source/Irrlicht/CGUIScrollBar.cpp"
    , "source/Irrlicht/CGUISkin.cpp"
    , "source/Irrlicht/CGUISpinBox.cpp"
    , "source/Irrlicht/CGUISpriteBank.cpp"
    , "source/Irrlicht/CGUIStaticText.cpp"
    , "source/Irrlicht/CGUITabControl.cpp"
    , "source/Irrlicht/CGUITable.cpp"
    , "source/Irrlicht/CGUIToolBar.cpp"
    , "source/Irrlicht/CGUITreeView.cpp"
    , "source/Irrlicht/CGUIWindow.cpp"
    }
    
  end --}
  
fun["irrlicht_编译"] = function() --{
  
  for i = 1, #str["irrlicht_文件表"] do --{
    
    os.execute(str["irrlicht_编译参数"]
    .. "./lib/irrlicht/"
    .. str["irrlicht_文件表"][i])
    
    end --}
    
  os.execute("lib /OUT:irrlicht.lib *.obj")
  
  end --}
  
fun["irrlicht_清理"] = function() --{
  
  os.execute("del *.obj")
  
  end --}
  
fun["lzma_预处理"] = function() --{
  
  str["lzma_编译参数"] = "cl "
  .. "/MD "
  .. "/O2 "
  .. "/c "
    
  end --}
  
fun["lzma_编译"] = function() --{
  
  os.execute(str["lzma_编译参数"]
  .. "./gframe/lzma/*.c")

  os.execute("lib /OUT:clzma.lib *.obj")
  
  end --}
  
fun["lzma_清理"] = function() --{
  
  os.execute("del *.obj")
  
  end --}
  
fun["spmemvfs_预处理"] = function() --{
  
  str["spmemvfs_编译参数"] = "cl "
  .. "/MD "
  .. "/O2 "
  .. "/c "
  .. "-I " .. lfs.currentdir() .. "/lib/sqlite3 "
    
  end --}
  
fun["spmemvfs_编译"] = function() --{
  
  os.execute(str["spmemvfs_编译参数"]
  .. "./gframe/spmemvfs/*.c")

  os.execute("lib /OUT:cspmemvfs.lib *.obj")
  
  end --}
  
fun["spmemvfs_清理"] = function() --{
  
  os.execute("del *.obj")
  
  end --}
  
fun["ocgcore_预处理"] = function() --{
  
  str["ocgcore_编译参数"] = "cl "
  .. "/MD "
  .. "/O2 "
  .. "/c "
  .. "/EHsc "
  .. "-I " .. lfs.currentdir() .. "/lib/lua/src "
    
  end --}
  
fun["ocgcore_编译"] = function() --{
  
  os.execute(str["ocgcore_编译参数"]
  .. "./ocgcore/*.cpp")

  os.execute("lib /OUT:ocgcore.lib *.obj")
  
  end --}
  
fun["ocgcore_清理"] = function() --{
  
  os.execute("del *.obj")
  
  end --}
  
fun["ygopro_预处理"] = function() --{
  
  str["ygopro_编译参数"] = "cl "
  .. "/MD "
  .. "/O2 "
  .. "/c "
  .. "/wd 4819 "
  .. "/EHsc "
  .. "/D _IRR_WCHAR_FILESYSTEM "
  .. "-I " .. lfs.currentdir() .. "/ocgcore "
  .. "-I " .. lfs.currentdir() .. "/lib/irrlicht/include "
  .. "-I " .. lfs.currentdir() .. "/lib/event/include "
  .. "-I " .. lfs.currentdir() .. "/lib/freetype/include "
  .. "-I " .. lfs.currentdir() .. "/lib/sqlite3 "
    
  end --}
  
fun["ygopro_编译"] = function() --{
  
  os.execute(str["ygopro_编译参数"]
  .. "./gframe/*.cpp")
  
  os.rename("gframe.obj", "gframe.o")

  os.execute("lib /OUT:ygopro.lib *.obj")
  
  end --}
  
fun["ygopro_连接"] = function() --{
  
  os.execute("link "
  .. "/OUT:ygopro.exe "
  .. "gframe.o "
  .. "ygopro.lib "
  .. "clzma.lib "
  .. "cspmemvfs.lib "
  .. "event.lib "
  .. "freetype.lib "
  .. "irrlicht.lib "
  .. "lua.lib "
  .. "ocgcore.lib "
  .. "sqlite3.lib "
  .. "gdi32.lib "
  .. "user32.lib "
  .. "kernel32.lib "
  .. "imm32.lib "
  .. "winmm.lib "
  .. "ws2_32.lib "
  .. "opengl32.lib "
  .. "shell32.lib "
  .. "iphlpapi.lib "
  .. "advapi32.lib "
  )
  
  end --}
  
fun["ygopro_清理"] = function() --{
  
  os.execute("del *.obj")
  
  os.execute("del *.o")
  
  end --}
  
--高层--------------------

fun["lua"] = function() --{
  
  fun["lua_预处理"]()
  
  fun["lua_编译"]()
  
  fun["lua_清理"]()
  
  end --}
  
fun["sqlite3"] = function() --{
  
  fun["sqlite3_预处理"]()
  
  fun["sqlite3_编译"]()
  
  fun["sqlite3_清理"]()
  
  end --}
  
fun["freetype"] = function() --{
  
  fun["freetype_预处理"]()
  
  fun["freetype_编译"]()
  
  fun["freetype_清理"]()
  
  end --}
  
fun["libevent"] = function() --{
  
  fun["libevent_预处理"]()
  
  fun["libevent_编译"]()
  
  fun["libevent_清理"]()
  
  end --}
  
fun["irrlicht"] = function() --{
  
  fun["irrlicht_预处理"]()
  
  fun["irrlicht_编译"]()
  
  fun["irrlicht_清理"]()
  
  end --}
  
fun["lzma"] = function() --{
  
  fun["lzma_预处理"]()
  
  fun["lzma_编译"]()
  
  fun["lzma_清理"]()
  
  end --}
  
fun["spmemvfs"] = function() --{
  
  fun["spmemvfs_预处理"]()
  
  fun["spmemvfs_编译"]()
  
  fun["spmemvfs_清理"]()
  
  end --}
  
fun["ocgcore"] = function() --{
  
  fun["ocgcore_预处理"]()
  
  fun["ocgcore_编译"]()
  
  fun["ocgcore_清理"]()
  
  end --}
  
fun["ygopro"] = function() --{
  
  fun["ygopro_预处理"]()
  
  fun["ygopro_编译"]()
  
  fun["ygopro_连接"]()
  
  fun["ygopro_清理"]()
  
  end --}
  
-------------------------

fun["lua"]()

fun["sqlite3"]()

fun["freetype"]()

fun["libevent"]()

fun["irrlicht"]()

fun["lzma"]()

fun["spmemvfs"]()

fun["ocgcore"]()

fun["ygopro"]()
~~~

## 缺点

这样子编译的 ygopro 还缺一些媒体资源,从你的 ygopro 中直接复制过来就行。

不支持声音,小问题。

不支持打人机卡组,小问题。

没有图标,小问题。

不支持中文输入法,大问题,不过我的输入法不受影响,哈哈。