Skip to content

Commit

Permalink
UI: Add new info dialog for metadata dump and shameless donation link
Browse files Browse the repository at this point in the history
  • Loading branch information
trotlinebeercan committed Dec 6, 2021
1 parent db8b019 commit 7c42cc0
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 12 deletions.
19 changes: 19 additions & 0 deletions CameraHackTool/CameraHackTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,16 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="UI\Information.xaml.cs">
<DependentUpon>Information.xaml</DependentUpon>
</Compile>
<Compile Include="Util\CMMemory.cs" />
<Compile Include="Util\CMMemoryManager.cs" />
<Compile Include="Util\Metadata.cs" />
<Page Include="UI\Information.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -142,6 +149,18 @@
<ItemGroup>
<Resource Include="Resources\AddressAndOffsetMetadata.xml" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.4.0.2\build\Fody.targets" Condition="Exists('..\packages\Fody.4.0.2\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
2 changes: 1 addition & 1 deletion CameraHackTool/Resources/AddressAndOffsetMetadata.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<Root>
<AppVersion>1.5</AppVersion>
<AppVersion>1.5.0.0</AppVersion>
<DownloadLink>https://github.com/BardMusicPlayer/ChipCameraHack/releases</DownloadLink>
<AppMetadata>
<LV>
Expand Down
17 changes: 17 additions & 0 deletions CameraHackTool/UI/Information.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Window x:Class="CameraHackTool.UI.Information"
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:CameraHackTool.UI"
mc:Ignorable="d"
Title="About ChipCameraHack" Height="350" Width="700" Background="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150*"/>
<ColumnDefinition Width="150*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TextBlock_Info" Margin="10,10,10,10" TextWrapping="Wrap" Grid.ColumnSpan="2" Background="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}">
</TextBlock>
</Grid>
</Window>
66 changes: 66 additions & 0 deletions CameraHackTool/UI/Information.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CameraHackTool.UI
{
public partial class Information : Window
{
public Information()
{
InitializeComponent();

TextBlock_Info.Inlines.Clear();
TextBlock_Info.Inlines.Add($"ChipCameraHack v" + Assembly.GetExecutingAssembly().GetName().Version.ToString(2) + ".\n");
TextBlock_Info.Inlines.Add($"Developed by Chipotle Ismylife.\n");
TextBlock_Info.Inlines.Add($"Ko-fi (buy me a drink!): ");
Hyperlink kflink = new Hyperlink()
{
NavigateUri = new Uri("https://ko-fi.com/trotlinebeercan")
};
kflink.Inlines.Add("https://ko-fi.com/trotlinebeercan");
kflink.RequestNavigate += Hyperlink_RequestNavigate;
TextBlock_Info.Inlines.Add(kflink);
TextBlock_Info.Inlines.Add("\n");
TextBlock_Info.Inlines.Add($"Github: ");
Hyperlink ghlink = new Hyperlink()
{
NavigateUri = new Uri("https://github.com/BardMusicPlayer/ChipCameraHack")
};
ghlink.Inlines.Add("https://github.com/BardMusicPlayer/ChipCameraHack");
ghlink.RequestNavigate += Hyperlink_RequestNavigate;
TextBlock_Info.Inlines.Add(ghlink);
TextBlock_Info.Inlines.Add("\n");
TextBlock_Info.Inlines.Add($"Metadata (for nerds):\n");
TextBlock_Info.Inlines.Add($"\tLocalRegion:\t{Metadata.Instance.LocalRegion}\n");
TextBlock_Info.Inlines.Add($"\tLocalVersion:\t{Metadata.Instance.LocalVersion}\n");
TextBlock_Info.Inlines.Add($"\tNewerVersion:\t{Metadata.Instance.NewerVersion}\n");
TextBlock_Info.Inlines.Add($"\tDownloadURL:\t{Metadata.Instance.DownloadURL}\n");
TextBlock_Info.Inlines.Add($"\tCameraZoom:\tffxiv_dx11.exe+0x{Metadata.Instance.CameraZoom.Address:X} + 0x{Metadata.Instance.CameraZoom.Offset:X}\n");
TextBlock_Info.Inlines.Add($"\tCameraFOV:\tffxiv_dx11.exe+0x{Metadata.Instance.CameraFOV.Address:X} + 0x{Metadata.Instance.CameraFOV.Offset:X}\n");
TextBlock_Info.Inlines.Add($"\tCameraAngleX:\tffxiv_dx11.exe+0x{Metadata.Instance.CameraAngleX.Address:X} + 0x{Metadata.Instance.CameraAngleX.Offset:X}\n");
TextBlock_Info.Inlines.Add($"\tCameraAngleY:\tffxiv_dx11.exe+0x{Metadata.Instance.CameraAngleY.Address:X} + 0x{Metadata.Instance.CameraAngleY.Offset:X}\n");
TextBlock_Info.Inlines.Add($"\tNameOffset:\t{Metadata.Instance.PlayerNameOffset}\n");
TextBlock_Info.Inlines.Add($"\tHeightOffset:\t{Metadata.Instance.CameraHeightOffset}\n");
TextBlock_Info.Inlines.Add($"\tMetadataURL:\t{Metadata.Instance.MetadataURL}\n");
}

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
System.Diagnostics.Process.Start(e.Uri.ToString());
}
}
}
14 changes: 11 additions & 3 deletions CameraHackTool/UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using FFXIVUtil;
using System;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Diagnostics;
using System.Windows.Threading;
using System.Reflection;
using CameraHackTool.UI;
using UI;

