Skip to content

Commit

Permalink
Fixed demo verification tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Traderain committed Nov 30, 2016
1 parent 3827133 commit cdea01e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
Binary file modified .vs/VolvoWrench/v14/.suo
Binary file not shown.
12 changes: 6 additions & 6 deletions VolvoWrench/Demo stuff/GoldSource/Verification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ public void Verify(string[] files)
mrtb.AppendText("Parsed demos. Results:" + "\n");
mrtb.AppendText("General stats:" + "\n");
mrtb.AppendText($@"
Highest FPS: {(1/Df.Select(x=> x.Value).Max(y => y.GsDemoInfo.AditionalStats.FrametimeMin)).ToString("N2")}
Lowest FPS: {(1/Df.Select(x=> x.Value).Min(y => y.GsDemoInfo.AditionalStats.FrametimeMax)).ToString("N2")}
Average FPS: {(Df.Select(z => z.Value).Average(k => k.GsDemoInfo.AditionalStats.Count) / Df.Select(x=> x.Value).Max(y => y.GsDemoInfo.AditionalStats.FrametimeSum)).ToString("N2")}
Lowest msec: {(1000.0 / Df.Select(x => x.Value).Max(y => y.GsDemoInfo.AditionalStats.MsecMin)).ToString("N2")} FPS
Highest msec: {(1000.0 / Df.Select(x => x.Value).Min(y => y.GsDemoInfo.AditionalStats.MsecMax)).ToString("N2")} FPS
Average msec: {(Df.Select(x => x.Value).Select(y => y.GsDemoInfo.AditionalStats.MsecSum / (double)y.GsDemoInfo.AditionalStats.Count)).Average().ToString("N2")} FPS
Highest FPS: {(1/Df.Select(x=> x.Value).ToList().Min(y => y.GsDemoInfo.AditionalStats.FrametimeMin)).ToString("N2")}
Lowest FPS: {(1/Df.Select(x=> x.Value).ToList().Max(y => y.GsDemoInfo.AditionalStats.FrametimeMax)).ToString("N2")}
Average FPS: {(Df.Select(z => z.Value).ToList().Average(k => k.GsDemoInfo.AditionalStats.Count/k.GsDemoInfo.AditionalStats.FrametimeSum)).ToString("N2")}
Lowest msec: {(1000.0/Df.Select(x => x.Value).ToList().Min(y => y.GsDemoInfo.AditionalStats.MsecMin)).ToString("N2")} FPS
Highest msec: {(1000.0/Df.Select(x => x.Value).ToList().Max(y => y.GsDemoInfo.AditionalStats.MsecMax)).ToString("N2")} FPS
Average msec: {(Df.Select(x => x.Value).ToList().Average(y => y.GsDemoInfo.AditionalStats.MsecSum / (double)y.GsDemoInfo.AditionalStats.Count)).ToString("N2")} FPS
Total time of the demos: {Df.Sum(x => x.Value.GsDemoInfo.DirectoryEntries.Sum(y => y.TrackTime))}s" + "\n\n");
mrtb.AppendText("Demo cheat check:" + "\n");
Expand Down
26 changes: 17 additions & 9 deletions VolvoWrench/Hotkey/hotkey.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Input;
using IniParser;
using IniParser.Parser;

namespace VolvoWrench.Hotkey
{
Expand All @@ -15,9 +18,14 @@ public Hotkey()
{
KeyPreview = true;
InitializeComponent();
label1.Text = @"Demo info popup: " + KeyInterop.KeyFromVirtualKey(Main.DemoPopupKey);
label2.Text = @"Overlay exit: " + KeyInterop.KeyFromVirtualKey(Main.OverLayExitKey);
label3.Text = @"Overlay rescan: " + KeyInterop.KeyFromVirtualKey(Main.OverLayRescanKey);
var _parser = new FileIniDataParser();
var iniD = _parser.ReadFile(Main.SettingsPath);
DemoPopupKey = Convert.ToInt32(iniD["HOTKEYS"]["demo_popup"], 16);
OverLayExitKey = Convert.ToInt32(iniD["HOTKEYS"]["overlay_exit"], 16);
OverLayRescanKey = Convert.ToInt32(iniD["HOTKEYS"]["overlay_rescan"],16);
label1.Text = @"Demo info popup: " + KeyInterop.KeyFromVirtualKey(DemoPopupKey);
label2.Text = @"Overlay exit: " + KeyInterop.KeyFromVirtualKey(OverLayExitKey);
label3.Text = @"Overlay rescan: " + KeyInterop.KeyFromVirtualKey(OverLayRescanKey);
}

private void button1_Click(object sender, EventArgs e)
Expand All @@ -28,17 +36,17 @@ private void button1_Click(object sender, EventArgs e)
private void button3_Click(object sender, EventArgs e)
{
Main.SettingsManager(false);
label1.Text = @"Demo info popup: " + KeyInterop.KeyFromVirtualKey(Main.DemoPopupKey);
label2.Text = @"Overlay exit: " + KeyInterop.KeyFromVirtualKey(Main.OverLayExitKey);
label3.Text = @"Overlay rescan: " + KeyInterop.KeyFromVirtualKey(Main.OverLayRescanKey);
label1.Text = @"Demo info popup: " + KeyInterop.KeyFromVirtualKey(DemoPopupKey);
label2.Text = @"Overlay exit: " + KeyInterop.KeyFromVirtualKey(OverLayExitKey);
label3.Text = @"Overlay rescan: " + KeyInterop.KeyFromVirtualKey(OverLayRescanKey);
}

private void button2_Click(object sender, EventArgs e)
{
Main.SettingsManager(true);
label1.Text = @"Demo info popup: " + KeyInterop.KeyFromVirtualKey(Main.DemoPopupKey);
label2.Text = @"Overlay exit: " + KeyInterop.KeyFromVirtualKey(Main.OverLayExitKey);
label3.Text = @"Overlay rescan: " + KeyInterop.KeyFromVirtualKey(Main.OverLayRescanKey);
label1.Text = @"Demo info popup: " + KeyInterop.KeyFromVirtualKey(DemoPopupKey);
label2.Text = @"Overlay exit: " + KeyInterop.KeyFromVirtualKey(OverLayExitKey);
label3.Text = @"Overlay rescan: " + KeyInterop.KeyFromVirtualKey(OverLayRescanKey);
}

private void button4_Click(object sender, EventArgs e)
Expand Down
20 changes: 13 additions & 7 deletions VolvoWrench/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public sealed partial class Main : Form
public static int DemoPopupKey;
public static int OverLayExitKey;
public static int OverLayRescanKey;


public static Font OverlayFont;
public static Color OverLayColor;
public static Font MainFont;
Expand Down Expand Up @@ -356,7 +358,12 @@ private void launchToolStripMenuItem_Click(object sender, EventArgs e)
{
if (File.Exists(CurrentFile) && Path.GetExtension(CurrentFile) == ".dem" && CurrentFile != null)
using (var a = new OverlayForm(CurrentFile))
{
var str = richTextBox1.Text;
richTextBox1.Text = @"Overlay launched please switch to your game!";
a.ShowDialog();
richTextBox1.Text = str;
}
else
MessageBox.Show(@"No file selected please select one to use the overlay!",
@"Couldn't open overlay!",
Expand Down Expand Up @@ -393,7 +400,7 @@ private void hotkeysToolStripMenuItem_Click_1(object sender, EventArgs e)
}

/// <summary>
/// This is the timer we use for hotkey detectoin
/// This is the timer we use for hotkey detection
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
Expand Down Expand Up @@ -575,7 +582,6 @@ public static void SettingsManager(bool reset)
DemoPopupKey = ToInt32(data["HOTKEYS"]["demo_popup"],16);
OverLayExitKey = ToInt32(data["HOTKEYS"]["overlay_exit"],16);
OverLayRescanKey = ToInt32(data["HOTKEYS"]["overlay_rescan"],16);
OverLayExitKey = ToInt32(data["HOTKEYS"]["overlay_rescan"],16);
OverlayFont = cvt.ConvertFromString(data["SETTINGS"]["overlay_font"]) as Font;
MainFont = cvt.ConvertFromString(data["SETTINGS"]["main_font"]) as Font;
var colorstring = data["SETTINGS"]["overlay_color"].Split(':');
Expand Down Expand Up @@ -697,11 +703,11 @@ public void PrintDemoDetails(CrossParseResult demo)
Frame count: {demo.GsDemoInfo.DirectoryEntries.Sum(x => x.FrameCount)}
Higest FPS: {(1/demo.GsDemoInfo.AditionalStats.FrametimeMin).ToString("N2")}
Lowest FPS: {(1/ demo.GsDemoInfo.AditionalStats.FrametimeMax).ToString("N2")}
Average FPS: {(demo.GsDemoInfo.AditionalStats.Count / demo.GsDemoInfo.AditionalStats.FrametimeSum).ToString("N2")}
Lowest msec: {(1000.0 / demo.GsDemoInfo.AditionalStats.MsecMax).ToString("N2")} FPS
Highest msec: {(1000.0 / demo.GsDemoInfo.AditionalStats.MsecMin).ToString("N2")} FPS
Average msec: {(1000.0 / (demo.GsDemoInfo.AditionalStats.MsecSum / (double)demo.GsDemoInfo.AditionalStats.Count)).ToString("N2")} FPS
Lowest FPS: {(1/demo.GsDemoInfo.AditionalStats.FrametimeMax).ToString("N2")}
Average FPS: {(demo.GsDemoInfo.AditionalStats.Count/demo.GsDemoInfo.AditionalStats.FrametimeSum).ToString("N2")}
Lowest msec: {(1000.0/demo.GsDemoInfo.AditionalStats.MsecMin).ToString("N2")} FPS
Highest msec: {(1000.0/demo.GsDemoInfo.AditionalStats.MsecMax).ToString("N2")} FPS
Average msec: {(1000.0/(demo.GsDemoInfo.AditionalStats.MsecSum/(double)demo.GsDemoInfo.AditionalStats.Count)).ToString("N2")} FPS
----------------------------------------------------------";
}
UpdateForm();
Expand Down

0 comments on commit cdea01e

Please sign in to comment.