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 ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# ignore generated Virtools.props
SuperScriptMaterializer/Virtools.props
# ignore generated database
*.db *.db
*.db-journal *.db-journal

View File

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

View File

@ -18,13 +18,13 @@
</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>v142</PlatformToolset> <PlatformToolset>v100</PlatformToolset>
<UseOfMfc>Dynamic</UseOfMfc> <UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v100</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc> <UseOfMfc>Dynamic</UseOfMfc>
@ -62,9 +62,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);$(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> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<DisableSpecificWarnings>4819</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
<OutputFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)</OutputFile> <OutputFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)</OutputFile>
@ -74,8 +75,7 @@
<AdditionalDependencies>$(VIRTOOLS_ATTACH_REF);$(SQLITE_ATTACH_REF);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(VIRTOOLS_ATTACH_REF);$(SQLITE_ATTACH_REF);%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.pdb</ProgramDatabaseFile> <ProgramDatabaseFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem> <ModuleDefinitionFile>$(VIRTOOLS_MODULE_DEFINE)</ModuleDefinitionFile>
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -91,14 +91,14 @@
<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);$(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> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<DisableSpecificWarnings>4819</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile> <ModuleDefinitionFile>$(VIRTOOLS_MODULE_DEFINE)</ModuleDefinitionFile>
<OutputFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)</OutputFile> <OutputFile>$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)</OutputFile>
<AdditionalLibraryDirectories>$(VIRTOOLS_LIB_PATH);$(SQLITE_LIB_PATH);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(VIRTOOLS_LIB_PATH);$(SQLITE_LIB_PATH);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>$(VIRTOOLS_ATTACH_REF);$(SQLITE_ATTACH_REF);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(VIRTOOLS_ATTACH_REF);$(SQLITE_ATTACH_REF);%(AdditionalDependencies)</AdditionalDependencies>
@ -119,6 +119,7 @@
<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="vt_menu.cpp" />
<ClCompile Include="vt_player.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="SuperScriptMaterializer.def" /> <None Include="SuperScriptMaterializer.def" />

View File

