Skip to content

Commit

Permalink
fixed crash, when defined key is invalid && dumped new version
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxfighter committed Jan 1, 2021
1 parent acb283e commit 9b216e4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
18 changes: 12 additions & 6 deletions SettingsUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ void SettingsUI::draw(const char* title, bool* p_open, ImGuiWindowFlags flags) {
ImGui::SameLine();
ImGui::PushItemWidth(30);
if (ImGui::InputText("##shortcut", shortcut, 64)) {
const int keyId = std::stoi(shortcut);
settings.settings.killproofKey = keyId;
// convert virtual key to vsc key
UINT vscKey = MapVirtualKeyA(keyId, MAPVK_VK_TO_VSC);
// get the name representation of the key
GetKeyNameTextA((vscKey << 16), shortCutRealName, 32);
try {
const int keyId = std::stoi(shortcut);
settings.settings.killproofKey = keyId;
// convert virtual key to vsc key
UINT vscKey = MapVirtualKeyA(keyId, MAPVK_VK_TO_VSC);
// get the name representation of the key
GetKeyNameTextA((vscKey << 16), shortCutRealName, 32);
} catch ([[maybe_unused]] const std::invalid_argument& e) {

} catch ([[maybe_unused]] const std::out_of_range& e) {

}
}
ImGui::PopItemWidth();
ImGui::SameLine();
Expand Down
2 changes: 1 addition & 1 deletion dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ arcdps_exports* mod_init() {
arc_exports.sig = 0x6BAF1938322278DE;
arc_exports.size = sizeof(arcdps_exports);
arc_exports.out_name = "killproof.me";
arc_exports.out_build = "1.2.1";
arc_exports.out_build = "1.2.2";
arc_exports.wnd_nofilter = mod_wnd;
arc_exports.combat = mod_combat;
arc_exports.imgui = mod_imgui;
Expand Down
4 changes: 2 additions & 2 deletions killproof_me.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>C:\Program Files\Guild Wars 2\addons\arcdps\</OutDir>
<OutDir>C:\Program Files\Guild Wars 2\bin64\</OutDir>
<TargetName>d3d9_arcdps_killproof_me</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>C:\Program Files\Guild Wars 2\addons\arcdps\</OutDir>
<OutDir>C:\Program Files\Guild Wars 2\bin64\</OutDir>
<TargetName>d3d9_arcdps_killproof_me</TargetName>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand Down

0 comments on commit 9b216e4

Please sign in to comment.