Update build environment

* Descending required build tools chain v142 -> v100. Actually, require Visual Studio version < Visual Studio 15(I use Visual Studio 2010).
* Add more macro for Virtools.props
* Solve build error for standalone version of Virtools 5
This commit is contained in:
yyc12345 2021-08-29 13:50:32 +08:00
parent e991ab1172
commit 087a7c9b69
15 changed files with 241 additions and 120 deletions

4
.gitignore vendored
View File

@ -3,6 +3,10 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# ignore generated Virtools.props
SuperScriptMaterializer/Virtools.props
# ignore generated database
*.db
*.db-journal

View File

@ -3,10 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29418.71
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SuperScriptMaterializer", "SuperScriptMaterializer\SuperScriptMaterializer.vcxproj", "{4D941003-020F-47FD-9FA2-FFC989E306B8}"
EndProject
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "SuperScriptViewer", "SuperScriptViewer\SuperScriptViewer.pyproj", "{6D751BF5-87D6-4123-94B3-34721938CF04}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SuperScriptMaterializer", "SuperScriptMaterializer\SuperScriptMaterializer.vcxproj", "{431163D3-86F1-4F6F-921C-062C6A4C70D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -17,22 +17,20 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|Any CPU.ActiveCfg = Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|Any CPU.Build.0 = Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x64.ActiveCfg = Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x86.ActiveCfg = Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x86.Build.0 = Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|Any CPU.ActiveCfg = Release|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|Any CPU.Build.0 = Release|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x64.ActiveCfg = Release|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x86.ActiveCfg = Release|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x86.Build.0 = Release|Win32
{6D751BF5-87D6-4123-94B3-34721938CF04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Debug|x64.ActiveCfg = Debug|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Debug|x86.ActiveCfg = Debug|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Release|x64.ActiveCfg = Release|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Release|x86.ActiveCfg = Release|Any CPU
{431163D3-86F1-4F6F-921C-062C6A4C70D9}.Debug|Any CPU.ActiveCfg = Debug|Win32
{431163D3-86F1-4F6F-921C-062C6A4C70D9}.Debug|x64.ActiveCfg = Debug|Win32
{431163D3-86F1-4F6F-921C-062C6A4C70D9}.Debug|x86.ActiveCfg = Debug|Win32
{431163D3-86F1-4F6F-921C-062C6A4C70D9}.Debug|x86.Build.0 = Debug|Win32
{431163D3-86F1-4F6F-921C-062C6A4C70D9}.Release|Any CPU.ActiveCfg = Release|Win32
{431163D3-86F1-4F6F-921C-062C6A4C70D9}.Release|x64.ActiveCfg = Release|Win32
{431163D3-86F1-4F6F-921C-062C6A4C70D9}.Release|x86.ActiveCfg = Release|Win32
{431163D3-86F1-4F6F-921C-062C6A4C70D9}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -18,13 +18,13 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v100</PlatformToolset>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v100</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
@ -62,9 +62,10 @@
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>$(VIRTOOLS_HEADER_PATH);$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);VIRTOOLS_USER_SDK;_DEBUG;$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FunctionLevelLinking>true</FunctionLevelLinking>
<DisableSpecificWarnings>4819</DisableSpecificWarnings>
</ClCompile>
<Link>
<OutputFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)</OutputFile>
@ -74,8 +75,7 @@
<AdditionalDependencies>$(VIRTOOLS_ATTACH_REF);$(SQLITE_ATTACH_REF);%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
<ModuleDefinitionFile>$(VIRTOOLS_MODULE_DEFINE)</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -91,14 +91,14 @@
<LanguageStandard>Default</LanguageStandard>
<AdditionalIncludeDirectories>$(VIRTOOLS_HEADER_PATH);$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);VIRTOOLS_USER_SDK;_DEBUG;$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<DisableSpecificWarnings>4819</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
<ModuleDefinitionFile>$(VIRTOOLS_MODULE_DEFINE)</ModuleDefinitionFile>
<OutputFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)</OutputFile>
<AdditionalLibraryDirectories>$(VIRTOOLS_LIB_PATH);$(SQLITE_LIB_PATH);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(VIRTOOLS_ATTACH_REF);$(SQLITE_ATTACH_REF);%(AdditionalDependencies)</AdditionalDependencies>
@ -119,6 +119,7 @@
<ClCompile Include="main.cpp" />
<ClCompile Include="script_export.cpp" />
<ClCompile Include="vt_menu.cpp" />
<ClCompile Include="vt_player.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="SuperScriptMaterializer.def" />

