diff --git a/plugins/builtin/CMakeLists.txt b/plugins/builtin/CMakeLists.txt index 75ba6be96..2b97dc599 100644 --- a/plugins/builtin/CMakeLists.txt +++ b/plugins/builtin/CMakeLists.txt @@ -1,46 +1,46 @@ -cmake_minimum_required(VERSION 3.16) -# Change this to the name of your plugin # -project(builtin) - -# Add your source files here # -add_library(${PROJECT_NAME} SHARED - source/plugin_builtin.cpp - - source/content/command_palette_commands.cpp - source/content/data_inspector.cpp - source/content/pl_builtin_functions.cpp - source/content/settings_entries.cpp - source/content/tools_entries.cpp - source/content/data_processor_nodes.cpp - source/content/ui_items.cpp - - source/math_evaluator.cpp - - source/lang/en_US.cpp - source/lang/de_DE.cpp - source/lang/it_IT.cpp - source/lang/zh_CN.cpp -) - -# Add additional include directories here # -target_include_directories(${PROJECT_NAME} PRIVATE include) -# Add additional libraries here # -target_link_libraries(${PROJECT_NAME} PRIVATE libimhex LLVMDemangle) - - - -# ---- No need to change anything from here downwards unless you know what you're doing ---- # - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_SHARED_LIBRARY_PREFIX "") -set(CMAKE_SHARED_LIBRARY_SUFFIX ".hexplug") - -if (WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition -fvisibility=hidden") -endif() - -add_compile_definitions(IMHEX_PLUGIN_NAME=${PROJECT_NAME}) - -if (NOT TARGET libimhex) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libimhex ${CMAKE_CURRENT_BINARY_DIR}/plugins/libimhex) +cmake_minimum_required(VERSION 3.16) +# Change this to the name of your plugin # +project(builtin) + +# Add your source files here # +add_library(${PROJECT_NAME} SHARED + source/plugin_builtin.cpp + + source/content/command_palette_commands.cpp + source/content/data_inspector.cpp + source/content/pl_builtin_functions.cpp + source/content/settings_entries.cpp + source/content/tools_entries.cpp + source/content/data_processor_nodes.cpp + source/content/ui_items.cpp + + source/math_evaluator.cpp + + source/lang/en_US.cpp + source/lang/de_DE.cpp + source/lang/it_IT.cpp + source/lang/zh_CN.cpp +) + +# Add additional include directories here # +target_include_directories(${PROJECT_NAME} PRIVATE include) +# Add additional libraries here # +target_link_libraries(${PROJECT_NAME} PRIVATE libimhex LLVMDemangle) + + + +# ---- No need to change anything from here downwards unless you know what you're doing ---- # + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_SHARED_LIBRARY_PREFIX "") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".hexplug") + +if (WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition -fvisibility=hidden") +endif() + +add_compile_definitions(IMHEX_PLUGIN_NAME=${PROJECT_NAME}) + +if (NOT TARGET libimhex) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libimhex ${CMAKE_CURRENT_BINARY_DIR}/plugins/libimhex) endif() \ No newline at end of file diff --git a/plugins/builtin/source/lang/zh_CN.cpp b/plugins/builtin/source/lang/zh_CN.cpp index 6a5541438..6ab4b06fa 100644 --- a/plugins/builtin/source/lang/zh_CN.cpp +++ b/plugins/builtin/source/lang/zh_CN.cpp @@ -1,610 +1,610 @@ -#include -#include - -namespace hex::plugin::builtin { - - void registerLanguageZhCN() { - ContentRegistry::Language::registerLanguage("Chinese (Simplified)", "zh-CN"); - - ContentRegistry::Language::addLocalizations("zh-CN", { - /* ImHex default functionality */ - { "hex.menu.file", "文件" }, - { "hex.menu.edit", "编辑" }, - { "hex.menu.view", "视图" }, - { "hex.menu.view.fps", "显示FPS" }, - { "hex.menu.view.demo", "显示ImGui演示" }, - { "hex.menu.help", "帮助" }, - { "hex.menu.feedback", "反馈" }, - { "hex.menu.debug_build", "调试构建"}, - - { "hex.welcome.header.main", "欢迎来到ImHex" }, - { "hex.welcome.header.start", "开始" }, - { "hex.welcome.start.create_file", "创建新文件" }, - { "hex.welcome.start.open_file", "打开文件" }, - { "hex.welcome.start.open_project", "打开工程" }, - { "hex.welcome.start.recent", "最近文件" }, - { "hex.welcome.header.help", "帮助" }, - { "hex.welcome.help.repo", "GitHub仓库" }, - { "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" }, - { "hex.welcome.help.gethelp", "获得帮助" }, - { "hex.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, - { "hex.welcome.header.plugins", "已加载插件" }, - { "hex.welcome.plugins.plugin", "插件" }, - { "hex.welcome.plugins.author", "作者" }, - { "hex.welcome.plugins.desc", "描述" }, - { "hex.welcome.header.customize", "自定义" }, - { "hex.welcome.customize.settings.title", "设置" }, - { "hex.welcome.customize.settings.desc", "更改ImHex的设置" }, - { "hex.welcome.header.update", "更新" }, - { "hex.welcome.update.title", "新的更新可用!" }, - { "hex.welcome.update.desc", "ImHex {0} 已发布!在这里下载。" }, - { "hex.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.header.learn", "学习" }, - { "hex.welcome.learn.latest.title", "最新版本" }, - { "hex.welcome.learn.latest.desc", "阅读ImHex最新版本的更改日志" }, - { "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, - { "hex.welcome.learn.pattern.title", "模式文档" }, - { "hex.welcome.learn.pattern.desc", "如何基于我们完善的文档编写ImHex模式" }, - { "hex.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, - { "hex.welcome.learn.plugins.title", "插件API" }, - { "hex.welcome.learn.plugins.desc", "通过插件扩展ImHex获得更多功能" }, - { "hex.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, - { "hex.welcome.header.various", "杂项" }, - { "hex.welcome.tip_of_the_day", "小提示" }, - - { "hex.safety_backup.title", "恢复丢失数据" }, - { "hex.safety_backup.desc", "不!ImHex上次崩溃了\n你想恢复你之前的工作吗?"}, - { "hex.safety_backup.restore", "恢复" }, - { "hex.safety_backup.delete", "删除" }, - - - { "hex.common.little_endian", "小端序" }, - { "hex.common.big_endian", "大端序" }, - { "hex.common.decimal", "十进制" }, - { "hex.common.hexadecimal", "十六进制" }, - { "hex.common.octal", "八进制" }, - { "hex.common.error", "错误" }, - { "hex.common.fatal", "致命错误" }, - { "hex.common.address", "地址" }, - { "hex.common.size", "大小" }, - { "hex.common.region", "区域" }, - { "hex.common.match_selection", "匹配选择" }, - { "hex.common.yes", "是" }, - { "hex.common.no", "否" }, - { "hex.common.okay", "好的" }, - { "hex.common.load", "加载" }, - { "hex.common.cancel", "取消" }, - { "hex.common.set", "设置" }, - { "hex.common.close", "关闭文件" }, - { "hex.common.dont_show_again", "不要再次显示" }, - { "hex.common.link", "链接" }, - { "hex.common.file", "文件" }, - - { "hex.view.bookmarks.name", "书签" }, - { "hex.view.bookmarks.default_title", "书签 [0x{0:X} - 0x{1:X}]" }, - { "hex.view.bookmarks.no_bookmarks", "空空如也。通过 编辑->添加书签 添加一个" }, - { "hex.view.bookmarks.title.info", "信息" }, - { "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} 字节)" }, - { "hex.view.bookmarks.button.jump", "转到" }, - { "hex.view.bookmarks.button.remove", "移除" }, - { "hex.view.bookmarks.header.name", "名称" }, - { "hex.view.bookmarks.header.color", "颜色" }, - { "hex.view.bookmarks.header.comment", "注释" }, - - { "hex.view.command_palette.name", "命令栏" }, - - { "hex.view.data_inspector.name", "数据分析器" }, - { "hex.view.data_inspector.table.name", "名称" }, - { "hex.view.data_inspector.table.value", "值" }, - - { "hex.view.data_processor.name", "数据处理器" }, - { "hex.view.data_processor.menu.remove_selection", "移除已选" }, - { "hex.view.data_processor.menu.remove_node", "移除节点" }, - { "hex.view.data_processor.menu.remove_link", "移除链接" }, - - { "hex.view.disassembler.name", "反汇编" }, - { "hex.view.disassembler.position", "位置" }, - { "hex.view.disassembler.base", "基地址" }, - { "hex.view.disassembler.region", "代码范围" }, - { "hex.view.disassembler.settings.header", "设置" }, - { "hex.view.disassembler.arch", "架构" }, - { "hex.view.disassembler.arm.arm", "ARM" }, - { "hex.view.disassembler.arm.thumb", "Thumb" }, - { "hex.view.disassembler.arm.default", "默认" }, - { "hex.view.disassembler.arm.cortex_m", "Cortex-M" }, - { "hex.view.disassembler.arm.armv8", "ARMv8" }, - - { "hex.view.disassembler.mips.mips32", "MIPS32" }, - { "hex.view.disassembler.mips.mips64", "MIPS64" }, - { "hex.view.disassembler.mips.mips32R6", "MIPS32R6" }, - { "hex.view.disassembler.mips.micro", "Micro MIPS" }, - - { "hex.view.disassembler.x86.16bit", "16位" }, - { "hex.view.disassembler.x86.32bit", "32位" }, - { "hex.view.disassembler.x86.64bit", "64位" }, - - { "hex.view.disassembler.ppc.32bit", "32位" }, - { "hex.view.disassembler.ppc.64bit", "64位" }, - - { "hex.view.disassembler.sparc.v9", "Sparc V9" }, - - { "hex.view.disassembler.disassemble", "反汇编" }, - { "hex.view.disassembler.disassembling", "反汇编中..." }, - { "hex.view.disassembler.disassembly.title", "反汇编" }, - { "hex.view.disassembler.disassembly.address", "地址" }, - { "hex.view.disassembler.disassembly.offset", "偏移" }, - { "hex.view.disassembler.disassembly.bytes", "字节" }, - - { "hex.view.hashes.name", "哈希" }, - { "hex.view.hashes.settings", "设置" }, - { "hex.view.hashes.function", "哈希函数" }, - { "hex.view.hashes.iv", "初始值" }, - { "hex.view.hashes.poly", "多项式" }, - { "hex.view.hashes.result", "结果" }, - - { "hex.view.help.name", "帮助" }, - { "hex.view.help.about.name", "关于" }, - { "hex.view.help.about.translator", "由xtexChooser翻译" }, - { "hex.view.help.about.source", "源代码位于GitHub:" }, - { "hex.view.help.about.donations", "赞助" }, - { "hex.view.help.about.thanks", "如果你喜欢我的工作,请赞助以帮助此项目继续前进。非常感谢 <3" }, - { "hex.view.help.about.libs", "使用的库" }, - { "hex.view.help.about.paths", "ImHex目录" }, - { "hex.view.help.documentation", "ImHex文档" }, - { "hex.view.help.pattern_cheat_sheet", "模式语言帮助"}, - { "hex.view.help.calc_cheat_sheet", "计算器帮助" }, - - { "hex.view.hexeditor.name", "Hex编辑器" }, - { "hex.view.hexeditor.create_file", "新建" }, - { "hex.view.hexeditor.open_file", "打开" }, - { "hex.view.hexeditor.open_project", "打开项目" }, - { "hex.view.hexeditor.save_project", "保存项目" }, - { "hex.view.hexeditor.save_data", "保存数据" }, - { "hex.view.hexeditor.open_base64", "打开Base64文件" }, - { "hex.view.hexeditor.load_enconding_file", "加载自定义编码定义文件" }, - { "hex.view.hexeditor.page", "页 {0} / {1}" }, - { "hex.view.hexeditor.save_as", "另存为" }, - { "hex.view.hexeditor.exit_application.title", "退出?" }, - { "hex.view.hexeditor.exit_application.desc", "工程还有为保存的更改。\n确定要退出吗?" }, - { "hex.view.hexeditor.script.title", "通过加载器脚本加载文件" }, - { "hex.view.hexeditor.script.desc", "通过Python加载器脚本加载文件。" }, - { "hex.view.hexeditor.script.script", "脚本" }, - { "hex.view.hexeditor.script.script.title", "加载器脚本:打开脚本" }, - { "hex.view.hexeditor.script.file", "文件" }, - { "hex.view.hexeditor.script.file.title", "加载器脚本:打开文件" }, - - { "hex.view.hexeditor.menu.file.open_file", "打开文件..." }, - { "hex.view.hexeditor.menu.file.open_recent", "打开最近"}, - { "hex.view.hexeditor.menu.file.save", "保存" }, - { "hex.view.hexeditor.menu.file.save_as", "另存为..." }, - { "hex.view.hexeditor.menu.file.close", "关闭" }, - { "hex.view.hexeditor.menu.file.quit", "退出ImHex" }, - { "hex.view.hexeditor.menu.file.open_project", "打开项目..." }, - { "hex.view.hexeditor.menu.file.save_project", "保存项目..." }, - { "hex.view.hexeditor.menu.file.load_encoding_file", "加载自定义编码..." }, - { "hex.view.hexeditor.menu.file.import", "导入..." }, - { "hex.view.hexeditor.menu.file.import.base64", "Base64文件" }, - { "hex.view.hexeditor.base64.import_error", "文件不是有效的Base64格式!" }, - { "hex.view.hexeditor.file_open_error", "打开文件失败!" }, - { "hex.view.hexeditor.menu.file.import.ips", "IPS补丁" }, - { "hex.view.hexeditor.menu.file.import.ips32", "IPS32补丁" }, - { "hex.view.hexeditor.menu.file.import.script", "带有加载器脚本的文件" }, - - { "hex.view.hexeditor.menu.file.export", "导出..." }, - { "hex.view.hexeditor.menu.file.export.title", "导出文件" }, - { "hex.view.hexeditor.menu.file.export.ips", "IPS补丁" }, - { "hex.view.hexeditor.menu.file.export.ips32", "IPS32补丁" }, - { "hex.view.hexeditor.menu.file.search", "搜索" }, - { "hex.view.hexeditor.search.string", "字符串" }, - { "hex.view.hexeditor.search.hex", "Hex" }, - { "hex.view.hexeditor.search.find", "查找" }, - { "hex.view.hexeditor.search.find_next", "查找下一个" }, - { "hex.view.hexeditor.search.find_prev", "查找上一个" }, - { "hex.view.hexeditor.menu.file.goto", "转到" }, - { "hex.view.hexeditor.goto.offset.absolute", "绝对" }, - { "hex.view.hexeditor.goto.offset.current", "当前" }, - { "hex.view.hexeditor.goto.offset.begin", "起始" }, - { "hex.view.hexeditor.goto.offset.end", "末尾" }, - { "hex.view.hexeditor.error.read_only", "无法获得写权限,文件以只读方式打开。" }, - { "hex.view.hexeditor.error.open", "打开文件失败!" }, - { "hex.view.hexeditor.error.create", "创建新文件失败!" }, - { "hex.view.hexeditor.menu.edit.undo", "撤销" }, - { "hex.view.hexeditor.menu.edit.redo", "重做" }, - { "hex.view.hexeditor.menu.edit.copy", "复制" }, - { "hex.view.hexeditor.menu.edit.copy_as", "复制为..." }, - { "hex.view.hexeditor.copy.hex", "字符串" }, - { "hex.view.hexeditor.copy.c", "C数组" }, - { "hex.view.hexeditor.copy.cpp", "C++数组" }, - { "hex.view.hexeditor.copy.csharp", "C#数组" }, - { "hex.view.hexeditor.copy.rust", "Rust数组" }, - { "hex.view.hexeditor.copy.python", "Python数组" }, - { "hex.view.hexeditor.copy.java", "Java数组" }, - { "hex.view.hexeditor.copy.js", "JavaScript数组" }, - { "hex.view.hexeditor.copy.ascii", "ASCII Art" }, - { "hex.view.hexeditor.copy.html", "HTML" }, - { "hex.view.hexeditor.menu.edit.paste", "粘贴" }, - { "hex.view.hexeditor.menu.edit.select_all", "全选" }, - { "hex.view.hexeditor.menu.edit.bookmark", "添加书签" }, - { "hex.view.hexeditor.menu.edit.set_base", "设置基地址" }, - { "hex.view.hexeditor.menu.edit.resize", "修改大小" }, - - { "hex.view.information.name", "数据信息" }, - { "hex.view.information.control", "控制" }, - { "hex.view.information.analyze", "分析" }, - { "hex.view.information.analyzing", "分析中..." }, - { "hex.view.information.region", "已分析区域" }, - { "hex.view.information.magic", "魔术信息" }, - { "hex.view.information.description", "描述:" }, - { "hex.view.information.mime", "MIME类型:" }, - { "hex.view.information.info_analysis", "信息分析" }, - { "hex.view.information.distribution", "字节分布" }, - { "hex.view.information.entropy", "熵" }, - { "hex.view.information.block_size", "块大小" }, - { "hex.view.information.block_size.desc", "{0} 块 × {1} 字节" }, - { "hex.view.information.file_entropy", "文件熵" }, - { "hex.view.information.highest_entropy", "最高熵" }, - { "hex.view.information.encrypted", "此数据似乎经过了加密或压缩!" }, - - { "hex.view.patches.name", "补丁" }, - { "hex.view.patches.offset", "偏移" }, - { "hex.view.patches.orig", "原始值" }, - { "hex.view.patches.patch", "修改值"}, - { "hex.view.patches.remove", "移除补丁" }, - - { "hex.view.pattern.name", "模式编辑器" }, - { "hex.view.pattern.accept_pattern", "接受模式" }, - { "hex.view.pattern.accept_pattern.desc", "一个或多个模式与所找到的数据类型兼容" }, - { "hex.view.pattern.accept_pattern.pattern_language", "模式" }, - { "hex.view.pattern.accept_pattern.question", "是否应用找到的模式?" }, - { "hex.view.pattern.menu.file.load_pattern", "加载模式文件..." }, - { "hex.view.pattern.open_pattern", "打开模式" }, - { "hex.view.pattern.evaluating", "计算中..." }, - { "hex.view.pattern.auto", "自动计算" }, - - { "hex.view.pattern_data.name", "模式数据" }, - { "hex.view.pattern_data.name", "名称" }, - { "hex.view.pattern_data.color", "颜色" }, - { "hex.view.pattern_data.offset", "偏移" }, - { "hex.view.pattern_data.size", "大小" }, - { "hex.view.pattern_data.type", "类型" }, - { "hex.view.pattern_data.value", "值" }, - - { "hex.view.settings.name", "设置" }, - - { "hex.view.strings.name", "字符串" }, - { "hex.view.strings.copy", "复制字符串" }, - { "hex.view.strings.demangle", "还原" }, - { "hex.view.strings.min_length", "最小长度" }, - { "hex.view.strings.filter", "过滤" }, - { "hex.view.strings.extract", "提取" }, - { "hex.view.strings.searching", "搜索中..." }, - { "hex.view.strings.offset", "偏移" }, - { "hex.view.strings.size", "大小" }, - { "hex.view.strings.string", "字符串" }, - { "hex.view.strings.demangle.title", "还原名" }, - { "hex.view.strings.demangle.copy", "复制" }, - - { "hex.view.tools.name", "工具" }, - - { "hex.view.yara.name", "Yara规则" }, - { "hex.view.yara.header.rules", "规则" }, - { "hex.view.yara.reload", "重新加载" }, - { "hex.view.yara.match", "匹配规则" }, - { "hex.view.yara.matching", "匹配中..." }, - { "hex.view.yara.error", "Yara编译器错误: " }, - { "hex.view.yara.header.matches", "匹配" }, - { "hex.view.yara.matches.identifier", "标识符" }, - { "hex.view.yara.whole_data", "全文件匹配!" }, - { "hex.view.yara.no_rules", "没有找到YARA规则。请将规则放到ImHex的'yara'目录下。" }, - - { "hex.view.constants.name", "常量" }, - { "hex.view.constants.row.category", "分类" }, - { "hex.view.constants.row.name", "名称" }, - { "hex.view.constants.row.desc", "描述" }, - { "hex.view.constants.row.value", "值" }, - - { "hex.view.store.name", "内容仓库" }, - { "hex.view.store.desc", "从ImHex在线数据库下载新内容" }, - { "hex.view.store.reload", "刷新" }, - { "hex.view.store.row.name", "名称" }, - { "hex.view.store.row.description", "描述" }, - { "hex.view.store.download", "下载" }, - { "hex.view.store.update", "更新" }, - { "hex.view.store.remove", "移除" }, - { "hex.view.store.tab.patterns", "模式" }, - { "hex.view.store.tab.libraries", "库" }, - { "hex.view.store.tab.magics", "魔术数据库" }, - { "hex.view.store.tab.constants", "常量" }, - { "hex.view.store.loading", "正在加载仓库内容..." }, - - - /* Builtin plugin features */ - - { "hex.builtin.command.calc.desc", "计算器" }, - { "hex.builtin.command.cmd.desc", "指令" }, - { "hex.builtin.command.cmd.result", "运行指令 '{0}'" }, - { "hex.builtin.command.web.desc", "网站解析" }, - { "hex.builtin.command.web.result", "导航到 '{0}'" }, - - // Use half angle for inspector names because displayable space - { "hex.builtin.inspector.binary", "二进制(8位)" }, - { "hex.builtin.inspector.u8", "uint8_t" }, - { "hex.builtin.inspector.s8", "int8_t" }, - { "hex.builtin.inspector.u16", "uint16_t" }, - { "hex.builtin.inspector.s16", "int16_t" }, - { "hex.builtin.inspector.u32", "uint32_t" }, - { "hex.builtin.inspector.s32", "int32_t" }, - { "hex.builtin.inspector.u64", "uint64_t" }, - { "hex.builtin.inspector.s64", "int64_t" }, - { "hex.builtin.inspector.float16", "半浮点(16位)" }, - { "hex.builtin.inspector.float", "float(32位单精度浮点)" }, - { "hex.builtin.inspector.double", "double(64位双精度浮点)" }, - { "hex.builtin.inspector.ascii", "ASCII字符" }, - { "hex.builtin.inspector.wide", "宽字符" }, - { "hex.builtin.inspector.utf8", "UTF-8代码点" }, - { "hex.builtin.inspector.string", "字符串" }, - { "hex.builtin.inspector.time32", "__time32_t" }, - { "hex.builtin.inspector.time64", "__time64_t" }, - { "hex.builtin.inspector.time", "time_t" }, - { "hex.builtin.inspector.guid", "GUID" }, - { "hex.builtin.inspector.rgba8", "RGBA8颜色" }, - - { "hex.builtin.nodes.constants", "常量" }, - { "hex.builtin.nodes.constants.int", "整数" }, - { "hex.builtin.nodes.constants.int.header", "整数" }, - { "hex.builtin.nodes.constants.int.output", "" }, - { "hex.builtin.nodes.constants.float", "浮点数" }, - { "hex.builtin.nodes.constants.float.header", "浮点数" }, - { "hex.builtin.nodes.constants.float.output", "" }, - { "hex.builtin.nodes.constants.nullptr", "空指针" }, - { "hex.builtin.nodes.constants.nullptr.header", "空指针" }, - { "hex.builtin.nodes.constants.nullptr.output", "" }, - { "hex.builtin.nodes.constants.buffer", "缓冲区" }, - { "hex.builtin.nodes.constants.buffer.header", "缓冲区" }, - { "hex.builtin.nodes.constants.buffer.size", "大小" }, - { "hex.builtin.nodes.constants.buffer.output", "" }, - { "hex.builtin.nodes.constants.string", "字符串" }, - { "hex.builtin.nodes.constants.string.header", "字符串" }, - { "hex.builtin.nodes.constants.string.output", "" }, - { "hex.builtin.nodes.constants.rgba8", "RGBA8颜色" }, - { "hex.builtin.nodes.constants.rgba8.header", "RGBA8颜色" }, - { "hex.builtin.nodes.constants.rgba8.output.r", "红" }, - { "hex.builtin.nodes.constants.rgba8.output.g", "绿" }, - { "hex.builtin.nodes.constants.rgba8.output.b", "蓝" }, - { "hex.builtin.nodes.constants.rgba8.output.a", "透明" }, - { "hex.builtin.nodes.constants.comment", "注释" }, - { "hex.builtin.nodes.constants.comment.header", "注释" }, - - { "hex.builtin.nodes.display", "显示" }, - { "hex.builtin.nodes.display.int", "整数" }, - { "hex.builtin.nodes.display.int.header", "整数显示" }, - { "hex.builtin.nodes.display.int.input", "值" }, - { "hex.builtin.nodes.display.float", "浮点数" }, - { "hex.builtin.nodes.display.float.header", "浮点数显示" }, - { "hex.builtin.nodes.display.float.input", "值" }, - - { "hex.builtin.nodes.data_access", "数据访问" }, - { "hex.builtin.nodes.data_access.read", "读取" }, - { "hex.builtin.nodes.data_access.read.header", "读取" }, - { "hex.builtin.nodes.data_access.read.address", "地址" }, - { "hex.builtin.nodes.data_access.read.size", "大小" }, - { "hex.builtin.nodes.data_access.read.data", "数据" }, - { "hex.builtin.nodes.data_access.write", "写入" }, - { "hex.builtin.nodes.data_access.write.header", "写入" }, - { "hex.builtin.nodes.data_access.write.address", "地址" }, - { "hex.builtin.nodes.data_access.write.data", "数据" }, - { "hex.builtin.nodes.data_access.size", "数据大小"}, - { "hex.builtin.nodes.data_access.size.header", "数据大小"}, - { "hex.builtin.nodes.data_access.size.size", "大小"}, - - { "hex.builtin.nodes.casting", "数据转换" }, - { "hex.builtin.nodes.casting.int_to_buffer", "整数到缓冲区" }, - { "hex.builtin.nodes.casting.int_to_buffer.header", "整数到缓冲区" }, - { "hex.builtin.nodes.casting.int_to_buffer.input", "输入" }, - { "hex.builtin.nodes.casting.int_to_buffer.output", "输出" }, - { "hex.builtin.nodes.casting.buffer_to_int", "缓冲区到整数" }, - { "hex.builtin.nodes.casting.buffer_to_int.header", "缓冲区到整数" }, - { "hex.builtin.nodes.casting.buffer_to_int.input", "输入" }, - { "hex.builtin.nodes.casting.buffer_to_int.output", "输出" }, - - { "hex.builtin.nodes.arithmetic", "运算" }, - { "hex.builtin.nodes.arithmetic.add", "加法" }, - { "hex.builtin.nodes.arithmetic.add.header", "加法" }, - { "hex.builtin.nodes.arithmetic.add.input.a", "输入A" }, - { "hex.builtin.nodes.arithmetic.add.input.b", "输入B" }, - { "hex.builtin.nodes.arithmetic.add.output", "输出" }, - { "hex.builtin.nodes.arithmetic.sub", "减法" }, - { "hex.builtin.nodes.arithmetic.sub.header", "减法" }, - { "hex.builtin.nodes.arithmetic.sub.input.a", "输入A" }, - { "hex.builtin.nodes.arithmetic.sub.input.b", "输入B" }, - { "hex.builtin.nodes.arithmetic.sub.output", "输出" }, - { "hex.builtin.nodes.arithmetic.mul", "乘法" }, - { "hex.builtin.nodes.arithmetic.mul.header", "乘法" }, - { "hex.builtin.nodes.arithmetic.mul.input.a", "输入A" }, - { "hex.builtin.nodes.arithmetic.mul.input.b", "输入B" }, - { "hex.builtin.nodes.arithmetic.mul.output", "输出" }, - { "hex.builtin.nodes.arithmetic.div", "除法" }, - { "hex.builtin.nodes.arithmetic.div.header", "除法" }, - { "hex.builtin.nodes.arithmetic.div.input.a", "输入A" }, - { "hex.builtin.nodes.arithmetic.div.input.b", "输入B" }, - { "hex.builtin.nodes.arithmetic.div.output", "输出" }, - { "hex.builtin.nodes.arithmetic.mod", "模数" }, - { "hex.builtin.nodes.arithmetic.mod.header", "模数" }, - { "hex.builtin.nodes.arithmetic.mod.input.a", "输入A" }, - { "hex.builtin.nodes.arithmetic.mod.input.b", "输入B" }, - { "hex.builtin.nodes.arithmetic.mod.output", "输出" }, - - { "hex.builtin.nodes.buffer", "缓冲区" }, - { "hex.builtin.nodes.buffer.combine", "组合" }, - { "hex.builtin.nodes.buffer.combine.header", "缓冲区组合" }, - { "hex.builtin.nodes.buffer.combine.input.a", "输入A" }, - { "hex.builtin.nodes.buffer.combine.input.b", "输入B" }, - { "hex.builtin.nodes.buffer.combine.output", "输出" }, - { "hex.builtin.nodes.buffer.slice", "切片" }, - { "hex.builtin.nodes.buffer.slice.header", "缓冲区切片" }, - { "hex.builtin.nodes.buffer.slice.input.buffer", "输入" }, - { "hex.builtin.nodes.buffer.slice.input.from", "从" }, - { "hex.builtin.nodes.buffer.slice.input.to", "到" }, - { "hex.builtin.nodes.buffer.slice.output", "输出" }, - { "hex.builtin.nodes.buffer.repeat", "重复" }, - { "hex.builtin.nodes.buffer.repeat.header", "缓冲区重复" }, - { "hex.builtin.nodes.buffer.repeat.input.buffer", "输入" }, - { "hex.builtin.nodes.buffer.repeat.input.count", "次数" }, - { "hex.builtin.nodes.buffer.repeat.output", "输出" }, - - { "hex.builtin.nodes.control_flow", "控制流" }, - { "hex.builtin.nodes.control_flow.if", "如果" }, - { "hex.builtin.nodes.control_flow.if.header", "如果" }, - { "hex.builtin.nodes.control_flow.if.condition", "条件" }, - { "hex.builtin.nodes.control_flow.if.true", "True" }, - { "hex.builtin.nodes.control_flow.if.false", "False" }, - { "hex.builtin.nodes.control_flow.if.output", "输出" }, - { "hex.builtin.nodes.control_flow.equals", "等于" }, - { "hex.builtin.nodes.control_flow.equals.header", "等于" }, - { "hex.builtin.nodes.control_flow.equals.input.a", "输入A" }, - { "hex.builtin.nodes.control_flow.equals.input.b", "输入B" }, - { "hex.builtin.nodes.control_flow.equals.output", "输出" }, - { "hex.builtin.nodes.control_flow.not", "取反" }, - { "hex.builtin.nodes.control_flow.not.header", "取反" }, - { "hex.builtin.nodes.control_flow.not.input", "输入" }, - { "hex.builtin.nodes.control_flow.not.output", "输出" }, - { "hex.builtin.nodes.control_flow.gt", "大于" }, - { "hex.builtin.nodes.control_flow.gt.header", "大于" }, - { "hex.builtin.nodes.control_flow.gt.input.a", "输入A" }, - { "hex.builtin.nodes.control_flow.gt.input.b", "输入B" }, - { "hex.builtin.nodes.control_flow.gt.output", "输出" }, - { "hex.builtin.nodes.control_flow.lt", "小于" }, - { "hex.builtin.nodes.control_flow.lt.header", "小于" }, - { "hex.builtin.nodes.control_flow.lt.input.a", "输入A" }, - { "hex.builtin.nodes.control_flow.lt.input.b", "输入B" }, - { "hex.builtin.nodes.control_flow.lt.output", "输出" }, - { "hex.builtin.nodes.control_flow.and", "与" }, - { "hex.builtin.nodes.control_flow.and.header", "逻辑与" }, - { "hex.builtin.nodes.control_flow.and.input.a", "输入A" }, - { "hex.builtin.nodes.control_flow.and.input.b", "输入B" }, - { "hex.builtin.nodes.control_flow.and.output", "输出" }, - { "hex.builtin.nodes.control_flow.or", "或" }, - { "hex.builtin.nodes.control_flow.or.header", "逻辑或" }, - { "hex.builtin.nodes.control_flow.or.input.a", "输入A" }, - { "hex.builtin.nodes.control_flow.or.input.b", "输入B" }, - { "hex.builtin.nodes.control_flow.or.output", "输出" }, - - { "hex.builtin.nodes.bitwise", "按位操作" }, - { "hex.builtin.nodes.bitwise.and", "与" }, - { "hex.builtin.nodes.bitwise.and.header", "位与" }, - { "hex.builtin.nodes.bitwise.and.input.a", "输入A" }, - { "hex.builtin.nodes.bitwise.and.input.b", "输入B" }, - { "hex.builtin.nodes.bitwise.and.output", "输出" }, - { "hex.builtin.nodes.bitwise.or", "或" }, - { "hex.builtin.nodes.bitwise.or.header", "位或" }, - { "hex.builtin.nodes.bitwise.or.input.a", "输入A" }, - { "hex.builtin.nodes.bitwise.or.input.b", "输入B" }, - { "hex.builtin.nodes.bitwise.or.output", "输出" }, - { "hex.builtin.nodes.bitwise.xor", "异或" }, - { "hex.builtin.nodes.bitwise.xor.header", "按位异或" }, - { "hex.builtin.nodes.bitwise.xor.input.a", "输入A" }, - { "hex.builtin.nodes.bitwise.xor.input.b", "输入B" }, - { "hex.builtin.nodes.bitwise.xor.output", "输出" }, - { "hex.builtin.nodes.bitwise.not", "取反" }, - { "hex.builtin.nodes.bitwise.not.header", "按位取反" }, - { "hex.builtin.nodes.bitwise.not.input", "输入" }, - { "hex.builtin.nodes.bitwise.not.output", "输出" }, - - { "hex.builtin.nodes.decoding", "编码" }, - { "hex.builtin.nodes.decoding.base64", "Base64" }, - { "hex.builtin.nodes.decoding.base64.header", "Base64解码" }, - { "hex.builtin.nodes.decoding.base64.input", "输入" }, - { "hex.builtin.nodes.decoding.base64.output", "输出" }, - { "hex.builtin.nodes.decoding.hex", "十六进制" }, - { "hex.builtin.nodes.decoding.hex.header", "十六进制解码" }, - { "hex.builtin.nodes.decoding.hex.input", "输入" }, - { "hex.builtin.nodes.decoding.hex.output", "输出" }, - - { "hex.builtin.nodes.crypto", "加密" }, - { "hex.builtin.nodes.crypto.aes", "AES解密" }, - { "hex.builtin.nodes.crypto.aes.header", "AES解密" }, - { "hex.builtin.nodes.crypto.aes.key", "密钥" }, - { "hex.builtin.nodes.crypto.aes.iv", "IV" }, - { "hex.builtin.nodes.crypto.aes.nonce", "Nonce" }, - { "hex.builtin.nodes.crypto.aes.input", "输入" }, - { "hex.builtin.nodes.crypto.aes.output", "输出" }, - { "hex.builtin.nodes.crypto.aes.mode", "模式" }, - { "hex.builtin.nodes.crypto.aes.key_length", "密钥长度" }, - - - - { "hex.builtin.tools.demangler", "Itanium/MSVC名还原" }, - { "hex.builtin.tools.demangler.mangled", "修饰名" }, - { "hex.builtin.tools.demangler.demangled", "还原名" }, - { "hex.builtin.tools.ascii_table", "ASCII表" }, - { "hex.builtin.tools.ascii_table.octal", "显示八进制" }, - { "hex.builtin.tools.regex_replacer", "正则替换" }, - { "hex.builtin.tools.regex_replacer.pattern", "正则表达式" }, - { "hex.builtin.tools.regex_replacer.replace", "替换表达式" }, - { "hex.builtin.tools.regex_replacer.input", "输入" }, - { "hex.builtin.tools.regex_replacer.output", "输出" }, - { "hex.builtin.tools.color", "颜色选择器" }, - { "hex.builtin.tools.calc", "计算器" }, - { "hex.builtin.tools.input", "输入" }, - { "hex.builtin.tools.format.standard", "标准" }, - { "hex.builtin.tools.format.scientific", "科学" }, - { "hex.builtin.tools.format.engineering", "工程师" }, - { "hex.builtin.tools.format.programmer", "程序员" }, - { "hex.builtin.tools.error", "最后错误: '{0}'" }, - { "hex.builtin.tools.history", "历史" }, - { "hex.builtin.tools.name", "名称" }, - { "hex.builtin.tools.value", "值" }, - { "hex.builtin.tools.base_converter", "基本进制转换" }, - { "hex.builtin.tools.base_converter.dec", "DEC" }, - { "hex.builtin.tools.base_converter.hex", "HEX" }, - { "hex.builtin.tools.base_converter.oct", "OCT" }, - { "hex.builtin.tools.base_converter.bin", "BIN" }, - { "hex.builtin.tools.permissions", "UNIX权限计算器" }, - { "hex.builtin.tools.permissions.perm_bits", "权限位" }, - { "hex.builtin.tools.permissions.absolute", "绝对符号" }, - { "hex.builtin.tools.permissions.setuid_error", "用户必须具有 setuid 位的执行权限才能应用!" }, - { "hex.builtin.tools.permissions.setgid_error", "组必须具有 setgid 位的执行权限才能应用!" }, - { "hex.builtin.tools.permissions.sticky_error", "必须有执行权限才能申请粘滞位!" }, - { "hex.builtin.tools.file_uploader", "文件上传" }, - { "hex.builtin.tools.file_uploader.control", "控制" }, - { "hex.builtin.tools.file_uploader.upload", "上传" }, - { "hex.builtin.tools.file_uploader.done", "完成!" }, - { "hex.builtin.tools.file_uploader.recent", "最近上传" }, - { "hex.builtin.tools.file_uploader.tooltip", "点击复制\n按住CTRL并点击以打开" }, - { "hex.builtin.tools.file_uploader.invalid_response", "接收到来自Anonfiles的无效响应!" }, - { "hex.builtin.tools.file_uploader.error", "上传文件失败!\n\n错误代码:{0}" }, - { "hex.builtin.tools.wiki_explain", "维基百科术语定义" }, - { "hex.builtin.tools.wiki_explain.control", "控制" }, - { "hex.builtin.tools.wiki_explain.search", "搜索" }, - { "hex.builtin.tools.wiki_explain.results", "结果" }, - { "hex.builtin.tools.wiki_explain.invalid_response", "接收到来自Wikipedia的无效响应!" }, - - { "hex.builtin.setting.imhex", "ImHex" }, - { "hex.builtin.setting.imhex.recent_files", "最近文件" }, - { "hex.builtin.setting.general", "通用" }, - { "hex.builtin.setting.general.show_tips", "在启动时显示每日提示" }, - { "hex.builtin.setting.interface", "界面" }, - { "hex.builtin.setting.interface.color", "颜色主题" }, - { "hex.builtin.setting.interface.color.system", "跟随系统" }, - { "hex.builtin.setting.interface.color.dark", "暗" }, - { "hex.builtin.setting.interface.color.light", "亮" }, - { "hex.builtin.setting.interface.color.classic", "经典" }, - { "hex.builtin.setting.interface.scaling", "缩放" }, - { "hex.builtin.setting.interface.scaling.native", "本地默认" }, - { "hex.builtin.setting.interface.scaling.x0_5", "x0.5" }, - { "hex.builtin.setting.interface.scaling.x1_0", "x1.0" }, - { "hex.builtin.setting.interface.scaling.x1_5", "x1.5" }, - { "hex.builtin.setting.interface.scaling.x2_0", "x2.0" }, - { "hex.builtin.setting.interface.language", "语言" }, - { "hex.builtin.setting.interface.fps", "FPS限制" }, - { "hex.builtin.setting.interface.highlight_alpha", "高亮不透明度" }, - - { "hex.builtin.provider.file.path", "路径" }, - { "hex.builtin.provider.file.size", "大小" }, - { "hex.builtin.provider.file.creation", "创建时间" }, - { "hex.builtin.provider.file.access", "最后访问时间" }, - { "hex.builtin.provider.file.modification", "最后更改时间" }, - }); - } - -} \ No newline at end of file +#include +#include + +namespace hex::plugin::builtin { + + void registerLanguageZhCN() { + ContentRegistry::Language::registerLanguage("Chinese (Simplified)", "zh-CN"); + + ContentRegistry::Language::addLocalizations("zh-CN", { + /* ImHex default functionality */ + { "hex.menu.file", "文件" }, + { "hex.menu.edit", "编辑" }, + { "hex.menu.view", "视图" }, + { "hex.menu.view.fps", "显示FPS" }, + { "hex.menu.view.demo", "显示ImGui演示" }, + { "hex.menu.help", "帮助" }, + { "hex.menu.feedback", "反馈" }, + { "hex.menu.debug_build", "调试构建"}, + + { "hex.welcome.header.main", "欢迎来到ImHex" }, + { "hex.welcome.header.start", "开始" }, + { "hex.welcome.start.create_file", "创建新文件" }, + { "hex.welcome.start.open_file", "打开文件" }, + { "hex.welcome.start.open_project", "打开工程" }, + { "hex.welcome.start.recent", "最近文件" }, + { "hex.welcome.header.help", "帮助" }, + { "hex.welcome.help.repo", "GitHub仓库" }, + { "hex.welcome.help.repo.link", "https://github.com/WerWolv/ImHex" }, + { "hex.welcome.help.gethelp", "获得帮助" }, + { "hex.welcome.help.gethelp.link", "https://github.com/WerWolv/ImHex/discussions/categories/get-help" }, + { "hex.welcome.header.plugins", "已加载插件" }, + { "hex.welcome.plugins.plugin", "插件" }, + { "hex.welcome.plugins.author", "作者" }, + { "hex.welcome.plugins.desc", "描述" }, + { "hex.welcome.header.customize", "自定义" }, + { "hex.welcome.customize.settings.title", "设置" }, + { "hex.welcome.customize.settings.desc", "更改ImHex的设置" }, + { "hex.welcome.header.update", "更新" }, + { "hex.welcome.update.title", "新的更新可用!" }, + { "hex.welcome.update.desc", "ImHex {0} 已发布!在这里下载。" }, + { "hex.welcome.update.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.welcome.header.learn", "学习" }, + { "hex.welcome.learn.latest.title", "最新版本" }, + { "hex.welcome.learn.latest.desc", "阅读ImHex最新版本的更改日志" }, + { "hex.welcome.learn.latest.link", "https://github.com/WerWolv/ImHex/releases/latest" }, + { "hex.welcome.learn.pattern.title", "模式文档" }, + { "hex.welcome.learn.pattern.desc", "如何基于我们完善的文档编写ImHex模式" }, + { "hex.welcome.learn.pattern.link", "https://imhex.werwolv.net/docs/pattern_language/pattern_language.html" }, + { "hex.welcome.learn.plugins.title", "插件API" }, + { "hex.welcome.learn.plugins.desc", "通过插件扩展ImHex获得更多功能" }, + { "hex.welcome.learn.plugins.link", "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide" }, + { "hex.welcome.header.various", "杂项" }, + { "hex.welcome.tip_of_the_day", "小提示" }, + + { "hex.safety_backup.title", "恢复丢失数据" }, + { "hex.safety_backup.desc", "不!ImHex上次崩溃了\n你想恢复你之前的工作吗?"}, + { "hex.safety_backup.restore", "恢复" }, + { "hex.safety_backup.delete", "删除" }, + + + { "hex.common.little_endian", "小端序" }, + { "hex.common.big_endian", "大端序" }, + { "hex.common.decimal", "十进制" }, + { "hex.common.hexadecimal", "十六进制" }, + { "hex.common.octal", "八进制" }, + { "hex.common.error", "错误" }, + { "hex.common.fatal", "致命错误" }, + { "hex.common.address", "地址" }, + { "hex.common.size", "大小" }, + { "hex.common.region", "区域" }, + { "hex.common.match_selection", "匹配选择" }, + { "hex.common.yes", "是" }, + { "hex.common.no", "否" }, + { "hex.common.okay", "好的" }, + { "hex.common.load", "加载" }, + { "hex.common.cancel", "取消" }, + { "hex.common.set", "设置" }, + { "hex.common.close", "关闭文件" }, + { "hex.common.dont_show_again", "不要再次显示" }, + { "hex.common.link", "链接" }, + { "hex.common.file", "文件" }, + + { "hex.view.bookmarks.name", "书签" }, + { "hex.view.bookmarks.default_title", "书签 [0x{0:X} - 0x{1:X}]" }, + { "hex.view.bookmarks.no_bookmarks", "空空如也。通过 编辑->添加书签 添加一个" }, + { "hex.view.bookmarks.title.info", "信息" }, + { "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} 字节)" }, + { "hex.view.bookmarks.button.jump", "转到" }, + { "hex.view.bookmarks.button.remove", "移除" }, + { "hex.view.bookmarks.header.name", "名称" }, + { "hex.view.bookmarks.header.color", "颜色" }, + { "hex.view.bookmarks.header.comment", "注释" }, + + { "hex.view.command_palette.name", "命令栏" }, + + { "hex.view.data_inspector.name", "数据分析器" }, + { "hex.view.data_inspector.table.name", "名称" }, + { "hex.view.data_inspector.table.value", "值" }, + + { "hex.view.data_processor.name", "数据处理器" }, + { "hex.view.data_processor.menu.remove_selection", "移除已选" }, + { "hex.view.data_processor.menu.remove_node", "移除节点" }, + { "hex.view.data_processor.menu.remove_link", "移除链接" }, + + { "hex.view.disassembler.name", "反汇编" }, + { "hex.view.disassembler.position", "位置" }, + { "hex.view.disassembler.base", "基地址" }, + { "hex.view.disassembler.region", "代码范围" }, + { "hex.view.disassembler.settings.header", "设置" }, + { "hex.view.disassembler.arch", "架构" }, + { "hex.view.disassembler.arm.arm", "ARM" }, + { "hex.view.disassembler.arm.thumb", "Thumb" }, + { "hex.view.disassembler.arm.default", "默认" }, + { "hex.view.disassembler.arm.cortex_m", "Cortex-M" }, + { "hex.view.disassembler.arm.armv8", "ARMv8" }, + + { "hex.view.disassembler.mips.mips32", "MIPS32" }, + { "hex.view.disassembler.mips.mips64", "MIPS64" }, + { "hex.view.disassembler.mips.mips32R6", "MIPS32R6" }, + { "hex.view.disassembler.mips.micro", "Micro MIPS" }, + + { "hex.view.disassembler.x86.16bit", "16位" }, + { "hex.view.disassembler.x86.32bit", "32位" }, + { "hex.view.disassembler.x86.64bit", "64位" }, + + { "hex.view.disassembler.ppc.32bit", "32位" }, + { "hex.view.disassembler.ppc.64bit", "64位" }, + + { "hex.view.disassembler.sparc.v9", "Sparc V9" }, + + { "hex.view.disassembler.disassemble", "反汇编" }, + { "hex.view.disassembler.disassembling", "反汇编中..." }, + { "hex.view.disassembler.disassembly.title", "反汇编" }, + { "hex.view.disassembler.disassembly.address", "地址" }, + { "hex.view.disassembler.disassembly.offset", "偏移" }, + { "hex.view.disassembler.disassembly.bytes", "字节" }, + + { "hex.view.hashes.name", "哈希" }, + { "hex.view.hashes.settings", "设置" }, + { "hex.view.hashes.function", "哈希函数" }, + { "hex.view.hashes.iv", "初始值" }, + { "hex.view.hashes.poly", "多项式" }, + { "hex.view.hashes.result", "结果" }, + + { "hex.view.help.name", "帮助" }, + { "hex.view.help.about.name", "关于" }, + { "hex.view.help.about.translator", "由xtexChooser翻译" }, + { "hex.view.help.about.source", "源代码位于GitHub:" }, + { "hex.view.help.about.donations", "赞助" }, + { "hex.view.help.about.thanks", "如果你喜欢我的工作,请赞助以帮助此项目继续前进。非常感谢 <3" }, + { "hex.view.help.about.libs", "使用的库" }, + { "hex.view.help.about.paths", "ImHex目录" }, + { "hex.view.help.documentation", "ImHex文档" }, + { "hex.view.help.pattern_cheat_sheet", "模式语言帮助"}, + { "hex.view.help.calc_cheat_sheet", "计算器帮助" }, + + { "hex.view.hexeditor.name", "Hex编辑器" }, + { "hex.view.hexeditor.create_file", "新建" }, + { "hex.view.hexeditor.open_file", "打开" }, + { "hex.view.hexeditor.open_project", "打开项目" }, + { "hex.view.hexeditor.save_project", "保存项目" }, + { "hex.view.hexeditor.save_data", "保存数据" }, + { "hex.view.hexeditor.open_base64", "打开Base64文件" }, + { "hex.view.hexeditor.load_enconding_file", "加载自定义编码定义文件" }, + { "hex.view.hexeditor.page", "页 {0} / {1}" }, + { "hex.view.hexeditor.save_as", "另存为" }, + { "hex.view.hexeditor.exit_application.title", "退出?" }, + { "hex.view.hexeditor.exit_application.desc", "工程还有为保存的更改。\n确定要退出吗?" }, + { "hex.view.hexeditor.script.title", "通过加载器脚本加载文件" }, + { "hex.view.hexeditor.script.desc", "通过Python加载器脚本加载文件。" }, + { "hex.view.hexeditor.script.script", "脚本" }, + { "hex.view.hexeditor.script.script.title", "加载器脚本:打开脚本" }, + { "hex.view.hexeditor.script.file", "文件" }, + { "hex.view.hexeditor.script.file.title", "加载器脚本:打开文件" }, + + { "hex.view.hexeditor.menu.file.open_file", "打开文件..." }, + { "hex.view.hexeditor.menu.file.open_recent", "打开最近"}, + { "hex.view.hexeditor.menu.file.save", "保存" }, + { "hex.view.hexeditor.menu.file.save_as", "另存为..." }, + { "hex.view.hexeditor.menu.file.close", "关闭" }, + { "hex.view.hexeditor.menu.file.quit", "退出ImHex" }, + { "hex.view.hexeditor.menu.file.open_project", "打开项目..." }, + { "hex.view.hexeditor.menu.file.save_project", "保存项目..." }, + { "hex.view.hexeditor.menu.file.load_encoding_file", "加载自定义编码..." }, + { "hex.view.hexeditor.menu.file.import", "导入..." }, + { "hex.view.hexeditor.menu.file.import.base64", "Base64文件" }, + { "hex.view.hexeditor.base64.import_error", "文件不是有效的Base64格式!" }, + { "hex.view.hexeditor.file_open_error", "打开文件失败!" }, + { "hex.view.hexeditor.menu.file.import.ips", "IPS补丁" }, + { "hex.view.hexeditor.menu.file.import.ips32", "IPS32补丁" }, + { "hex.view.hexeditor.menu.file.import.script", "带有加载器脚本的文件" }, + + { "hex.view.hexeditor.menu.file.export", "导出..." }, + { "hex.view.hexeditor.menu.file.export.title", "导出文件" }, + { "hex.view.hexeditor.menu.file.export.ips", "IPS补丁" }, + { "hex.view.hexeditor.menu.file.export.ips32", "IPS32补丁" }, + { "hex.view.hexeditor.menu.file.search", "搜索" }, + { "hex.view.hexeditor.search.string", "字符串" }, + { "hex.view.hexeditor.search.hex", "Hex" }, + { "hex.view.hexeditor.search.find", "查找" }, + { "hex.view.hexeditor.search.find_next", "查找下一个" }, + { "hex.view.hexeditor.search.find_prev", "查找上一个" }, + { "hex.view.hexeditor.menu.file.goto", "转到" }, + { "hex.view.hexeditor.goto.offset.absolute", "绝对" }, + { "hex.view.hexeditor.goto.offset.current", "当前" }, + { "hex.view.hexeditor.goto.offset.begin", "起始" }, + { "hex.view.hexeditor.goto.offset.end", "末尾" }, + { "hex.view.hexeditor.error.read_only", "无法获得写权限,文件以只读方式打开。" }, + { "hex.view.hexeditor.error.open", "打开文件失败!" }, + { "hex.view.hexeditor.error.create", "创建新文件失败!" }, + { "hex.view.hexeditor.menu.edit.undo", "撤销" }, + { "hex.view.hexeditor.menu.edit.redo", "重做" }, + { "hex.view.hexeditor.menu.edit.copy", "复制" }, + { "hex.view.hexeditor.menu.edit.copy_as", "复制为..." }, + { "hex.view.hexeditor.copy.hex", "字符串" }, + { "hex.view.hexeditor.copy.c", "C数组" }, + { "hex.view.hexeditor.copy.cpp", "C++数组" }, + { "hex.view.hexeditor.copy.csharp", "C#数组" }, + { "hex.view.hexeditor.copy.rust", "Rust数组" }, + { "hex.view.hexeditor.copy.python", "Python数组" }, + { "hex.view.hexeditor.copy.java", "Java数组" }, + { "hex.view.hexeditor.copy.js", "JavaScript数组" }, + { "hex.view.hexeditor.copy.ascii", "ASCII Art" }, + { "hex.view.hexeditor.copy.html", "HTML" }, + { "hex.view.hexeditor.menu.edit.paste", "粘贴" }, + { "hex.view.hexeditor.menu.edit.select_all", "全选" }, + { "hex.view.hexeditor.menu.edit.bookmark", "添加书签" }, + { "hex.view.hexeditor.menu.edit.set_base", "设置基地址" }, + { "hex.view.hexeditor.menu.edit.resize", "修改大小" }, + + { "hex.view.information.name", "数据信息" }, + { "hex.view.information.control", "控制" }, + { "hex.view.information.analyze", "分析" }, + { "hex.view.information.analyzing", "分析中..." }, + { "hex.view.information.region", "已分析区域" }, + { "hex.view.information.magic", "魔术信息" }, + { "hex.view.information.description", "描述:" }, + { "hex.view.information.mime", "MIME类型:" }, + { "hex.view.information.info_analysis", "信息分析" }, + { "hex.view.information.distribution", "字节分布" }, + { "hex.view.information.entropy", "熵" }, + { "hex.view.information.block_size", "块大小" }, + { "hex.view.information.block_size.desc", "{0} 块 × {1} 字节" }, + { "hex.view.information.file_entropy", "文件熵" }, + { "hex.view.information.highest_entropy", "最高熵" }, + { "hex.view.information.encrypted", "此数据似乎经过了加密或压缩!" }, + + { "hex.view.patches.name", "补丁" }, + { "hex.view.patches.offset", "偏移" }, + { "hex.view.patches.orig", "原始值" }, + { "hex.view.patches.patch", "修改值"}, + { "hex.view.patches.remove", "移除补丁" }, + + { "hex.view.pattern.name", "模式编辑器" }, + { "hex.view.pattern.accept_pattern", "接受模式" }, + { "hex.view.pattern.accept_pattern.desc", "一个或多个模式与所找到的数据类型兼容" }, + { "hex.view.pattern.accept_pattern.pattern_language", "模式" }, + { "hex.view.pattern.accept_pattern.question", "是否应用找到的模式?" }, + { "hex.view.pattern.menu.file.load_pattern", "加载模式文件..." }, + { "hex.view.pattern.open_pattern", "打开模式" }, + { "hex.view.pattern.evaluating", "计算中..." }, + { "hex.view.pattern.auto", "自动计算" }, + + { "hex.view.pattern_data.name", "模式数据" }, + { "hex.view.pattern_data.name", "名称" }, + { "hex.view.pattern_data.color", "颜色" }, + { "hex.view.pattern_data.offset", "偏移" }, + { "hex.view.pattern_data.size", "大小" }, + { "hex.view.pattern_data.type", "类型" }, + { "hex.view.pattern_data.value", "值" }, + + { "hex.view.settings.name", "设置" }, + + { "hex.view.strings.name", "字符串" }, + { "hex.view.strings.copy", "复制字符串" }, + { "hex.view.strings.demangle", "还原" }, + { "hex.view.strings.min_length", "最小长度" }, + { "hex.view.strings.filter", "过滤" }, + { "hex.view.strings.extract", "提取" }, + { "hex.view.strings.searching", "搜索中..." }, + { "hex.view.strings.offset", "偏移" }, + { "hex.view.strings.size", "大小" }, + { "hex.view.strings.string", "字符串" }, + { "hex.view.strings.demangle.title", "还原名" }, + { "hex.view.strings.demangle.copy", "复制" }, + + { "hex.view.tools.name", "工具" }, + + { "hex.view.yara.name", "Yara规则" }, + { "hex.view.yara.header.rules", "规则" }, + { "hex.view.yara.reload", "重新加载" }, + { "hex.view.yara.match", "匹配规则" }, + { "hex.view.yara.matching", "匹配中..." }, + { "hex.view.yara.error", "Yara编译器错误: " }, + { "hex.view.yara.header.matches", "匹配" }, + { "hex.view.yara.matches.identifier", "标识符" }, + { "hex.view.yara.whole_data", "全文件匹配!" }, + { "hex.view.yara.no_rules", "没有找到YARA规则。请将规则放到ImHex的'yara'目录下。" }, + + { "hex.view.constants.name", "常量" }, + { "hex.view.constants.row.category", "分类" }, + { "hex.view.constants.row.name", "名称" }, + { "hex.view.constants.row.desc", "描述" }, + { "hex.view.constants.row.value", "值" }, + + { "hex.view.store.name", "内容仓库" }, + { "hex.view.store.desc", "从ImHex在线数据库下载新内容" }, + { "hex.view.store.reload", "刷新" }, + { "hex.view.store.row.name", "名称" }, + { "hex.view.store.row.description", "描述" }, + { "hex.view.store.download", "下载" }, + { "hex.view.store.update", "更新" }, + { "hex.view.store.remove", "移除" }, + { "hex.view.store.tab.patterns", "模式" }, + { "hex.view.store.tab.libraries", "库" }, + { "hex.view.store.tab.magics", "魔术数据库" }, + { "hex.view.store.tab.constants", "常量" }, + { "hex.view.store.loading", "正在加载仓库内容..." }, + + + /* Builtin plugin features */ + + { "hex.builtin.command.calc.desc", "计算器" }, + { "hex.builtin.command.cmd.desc", "指令" }, + { "hex.builtin.command.cmd.result", "运行指令 '{0}'" }, + { "hex.builtin.command.web.desc", "网站解析" }, + { "hex.builtin.command.web.result", "导航到 '{0}'" }, + + // Use half angle for inspector names because displayable space + { "hex.builtin.inspector.binary", "二进制(8位)" }, + { "hex.builtin.inspector.u8", "uint8_t" }, + { "hex.builtin.inspector.s8", "int8_t" }, + { "hex.builtin.inspector.u16", "uint16_t" }, + { "hex.builtin.inspector.s16", "int16_t" }, + { "hex.builtin.inspector.u32", "uint32_t" }, + { "hex.builtin.inspector.s32", "int32_t" }, + { "hex.builtin.inspector.u64", "uint64_t" }, + { "hex.builtin.inspector.s64", "int64_t" }, + { "hex.builtin.inspector.float16", "半浮点(16位)" }, + { "hex.builtin.inspector.float", "float(32位单精度浮点)" }, + { "hex.builtin.inspector.double", "double(64位双精度浮点)" }, + { "hex.builtin.inspector.ascii", "ASCII字符" }, + { "hex.builtin.inspector.wide", "宽字符" }, + { "hex.builtin.inspector.utf8", "UTF-8代码点" }, + { "hex.builtin.inspector.string", "字符串" }, + { "hex.builtin.inspector.time32", "__time32_t" }, + { "hex.builtin.inspector.time64", "__time64_t" }, + { "hex.builtin.inspector.time", "time_t" }, + { "hex.builtin.inspector.guid", "GUID" }, + { "hex.builtin.inspector.rgba8", "RGBA8颜色" }, + + { "hex.builtin.nodes.constants", "常量" }, + { "hex.builtin.nodes.constants.int", "整数" }, + { "hex.builtin.nodes.constants.int.header", "整数" }, + { "hex.builtin.nodes.constants.int.output", "" }, + { "hex.builtin.nodes.constants.float", "浮点数" }, + { "hex.builtin.nodes.constants.float.header", "浮点数" }, + { "hex.builtin.nodes.constants.float.output", "" }, + { "hex.builtin.nodes.constants.nullptr", "空指针" }, + { "hex.builtin.nodes.constants.nullptr.header", "空指针" }, + { "hex.builtin.nodes.constants.nullptr.output", "" }, + { "hex.builtin.nodes.constants.buffer", "缓冲区" }, + { "hex.builtin.nodes.constants.buffer.header", "缓冲区" }, + { "hex.builtin.nodes.constants.buffer.size", "大小" }, + { "hex.builtin.nodes.constants.buffer.output", "" }, + { "hex.builtin.nodes.constants.string", "字符串" }, + { "hex.builtin.nodes.constants.string.header", "字符串" }, + { "hex.builtin.nodes.constants.string.output", "" }, + { "hex.builtin.nodes.constants.rgba8", "RGBA8颜色" }, + { "hex.builtin.nodes.constants.rgba8.header", "RGBA8颜色" }, + { "hex.builtin.nodes.constants.rgba8.output.r", "红" }, + { "hex.builtin.nodes.constants.rgba8.output.g", "绿" }, + { "hex.builtin.nodes.constants.rgba8.output.b", "蓝" }, + { "hex.builtin.nodes.constants.rgba8.output.a", "透明" }, + { "hex.builtin.nodes.constants.comment", "注释" }, + { "hex.builtin.nodes.constants.comment.header", "注释" }, + + { "hex.builtin.nodes.display", "显示" }, + { "hex.builtin.nodes.display.int", "整数" }, + { "hex.builtin.nodes.display.int.header", "整数显示" }, + { "hex.builtin.nodes.display.int.input", "值" }, + { "hex.builtin.nodes.display.float", "浮点数" }, + { "hex.builtin.nodes.display.float.header", "浮点数显示" }, + { "hex.builtin.nodes.display.float.input", "值" }, + + { "hex.builtin.nodes.data_access", "数据访问" }, + { "hex.builtin.nodes.data_access.read", "读取" }, + { "hex.builtin.nodes.data_access.read.header", "读取" }, + { "hex.builtin.nodes.data_access.read.address", "地址" }, + { "hex.builtin.nodes.data_access.read.size", "大小" }, + { "hex.builtin.nodes.data_access.read.data", "数据" }, + { "hex.builtin.nodes.data_access.write", "写入" }, + { "hex.builtin.nodes.data_access.write.header", "写入" }, + { "hex.builtin.nodes.data_access.write.address", "地址" }, + { "hex.builtin.nodes.data_access.write.data", "数据" }, + { "hex.builtin.nodes.data_access.size", "数据大小"}, + { "hex.builtin.nodes.data_access.size.header", "数据大小"}, + { "hex.builtin.nodes.data_access.size.size", "大小"}, + + { "hex.builtin.nodes.casting", "数据转换" }, + { "hex.builtin.nodes.casting.int_to_buffer", "整数到缓冲区" }, + { "hex.builtin.nodes.casting.int_to_buffer.header", "整数到缓冲区" }, + { "hex.builtin.nodes.casting.int_to_buffer.input", "输入" }, + { "hex.builtin.nodes.casting.int_to_buffer.output", "输出" }, + { "hex.builtin.nodes.casting.buffer_to_int", "缓冲区到整数" }, + { "hex.builtin.nodes.casting.buffer_to_int.header", "缓冲区到整数" }, + { "hex.builtin.nodes.casting.buffer_to_int.input", "输入" }, + { "hex.builtin.nodes.casting.buffer_to_int.output", "输出" }, + + { "hex.builtin.nodes.arithmetic", "运算" }, + { "hex.builtin.nodes.arithmetic.add", "加法" }, + { "hex.builtin.nodes.arithmetic.add.header", "加法" }, + { "hex.builtin.nodes.arithmetic.add.input.a", "输入A" }, + { "hex.builtin.nodes.arithmetic.add.input.b", "输入B" }, + { "hex.builtin.nodes.arithmetic.add.output", "输出" }, + { "hex.builtin.nodes.arithmetic.sub", "减法" }, + { "hex.builtin.nodes.arithmetic.sub.header", "减法" }, + { "hex.builtin.nodes.arithmetic.sub.input.a", "输入A" }, + { "hex.builtin.nodes.arithmetic.sub.input.b", "输入B" }, + { "hex.builtin.nodes.arithmetic.sub.output", "输出" }, + { "hex.builtin.nodes.arithmetic.mul", "乘法" }, + { "hex.builtin.nodes.arithmetic.mul.header", "乘法" }, + { "hex.builtin.nodes.arithmetic.mul.input.a", "输入A" }, + { "hex.builtin.nodes.arithmetic.mul.input.b", "输入B" }, + { "hex.builtin.nodes.arithmetic.mul.output", "输出" }, + { "hex.builtin.nodes.arithmetic.div", "除法" }, + { "hex.builtin.nodes.arithmetic.div.header", "除法" }, + { "hex.builtin.nodes.arithmetic.div.input.a", "输入A" }, + { "hex.builtin.nodes.arithmetic.div.input.b", "输入B" }, + { "hex.builtin.nodes.arithmetic.div.output", "输出" }, + { "hex.builtin.nodes.arithmetic.mod", "模数" }, + { "hex.builtin.nodes.arithmetic.mod.header", "模数" }, + { "hex.builtin.nodes.arithmetic.mod.input.a", "输入A" }, + { "hex.builtin.nodes.arithmetic.mod.input.b", "输入B" }, + { "hex.builtin.nodes.arithmetic.mod.output", "输出" }, + + { "hex.builtin.nodes.buffer", "缓冲区" }, + { "hex.builtin.nodes.buffer.combine", "组合" }, + { "hex.builtin.nodes.buffer.combine.header", "缓冲区组合" }, + { "hex.builtin.nodes.buffer.combine.input.a", "输入A" }, + { "hex.builtin.nodes.buffer.combine.input.b", "输入B" }, + { "hex.builtin.nodes.buffer.combine.output", "输出" }, + { "hex.builtin.nodes.buffer.slice", "切片" }, + { "hex.builtin.nodes.buffer.slice.header", "缓冲区切片" }, + { "hex.builtin.nodes.buffer.slice.input.buffer", "输入" }, + { "hex.builtin.nodes.buffer.slice.input.from", "从" }, + { "hex.builtin.nodes.buffer.slice.input.to", "到" }, + { "hex.builtin.nodes.buffer.slice.output", "输出" }, + { "hex.builtin.nodes.buffer.repeat", "重复" }, + { "hex.builtin.nodes.buffer.repeat.header", "缓冲区重复" }, + { "hex.builtin.nodes.buffer.repeat.input.buffer", "输入" }, + { "hex.builtin.nodes.buffer.repeat.input.count", "次数" }, + { "hex.builtin.nodes.buffer.repeat.output", "输出" }, + + { "hex.builtin.nodes.control_flow", "控制流" }, + { "hex.builtin.nodes.control_flow.if", "如果" }, + { "hex.builtin.nodes.control_flow.if.header", "如果" }, + { "hex.builtin.nodes.control_flow.if.condition", "条件" }, + { "hex.builtin.nodes.control_flow.if.true", "True" }, + { "hex.builtin.nodes.control_flow.if.false", "False" }, + { "hex.builtin.nodes.control_flow.if.output", "输出" }, + { "hex.builtin.nodes.control_flow.equals", "等于" }, + { "hex.builtin.nodes.control_flow.equals.header", "等于" }, + { "hex.builtin.nodes.control_flow.equals.input.a", "输入A" }, + { "hex.builtin.nodes.control_flow.equals.input.b", "输入B" }, + { "hex.builtin.nodes.control_flow.equals.output", "输出" }, + { "hex.builtin.nodes.control_flow.not", "取反" }, + { "hex.builtin.nodes.control_flow.not.header", "取反" }, + { "hex.builtin.nodes.control_flow.not.input", "输入" }, + { "hex.builtin.nodes.control_flow.not.output", "输出" }, + { "hex.builtin.nodes.control_flow.gt", "大于" }, + { "hex.builtin.nodes.control_flow.gt.header", "大于" }, + { "hex.builtin.nodes.control_flow.gt.input.a", "输入A" }, + { "hex.builtin.nodes.control_flow.gt.input.b", "输入B" }, + { "hex.builtin.nodes.control_flow.gt.output", "输出" }, + { "hex.builtin.nodes.control_flow.lt", "小于" }, + { "hex.builtin.nodes.control_flow.lt.header", "小于" }, + { "hex.builtin.nodes.control_flow.lt.input.a", "输入A" }, + { "hex.builtin.nodes.control_flow.lt.input.b", "输入B" }, + { "hex.builtin.nodes.control_flow.lt.output", "输出" }, + { "hex.builtin.nodes.control_flow.and", "与" }, + { "hex.builtin.nodes.control_flow.and.header", "逻辑与" }, + { "hex.builtin.nodes.control_flow.and.input.a", "输入A" }, + { "hex.builtin.nodes.control_flow.and.input.b", "输入B" }, + { "hex.builtin.nodes.control_flow.and.output", "输出" }, + { "hex.builtin.nodes.control_flow.or", "或" }, + { "hex.builtin.nodes.control_flow.or.header", "逻辑或" }, + { "hex.builtin.nodes.control_flow.or.input.a", "输入A" }, + { "hex.builtin.nodes.control_flow.or.input.b", "输入B" }, + { "hex.builtin.nodes.control_flow.or.output", "输出" }, + + { "hex.builtin.nodes.bitwise", "按位操作" }, + { "hex.builtin.nodes.bitwise.and", "与" }, + { "hex.builtin.nodes.bitwise.and.header", "位与" }, + { "hex.builtin.nodes.bitwise.and.input.a", "输入A" }, + { "hex.builtin.nodes.bitwise.and.input.b", "输入B" }, + { "hex.builtin.nodes.bitwise.and.output", "输出" }, + { "hex.builtin.nodes.bitwise.or", "或" }, + { "hex.builtin.nodes.bitwise.or.header", "位或" }, + { "hex.builtin.nodes.bitwise.or.input.a", "输入A" }, + { "hex.builtin.nodes.bitwise.or.input.b", "输入B" }, + { "hex.builtin.nodes.bitwise.or.output", "输出" }, + { "hex.builtin.nodes.bitwise.xor", "异或" }, + { "hex.builtin.nodes.bitwise.xor.header", "按位异或" }, + { "hex.builtin.nodes.bitwise.xor.input.a", "输入A" }, + { "hex.builtin.nodes.bitwise.xor.input.b", "输入B" }, + { "hex.builtin.nodes.bitwise.xor.output", "输出" }, + { "hex.builtin.nodes.bitwise.not", "取反" }, + { "hex.builtin.nodes.bitwise.not.header", "按位取反" }, + { "hex.builtin.nodes.bitwise.not.input", "输入" }, + { "hex.builtin.nodes.bitwise.not.output", "输出" }, + + { "hex.builtin.nodes.decoding", "编码" }, + { "hex.builtin.nodes.decoding.base64", "Base64" }, + { "hex.builtin.nodes.decoding.base64.header", "Base64解码" }, + { "hex.builtin.nodes.decoding.base64.input", "输入" }, + { "hex.builtin.nodes.decoding.base64.output", "输出" }, + { "hex.builtin.nodes.decoding.hex", "十六进制" }, + { "hex.builtin.nodes.decoding.hex.header", "十六进制解码" }, + { "hex.builtin.nodes.decoding.hex.input", "输入" }, + { "hex.builtin.nodes.decoding.hex.output", "输出" }, + + { "hex.builtin.nodes.crypto", "加密" }, + { "hex.builtin.nodes.crypto.aes", "AES解密" }, + { "hex.builtin.nodes.crypto.aes.header", "AES解密" }, + { "hex.builtin.nodes.crypto.aes.key", "密钥" }, + { "hex.builtin.nodes.crypto.aes.iv", "IV" }, + { "hex.builtin.nodes.crypto.aes.nonce", "Nonce" }, + { "hex.builtin.nodes.crypto.aes.input", "输入" }, + { "hex.builtin.nodes.crypto.aes.output", "输出" }, + { "hex.builtin.nodes.crypto.aes.mode", "模式" }, + { "hex.builtin.nodes.crypto.aes.key_length", "密钥长度" }, + + + + { "hex.builtin.tools.demangler", "Itanium/MSVC名还原" }, + { "hex.builtin.tools.demangler.mangled", "修饰名" }, + { "hex.builtin.tools.demangler.demangled", "还原名" }, + { "hex.builtin.tools.ascii_table", "ASCII表" }, + { "hex.builtin.tools.ascii_table.octal", "显示八进制" }, + { "hex.builtin.tools.regex_replacer", "正则替换" }, + { "hex.builtin.tools.regex_replacer.pattern", "正则表达式" }, + { "hex.builtin.tools.regex_replacer.replace", "替换表达式" }, + { "hex.builtin.tools.regex_replacer.input", "输入" }, + { "hex.builtin.tools.regex_replacer.output", "输出" }, + { "hex.builtin.tools.color", "颜色选择器" }, + { "hex.builtin.tools.calc", "计算器" }, + { "hex.builtin.tools.input", "输入" }, + { "hex.builtin.tools.format.standard", "标准" }, + { "hex.builtin.tools.format.scientific", "科学" }, + { "hex.builtin.tools.format.engineering", "工程师" }, + { "hex.builtin.tools.format.programmer", "程序员" }, + { "hex.builtin.tools.error", "最后错误: '{0}'" }, + { "hex.builtin.tools.history", "历史" }, + { "hex.builtin.tools.name", "名称" }, + { "hex.builtin.tools.value", "值" }, + { "hex.builtin.tools.base_converter", "基本进制转换" }, + { "hex.builtin.tools.base_converter.dec", "DEC" }, + { "hex.builtin.tools.base_converter.hex", "HEX" }, + { "hex.builtin.tools.base_converter.oct", "OCT" }, + { "hex.builtin.tools.base_converter.bin", "BIN" }, + { "hex.builtin.tools.permissions", "UNIX权限计算器" }, + { "hex.builtin.tools.permissions.perm_bits", "权限位" }, + { "hex.builtin.tools.permissions.absolute", "绝对符号" }, + { "hex.builtin.tools.permissions.setuid_error", "用户必须具有 setuid 位的执行权限才能应用!" }, + { "hex.builtin.tools.permissions.setgid_error", "组必须具有 setgid 位的执行权限才能应用!" }, + { "hex.builtin.tools.permissions.sticky_error", "必须有执行权限才能申请粘滞位!" }, + { "hex.builtin.tools.file_uploader", "文件上传" }, + { "hex.builtin.tools.file_uploader.control", "控制" }, + { "hex.builtin.tools.file_uploader.upload", "上传" }, + { "hex.builtin.tools.file_uploader.done", "完成!" }, + { "hex.builtin.tools.file_uploader.recent", "最近上传" }, + { "hex.builtin.tools.file_uploader.tooltip", "点击复制\n按住CTRL并点击以打开" }, + { "hex.builtin.tools.file_uploader.invalid_response", "接收到来自Anonfiles的无效响应!" }, + { "hex.builtin.tools.file_uploader.error", "上传文件失败!\n\n错误代码:{0}" }, + { "hex.builtin.tools.wiki_explain", "维基百科术语定义" }, + { "hex.builtin.tools.wiki_explain.control", "控制" }, + { "hex.builtin.tools.wiki_explain.search", "搜索" }, + { "hex.builtin.tools.wiki_explain.results", "结果" }, + { "hex.builtin.tools.wiki_explain.invalid_response", "接收到来自Wikipedia的无效响应!" }, + + { "hex.builtin.setting.imhex", "ImHex" }, + { "hex.builtin.setting.imhex.recent_files", "最近文件" }, + { "hex.builtin.setting.general", "通用" }, + { "hex.builtin.setting.general.show_tips", "在启动时显示每日提示" }, + { "hex.builtin.setting.interface", "界面" }, + { "hex.builtin.setting.interface.color", "颜色主题" }, + { "hex.builtin.setting.interface.color.system", "跟随系统" }, + { "hex.builtin.setting.interface.color.dark", "暗" }, + { "hex.builtin.setting.interface.color.light", "亮" }, + { "hex.builtin.setting.interface.color.classic", "经典" }, + { "hex.builtin.setting.interface.scaling", "缩放" }, + { "hex.builtin.setting.interface.scaling.native", "本地默认" }, + { "hex.builtin.setting.interface.scaling.x0_5", "x0.5" }, + { "hex.builtin.setting.interface.scaling.x1_0", "x1.0" }, + { "hex.builtin.setting.interface.scaling.x1_5", "x1.5" }, + { "hex.builtin.setting.interface.scaling.x2_0", "x2.0" }, + { "hex.builtin.setting.interface.language", "语言" }, + { "hex.builtin.setting.interface.fps", "FPS限制" }, + { "hex.builtin.setting.interface.highlight_alpha", "高亮不透明度" }, + + { "hex.builtin.provider.file.path", "路径" }, + { "hex.builtin.provider.file.size", "大小" }, + { "hex.builtin.provider.file.creation", "创建时间" }, + { "hex.builtin.provider.file.access", "最后访问时间" }, + { "hex.builtin.provider.file.modification", "最后更改时间" }, + }); + } + +} diff --git a/plugins/builtin/source/plugin_builtin.cpp b/plugins/builtin/source/plugin_builtin.cpp index f6a5f2586..7208f9915 100644 --- a/plugins/builtin/source/plugin_builtin.cpp +++ b/plugins/builtin/source/plugin_builtin.cpp @@ -1,42 +1,42 @@ -#include - -namespace hex::plugin::builtin { - - void registerDataInspectorEntries(); - void registerToolEntries(); - void registerPatternLanguageFunctions(); - void registerCommandPaletteCommands(); - void registerSettings(); - void registerDataProcessorNodes(); - - void addFooterItems(); - void addToolbarItems(); - - void registerLanguageEnUS(); - void registerLanguageDeDE(); - void registerLanguageItIT(); - void registerLanguageZhCN(); - -} - -IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") { - - using namespace hex::plugin::builtin; - - registerDataInspectorEntries(); - registerToolEntries(); - registerPatternLanguageFunctions(); - registerCommandPaletteCommands(); - registerSettings(); - registerDataProcessorNodes(); - - addFooterItems(); - addToolbarItems(); - - registerLanguageEnUS(); - registerLanguageDeDE(); - registerLanguageItIT(); - registerLanguageZhCN(); -} - - +#include + +namespace hex::plugin::builtin { + + void registerDataInspectorEntries(); + void registerToolEntries(); + void registerPatternLanguageFunctions(); + void registerCommandPaletteCommands(); + void registerSettings(); + void registerDataProcessorNodes(); + + void addFooterItems(); + void addToolbarItems(); + + void registerLanguageEnUS(); + void registerLanguageDeDE(); + void registerLanguageItIT(); + void registerLanguageZhCN(); + +} + +IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") { + + using namespace hex::plugin::builtin; + + registerDataInspectorEntries(); + registerToolEntries(); + registerPatternLanguageFunctions(); + registerCommandPaletteCommands(); + registerSettings(); + registerDataProcessorNodes(); + + addFooterItems(); + addToolbarItems(); + + registerLanguageEnUS(); + registerLanguageDeDE(); + registerLanguageItIT(); + registerLanguageZhCN(); +} + + diff --git a/plugins/windows/CMakeLists.txt b/plugins/windows/CMakeLists.txt index 797965284..65e1a0ac4 100644 --- a/plugins/windows/CMakeLists.txt +++ b/plugins/windows/CMakeLists.txt @@ -1,41 +1,41 @@ -cmake_minimum_required(VERSION 3.16) - -# Change this to the name of your plugin # -project(windows) - -# Add your source files here # -if (WIN32) - add_library(${PROJECT_NAME} SHARED - source/plugin_windows.cpp - - source/views/view_tty_console.cpp - - source/lang/en_US.cpp - source/lang/zh_CN.cpp - - source/content/footer_items.cpp - ) - - # Add additional include directories here # - target_include_directories(${PROJECT_NAME} PRIVATE include) - # Add additional libraries here # - target_link_libraries(${PROJECT_NAME} PRIVATE libimhex) -endif () - - - -# ---- No need to change anything from here downwards unless you know what you're doing ---- # - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_SHARED_LIBRARY_PREFIX "") -set(CMAKE_SHARED_LIBRARY_SUFFIX ".hexplug") - -if (WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition -fvisibility=hidden") -endif() - -add_compile_definitions(IMHEX_PLUGIN_NAME=${PROJECT_NAME}) - -if (NOT TARGET libimhex) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libimhex ${CMAKE_CURRENT_BINARY_DIR}/plugins/libimhex) +cmake_minimum_required(VERSION 3.16) + +# Change this to the name of your plugin # +project(windows) + +# Add your source files here # +if (WIN32) + add_library(${PROJECT_NAME} SHARED + source/plugin_windows.cpp + + source/views/view_tty_console.cpp + + source/lang/en_US.cpp + source/lang/zh_CN.cpp + + source/content/footer_items.cpp + ) + + # Add additional include directories here # + target_include_directories(${PROJECT_NAME} PRIVATE include) + # Add additional libraries here # + target_link_libraries(${PROJECT_NAME} PRIVATE libimhex) +endif () + + + +# ---- No need to change anything from here downwards unless you know what you're doing ---- # + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_SHARED_LIBRARY_PREFIX "") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".hexplug") + +if (WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition -fvisibility=hidden") +endif() + +add_compile_definitions(IMHEX_PLUGIN_NAME=${PROJECT_NAME}) + +if (NOT TARGET libimhex) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libimhex ${CMAKE_CURRENT_BINARY_DIR}/plugins/libimhex) endif() \ No newline at end of file diff --git a/plugins/windows/source/lang/zh_CN.cpp b/plugins/windows/source/lang/zh_CN.cpp index 42137cd7d..91e3d6b00 100644 --- a/plugins/windows/source/lang/zh_CN.cpp +++ b/plugins/windows/source/lang/zh_CN.cpp @@ -1,30 +1,30 @@ -#include -#include - -namespace hex::plugin::windows { - - void registerLanguageZhCN() { - ContentRegistry::Language::addLocalizations("zh-CN", { - { "hex.windows.view.tty_console.name", "TTY控制台" }, - { "hex.windows.view.tty_console.config", "配置"}, - { "hex.windows.view.tty_console.port", "端口" }, - { "hex.windows.view.tty_console.reload", "重载" }, - { "hex.windows.view.tty_console.baud", "波特率" }, - { "hex.windows.view.tty_console.num_bits", "数据位" }, - { "hex.windows.view.tty_console.stop_bits", "终止位" }, - { "hex.windows.view.tty_console.parity_bits", "奇偶校验位" }, - { "hex.windows.view.tty_console.cts", "使用CTS流控制" }, - { "hex.windows.view.tty_console.connect", "连接" }, - { "hex.windows.view.tty_console.disconnect", "断开" }, - { "hex.windows.view.tty_console.connect_error", "无法连接到COM端口!" }, - { "hex.windows.view.tty_console.clear", "清除" }, - { "hex.windows.view.tty_console.auto_scroll", "自动滚动" }, - { "hex.windows.view.tty_console.console", "控制台" }, - { "hex.windows.view.tty_console.send_etx", "发送ETX" }, - { "hex.windows.view.tty_console.send_eot", "发送EOT" }, - { "hex.windows.view.tty_console.send_sub", "发送SUB" } - - }); - } - -} \ No newline at end of file +#include +#include + +namespace hex::plugin::windows { + + void registerLanguageZhCN() { + ContentRegistry::Language::addLocalizations("zh-CN", { + { "hex.windows.view.tty_console.name", "TTY控制台" }, + { "hex.windows.view.tty_console.config", "配置"}, + { "hex.windows.view.tty_console.port", "端口" }, + { "hex.windows.view.tty_console.reload", "重载" }, + { "hex.windows.view.tty_console.baud", "波特率" }, + { "hex.windows.view.tty_console.num_bits", "数据位" }, + { "hex.windows.view.tty_console.stop_bits", "终止位" }, + { "hex.windows.view.tty_console.parity_bits", "奇偶校验位" }, + { "hex.windows.view.tty_console.cts", "使用CTS流控制" }, + { "hex.windows.view.tty_console.connect", "连接" }, + { "hex.windows.view.tty_console.disconnect", "断开" }, + { "hex.windows.view.tty_console.connect_error", "无法连接到COM端口!" }, + { "hex.windows.view.tty_console.clear", "清除" }, + { "hex.windows.view.tty_console.auto_scroll", "自动滚动" }, + { "hex.windows.view.tty_console.console", "控制台" }, + { "hex.windows.view.tty_console.send_etx", "发送ETX" }, + { "hex.windows.view.tty_console.send_eot", "发送EOT" }, + { "hex.windows.view.tty_console.send_sub", "发送SUB" } + + }); + } + +} diff --git a/plugins/windows/source/plugin_windows.cpp b/plugins/windows/source/plugin_windows.cpp index 83305b36b..66de1b894 100644 --- a/plugins/windows/source/plugin_windows.cpp +++ b/plugins/windows/source/plugin_windows.cpp @@ -1,25 +1,25 @@ -#include - -#include "views/view_tty_console.hpp" - -namespace hex::plugin::windows { - - void registerLanguageEnUS(); - void registerLanguageZhCN(); - - void addFooterItems(); -} - - -IMHEX_PLUGIN_SETUP("Windows", "WerWolv", "Windows-only features") { - using namespace hex::plugin::windows; - - ContentRegistry::Views::add(); - - registerLanguageEnUS(); - registerLanguageZhCN(); - - addFooterItems(); -} - - +#include + +#include "views/view_tty_console.hpp" + +namespace hex::plugin::windows { + + void registerLanguageEnUS(); + void registerLanguageZhCN(); + + void addFooterItems(); +} + + +IMHEX_PLUGIN_SETUP("Windows", "WerWolv", "Windows-only features") { + using namespace hex::plugin::windows; + + ContentRegistry::Views::add(); + + registerLanguageEnUS(); + registerLanguageZhCN(); + + addFooterItems(); +} + + diff --git a/source/window/win_window.cpp b/source/window/win_window.cpp index 3c913ae8c..c297cfa6a 100644 --- a/source/window/win_window.cpp +++ b/source/window/win_window.cpp @@ -1,263 +1,263 @@ -#include "window.hpp" - - -#if defined(OS_WINDOWS) - - #include - #include - - #include - #include - #include - - #include - - #include - #define GLFW_EXPOSE_NATIVE_WIN32 - #include - #undef GLFW_EXPOSE_NATIVE_WIN32 - - #include - #include - #include - - namespace hex { - - static LONG_PTR oldWndProc; - static float titleBarHeight; - static ImGuiMouseCursor mouseCursorIcon; - - static bool isTaskbarAutoHideEnabled(UINT edge, RECT monitor) { - APPBARDATA data = { .cbSize = sizeof(APPBARDATA), .uEdge = edge, .rc = monitor }; - return ::SHAppBarMessage(ABM_GETAUTOHIDEBAR, &data); - } - - static LRESULT windowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) { - case WM_NCCALCSIZE: { - RECT &rect = *reinterpret_cast(lParam); - RECT client = rect; - - DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam); - - if (IsMaximized(hwnd)) { - WINDOWINFO windowInfo = { .cbSize = sizeof(WINDOWINFO) }; - GetWindowInfo(hwnd, &windowInfo); - rect = RECT { - .left = static_cast(client.left + windowInfo.cyWindowBorders), - .top = static_cast(client.top + windowInfo.cyWindowBorders), - .right = static_cast(client.right - windowInfo.cyWindowBorders), - .bottom = static_cast(client.bottom - windowInfo.cyWindowBorders) - }; - - HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY); - MONITORINFO monitorInfo = { .cbSize = sizeof(MONITORINFO) }; - GetMonitorInfoW(hMonitor, &monitorInfo); - - if (EqualRect(&rect, &monitorInfo.rcMonitor)) { - if (isTaskbarAutoHideEnabled(ABE_BOTTOM, monitorInfo.rcMonitor)) - rect.bottom--; - else if (isTaskbarAutoHideEnabled(ABE_LEFT, monitorInfo.rcMonitor)) - rect.left++; - else if (isTaskbarAutoHideEnabled(ABE_TOP, monitorInfo.rcMonitor)) - rect.top++; - else if (isTaskbarAutoHideEnabled(ABE_RIGHT, monitorInfo.rcMonitor)) - rect.right--; - } - } else { - rect = client; - } - - return 0; - } - case WM_SETCURSOR: { - auto cursorPos = LOWORD(lParam); - - switch (cursorPos) { - case HTRIGHT: - case HTLEFT: - mouseCursorIcon = ImGuiMouseCursor_ResizeEW; - return TRUE; - case HTTOP: - case HTBOTTOM: - mouseCursorIcon = ImGuiMouseCursor_ResizeNS; - return TRUE; - case HTTOPLEFT: - case HTBOTTOMRIGHT: - mouseCursorIcon = ImGuiMouseCursor_ResizeNWSE; - return TRUE; - case HTTOPRIGHT: - case HTBOTTOMLEFT: - mouseCursorIcon = ImGuiMouseCursor_ResizeNESW; - return TRUE; - default: - mouseCursorIcon = ImGuiMouseCursor_None; - return TRUE; - } - } - case WM_NCHITTEST: { - POINT cursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - - const POINT border{ - static_cast((::GetSystemMetrics(SM_CXFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 2.0F), - static_cast((::GetSystemMetrics(SM_CYFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 2.0F) - }; - - RECT window; - if (!::GetWindowRect(hwnd, &window)) { - return HTNOWHERE; - } - - constexpr auto RegionClient = 0b0000; - constexpr auto RegionLeft = 0b0001; - constexpr auto RegionRight = 0b0010; - constexpr auto RegionTop = 0b0100; - constexpr auto RegionBottom = 0b1000; - - const auto result = - RegionLeft * (cursor.x < (window.left + border.x)) | - RegionRight * (cursor.x >= (window.right - border.x)) | - RegionTop * (cursor.y < (window.top + border.y)) | - RegionBottom * (cursor.y >= (window.bottom - border.y)); - - switch (result) { - case RegionLeft: - return HTLEFT; - case RegionRight: - return HTRIGHT; - case RegionTop: - return HTTOP; - case RegionBottom: - return HTBOTTOM; - case RegionTop | RegionLeft: - return HTTOPLEFT; - case RegionTop | RegionRight: - return HTTOPRIGHT; - case RegionBottom | RegionLeft: - return HTBOTTOMLEFT; - case RegionBottom | RegionRight: - return HTBOTTOMRIGHT; - case RegionClient: - default: - if ((cursor.y < (window.top + titleBarHeight * 2)) && !ImGui::IsAnyItemHovered()) - return HTCAPTION; - else break; - } - break; - } - case WM_SETTINGCHANGE: - { - if (LPCTSTR(lParam) == std::string_view("ImmersiveColorSet")) { - EventManager::post(); - } - - break; - } - default: break; - } - - return CallWindowProc((WNDPROC)oldWndProc, hwnd, uMsg, wParam, lParam); - } - - - void Window::initNative() { - auto hConsoleWindow = ::GetConsoleWindow(); - #if !defined(DEBUG) - ::ShowWindow(hConsoleWindow, FALSE); - #endif - - auto hConsole = ::GetStdHandle(STD_OUTPUT_HANDLE); - if (hConsole != INVALID_HANDLE_VALUE) { - DWORD mode = 0; - if (::GetConsoleMode(hConsole, &mode)) { - mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; - ::SetConsoleMode(hConsole, mode); - } - } - } - - void Window::setupNativeWindow() { - auto hwnd = glfwGetWin32Window(this->m_window); - - oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)windowProc); - - MARGINS borderless = {1,1,1,1}; - ::DwmExtendFrameIntoClientArea(hwnd, &borderless); - - ::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE); - ::SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU); - - bool themeFollowSystem = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color") == 0; - EventManager::subscribe(this, [themeFollowSystem]{ - if (!themeFollowSystem) return; - - HKEY hkey; - if (RegOpenKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", &hkey) == ERROR_SUCCESS) { - DWORD value = 0; - DWORD size = sizeof(DWORD); - - auto error = RegQueryValueEx(hkey, "AppsUseLightTheme", nullptr, nullptr, reinterpret_cast(&value), &size); - if (error == ERROR_SUCCESS) { - EventManager::post(value == 0 ? 1 : 2); - } - } - }); - - if (themeFollowSystem) - EventManager::post(); - } - - void Window::updateNativeWindow() { - titleBarHeight = ImGui::GetCurrentWindow()->MenuBarHeight(); - - if (mouseCursorIcon != ImGuiMouseCursor_None) - ImGui::SetMouseCursor(mouseCursorIcon); - } - - void Window::drawTitleBar() { - auto buttonSize = ImVec2(titleBarHeight * 1.5F, titleBarHeight - 1); - - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); - ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetColorU32(ImGuiCol_MenuBarBg)); - ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetColorU32(ImGuiCol_ScrollbarGrabActive)); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetColorU32(ImGuiCol_ScrollbarGrabHovered)); - - ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 6); - #if defined(DEBUG) - if (ImGui::TitleBarButton(ICON_VS_DEBUG, buttonSize)) - hex::openWebpage("https://imhex.werwolv.net/debug"); - ImGui::InfoTooltip("hex.menu.debug_build"_lang); - #endif - if (ImGui::TitleBarButton(ICON_VS_SMILEY, buttonSize)) - hex::openWebpage("mailto://hey@werwolv.net"); - ImGui::InfoTooltip("hex.menu.feedback"_lang); - - ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 3); - if (ImGui::TitleBarButton(ICON_VS_CHROME_MINIMIZE, buttonSize)) - glfwIconifyWindow(this->m_window); - if (glfwGetWindowAttrib(this->m_window, GLFW_MAXIMIZED)) { - if (ImGui::TitleBarButton(ICON_VS_CHROME_RESTORE, buttonSize)) - glfwRestoreWindow(this->m_window); - } else { - if (ImGui::TitleBarButton(ICON_VS_CHROME_MAXIMIZE, buttonSize)) - glfwMaximizeWindow(this->m_window); - } - - ImGui::PushStyleColor(ImGuiCol_ButtonActive, 0xFF7A70F1); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, 0xFF2311E8); - - - if (ImGui::TitleBarButton(ICON_VS_CHROME_CLOSE, buttonSize)) { - ImHexApi::Common::closeImHex(); - } - - ImGui::PopStyleColor(5); - ImGui::PopStyleVar(); - - ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize(this->m_windowTitle.c_str()).x) / 2); - ImGui::TextUnformatted(this->m_windowTitle.c_str()); - } - - } - +#include "window.hpp" + + +#if defined(OS_WINDOWS) + + #include + #include + + #include + #include + #include + + #include + + #include + #define GLFW_EXPOSE_NATIVE_WIN32 + #include + #undef GLFW_EXPOSE_NATIVE_WIN32 + + #include + #include + #include + + namespace hex { + + static LONG_PTR oldWndProc; + static float titleBarHeight; + static ImGuiMouseCursor mouseCursorIcon; + + static bool isTaskbarAutoHideEnabled(UINT edge, RECT monitor) { + APPBARDATA data = { .cbSize = sizeof(APPBARDATA), .uEdge = edge, .rc = monitor }; + return ::SHAppBarMessage(ABM_GETAUTOHIDEBAR, &data); + } + + static LRESULT windowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + switch (uMsg) { + case WM_NCCALCSIZE: { + RECT &rect = *reinterpret_cast(lParam); + RECT client = rect; + + DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam); + + if (IsMaximized(hwnd)) { + WINDOWINFO windowInfo = { .cbSize = sizeof(WINDOWINFO) }; + GetWindowInfo(hwnd, &windowInfo); + rect = RECT { + .left = static_cast(client.left + windowInfo.cyWindowBorders), + .top = static_cast(client.top + windowInfo.cyWindowBorders), + .right = static_cast(client.right - windowInfo.cyWindowBorders), + .bottom = static_cast(client.bottom - windowInfo.cyWindowBorders) + }; + + HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY); + MONITORINFO monitorInfo = { .cbSize = sizeof(MONITORINFO) }; + GetMonitorInfoW(hMonitor, &monitorInfo); + + if (EqualRect(&rect, &monitorInfo.rcMonitor)) { + if (isTaskbarAutoHideEnabled(ABE_BOTTOM, monitorInfo.rcMonitor)) + rect.bottom--; + else if (isTaskbarAutoHideEnabled(ABE_LEFT, monitorInfo.rcMonitor)) + rect.left++; + else if (isTaskbarAutoHideEnabled(ABE_TOP, monitorInfo.rcMonitor)) + rect.top++; + else if (isTaskbarAutoHideEnabled(ABE_RIGHT, monitorInfo.rcMonitor)) + rect.right--; + } + } else { + rect = client; + } + + return 0; + } + case WM_SETCURSOR: { + auto cursorPos = LOWORD(lParam); + + switch (cursorPos) { + case HTRIGHT: + case HTLEFT: + mouseCursorIcon = ImGuiMouseCursor_ResizeEW; + return TRUE; + case HTTOP: + case HTBOTTOM: + mouseCursorIcon = ImGuiMouseCursor_ResizeNS; + return TRUE; + case HTTOPLEFT: + case HTBOTTOMRIGHT: + mouseCursorIcon = ImGuiMouseCursor_ResizeNWSE; + return TRUE; + case HTTOPRIGHT: + case HTBOTTOMLEFT: + mouseCursorIcon = ImGuiMouseCursor_ResizeNESW; + return TRUE; + default: + mouseCursorIcon = ImGuiMouseCursor_None; + return TRUE; + } + } + case WM_NCHITTEST: { + POINT cursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + + const POINT border{ + static_cast((::GetSystemMetrics(SM_CXFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 2.0F), + static_cast((::GetSystemMetrics(SM_CYFRAME) + ::GetSystemMetrics(SM_CXPADDEDBORDER)) * SharedData::globalScale / 2.0F) + }; + + RECT window; + if (!::GetWindowRect(hwnd, &window)) { + return HTNOWHERE; + } + + constexpr auto RegionClient = 0b0000; + constexpr auto RegionLeft = 0b0001; + constexpr auto RegionRight = 0b0010; + constexpr auto RegionTop = 0b0100; + constexpr auto RegionBottom = 0b1000; + + const auto result = + RegionLeft * (cursor.x < (window.left + border.x)) | + RegionRight * (cursor.x >= (window.right - border.x)) | + RegionTop * (cursor.y < (window.top + border.y)) | + RegionBottom * (cursor.y >= (window.bottom - border.y)); + + switch (result) { + case RegionLeft: + return HTLEFT; + case RegionRight: + return HTRIGHT; + case RegionTop: + return HTTOP; + case RegionBottom: + return HTBOTTOM; + case RegionTop | RegionLeft: + return HTTOPLEFT; + case RegionTop | RegionRight: + return HTTOPRIGHT; + case RegionBottom | RegionLeft: + return HTBOTTOMLEFT; + case RegionBottom | RegionRight: + return HTBOTTOMRIGHT; + case RegionClient: + default: + if ((cursor.y < (window.top + titleBarHeight * 2)) && !ImGui::IsAnyItemHovered()) + return HTCAPTION; + else break; + } + break; + } + case WM_SETTINGCHANGE: + { + if (LPCTSTR(lParam) == std::string_view("ImmersiveColorSet")) { + EventManager::post(); + } + + break; + } + default: break; + } + + return CallWindowProc((WNDPROC)oldWndProc, hwnd, uMsg, wParam, lParam); + } + + + void Window::initNative() { + auto hConsoleWindow = ::GetConsoleWindow(); + #if !defined(DEBUG) + ::ShowWindow(hConsoleWindow, FALSE); + #endif + + auto hConsole = ::GetStdHandle(STD_OUTPUT_HANDLE); + if (hConsole != INVALID_HANDLE_VALUE) { + DWORD mode = 0; + if (::GetConsoleMode(hConsole, &mode)) { + mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + ::SetConsoleMode(hConsole, mode); + } + } + } + + void Window::setupNativeWindow() { + auto hwnd = glfwGetWin32Window(this->m_window); + + oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)windowProc); + + MARGINS borderless = {1,1,1,1}; + ::DwmExtendFrameIntoClientArea(hwnd, &borderless); + + ::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE); + ::SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU); + + bool themeFollowSystem = ContentRegistry::Settings::getSetting("hex.builtin.setting.interface", "hex.builtin.setting.interface.color") == 0; + EventManager::subscribe(this, [themeFollowSystem]{ + if (!themeFollowSystem) return; + + HKEY hkey; + if (RegOpenKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", &hkey) == ERROR_SUCCESS) { + DWORD value = 0; + DWORD size = sizeof(DWORD); + + auto error = RegQueryValueEx(hkey, "AppsUseLightTheme", nullptr, nullptr, reinterpret_cast(&value), &size); + if (error == ERROR_SUCCESS) { + EventManager::post(value == 0 ? 1 : 2); + } + } + }); + + if (themeFollowSystem) + EventManager::post(); + } + + void Window::updateNativeWindow() { + titleBarHeight = ImGui::GetCurrentWindow()->MenuBarHeight(); + + if (mouseCursorIcon != ImGuiMouseCursor_None) + ImGui::SetMouseCursor(mouseCursorIcon); + } + + void Window::drawTitleBar() { + auto buttonSize = ImVec2(titleBarHeight * 1.5F, titleBarHeight - 1); + + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); + ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetColorU32(ImGuiCol_MenuBarBg)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetColorU32(ImGuiCol_ScrollbarGrabActive)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetColorU32(ImGuiCol_ScrollbarGrabHovered)); + + ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 6); + #if defined(DEBUG) + if (ImGui::TitleBarButton(ICON_VS_DEBUG, buttonSize)) + hex::openWebpage("https://imhex.werwolv.net/debug"); + ImGui::InfoTooltip("hex.menu.debug_build"_lang); + #endif + if (ImGui::TitleBarButton(ICON_VS_SMILEY, buttonSize)) + hex::openWebpage("mailto://hey@werwolv.net"); + ImGui::InfoTooltip("hex.menu.feedback"_lang); + + ImGui::SetCursorPosX(ImGui::GetWindowWidth() - buttonSize.x * 3); + if (ImGui::TitleBarButton(ICON_VS_CHROME_MINIMIZE, buttonSize)) + glfwIconifyWindow(this->m_window); + if (glfwGetWindowAttrib(this->m_window, GLFW_MAXIMIZED)) { + if (ImGui::TitleBarButton(ICON_VS_CHROME_RESTORE, buttonSize)) + glfwRestoreWindow(this->m_window); + } else { + if (ImGui::TitleBarButton(ICON_VS_CHROME_MAXIMIZE, buttonSize)) + glfwMaximizeWindow(this->m_window); + } + + ImGui::PushStyleColor(ImGuiCol_ButtonActive, 0xFF7A70F1); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, 0xFF2311E8); + + + if (ImGui::TitleBarButton(ICON_VS_CHROME_CLOSE, buttonSize)) { + ImHexApi::Common::closeImHex(); + } + + ImGui::PopStyleColor(5); + ImGui::PopStyleVar(); + + ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize(this->m_windowTitle.c_str()).x) / 2); + ImGui::TextUnformatted(this->m_windowTitle.c_str()); + } + + } + #endif \ No newline at end of file