namespace CameraHackTool
{
Expand Down Expand Up @@ -223,7 +224,14 @@ private void ListBox_RunningProcesses_MouseDoubleClick(object sender, System.Win

private void Button_Info_Click(object sender, RoutedEventArgs e)
{
// display an info popup
Information processSelection = new Information();
processSelection.Top = this.Top;
processSelection.Left = this.Left;
Nullable<bool> dialogResult = processSelection.ShowDialog();
if (dialogResult == true)
{
// ???
}
}
}
}
3 changes: 1 addition & 2 deletions CameraHackTool/UI/ProcessSelection.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Window x:Class="FFXIVUtil.ProcessSelection"
<Window x:Class="UI.ProcessSelection"
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:FFXIVUtil"
mc:Ignorable="d"
Title="Select Process" Height="300" Width="300" Background="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}">
<Grid>
Expand Down
2 changes: 1 addition & 1 deletion CameraHackTool/UI/ProcessSelection.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FFXIVUtil
namespace UI
{
using System.Diagnostics;
using System.Collections.Generic;
Expand Down
10 changes: 5 additions & 5 deletions CameraHackTool/Util/Metadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public class Metadata
private static readonly Lazy<Metadata> __arbitur__ = new Lazy<Metadata>(() => new Metadata());

#if DEBUG
private string MetadataUrl = Path.Combine(Directory.GetParent(Environment.CurrentDirectory).Parent.FullName, "Resources/AddressAndOffsetMetadata.xml");
public string MetadataURL = Path.Combine(Directory.GetParent(Environment.CurrentDirectory).Parent.FullName, "Resources/AddressAndOffsetMetadata.xml");
#else
private string MetadataUrl = "https://raw.githubusercontent.com/BardMusicPlayer/ChipCameraHack/main/CameraHackTool/AddressAndOffsetMetadata.xml";
public string MetadataURL = "https://raw.githubusercontent.com/BardMusicPlayer/ChipCameraHack/main/CameraHackTool/AddressAndOffsetMetadata.xml";
#endif

public enum MetadataResult
Expand All @@ -27,7 +27,7 @@ public enum MetadataResult
Failure
}

private enum GameRegion
public enum GameRegion
{
LV = 0,
KR = 1,
Expand All @@ -43,7 +43,7 @@ public MetadataResult grabApplicationMetadata()
{
try
{
XDocument xmlf = XDocument.Load(MetadataUrl);
XDocument xmlf = XDocument.Load(MetadataURL);
var root = xmlf.Element("Root");

foreach (var element in root.Elements())
Expand Down Expand Up @@ -172,7 +172,7 @@ public MemoryAddressAndOffset(int addr, int off)
public string CameraHeightOffset => CameraHeightData[this.LocalRegion.ToString()];

// region specific addresses
private GameRegion LocalRegion;
public GameRegion LocalRegion;
private Dictionary<string, MemoryAddressAndOffset> CameraZoomData = new Dictionary<string, MemoryAddressAndOffset>();
private Dictionary<string, MemoryAddressAndOffset> CameraFOVData = new Dictionary<string, MemoryAddressAndOffset>();
private Dictionary<string, MemoryAddressAndOffset> CameraAngleXData = new Dictionary<string, MemoryAddressAndOffset>();
Expand Down

0 comments on commit 7c42cc0

Please sign in to comment.