Skip to content

Commit

Permalink
1.0.2.0: 20230921 game update. Resolves #5. (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Squirrelies authored Sep 29, 2023
1 parent a86947f commit 6b76885
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
7 changes: 4 additions & 3 deletions SRTPluginProviderRE4R/GameHashes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ namespace SRTPluginProviderRE4R
/// </summary>
public static class GameHashes
{
private static readonly byte[] re4rWW_11025382 = new byte[32] { 0x3E, 0xC3, 0x90, 0x1D, 0xD4, 0xF7, 0x0C, 0x7E, 0x03, 0xDB, 0xE3, 0x13, 0xA4, 0x7A, 0xDB, 0xC1, 0x10, 0x94, 0xD9, 0xAE, 0x34, 0xB6, 0xF3, 0x5E, 0xF9, 0xA0, 0x8C, 0x4F, 0x57, 0x32, 0x6D, 0x1E };
private static readonly byte[] re4rWW_20230921_1 = new byte[32] { 0x95, 0xA1, 0x03, 0xE6, 0xA4, 0xAF, 0xA5, 0xD6, 0x53, 0x01, 0xE8, 0x84, 0x1D, 0x8B, 0x2B, 0x0D, 0x87, 0x26, 0x5B, 0x01, 0xBE, 0x96, 0x7F, 0x4C, 0xC2, 0x80, 0x41, 0xC2, 0xF6, 0xEE, 0xE1, 0xE9 };
private static readonly byte[] re4rWW_20230424_1 = new byte[32] { 0x3E, 0xC3, 0x90, 0x1D, 0xD4, 0xF7, 0x0C, 0x7E, 0x03, 0xDB, 0xE3, 0x13, 0xA4, 0x7A, 0xDB, 0xC1, 0x10, 0x94, 0xD9, 0xAE, 0x34, 0xB6, 0xF3, 0x5E, 0xF9, 0xA0, 0x8C, 0x4F, 0x57, 0x32, 0x6D, 0x1E };
private static readonly byte[] re4rWW_20230407_1 = new byte[32] { 0x7A, 0x0A, 0x58, 0xB6, 0x00, 0x35, 0xCF, 0xBB, 0x73, 0xDD, 0x4F, 0x22, 0x16, 0x38, 0xD2, 0x6E, 0x50, 0xC8, 0xBF, 0xE6, 0xFC, 0x68, 0x77, 0x6B, 0x1F, 0x05, 0x1F, 0x33, 0x4A, 0x10, 0x00, 0x5C };
private static readonly byte[] re4rWW_20230323_1 = new byte[32] { 0x3C, 0x81, 0x07, 0xE9, 0x35, 0x2D, 0x0C, 0x4F, 0x39, 0x3D, 0x37, 0x50, 0xF0, 0xAC, 0x86, 0x62, 0x39, 0x1D, 0x52, 0x55, 0x9E, 0x94, 0xB5, 0x86, 0x73, 0x70, 0x50, 0xE0, 0xC5, 0x5E, 0xC3, 0x18 };
private static readonly byte[] re4rDEMO_20230309_1 = new byte[32] { 0xBA, 0x9D, 0xC7, 0x4A, 0xC8, 0x52, 0x30, 0x62, 0x12, 0xB2, 0xDD, 0x17, 0x93, 0xA8, 0xB6, 0xFD, 0x09, 0x2A, 0x62, 0xD5, 0x03, 0xFC, 0x87, 0x30, 0x59, 0xD2, 0x62, 0x50, 0xAE, 0x73, 0x0E, 0xAC };
Expand Down Expand Up @@ -50,8 +51,8 @@ public static GameVersion DetectVersion(string filePath)
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete))
checksum = hashFunc.ComputeHash(fs);

if (checksum.SequenceEqual(re4rWW_11025382))
return GameVersion.RE4R_WW_11025382;
if (checksum.SequenceEqual(re4rWW_20230921_1))
return GameVersion.RE4R_WW_20230921_1;
else if (checksum.SequenceEqual(re4rWW_20230407_1))
return GameVersion.RE4R_WW_20230407_1;
else if (checksum.SequenceEqual(re4rWW_20230323_1))
Expand Down
32 changes: 21 additions & 11 deletions SRTPluginProviderRE4R/GameMemoryRE4RScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,23 @@ internal unsafe void Initialize(Process process)

