Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions SRTPluginProviderRE8/GameHashes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public static class GameHashes
//private static readonly byte[] re8ceroD_20210810_3 = new byte[32] { 248, 18, 212, 128, 184, 219, 12, 144, 5, 248, 18, 119, 67, 167, 153, 209, 150, 26, 72, 170, 14, 208, 57, 29, 8, 208, 168, 231, 124, 196, 77, 49 };
//private static readonly byte[] re8ceroZ_20210810_3 = new byte[32] { 0x8A, 0x92, 0x8C, 0x97, 0xEC, 0xF0, 0x40, 0x88, 0xE8, 0x2A, 0x24, 0x19, 0x93, 0x1E, 0x59, 0x26, 0x9A, 0x8B, 0x56, 0xD6, 0x2C, 0x72, 0x22, 0xE9, 0xE2, 0xB4, 0x04, 0xF7, 0x68, 0x96, 0x72, 0x2F };

// PATCH 1.03
private static readonly byte[] re8WW_20210824_4 = new byte[32] { 0x31, 0x63, 0xAE, 0xD5, 0x4F, 0x11, 0x11, 0xD4, 0x03, 0x59, 0x84, 0x37, 0x6E, 0x5C, 0x91, 0xEA, 0x79, 0x0C, 0x8A, 0x72, 0x43, 0x6F, 0x83, 0xD9, 0xB5, 0x4D, 0xEA, 0x2E, 0x16, 0x61, 0x78, 0x7F };

public static GameVersion DetectVersion(string filePath)
{
byte[] checksum;
Expand All @@ -59,6 +62,12 @@ public static GameVersion DetectVersion(string filePath)
return GameVersion.RE8_WW_20210810_3;
}

else if (checksum.SequenceEqual(re8WW_20210824_4))
{
Console.WriteLine("Steam v1.03 Detected.");
return GameVersion.RE8_WW_20210824_4;
}

