예제 #1
0
        public OneTimeRunViewModel()
        {
            Version = 7;

            ParseCommandLine();
            Model = new PakEditor();

            ImportByParameterCommand  = new ImportByParameterCommand();
            ExtractByParameterCommand = new ExtractByParameterCommand();
            CreateByParameterCommand  = new CreateByParameterCommand();
        }
예제 #2
0
        public MainViewModel(IFilePathProvider filePathProvider)
        {
            FilePathProvider = filePathProvider;
            Model            = new PakEditor();

            OpenFileCommand         = new OpenFileCommand();
            ExtractAllCommand       = new ExtractAllCommand();
            ExtractSelectedCommand  = new ExtractSelectedCommand();
            ImportCommand           = new ImportCommand();
            CloseApplicationCommand = new CloseApplicationCommand();
            OpenAboutWindowCommand  = new OpenAboutWindowCommand();
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.Title         = "FastGH3";
            Console.CursorVisible = false;
            Console.WindowWidth   = 41;
            Console.WindowHeight  = 19;
            Console.BufferWidth   = 41;
            Console.BufferHeight  = 19;
            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 && args.Length == 0)
                {
                    Console.WriteLine("FASTGH3 by donnaken15");
                    Console.WriteLine("Checking file extension...");

                    if (!openchart.SafeFileName.Contains(".fsp") || !openchart.SafeFileName.Contains(".zip"))
                    {
                        if (openchart.SafeFileName.Contains(".chart") && !openchart.SafeFileName.Contains(".mid"))
                        {
                            Console.WriteLine("Detected chart file.");
                            currentchart = openchart.FileName;
                        }
                        else
                        {
                            Console.WriteLine("Detected midi file.");
                            Process.Start("mid2chart.exe", "-e " + openchart.FileName);
                            currentchart = openchart.FileName.Replace(openchart.SafeFileName, "") + openchart.SafeFileName.Replace(".chart", " (editable) .chart");
                        }
                        chart = File.ReadAllText(currentchart).Replace("}", "").Replace("{", "");
                        File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart", chart);
                        IniFile chartini = new IniFile();
                        chartini.Load("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart");
                        Console.WriteLine("Generating QB template.");
                        File.Delete("C:\\Windows\\fastgh3\\DATA\\SONGS\\song.qb");
                        File.Copy("C:\\Windows\\fastgh3\\DATA\\SONGS\\.qb", "C:\\Windows\\fastgh3\\DATA\\SONGS\\song.qb", true);
                        File.SetAttributes("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb", FileAttributes.Normal);
                        Console.WriteLine("Opening song pak.");
                        disallowGameStartup();
                        PakFormat pakformat = new PakFormat("C:\\Windows\\FastGH3\\DATA\\SONGS\\test_song.pak.xen", "", "", PakFormatType.PC);
                        PakEditor buildsong = new PakEditor(pakformat);
                        Console.WriteLine("Compiling chart.");
                        QbFile     songdata   = new QbFile("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb", pakformat);
                        QbItemBase array_easy = new QbItemArray(songdata);
                        array_easy.Create(QbItemType.SectionArray);
                        array_easy.ItemQbKey.Crc.Equals("BDA2A669");
                        QbItemInteger notes_easy = new QbItemInteger(songdata);
                        maxnotes = chartini.GetSection("EasySingle").Keys.Count;
                        File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", maxnotes.ToString());
                        notes_easy.Create(QbItemType.ArrayInteger);
                        notes_easy.Values[0] = 1;
                        foreach (IniSection.IniKey k in chartini.GetSection("EasySingle").Keys)
                        {
                            Console.WriteLine(k.GetValue().Replace("N ", "").EndsWith(" ") + " note @ " + k.GetName() + "");
                        }
                        Console.ReadKey();
                        songdata.AddItem(array_easy);
                        array_easy.AddItem(notes_easy);
                        songdata.AlignPointers();
                        songdata.Write("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb");
                        Console.WriteLine("Compiling pak.");
                        buildsong.ReplaceFile("6BE19E2F", "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb");
                        Console.WriteLine("Encoding song.");
                        disallowGameStartup();
                        Console.WriteLine("Speeding up.");
                        Console.ReadKey();
                        Process gh3 = new Process();
                        gh3.StartInfo.FileName         = "C:\\Windows\\FastGH3\\gh3.exe";
                        gh3.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\";

                        /*gh3.Start();
                         * //*/
                    }
                    else
                    {
                        MessageBox.Show("TEST");
                    }
                }
            }
            //try
            //{
            if (parameters.Length >= 0)
            {
                if (parameters[1] == "-startupmsg" && args[2] == "off")
                {
                    File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "off");
                }
                if (parameters[1] == "-startupmsg" && args[2] == "on")
                {
                    File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "on");
                }
                if (parameters[1] == "-settings")
                {
                    Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;
                    //Application.Run(new settings());
                    settings options = new settings();
                    options.ShowDialog();
                }
                if (File.Exists(parameters[1]))
                {
                    Console.WriteLine("FASTGH3 by donnaken15");
                    Console.WriteLine("Checking file extension...");
                    if (Path.GetFileName(parameters[1]).Contains(".chart") && !Path.GetFileName(parameters[1]).Contains(".mid"))
                    {
                        Console.WriteLine("Detected chart file.");
                        currentchart = parameters[1];
                    }
                    else
                    {
                        Console.WriteLine("Detected midi file.");
                        Process.Start("mid2chart.exe", "-e " + parameters[1]);
                        currentchart = parameters[1].Replace(Path.GetFileName(parameters[1]), "") + Path.GetFileName(parameters[1]).Replace(".chart", " (editable) .chart");
                    }
                    Console.WriteLine("Reading chart file.");
                    chart = File.ReadAllText(currentchart).Replace("}", "").Replace("{", "");
                    File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart", chart);
                    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");
                    }
                    IniFile chartini = new IniFile();
                    chartini.Load("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart");
                    chartiniexpert = chart.After("[ExpertSingle]").Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    File.WriteAllText("C:\\Windows\\FastGH3\\PLUGINS\\CODE\\notelimit\\notelimitfix.cpp", "#include \"noteLimitFix.h\"\n#include \"core\\Patcher.h\"\n#include <stdint.h>\n\nconst uint32_t MAX_NOTES " + chartini.GetSection("ExpertSingle").Keys.Count + ";//5DA666\nconst uint32_t GH3_MAX_PLAYERS = 2;\nvoid* const SIZEOP_NOTE_ALLOCATION = (void*)0x0041AA78;\nvoid* const ADDROP_SUSTAINARRAY_1 = (void*)0x0041EE33;\nvoid * const ADDROP_SUSTAINARRAY_2 = (void*)0x00423CD4;\nvoid * const ADDROP_SUSTAINARRAY_3 = (void*)0x00423D02;\nvoid * const ADDROP_FCARRAY = (void*)0x00423D14;\nvoid * const ADDROP_NOTEOFFSETARRAY = (void*)0x00423D22;\n\n\nstatic float* fixedSustainArray = nullptr;\nstatic float* fixedFcArray = nullptr;\nstatic uint32_t* fixedOffsetArray = nullptr;\n\n\nstatic GH3P::Patcher g_patcher = GH3P::Patcher(__FILE__);\n\n\nvoid FixNoteLimit()\n{\nif(fixedSustainArray == nullptr)\nfixedSustainArray = new float[MAX_NOTES * GH3_MAX_PLAYERS];\n\n\nif(fixedFcArray == nullptr)\nfixedFcArray = new float[MAX_NOTES * GH3_MAX_PLAYERS];\n\nif(fixedOffsetArray == nullptr)\nfixedOffsetArray = new uint32_t[MAX_NOTES * GH3_MAX_PLAYERS];\n\n\ng_patcher.WriteInt32(SIZEOP_NOTE_ALLOCATION, MAX_NOTES);\n\ng_patcher.WriteInt32(ADDROP_SUSTAINARRAY_1, reinterpret_cast<uint32_t>(fixedSustainArray));\ng_patcher.WriteInt32(ADDROP_SUSTAINARRAY_2, reinterpret_cast<uint32_t>(fixedSustainArray));\ng_patcher.WriteInt32(ADDROP_SUSTAINARRAY_3, reinterpret_cast<uint32_t>(fixedSustainArray));\ng_patcher.WriteInt32(ADDROP_FCARRAY, reinterpret_cast<uint32_t>(fixedFcArray));\ng_patcher.WriteInt32(ADDROP_NOTEOFFSETARRAY, reinterpret_cast<uint32_t>(fixedOffsetArray));\n}\n\n");
                    disallowGameStartup();
                    Console.WriteLine("Generating QB template.");
                    File.Delete("C:\\Windows\\fastgh3\\DATA\\SONGS\\song.qb");
                    File.Copy("C:\\Windows\\fastgh3\\DATA\\SONGS\\.qb", "C:\\Windows\\fastgh3\\DATA\\SONGS\\song.qb", true);
                    File.SetAttributes("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb", FileAttributes.Normal);
                    disallowGameStartup();
                    Console.WriteLine("Opening song pak.");
                    PakFormat pakformat = new PakFormat("C:\\Windows\\FastGH3\\DATA\\SONGS\\song_song.pak.xen", "", "", PakFormatType.PC);
                    PakEditor buildsong = new PakEditor(pakformat, false);
                    Console.WriteLine("Compiling chart.");
                    QbFile     songdata   = new QbFile("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb", pakformat);
                    QbItemBase array_easy = new QbItemArray(songdata);
                    array_easy.Create(QbItemType.SectionArray);
                    QbItemInteger notes_expert = new QbItemInteger(songdata);
                    File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", (3 * chartiniexpert.Length).ToString());
                    notes_expert.Create(QbItemType.ArrayInteger);
                    pushinteger = 0;
                    foreach (string note in chartiniexpert)
                    {
                        uint.TryParse(note.Before(" = N"), out notes_expert.Values[pushinteger]);
                        notes_expert.Values[pushinteger] *= Convert.ToUInt32(2.8125);
                        int.TryParse(note.After(" = N ").Before(" "), out notecolor);
                        uint.TryParse(note.After(" = N ") + notecolor + " ", out notes_expert.Values[pushinteger + 1]);
                        if (notes_expert.Values[pushinteger + 1] == 0)
                        {
                            notes_expert.Values[pushinteger + 1] = 1;
                        }
                        if (notecolor == 0)
                        {
                            try
                            {
                                if (notes_expert.Values[pushinteger - 1] == 2 && notes_expert.Values[pushinteger - 3] == notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 3;
                                }
                                if (notes_expert.Values[pushinteger - 1] == 4 && notes_expert.Values[pushinteger - 3] == notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 5;
                                }
                                if (notes_expert.Values[pushinteger - 1] == 8 && notes_expert.Values[pushinteger - 3] == notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 9;
                                }
                                if (notes_expert.Values[pushinteger - 1] == 16 && notes_expert.Values[pushinteger - 3] == notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 17;
                                }
                                if (notes_expert.Values[pushinteger - 3] != notes_expert.Values[pushinteger] && notes_expert.Values[pushinteger + 3] != notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 1;
                                }
                                if (notes_expert.Values[pushinteger + 5] == 2 && notes_expert.Values[pushinteger - 3] == notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 3;
                                }
                                if (notes_expert.Values[pushinteger + 5] == 4 && notes_expert.Values[pushinteger - 3] == notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 5;
                                }
                                if (notes_expert.Values[pushinteger + 5] == 8 && notes_expert.Values[pushinteger - 3] == notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 9;
                                }
                                if (notes_expert.Values[pushinteger + 5] == 16 && notes_expert.Values[pushinteger - 3] == notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 17;
                                }
                                if (notes_expert.Values[pushinteger + 4] != notes_expert.Values[pushinteger] && notes_expert.Values[pushinteger + 3] != notes_expert.Values[pushinteger])
                                {
                                    notes_expert.Values[pushinteger + 2] = 1;
                                }
                            }
                            catch
                            {
                            }
                        }
                        if (notecolor == 1)
                        {
                            notes_expert.Values[pushinteger + 2] = 2;
                        }
                        if (notecolor == 2)
                        {
                            notes_expert.Values[pushinteger + 2] = 4;
                        }
                        if (notecolor == 3)
                        {
                            notes_expert.Values[pushinteger + 2] = 8;
                        }
                        if (notecolor == 4)
                        {
                            notes_expert.Values[pushinteger + 2] = 16;
                        }
                        Console.WriteLine(notes_expert.Values[pushinteger] + Environment.NewLine + notes_expert.Values[pushinteger + 1] + Environment.NewLine + notes_expert.Values[pushinteger + 2]);
                        pushinteger += 3;
                    }

                    /*foreach (IniSection s in chartini.Sections)
                     * {
                     *  foreach (IniSection.IniKey k in s.Keys)
                     *  {
                     *      if (s.Name == "ExpertSingle")
                     *      {
                     *          //Console.WriteLine("note @ " + k.GetName() + " that is " + k.GetValue().Substring(5) + " milliseconds long");
                     *          notes_expert.Values[pushinteger] = Convert.ToUInt32(k.Name);
                     *          notes_expert.Values[pushinteger + 1] = Convert.ToUInt32(k.Value.Substring(5)) + 1;
                     *          notes_expert.Values[pushinteger + 2] = 1;
                     *          pushinteger += 3;
                     *      }
                     *  }
                     * }*/
                    //Console.WriteLine(chartini.GetSection("ExpertSingle").Keys.Count+" notes in expert chart.");
                    Console.ReadKey();
                    songdata.AddItem(array_easy);
                    array_easy.AddItem(notes_expert);
                    songdata.AlignPointers();
                    songdata.Write("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb");
                    Console.WriteLine("Compiling pak.");
                    buildsong.ReplaceFile("6BE19E2F", "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb");
                    Console.WriteLine("Encoding song.");
                    disallowGameStartup();
                    Console.WriteLine("Speeding up.");
                    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.Start();
                    Process gh3 = new Process();
                    gh3.StartInfo.FileName         = "C:\\Windows\\FastGH3\\gh3.exe";
                    gh3.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\";

                    /*dxwnd.Start();
                     * gh3.Start();
                     * //*/
                }
            }

            GC.Collect();
        }