mirror of
https://github.com/k1tbyte/Wand-Enhancer.git
synced 2026-08-29 01:08:51 +00:00
added runtime patcher, added MemoryUtils, fixes
This commit is contained in:
@@ -4,28 +4,123 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:WeModPatcher.View.Popups"
|
||||
xmlns:controls="clr-namespace:WeModPatcher.View.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300"
|
||||
d:DesignHeight="Auto" d:DesignWidth="Auto"
|
||||
Background="{DynamicResource Background}"
|
||||
Foreground="{DynamicResource MutedForeground}"
|
||||
FontWeight="Medium"
|
||||
FontSize="13">
|
||||
<Grid Margin="0 0 5 0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="27"/>
|
||||
<RowDefinition Height="27"/>
|
||||
<RowDefinition Height="27"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" VerticalAlignment="Center" Text="Activate WeMod Pro"/>
|
||||
<CheckBox Grid.Row="0" x:Name="ActivateProBox" HorizontalAlignment="Right" VerticalAlignment="Center" IsChecked="True"/>
|
||||
<UserControl.Resources>
|
||||
<Button x:Key="BackButton" Click="BackClicked" VerticalAlignment="Bottom" Padding="3"
|
||||
Margin="0 0 15 0"
|
||||
Width="35" Height="23" Style="{StaticResource IconButton}"
|
||||
Tag="{StaticResource ArrowLeft}"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid x:Name="PatchVectors" Visibility="Visible" Margin="0 0 5 0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="27"/>
|
||||
<RowDefinition Height="27"/>
|
||||
<RowDefinition Height="27"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" VerticalAlignment="Center" Text="Activate WeMod Pro"/>
|
||||
<CheckBox Grid.Row="0" x:Name="ActivateProBox" HorizontalAlignment="Right" VerticalAlignment="Center" IsChecked="True"/>
|
||||
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Center" Text="Disable telemetry"/>
|
||||
<CheckBox Grid.Row="1" x:Name="DisableTelemetryBox" HorizontalAlignment="Right" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Center" Text="Disable telemetry"/>
|
||||
<CheckBox Grid.Row="1" x:Name="DisableTelemetryBox" HorizontalAlignment="Right" VerticalAlignment="Center"/>
|
||||
|
||||
<TextBlock Grid.Row="2" VerticalAlignment="Center" Text="Disable updates"/>
|
||||
<CheckBox Grid.Row="2" x:Name="DisableUpdateBox" HorizontalAlignment="Right" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="2" VerticalAlignment="Center" Text="Disable updates"/>
|
||||
<CheckBox Grid.Row="2" x:Name="DisableUpdateBox" HorizontalAlignment="Right" VerticalAlignment="Center"/>
|
||||
|
||||
<Button Grid.Row="3" Padding="0 5 0 5" Margin="0 15 0 0" Content="Continue"
|
||||
Click="ButtonBase_OnClick"/>
|
||||
<Button Grid.Row="3" Padding="0 5 0 5" Margin="0 15 0 0" Content="Continue"
|
||||
Click="NextClicked"/>
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="PatchMethod" Visibility="Collapsed" Width="650">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid>
|
||||
<Border Background="{DynamicResource Muted}" HorizontalAlignment="Right" Width="2"
|
||||
CornerRadius="10"/>
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="16" Text="Static" Foreground="{DynamicResource Foreground}" HorizontalAlignment="Center" Margin="0 0 0 10"/>
|
||||
<controls:InfoItem
|
||||
IconColor="SpringGreen"
|
||||
IconData="{StaticResource CheckDecagram}"
|
||||
Text="Starting WeMod without this program" />
|
||||
|
||||
<controls:InfoItem
|
||||
Margin="0 15 0 0"
|
||||
IconColor="PaleVioletRed"
|
||||
IconData="{StaticResource AlertDecagram}"
|
||||
Text="Violation of WeMod digital signature (possibly marked by antiviruses, anti-cheats)" />
|
||||
|
||||
<controls:InfoItem
|
||||
Margin="0 10 0 0"
|
||||
IconColor="PaleVioletRed"
|
||||
IconData="{StaticResource AlertDecagram}"
|
||||
Text="Auto-patching after WeMod updates is not available" />
|
||||
|
||||
<controls:InfoItem
|
||||
Margin="0 10 0 0"
|
||||
IconColor="PaleVioletRed"
|
||||
IconData="{StaticResource AlertDecagram}"
|
||||
Text="Hotkeys will be broken" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Row="0" Grid.Column="1">
|
||||
<StackPanel Margin="10 0 0 0">
|
||||
<TextBlock FontSize="16" Text="Runtime" Foreground="{DynamicResource Foreground}"
|
||||
HorizontalAlignment="Center" Margin="-10 0 0 10"/>
|
||||
|
||||
<controls:InfoItem
|
||||
IconColor="SpringGreen"
|
||||
IconData="{StaticResource CheckDecagram}"
|
||||
Text="Hotkeys still work" />
|
||||
|
||||
<controls:InfoItem Margin="0 10 0 0"
|
||||
IconColor="SpringGreen"
|
||||
IconData="{StaticResource CheckDecagram}"
|
||||
Text="Does not break the digital signature (does not make changes to the original .exe)" />
|
||||
|
||||
<controls:InfoItem Margin="0 10 0 0"
|
||||
IconColor="SpringGreen"
|
||||
IconData="{StaticResource CheckDecagram}"
|
||||
Text="Automatically applies patches to new versions (referring to your current selection)" />
|
||||
|
||||
<controls:InfoItem
|
||||
Margin="0 10 0 0"
|
||||
IconColor="Yellow"
|
||||
IconData="{StaticResource AlertDecagram}"
|
||||
Text="The WeMod startup process is controlled by the patcher. (Don't worry, you will no longer see this window. You will run WeMod as usual but using the shortcut that will be created after choosing this method). So you will want to keep this program. Make sure it's in a safe directory (not Temp, Downloads, etc)." />
|
||||
|
||||
<controls:InfoItem Margin="0 10 0 0"
|
||||
IconColor="PaleVioletRed"
|
||||
IconData="{StaticResource AlertDecagram}"
|
||||
Text="Running WeMod directly through official WeMod.exe is not possible until you restore patch backup" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Button Grid.Column="0" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Center"
|
||||
Padding="10 5" Margin="0 15 0 0"
|
||||
Click="OnStaticSelected"
|
||||
Content="Use static"/>
|
||||
|
||||
<Button Grid.Column="1" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Center"
|
||||
Padding="10 5" Margin="0 15 0 0"
|
||||
Click="OnRuntimeSelected"
|
||||
Content="Use runtime"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
|
||||
@@ -3,22 +3,42 @@ using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using WeModPatcher.Models;
|
||||
using WeModPatcher.View.Controls;
|
||||
|
||||
namespace WeModPatcher.View.Popups
|
||||
{
|
||||
public partial class PatchVectorsPopup : UserControl
|
||||
public partial class PatchVectorsPopup : UserControl, IDisposable
|
||||
{
|
||||
private readonly Action<HashSet<EPatchType>> _onApply;
|
||||
private readonly Action<PatchConfig> _onApply;
|
||||
private readonly StackPanel _popupTitleContainer;
|
||||
private string _originalTitle;
|
||||
private readonly TextBlock _titleTextBlock;
|
||||
|
||||
public PatchVectorsPopup(Action<HashSet<EPatchType>> onApply)
|
||||
public PatchVectorsPopup(Action<PatchConfig> onApply)
|
||||
{
|
||||
_onApply = onApply;
|
||||
InitializeComponent();
|
||||
_popupTitleContainer = MainWindow.MainWindow.Instance.PopupHost.TitleContainer;
|
||||
_titleTextBlock = _popupTitleContainer.Children[0] as TextBlock;
|
||||
}
|
||||
|
||||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
|
||||
private void BackClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(ActivateProBox.IsChecked != true && DisableUpdateBox.IsChecked != true && DisableTelemetryBox.IsChecked != true)
|
||||
Dispose();
|
||||
PatchMethod.Visibility = Visibility.Collapsed;
|
||||
PatchVectors.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void OnRuntimeSelected(object sender, RoutedEventArgs e)
|
||||
=> RaiseCallback(EPatchProcessMethod.Runtime);
|
||||
|
||||
private void OnStaticSelected(object sender, RoutedEventArgs e)
|
||||
=> RaiseCallback(EPatchProcessMethod.Static);
|
||||
|
||||
private void RaiseCallback(EPatchProcessMethod method)
|
||||
{
|
||||
if (ActivateProBox.IsChecked != true && DisableUpdateBox.IsChecked != true &&
|
||||
DisableTelemetryBox.IsChecked != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -28,13 +48,35 @@ namespace WeModPatcher.View.Popups
|
||||
{
|
||||
result.Add(EPatchType.ActivatePro);
|
||||
}
|
||||
|
||||
|
||||
if (DisableUpdateBox.IsChecked == true)
|
||||
{
|
||||
result.Add(EPatchType.DisableUpdates);
|
||||
}
|
||||
|
||||
_onApply(result);
|
||||
|
||||
_onApply(new PatchConfig
|
||||
{
|
||||
PatchTypes = result,
|
||||
PatchMethod = method
|
||||
});
|
||||
}
|
||||
|
||||
private void NextClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_popupTitleContainer.Children.Insert(0, FindResource("BackButton") as Button);
|
||||
_originalTitle = _titleTextBlock.Text;
|
||||
_titleTextBlock.Text = "Patch method";
|
||||
PatchMethod.Visibility = Visibility.Visible;
|
||||
PatchVectors.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (PatchVectors.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
_popupTitleContainer.Children.RemoveAt(0);
|
||||
_titleTextBlock.Text = _originalTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user