Skip to content

Commit

Permalink
Renamed solution and added PTDE Loaded
Browse files Browse the repository at this point in the history
- From WPF.Gadgetlemage to Gadgetlemage
- Loaded now works for PTDE
  • Loading branch information
CapitaineToinon committed Apr 3, 2019
1 parent b58fe79 commit 98ca72a
Show file tree
Hide file tree
Showing 23 changed files with 75 additions and 58 deletions.
8 changes: 1 addition & 7 deletions WPF.Gadgetlemage.sln → Gadgetlemage.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.438
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF.Gadgetlemage", "WPF.Gadgetlemage\WPF.Gadgetlemage.csproj", "{E1892EF2-6542-4B25-B706-A9E016636DC6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gadgetlemage", "Gadgetlemage\Gadgetlemage.csproj", "{E1892EF2-6542-4B25-B706-A9E016636DC6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E1892EF2-6542-4B25-B706-A9E016636DC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1892EF2-6542-4B25-B706-A9E016636DC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1892EF2-6542-4B25-B706-A9E016636DC6}.Debug|x64.ActiveCfg = Debug|x64
{E1892EF2-6542-4B25-B706-A9E016636DC6}.Debug|x64.Build.0 = Debug|x64
{E1892EF2-6542-4B25-B706-A9E016636DC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1892EF2-6542-4B25-B706-A9E016636DC6}.Release|Any CPU.Build.0 = Release|Any CPU
{E1892EF2-6542-4B25-B706-A9E016636DC6}.Release|x64.ActiveCfg = Release|x64
{E1892EF2-6542-4B25-B706-A9E016636DC6}.Release|x64.Build.0 = Release|x64
EndGlobalSection
Expand Down
9 changes: 6 additions & 3 deletions WPF.Gadgetlemage/App.config → Gadgetlemage/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WPF.Gadgetlemage.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Gadgetlemage.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<userSettings>
<WPF.Gadgetlemage.Properties.Settings>
<Gadgetlemage.Properties.Settings>
<setting name="HotkeyCreate" serializeAs="String">
<value>27</value>
</setting>
Expand All @@ -25,6 +25,9 @@
<setting name="Auto" serializeAs="String">
<value>False</value>
</setting>
</WPF.Gadgetlemage.Properties.Settings>
<setting name="SelectedIndex" serializeAs="String">
<value>0</value>
</setting>
</Gadgetlemage.Properties.Settings>
</userSettings>
</configuration>
4 changes: 2 additions & 2 deletions WPF.Gadgetlemage/App.xaml → Gadgetlemage/App.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Application x:Class="WPF.Gadgetlemage.App"
<Application x:Class="Gadgetlemage.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPF.Gadgetlemage"
xmlns:local="clr-namespace:Gadgetlemage"
StartupUri="MainWindow.xaml">
<Application.Resources>

Expand Down
2 changes: 1 addition & 1 deletion WPF.Gadgetlemage/App.xaml.cs → Gadgetlemage/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Windows;

namespace WPF.Gadgetlemage
namespace Gadgetlemage
{
/// <summary>
/// Logique d'interaction pour App.xaml
Expand Down
2 changes: 1 addition & 1 deletion WPF.Gadgetlemage/Assembly.cs → Gadgetlemage/Assembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace WPF.Gadgetlemage
namespace Gadgetlemage
{
public static class Assembly
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Diagnostics;

namespace WPF.Gadgetlemage
namespace Gadgetlemage
{
public enum Version
{
Expand Down Expand Up @@ -40,9 +40,11 @@ public class DarkSoulsHook : PHook
private const string PTDEBasePtrAOB = "8B 0D ? ? ? ? 8B 7E 1C 8B 49 08 8B 46 20";
private const string PTDEInventoryDataAOB = "A1 ? ? ? ? 53 55 8B 6C 24 10 56 8B 70 08 32 DB 85 F6";
private const string PTDEFlagsAOB = "56 8B F1 8B 46 1C 50 A1 ? ? ? ? 32 C9";
private const string PTDEChrFollowCamAOB = "8B 15 ? ? ? ? F3 0F 10 44 24 30 52 E8 ? ? ? ? 8B 06 8B 50 2C 8B CE FF D2";
private PHPointer PTDEBasePtr;
private PHPointer PTDEInventoryData;
private PHPointer PTDEFlags;
private PHPointer PTDEChrFollowCam;
private uint PTDEInventoryIndexStart = 0x1B8;
private uint PTDEFuncItemGetPtr = 0xC0B6DA;

Expand Down Expand Up @@ -105,7 +107,7 @@ public bool Loaded
{
return (Version == Version.DarkSoulsRemastered)
? (RemasterChrFollowCam.Resolve() != IntPtr.Zero)
: true;
: (PTDEChrFollowCam.Resolve() != IntPtr.Zero);
}
}

Expand All @@ -132,6 +134,7 @@ public DarkSoulsHook() : base(_refreshInterval, _minLifetime, processSelector)
PTDEBasePtr = RegisterAbsoluteAOB(PTDEBasePtrAOB, 2);
PTDEInventoryData = RegisterAbsoluteAOB(PTDEInventoryDataAOB, 1);
PTDEFlags = RegisterAbsoluteAOB(PTDEFlagsAOB, 8, 0, 0);
PTDEChrFollowCam = RegisterAbsoluteAOB(PTDEChrFollowCamAOB, 2, 0x4, 0x0);

// Remastered Pointers
RemasterBasePtr = RegisterRelativeAOB(RemasterBasePtrAOB, 3, 7);
Expand Down
2 changes: 1 addition & 1 deletion WPF.Gadgetlemage/Flags.cs → Gadgetlemage/Flags.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace WPF.Gadgetlemage
namespace Gadgetlemage
{
/// <summary>
/// Flags magic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E1892EF2-6542-4B25-B706-A9E016636DC6}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WPF.Gadgetlemage</RootNamespace>
<AssemblyName>WPF.Gadgetlemage</AssemblyName>
<RootNamespace>Gadgetlemage</RootNamespace>
<AssemblyName>Gadgetlemage</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand Down Expand Up @@ -56,6 +56,9 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="LowLevelHooking, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LowLevelHooking.1.0.1\lib\net20\LowLevelHooking.dll</HintPath>
Expand All @@ -65,6 +68,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
Expand All @@ -88,6 +92,11 @@
<Compile Include="Flags.cs" />
<Compile Include="Hotkey.cs" />
<Compile Include="InventoryItem.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="User32.cs" />
<Compile Include="Weapon.cs" />
<Page Include="MainWindow.xaml">
Expand All @@ -107,11 +116,6 @@
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
Expand All @@ -135,10 +139,11 @@
</None>
</ItemGroup>
<ItemGroup>
<Resource Include="Ressources\PTDE.txt" />
<Resource Include="icon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Ressources\REMASTERED.txt" />
<Resource Include="Resources\PTDE.txt" />
<Resource Include="Resources\REMASTERED.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 1 addition & 1 deletion WPF.Gadgetlemage/Hotkey.cs → Gadgetlemage/Hotkey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Windows.Input;
using LowLevelHooking;

namespace WPF.Gadgetlemage
namespace Gadgetlemage
{
public class Hotkey
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace WPF.Gadgetlemage
namespace Gadgetlemage
{
public struct InventoryItem
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Window x:Class="WPF.Gadgetlemage.MainWindow"
<Window x:Class="Gadgetlemage.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPF.Gadgetlemage"
xmlns:local="clr-namespace:Gadgetlemage"
mc:Ignorable="d" Width="546" VerticalAlignment="Top" ResizeMode="NoResize" Height="415">
<Grid Margin="0,0,2,0" VerticalAlignment="Top">
<ComboBox x:Name="comboWeapons" Margin="10,10,90,0" VerticalAlignment="Top" FontFamily="Roboto" Height="22"/>
Expand All @@ -26,7 +26,7 @@
<ColumnDefinition Width="7*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Margin="10,34,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="31" FontFamily="Roboto" Foreground="#FF464646"><Run Text="Automatically creates the Black Knight weapon if it doesn't drop. "/><Run Text="The weapon can then be dropped manually if desired."/></TextBlock>
<TextBlock Margin="10,34,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="31" FontFamily="Roboto" Foreground="#FF464646"><Run Text="Automatically creates the Black Knight weapon if it doesn't drop. "/><Run Text="The weapon can "/><Run Text="still "/><Run Text="be dropped manually if desired."/></TextBlock>
<TextBlock Margin="10,20,10,0" TextWrapping="Wrap" VerticalAlignment="Top" FontFamily="Roboto" FontWeight="Bold" Height="14"><Run Text="Automatically"/><Run Text=" Create Weapon"/></TextBlock>
<TextBlock Margin="10,70,10,0" TextWrapping="Wrap" VerticalAlignment="Top" FontFamily="Roboto" FontWeight="Bold" Height="14" Text="Enable Global Hotkey"/>
<TextBlock Margin="10,84,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="31" FontFamily="Roboto" Foreground="#FF464646" Text="Enables the global hotkey. The hotkey is only active when Dark Souls or Dark Souls: Remastered is in focus."/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Windows.Navigation;
using LowLevelHooking;

namespace WPF.Gadgetlemage
namespace Gadgetlemage
{
/// <summary>
/// Logique d'interaction pour MainWindow.xaml
Expand Down Expand Up @@ -79,7 +79,7 @@ private void AutoRefresh(CancellationToken ct)

Dispatcher.Invoke(new Action(() =>
{
btnCreate.IsEnabled = Hook.Loaded;
btnCreate.IsEnabled = Hook.Hooked && Hook.Loaded;

bool auto = cbxAuto.IsChecked ?? false;
if (Hook.Hooked && Hook.Loaded && auto)
Expand All @@ -103,33 +103,28 @@ private void MainWindow_Loaded(object sender, RoutedEventArgs e)
RefreshThread = null;
RefreshCancellationSource = null;

// Load defaults
cbxAuto.IsChecked = (bool)Properties.Settings.Default["Auto"];
cbxHotkey.IsChecked = (bool)Properties.Settings.Default["Hotkey"];
cbxConsume.IsChecked = (bool)Properties.Settings.Default["Consume"];
cbxSound.IsChecked = (bool)Properties.Settings.Default["Sound"];

#if DEBUG
cbxAuto.IsChecked = false;
cbxHotkey.IsChecked = false;
cbxConsume.IsChecked = false;
cbxSound.IsChecked = false;
#endif

// Keyboard hook and hotkeys
keyboardHook = new GlobalKeyboardHook();
Hook = new DarkSoulsHook()
{
RefreshInterval = 1000 / 30
RefreshInterval = 1000 / 30 // 30 times a second
};

// Get Item Hotkey
createHotkey = new Hotkey("HotkeyCreate", GetItem);

// Load defaults
int selectedIndex = (int)Properties.Settings.Default["SelectedIndex"];
Hook.SelectedWeapon = Hook.Weapons[selectedIndex];
cbxAuto.IsChecked = (bool)Properties.Settings.Default["Auto"];
cbxHotkey.IsChecked = (bool)Properties.Settings.Default["Hotkey"];
cbxConsume.IsChecked = (bool)Properties.Settings.Default["Consume"];
cbxSound.IsChecked = (bool)Properties.Settings.Default["Sound"];

// UI elements
comboWeapons.Items.Clear();
Hook.Weapons.ForEach(w => comboWeapons.Items.Add(w));
comboWeapons.SelectedIndex = 0;
comboWeapons.SelectedIndex = selectedIndex;
comboWeapons.SelectionChanged += ComboWeapons_SelectionChanged;

tbxHotkey.IsReadOnly = true;
Expand Down Expand Up @@ -188,11 +183,13 @@ private void MainWindow_Closed(object sender, EventArgs e)
// Save settings
createHotkey.Save();

int selectedIndex = comboWeapons.SelectedIndex;
bool auto = cbxAuto.IsChecked ?? false;
bool hotkeyEnabled = cbxHotkey.IsChecked ?? false;
bool consume = cbxConsume.IsChecked ?? false;
bool sound = cbxSound.IsChecked ?? false;

Properties.Settings.Default["SelectedIndex"] = selectedIndex;
Properties.Settings.Default["Auto"] = auto;
Properties.Settings.Default["Hotkey"] = hotkeyEnabled;
Properties.Settings.Default["Consume"] = consume;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("WPF.Gadgetlemage")]
[assembly: AssemblyTitle("Gadgetlemage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WPF.Gadgetlemage")]
[assembly: AssemblyProduct("Gadgetlemage")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="PTDE" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Ressources\PTDE.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
<value>..\Resources\PTDE.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="REMASTERED" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Ressources\REMASTERED.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
<value>..\Resources\REMASTERED.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="WPF.Gadgetlemage.Properties" GeneratedClassName="Settings">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Gadgetlemage.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="HotkeyCreate" Type="System.Int32" Scope="User">
Expand All @@ -17,5 +17,8 @@
<Setting Name="Auto" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="SelectedIndex" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 98ca72a

Please sign in to comment.