diff --git a/README_ZH.md b/README_ZH.md
index a63bcd3..175b3d6 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -19,7 +19,15 @@
* `SuperScriptViewer`:一个Python工程,使用Flask提供一个本地Web界面进行脚本以供快速查看,通常是用于本地快速查看解析后脚本的数据。
* `SuperScriptEnterprise`:一个PHP工程,相对于`SuperScriptViewer`更适合部署于服务器上进行数据的展示和浏览。
-整个工程所作的事情就是,将Virtools文档中的所有脚本导出成一个SQLite数据库文件,然后经过Python进行排布处理,最后提供一个本地Web前端查看脚本。这同样适用于`Script Hidden`的Virtools脚本,也适用于其中含有不可展开的`Behavior Graph`的脚本。
+
+
+四个部分组成的工作流程如上图所示。整个工程所作的事情就是,将Virtools文档中的所有脚本导出成一个SQLite数据库文件,然后经过Python进行排布处理,最后提供一个本地Web前端查看脚本。这同样适用于`Script Hidden`的Virtools脚本,也适用于其中含有不可展开的`Behavior Graph`的脚本。
物化器不能完全恢复脚本的原有排布,无论原有排布是否存在,物化器都将重新自动生成脚本中的各个元素的位置。某些结构的关系可能会改变(例如Export parameter),亦或者是与Virtools中的呈现不同,但是逻辑思路将不会改变。同时物化器不能将已经生成的结构回写成Virtools可接受的格式,因此物化器只能提供无视脚本隐藏的分析功能。
diff --git a/SuperScriptMaterializer/database.cpp b/SuperScriptMaterializer/database.cpp
index 1532ea6..46a5761 100644
--- a/SuperScriptMaterializer/database.cpp
+++ b/SuperScriptMaterializer/database.cpp
@@ -601,6 +601,7 @@ void envDatabase::write_envPlugin(db_envPlugin* data) {
void envDatabase::write_envVariable(db_envVariable* data) {
if (db == NULL) return;
+#if !defined(VIRTOOLS_21)
sqlite3_stmt* stmt = NULL;
tryGetStmt(5, "INSERT INTO [variable] VALUES (?, ?, ?, ?, ?, ?)");
sqlite3_reset(stmt);
@@ -612,6 +613,7 @@ void envDatabase::write_envVariable(db_envVariable* data) {
sqlite3_bind_text(stmt, 5, data->representation.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 6, data->data.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_step(stmt);
+#endif
}
#undef tryGetStmt
diff --git a/SuperScriptMaterializer/database.h b/SuperScriptMaterializer/database.h
index 4de3400..b33a934 100644
--- a/SuperScriptMaterializer/database.h
+++ b/SuperScriptMaterializer/database.h
@@ -6,6 +6,7 @@
#include
#include
#include
+#include "virtools_compatible.h"
#define STRINGCACHE_SIZE 25565
@@ -221,7 +222,7 @@ typedef struct {
std::string name;
std::string desciption;
XWORD flags;
- CKVariableManager::Variable::Type type;
+ UNIVERSAL_VAR_TYPE type;
std::string representation;
std::string data;
}db_envVariable;
diff --git a/SuperScriptMaterializer/env_export.cpp b/SuperScriptMaterializer/env_export.cpp
index 5f93f54..fa88529 100644
--- a/SuperScriptMaterializer/env_export.cpp
+++ b/SuperScriptMaterializer/env_export.cpp
@@ -126,6 +126,7 @@ void IteratePlugin(CKPluginManager* plgManager, envDatabase* db, dbEnvDataStruct
}
}
+#if !defined(VIRTOOLS_21)
void IterateVariable(CKVariableManager* varManager, envDatabase* db, dbEnvDataStructHelper* helper) {
CKVariableManager::Iterator it = varManager->GetVariableIterator();
CKVariableManager::Variable* varobj = NULL;
@@ -142,4 +143,5 @@ void IterateVariable(CKVariableManager* varManager, envDatabase* db, dbEnvDataSt
db->write_envVariable(helper->_db_envVariable);
}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file
diff --git a/SuperScriptMaterializer/script_export.cpp b/SuperScriptMaterializer/script_export.cpp
index 8ad064f..0c8fc78 100644
--- a/SuperScriptMaterializer/script_export.cpp
+++ b/SuperScriptMaterializer/script_export.cpp
@@ -2,6 +2,9 @@
//disable shit tip
#pragma warning(disable:26812)
+// disable microsoft shitty macro to avoid build error
+#undef GetClassName
+
#define changeSuffix(a) prefix[endIndex]='\0';strcat(prefix,a)
#define copyGuid(guid,str) sprintf(helper->_stringCache,"%d,%d",guid.d1,guid.d2);str=helper->_stringCache;
#define safeStringCopy(storage,str) storage=(str)?(str):"";
@@ -104,7 +107,7 @@ void proc_pTarget(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbSc
db->write_pTarget(helper->_db_pTarget);
//judge whether expoer parameter and write database
- if (((CKBehavior*)ctx->GetObjectA(grandparents))->GetInputParameterPosition(cache) != -1) {
+ if (((CKBehavior*)ctx->GetObject(grandparents))->GetInputParameterPosition(cache) != -1) {
helper->_db_eLink->export_obj = cache->GetID();
helper->_db_eLink->internal_obj = parents;
helper->_db_eLink->is_in = TRUE;
@@ -134,7 +137,7 @@ void proc_pIn(CKContext* ctx, CKParameterIn* cache, scriptDatabase* db, dbScript
db->write_pIn(helper->_db_pIn);
//judge whether expoer parameter and write database
- if (((CKBehavior*)ctx->GetObjectA(grandparents))->GetInputParameterPosition(cache) != -1) {
+ if (((CKBehavior*)ctx->GetObject(grandparents))->GetInputParameterPosition(cache) != -1) {
helper->_db_eLink->export_obj = cache->GetID();
helper->_db_eLink->internal_obj = parents;
helper->_db_eLink->is_in = TRUE;
@@ -163,7 +166,7 @@ void proc_pOut(CKContext* ctx, CKParameterOut* cache, scriptDatabase* db, dbScri
db->write_pOut(helper->_db_pOut);
//judge whether expoer parameter and write database
- if (((CKBehavior*)ctx->GetObjectA(grandparents))->GetOutputParameterPosition(cache) != -1) {
+ if (((CKBehavior*)ctx->GetObject(grandparents))->GetOutputParameterPosition(cache) != -1) {
helper->_db_eLink->export_obj = cache->GetID();
helper->_db_eLink->internal_obj = parents;
helper->_db_eLink->is_in = FALSE;
@@ -411,7 +414,10 @@ void DigParameterData(CKParameterLocal* p, scriptDatabase* db, dbScriptDataStruc
if (p->GetParameterClassID() && p->GetValueObject(false)) {
helper_pDataExport("id", (long)p->GetValueObject(false)->GetID(), db, helper, parents);
helper_pDataExport("name", p->GetValueObject(false)->GetName(), db, helper, parents);
- helper_pDataExport("type", p->GetValueObject(false)->GetClassNameA(), db, helper, parents);
+
+ CK_CLASSID none_classid = p->GetValueObject(false)->GetClassID();
+ CKParameterType none_type = helper->_parameterManager->ClassIDToType(none_classid);
+ helper_pDataExport("type",helper->_parameterManager->ParameterTypeToName(none_type), db, helper, parents);
return;
}
//float
diff --git a/SuperScriptMaterializer/virtools_compatible.h b/SuperScriptMaterializer/virtools_compatible.h
index 47aff22..0f63880 100644
--- a/SuperScriptMaterializer/virtools_compatible.h
+++ b/SuperScriptMaterializer/virtools_compatible.h
@@ -5,4 +5,10 @@
//void __declspec(noreturn) FAKE_THROW();
+#if defined(VIRTOOLS_21)
+#define UNIVERSAL_VAR_TYPE void*
+#elif defined(VIRTOOLS_25) || defined(VIRTOOLS_35) || defined(VIRTOOLS_40) || defined(VIRTOOLS_50)
+#define UNIVERSAL_VAR_TYPE CKVariableManager::Variable::Type
+#endif
+
#endif
\ No newline at end of file
diff --git a/SuperScriptMaterializer/vt_menu.cpp b/SuperScriptMaterializer/vt_menu.cpp
index bf36356..94cbea6 100644
--- a/SuperScriptMaterializer/vt_menu.cpp
+++ b/SuperScriptMaterializer/vt_menu.cpp
@@ -126,7 +126,9 @@ void PluginMenuCallback(int commandID) {
IterateMessage(ctx->GetMessageManager(), _db, _helper);
IterateAttribute(ctx->GetAttributeManager(), _db, _helper);
IteratePlugin(CKGetPluginManager(), _db, _helper);
+#if !defined(VIRTOOLS_21)
IterateVariable(ctx->GetVariableManager(), _db, _helper);
+#endif
//release all
_helper->dispose();
diff --git a/SuperScriptMaterializer/vt_player.cpp b/SuperScriptMaterializer/vt_player.cpp
index edf90f7..22a28cc 100644
--- a/SuperScriptMaterializer/vt_player.cpp
+++ b/SuperScriptMaterializer/vt_player.cpp
@@ -10,6 +10,10 @@ void PlayerMain(const char* virtools_composition, const char* script_db_path, co
printf("Report bug: https://github.com/yyc12345/SuperScriptMaterializer/issues\n");
// ====================== init ck2 engine
+#if defined(VIRTOOLS_21)
+ CommonAssert(LoadLibrary("CK2.dll") != NULL, "Error loading CK2.dll");
+#endif
+
CommonAssert(!CKStartUp(), "CKStartUp Error");
CKPluginManager* pluginManager = CKGetPluginManager();
CommonAssert(pluginManager != NULL, "PluginManager = null");
@@ -52,7 +56,9 @@ void PlayerMain(const char* virtools_composition, const char* script_db_path, co
IterateMessage(context->GetMessageManager(), _env_db, _env_helper);
IterateAttribute(context->GetAttributeManager(), _env_db, _env_helper);
IteratePlugin(CKGetPluginManager(), _env_db, _env_helper);
+#if !defined(VIRTOOLS_21)
IterateVariable(context->GetVariableManager(), _env_db, _env_helper);
+#endif
// free
_script_helper->dispose();