From 2138e46332b57ae77e799d964f69358abe6f707c Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Wed, 31 Jul 2024 20:43:32 +0800 Subject: [PATCH] feat: update library dependency - update YYCC dependency. add MessageBox to notice user error occurs by new added feature. - bump up version --- doc/DEV_HELP.md | 1 + script/build.bat | 8 ++++---- script/build_build_script.py | 2 +- src/VirtoolsMenu.cpp | 10 ++++++++++ src/VirtoolsMenu.hpp | 2 ++ src/main.cpp | 2 +- src/resource.h | 2 ++ src/vtobjplugin.props | 2 +- src/vtobjplugin.rc | 28 ++++++++++++++++------------ 9 files changed, 38 insertions(+), 19 deletions(-) diff --git a/doc/DEV_HELP.md b/doc/DEV_HELP.md index 9d7a473..434965a 100644 --- a/doc/DEV_HELP.md +++ b/doc/DEV_HELP.md @@ -16,4 +16,5 @@ For texture file path, it is done in both `ExportLayoutWeaver` and `ObjExport`. * Dialog left-bottom corner version string (all languages, current is English and Simplified Chinese). * About dialog string in string table (also for all languages). +* Version info in resource file (also for all languages). * Version indentifier passed to `YYCC::ConfigManager::CoreManager` constructor in `ConfigManager.cpp` if config file structure has been changed when bumping version. diff --git a/script/build.bat b/script/build.bat index 401fc98..155b8fe 100644 --- a/script/build.bat +++ b/script/build.bat @@ -1,16 +1,16 @@ @ECHO OFF ECHO This script must be executed at the root of project. Press any key to continue... PAUSE -python "script\setup_env.py" -p "E:\Virtools\Virtools Dev 3.0" -y "J:\YYCCommonplace\bin\install" +python "script\setup_env.py" -p "E:\Virtools\Virtools Dev 3.0" -y "J:\YYCCommonplace\bin\msvc_install" MSBuild src\vtobjplugin.sln -p:Configuration=Release -p:Platform=x86 python -m zipfile -c "E:\Virtools\Virtools Dev 3.0\InterfacePlugins\vtobjplugin_vt3.0.zip" "E:\Virtools\Virtools Dev 3.0\InterfacePlugins\vtobjplugin.dll" "E:\Virtools\Virtools Dev 3.0\InterfacePlugins\vtobjplugin.pdb" -python "script\setup_env.py" -p "E:\Virtools\Virtools Dev 3.5" -y "J:\YYCCommonplace\bin\install" +python "script\setup_env.py" -p "E:\Virtools\Virtools Dev 3.5" -y "J:\YYCCommonplace\bin\msvc_install" MSBuild src\vtobjplugin.sln -p:Configuration=Release -p:Platform=x86 python -m zipfile -c "E:\Virtools\Virtools Dev 3.5\InterfacePlugins\vtobjplugin_vt3.5.zip" "E:\Virtools\Virtools Dev 3.5\InterfacePlugins\vtobjplugin.dll" "E:\Virtools\Virtools Dev 3.5\InterfacePlugins\vtobjplugin.pdb" -python "script\setup_env.py" -p "E:\Virtools\Virtools Dev 4.0" -y "J:\YYCCommonplace\bin\install" +python "script\setup_env.py" -p "E:\Virtools\Virtools Dev 4.0" -y "J:\YYCCommonplace\bin\msvc_install" MSBuild src\vtobjplugin.sln -p:Configuration=Release -p:Platform=x86 python -m zipfile -c "E:\Virtools\Virtools Dev 4.0\InterfacePlugins\vtobjplugin_vt4.0.zip" "E:\Virtools\Virtools Dev 4.0\InterfacePlugins\vtobjplugin.dll" "E:\Virtools\Virtools Dev 4.0\InterfacePlugins\vtobjplugin.pdb" -python "script\setup_env.py" -p "E:\Virtools\Virtools Dev 5.0" -y "J:\YYCCommonplace\bin\install" +python "script\setup_env.py" -p "E:\Virtools\Virtools Dev 5.0" -y "J:\YYCCommonplace\bin\msvc_install" MSBuild src\vtobjplugin.sln -p:Configuration=Release -p:Platform=x86 python -m zipfile -c "E:\Virtools\Virtools Dev 5.0\InterfacePlugins\vtobjplugin_vt5.0.zip" "E:\Virtools\Virtools Dev 5.0\InterfacePlugins\vtobjplugin.dll" "E:\Virtools\Virtools Dev 5.0\InterfacePlugins\vtobjplugin.pdb" ECHO Build Done. diff --git a/script/build_build_script.py b/script/build_build_script.py index 21f7778..c99c8bc 100644 --- a/script/build_build_script.py +++ b/script/build_build_script.py @@ -15,7 +15,7 @@ def main() -> None: for ver in ('3.0', '3.5', '4.0', '5.0'): vt_path: str = f'E:\Virtools\\Virtools Dev {ver}' vt_interface_path: str = f'{vt_path}\InterfacePlugins' - writeline(f, f'python "script\\setup_env.py" -p "{vt_path}" -y "J:\\YYCCommonplace\\bin\\install"') + writeline(f, f'python "script\\setup_env.py" -p "{vt_path}" -y "J:\\YYCCommonplace\\bin\\msvc_install"') writeline(f, f'MSBuild src\\vtobjplugin.sln -p:Configuration=Release -p:Platform=x86') writeline(f, f'python -m zipfile -c "{vt_interface_path}\\vtobjplugin_vt{ver}.zip" "{vt_interface_path}\\vtobjplugin.dll" "{vt_interface_path}\\vtobjplugin.pdb"') diff --git a/src/VirtoolsMenu.cpp b/src/VirtoolsMenu.cpp index 758bb04..1a13c7a 100644 --- a/src/VirtoolsMenu.cpp +++ b/src/VirtoolsMenu.cpp @@ -118,5 +118,15 @@ namespace vtobjplugin::VirtoolsMenu { return g_Plugininterface; } + void UnhandledExceptionCallback(const YYCC::yycc_u8string& log_path, const YYCC::yycc_u8string& coredump_path) { + const auto& string_loader = Utilities::StringLoader::GetSingleton(); + MessageBoxW( + NULL, + YYCC::EncodingHelper::UTF8ToWchar(YYCC::StringHelper::Printf(string_loader.LoadStringU8(IDS_UE_BODY).c_str(), log_path.c_str(), coredump_path.c_str()).c_str()).c_str(), + string_loader.LoadStringW(IDS_UE_TITLE).c_str(), + MB_OK + MB_ICONERROR + ); + } + } diff --git a/src/VirtoolsMenu.hpp b/src/VirtoolsMenu.hpp index 51caa01..97cebfc 100644 --- a/src/VirtoolsMenu.hpp +++ b/src/VirtoolsMenu.hpp @@ -7,4 +7,6 @@ namespace vtobjplugin::VirtoolsMenu { PluginInfo* GetPluginInfo(); PluginInterface* GetPluginInterface(); + void UnhandledExceptionCallback(const YYCC::yycc_u8string& log_path, const YYCC::yycc_u8string& coredump_path); + } diff --git a/src/main.cpp b/src/main.cpp index 03b8c36..58fb13b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,7 +20,7 @@ class CVtObjPlugin : CWinApp { virtual BOOL InitInstance() override { // register unhandler exception handler #ifdef VTOBJ_RELEASE - YYCC::ExceptionHelper::Register(); + YYCC::ExceptionHelper::Register(vtobjplugin::VirtoolsMenu::UnhandledExceptionCallback); #endif // load config from file diff --git a/src/resource.h b/src/resource.h index 9fa7422..173016a 100644 --- a/src/resource.h +++ b/src/resource.h @@ -29,6 +29,8 @@ #define IDS_EXPLAYOUT_NAME_CONV_FAIL 128 #define IDS_EXPALYOUT_NAME_UNAMED 129 #define IDS_EXPLAYOUT_NAME_UNAMED 129 +#define IDS_UE_TITLE 130 +#define IDS_UE_BODY 131 #define IDC_RADIO1 1001 #define IDC_RADIO2 1002 #define IDC_RADIO3 1003 diff --git a/src/vtobjplugin.props b/src/vtobjplugin.props index 832ce8a..b6f0f10 100644 --- a/src/vtobjplugin.props +++ b/src/vtobjplugin.props @@ -3,7 +3,7 @@ E:\Virtools\Virtools Dev 5.0 - J:\YYCCommonplace\bin\install + J:\YYCCommonplace\bin\msvc_install diff --git a/src/vtobjplugin.rc b/src/vtobjplugin.rc index 275a816..0cd7c1f 100644 --- a/src/vtobjplugin.rc +++ b/src/vtobjplugin.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_CHINESE, SUBLANG_NEUTRAL // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,0,0,0 - PRODUCTVERSION 3,0,0,0 + FILEVERSION 3,1,0,0 + PRODUCTVERSION 3,1,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,12 +43,12 @@ BEGIN BEGIN VALUE "CompanyName", "yyc12345" VALUE "FileDescription", "用于 Virtools 的 Wavefront OBJ 导出器。" - VALUE "FileVersion", "3.0.0.0" + VALUE "FileVersion", "3.1.0.0" VALUE "InternalName", "vtobjplu.dll" VALUE "LegalCopyright", "版权所有 (C) 2020-2024 yyc12345" VALUE "OriginalFilename", "vtobjplu.dll" VALUE "ProductName", "vtobjplugin" - VALUE "ProductVersion", "3.0.0.0" + VALUE "ProductVersion", "3.1.0.0" END END BLOCK "VarFileInfo" @@ -109,7 +109,7 @@ BEGIN EDITTEXT IDC_EDIT3,230,383,107,14,ES_AUTOHSCROLL CONTROL "在物体和材质文件中使用 UTF8",IDC_CHECK11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,402,123,10 CONTROL "在脚本文件中使用 UTF8",IDC_CHECK12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,420,99,10 - LTEXT "vtobjplugin - v3.0",IDC_STATIC,6,444,58,8 + LTEXT "vtobjplugin - v3.1",IDC_STATIC,6,444,58,8 PUSHBUTTON "重置为默认",IDC_BUTTON2,6,462,50,14 END @@ -157,7 +157,7 @@ BEGIN IDS_VTMENU_MENU_REPORT_BUG "汇报错误" IDS_VTMENU_MENU_ABOUT "关于 vtobjplugin" IDS_VTMENU_ABOUT_TITLE "关于 vtobjplugin" - IDS_VTMENU_ABOUT_BODY "vtobjplugin v3.0 - 适用于 Virtools 的 Wavefront OBJ 导出器。\n基于 GPL v3 许可证。\n项目主页: https://github.com/yyc12345/vtobjplugin" + IDS_VTMENU_ABOUT_BODY "vtobjplugin v3.1 - 适用于 Virtools 的 Wavefront OBJ 导出器。\n基于 GPL v3 许可证。\n项目主页: https://github.com/yyc12345/vtobjplugin" IDS_VTMENU_SUCCESS_NOTE "Wavefront OBJ 导出完成。" IDS_EXPSETDLG_ERR_TITLE "设置错误" END @@ -186,6 +186,8 @@ STRINGTABLE BEGIN IDS_EXPLAYOUT_NAME_CONV_FAIL "无法以给定编码转换其名称。因此使用生成的名称替代。" IDS_EXPLAYOUT_NAME_UNAMED "未命名物体。使用生成的名称。" + IDS_UE_TITLE "致命错误" + IDS_UE_BODY "发生了致命错误。报告已生成。请报告给开发者。\n日志路径: %s\n核心转储路径: %s" END #endif // Chinese (Simplified) resources @@ -241,8 +243,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,0,0,0 - PRODUCTVERSION 3,0,0,0 + FILEVERSION 3,1,0,0 + PRODUCTVERSION 3,1,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -259,12 +261,12 @@ BEGIN BEGIN VALUE "CompanyName", "yyc12345" VALUE "FileDescription", "Wavefront OBJ Exporter for Virtools." - VALUE "FileVersion", "3.0.0.0" + VALUE "FileVersion", "3.1.0.0" VALUE "InternalName", "vtobjplu.dll" VALUE "LegalCopyright", "Copyright (C) 2020-2024 yyc12345" VALUE "OriginalFilename", "vtobjplu.dll" VALUE "ProductName", "vtobjplugin" - VALUE "ProductVersion", "3.0.0.0" + VALUE "ProductVersion", "3.1.0.0" END END BLOCK "VarFileInfo" @@ -330,7 +332,7 @@ BEGIN CONTROL "Use UTF8 in Object and Material File",IDC_CHECK11, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,402,131,10 CONTROL "Use UTF8 in Script File",IDC_CHECK12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,420,87,10 - LTEXT "vtobjplugin - v3.0",IDC_STATIC,6,444,58,8 + LTEXT "vtobjplugin - v3.1",IDC_STATIC,6,444,58,8 PUSHBUTTON "Reset",IDC_BUTTON2,6,462,50,14 END @@ -378,7 +380,7 @@ BEGIN IDS_VTMENU_MENU_REPORT_BUG "Report Bug" IDS_VTMENU_MENU_ABOUT "About vtobjplugin" IDS_VTMENU_ABOUT_TITLE "About vtobjplugin" - IDS_VTMENU_ABOUT_BODY "vtobjplugin v3.0 - A Wavefront OBJ Exporter for Virtools.\nUnder GPL v3 License.\nProject Home Page: https://github.com/yyc12345/vtobjplugin" + IDS_VTMENU_ABOUT_BODY "vtobjplugin v3.1 - A Wavefront OBJ Exporter for Virtools.\nUnder GPL v3 License.\nProject Home Page: https://github.com/yyc12345/vtobjplugin" IDS_VTMENU_SUCCESS_NOTE "Wavefront OBJ Export Done." IDS_EXPSETDLG_ERR_TITLE "Setting Error" END @@ -410,6 +412,8 @@ BEGIN IDS_EXPLAYOUT_NAME_CONV_FAIL "Fail to convert its name by given encoding. Use generated name instead." IDS_EXPLAYOUT_NAME_UNAMED "Unamed object. Use generated name." + IDS_UE_TITLE "Fatal Error" + IDS_UE_BODY "Fatal error occurs. Report is generated. Please report to developer.\nLog path: %s\nCore dump path: %s" END #endif // English (United States) resources