Skip to content

Commit

Permalink
Removed wait time setting
Browse files Browse the repository at this point in the history
Sorting settings file
  • Loading branch information
Maxx53 committed Nov 30, 2016
1 parent 42c4b5b commit 6b3c999
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 119 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This project uses [Core Audio API](https://github.com/morphx666/CoreAudio).

###Setting Tips

![Settings Window](http://images.illuzor.com/uploads/rs14ncl2.png)
![Settings Window](http://images.illuzor.com/uploads/rs14ncl.png)

* If you have Steam-licensed Rocksmith 2014, check the "Steam game" box, otherwise leave this checkbox and browse game EXE-file by pressing "..." button.
* "Device" сombobox contains all **active** found input audio devices in your system. Select the device connected to your guitar. If your device is not in the list, check the "Manual" box and set VID & PID values manually (find it in "Device manager"). VID & PID sets as "0000" means default non-USB input audio device, for example integrated Realtek microphone input.
Expand Down
5 changes: 4 additions & 1 deletion scr/NoCableLauncher/PortableSettingsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Specialized;
using System.Windows.Forms;
using System.IO;
using System.Linq;

namespace NoCableLauncher
{
Expand Down Expand Up @@ -70,7 +71,9 @@ public override void Initialize(string name, NameValueCollection config)

public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection collection)
{
foreach (SettingsPropertyValue propertyValue in collection)
var sorted = collection.Cast<SettingsPropertyValue>().OrderBy(s => s.Name);

foreach (SettingsPropertyValue propertyValue in sorted)
SetValue(propertyValue);

try
Expand Down
39 changes: 25 additions & 14 deletions scr/NoCableLauncher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,40 @@ private static void StartGame()
}
else
//This do not return game process!
//Steam starts game with some delay
Process.Start(steamName);
}


private static void HookProcess()
{
//Finding game process
Process[] processes = Process.GetProcessesByName(exeName);
//Waiting 60 seconds, while game starts
for (int i = 0; i < 60; i++)
{
Thread.Sleep(1000);

//Finding game process
Process[] processes = Process.GetProcessesByName(exeName);

if (processes.Length == 0)
ExitWithError(string.Format("Can't find process: {0}.exe", exeName));
if (processes.Length > 0)
{
//If game process found

var process = processes[0];
processID = process.Id;
var process = processes[0];
processID = process.Id;

if (settings.Multiplayer)
{
process.EnableRaisingEvents = true;
process.Exited += process_Exited;
gameRunning = true;
if (settings.Multiplayer)
{
process.EnableRaisingEvents = true;
process.Exited += process_Exited;
gameRunning = true;
}

return;
}
}

ExitWithError(string.Format("Can't find process: {0}.exe", exeName));
}

private static void process_Exited(object sender, EventArgs e)
Expand Down Expand Up @@ -226,9 +240,6 @@ public static void Main(string[] args)
//Launching Rocksmith 2014
StartGame();

//Waiting while game starting
Thread.Sleep(settings.waitTime);

//Getting process id and setting exit event
HookProcess();

Expand Down
Loading

0 comments on commit 6b3c999

Please sign in to comment.