View File

@ -15,39 +15,42 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="database.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="env_export.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="script_export.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="vt_menu.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="database.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="script_export.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="env_export.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="vt_menu.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="database.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="env_export.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="script_export.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="env_export.cpp">
<ClCompile Include="vt_menu.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="vt_player.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets"/>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Label="UserMacros">
<VIRTOOLS_HEADER_PATH>E:\Virtools\Virtools Dev 5.0\Sdk/Includes</VIRTOOLS_HEADER_PATH>
<VIRTOOLS_LIB_PATH>E:\Virtools\Virtools Dev 5.0\Sdk/Lib/Win32/Release</VIRTOOLS_LIB_PATH>
<SQLITE_HEADER_PATH>D:\CppLib\SQLite\sqlite-amalgamation-3310100</SQLITE_HEADER_PATH>
<SQLITE_LIB_PATH>D:\CppLib\SQLite\sqlite-dll-win32-x86-3310100</SQLITE_LIB_PATH>
<VIRTOOLS_OUTPUT_PATH>E:\Virtools\Virtools Dev 5.0\</VIRTOOLS_OUTPUT_PATH>
<VIRTOOLS_BUILD_TYPE>VIRTOOLS_STANDALONE</VIRTOOLS_BUILD_TYPE>
<VIRTOOLS_DEBUG_TARGET>E:\Virtools\Virtools Dev 5.0\SuperScriptMaterializer.exe</VIRTOOLS_DEBUG_TARGET>
<VIRTOOLS_DEBUG_ROOT>E:\Virtools\Virtools Dev 5.0</VIRTOOLS_DEBUG_ROOT>
<VIRTOOLS_BUILD_SUFFIX>exe</VIRTOOLS_BUILD_SUFFIX>
<VIRTOOLS_VER>VIRTOOLS_50</VIRTOOLS_VER>
<BML_SPECIAL_MACRO/>
<VIRTOOLS_ATTACH_REF>vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib</VIRTOOLS_ATTACH_REF>
<SQLITE_ATTACH_REF>sqlite3.lib</SQLITE_ATTACH_REF>
</PropertyGroup>
<PropertyGroup/>
<ItemDefinitionGroup/>
<ItemGroup>
<BuildMacro Include="VIRTOOLS_HEADER_PATH">
<Value>$(VIRTOOLS_HEADER_PATH)</Value>
</BuildMacro>
<BuildMacro Include="VIRTOOLS_LIB_PATH">
<Value>$(VIRTOOLS_LIB_PATH)</Value>
</BuildMacro>
<BuildMacro Include="SQLITE_HEADER_PATH">
<Value>$(SQLITE_HEADER_PATH)</Value>
</BuildMacro>
<BuildMacro Include="SQLITE_LIB_PATH">
<Value>$(SQLITE_LIB_PATH)</Value>
</BuildMacro>
<BuildMacro Include="VIRTOOLS_OUTPUT_PATH">
<Value>$(VIRTOOLS_OUTPUT_PATH)</Value>
</BuildMacro>
<BuildMacro Include="VIRTOOLS_BUILD_TYPE">
<Value>$(VIRTOOLS_BUILD_TYPE)</Value>
</BuildMacro>
<BuildMacro Include="VIRTOOLS_DEBUG_TARGET">
<Value>$(VIRTOOLS_DEBUG_TARGET)</Value>
</BuildMacro>
<BuildMacro Include="VIRTOOLS_DEBUG_ROOT">
<Value>$(VIRTOOLS_DEBUG_ROOT)</Value>
</BuildMacro>
<BuildMacro Include="VIRTOOLS_BUILD_SUFFIX">
<Value>$(VIRTOOLS_BUILD_SUFFIX)</Value>
</BuildMacro>
<BuildMacro Include="VIRTOOLS_VER">
<Value>$(VIRTOOLS_VER)</Value>
</BuildMacro>
<BuildMacro Include="BML_SPECIAL_MACRO">
<Value>$(BML_SPECIAL_MACRO)</Value>
</BuildMacro>
<BuildMacro Include="VIRTOOLS_ATTACH_REF">
<Value>$(VIRTOOLS_ATTACH_REF)</Value>
</BuildMacro>
<BuildMacro Include="SQLITE_ATTACH_REF">
<Value>$(SQLITE_ATTACH_REF)</Value>
</BuildMacro>
</ItemGroup>
</Project>

