Do some misc stuff

* Update documents partially.
* Finish basic adaptation of Virtools 2.5, 3.5, 4.0, 5.0 with both plugin and standalone version.
* Still have problem while building with Virtools 2.1 reverse SDK. Waiting upstream changes.
This commit is contained in:
yyc12345 2021-09-02 18:14:59 +08:00
parent 087a7c9b69
commit 740964f837
10 changed files with 599 additions and 60 deletions

20
Documents/COMPILE_ZH.md Normal file
View File

@ -0,0 +1,20 @@
# 编译与调试
本文档将指导您编译或调试`SuperScriptMaterializer`
## 需求
- Visual Studio 2010即VC++ v100的工具集不能使用Virtools 2015及以上版本进行编译在编译Virtools 5.0 Standalone版本的时候亲测会出错且无法解决
- Virtools SDK 或 Ballance Mod Loader如果以Virtools 2.1作为目标)
- Python 3.x
## 编译之前
编译之前您需要先进入项目根目录下在此处打开终端我们首先需要生成编译的参数。自上一个版本以来我们将编译时需要的一些参数全部转为Visual Studio可识别的宏定义在独立的`Virtools.props`中,此步操作便是生成这个文件,以确定编译文件的相关参数。
按如下格式运行指令
```
```

0
Documents/DEPLOY_ZH.md Normal file
View File

View File

