using System; using System.IO; using System.Diagnostics; using System.Windows.Forms; using Nanook.QueenBee.Parser; using static IniFile; using System.Net; using Ionic.Zip; using System.Runtime.InteropServices; using System.Threading; using FastGH3; namespace FastGH3 { class Program { [DllImport("USER32.DLL")] public static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("USER32.DLL", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); private static string currentchart; private static string chart; private static string guitar_audio; private static string rhythm_audio; private static string song_audio; private static string[] chartiniexpert; private static bool vsync; private static int maxnotes; private static uint pushinteger; private static int notecolor; private static string[] parameters; private static OpenFileDialog openchart = new OpenFileDialog() { AddExtension = true, CheckFileExists = true, CheckPathExists = true, Filter = "All chart types|*.mid;*.chart|FastGH3 Song Package|*.fsp;*.zip|Any type|*.*", RestoreDirectory = true, Title = "Select chart" }; private static IniFile chartini = new IniFile(); static string Reverse(string s) { char[] charArray = s.ToCharArray(); Array.Reverse(charArray); return new string(charArray); } static void disallowGameStartup() { try { foreach (Process proc in Process.GetProcessesByName("GH3")) { proc.Kill(); } foreach (Process proc2 in Process.GetProcessesByName("DxWnd")) { proc2.Kill(); } } catch (Exception ex) { Console.Write("ERROR! :(\n" + ex.Message); } } public static void MergeNotes(QbItemInteger array) { #region ENTIRE CODE FOR NOTE MERGING // THIS TOOK SO LONG TO MAKE!!! D:< try { for (int i = 0; i < array.Values.Length; i += 3) { #region Merge 2 Notes if (array.Values[i] == array.Values[i + 3] && array.Values[i + 6] != array.Values[i] && i < array.Length - 6) { if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2) { array.Values[i + 2] = 3; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 4) { array.Values[i + 2] = 5; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 8) { array.Values[i + 2] = 9; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 16) { array.Values[i + 2] = 17; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } if (array.Values[i + 2] == 2 && array.Values[i + 5] == 4) { array.Values[i + 2] = 6; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } if (array.Values[i + 2] == 2 && array.Values[i + 5] == 8) { array.Values[i + 2] = 10; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } if (array.Values[i + 2] == 2 && array.Values[i + 5] == 16) { array.Values[i + 2] = 18; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } if (array.Values[i + 2] == 4 && array.Values[i + 5] == 8) { array.Values[i + 2] = 12; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } if (array.Values[i + 2] == 4 && array.Values[i + 5] == 16) { array.Values[i + 2] = 20; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } if (array.Values[i + 2] == 8 && array.Values[i + 5] == 16) { array.Values[i + 2] = 24; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; } } #endregion #region Merge 3 Notes if (array.Values[i] == array.Values[i + 3] && array.Values[i + 3] == array.Values[i + 6] && array.Values[i + 6] == array.Values[i] && array.Values[i + 9] != array.Values[i] && i < array.Length - 9) { if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 4) { array.Values[i + 2] = 7; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 8) { array.Values[i + 2] = 11; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 4 && array.Values[i + 8] == 8) { array.Values[i + 2] = 13; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } if (array.Values[i + 2] == 2 && array.Values[i + 5] == 4 && array.Values[i + 8] == 8) { array.Values[i + 2] = 14; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 16) { array.Values[i + 2] = 19; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 4 && array.Values[i + 8] == 16) { array.Values[i + 2] = 21; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } if (array.Values[i + 2] == 2 && array.Values[i + 5] == 4 && array.Values[i + 8] == 16) { array.Values[i + 2] = 22; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 8 && array.Values[i + 8] == 16) { array.Values[i + 2] = 25; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } if (array.Values[i + 2] == 2 && array.Values[i + 5] == 8 && array.Values[i + 8] == 16) { array.Values[i + 2] = 26; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } if (array.Values[i + 2] == 4 && array.Values[i + 5] == 8 && array.Values[i + 8] == 16) { array.Values[i + 2] = 28; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; } } #endregion #region Merge 4 Notes if (array.Values[i] == array.Values[i + 3] && array.Values[i + 3] == array.Values[i + 6] && array.Values[i + 6] == array.Values[i] && array.Values[i + 9] == array.Values[i] && array.Values[i + 12] != array.Values[i] && i < array.Length - 12) { if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 4 && array.Values[i + 11] == 8) { array.Values[i + 2] = 15; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; array.Values[i + 9] = -1000; array.Values[i + 10] = 0; array.Values[i + 11] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 4 && array.Values[i + 11] == 16) { array.Values[i + 2] = 23; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; array.Values[i + 9] = -1000; array.Values[i + 10] = 0; array.Values[i + 11] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 8 && array.Values[i + 11] == 16) { array.Values[i + 2] = 27; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; array.Values[i + 9] = -1000; array.Values[i + 10] = 0; array.Values[i + 11] = 0; } if (array.Values[i + 2] == 1 && array.Values[i + 5] == 4 && array.Values[i + 8] == 8 && array.Values[i + 11] == 16) { array.Values[i + 2] = 29; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; array.Values[i + 9] = -1000; array.Values[i + 10] = 0; array.Values[i + 11] = 0; } if (array.Values[i + 2] == 2 && array.Values[i + 5] == 4 && array.Values[i + 8] == 8 && array.Values[i + 11] == 16) { array.Values[i + 2] = 30; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; array.Values[i + 9] = -1000; array.Values[i + 10] = 0; array.Values[i + 11] = 0; } } #endregion #region Merge 5 Notes if (array.Values[i] == array.Values[i + 3] && array.Values[i + 3] == array.Values[i + 6] && array.Values[i + 6] == array.Values[i] && array.Values[i + 9] == array.Values[i] && array.Values[i + 12] == array.Values[i] && i < array.Length - 15) { if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 4 && array.Values[i + 11] == 8 && array.Values[i + 14] == 16) { array.Values[i + 2] = 31; array.Values[i + 3] = -1000; array.Values[i + 4] = 0; array.Values[i + 5] = 0; array.Values[i + 6] = -1000; array.Values[i + 7] = 0; array.Values[i + 8] = 0; array.Values[i + 9] = -1000; array.Values[i + 10] = 0; array.Values[i + 11] = 0; array.Values[i + 12] = -1000; array.Values[i + 13] = 0; array.Values[i + 14] = 0; } } #endregion #region Print note info for debugging Console.Write("\r\nTime: " + array.Values[i] + " Length: " + array.Values[i + 1] + "\tFrets: " + array.Values[i + 2] + "(" + Reverse(Convert.ToString(array.Values[i + 2], 2)) + ")"); #endregion } } catch { } #endregion } [STAThread] static void Main(string[] args) { Console.Title = "FastGH3"; Console.CursorVisible = false; Console.WindowWidth = 41; Console.WindowHeight = 19; Console.BufferWidth = 41; Console.BufferHeight = short.MaxValue - 1; parameters = Environment.GetCommandLineArgs(); if (args.Length == 0) { if (File.Exists(@"C:\Windows\fastgh3\CONFIGS\startupmsg")) { if (File.ReadAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg").ToString() == "on") { Console.CursorVisible = false; Console.WriteLine(@" FastGH3 is an advanced mod of Guitar Hero 3 designed to be played as fast as possible. With this mod, you can play customs without any technical setup and even associate chart or mid files with the game so you can access your charts quickly. To access settings, use -settings in parameters. If you want to disable this welcome message, you can do so by using these parameters: -startupmsg off Press any key to load a chart."); Console.ReadKey(); } } else { Directory.CreateDirectory(@"C:\Windows\fastgh3\CONFIGS\"); File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "on"); } if (openchart.ShowDialog() == DialogResult.OK) { Process.Start("C:\\Windows\\FastGH3\\FastGH3.exe", SubstringExtensions.EncloseWithQuoteMarks(openchart.FileName)); } } try { if (parameters.Length > 0) { if (parameters[1] == "-startupmsg" && parameters[2] == "off") { File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "off"); } if (parameters[1] == "-startupmsg" && parameters[2] == "on") { File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "on"); } if (parameters[1] == "-settings") { Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled; new settings().ShowDialog(); } if (parameters[1] == "dl" && (parameters[2] != "" || parameters[2] != null)) { Console.WriteLine("FastGH3 by donnaken15"); Console.WriteLine("Downloading song package..."); WebClient fsp = new WebClient(); Uri fsplink = new Uri(parameters[2].Replace("fastgh3://", "http://")); try { fsp.DownloadFile(fsplink, "C:\\Windows\\FastGH3\\DATA\\TEMP\\DOWNLOAD.FSP"); } catch (Exception ex) { Console.Write("ERROR! :(\n" + ex.Message); } Console.WriteLine("Adding song to game."); using (ZipFile file = ZipFile.Read(@"C:\Windows\FastGH3\DATA\TEMP\DOWNLOAD.FSP")) { file.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently; foreach (ZipEntry data in file) { if (data.FileName.Contains(".pak")) { data.Extract("C:\\Windows\\FastGH3\\DATA\\SONGS\\"); File.Delete("C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen"); File.Move("C:\\Windows\\FastGH3\\DATA\\SONGS\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen"); } if (data.FileName.Contains(".fsb")) { data.Extract("C:\\Windows\\FastGH3\\DATA\\MUSIC\\"); File.Delete("C:\\Windows\\FastGH3\\DATA\\MUSIC\\fastgh3.fsb.xen"); File.Move("C:\\Windows\\FastGH3\\DATA\\MUSIC\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\MUSIC\\fastgh3.fsb.xen"); } } } Console.WriteLine("Speeding up."); Process dxwnd = new Process(); dxwnd.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe"; dxwnd.StartInfo.Arguments = "/q"; dxwnd.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED\\"; dxwnd.StartInfo.CreateNoWindow = false; dxwnd.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; dxwnd.Start(); Process gh3 = new Process(); if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True") { gh3.StartInfo.FileName = "C:\\Program Files\\3da\\3DAnalyze.exe"; gh3.StartInfo.Arguments = "/EXE=C:\\Windows\\FastGH3\\gh3.exe"; } else { gh3.StartInfo.FileName = "C:\\Windows\\FastGH3\\gh3.exe"; gh3.StartInfo.Arguments = ""; } gh3.Start(); gh3.WaitForInputIdle(); if (gh3.StartInfo.FileName == "C:\\Program Files\\3da\\3DAnalyze.exe") { Thread.Sleep(2500); gh3.Kill(); } } if (File.Exists(parameters[1])) { Console.WriteLine("FASTGH3 by donnaken15"); if (Path.GetFileName(parameters[1]).Contains(".chart") || Path.GetFileName(parameters[1]).Contains(".mid")) { Process chart2mid = new Process(); Console.WriteLine("Checking file extension..."); File.Delete("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid"); if (Path.GetFileName(parameters[1]).Contains(".chart")) { Console.WriteLine("Detected chart file. "); File.Copy(parameters[1], "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart", true); } else if (Path.GetFileName(parameters[1]).Contains(".mid")) { Console.WriteLine("Detected midi file."); File.Copy(parameters[1], "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid", true); } try { File.Move("C:\\Windows\\FastGH3\\FastGH3.exe.bak", "C:\\Windows\\FastGH3\\FastGH3.exe"); } catch { } chartini.Load("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart"); Thread.Sleep(100); File.Delete("C:\\Windows\\FastGH3\\DATA\\TEMP\\MUSIC\\fastgh3.fsb.xen"); File.Delete("C:\\Windows\\FastGH3\\DATA\\TEMP\\MUSIC\\fastgh3.dat.xen"); File.Delete("C:\\Windows\\FastGH3\\DATA\\TEMP\\SONGS\\fastgh3_song.pak.xen"); Process sox = new Process(); sox.StartInfo.FileName = "C:\\Windows\\FastGH3\\sox.exe"; if (File.Exists(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "song.ogg"))) { try { sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "song.ogg") + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg rate 44.1k"; if (File.Exists(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "guitar.ogg"))) { sox.Start(); sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "song.ogg").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\guitar.ogg rate 44.1k"; if (File.Exists(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "rhythm.ogg"))) { sox.Start(); sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "rhythm.ogg").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\rhythm.ogg rate 44.1k"; } } } catch { } } else if (Path.GetFileName(parameters[1]).Contains(".chart")) { try { if (chart.Contains("GuitarStream = \"")) { try { sox.StartInfo.Arguments = SubstringExtensions.EncloseWithQuoteMarks(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), chartini.GetSection("Song").GetKey("GuitarStream").Value.Replace(" \"", "").Replace("\"", ""))) + @" C:\Windows\FastGH3\DATA\MUSIC\audio\guitar.ogg rate 44.1k"; sox.Start(); } catch { } } if (chart.Contains("BassStream = \"")) { try { sox.StartInfo.Arguments = SubstringExtensions.EncloseWithQuoteMarks(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), chartini.GetSection("Song").GetKey("BassStream").Value.Replace(" \"", "").Replace("\"", ""))) + @" C:\Windows\FastGH3\DATA\MUSIC\audio\rhythm.ogg rate 44.1k"; sox.Start(); } catch { } } sox.StartInfo.Arguments = SubstringExtensions.EncloseWithQuoteMarks(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), chartini.GetSection("Song").GetKey("MusicStream").Value.Replace(" \"", "").Replace("\"", ""))) + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg rate 44.1k"; } catch { } } else if (File.Exists(Path.GetFullPath(parameters[1]).Replace(".mid", ".ogg").Replace(".chart", ".ogg"))) { try { sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(".mid", ".ogg").Replace(".chart", ".ogg").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg rate 44.1k"; } catch { } } else if (File.Exists(Path.GetFullPath(parameters[1]).Replace(".mid", ".mp3").Replace(".chart", ".mp3"))) { try { sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(".mid", ".mp3").Replace(".chart", ".mp3").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg rate 44.1k"; } catch { } } else if (File.Exists(Path.GetFullPath(parameters[1]).Replace(".mid", ".wav").Replace(".chart", ".wav"))) { try { sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(".mid", ".wav").Replace(".chart", ".wav").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg rate 44.1k"; } catch { } } else { DialogResult audiolost = MessageBox.Show("No audio files can be found?\nDo you want to search for it?", "Broken chart?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); DialogResult playsilent = MessageBox.Show("Want to play without audio?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (audiolost == DialogResult.Yes) { OpenFileDialog searchaudio = new OpenFileDialog() { CheckFileExists = true, CheckPathExists = true, InitialDirectory = Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), ""), Filter = "Audio files|*.mp3;*.wav;*.ogg|Any type|*.*" }; } else if (audiolost == DialogResult.No) { if (playsilent == DialogResult.Yes) { sox.StartInfo.Arguments = "C:\\Windows\\FastGH3\\DATA\\TEMP\\MUSIC\\blank.ogg C:\\Windows\\FastGH3\\DATA\\MUSIC\\audio\\song.ogg rate 44.1k"; } else if (playsilent == DialogResult.No) { Application.Exit(); } } } sox.Start(); try { if (Path.GetFileName(parameters[1]).Contains(".chart")) { File.Copy(parameters[1].Replace(".chart", ".mid"), "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid", true); chart2mid.Kill(); } } catch { } try { File.Move("C:\\Windows\\FastGH3\\FastGH3.exe.bak", "C:\\Windows\\FastGH3\\FastGH3.exe"); } catch { } File.Copy(parameters[1].Replace(".chart", ".mid"), "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid", true); Console.ReadKey(); Console.WriteLine("Reading chart file."); Console.ReadKey(); chart = File.ReadAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart").Replace("}", "").Replace("{", ""); Console.ReadKey(); File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart", chart); Console.ReadKey(); if (chart.Contains("= S ")) { Process.Start("C:\\Windows\\FastGH3\\sed.exe", "sed - i '/ = S /d' C:\\Windows\\fastgh3\\DATA\\SONGS\\song.chart"); Process.Start("C:\\Windows\\FastGH3\\sed.exe", "sed - i '/ = TS /d' C:\\Windows\\fastgh3\\DATA\\SONGS\\song.chart"); } Console.ReadKey(); chartini.Load("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart"); Console.ReadKey(); string[] chartinieasy = chart.After("[EasySingle]").Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string[] chartinimedium = chart.After("[MediumSingle]").Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string[] chartinihard = chart.After("[HardSingle]").Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); chartiniexpert = chart.After("[ExpertSingle]").Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); disallowGameStartup(); Console.ReadKey(); Console.WriteLine("Generating QB template."); Console.ReadKey(); File.Delete("C:\\Windows\\fastgh3\\DATA\\SONGS\\song.qb"); Console.ReadKey(); File.Copy("C:\\Windows\\fastgh3\\DATA\\SONGS\\.qb", "C:\\Windows\\fastgh3\\DATA\\SONGS\\song.qb", true); Console.ReadKey(); File.SetAttributes("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb", FileAttributes.Normal); Console.ReadKey(); disallowGameStartup(); Console.ReadKey(); Console.WriteLine("Opening song pak."); Console.ReadKey(); File.Copy("C:\\Windows\\FastGH3\\DATA\\SONGS\\.pak","C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen",true); PakFormat pakformat = new PakFormat("C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen", "", "", PakFormatType.PC); Console.ReadKey(); PakEditor buildsong = new PakEditor(pakformat, false); Console.ReadKey(); Console.WriteLine("Compiling chart."); Console.ReadKey(); QbFile songdata = new QbFile("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb", pakformat); Console.ReadKey(); QbItemBase array_easy = new QbItemArray(songdata); QbItemBase array_medium = new QbItemArray(songdata); QbItemBase array_hard = new QbItemArray(songdata); QbItemBase array_expert = new QbItemArray(songdata); Console.ReadKey(); array_easy.Create(QbItemType.SectionArray); array_medium.Create(QbItemType.SectionArray); array_hard.Create(QbItemType.SectionArray); array_expert.Create(QbItemType.SectionArray); Console.ReadKey(); QbItemInteger notes_easy = new QbItemInteger(songdata); QbItemInteger notes_medium = new QbItemInteger(songdata); QbItemInteger notes_hard = new QbItemInteger(songdata); QbItemInteger notes_expert = new QbItemInteger(songdata); Console.ReadKey(); if (chartinieasy.Length > 0) { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", (3 * chartinieasy.Length).ToString()); } else { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3"); } notes_easy.Create(QbItemType.ArrayInteger); if (chartinimedium.Length > 0) { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", (3 * chartinimedium.Length).ToString()); } else { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3"); } notes_medium.Create(QbItemType.ArrayInteger); if (chartinihard.Length > 0) { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", (3 * chartinihard.Length).ToString()); } else { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3"); } notes_hard.Create(QbItemType.ArrayInteger); if (chartiniexpert.Length > 0) { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", (3 * chartiniexpert.Length).ToString()); } else { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3"); } notes_expert.Create(QbItemType.ArrayInteger); array_easy.ItemQbKey = QbKey.Create("E9BB103D"); array_medium.ItemQbKey = QbKey.Create("DE2FC9CC"); array_hard.ItemQbKey = QbKey.Create("61CC9578"); array_expert.ItemQbKey = QbKey.Create("57471F39"); Console.ReadKey(); #region Import expert notes pushinteger = 0; foreach (string note in chartiniexpert) { int.TryParse(note.Before(" = N"), out notes_expert.Values[pushinteger]); notes_expert.Values[pushinteger] = Convert.ToInt32(notes_expert.Values[pushinteger] * 2.604166666666667); int.TryParse(note.After(" = N ").Before(" "), out notecolor); if (notes_expert.Values[pushinteger + 1] == 0) { notes_expert.Values[pushinteger + 1] = 1; } else { int.TryParse(note.After(" = N " + notecolor.ToString() + ' '), out notes_expert.Values[pushinteger + 1]); notes_expert.Values[pushinteger + 1] = Convert.ToInt32(notes_expert.Values[pushinteger + 1] * 2.604166666666667); } switch (notecolor) { case 0: notes_expert.Values[pushinteger + 2] = 1; break; case 1: notes_expert.Values[pushinteger + 2] = 2; break; case 2: notes_expert.Values[pushinteger + 2] = 4; break; case 3: notes_expert.Values[pushinteger + 2] = 8; break; case 4: notes_expert.Values[pushinteger + 2] = 16; break; } pushinteger += 3; } #endregion MergeNotes(notes_easy); MergeNotes(notes_medium); MergeNotes(notes_hard); MergeNotes(notes_expert); songdata.AddItem(array_easy); songdata.AddItem(array_medium); songdata.AddItem(array_hard); songdata.AddItem(array_expert); array_easy.AddItem(notes_easy); array_medium.AddItem(notes_medium); array_hard.AddItem(notes_hard); array_expert.AddItem(notes_expert); Console.ReadKey(); string qbkey = ""; for (int i = 0; i < 20; i++) { QbItemBase disposable = new QbItemArray(songdata); disposable.Create(QbItemType.SectionArray); switch (i) { case 0: qbkey = "9C876792"; break; case 1: qbkey = "4FE36D34"; break; case 2: qbkey = "74F79A34"; break; case 3: qbkey = "608DEDC6"; break; case 4: qbkey = "BA97A161"; break; case 5: qbkey = "4575E6F0"; break; case 6: qbkey = "E57786DA"; break; case 7: qbkey = "CB0D41E7"; break; default: qbkey = "ABCDEF00"; break; } disposable.ItemQbKey = QbKey.Create(qbkey); QbItemBase disposable2 = new QbItemArray(songdata); QbItemInteger disposable3 = new QbItemInteger(songdata); songdata.AddItem(disposable); /*if (i < 8 && i > 11) { disposable2.Create(QbItemType.ArrayArray); disposable.AddItem(disposable2); } if (i > 7 && i < 12) { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3"); disposable3.Create(QbItemType.ArrayInteger); disposable3.Values[0] = 0; disposable3.Values[1] = 0; disposable3.Values[2] = 0; disposable.AddItem(disposable3); }*/ } Console.ReadKey(); songdata.AlignPointers(); Console.ReadKey(); songdata.Write("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb"); Console.ReadKey(); Console.WriteLine("Compiling pak."); Console.ReadKey(); buildsong.ReplaceFile("E15310CD", "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb"); Console.ReadKey(); Console.WriteLine("Encoding song."); Console.ReadKey(); disallowGameStartup(); Console.WriteLine("Speeding up."); try { var olddxwnd = Process.GetProcessesByName("dxwnd")[0]; olddxwnd.Kill(); } catch { } Process dxwnd = new Process(); dxwnd.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe"; dxwnd.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED\\"; dxwnd.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; dxwnd.StartInfo.Arguments = "/q"; if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True") { dxwnd.Start(); } Process gh3 = new Process(); gh3.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\"; if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True") { gh3.StartInfo.FileName = "C:\\Program Files\\3da\\3DAnalyze.exe"; gh3.StartInfo.Arguments = "/EXE=C:\\Windows\\FastGH3\\gh3.exe"; } else { gh3.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe"; gh3.StartInfo.Arguments = "/q /r:0"; gh3.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED"; gh3.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; } if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\maxnotes_auto") == "true") { try { if (chartini.GetSection("EasySingle").Keys.Count > chartini.GetSection("MediumSingle").Keys.Count) { if (chartini.GetSection("EasySingle").Keys.Count > chartini.GetSection("HardSingle").Keys.Count) { if (chartini.GetSection("EasySingle").Keys.Count > chartini.GetSection("ExpertSingle").Keys.Count) { maxnotes = chartini.GetSection("EasySingle").Keys.Count; } } } } catch { maxnotes = chartini.GetSection("ExpertSingle").Keys.Count; } try { if (chartini.GetSection("MediumSingle").Keys.Count > chartini.GetSection("EasySingle").Keys.Count) { if (chartini.GetSection("MediumSingle").Keys.Count > chartini.GetSection("HardSingle").Keys.Count) { if (chartini.GetSection("MediumSingle").Keys.Count > chartini.GetSection("ExpertSingle").Keys.Count) { maxnotes = chartini.GetSection("MediumSingle").Keys.Count; } } } } catch { maxnotes = chartini.GetSection("ExpertSingle").Keys.Count; } try { if (chartini.GetSection("HardSingle").Keys.Count > chartini.GetSection("EasySingle").Keys.Count) { if (chartini.GetSection("HardSingle").Keys.Count > chartini.GetSection("MediumSingle").Keys.Count) { if (chartini.GetSection("HardSingle").Keys.Count > chartini.GetSection("ExpertSingle").Keys.Count) { maxnotes = chartini.GetSection("HardSingle").Keys.Count; } } } } catch { maxnotes = chartini.GetSection("ExpertSingle").Keys.Count; } try { if (chartini.GetSection("ExpertSingle").Keys.Count > chartini.GetSection("EasySingle").Keys.Count) { if (chartini.GetSection("ExpertSingle").Keys.Count > chartini.GetSection("MediumSingle").Keys.Count) { if (chartini.GetSection("ExpertSingle").Keys.Count > chartini.GetSection("HardSingle").Keys.Count) { maxnotes = chartini.GetSection("ExpertSingle").Keys.Count; } } } } catch { maxnotes = chartini.GetSection("ExpertSingle").Keys.Count; } if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\maxnotes_auto") == "true") { File.WriteAllText("C:\\Windows\\FastGH3\\CONFIGS\\maxnotes", maxnotes.ToString()); } } //File.Delete(@"C:\Windows\FastGH3\DATA\MUSIC\fastgh3.fsb.xen"); //File.Delete(@"C:\Windows\FastGH3\DATA\MUSIC\fastgh3.dat.xen"); //File.Delete(@"C:\Windows\fastgh3\DATA\SONGS\fastgh3_song.pak.xen"); //File.Copy(@"C:\Windows\fastgh3\DATA\TEMP\MUSIC\fastgh3.dat.xen", @"C:\Windows\FastGH3\DATA\MUSIC\fastgh3.dat.xen", true); //File.Copy(@"C:\Windows\fastgh3\DATA\TEMP\MUSIC\fastgh3.fsb.xen", @"C:\Windows\FastGH3\DATA\MUSIC\fastgh3.fsb.xen", true); //File.Copy(@"C:\Windows\fastgh3\DATA\TEMP\SONGS\fastgh3_song.pak.xen", @"C:\Windows\FastGH3\DATA\SONGS\fastgh3_song.pak.xen", true); gh3.Start(); Thread.Sleep(2500); if (gh3.StartInfo.FileName == "C:\\Program Files\\3da\\3DAnalyze.exe") { gh3.Kill(); } try { File.Move("C:\\Windows\\FastGH3\\FastGH3.exe.bak", "C:\\Windows\\FastGH3\\FastGH3.exe"); } catch { } } } } } catch { } GC.Collect(); try { if (File.Exists(parameters[1]) && parameters[1].Contains(".fsp")) { Console.WriteLine("FastGH3 by donnaken15"); Console.WriteLine("Adding song to game."); using (ZipFile file = ZipFile.Read(parameters[1])) { file.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently; foreach (ZipEntry data in file) { if (data.FileName.Contains(".pak")) { data.Extract("C:\\Windows\\FastGH3\\DATA\\SONGS\\"); File.Delete("C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen"); File.Move("C:\\Windows\\FastGH3\\DATA\\SONGS\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen"); } if (data.FileName.Contains(".fsb")) { data.Extract("C:\\Windows\\FastGH3\\DATA\\MUSIC\\"); File.Delete("C:\\Windows\\FastGH3\\DATA\\MUSIC\\fastgh3.fsb.xen"); File.Move("C:\\Windows\\FastGH3\\DATA\\MUSIC\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\MUSIC\\fastgh3.fsb.xen"); } } } try { File.Move("C:\\Windows\\FastGH3\\FastGH3.exe.bak", "C:\\Windows\\FastGH3\\FastGH3.exe"); } catch { } Console.WriteLine("Speeding up."); Process dxwnd = new Process(); dxwnd.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe"; dxwnd.StartInfo.Arguments = "/q"; dxwnd.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED\\"; dxwnd.StartInfo.CreateNoWindow = false; dxwnd.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; dxwnd.Start(); Process gh3 = new Process(); if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True") { gh3.StartInfo.FileName = "C:\\Program Files\\3da\\3DAnalyze.exe"; gh3.StartInfo.Arguments = "/EXE=C:\\Windows\\FastGH3\\gh3.exe"; } else { gh3.StartInfo.FileName = "C:\\Windows\\FastGH3\\gh3.exe"; gh3.StartInfo.Arguments = ""; } gh3.Start(); if (gh3.StartInfo.FileName == "C:\\Program Files\\3da\\3DAnalyze.exe") { Thread.Sleep(2500); gh3.Kill(); } } } catch { } } } }