View File

@ -75,7 +75,7 @@ void dbEnvDataStructHelper::dispose() {
void database::open(const char* file) {
db = NULL;
stmtCache = new std::vector<sqlite3_stmt*>(15, NULL);
stmtCache = new std::vector<sqlite3_stmt*>(14, NULL); // TODO: sync with tryGetStmt's count
//open db
int result;
@ -206,7 +206,7 @@ BOOL scriptDatabase::finalJob() {
}
BOOL envDatabase::init() {
stmtCache = new std::vector<sqlite3_stmt*>(5, NULL);
stmtCache = new std::vector<sqlite3_stmt*>(6, NULL); // TODO: sync with tryGetStmt's count
int result;

View File

@ -1,6 +1,8 @@
#include "stdafx.h"
#include "vt_menu.h"
#include "vt_player.h"
#if defined(VIRTOOLS_PLUGIN)
PluginInterface* s_Plugininterface = NULL;
PluginInfo g_PluginInfo0;
@ -25,18 +27,31 @@ class SuperScriptMaterializer : CWinApp {
SuperScriptMaterializer theApp;
BOOL SuperScriptMaterializer::InitInstance() {
// TODO: Add your specialized code here and/or call the base class
CWinApp::InitInstance();
strcpy(g_PluginInfo0.m_Name, "Super Script Materializer");
g_PluginInfo0.m_PluginType = PluginInfo::PT_EDITOR;
g_PluginInfo0.m_PluginType = (PluginInfo::PLUGIN_TYPE)(g_PluginInfo0.m_PluginType | PluginInfo::PTF_RECEIVENOTIFICATION);
g_PluginInfo0.m_PluginCallback = PluginCallback;
return CWinApp::InitInstance();
return TRUE;
}
int SuperScriptMaterializer::ExitInstance() {
// TODO: Add your specialized code here and/or call the base class
return CWinApp::ExitInstance();
}
#elif defined(VIRTOOLS_STANDALONE)
int main(int argc, char* argv[]) {
if (argc != 4) {
printf("Arguments too less!\n");
printf("Format: SuperScriptMaterializer.exe [virtools composition] [script db path] [env db path]\n");
ExitProcess(1);
}
PlayerMain(argv[1], argv[2], argv[3]);
return 0;
}
#endif

View File

@ -31,6 +31,9 @@
//PLUGIN PRECOMPILED HEADER INCLUDED
#include "CKAll.h"
#if defined(VIRTOOLS_PLUGIN)
#include "VIControls.h"
#include "CKControlsAll.h"
#include "VEP_ScriptActionMenu.h"
@ -38,3 +41,7 @@
#include "VEP_All.h"
using namespace CKControl;
#elif defined(VIRTOOLS_STANDALONE)
#endif

View File

@ -0,0 +1,12 @@
#include "virtools_compatible.h"
#if defined(VIRTOOLS_50) && defined(VIRTOOLS_STANDALONE)
//#define stdin (__acrt_iob_func(0))
//#define stdout (__acrt_iob_func(1))
//#define stderr (__acrt_iob_func(2))
//
//FILE _iob[] = { *stdin, *stdout, *stderr };
//extern "C" FILE * __cdecl __iob_func(void) { return _iob; }
#endif

View File

@ -0,0 +1,8 @@
#if !defined(_YYCDLL_VIRTOOLS_COMPATIBLE_H__IMPORTED_)
#define _YYCDLL_VIRTOOLS_COMPATIBLE_H__IMPORTED_
#include "stdafx.h"
#endif

View File

@ -3,6 +3,8 @@
#include "script_export.h"
#include "env_export.h"
#if defined(VIRTOOLS_PLUGIN)
extern PluginInterface* s_Plugininterface;
CMenu* s_MainMenu = NULL;
@ -177,3 +179,5 @@ BOOL OpenFileDialog(std::string* returned_file) {
free(file);
return status;
}
#endif

View File

@ -1,6 +1,7 @@
#if !defined(_YYCDLL_VT_MENU_H__IMPORTED_)
#define _YYCDLL_VT_MENU_H__IMPORTED_
#if defined(VIRTOOLS_PLUGIN)
#include "stdafx.h"
#include "database.h"
@ -12,5 +13,6 @@ void UpdateMenu();
void PluginMenuCallback(int commandID);
BOOL OpenFileDialog(std::string* returned_file);
#endif
#endif

View File

@ -0,0 +1,93 @@
#include "vt_player.h"
#include "script_export.h"
#include "env_export.h"
#if defined(VIRTOOLS_STANDALONE)
void PlayerMain(const char* virtools_composition, const char* script_db_path, const char* env_db_path) {
printf("Super Script Materializer\n");
printf("Homepage: https://github.com/yyc12345/SuperScriptMaterializer\n");
printf("Report bug: https://github.com/yyc12345/SuperScriptMaterializer/issues\n");
printf("Parsing %s...\n", virtools_composition);
// ====================== init ck2 engine
CommonAssert(!CKStartUp(), "CKStartUp Error");
CKPluginManager* pluginManager = CKGetPluginManager();
CommonAssert(pluginManager != NULL, "PluginManager = null");
CommonAssert(pluginManager->ParsePlugins("RenderEngines") > 0, "Error loading RenderEngines");
CommonAssert(pluginManager->ParsePlugins("Managers") > 0, "Error loading Managers");
CommonAssert(pluginManager->ParsePlugins("BuildingBlocks") > 0, "Error loading BuildingBlocks");
CommonAssert(pluginManager->ParsePlugins("Plugins") > 0, "Error loading Plugins");
// ====================== create context and load file
CKContext* context = NULL;
CommonAssert(!CKCreateContext(&context, NULL), "CKCreateContext Error");
CKObjectArray* array = CreateCKObjectArray();
CommonAssert(!context->Load((char*)virtools_composition, array), "CKContext->Load() Error");
#if defined(_RELEASE)
try {
#endif
// ====================== do database export
// define and init
scriptDatabase* _script_db = new scriptDatabase();
dbScriptDataStructHelper* _script_helper = new dbScriptDataStructHelper();
envDatabase* _env_db = new envDatabase();
dbEnvDataStructHelper* _env_helper = new dbEnvDataStructHelper();
DeleteFile(script_db_path);
DeleteFile(env_db_path);
_script_db->open(script_db_path);
_script_helper->init(context->GetParameterManager());
_env_db->open(env_db_path);
_env_helper->init();
// export
IterateScript(context, _script_db, _script_helper);
IterateParameterOperation(context->GetParameterManager(), _env_db, _env_helper);
IterateParameter(context->GetParameterManager(), _env_db, _env_helper);
IterateMessage(context->GetMessageManager(), _env_db, _env_helper);
IterateAttribute(context->GetAttributeManager(), _env_db, _env_helper);
IteratePlugin(CKGetPluginManager(), _env_db, _env_helper);
IterateVariable(context->GetVariableManager(), _env_db, _env_helper);
// free
_script_helper->dispose();
_script_db->close();
_env_helper->dispose();
_env_db->close();
delete _script_helper;
delete _script_db;
delete _env_helper;
delete _env_db;
#if defined(_RELEASE)
} catch (const std::exception & e) {
std::string errstr;
errstr = "An error occurs, application will exit. Please report to developer with this window and reproduce step.\nError message: ";
errstr += e.what();
printf("[ERROR] %s", errstr.c_str());
ExitProcess(1);
}
#endif
// ====================== free resources and shutdown engine
DeleteCKObjectArray(array);
context->ClearAll();
CKCloseContext(context);
CKShutdown();
printf("Done!");
}
void CommonAssert(BOOL condition, const char* desc) {
if (!condition) {
printf("[ERROR] %s\n", desc);
ExitProcess(1);
}
}
#endif

View File

@ -0,0 +1,13 @@
#if !defined(_YYCDLL_VT_PLAYER_H__IMPORTED_)
#define _YYCDLL_VT_PLAYER_H__IMPORTED_
#if defined(VIRTOOLS_STANDALONE)
#include "stdafx.h"
#include "database.h"
void PlayerMain(const char* virtools_composition, const char* script_db_path, const char* env_db_path);
void CommonAssert(BOOL condition, const char* desc);
#endif
#endif

View File

@ -5,8 +5,6 @@ import sys
# ======================== const define
program_name = "SuperScriptMaterializer"
build_type_standalone = "standalone"
build_type_plugin = "plugin"
valid_build_type = (
@ -14,13 +12,20 @@ valid_build_type = (
build_type_plugin
)
virtools_attach_ref_dict = {
virtools_attach_ref_plugin_dict = {
"21": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"25": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"35": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"40": "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 = {
"21": "vxmath.lib;ck2.lib",
"25": "vxmath.lib;ck2.lib",
"35": "vxmath.lib;ck2.lib",
"40": "vxmath.lib;ck2.lib",
"50": "vxmath.lib;ck2.lib"
}
executable_virtools = {
"21": "Dev.exe",
@ -117,27 +122,32 @@ sqlite_attach_ref = input_sqlite_attach_ref
virtools_ver = 'VIRTOOLS_' + input_virtools_version
virtools_debug_root = input_virtools_root_path
virtools_attach_ref = virtools_attach_ref_dict[input_virtools_version]
if input_build_type == build_type_plugin:
virtools_build_type = 'VIRTOOLS_PLUGIN'
virtools_build_suffix = 'dll'
virtools_module_define = 'SuperScriptMaterializer.def'
virtools_debug_commandline = ''
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_attach_ref = virtools_attach_ref_plugin_dict[input_virtools_version]
elif input_build_type == build_type_standalone:
virtools_build_type = 'VIRTOOLS_STANDALONE'
virtools_build_suffix = 'exe'
virtools_module_define = ''
virtools_debug_commandline = 'test.nmo test_script.db test_env.db'
virtools_debug_target = os.path.join(input_virtools_root_path, 'SuperScriptMaterializer.exe')
virtools_output_path = input_virtools_root_path
virtools_attach_ref = virtools_attach_ref_standalone_dict[input_virtools_version]
# make sure the last char of output_path is slash
if virtools_output_path[-1] != '\\' or virtools_output_path[-1] != '/':
virtools_output_path = virtools_output_path + '\\'
# in virtools 2.1, we use bml, so we need add bml macro and set virtools header to bml's virtools header
# also, we don't need set lib path because all virtools file have been imported in project
# 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
if input_virtools_version == '21':
virtools_header_path = ''#os.path.join(input_bml_path, 'virtools')
virtools_header_path = ''
virtools_lib_path = ''
bml_special_macro = 'BML_EXPORT='
else:
@ -169,6 +179,23 @@ for bt in ('Debug', 'Release'):
node_build_type.appendChild(node_configuration_type)
root.appendChild(node_build_type)
# ======================== write subsystem
for bt in ('Debug', 'Release'):
node_item_def = dom.createElement('ItemDefinitionGroup')
node_item_def.setAttribute('Condition', "'$(Configuration)|$(Platform)'=='{}|Win32'".format(bt))
node_item_def_link = dom.createElement('Link')
node_sub_system = dom.createElement('SubSystem')
if input_build_type == build_type_standalone:
node_sub_system.appendChild(dom.createTextNode('Console'))
elif input_build_type == build_type_plugin:
node_sub_system.appendChild(dom.createTextNode('Windows'))
node_item_def_link.appendChild(node_sub_system)
node_item_def.appendChild(node_item_def_link)
root.appendChild(node_item_def)
# ======================== write macro and misc
node_property_group = dom.createElement('PropertyGroup')
node_property_group.setAttribute('Label', 'UserMacros')
@ -191,11 +218,13 @@ write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_OUTPUT_PATH', v
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_BUILD_TYPE', virtools_build_type)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_DEBUG_TARGET', virtools_debug_target)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_DEBUG_ROOT', virtools_debug_root)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_DEBUG_COMMANDLINE', virtools_debug_commandline)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_BUILD_SUFFIX', virtools_build_suffix)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_VER', virtools_ver)
write_macro(dom, node_property_group, node_item_group, 'BML_SPECIAL_MACRO', bml_special_macro)
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, 'VIRTOOLS_MODULE_DEFINE', virtools_module_define)
# ======================== write extra compile