Skip to content

Commit 99c4aca

Browse files
feat: add patch explorer frame DLL toggle and localization
- Added a toggle for "ExplorerFrame Patch" in the Context Menu configuration. - Updated English and Chinese localization files to include the new toggle label. - Modified the config menu to include the new toggle option for the ExplorerFrame Patch.
1 parent e13eada commit 99c4aca

File tree

8 files changed

+71
-53
lines changed

8 files changed

+71
-53
lines changed

resources/schema.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -372,17 +372,23 @@
372372
"type": "boolean",
373373
"default": false
374374
},
375-
"hotkeys": {
376-
"title": "Enable Hotkeys",
377-
"description": "Enable hotkey support for the context menu",
378-
"type": "boolean",
379-
"default": true
380-
},
381-
"search_large_dwItemData_range": {
382-
"title": "Search Larger Range of DWItemData",
383-
"description": "Search for a larger range of DWItemData",
384-
"type": "boolean",
385-
"default": false,
375+
"hotkeys": {
376+
"title": "Enable Hotkeys",
377+
"description": "Enable hotkey support for the context menu",
378+
"type": "boolean",
379+
"default": true
380+
},
381+
"patch_explorerframe_dll": {
382+
"title": "Patch ExplorerFrame.dll",
383+
"description": "Controls whether Breeze patches ExplorerFrame.dll so the Explorer left pane can use the Breeze context menu",
384+
"type": "boolean",
385+
"default": true
386+
},
387+
"search_large_dwItemData_range": {
388+
"title": "Search Larger Range of DWItemData",
389+
"description": "Search for a larger range of DWItemData",
390+
"type": "boolean",
391+
"default": false,
386392
"deprecationMessage": "This option is for debugging purposes only and is not recommended to be enabled"
387393
},
388394
"position": {

src/shell/config.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,13 @@ struct config {
9999
bool vsync = true;
100100
bool ignore_owner_draw = true;
101101
bool reverse_if_open_to_up = true;
102-
bool experimental_ownerdraw_support = false;
103-
bool hotkeys = true;
104-
bool show_settings_button = true;
105-
106-
// debug purpose only
107-
bool search_large_dwItemData_range = false;
102+
bool experimental_ownerdraw_support = false;
103+
bool hotkeys = true;
104+
bool show_settings_button = true;
105+
bool patch_explorerframe_dll = true;
106+
107+
// debug purpose only
108+
bool search_large_dwItemData_range = false;
108109

109110
struct position {
110111
int padding_vertical = 20;

src/shell/fix_win11_menu.cc

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "blook/blook.h"
1111
#include "blook/memo.h"
12+
#include "config.h"
1213
#include "utils.h"
1314
#include "zasm/base/immediate.hpp"
1415
#include "zasm/x86/mnemonic.hpp"
@@ -184,29 +185,31 @@ void mb_shell::fix_win11_menu::install() {
184185
}
185186
}
186187

187-
if (auto explorerframe = proc->module("ExplorerFrame.dll")) {
188-
auto disasm =
189-
explorerframe.value()->section(".text")->disassembly();
188+
if (config::current->context_menu.patch_explorerframe_dll) {
189+
if (auto explorerframe = proc->module("ExplorerFrame.dll")) {
190+
auto disasm =
191+
explorerframe.value()->section(".text")->disassembly();
190192

191-
for (auto &ins : disasm) {
192-
if (!is_key_state_call(ins))
193-
continue;
194-
195-
auto function =
196-
ins.ptr()
197-
.find_upwards({0xCC, 0xCC, 0xCC, 0xCC, 0xCC})
198-
->range_size(0x200)
199-
.disassembly();
200-
if (!has_key_state_check(function, 0x10) ||
201-
!has_key_state_check(function, 0x79)) {
202-
continue;
203-
}
193+
for (auto &ins : disasm) {
194+
if (!is_key_state_call(ins))
195+
continue;
204196

205-
if (patch_key_state_check(function, 0x10)) {
206-
spdlog::info(
207-
"Patched explorerframe.dll for win11 menu fix: {}",
208-
ins.ptr().data());
209-
break;
197+
auto function =
198+
ins.ptr()
199+
.find_upwards({0xCC, 0xCC, 0xCC, 0xCC, 0xCC})
200+
->range_size(0x200)
201+
.disassembly();
202+
if (!has_key_state_check(function, 0x10) ||
203+
!has_key_state_check(function, 0x79)) {
204+
continue;
205+
}
206+
207+
if (patch_key_state_check(function, 0x10)) {
208+
spdlog::info("Patched explorerframe.dll for win11 "
209+
"menu fix: {}",
210+
ins.ptr().data());
211+
break;
212+
}
210213
}
211214
}
212215
}

src/shell/script/script.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/shell/script/ts/src/config_page/pages/ContextMenuConfig.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@ const ContextMenuConfig = memo(() => {
221221
setNestedValue(newConfig, "show_settings_button", v);
222222
update(newConfig);
223223
}} />
224+
<Toggle label={t("settings.patchExplorerFrameDll")} value={getNestedValue(config, "patch_explorerframe_dll") ?? getNestedValue(defaultConfig, "patch_explorerframe_dll")} onChange={(v) => {
225+
const newConfig = { ...config };
226+
setNestedValue(newConfig, "patch_explorerframe_dll", v);
227+
update(newConfig);
228+
}} />
224229
</flex>
225230
</flex>
226231
);

src/shell/script/ts/src/i18n/locales/en-US.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
"ignoreOwnerDraw": "Ignore Owner Draw",
2222
"reverseIfOpenToUp": "Reverse When Opening Upward",
2323
"tryWin11RoundCorner": "Try Windows 11 Round Corners",
24-
"acrylicBackground": "Acrylic Background",
25-
"hotkeys": "Hotkeys",
26-
"showSettingsButton": "Show Settings Button in Top Left"
27-
},
24+
"acrylicBackground": "Acrylic Background",
25+
"hotkeys": "Hotkeys",
26+
"showSettingsButton": "Show Settings Button in Top Left",
27+
"patchExplorerFrameDll": "ExplorerFrame Patch (left pane Breeze menu)"
28+
},
2829
"plugin": {
2930
"title": "Plugins",
3031
"config": "Plugin Config",

src/shell/script/ts/src/i18n/locales/zh-CN.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
"ignoreOwnerDraw": "忽略自绘菜单",
2222
"reverseIfOpenToUp": "向上展开时反向排列",
2323
"tryWin11RoundCorner": "尝试使用 Windows 11 圆角",
24-
"acrylicBackground": "亚克力背景效果",
25-
"hotkeys": "键盘热键",
26-
"showSettingsButton": "在左上角显示设置按钮"
27-
},
24+
"acrylicBackground": "亚克力背景效果",
25+
"hotkeys": "键盘热键",
26+
"showSettingsButton": "在左上角显示设置按钮",
27+
"patchExplorerFrameDll": "启用 ExplorerFrame Patch(左侧栏 Breeze 右键菜单)"
28+
},
2829
"plugin": {
2930
"title": "插件",
3031
"config": "插件配置",

src/shell/script/ts/src/menu/configMenu.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ export const makeBreezeConfigMenu = (mainMenu) => {
322322
};
323323

324324
sub.append_spacer()
325+
createBoolToggle(sub, "ExplorerFrame Patch(左侧栏 Breeze 右键菜单)", "context_menu.patch_explorerframe_dll", true);
325326

326327
const theme_presets = {
327328
"默认": null,

0 commit comments

Comments
 (0)