Skip to content

Commit

Permalink
Merge pull request SapphireServer#59 from MapleHinata/add-support-for…
Browse files Browse the repository at this point in the history
…-capture-using-deucalion

Add support for capturing using Deucalion
  • Loading branch information
SapphireMordred authored May 23, 2024
2 parents 332b374 + ead8d99 commit 17d30e8
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "lib/Machina"]
path = lib/Machina
url = https://github.com/lmcintyre/machina
url = https://github.com/MapleHinata/machina
3 changes: 3 additions & 0 deletions FFXIVMonReborn/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
<setting name="OodleLibraryPath" serializeAs="String">
<value />
</setting>
<setting name="UseDeucalion" serializeAs="String">
<value>False</value>
</setting>
</FFXIVMonReborn.Properties.Settings>
</userSettings>
</configuration>
19 changes: 11 additions & 8 deletions FFXIVMonReborn/MachinaCaptureWorker.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using FFXIVMonReborn.DataModel;
using FFXIVMonReborn.Properties;
using FFXIVMonReborn.Views;
using Machina;
using Machina.FFXIV;
using Machina.FFXIV.Headers;
using Machina.FFXIV.Oodle;
Expand Down Expand Up @@ -150,7 +142,18 @@ public void Run()
monitor.MessageSentEventHandler = MessageSent;

monitor.OodleImplementation = _oodleImplementation;
monitor.UseDeucalion = Settings.Default.UseDeucalion;

if (monitor.UseDeucalion)
{
int? id = Process.GetProcessesByName("ffxiv_dx11").FirstOrDefault()?.Id;

if (id == null)
throw new ThreadStateException("No ffxiv_dx11.exe process was found, please ensure that the DirectX 11 version of the game is running and try again.");

monitor.ProcessID = (uint)id;
}

// GamePath points to sqpack
monitor.OodlePath = GetOodlePath();

Expand Down
12 changes: 12 additions & 0 deletions FFXIVMonReborn/Properties/Settings.Designer.cs

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

3 changes: 3 additions & 0 deletions FFXIVMonReborn/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@
</Setting>
<Setting Name="OodleLibraryPath" Type="System.String" Scope="User">
</Setting>
<Setting Name="UseDeucalion" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
1 change: 1 addition & 0 deletions FFXIVMonReborn/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<Separator></Separator>
<MenuItem x:Name="SwitchModeSockets" Header="_Capture mode: Sockets" Click="SwitchModeSockets_OnClick"/>
<MenuItem x:Name="SwitchModePcap" Header="_Capture mode: WinPCap" Click="SwitchModePcap_OnClick"/>
<MenuItem x:Name="SwitchModeDeucalion" Header="_Inject the Deucalion library for Capture" IsCheckable="True" Click="SwitchModeDeucalion_OnClick" Checked="SwitchModeDeucalion_OnChecked" Unchecked="SwitchModeDeucalion_OnUnchecked"/>
<Separator></Separator>
<MenuItem Header="_About" Click="AboutButton_OnClick"/>
</MenuItem>
Expand Down
41 changes: 41 additions & 0 deletions FFXIVMonReborn/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ public MainWindow()

if (Properties.Settings.Default.OodleEnforced)
OodleEnforcedCheckbox.IsChecked = true;

if (Properties.Settings.Default.UseDeucalion)
{
SwitchModeDeucalion.IsChecked = true;
}

OodleImplementation = (OodleImplementation) Settings.Default.OodleImplementation;
OodleImplementationItems = new ObservableCollection<OodleImplementationItem>();
Expand Down Expand Up @@ -812,6 +817,42 @@ private void SetOoodleLibraryPath(object sender, RoutedEventArgs e)

}
}

private void SwitchModeDeucalion_OnChecked(object sender, RoutedEventArgs e)
{
if (AreTabsCapturing())
{
MessageBox.Show("A capture is in progress.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
return;
}

Settings.Default.UseDeucalion = true;
Settings.Default.Save();
}

private void SwitchModeDeucalion_OnUnchecked(object sender, RoutedEventArgs e)
{
if (AreTabsCapturing())
{
MessageBox.Show("A capture is in progress.", "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
return;
}

Settings.Default.UseDeucalion = false;
Settings.Default.Save();
}

private void SwitchModeDeucalion_OnClick(object sender, RoutedEventArgs e)
{
if (Settings.Default.UseDeucalion)
MessageBox.Show("Deucalion allows you to capture packets by injecting a DLL into the game, " +
"skipping network capturing and Oodle. " +
"However, Deucalion might not work with all game versions.",
"FFXIVMon Reborn", MessageBoxButton.OK,
MessageBoxImage.Information);
}
}

public class OodleImplementationItem : INotifyPropertyChanged
Expand Down
2 changes: 1 addition & 1 deletion lib/Machina

0 comments on commit 17d30e8

Please sign in to comment.