Skip to content

Commit

Permalink
Updating for loadless RTA.
Browse files Browse the repository at this point in the history
  • Loading branch information
Grimelios committed Aug 2, 2017
1 parent 26e8999 commit a3c6edd
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 8 deletions.
8 changes: 8 additions & 0 deletions Components/LiveSplit.TheEndIsNigh.Updates.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<updates>
<update version="1.4.1">
<files>
<file path="Components/LiveSplit.TheEndIsNigh.dll" status="changed" />
</files>
<changelog>
<change>Game time now accurately reflects loadless RTA (to account for lag on screen transitions).</change>
</changelog>
</update>
<update version="1.4.0">
<files>
<file path="Components/LiveSplit.TheEndIsNigh.dll" status="changed" />
Expand Down
Binary file modified Components/LiveSplit.TheEndIsNigh.dll
Binary file not shown.
7 changes: 7 additions & 0 deletions LiveSplit.TheEndIsNigh/EndIsNighComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class EndIsNighComponent : IComponent

private int deathCount;

private long startingFrames;

/// <summary>
/// Constructs the component.
/// </summary>
Expand Down Expand Up @@ -251,6 +253,8 @@ public void Autosplit()
{
if (!fileSelected && memory.CheckFileSelect())
{
startingFrames = memory.GetRawFrames();

// Checking for null allows this function to be used in testing (where no timer exists).
timer?.Start();
runStarted = true;
Expand All @@ -272,6 +276,9 @@ public void Autosplit()
}
}

long runFrames = memory.GetRawFrames() - startingFrames;

timer.CurrentState.SetGameTime(TimeSpan.FromSeconds(runFrames / 60f));
splitCollection.Update();
}

Expand Down
2 changes: 1 addition & 1 deletion LiveSplit.TheEndIsNigh/LiveSplit.TheEndIsNigh.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="Reference\AutosplitData.png" />
<Content Include="Reference\Carts.png" />
<Content Include="Resources\Add.png" />
<Content Include="Resources\Delete.png" />
<Content Include="Resources\Down.png" />
<Content Include="Resources\Question.png" />
<Content Include="Resources\Up.png" />
<Content Include="Reference\AutosplitData.jpg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
24 changes: 21 additions & 3 deletions LiveSplit.TheEndIsNigh/Memory/EndIsNighMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,21 @@ public bool HookProcess()
}

/// <summary>
/// Returns the number of frames the game has been running (i.e. in-game frames). This value only updates during gameplay.
/// Returns the number of in-game time (IGT frames). This value only updates during gameplay. It does not update during cutscenes,
/// menus, or during lag on screen transitions.
/// </summary>
public long GetInGameTime()
public long GetIGTFrames()
{
return process.Read<long>(dataPointer, MemoryOffsets.InGameTime);
return process.Read<long>(dataPointer, MemoryOffsets.IGTFrames);
}

/// <summary>
/// Returns the total number of frames the game has been running. As opposed to IGT frames, this value updates every frame, so it
/// can be used to accurately measure loadless RTA (i.e. real-time minus lag on level transitions).
/// </summary>
public long GetRawFrames()
{
return process.Read<long>(dataPointer, MemoryOffsets.RawFrames);
}

/// <summary>
Expand Down Expand Up @@ -89,6 +99,14 @@ public bool CheckFileSelect()
return process.Read<bool>(dataPointer, MemoryOffsets.FileSelect);
}

/// <summary>
/// Checks whether any resources for the game have been modified.
/// </summary>
public bool CheckModdedResources()
{
return process.Read<bool>(dataPointer, MemoryOffsets.ModdedResources);
}

/// <summary>
/// Checks whether the player has collected the given body part.
/// </summary>
Expand Down
14 changes: 12 additions & 2 deletions LiveSplit.TheEndIsNigh/Memory/MemoryOffsets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public static class MemoryOffsets
/// <summary>
/// Offset to in-game time (frame count).
/// </summary>
public const int InGameTime = 0x10;
public const int IGTFrames = 0x10;

/// <summary>
/// Offset to death count.
/// </summary>
public const int DeathCount = InGameTime + 0x8;
public const int DeathCount = IGTFrames + 0x8;

/// <summary>
/// Offset to the player's X coordinate in the world grid.
Expand Down Expand Up @@ -85,5 +85,15 @@ public static class MemoryOffsets
/// Offset to the file-selected flag.
/// </summary>
public const int FileSelect = BeatEnd2 + 0x1;

/// <summary>
/// Offset to the modded-resources flag.
/// </summary>
public const int ModdedResources = FileSelect + 0x1;

/// <summary>
/// Offset to the count of raw app frames (used to properly compute loadless RTA).
/// </summary>
public const int RawFrames = ModdedResources + 0x3;
}
}
4 changes: 2 additions & 2 deletions LiveSplit.TheEndIsNigh/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,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.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]
Binary file removed LiveSplit.TheEndIsNigh/Reference/AutosplitData.jpg
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a3c6edd

Please sign in to comment.