@ -8,43 +8,73 @@
--- ---
## 简介
超级Virtools脚本物化器机翻确信 超级Virtools脚本物化器机翻确信
本项目分为2个部分`SuperScriptMaterializer`是一个C++工程将生成一个Virtools界面插件用于导出初步数据`SuperScriptViewer`是一个Python工程将解析导出的数据然后使用Flask提供一个本地Web界面进行脚本查看。 本项目分为4个部分
将Virtools文档中的所有脚本导出成一个SQLite数据库文件然后经过Python进行排布处理最后提供一个本地Web前端查看脚本。这同样适用于`Script Hidden`的Virtools脚本也适用于其中含有不可展开的`Behavior Graph`的脚本。 * `SuperScriptMaterializer`一个C++工程将生成一个Virtools界面插件或独立播放器用于导出初步数据。
* `SuperScriptDecorator`一个Python工程将解析导出的数据并将其组合成易于浏览的格式。
* `SuperScriptViewer`一个Python工程使用Flask提供一个本地Web界面进行脚本以供快速查看通常是用于本地快速查看解析后脚本的数据。
* `SuperScriptEnterprise`一个PHP工程相对于`SuperScriptViewer`更适合部署于服务器上进行数据的展示和浏览。
整个工程所作的事情就是将Virtools文档中的所有脚本导出成一个SQLite数据库文件然后经过Python进行排布处理最后提供一个本地Web前端查看脚本。这同样适用于`Script Hidden`的Virtools脚本也适用于其中含有不可展开的`Behavior Graph`的脚本。
物化器不能完全恢复脚本的原有排布无论原有排布是否存在物化器都将重新自动生成脚本中的各个元素的位置。某些结构的关系可能会改变例如Export parameter亦或者是与Virtools中的呈现不同但是逻辑思路将不会改变。同时物化器不能将已经生成的结构回写成Virtools可接受的格式因此物化器只能提供无视脚本隐藏的分析功能。 物化器不能完全恢复脚本的原有排布无论原有排布是否存在物化器都将重新自动生成脚本中的各个元素的位置。某些结构的关系可能会改变例如Export parameter亦或者是与Virtools中的呈现不同但是逻辑思路将不会改变。同时物化器不能将已经生成的结构回写成Virtools可接受的格式因此物化器只能提供无视脚本隐藏的分析功能。
本工程代码源于另两个工程:[BearKidsTeam/Script-Materializer](https://github.com/BearKidsTeam/Script-Materializer)该工程用于将指定脚本导出为JSON文档和[BearKidsTeam/VirtoolsScriptDeobfuscation](https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation)该工程能够在Virtools 3.5中提供内置的隐藏脚本解析功能将解析结果解析为可以被Virtools识别的格式
**注意事项** **注意事项**
* 当前最新的commit并不一定可以稳定使用请访问Release界面获取可以稳定使用的版本。 * 当前最新的commit并不一定可以稳定使用请访问Release界面获取可以稳定使用的版本。
* 如果您更换了使用的版本(包括第一个稳定版本之前的版本),则需要重新构建所有数据,因为各个版本之间的数据可能彼此不兼容。 * 如果您更换了使用的版本(包括第一个稳定版本之前的版本),则需要重新构建所有数据,因为各个版本之间的数据可能彼此不兼容。
## SuperScriptMaterializer
SuperScriptMaterializer分为两种类型一种是*插件*模式在Virtools内部作为界面插件由人手动点击菜单进行导出一般用于本地快速查看。另一种是*独立*模式使用独立的Virtools编译器加载文件并导出通过命令行参数的方式获得需要解析的文件和解析后数据库的路径一般用于编写Shell脚本批量进行脚本导出。目前我们支持的Virtools版本和模式如下
|已知的Virtools版本|插件模式|独立模式|
|:---|:---|:---|
|Virtools 2.1|× (0)|√ (1)|
|Virtools 2.5|× (2)|√|
|Virtools 3.0|× (3)|× (3)|
|Virtools 3.5|√ (4)|√ (4)|
|Virtools 4.0|√ (4)|√ (4)|
|Virtools 5.0|√|√|
0. 没有可用的Virtools Dev 2.1,因此没有插件模式
0. 使用Ballance Mod Loader提供的逆向Virtools SDK进行编译
0. Virtools SDK不支持在界面上添加菜单
0. 缺少Virtools SDK无法编译
0. 正在编写中
### 使用 ### 使用
- Virtools Dev 5.0 无论您现在要使用何种版本,您都必须先下载一份可用的,匹配的`sqlite.dll`。通常来说,我们在每一次版本发布的时候都会附带对应的`sqlite.dll`,您只需要下载即可。
- 至少Python 3.0且需要安装Flask库
- 常见浏览器除了Safari
### 编译 如果您将Virtools 2.1作为目标则由于其只有独立模式您需要准备一份Virtools 2.1的运行环境(通常而言是`CK2.dll``VxMath.dll`等一系列文件。由于Virtools 2.1并没有创作环境因此您只能从其他分发版本中获取到这个运行环境通常来说是一种游戏在您的游戏文件夹内搜索相关dll即可找到将下载好的独立模式的exe和`sqlite.dll`一起放在那里即可。
为了编译或者调试这个项目,以下工具也是必须的。 如果您选择其他Virtools版本那么很幸运它们的创作环境还能被下载到。因此如果你选择独立模式可以将下载到的exe和`sqlite.dll`一起放在Virtools创作环境的根目录下通常有一个名为`Dev.exe`的可执行程序在那里。当然如果你是要解析某个游戏的内容则可以和游戏所使用的Virtools环境放在一起。如果你选择插件模式那么请仍然将`sqlite.dll`放在Virtools创作环境的根目录下但是将下载到的dll插件文件放在名为`InterfacePlugins`的目录下
- Virtools Dev 5.0 SDK在其他版本上或许也能工作已测试Virtools 4可以无修改编译并运行 #### 插件版本
- Visual Studio 2015至少VC++ v140的工具集
## 使用方法 启动Virtools打开需要解析的文档点击菜单栏的`Super Script Materializer`-`Export all script`,保存为`export.db`然后等待Virtools提示你已经导出完成。这一步将导出所有脚本。然后同样的操作执行`Super Script Materializer`-`Export environment`,并将其保存为`env.db`。这一步将保存所有环境变量。环境变量很重要,尤其是分析脚本中的一些数据的时候。
### 基本方法 #### 独立版本
将Virtools插件投入`InterfacePlugins`目录下,将`sqlite3.dll`和`Dev.exe`放在同一目录。如果你使用了Release页面的打包文件则直接在Virtools根目录解压然后允许合并和覆盖即可。然后启动Virtools打开需要解析的文档点击菜单栏的`Super Script Materializer`-`Export all script`,保存为`export.db`然后等待Virtools提示你已经导出完成。然后同样的操作执行`Super Script Materializer`-`Export environment`,并将其保存为`env.db`。 在独立版本所在文件夹内启动命令行,按以下格式输入命令:`SuperScriptMaterializer.exe [virtools composition] [script db path] [env db path]`
将`export.db`和`env.db`与`SuperScriptViewer.py`放在一起。然后在此目录中运行`python ./SuperScriptViewer.py`等待Python交互界面提示可以打开本地的网页即可。 * `virtools composition`要导出的Virtools文档的地址
* `script db path`:导出所有脚本所用数据库的地址
* `env db path`:保存所有环境变量所用数据库的地址
`SuperScriptViewer.py`具有一些命令行开关: ## SuperScriptDecorator
### 使用
将上一步得到的`export.db`和`env.db`与`SuperScriptDecorator.py`放在一起。然后在此目录中运行`python3 ./SuperScriptDecorator.py`等待Python交互界面提示可以打开本地的网页即可。
`SuperScriptDecorator.py`具有一些命令行开关:
- `-i`:指定输入的`export.db` - `-i`:指定输入的`export.db`
- `-o`:指定输出的`decorated.db`,如果已经存在将不考虑输入,直接使用输出数据库呈现 - `-o`:指定输出的`decorated.db`,如果已经存在将不考虑输入,直接使用输出数据库呈现
@ -53,20 +83,41 @@
- `-f`:无参数,用于强制重新生成输出数据库,无论输出数据库是否存在 - `-f`:无参数,用于强制重新生成输出数据库,无论输出数据库是否存在
- `-d`:无参数,启用调试模式,直接抛出异常,而不是捕获后在控制台输出,方便调试 - `-d`:无参数,启用调试模式,直接抛出异常,而不是捕获后在控制台输出,方便调试
### 提示
以上选项在基本使用中应该不会用到,因此按上述规则直接放置好文件直接运行即可。 以上选项在基本使用中应该不会用到,因此按上述规则直接放置好文件直接运行即可。
如果Python交互界面提示数据库`TEXT`类型解码失败,或者解析的字符出现乱码,那么可能您需要手动使用`-c`开关指定数据库文本解码方式。因为Virtools使用多字节编码依赖于当前操作系统的代码页`SuperScriptDecorator`做了特殊获取以保证大多数计算机可以直接运行但仍然不能排除一些特殊情况。需要注意的是指定的编码不是你计算机当前的代码页而是制作这个Virtools文档的作者的计算机的代码页。
## SuperScriptViewer
一份指导你如何使用Viewer的文档已内置在Viewer中可以从Help页面进行查看 一份指导你如何使用Viewer的文档已内置在Viewer中可以从Help页面进行查看
### 使用注意 ## 问题反馈
- 导出插件选择完文件后弹出错误或者Python交互界面弹出错误请附带您引起bug的文件以及错误窗口的内容提交bug 以下情况可能是程序陷入了错误请附带您引起bug的文件如果可以以及错误窗口的内容提交bug
- 如果Python交互界面提示数据库`TEXT`类型解码失败,或者解析的字符出现乱码,那么可能您需要手动使用`-c`开关指定数据库文本解码方式。因为Virtools使用多字节编码依赖于当前操作系统的代码页`SuperScriptMaterializer`做了特殊获取以保证大多数计算机可以直接运行但仍然不能排除一些特殊情况。需要注意的是指定的编码不是你计算机当前的代码页而是制作这个Virtools文档的作者的计算机的代码页。
* `SuperScriptMaterializer`插件模式在选择完文件后弹出错误或长时间没有反应
* `SuperScriptMaterializer`独立模式输出了`[ERROR]`等类似内容
* Python交互界面弹出错误
## 常见场景
// todo
## 部署
参见[部署](./Documents/DEPLOY_ZH.md)
## 编译 ## 编译
参见[编译](./Documents/COMPILE_ZH.md)
<!--
只有Virtools界面插件需要编译其余均为解释性语言无需编译。 只有Virtools界面插件需要编译其余均为解释性语言无需编译。
需要手动配置Virtools插件的编译参数例如包含路径等需要指向您自己的Virtools SDK。对于SQLite SDK您可以从[sqlite.org](http://www.sqlite.org/)下载然后使用Visual C++的工具集执行`LIB /DEF:sqlite3.def /machine:IX86`以获取可以用于编译的文件。 需要手动配置Virtools插件的编译参数例如包含路径等需要指向您自己的Virtools SDK。对于SQLite SDK您可以从[sqlite.org](http://www.sqlite.org/)下载然后使用Visual C++的工具集执行`LIB /DEF:sqlite3.def /machine:IX86`以获取可以用于编译的文件。
-->
## 开发计划 ## 开发计划
@ -74,4 +125,12 @@
* 当前页面搜索和全局搜索 * 当前页面搜索和全局搜索
* Shortcut追踪 * Shortcut追踪
* 在Viewer中移动Block和BB * 在Viewer中移动Block和BB
## 特别感谢
* Dassault System提供了Virtools 2.5及其可用的SDK
* [BearKidsTeam/Script-Materializer](https://github.com/BearKidsTeam/Script-Materializer)该工程用于将指定脚本导出为JSON文档
* [BearKidsTeam/VirtoolsScriptDeobfuscation](https://github.com/BearKidsTeam/VirtoolsScriptDeobfuscation)该工程能够在Virtools 3.5中提供内置的隐藏脚本解析功能将解析结果解析为可以被Virtools识别的格式
* [Gamepiaynmo/BallanceModLoader](https://github.com/Gamepiaynmo/BallanceModLoader)该工程提供了可以用于Virtools 2.1目标编译的由逆向得到的Virtools SDK
* [phaicm](https://github.com/phaicm): 提供了许多测试文件用于修复程序Bug。以及说明文档翻译上的帮助。

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@ -16,11 +15,12 @@
<RootNamespace>SuperScriptMaterializer</RootNamespace> <RootNamespace>SuperScriptMaterializer</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PlatformToolset>v100</PlatformToolset> <PlatformToolset>v100</PlatformToolset>
<UseOfMfc>Dynamic</UseOfMfc> <UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
@ -28,19 +28,20 @@
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc> <UseOfMfc>Dynamic</UseOfMfc>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="Virtools.props" /> <Import Project="Virtools.props"/>
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="Virtools.props" /> <Import Project="Virtools.props"/>
</ImportGroup> </ImportGroup>
<ImportGroup Label="Shared"> <ImportGroup Label="Shared">
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros"/>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(VIRTOOLS_OUTPUT_PATH)</OutDir> <OutDir>$(VIRTOOLS_OUTPUT_PATH)</OutDir>
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
@ -62,10 +63,10 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>$(VIRTOOLS_HEADER_PATH);$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(VIRTOOLS_HEADER_PATH);$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);VIRTOOLS_USER_SDK;_DEBUG;$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);$(VIRTOOLS_EXTRA_MACRO);$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<DisableSpecificWarnings>4819</DisableSpecificWarnings> <DisableSpecificWarnings>4819;4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
<OutputFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)</OutputFile> <OutputFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)</OutputFile>
@ -91,9 +92,9 @@
<LanguageStandard>Default</LanguageStandard> <LanguageStandard>Default</LanguageStandard>
<AdditionalIncludeDirectories>$(VIRTOOLS_HEADER_PATH);$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(VIRTOOLS_HEADER_PATH);$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);VIRTOOLS_USER_SDK;_DEBUG;$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);$(VIRTOOLS_EXTRA_MACRO);$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<DisableSpecificWarnings>4819</DisableSpecificWarnings> <DisableSpecificWarnings>4819;4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
@ -106,25 +107,27 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="database.h" /> <ClInclude Include="database.h"/>
<ClInclude Include="env_export.h" /> <ClInclude Include="env_export.h"/>
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h"/>
<ClInclude Include="script_export.h" /> <ClInclude Include="script_export.h"/>
<ClInclude Include="vt_menu.h" /> <ClInclude Include="virtools_compatible.h"/>
<ClInclude Include="stdafx.h" /> <ClInclude Include="vt_menu.h"/>
<ClInclude Include="stdafx.h"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="database.cpp" /> <ClCompile Include="database.cpp"/>
<ClCompile Include="env_export.cpp" /> <ClCompile Include="env_export.cpp"/>
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp"/>
<ClCompile Include="script_export.cpp" /> <ClCompile Include="script_export.cpp"/>
<ClCompile Include="vt_menu.cpp" /> <ClCompile Include="virtools_compatible.cpp"/>
<ClCompile Include="vt_player.cpp" /> <ClCompile Include="vt_menu.cpp"/>
<ClCompile Include="vt_player.cpp"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="SuperScriptMaterializer.def" /> <None Include="SuperScriptMaterializer.def"/>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -33,6 +33,240 @@
<ClInclude Include="vt_menu.h"> <ClInclude Include="vt_menu.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CK2dEntity.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CK3dEntity.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKAll.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKAttributeManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKBaseManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKBehavior.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKBehaviorIO.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKBehaviorManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKBehaviorPrototype.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKBeObject.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKBitmapData.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKCamera.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKCollisionManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKContext.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKDataArray.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKDef.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKdefines2.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKDependencies.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKEnums.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKError.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKGlobals.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKGroup.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKInputManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKLevel.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKLight.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKMaterial.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKMesh.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKMessage.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKMessageManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKObject.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKObjectArray.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKObjectDeclaration.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKParameter.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKParameterIn.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKParameterManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKParameterOperation.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKPathManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKPluginManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKRenderContext.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKRenderManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKRenderObject.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKScene.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKSceneObject.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKSound.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKSoundManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKSprite.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKSprite3D.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKSpriteText.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKStateObject.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKTexture.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKTimeManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\CKTypes.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\Vx2dVector.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxAllocator.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxColor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxFrustum.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxMath.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxMathDefines.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxMatrix.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxMutex.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxPlane.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxQuaternion.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxRay.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxRect.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxSphere.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\VxVector.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XArray.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XBitArray.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XClassArray.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XHashFun.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XHashTable.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XObjectArray.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XSArray.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XSHashTable.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XSmartPtr.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XString.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="D:\BallanceModLoader\virtools\XUtil.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="virtools_compatible.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="database.cpp"> <ClCompile Include="database.cpp">
@ -53,6 +287,156 @@
<ClCompile Include="vt_player.cpp"> <ClCompile Include="vt_player.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CK2dEntity.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CK3dEntity.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKAttributeManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKBaseManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKBehavior.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKBehaviorIO.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKBehaviorManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKBehaviorPrototype.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKBeObject.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKBitmapData.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKCamera.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKCollisionManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKContext.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKDataArray.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKGlobals.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKGroup.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKInputManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKLevel.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKLight.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKMaterial.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKMesh.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKMessage.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKMessageManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKObject.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKObjectArray.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKObjectDeclaration.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKParameter.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKParameterIn.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKParameterManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKParameterOperation.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKPathManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKPluginManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKRenderContext.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKRenderManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKRenderObject.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKScene.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKSceneObject.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKSound.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKSoundManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKSprite.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKSprite3D.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKSpriteText.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKStateObject.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKTexture.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\CKTimeManager.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\VxMath.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\VxMatrix.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\VxQuaternion.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="D:\BallanceModLoader\virtools\XString.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="virtools_compatible.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="SuperScriptMaterializer.def"> <None Include="SuperScriptMaterializer.def">

