Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing JP .exe version for 1.10 #77

Merged
merged 1 commit into from
Jan 5, 2025
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
57 changes: 29 additions & 28 deletions src/SoulMemory/EldenRing/EldenRing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@
break;

default:
case EldenRingVersion.V1_12_0:

Check warning on line 134 in src/SoulMemory/EldenRing/EldenRing.cs

View workflow job for this annotation

GitHub Actions / build

Remove this empty 'case' clause. (https://rules.sonarsource.com/csharp/RSPEC-3458)
case EldenRingVersion.V1_12_3:

Check warning on line 135 in src/SoulMemory/EldenRing/EldenRing.cs

View workflow job for this annotation

GitHub Actions / build

Remove this empty 'case' clause. (https://rules.sonarsource.com/csharp/RSPEC-3458)
case EldenRingVersion.V1_13_0:

Check warning on line 136 in src/SoulMemory/EldenRing/EldenRing.cs

View workflow job for this annotation

GitHub Actions / build

Remove this empty 'case' clause. (https://rules.sonarsource.com/csharp/RSPEC-3458)
case EldenRingVersion.V1_14_0:

Check warning on line 137 in src/SoulMemory/EldenRing/EldenRing.cs

View workflow job for this annotation

GitHub Actions / build

Remove this empty 'case' clause. (https://rules.sonarsource.com/csharp/RSPEC-3458)
case EldenRingVersion.V1_15_0:

Check warning on line 138 in src/SoulMemory/EldenRing/EldenRing.cs

View workflow job for this annotation

GitHub Actions / build

Remove this empty 'case' clause. (https://rules.sonarsource.com/csharp/RSPEC-3458)
case EldenRingVersion.V1_16_0:

Check warning on line 139 in src/SoulMemory/EldenRing/EldenRing.cs

View workflow job for this annotation

GitHub Actions / build

Remove this empty 'case' clause. (https://rules.sonarsource.com/csharp/RSPEC-3458)
_screenStateOffset = 0x730;
_positionOffset = 0x6d4;
_mapIdOffset = 0x6d0;
Expand Down Expand Up @@ -204,34 +204,35 @@

#region version ================================================================================================

private readonly Dictionary<EldenRingVersion, Version> _versions = new Dictionary<EldenRingVersion, Version>()
private readonly List<(EldenRingVersion eldenRingVersion, Version version)> _versions = new List<(EldenRingVersion, Version)>()
{

{ EldenRingVersion.V1_02_0, new Version(1,2,0,0) },
{ EldenRingVersion.V1_02_1, new Version(1,2,1,0) },
{ EldenRingVersion.V1_02_2, new Version(1,2,2,0) },
{ EldenRingVersion.V1_02_3, new Version(1,2,3,0) },
{ EldenRingVersion.V1_03_0, new Version(1,3,0,0) },
{ EldenRingVersion.V1_03_1, new Version(1,3,1,0) },
{ EldenRingVersion.V1_03_2, new Version(1,3,2,0) },
{ EldenRingVersion.V1_04_0, new Version(1,4,0,0) },
{ EldenRingVersion.V1_04_1, new Version(1,4,1,0) },
{ EldenRingVersion.V1_05_0, new Version(1,5,0,0) },
{ EldenRingVersion.V1_06_0, new Version(1,6,0,0) },
{ EldenRingVersion.V1_07_0, new Version(1,7,0,0) },
{ EldenRingVersion.V1_08_0, new Version(1,8,0,0) },
{ EldenRingVersion.V1_08_1, new Version(1,8,1,0) },
{ EldenRingVersion.V1_09_0, new Version(1,9,0,0) },
{ EldenRingVersion.V1_09_1, new Version(1,9,1,0) },
(EldenRingVersion.V1_02_0, new Version(1,2,0,0)),
(EldenRingVersion.V1_02_1, new Version(1,2,1,0)),
(EldenRingVersion.V1_02_2, new Version(1,2,2,0)),
(EldenRingVersion.V1_02_3, new Version(1,2,3,0)),
(EldenRingVersion.V1_03_0, new Version(1,3,0,0)),
(EldenRingVersion.V1_03_1, new Version(1,3,1,0)),
(EldenRingVersion.V1_03_2, new Version(1,3,2,0)),
(EldenRingVersion.V1_04_0, new Version(1,4,0,0)),
(EldenRingVersion.V1_04_1, new Version(1,4,1,0)),
(EldenRingVersion.V1_05_0, new Version(1,5,0,0)),
(EldenRingVersion.V1_06_0, new Version(1,6,0,0)),
(EldenRingVersion.V1_07_0, new Version(1,7,0,0)),
(EldenRingVersion.V1_08_0, new Version(1,8,0,0)),
(EldenRingVersion.V1_08_1, new Version(1,8,1,0)),
(EldenRingVersion.V1_09_0, new Version(1,9,0,0)),
(EldenRingVersion.V1_09_1, new Version(1,9,1,0)),
//1.10 turned into 2.0.0.0 for some reason
{ EldenRingVersion.V1_10_0, new Version(2,0,0,0) },
{ EldenRingVersion.V1_10_1, new Version(2,0,1,0) },
{ EldenRingVersion.V1_12_0, new Version(2,2,0,0) },
{ EldenRingVersion.V1_12_3, new Version(2,2,3,0) },
{ EldenRingVersion.V1_13_0, new Version(2,3,0,0) },
{ EldenRingVersion.V1_14_0, new Version(2,4,0,0) },
{ EldenRingVersion.V1_15_0, new Version(2,5,0,0) },
{ EldenRingVersion.V1_16_0, new Version(2,6,0,0) },
(EldenRingVersion.V1_10_0, new Version(2,0,0,0)),
(EldenRingVersion.V1_10_0, new Version(2,0,0,1)), //JP-only version for 1.10
(EldenRingVersion.V1_10_1, new Version(2,0,1,0)),
(EldenRingVersion.V1_12_0, new Version(2,2,0,0)),
(EldenRingVersion.V1_12_3, new Version(2,2,3,0)),
(EldenRingVersion.V1_13_0, new Version(2,3,0,0)),
(EldenRingVersion.V1_14_0, new Version(2,4,0,0)),
(EldenRingVersion.V1_15_0, new Version(2,5,0,0)),
(EldenRingVersion.V1_16_0, new Version(2,6,0,0)),
};

public enum EldenRingVersion
Expand Down Expand Up @@ -275,13 +276,13 @@

public EldenRingVersion GetVersion(Version v)
{
var version = _versions.FirstOrDefault(i => i.Value.CompareTo(v) == 0);
if (version.Value == null)
var version = _versions.FirstOrDefault(i => i.version.CompareTo(v) == 0);
if (version.version == null)
{
return EldenRingVersion.Unknown;
}

return version.Key;
return version.eldenRingVersion;
}

#endregion
Expand Down Expand Up @@ -425,7 +426,7 @@

#region Read event flag

public bool ReadEventFlag(uint eventFlagId)

Check warning on line 429 in src/SoulMemory/EldenRing/EldenRing.cs

View workflow job for this annotation

GitHub Actions / build

Refactor this method to reduce its Cognitive Complexity from 20 to the 15 allowed. (https://rules.sonarsource.com/csharp/RSPEC-3776)
{
var divisor = _virtualMemoryFlag.ReadInt32(0x1c);
//This check does not exist in the games code; reading 0 here means something isn't initialized yet and we should check this flag again later.
Expand Down
17 changes: 9 additions & 8 deletions src/cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,23 @@ internal class Program
static void Main(string[] args)
{

GameLoop<DarkSouls1>((e) =>
{
var saveSlot = e.GetCurrentSaveSlot();
var pos = e.GetPosition();
var igtElapsed = TimeSpan.FromMilliseconds(e.GetInGameTimeMilliseconds());
Console.WriteLine($"IGT: {igtElapsed} slot: {saveSlot} pos: {pos}");
});

GlobalHotKey.RegisterHotKey(ModifierKeys.Alt, Key.A, () =>{ Debug.WriteLine("A"); });
GlobalHotKey.RegisterHotKey(ModifierKeys.Alt, Key.S, () =>{ Debug.WriteLine("S"); });
GlobalHotKey.RegisterHotKey(ModifierKeys.Alt, Key.D, () =>{ Debug.WriteLine("D"); });

//TestUi();
GameLoop<EldenRing>((e) =>
{
var versionString = e.GetProcess().MainModule?.FileVersionInfo.ProductVersion ?? "Failed to read ER version";
if(!Version.TryParse(versionString, out Version v))
{
Console.WriteLine("Failed to parse version string");
}

Console.WriteLine($"Raw version: {versionString}, ER version: {e.GetVersion(v)}");

var igtElapsed = TimeSpan.FromMilliseconds(e.GetInGameTimeMilliseconds());
e.GetPosition();
Console.WriteLine($"IGT: {igtElapsed}");
});
}
Expand Down
Loading