├── .dependabot
└── config.yml.txt
├── .editorconfig
├── .gitignore
├── LICENSE.txt
├── README.md
├── SmartHunter.sln
├── SmartHunter
├── App.config
├── App.xaml
├── App.xaml.cs
├── Core
│ ├── AddressRange.cs
│ ├── BytePattern.cs
│ ├── Command.cs
│ ├── Config
│ │ ├── ConfigContainer.cs
│ │ ├── ContractResolver.cs
│ │ ├── PreserveCollectionIntegrity.cs
│ │ ├── StringFloatConverter.cs
│ │ └── WidgetConfig.cs
│ ├── Data
│ │ ├── Bindable.cs
│ │ ├── ContextualWidget.cs
│ │ ├── Progress.cs
│ │ ├── TimedVisibility.cs
│ │ ├── Widget.cs
│ │ └── WidgetContext.cs
│ ├── FileContainer.cs
│ ├── GenericEventArgs.cs
│ ├── Helpers
│ │ ├── MemoryHelper.cs
│ │ ├── Updater.cs
│ │ └── WindowHelper.cs
│ ├── KeyboardInput.cs
│ ├── KeyboardInputEventArgs.cs
│ ├── Log.cs
│ ├── MemoryUpdater.cs
│ ├── Overlay.cs
│ ├── PointerTrace.cs
│ ├── PointerTraceLevel.cs
│ ├── Setting.cs
│ ├── StateMachine.cs
│ ├── ThreadedMemoryScan.cs
│ ├── Windows
│ │ └── WidgetWindow.cs
│ └── WindowsApi.cs
├── Game
│ ├── Config
│ │ ├── BytePatternConfig.cs
│ │ ├── CrownPreset.cs
│ │ ├── DebugConfig.cs
│ │ ├── DebugWidgetConfig.cs
│ │ ├── LocalizationConfig.cs
│ │ ├── MainConfig.cs
│ │ ├── MemoryConditionConfig.cs
│ │ ├── MemoryConfig.cs
│ │ ├── MemorySource.cs
│ │ ├── MonsterConfig.cs
│ │ ├── MonsterCrownConfig.cs
│ │ ├── MonsterDataConfig.cs
│ │ ├── MonsterPartConfig.cs
│ │ ├── MonsterStatusEffectConfig.cs
│ │ ├── MonsterWidgetConfig.cs
│ │ ├── OverlayConfig.cs
│ │ ├── PlayerDataConfig.cs
│ │ ├── PlayerWidgetConfig.cs
│ │ ├── StatusEffectConfig.cs
│ │ └── TeamWidgetConfig.cs
│ ├── Data
│ │ ├── Game.cs
│ │ ├── Monster.cs
│ │ ├── MonsterCrown.cs
│ │ ├── MonsterPart.cs
│ │ ├── MonsterStatusEffect.cs
│ │ ├── Player.cs
│ │ ├── PlayerStatusEffect.cs
│ │ ├── ViewModels
│ │ │ ├── ConsoleViewModel.cs
│ │ │ ├── OverlayViewModel.cs
│ │ │ └── SettingsViewModel.cs
│ │ ├── WeaponType.cs
│ │ └── WidgetContexts
│ │ │ ├── DebugWidgetContext.cs
│ │ │ ├── MonsterWidgetContext.cs
│ │ │ ├── PlayerWidgetContext.cs
│ │ │ └── TeamWidgetContext.cs
│ ├── Helpers
│ │ ├── ConfigHelper.cs
│ │ ├── LocalizationHelper.cs
│ │ └── MhwHelper.cs
│ ├── InputControl.cs
│ ├── MhwMemoryUpdater.cs
│ └── MhwOverlay.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── SmartHunter.csproj
└── Ui
│ ├── Converters
│ ├── AngleToIsLargeArcConverter.cs
│ ├── AngleToPointConverter.cs
│ ├── BoolToVisibilityConverter.cs
│ ├── ColorTransformConverter.cs
│ ├── EnumComparisonConverter.cs
│ ├── FractionToPercentageConverter.cs
│ ├── LocalizerConverter.cs
│ ├── NumberComparisonConverter.cs
│ ├── NumberToCenteredMarginConverter.cs
│ ├── PlayerToPlayerIndexConverter.cs
│ ├── StringArrayContainsConverter.cs
│ ├── StringFormatConverter.cs
│ └── WeaponTypeToNameConverter.cs
│ ├── Fonts
│ ├── Roboto-Bold.ttf
│ └── Roboto-Medium.ttf
│ ├── Resources
│ └── Default.xaml
│ └── Windows
│ ├── ConsoleWindow.xaml
│ ├── ConsoleWindow.xaml.cs
│ ├── DebugWidgetWindow.xaml
│ ├── DebugWidgetWindow.xaml.cs
│ ├── MonsterWidgetWindow.xaml
│ ├── MonsterWidgetWindow.xaml.cs
│ ├── PlayerWidgetWindow.xaml
│ ├── PlayerWidgetWindow.xaml.cs
│ ├── TeamWidgetWindow.xaml
│ └── TeamWidgetWindow.xaml.cs
├── build
├── PackageRelease.ps1
└── build.cmd
└── doc
└── Config.json.md
/.dependabot/config.yml.txt:
--------------------------------------------------------------------------------
1 | version: 1
2 | update_configs:
3 | - package_manager: "dotnet:nuget"
4 | directory: "/"
5 | update_schedule: "live"
6 | target_branch: dev
7 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 |
3 | # Top-most EditorConfig file
4 | root = true
5 |
6 | # Default settings:
7 | [*]
8 | charset = utf-8
9 | indent_style = space
10 | indent_size = 4
11 | insert_final_newline = true
12 | trim_trailing_whitespace = true
13 |
14 | # C# files
15 | [*.cs]
16 | end_of_line = crlf
17 |
18 | # Documentation for Visual Studio .editorconfig configuration:
19 | # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
20 |
21 | ## Advanced
22 | dotnet_sort_system_directives_first = true
23 |
24 | ## Code Style
25 |
26 | ### General
27 |
28 | # 'this.' preferences
29 | dotnet_style_qualification_for_field = false:suggestion
30 | dotnet_style_qualification_for_property = false:suggestion
31 | dotnet_style_qualification_for_method = false:suggestion
32 | dotnet_style_qualification_for_event = false:suggestion
33 |
34 | # Predefined type preferences
35 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
36 | dotnet_style_predefined_type_for_member_access = true:suggestion
37 |
38 | # 'using' preferences
39 | csharp_using_directive_placement = outside_namespace:suggestion
40 |
41 | # Modifier preferences
42 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
43 | csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion
44 | dotnet_style_readonly_field = true:suggestion
45 |
46 | # parenthesis preferences
47 | dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
48 | dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
49 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
50 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
51 |
52 | # Expression-level preferences
53 | dotnet_style_object_initializer = true:suggestion
54 | dotnet_style_collection_initializer = true:suggestion
55 | dotnet_style_explicit_tuple_names = true:suggestion
56 | dotnet_style_prefer_inferred_tuple_names = true:suggestion
57 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
58 | dotnet_style_prefer_auto_properties = true:none
59 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
60 | dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
61 | dotnet_style_prefer_conditional_expression_over_return = true:suggestion
62 | csharp_prefer_simple_default_expression = true:suggestion
63 | csharp_style_deconstructed_variable_declaration = true:suggestion
64 | csharp_style_pattern_local_over_anonymous_function = true:suggestion
65 |
66 | ## Pattern matching
67 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
68 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
69 |
70 | # Variable preferences
71 | csharp_style_inlined_variable_declaration = true:suggestion
72 |
73 | # Null checking preferences
74 | csharp_style_throw_expression = true:suggestion
75 | csharp_style_conditional_delegate_call = true:suggestion
76 | dotnet_style_coalesce_expression = true:suggestion
77 | dotnet_style_null_propagation = true:suggestion
78 |
79 | # 'var' preferences'
80 | csharp_style_var_for_built_in_types = true:suggestion
81 | csharp_style_var_when_type_is_apparent = true:suggestion
82 | csharp_style_var_elsewhere = true:suggestion
83 |
84 | # Expression-bodied members
85 | csharp_style_expression_bodied_methods = true:suggestion
86 | csharp_style_expression_bodied_constructors = when_on_single_line:suggestion
87 | csharp_style_expression_bodied_operators = true:suggestion
88 | csharp_style_expression_bodied_properties = true:suggestion
89 | csharp_style_expression_bodied_indexers = true:suggestion
90 | csharp_style_expression_bodied_accessors = true:suggestion
91 |
92 | ### Formatting
93 |
94 | #### Indentation
95 | csharp_indent_block_contents = true
96 | csharp_indent_braces = false
97 | csharp_indent_case_contents = true
98 | csharp_indent_switch_labels = true
99 | csharp_indent_labels = flush_left
100 |
101 | #### New Lines
102 | # braces
103 | csharp_new_line_before_open_brace = all
104 | # keywords
105 | csharp_new_line_before_else = true
106 | csharp_new_line_before_catch = true
107 | csharp_new_line_before_finally = true
108 | # expressions
109 | csharp_new_line_before_members_in_object_initializers = true
110 | csharp_new_line_before_members_in_anonymous_types = true
111 | csharp_new_line_within_query_expression_clauses = true
112 |
113 | #### Spacing
114 | # method declarations
115 | csharp_space_between_method_declaration_name_and_open_parenthesis = false
116 | csharp_space_between_method_declaration_parameter_list_parentheses = false
117 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
118 | # method calls
119 | csharp_space_between_method_call_name_and_opening_parenthesis = false
120 | csharp_space_between_method_call_parameter_list_parentheses = false
121 | csharp_space_between_method_call_empty_parameter_list_parentheses = false
122 | # other spacing options
123 | csharp_space_after_keywords_in_control_flow_statements = true
124 | csharp_space_between_parentheses = false
125 | csharp_space_after_cast = false
126 | csharp_space_around_declaration_statements = do_not_ignore
127 | # brackets
128 | csharp_space_before_open_square_brackets = false
129 | csharp_space_between_empty_square_brackets = false
130 | csharp_space_between_square_brackets = false
131 | # delimiters
132 | csharp_space_after_colon_in_inheritance_clause = true
133 | csharp_space_after_comma = true
134 | csharp_space_after_dot = false
135 | csharp_space_after_semicolon_in_for_statement = true
136 | csharp_space_before_colon_in_inheritance_clause = true
137 | csharp_space_before_comma = false
138 | csharp_space_before_dot = false
139 | csharp_space_before_semicolon_in_for_statement = false
140 | # operators
141 | csharp_space_around_binary_operators = before_and_after
142 |
143 | #### Wrapping
144 | csharp_preserve_single_line_blocks = true
145 | csharp_preserve_single_line_statements = false
146 |
147 | ### Naming
148 | # name all constant fields using PascalCase
149 | dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
150 | dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
151 | dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
152 |
153 | dotnet_naming_symbols.constant_fields.applicable_kinds = field
154 | dotnet_naming_symbols.constant_fields.required_modifiers = const
155 |
156 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case
157 |
158 | # static fields should have s_ prefix
159 | dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
160 | dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
161 | dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
162 |
163 | dotnet_naming_symbols.static_fields.applicable_kinds = field
164 | dotnet_naming_symbols.static_fields.required_modifiers = static
165 |
166 | dotnet_naming_style.static_prefix_style.required_prefix = s_
167 | dotnet_naming_style.static_prefix_style.capitalization = camel_case
168 |
169 | # internal and private fields should be _camelCase
170 | dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
171 | dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
172 | dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
173 |
174 | dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
175 | dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
176 |
177 | dotnet_naming_style.camel_case_underscore_style.required_prefix = _
178 | dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
179 |
180 | # Markdown files
181 | [*.md]
182 | trim_trailing_whitespace = false
183 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | [Bb]in
2 | [Dd]ebug/
3 | [Pp]ublish/
4 | [Rr]elease*/
5 | obj/
6 | .vs/
7 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 r00telement
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SmartHunter - Monster Hunter: World Overlay
2 |
3 | A complete overlay for Monster Hunter: World on PC with Iceborne support. Originally distributed on [Nexus Mods](https://www.nexusmods.com/monsterhunterworld/mods/793). Features include:
4 |
5 | - Monster widget - name, health, parts, status effect buildup, and crown.
6 | - Team widget - name and damage meters.
7 | - Player widget - buff, debuff, and equipment/mantle timers.
8 | - Open source - freely learn from and contribute to the project.
9 | - Skinnable - create and distribute your own rich styles and animations with XAML.
10 | - Easy localization - create and distribute your own translations for our international friends.
11 |
12 | ## Requirements
13 |
14 | - [.NET Framework runtime](https://dotnet.microsoft.com/download/dotnet-framework) (4.6.1 is required 4.8 is recommended).
15 | - Monster Hunter: World running in borderless window or windowed mode.
16 |
17 | ## How to install
18 |
19 | - Download the latest release from [here](https://github.com/sir-wilhelm/SmartHunter/releases) (Assets > SmartHunter.zip).
20 | - Extract the contents of the zip.
21 | - Right-click SmartHunter.exe > Properties > check Unblock > click OK.
22 |
23 | ## How to use
24 |
25 | - Launch `SmartHunter.exe`.
26 | - Hold `LeftAlt` to view widget locations.
27 | - Click and drag widgets to move them.
28 | - Use the mouse wheel scroll over widgets to rescale them.
29 | - Other modifiers:
30 | - Press and hold `F1` to hide all widgets.
31 | - Press `RightCtrl` to toggle widget visibility.
32 |
33 | ### How to update
34 |
35 | - SmartHunter automatically checks the latest release, and if a new version is released it will auto download, extract, and clean up the old files.
36 | - To disable this feature set `AutomaticallyCheckAndDownloadUpdates` to `false` in `Config.json`.
37 | - You can always grab the latest version from the [releases](https://github.com/sir-wilhelm/SmartHunter/releases) page.
38 |
39 | ### How to use custom data
40 |
41 | - To better support auto updates, the .json data files are recreated by default.
42 | - To change/use custom data files set `UseCustomData` to `true` in `Config.json`.
43 | - Note: Memory.json is not
44 |
45 | ### How to create and use new localizations
46 |
47 | - Create a copy of `en-US.json` and rename it for the locale you are translating to.
48 | - Translate the strings in the second part of each key value pair. Do not change the keys.
49 | - Ensure the new file is in the SmartHunter folder.
50 | - Open `Config.json` and point `LocalizationFileName` to the new file.
51 |
52 | ### How to create and use new skins
53 |
54 | - Create a copy of `Default.xaml` and rename it appropriately.
55 | - Make changes to the new file.
56 | - Ensure the new file is in the SmartHunter folder.
57 | - Open `Config.json` and point `SkinFileName` to the new file.
58 |
59 | # FAQ
60 |
61 | Can I configure what is visible?
62 | Yes - see `Config.json` documentation [here](/doc/Config.json.md).
63 |
64 | Why don't monster parts and status effects update properly in multiplayer sessions?
65 | This data only updates properly for the quest host. This is just the way the game works and it can't be worked around.
66 |
67 | Where is the config file?
68 | `Config.json` is generated when SmartHunter is first launched.
69 |
--------------------------------------------------------------------------------
/SmartHunter.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29613.14
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SmartHunter", "SmartHunter\SmartHunter.csproj", "{F5F99CEF-1C16-48E6-A88B-1A66D3B53998}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2A20B067-F085-4EB5-8667-7E708ACE5755}"
9 | ProjectSection(SolutionItems) = preProject
10 | .editorconfig = .editorconfig
11 | .gitignore = .gitignore
12 | LICENSE.txt = LICENSE.txt
13 | README.md = README.md
14 | EndProjectSection
15 | EndProject
16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{ABF62AAC-2B01-43AB-9233-F2C3F4F746B3}"
17 | ProjectSection(SolutionItems) = preProject
18 | build\build.cmd = build\build.cmd
19 | build\PackageRelease.ps1 = build\PackageRelease.ps1
20 | EndProjectSection
21 | EndProject
22 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{AC741825-8381-4958-A594-773ED0E868FF}"
23 | ProjectSection(SolutionItems) = preProject
24 | doc\Config.json.md = doc\Config.json.md
25 | EndProjectSection
26 | EndProject
27 | Global
28 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
29 | Debug|Any CPU = Debug|Any CPU
30 | Release|Any CPU = Release|Any CPU
31 | EndGlobalSection
32 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
33 | {F5F99CEF-1C16-48E6-A88B-1A66D3B53998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34 | {F5F99CEF-1C16-48E6-A88B-1A66D3B53998}.Debug|Any CPU.Build.0 = Debug|Any CPU
35 | {F5F99CEF-1C16-48E6-A88B-1A66D3B53998}.Release|Any CPU.ActiveCfg = Release|Any CPU
36 | {F5F99CEF-1C16-48E6-A88B-1A66D3B53998}.Release|Any CPU.Build.0 = Release|Any CPU
37 | EndGlobalSection
38 | GlobalSection(SolutionProperties) = preSolution
39 | HideSolutionNode = FALSE
40 | EndGlobalSection
41 | GlobalSection(ExtensibilityGlobals) = postSolution
42 | SolutionGuid = {A27E60A3-31A8-4F18-8D9E-30FA3B4CAF53}
43 | EndGlobalSection
44 | EndGlobal
45 |
--------------------------------------------------------------------------------
/SmartHunter/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/SmartHunter/App.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SmartHunter/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Windows;
7 | using System.Xaml;
8 | using SmartHunter.Core;
9 | using SmartHunter.Game;
10 | using SmartHunter.Game.Data.ViewModels;
11 | using SmartHunter.Game.Helpers;
12 | using SmartHunter.Ui.Windows;
13 | using XamlReader = System.Windows.Markup.XamlReader;
14 |
15 | namespace SmartHunter
16 | {
17 | public partial class App : Application
18 | {
19 | MhwOverlay m_Overlay;
20 | FileContainer m_SkinFile;
21 |
22 | string m_LastSkinFileName;
23 |
24 | protected override void OnStartup(StartupEventArgs e)
25 | {
26 | // Initialize the console view model first thing so we can see any problems that may occur
27 | var consoleViewModel = ConsoleViewModel.Instance;
28 |
29 | var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
30 | var fileVersionInfoVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
31 | Log.WriteLine($"Started: Assembly Version: {assemblyVersion} | File Version: {fileVersionInfoVersion}");
32 |
33 | SetPerMonitorDpiAwareness();
34 |
35 | ConfigHelper.EnsureConfigs();
36 | ConfigHelper.Main.Loaded += Config_Loaded;
37 |
38 | m_SkinFile = new FileContainer(ConfigHelper.Main.Values.SkinFileName);
39 | m_SkinFile.Changed += (s1, e1) => { LoadSkin(); };
40 | LoadSkin();
41 |
42 | m_Overlay = new MhwOverlay(new ConsoleWindow(), new TeamWidgetWindow(), new MonsterWidgetWindow(), new PlayerWidgetWindow(), new DebugWidgetWindow());
43 |
44 | base.OnStartup(e);
45 | }
46 |
47 | protected override void OnExit(ExitEventArgs e)
48 | {
49 | Log.WriteLine("Ended");
50 | base.OnExit(e);
51 | }
52 |
53 | private void Config_Loaded(object sender, EventArgs e)
54 | {
55 | if (m_LastSkinFileName != ConfigHelper.Main.Values.SkinFileName)
56 | {
57 | LoadSkin();
58 | }
59 | }
60 |
61 | void LoadSkin()
62 | {
63 | if (ConfigHelper.Main.Values.Debug.UseInternalSkin)
64 | {
65 | return;
66 | }
67 |
68 | var skinFileName = ConfigHelper.Main.Values.SkinFileName;
69 | if (!File.Exists(FileContainer.GetFullPathFileName(skinFileName)))
70 | {
71 | Log.WriteLine($"Failed to load skin file '{skinFileName}'");
72 | return;
73 | }
74 |
75 | m_SkinFile.TryChangeFileName(skinFileName);
76 |
77 | try
78 | {
79 | ResourceDictionary resourceDictionary = null;
80 |
81 | using (var streamReader = new StreamReader(m_SkinFile.FullPathFileName, Encoding.UTF8))
82 | {
83 | var xmlReaderSettings = new XamlXmlReaderSettings
84 | {
85 | LocalAssembly = Assembly.GetExecutingAssembly()
86 | };
87 |
88 | using (var xamlReader = new XamlXmlReader(streamReader.BaseStream, XamlReader.GetWpfSchemaContext(), xmlReaderSettings))
89 | {
90 | resourceDictionary = XamlReader.Load(xamlReader) as ResourceDictionary;
91 | }
92 | }
93 |
94 | if (resourceDictionary != null)
95 | {
96 | Resources.MergedDictionaries.Clear();
97 | Resources.MergedDictionaries.Add(resourceDictionary);
98 |
99 | if (m_Overlay != null)
100 | {
101 | m_Overlay.RefreshWidgetsLayout();
102 | }
103 |
104 | Log.WriteLine($"{m_SkinFile.FileName} loaded");
105 | }
106 | }
107 | catch (Exception ex)
108 | {
109 | Log.WriteException(ex);
110 | }
111 |
112 | m_LastSkinFileName = skinFileName;
113 | }
114 |
115 | void SetPerMonitorDpiAwareness()
116 | {
117 | // Win 8.1 added support for per monitor dpi
118 | if (Environment.OSVersion.Version >= new Version(6, 3, 0))
119 | {
120 | // Win 10 creators update added support for per monitor v2
121 | if (Environment.OSVersion.Version >= new Version(10, 0, 15063))
122 | {
123 | WindowsApi.SetProcessDpiAwarenessContext((int)WindowsApi.DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
124 | }
125 | else
126 | {
127 | WindowsApi.SetProcessDpiAwareness(WindowsApi.PROCESS_DPI_AWARENESS.PROCESS_PER_MONITOR_DPI_AWARE);
128 | }
129 | }
130 | else
131 | {
132 | WindowsApi.SetProcessDPIAware();
133 | }
134 | }
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/SmartHunter/Core/AddressRange.cs:
--------------------------------------------------------------------------------
1 | namespace SmartHunter.Core
2 | {
3 | public class AddressRange
4 | {
5 | public ulong Start { get; private set; }
6 | public ulong End { get; private set; }
7 | public ulong Size { get; private set; }
8 |
9 | public AddressRange(ulong start, ulong size)
10 | {
11 | Start = start;
12 | End = start + size;
13 | Size = size;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/SmartHunter/Core/BytePattern.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using SmartHunter.Game.Config;
5 |
6 | namespace SmartHunter.Core
7 | {
8 | public class BytePattern
9 | {
10 | public BytePatternConfig Config { get; }
11 | public byte?[] Bytes { get; private set; }
12 | public List MatchedAddresses { get; private set; }
13 |
14 | public BytePattern(BytePatternConfig config)
15 | {
16 | Config = config;
17 | Bytes = BytesFromString(config.PatternString);
18 | MatchedAddresses = new List();
19 | }
20 |
21 | public static byte?[] BytesFromString(string byteString)
22 | {
23 | List byteList = new List();
24 |
25 | var singleByteStrings = byteString.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
26 |
27 | foreach (var singleByteString in singleByteStrings)
28 | {
29 | byte parsedByte = 0;
30 | if (byte.TryParse(singleByteString, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out parsedByte))
31 | {
32 | byteList.Add(parsedByte);
33 | }
34 | else
35 | {
36 | byteList.Add(null);
37 | }
38 | }
39 |
40 | return byteList.ToArray();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/SmartHunter/Core/Command.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Input;
3 |
4 | namespace SmartHunter.Core
5 | {
6 | #pragma warning disable 67
7 | public class Command : ICommand
8 | {
9 | private readonly Action