private GameVersion SelectPointerAddresses(GameVersion version)
{
Console.WriteLine($"Version: {version}");

switch (version)
{
case GameVersion.RE4R_WW_11025382:
case GameVersion.RE4R_WW_20230921_1:
{
pointerAddressCharacterManager = 0x0DBC2900;
pointerAddressGameStatsManager = 0x0DBBDA10;
pointerAddressGameRankManager = 0x0DBC2A00;
pointerAddressGameClock = 0x0DBC53A0;
pointerAddressInventoryManager = 0x0DBC2AD0;
pointerAddressInGameShopManager = 0x0DBC2AB8;
pointerAddressHighwayGuiManager = 0x0DBC2AA0;
pointerAddressCampaignManager = 0x0DBC2848;
break;
}
case GameVersion.RE4R_WW_20230424_1:
{
pointerAddressCharacterManager = 0x0D261E60;
pointerAddressGameStatsManager = 0x0D2603F0;
Expand All @@ -114,8 +128,7 @@ private GameVersion SelectPointerAddresses(GameVersion version)
pointerAddressInGameShopManager = 0x0D249D18;
pointerAddressHighwayGuiManager = 0x0D260470;
pointerAddressCampaignManager = 0x0D259508;
Console.WriteLine("Version: RE4R_WW_11025382");
return GameVersion.RE4R_WW_11025382;
break;
}
case GameVersion.RE4R_WW_20230407_1:
{
Expand All @@ -127,20 +140,17 @@ private GameVersion SelectPointerAddresses(GameVersion version)
pointerAddressInGameShopManager = 0x0D21A0D8;
pointerAddressHighwayGuiManager = 0x0D22B240;
pointerAddressCampaignManager = 0x0D23DCE0;
Console.WriteLine("Version: RE4R_WW_20230407_1");
return GameVersion.RE4R_WW_20230407_1;
break;
}

case GameVersion.RE4R_WW_20230323_1:
{
Console.WriteLine("Version: RE4R_WW_20230323_1 - No longer supported due to structure changes.");
return GameVersion.RE4R_WW_20230323_1; // No longer supported due to structure changes.
Console.WriteLine("Version no longer supported due to structure changes.");
break; // No longer supported due to structure changes.
}
}

// If we made it this far... rest in pepperonis. We have failed to detect any of the correct versions we support and have no idea what pointer addresses to use. Bail out.
Console.WriteLine("Version: Unknown");
return GameVersion.Unknown;
return version;
}

internal void UpdatePointers()
Expand Down Expand Up @@ -326,7 +336,7 @@ internal unsafe IGameMemoryRE4R Refresh()
{
gameMemoryValues._isInGameShopOpen = PointerInGameShopManager.DerefInt(0x50) != 0;
gameMemoryValues._chapterId = PointerCampaignManager.DerefInt(0x30);
gameMemoryValues._lastItem = PointerLastItem.DerefInt(gv == GameVersion.RE4R_WW_11025382 ? 0xF0 : 0xE8);
gameMemoryValues._lastItem = PointerLastItem.DerefInt(gv == GameVersion.RE4R_WW_20230424_1 ? 0xF0 : 0xE8);
gameMemoryValues._spinel = PointerSpinel.DerefInt(0x20);
UpdatePlayerContext();
UpdateInventoryManager();
Expand Down
3 changes: 2 additions & 1 deletion SRTPluginProviderRE4R/GameVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public enum GameVersion : int
RE4R_Demo_20230309_1,
RE4R_WW_20230323_1,
RE4R_WW_20230407_1,
RE4R_WW_11025382,
RE4R_WW_20230424_1,
RE4R_WW_20230921_1,
}
}
4 changes: 2 additions & 2 deletions SRTPluginProviderRE4R/SRTPluginProviderRE4R.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<Copyright>Copyright © 2023 $(Authors)</Copyright>
<Product>Resident Evil 4 (2023) Memory Producer Plugin</Product>
<Description>A producer plugin for the SRT Host to provide memory values to other plugins.</Description>
<Version>1.0.1.7</Version>
<FileVersion>1.0.1.7</FileVersion>
<Version>1.0.2.0</Version>
<FileVersion>1.0.2.0</FileVersion>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<DebugType>embedded</DebugType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down

0 comments on commit 6b76885

Please sign in to comment.