View File

@ -416,7 +416,10 @@ void DigParameterData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStruc
} }
//float //float
if (t == CKPGUID_FLOAT || t == CKPGUID_ANGLE || t == CKPGUID_PERCENTAGE || t == CKPGUID_TIME if (t == CKPGUID_FLOAT || t == CKPGUID_ANGLE || t == CKPGUID_PERCENTAGE || t == CKPGUID_TIME
|| t == CKPGUID_FLOATSLIDER) { #if defined(VIRTOOLS_50) || defined(VIRTOOLS_40) || defined(VIRTOOLS_35)
|| t == CKPGUID_FLOATSLIDER
#endif
) {
helper_pDataExport("float-data", *(float*)(p->GetReadDataPtr(false)), db, helper, parents); helper_pDataExport("float-data", *(float*)(p->GetReadDataPtr(false)), db, helper, parents);
return; return;
} }
@ -469,10 +472,11 @@ void DigParameterData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStruc
return; return;
} }
if (t == CKPGUID_2DCURVE) { if (t == CKPGUID_2DCURVE) {
CK2dCurve* c; //CK2dCurve* c;
CK2dCurve* c = (CK2dCurve*)p->GetReadDataPtr(false);
char prefix[128]; char prefix[128];
int endIndex = 0; int endIndex = 0;
memcpy(&c, p->GetReadDataPtr(false), sizeof(c)); //memcpy(&c, p->GetReadDataPtr(false), sizeof(c));
for (int i = 0, cc = c->GetControlPointCount(); i < cc; ++i) { for (int i = 0, cc = c->GetControlPointCount(); i < cc; ++i) {
sprintf(prefix, "2dcurve.control_point[%d]", i); sprintf(prefix, "2dcurve.control_point[%d]", i);
endIndex = strlen(prefix); endIndex = strlen(prefix);
@ -518,7 +522,11 @@ void DigParameterData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStruc
unknowType = TRUE; unknowType = TRUE;
//if it gets here, we have no idea what it really is. so simply dump it. //if it gets here, we have no idea what it really is. so simply dump it.
//buffer-like //buffer-like
if (unknowType || t == CKPGUID_VOIDBUF || t == CKPGUID_SHADER || t == CKPGUID_TECHNIQUE || t == CKPGUID_PASS) { if (unknowType || t == CKPGUID_VOIDBUF
#if defined(VIRTOOLS_50) || defined(VIRTOOLS_40) || defined(VIRTOOLS_35)
|| t == CKPGUID_SHADER || t == CKPGUID_TECHNIQUE || t == CKPGUID_PASS
#endif
) {
//dump data //dump data
unsigned char* cptr = (unsigned char*)p->GetReadDataPtr(false); unsigned char* cptr = (unsigned char*)p->GetReadDataPtr(false);
char temp[8]; char temp[8];

View File

@ -9,4 +9,8 @@
//FILE _iob[] = { *stdin, *stdout, *stderr }; //FILE _iob[] = { *stdin, *stdout, *stderr };
//extern "C" FILE * __cdecl __iob_func(void) { return _iob; } //extern "C" FILE * __cdecl __iob_func(void) { return _iob; }
#endif #endif
//void __declspec(noreturn) FAKE_THROW() {
// throw "Unimplemented function called.";
//}

View File

@ -3,6 +3,6 @@
#include "stdafx.h" #include "stdafx.h"
//void __declspec(noreturn) FAKE_THROW();
#endif #endif

View File

@ -9,8 +9,6 @@ void PlayerMain(const char* virtools_composition, const char* script_db_path, co
printf("Homepage: https://github.com/yyc12345/SuperScriptMaterializer\n"); printf("Homepage: https://github.com/yyc12345/SuperScriptMaterializer\n");
printf("Report bug: https://github.com/yyc12345/SuperScriptMaterializer/issues\n"); printf("Report bug: https://github.com/yyc12345/SuperScriptMaterializer/issues\n");
printf("Parsing %s...\n", virtools_composition);
// ====================== init ck2 engine // ====================== init ck2 engine
CommonAssert(!CKStartUp(), "CKStartUp Error"); CommonAssert(!CKStartUp(), "CKStartUp Error");
CKPluginManager* pluginManager = CKGetPluginManager(); CKPluginManager* pluginManager = CKGetPluginManager();
@ -30,6 +28,8 @@ void PlayerMain(const char* virtools_composition, const char* script_db_path, co
#if defined(_RELEASE) #if defined(_RELEASE)
try { try {
#endif #endif
printf("Parsing %s...\n", virtools_composition);
// ====================== do database export // ====================== do database export
// define and init // define and init
scriptDatabase* _script_db = new scriptDatabase(); scriptDatabase* _script_db = new scriptDatabase();
@ -64,6 +64,8 @@ void PlayerMain(const char* virtools_composition, const char* script_db_path, co
delete _env_helper; delete _env_helper;
delete _env_db; delete _env_db;
printf("Done!");
#if defined(_RELEASE) #if defined(_RELEASE)
} catch (const std::exception & e) { } catch (const std::exception & e) {
std::string errstr; std::string errstr;
@ -76,11 +78,17 @@ void PlayerMain(const char* virtools_composition, const char* script_db_path, co
// ====================== free resources and shutdown engine // ====================== free resources and shutdown engine
DeleteCKObjectArray(array); DeleteCKObjectArray(array);
context->Reset();
context->ClearAll(); context->ClearAll();
// todo: Virtools 4.0 standalone version throw exception in there, but i don't knwo why
// but it doesn't affect database export, perhaps
CKCloseContext(context); CKCloseContext(context);
CKShutdown(); CKShutdown();
printf("Done!"); // todo: Virtools 2.5 standalone version throw exception in there, but i don't knwo why
// but it doesn't affect database export, perhaps
} }
void CommonAssert(BOOL condition, const char* desc) { void CommonAssert(BOOL condition, const char* desc) {

View File

@ -20,13 +20,28 @@ virtools_attach_ref_plugin_dict = {
"50": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib" "50": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib"
} }
virtools_attach_ref_standalone_dict = { virtools_attach_ref_standalone_dict = {
"21": "vxmath.lib;ck2.lib", "21": "",
"25": "vxmath.lib;ck2.lib", "25": "VxMath.lib;CK2.lib",
"35": "vxmath.lib;ck2.lib", "35": "vxmath.lib;ck2.lib",
"40": "vxmath.lib;ck2.lib", "40": "vxmath.lib;ck2.lib",
"50": "vxmath.lib;ck2.lib" "50": "vxmath.lib;ck2.lib"
} }
virtools_extra_macro_plugin_dict = {
"21": "",
"25": "",
"35": "_CRT_SECURE_NO_WARNINGS",
"40": "_CRT_SECURE_NO_WARNINGS",
"50": ""
}
virtools_extra_macro_standalone_dict = {
"21": "_DEBUG",
"25": "_CRT_SECURE_NO_WARNINGS;_DEBUG",
"35": "_CRT_SECURE_NO_WARNINGS;_DEBUG",
"40": "_CRT_SECURE_NO_WARNINGS;_DEBUG",
"50": "VIRTOOLS_USER_SDK;_DEBUG"
}
executable_virtools = { executable_virtools = {
"21": "Dev.exe", "21": "Dev.exe",
"25": "Dev.exe", "25": "Dev.exe",
@ -131,6 +146,7 @@ if input_build_type == build_type_plugin:
virtools_debug_target = os.path.join(input_virtools_root_path, executable_virtools[input_virtools_version]) virtools_debug_target = os.path.join(input_virtools_root_path, executable_virtools[input_virtools_version])
virtools_output_path = os.path.join(input_virtools_root_path, 'InterfacePlugins') virtools_output_path = os.path.join(input_virtools_root_path, 'InterfacePlugins')
virtools_attach_ref = virtools_attach_ref_plugin_dict[input_virtools_version] virtools_attach_ref = virtools_attach_ref_plugin_dict[input_virtools_version]
virtools_extra_macro = virtools_extra_macro_plugin_dict[input_virtools_version]
elif input_build_type == build_type_standalone: elif input_build_type == build_type_standalone:
virtools_build_type = 'VIRTOOLS_STANDALONE' virtools_build_type = 'VIRTOOLS_STANDALONE'
virtools_build_suffix = 'exe' virtools_build_suffix = 'exe'
@ -139,6 +155,7 @@ elif input_build_type == build_type_standalone:
virtools_debug_target = os.path.join(input_virtools_root_path, 'SuperScriptMaterializer.exe') virtools_debug_target = os.path.join(input_virtools_root_path, 'SuperScriptMaterializer.exe')
virtools_output_path = input_virtools_root_path virtools_output_path = input_virtools_root_path
virtools_attach_ref = virtools_attach_ref_standalone_dict[input_virtools_version] virtools_attach_ref = virtools_attach_ref_standalone_dict[input_virtools_version]
virtools_extra_macro = virtools_extra_macro_standalone_dict[input_virtools_version]
# make sure the last char of output_path is slash # make sure the last char of output_path is slash
if virtools_output_path[-1] != '\\' or virtools_output_path[-1] != '/': if virtools_output_path[-1] != '\\' or virtools_output_path[-1] != '/':
@ -147,13 +164,18 @@ if virtools_output_path[-1] != '\\' or virtools_output_path[-1] != '/':
# in virtools 2.1, we use bml, so we need add bml macro and set virtools header and virtools lib to blank # in virtools 2.1, we use bml, so we need add bml macro and set virtools header and virtools lib to blank
# because all virtools file have been imported in project # because all virtools file have been imported in project
if input_virtools_version == '21': if input_virtools_version == '21':
virtools_header_path = ''
virtools_lib_path = ''
bml_special_macro = 'BML_EXPORT=' bml_special_macro = 'BML_EXPORT='
virtools_header_path = os.path.join(input_bml_path, 'virtools')
virtools_lib_path = ''
else: else:
virtools_header_path = os.path.join(input_virtools_root_path, 'Sdk/Includes')
virtools_lib_path = os.path.join(input_virtools_root_path, 'Sdk/Lib/Win32/Release')
bml_special_macro = '' bml_special_macro = ''
if input_virtools_version == '25':
virtools_header_path = os.path.join(input_virtools_root_path, 'Virtools_SDK/Includes')
virtools_lib_path = os.path.join(input_virtools_root_path, 'Virtools_SDK/Lib')
else:
virtools_header_path = os.path.join(input_virtools_root_path, 'Sdk/Includes')
virtools_lib_path = os.path.join(input_virtools_root_path, 'Sdk/Lib/Win32/Release')
# ======================== create document # ======================== create document
@ -167,6 +189,8 @@ cache.setAttribute('Label', 'PropertySheets')
root.appendChild(cache) root.appendChild(cache)
# ======================== write build type # ======================== write build type
# due to build chain v100 shit design, this configuration onlt can be modified in .vcxproj
'''
for bt in ('Debug', 'Release'): for bt in ('Debug', 'Release'):
node_build_type = dom.createElement('PropertyGroup') node_build_type = dom.createElement('PropertyGroup')
node_build_type.setAttribute('Label', 'Configuration') node_build_type.setAttribute('Label', 'Configuration')
@ -178,6 +202,7 @@ for bt in ('Debug', 'Release'):
node_configuration_type.appendChild(dom.createTextNode('DynamicLibrary')) node_configuration_type.appendChild(dom.createTextNode('DynamicLibrary'))
node_build_type.appendChild(node_configuration_type) node_build_type.appendChild(node_configuration_type)
root.appendChild(node_build_type) root.appendChild(node_build_type)
'''
# ======================== write subsystem # ======================== write subsystem
for bt in ('Debug', 'Release'): for bt in ('Debug', 'Release'):
@ -225,6 +250,7 @@ write_macro(dom, node_property_group, node_item_group, 'BML_SPECIAL_MACRO', bml_
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_ATTACH_REF', virtools_attach_ref) write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_ATTACH_REF', virtools_attach_ref)
write_macro(dom, node_property_group, node_item_group, 'SQLITE_ATTACH_REF', sqlite_attach_ref) write_macro(dom, node_property_group, node_item_group, 'SQLITE_ATTACH_REF', sqlite_attach_ref)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_MODULE_DEFINE', virtools_module_define) write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_MODULE_DEFINE', virtools_module_define)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_EXTRA_MACRO', virtools_extra_macro)
# ======================== write extra compile # ======================== write extra compile
@ -244,4 +270,31 @@ if input_virtools_version == '21':
with open('./SuperScriptMaterializer/Virtools.props', 'w', encoding='utf-8') as f: with open('./SuperScriptMaterializer/Virtools.props', 'w', encoding='utf-8') as f:
dom.writexml(f, addindent='\t', newl='\n', encoding='utf-8') dom.writexml(f, addindent='\t', newl='\n', encoding='utf-8')
# ======================== modify .vcxproj
# due to build chain v100 shit design, this configuration onlt can be modified in .vcxproj
if input_build_type == build_type_standalone:
vcxproj_build_type = 'Application'
elif input_build_type == build_type_plugin:
vcxproj_build_type = 'DynamicLibrary'
vcxproj = minidom.parse('./SuperScriptMaterializer/SuperScriptMaterializer.vcxproj')
node_project = vcxproj.documentElement
for item in node_project.getElementsByTagName('PropertyGroup'):
attr_label = item.getAttribute('Label')
attr_condition = item.getAttribute('Condition')
if attr_label == 'Configuration' and (attr_condition == "'$(Configuration)|$(Platform)'=='Debug|Win32'" or attr_condition == "'$(Configuration)|$(Platform)'=='Release|Win32'"):
# valid node
node_cfg_type = item.getElementsByTagName('ConfigurationType')
if len(node_cfg_type) != 0:
# have node, change it
node_cfg_type[0].childNodes[0].nodeValue = vcxproj_build_type
else:
# don't have node, add one
node_cfg_type = vcxproj.createElement('ConfigurationType')
node_cfg_type.appendChild(vcxproj.createTextNode(vcxproj_build_type))
item.appendChild(node_cfg_type)
with open('./SuperScriptMaterializer/SuperScriptMaterializer.vcxproj', 'w', encoding='utf-8') as f:
vcxproj.writexml(f, encoding='utf-8')
print("OK!") print("OK!")