// ReSharper restore UnusedParameter.Global #pragma warning restore IDE0060 // Remove unused parameter /// <summary> /// This method is what is hooked onto the D3D9 EndScene Function. /// /// Updates our GameInfo object, Renders our custom overlay, Reports our errors. /// Once our custom logic is done, we call the original EndScene function, and return Ok. /// </summary> /// <param name="device">A pointer to the D3D9 Device of the base executabe.</param> /// <returns>An OK Code.</returns> private int EndSceneHook(IntPtr device) { var dev = (Device)device; var changed = false; try { _lcgolInfo.Update(); if (_lcgolInfo.Level.Current != _lcgolInfo.Level.Old) { changed = true; _server.ReportMessage($"New Level: {_lcgolInfo.Level.Current}"); } if (_lcgolInfo.State.Current != _lcgolInfo.State.Old) { changed = true; _server.ReportMessage($"New State: {_lcgolInfo.State.Current}"); } if (changed) { _server.ReportMessage("End Frame.\n"); } _overlay.Render(_lcgolInfo, dev, _liveSplitHelper); } catch (Exception e) { _server.ReportException(e); } dev.EndScene(); return(Result.Ok.Code); }