else if (checksum.SequenceEqual(re8promo01_20210426_1))
{
Console.WriteLine("Steam Promo v1.00 Detected.");
Expand Down
6 changes: 6 additions & 0 deletions SRTPluginProviderRE8/GameMemoryRE8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@ public class GameMemoryRE8 : IGameMemoryRE8
public int Lei { get => _lei; set => _lei = value; }
internal int _lei;

public int EnemyTableCount { get => _enemyTableCount; set => _enemyTableCount = value; }
internal int _enemyTableCount;

public EnemyHP[] EnemyHealth { get => _enemyHealth; set => _enemyHealth = value; }
internal EnemyHP[] _enemyHealth;

public int PlayerInventoryCount { get => _playerInventoryCount; set => _playerInventoryCount = value; }
internal int _playerInventoryCount;

public InventoryEntry LastKeyItem { get => _lastKeyItem; set => _lastKeyItem = value; }
internal InventoryEntry _lastKeyItem;

Expand Down
11 changes: 5 additions & 6 deletions SRTPluginProviderRE8/GameMemoryRE8Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ internal class GameMemoryRE8Scanner : IDisposable
public bool HasScanned;
public bool ProcessRunning => memoryAccess != null && memoryAccess.ProcessRunning;
public int ProcessExitCode => (memoryAccess != null) ? memoryAccess.ProcessExitCode : 0;
private int EnemyTableCount;
private int InventoryTableCount;

// Pointer Address Variables
private int pointerPropsManager;
Expand Down Expand Up @@ -237,6 +235,7 @@ private bool SelectPointerAddresses(GameVersion version)
switch (version)
{
case GameVersion.RE8_WW_20210810_3:
case GameVersion.RE8_WW_20210824_4:
{
pointerInventory = 0x0A06B7F0; // app_InventoryManager
pointerPropsManager = 0x0A06B900; // app_PropsManager
Expand Down Expand Up @@ -330,7 +329,7 @@ private bool SelectPointerAddresses(GameVersion version)
private unsafe void GenerateEnemyEntries()
{
bool success;
fixed (int* p = &EnemyTableCount)
fixed (int* p = &gameMemoryValues._enemyTableCount)
success = PointerEnemyEntryList.TryDerefInt(0x1C, p);

PointerEnemyEntries = new MultilevelPointer[MAX_ENTITIES]; // Create a new enemy pointer table array with the detected size.
Expand All @@ -353,7 +352,7 @@ private unsafe void GenerateEnemyEntries()
private unsafe void GenerateItemEntries()
{
bool success;
fixed (int* p = &InventoryTableCount)
fixed (int* p = &gameMemoryValues._playerInventoryCount)
success = PointerInventoryEntryList.TryDerefInt(0x1C, p);

PointerInventoryEntries = new MultilevelPointer[MAX_ITEMS];
Expand Down Expand Up @@ -417,7 +416,7 @@ internal unsafe IGameMemoryRE8 Refresh()
try
{
// Check to see if the pointer is currently valid. It can become invalid when rooms are changed.
if (PointerEnemyEntries[i].Address != IntPtr.Zero && i < EnemyTableCount && SafeReadByteArray(PointerEnemyEntries[i].Address, sizeof(GamePlayerHP), out byte[] enemyHpBytes))
if (PointerEnemyEntries[i].Address != IntPtr.Zero && i < gameMemoryValues.EnemyTableCount && SafeReadByteArray(PointerEnemyEntries[i].Address, sizeof(GamePlayerHP), out byte[] enemyHpBytes))
{
// Note, this is using the same structure as the player HP.
// This may not always be the case, but the structures match for now.
Expand Down Expand Up @@ -449,7 +448,7 @@ internal unsafe IGameMemoryRE8 Refresh()
try
{
// Check to see if the pointer is currently valid. It can become invalid when rooms are changed.
if (PointerInventoryEntries[i].Address != IntPtr.Zero && i < InventoryTableCount && SafeReadByteArray(PointerInventoryEntries[i].Address, sizeof(GameInventoryItem), out byte[] inventoryItemBytes))
if (PointerInventoryEntries[i].Address != IntPtr.Zero && i < gameMemoryValues.PlayerInventoryCount && SafeReadByteArray(PointerInventoryEntries[i].Address, sizeof(GameInventoryItem), out byte[] inventoryItemBytes))
{
var inventoryItem = GameInventoryItem.AsStruct(inventoryItemBytes);

Expand Down
7 changes: 6 additions & 1 deletion SRTPluginProviderRE8/GameVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
public enum GameVersion : int
{
Unknown,

RE8_WW_20210506_1,
RE8_CEROD_20210506_1,
RE8_CEROZ_20210508_1,
RE8_PROMO_01_20210426_1,
RE8_UNK_20210710_1,
RE8_UNK_20210714_1,

RE8_WW_20210719_2,
RE8_CEROD_20210719_2,
RE8_CEROZ_20210719_2,

RE8_WW_20210810_3,
RE8_CEROD_20210810_3,
RE8_CEROZ_20210810_3
RE8_CEROZ_20210810_3,

RE8_WW_20210824_4,
}
}
4 changes: 3 additions & 1 deletion SRTPluginProviderRE8/IGameMemoryRE8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ public interface IGameMemoryRE8
int RankScore { get; set; }
int Rank { get; set; }
int Lei { get; set; }
int PlayerInventoryCount { get; set; }
InventoryEntry[] PlayerInventory { get; set; }
int EnemyTableCount { get; set; }
EnemyHP[] EnemyHealth { get; set; }
InventoryEntry LastKeyItem { get; set; }

}
}
4 changes: 2 additions & 2 deletions SRTPluginProviderRE8/SRTPluginProviderRE8.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<Copyright>Copyright © 2020 Christopher Couture</Copyright>
<Product>Resident Evil 8 (2021) Memory Provider Plugin</Product>
<Description>A provider plugin for the SRT Host to provide memory values to other plugins.</Description>
<Version>1.2.0.0</Version>
<FileVersion>1.2.0.0</FileVersion>
<Version>1.2.0.1</Version>
<FileVersion>1.2.0.1</FileVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<DebugType>embedded</DebugType>
<!-- netcoreapp3.1 had to be hardcoded here because this project reports $(TargetFramework) as netstandard2.0 (rightfully so) and I am not sure how this project's csproj can auto-detect another project's framework version to copy it to the appropriate folder so we're just... hardcoding this. -->
Expand Down
2 changes: 1 addition & 1 deletion SRTPluginProviderRE8/Structs/InventoryEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public string _DebuggerDisplay
else if (IsMap)
return string.Format("Map {0}", (CraftableEnumeration)ItemID);
else if (ItemID > 0)
return string.Format("Uknown Item 0x{0}", ItemID.ToString("X4"));
return string.Format("Unknown Item 0x{0}", ItemID.ToString("X4"));
else
return string.Format("Empty Slot");
}
Expand Down