@ -15,39 +15,42 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<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"> <ClInclude Include="stdafx.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="vt_menu.h"> <ClInclude Include="vt_menu.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </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>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="vt_menu.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="database.cpp"> <ClCompile Include="database.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="env_export.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="script_export.cpp"> <ClCompile Include="script_export.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="env_export.cpp"> <ClCompile Include="vt_menu.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="vt_player.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </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) { void database::open(const char* file) {
db = NULL; 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 //open db
int result; int result;
@ -206,7 +206,7 @@ BOOL scriptDatabase::finalJob() {
} }
BOOL envDatabase::init() { 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; int result;

View File

@ -1,6 +1,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "vt_menu.h" #include "vt_menu.h"
#include "vt_player.h"
#if defined(VIRTOOLS_PLUGIN)
PluginInterface* s_Plugininterface = NULL; PluginInterface* s_Plugininterface = NULL;
PluginInfo g_PluginInfo0; PluginInfo g_PluginInfo0;
@ -25,18 +27,31 @@ class SuperScriptMaterializer : CWinApp {
SuperScriptMaterializer theApp; SuperScriptMaterializer theApp;
BOOL SuperScriptMaterializer::InitInstance() { 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"); strcpy(g_PluginInfo0.m_Name, "Super Script Materializer");
g_PluginInfo0.m_PluginType = PluginInfo::PT_EDITOR; g_PluginInfo0.m_PluginType = PluginInfo::PT_EDITOR;
g_PluginInfo0.m_PluginType = (PluginInfo::PLUGIN_TYPE)(g_PluginInfo0.m_PluginType | PluginInfo::PTF_RECEIVENOTIFICATION); g_PluginInfo0.m_PluginType = (PluginInfo::PLUGIN_TYPE)(g_PluginInfo0.m_PluginType | PluginInfo::PTF_RECEIVENOTIFICATION);
g_PluginInfo0.m_PluginCallback = PluginCallback; g_PluginInfo0.m_PluginCallback = PluginCallback;
return CWinApp::InitInstance(); return TRUE;
} }
int SuperScriptMaterializer::ExitInstance() { int SuperScriptMaterializer::ExitInstance() {
// TODO: Add your specialized code here and/or call the base class
return CWinApp::ExitInstance(); 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 //PLUGIN PRECOMPILED HEADER INCLUDED
#include "CKAll.h" #include "CKAll.h"
#if defined(VIRTOOLS_PLUGIN)
#include "VIControls.h" #include "VIControls.h"
#include "CKControlsAll.h" #include "CKControlsAll.h"
#include "VEP_ScriptActionMenu.h" #include "VEP_ScriptActionMenu.h"
@ -38,3 +41,7 @@
#include "VEP_All.h" #include "VEP_All.h"
using namespace CKControl; 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 "script_export.h"
#include "env_export.h" #include "env_export.h"
#if defined(VIRTOOLS_PLUGIN)
extern PluginInterface* s_Plugininterface; extern PluginInterface* s_Plugininterface;
CMenu* s_MainMenu = NULL; CMenu* s_MainMenu = NULL;
@ -177,3 +179,5 @@ BOOL OpenFileDialog(std::string* returned_file) {
free(file); free(file);
return status; return status;
} }
#endif

View File

@ -1,6 +1,7 @@
#if !defined(_YYCDLL_VT_MENU_H__IMPORTED_) #if !defined(_YYCDLL_VT_MENU_H__IMPORTED_)
#define _YYCDLL_VT_MENU_H__IMPORTED_ #define _YYCDLL_VT_MENU_H__IMPORTED_
#if defined(VIRTOOLS_PLUGIN)
#include "stdafx.h" #include "stdafx.h"
#include "database.h" #include "database.h"
@ -12,5 +13,6 @@ void UpdateMenu();
void PluginMenuCallback(int commandID); void PluginMenuCallback(int commandID);
BOOL OpenFileDialog(std::string* returned_file); BOOL OpenFileDialog(std::string* returned_file);
#endif
#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 # ======================== const define
program_name = "SuperScriptMaterializer"
build_type_standalone = "standalone" build_type_standalone = "standalone"
build_type_plugin = "plugin" build_type_plugin = "plugin"
valid_build_type = ( valid_build_type = (
@ -14,13 +12,20 @@ valid_build_type = (
build_type_plugin build_type_plugin
) )
virtools_attach_ref_dict = { virtools_attach_ref_plugin_dict = {
"21": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib", "21": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"25": "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", "35": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"40": "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" "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 = { executable_virtools = {
"21": "Dev.exe", "21": "Dev.exe",
@ -117,27 +122,32 @@ sqlite_attach_ref = input_sqlite_attach_ref
virtools_ver = 'VIRTOOLS_' + input_virtools_version virtools_ver = 'VIRTOOLS_' + input_virtools_version
virtools_debug_root = input_virtools_root_path virtools_debug_root = input_virtools_root_path
virtools_attach_ref = virtools_attach_ref_dict[input_virtools_version]
if input_build_type == build_type_plugin: if input_build_type == build_type_plugin:
virtools_build_type = 'VIRTOOLS_PLUGIN' virtools_build_type = 'VIRTOOLS_PLUGIN'
virtools_build_suffix = 'dll' 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_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]
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'
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_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]
# 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] != '/':
virtools_output_path = virtools_output_path + '\\' 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 # in virtools 2.1, we use bml, so we need add bml macro and set virtools header and virtools lib to blank
# also, we don't need set lib path 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 = ''#os.path.join(input_bml_path, 'virtools') virtools_header_path = ''
virtools_lib_path = '' virtools_lib_path = ''
bml_special_macro = 'BML_EXPORT=' bml_special_macro = 'BML_EXPORT='
else: else:
@ -169,6 +179,23 @@ for bt in ('Debug', 'Release'):
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
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 # ======================== write macro and misc
node_property_group = dom.createElement('PropertyGroup') node_property_group = dom.createElement('PropertyGroup')
node_property_group.setAttribute('Label', 'UserMacros') 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_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_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_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_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, '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, '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, '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 extra compile # ======================== write extra compile