Skip to content

Commit

Permalink
Added Sekiro support
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankvdStam committed Jun 17, 2022
1 parent 05d188a commit c568e96
Show file tree
Hide file tree
Showing 23 changed files with 478 additions and 23 deletions.
Binary file modified Components/SoulMemory.dll
Binary file not shown.
Binary file modified Components/SoulSplitter.dll
Binary file not shown.
9 changes: 9 additions & 0 deletions Components/Updates.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<updates>
<update version="1.0.30">
<files>
<file path="Components/SoulMemory.dll" status="changed" />
<file path="Components/SoulSplitter.dll" status="changed" />
</files>
<changelog>
<change>Added support for Sekiro!</change>
</changelog>
</update>
<update version="1.0.29">
<files>
<file path="Components/SoulMemory.dll" status="changed" />
Expand Down
Binary file added Components/soulinjectee.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Soulsmodding community: http://soulsmodding.wikidot.com/

Uses the excellent material design library by James Willock: https://materialdesigninxaml.net/

Thanks to Nordgaren, his tools can be found here:
Thanks to Nordgaren, his tools can be found here:
https://github.com/Nordgaren/DS2S-META
https://github.com/Nordgaren/DS2-META
https://github.com/Nordgaren/Erd-Tools
Expand Down
4 changes: 2 additions & 2 deletions src/SoulMemory/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.29")]
[assembly: AssemblyFileVersion("1.0.29")]
[assembly: AssemblyVersion("1.0.30")]
[assembly: AssemblyFileVersion("1.0.30")]
36 changes: 33 additions & 3 deletions src/SoulMemory/Sekiro/Sekiro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using SoulMemory.Memory;
using SoulMemory.Native;
Expand All @@ -19,21 +20,29 @@ public class Sekiro
private Pointer _sprjEventFlagMan;
private Pointer _fieldArea;
private Pointer _worldChrManImp;
private Pointer _igt;
private Pointer _position;

private bool InitPointers()
{
try
{
_process.ScanCache()
.ScanRelative("SprjEventFlagMan", "48 8b 1d ? ? ? ? 4c 89 64 24 30 44 8b e2 4c 89 7c 24 20 48 85 db", 3, 7)
.ScanRelative("SprjEventFlagMan", "48 8b 0d ? ? ? ? 48 89 5c 24 50 48 89 6c 24 58 48 89 74 24 60", 3, 7)
.CreatePointer(out _sprjEventFlagMan, 0)

.ScanRelative("FieldArea", "48 8b 0d ? ? ? ? 48 85 c9 74 26 44 8b 41 28 48 8d 54 24 40", 3, 7)
.CreatePointer(out _fieldArea, 0)

.ScanRelative("WorldChrManImp", "48 8B 35 ? ? ? ? 44 0F 28 18", 3, 7)
.CreatePointer(out _worldChrManImp, 0)
;
.CreatePointer(out _position, 0, 0x48, 0x28)

.ScanRelative("Igt", "48 8b 05 ? ? ? ? 32 d2 48 8b 48 08 48 85 c9 74 13 80 b9 ba", 3, 7)
.CreatePointer(out _igt, 0x0, 0x9c)
//.CreatePointer(out _igt, 0x0, 0x70) new game cycle

;

return InitB3Mods();
}
Expand All @@ -44,6 +53,26 @@ private bool InitPointers()
}
}

public int GetInGameTimeMilliseconds()
{
return _igt?.ReadInt32() ?? 0;
}

public bool IsPlayerLoaded()
{
if (_worldChrManImp == null)
return false;

return _worldChrManImp.ReadInt64(0x88) != 0;
}

public Vector3f GetPlayerPosition()
{
return new Vector3f(_position?.ReadFloat(0x80) ?? 0f, _position?.ReadFloat(0x84) ?? 0f, _position?.ReadFloat(0x88) ?? 0f);
}

public bool Attached => _process != null;

#region Refresh ================================================================================================================================
private void ResetPointers()
{
Expand Down Expand Up @@ -314,13 +343,14 @@ private bool InitB3Mods()
This could potentially cause issues. Replace with code that
detects decryption if necessary
*/
Thread.Sleep(3000);

string version;

uint logoCodeBytesPointFive = 0;
uint logoCodeBytesPointSix = 0;



switch (_process?.MainModule?.ModuleMemorySize){
case 67727360:
version = "1.02";
Expand Down
8 changes: 7 additions & 1 deletion src/SoulMemory/Vector3f.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ namespace SoulMemory
{
public class Vector3f
{
public Vector3f(){ }
public Vector3f(float x, float y, float z)
{
X = x;
Y = y;
Z = z;
}

public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }

public Vector3f Clone()
{
return new Vector3f(X, Y, Z);
}

public override string ToString()
{
return $"{X:N2}, {Y:N2}, {Z:N2}";
Expand Down
4 changes: 2 additions & 2 deletions src/SoulSplitter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.29")]
[assembly: AssemblyFileVersion("1.0.29")]
[assembly: AssemblyVersion("1.0.30")]
[assembly: AssemblyFileVersion("1.0.30")]
1 change: 1 addition & 0 deletions src/SoulSplitter/SoulSplitter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<Compile Include="Splits\EldenRing\Split.cs" />
<Compile Include="Splits\EldenRing\EldenRingSplitType.cs" />
<Compile Include="Splits\Sekiro\SekiroSplitType.cs" />
<Compile Include="Splits\Sekiro\Split.cs" />
<Compile Include="Splitters\DarkSouls3Splitter.cs" />
<Compile Include="Splitters\SekiroSplitter.cs" />
<Compile Include="UI\DarkSouls3\DarkSouls3Control.xaml.cs">
Expand Down
1 change: 1 addition & 0 deletions src/SoulSplitter/Splits/Sekiro/SekiroSplitType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public enum SplitType
{
Boss,
Idol,
Position,
Flag,
}
}
57 changes: 57 additions & 0 deletions src/SoulSplitter/Splits/Sekiro/Split.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using SoulMemory;
using SoulMemory.Sekiro;

namespace SoulSplitter.Splits.Sekiro
{
internal class Split
{
public Split(TimingType timingType, SplitType darkSouls3SplitType, object split)
{
TimingType = timingType;
SplitType = darkSouls3SplitType;

switch (SplitType)
{
default:
throw new Exception($"unsupported split type {SplitType}");

case SplitType.Boss:
Boss = (Boss)split;
Flag = (uint)Boss;
break;

case SplitType.Idol:
Idol = (Idol)split;
Flag = (uint)Idol;
break;

case SplitType.Position:
Position = (Vector3f)split;
break;

case SplitType.Flag:
Flag = (uint)split;
break;
}
}

public readonly TimingType TimingType;
public readonly SplitType SplitType;

public readonly Boss Boss;
public readonly Idol Idol;
public readonly uint Flag;
public readonly Vector3f Position;

/// <summary>
/// Set to true when split conditions are met. Does not trigger a split until timing conditions are met
/// </summary>
public bool SplitConditionMet = false;

/// <summary>
/// True after this split object cause a split. No longer need to check split conditions
/// </summary>
public bool SplitTriggered = false;
}
}
Loading

0 comments on commit c568e96

Please sign in to comment.