Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,27 @@ void Menu::DrawOverlay()
* @note This method contains Menu-specific logic and state management that makes it
* inappropriate for extraction to a utility class.
*/
static std::vector<InputCombo> DeriveWeatherEditorKey(const std::vector<InputCombo>& menuKey)
{
bool hasShift = false;
uint32_t baseKey = 0;

for (const auto& combo : menuKey) {
uint32_t vk = combo.GetKey();
if (vk == VK_SHIFT || vk == VK_LSHIFT || vk == VK_RSHIFT) {
hasShift = true;
} else if (vk != VK_CONTROL && vk != VK_LCONTROL && vk != VK_RCONTROL &&
vk != VK_MENU && vk != VK_LMENU && vk != VK_RMENU) {
baseKey = vk;
}
}

if (hasShift || baseKey == 0)
return {};

return { InputCombo::Keyboard(VK_SHIFT), InputCombo::Keyboard(baseKey) };
}

void Menu::ProcessInputEventQueue()
{
std::unique_lock<std::shared_mutex> mutex(_inputEventMutex);
Expand Down Expand Up @@ -950,7 +971,12 @@ void Menu::ProcessInputEventQueue()
};
auto shaderCache = globals::shaderCache;
HotkeyAction hotkeyActions[] = {
{ &settings.ToggleKey, &settingToggleKey, [this](std::vector<InputCombo> keys) { settings.ToggleKey = keys; settingToggleKey = false; } },
{ &settings.ToggleKey, &settingToggleKey, [this](std::vector<InputCombo> keys) {
settings.ToggleKey = keys;
settingToggleKey = false;
if (!settings.FirstTimeSetupCompleted)
settings.WeatherEditorToggleKey = DeriveWeatherEditorKey(keys);
} },
Comment thread
coderabbitai[bot] marked this conversation as resolved.
{ &settings.SkipCompilationKey, &settingSkipCompilationKey, [this](std::vector<InputCombo> keys) { settings.SkipCompilationKey = keys; settingSkipCompilationKey = false; } },
{ &settings.EffectToggleKey, &settingsEffectsToggle, [this](std::vector<InputCombo> keys) { settings.EffectToggleKey = keys; settingsEffectsToggle = false; } },
{ &settings.OverlayToggleKey, &settingOverlayToggleKey, [this](std::vector<InputCombo> keys) { settings.OverlayToggleKey = keys; settingOverlayToggleKey = false; } },
Expand Down
2 changes: 1 addition & 1 deletion src/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ class Menu
std::vector<InputCombo> OverlayToggleKey = { InputCombo::Keyboard(VK_F10) }; // Global overlay toggle key for all overlays
std::vector<InputCombo> ShaderBlockPrevKey = { InputCombo::Keyboard(VK_PRIOR) }; // Debug: cycle backward through shaders (PageUp)
std::vector<InputCombo> ShaderBlockNextKey = { InputCombo::Keyboard(VK_NEXT) }; // Debug: cycle forward through shaders (PageDown)
std::vector<InputCombo> WeatherEditorToggleKey = { InputCombo::Keyboard(VK_F11) }; // Weather Editor toggle key
std::vector<InputCombo> WeatherEditorToggleKey = { InputCombo::Keyboard(VK_SHIFT), InputCombo::Keyboard(VK_END) }; // Weather Editor toggle key
bool EnableShaderBlocking = false; // Enable shader blocking hotkeys for debugging
bool FirstTimeSetupCompleted = false; // Track if first-time setup has been completed
bool SkipClearCacheConfirmation = false; // Skip confirmation dialog when clearing shader cache
Expand Down
14 changes: 14 additions & 0 deletions src/Menu/HomePageRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,20 @@ void HomePageRenderer::RenderFirstTimeSetupDialog()
ImGui::TextDisabled("%s", pressKeyText);
}

// Weather Editor hotkey status — updates live as user picks keys
{
auto& weatherKey = menu->GetSettings().WeatherEditorToggleKey;
if (weatherKey.empty()) {
const char* warnText = "Weather Editor hotkey unbound \xe2\x80\x94 chosen key uses Shift";
centerText(warnText);
ImGui::TextColored(ImVec4(1.0f, 0.75f, 0.0f, 1.0f), "%s", warnText);
} else {
std::string infoStr = "Weather Editor hotkey will be: " + Util::Input::KeyIdToString(weatherKey);
centerText(infoStr.c_str());
ImGui::TextDisabled("%s", infoStr.c_str());
}
}

ImGui::Spacing();

const char* laterText = "You can change this later in General > Keybindings.";
Expand Down
Loading