Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Robinson committed Nov 2, 2014
2 parents 160c821 + dd05ef1 commit 899e7ee
Show file tree
Hide file tree
Showing 9 changed files with 4,746 additions and 463 deletions.
Binary file modified Components/LiveSplit.Skyrim.dll
Binary file not shown.
16 changes: 16 additions & 0 deletions Components/update.LiveSplit.Skyrim.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
<updates>
<update version="2.0.0">
<files>
<file path="Components/LiveSplit.Skyrim.dll" status="changed"/>
</files>
<changelog>
<change>
Added autosplits for every split in any%.
</change>
<change>
Removed the Alternate Timing layout component. It's now its own component and works for all games.
</change>
<change>
Redesigned settings.
</change>
</changelog>
</update>
<update version="1.4.2">
<files>
<file path="Components/LiveSplit.Skyrim.dll" status="changed"/>
Expand Down
480 changes: 408 additions & 72 deletions GameMemory.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// 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.2.0")]
[assembly: AssemblyFileVersion("1.4.2.0")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]

[assembly: ComponentFactory(typeof(SkyrimFactory))]
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
LiveSplit.Skyrim v1.4.2
=======================
LiveSplit.Skyrim v2.0
=====================

LiveSplit.Skyrim is a [LiveSplit](http://livesplit.org/) component for The Elder Scrolls V: Skyrim.

Features
--------
* Keeps track of Game Time to get rid of loading times.
* Auto start/stop/reset the timer.
* Splits when you finish Helgen and default Alduin 2. (configurable)
* Splits when you finish each split in Any%. (configurable)
# Splits when you finish each guild. (configurable)

Install
Expand All @@ -16,17 +16,21 @@ Starting with LiveSplit 1.4, you can download and install LiveSplit.Skyrim autom

If the plugin is not working with this process, download the plugin from the [releases page](https://github.com/drtchops/LiveSplit.Skyrim/releases) and place the LiveSplit.Skyrim.dll in your Components directory of LiveSplit.

Upgrade
-------
You may have issues when upgrading from a version prior to 2.0. Try deactiving the autosplitter from the splits editor, removing it from the layout editor, and restarting LiveSplit before upgrading. If the problem persists, delete the LiveSplit.Skyrim.dll from your Components folder and try again.

Configure
---------
Due to bugs in LiveSplit 1.4.0, it's recommended to deactivate LiveSplit.Skyrim in the Splits Editor after activating (downloading) it the first time. Instead, you should activate it in the Layout Editor, under the "Control" category. Double-click "Skyrim" after adding it to your layout to bring up the settings.
Open your Splits Editor and active the autosplitter. If this is not working, leave it deactivated and manually add it in the Layout Editor. You can configure the settings in whichever editor it has been enabled in.

After configuring everything you'll most likely want to turn on game time as primary timing, so that your splits will run off game time. You can do this by right-clicking LiveSplit and going to Compare Against->Game Time.
After configuring everything you'll most likely want to turn on game time as primary timing, so that your splits will run off game time. You can do this by right-clicking LiveSplit and going to Compare Against -> Game Time.

#### Auto Split
The default settings are to automatically reset, start, and end the splits (the first and last splits). You can enable Helgen and guild autosplitting here.
The default settings are to automatically reset, start, and end the splits (the first and last splits). You can enable individual splits here.

#### Alternate Timing Method
This makes it show Real Time when comparing against Game Time, and vice versa. Doesn't work when LiveSplit.Skyrim is activated via the Splits Editor.
If you wish to show Real Time on your layout, download AlternateTimingMethod from the [LiveSplit Components page](http://livesplit.org/components/) or its own [Github page](https://github.com/Dalet/LiveSplit.AlternateTimingMethod/releases).

Change Log
----------
Expand Down
120 changes: 37 additions & 83 deletions SkyrimComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@

namespace LiveSplit.Skyrim
{
class SkyrimComponent : IComponent
class SkyrimComponent : LogicComponent
{
public string ComponentName
public override string ComponentName
{
get { return "Skyrim"; }
}

public IDictionary<string, Action> ContextMenuControls { get; protected set; }
protected InfoTimeComponent InternalComponent { get; set; }
public SkyrimSettings Settings { get; set; }

public bool Disposed { get; private set; }
Expand All @@ -28,88 +26,42 @@ public string ComponentName
private TimerModel _timer;
private GameMemory _gameMemory;
private LiveSplitState _state;
private GraphicsCache _cache;

public SkyrimComponent(LiveSplitState state, bool isLayoutComponent)
{
_state = state;
this.IsLayoutComponent = isLayoutComponent;

this.Settings = new SkyrimSettings();
this.ContextMenuControls = new Dictionary<String, Action>();
this.InternalComponent = new InfoTimeComponent(null, null, new RegularTimeFormatter(TimeAccuracy.Hundredths));

_cache = new GraphicsCache();
_timer = new TimerModel { CurrentState = state };
_timer = new TimerModel { CurrentState = state };

_gameMemory = new GameMemory();
_gameMemory = new GameMemory(this.Settings);
_gameMemory.OnFirstLevelLoading += gameMemory_OnFirstLevelLoading;
_gameMemory.OnPlayerGainedControl += gameMemory_OnPlayerGainedControl;
_gameMemory.OnLoadStarted += gameMemory_OnLoadStarted;
_gameMemory.OnLoadFinished += gameMemory_OnLoadFinished;
// _gameMemory.OnLoadScreenStarted += gameMemory_OnLoadScreenStarted;
// _gameMemory.OnLoadScreenFinished += gameMemory_OnLoadScreenFinished;
_gameMemory.OnSplitCompleted += gameMemory_OnSplitCompleted;
state.OnReset += state_OnReset;
state.OnStart += State_OnStart;
_gameMemory.StartMonitoring();
}

public void Dispose()
public override void Dispose()
{
this.Disposed = true;

_state.OnReset -= state_OnReset;
_state.OnStart -= State_OnStart;

if (_gameMemory != null)
{
_gameMemory.Stop();
}
}

void state_OnReset(object sender, TimerPhase e)
{
_gameMemory.resetSplitStates();
}

public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
{
if (!this.Settings.DrawWithoutLoads)
{
return;
}

this.InternalComponent.TimeValue =
state.CurrentTime[state.CurrentTimingMethod == TimingMethod.GameTime
? TimingMethod.RealTime : TimingMethod.GameTime];
this.InternalComponent.InformationName = state.CurrentTimingMethod == TimingMethod.GameTime
? "Real Time" : "Without Loads";

_cache.Restart();
_cache["TimeValue"] = this.InternalComponent.ValueLabel.Text;
_cache["TimingMethod"] = state.CurrentTimingMethod;
if (invalidator != null && _cache.HasChanged)
{
invalidator.Invalidate(0f, 0f, width, height);
}
}

public void DrawVertical(Graphics g, LiveSplitState state, float width, Region region)
void State_OnStart(object sender, EventArgs e)
{
this.PrepareDraw(state);
this.InternalComponent.DrawVertical(g, state, width, region);
}

public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region region)
{
this.PrepareDraw(state);
this.InternalComponent.DrawHorizontal(g, state, height, region);
}

void PrepareDraw(LiveSplitState state)
{
this.InternalComponent.NameLabel.ForeColor = state.LayoutSettings.TextColor;
this.InternalComponent.ValueLabel.ForeColor = state.LayoutSettings.TextColor;
this.InternalComponent.NameLabel.HasShadow = this.InternalComponent.ValueLabel.HasShadow = state.LayoutSettings.DropShadows;
_gameMemory.resetSplitStates();
}

void gameMemory_OnFirstLevelLoading(object sender, EventArgs e)
Expand Down Expand Up @@ -138,55 +90,57 @@ void gameMemory_OnLoadFinished(object sender, EventArgs e)
_state.IsGameTimePaused = false;
}

// void gameMemory_OnLoadScreenStarted(object sender, EventArgs e)
// {
// // Nothing to do
// }

// void gameMemory_OnLoadScreenFinished(object sender, EventArgs e)
// {
// // Nothing to do
// }

void gameMemory_OnSplitCompleted(object sender, GameMemory.SplitArea split, uint frame)
{
Trace.WriteLineIf(split != GameMemory.SplitArea.None, String.Format("[NoLoads] {0} Split - {1}", split, frame));
if (!_gameMemory.splitStates[(int)split] &&
Debug.WriteLineIf(split != GameMemory.SplitArea.None, String.Format("[NoLoads] Trying to split {0} with {1} template, State: {2} - {3}", split, this.Settings.AnyPercentTemplate, _gameMemory.splitStates[(int)split], frame));
if (_state.CurrentPhase == TimerPhase.Running && !_gameMemory.splitStates[(int)split] &&
((split == GameMemory.SplitArea.Helgen && this.Settings.Helgen) ||
(split == GameMemory.SplitArea.DarkBrotherhoodQuestlineCompleted && this.Settings.DarkBrotherhood) ||
(split == GameMemory.SplitArea.Whiterun && this.Settings.Whiterun) ||
(split == GameMemory.SplitArea.ThalmorEmbassy && this.Settings.ThalmorEmbassy) ||
(split == GameMemory.SplitArea.Esbern && this.Settings.Esbern) ||
(split == GameMemory.SplitArea.Riverwood && this.Settings.Riverwood) ||
(split == GameMemory.SplitArea.TheWall && this.Settings.TheWall) ||
(split == GameMemory.SplitArea.Septimus && this.Settings.Septimus) ||
(split == GameMemory.SplitArea.MzarkTower && this.Settings.MzarkTower) ||
(split == GameMemory.SplitArea.ClearSky && this.Settings.ClearSky) ||
(split == GameMemory.SplitArea.HorseClimb && this.Settings.HorseClimb) ||
(split == GameMemory.SplitArea.CutsceneEnd && this.Settings.CutsceneEnd) ||
(split == GameMemory.SplitArea.CutsceneStart && this.Settings.CutsceneStart) ||
(split == GameMemory.SplitArea.Alduin1 && this.Settings.Alduin1) ||
(split == GameMemory.SplitArea.HighHrothgar && this.Settings.HighHrothgar) ||
(split == GameMemory.SplitArea.Solitude && this.Settings.Solitude) ||
(split == GameMemory.SplitArea.Windhelm && this.Settings.Windhelm) ||
(split == GameMemory.SplitArea.Council && this.Settings.Council) ||
(split == GameMemory.SplitArea.Odahviing && this.Settings.Odahviing) ||
(split == GameMemory.SplitArea.EnterSovngarde && this.Settings.EnterSovngarde) ||
(split == GameMemory.SplitArea.CollegeOfWinterholdQuestlineCompleted && this.Settings.CollegeOfWinterhold) ||
(split == GameMemory.SplitArea.CompanionsQuestlineCompleted && this.Settings.Companions) ||
(split == GameMemory.SplitArea.CollegeQuestlineCompleted && this.Settings.CollegeOfWinterhold) ||
(split == GameMemory.SplitArea.DarkBrotherhoodQuestlineCompleted && this.Settings.DarkBrotherhood) ||
(split == GameMemory.SplitArea.ThievesGuildQuestlineCompleted && this.Settings.ThievesGuild) ||
(split == GameMemory.SplitArea.AlduinDefeated && this.Settings.AlduinDefeated)))
{
Trace.WriteLine(String.Format("[NoLoads] {0} Split with {2} template - {1}", split, frame, this.Settings.AnyPercentTemplate));
_timer.Split();
_gameMemory.splitStates[(int)split] = true;
}
}

public XmlNode GetSettings(XmlDocument document)
public override XmlNode GetSettings(XmlDocument document)
{
return this.Settings.GetSettings(document);
}

public Control GetSettingsControl(LayoutMode mode)
public override Control GetSettingsControl(LayoutMode mode)
{
return this.Settings;
}

public void SetSettings(XmlNode settings)
public override void SetSettings(XmlNode settings)
{
this.Settings.SetSettings(settings);
}

public float VerticalHeight { get { return this.Settings.DrawWithoutLoads ? this.InternalComponent.VerticalHeight : 0; } }
public float HorizontalWidth { get { return this.Settings.DrawWithoutLoads ? this.InternalComponent.HorizontalWidth : 0; } }
public float MinimumWidth { get { return this.InternalComponent.MinimumWidth; } }
public float MinimumHeight { get { return this.InternalComponent.MinimumHeight; } }
public float PaddingLeft { get { return this.Settings.DrawWithoutLoads ? this.InternalComponent.PaddingLeft : 0; } }
public float PaddingRight { get { return this.Settings.DrawWithoutLoads ? this.InternalComponent.PaddingRight : 0; } }
public float PaddingTop { get { return this.Settings.DrawWithoutLoads ? this.InternalComponent.PaddingTop : 0; } }
public float PaddingBottom { get { return this.Settings.DrawWithoutLoads ? this.InternalComponent.PaddingBottom : 0; } }
public void RenameComparison(string oldName, string newName) { }
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { }
public override void RenameComparison(string oldName, string newName) { }
}
}
Loading

0 comments on commit 899e7ee

Please sign in to comment.