Exemple #1
0
        static void Main(string[] args)
        {
            // ENTRY POINT

            // Set my working path for unzipper
            Unzip.ApplicationPath = Application.StartupPath;

            // To start the fix ALL patch MUST be applied!
            bool forbidStart = false;

            // Check: it's a debug mode?
            // NB: if debug mode is enabled it will write all console log into
            // a .txt file on user desktop

            if (File.Exists(Application.StartupPath + "\\debug.sss") ||
                (args.Length != 0 && args[0].Contains("-debug")))
            {
                // Debug mode enabled!

                // No need to check if exist
                File.Delete(Ocelot.debugMode_filePath);

                Ocelot.debugMode = true;

                Ocelot.PrintToDebugConsole("[!][!][!][!][!][!][!][!][!][!][!][!]");
                Ocelot.PrintToDebugConsole("[!]");
                Ocelot.PrintToDebugConsole("[!] Fix started at " + DateTime.UtcNow + " (UCT)");
                Ocelot.PrintToDebugConsole("[!] Fix internal version: " + Ocelot.VERSION);

                // Check if admin has right privileges

                bool adminRights = new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);

                if (adminRights)
                {
                    Ocelot.PrintToDebugConsole("[!] V's Fix has admin rights");
                }
                else
                {
                    Ocelot.PrintToDebugConsole("[!] V's Fix HASN'T admin rights");
                }

                // Print last game execution log, if exist

                string latestLastLogPath = Ocelot.RecoverLastLogPath();

                if (File.Exists(latestLastLogPath))
                {
                    Ocelot.PrintToDebugConsole("[PRINT LAST.LOG] A last.log file exist. Reading it...");

                    try
                    {
                        string entireFile = File.ReadAllText(latestLastLogPath, Encoding.ASCII);

                        Ocelot.PrintToDebugConsole("[PRINT LAST.LOG] " + entireFile);
                    }

                    catch
                    {
                        Ocelot.PrintToDebugConsole("[PRINT LAST.LOG] EXCEPTION WHILE READING LAST.LOG");
                    }
                }

                else
                {
                    Ocelot.PrintToDebugConsole("[PRINT LAST.LOG] No last.log file found. Game has never started!");
                }
            }

            // CHECK: start 'Nosy Mode'?
            // Is used to hide graphical things, allowing me to program the Fix
            // around people in peace and without looking like a total weirdo
            // to un-educated people

            if (File.Exists("nosyaround.sss"))
            {
                Ocelot.NOSYMODE = true;

                Ocelot.PrintToDebugConsole("[NOSY] NOSY MODE ACTIVATED!");
            }

            // Check running directory
            // V's fix is designed to work in GAME FOLDER/bin

            if (!(System.IO.File.Exists(Application.StartupPath + "\\mgs2_sse.exe")))
            {
                Ocelot.showMessage("wrong_folder_error");

                // Can't apply any prior needed patch cause...directory is wrong
                // Form is never created
                // Neither fix will try to install/extract anything
                // V's Fix will now close

                Ocelot.PrintToDebugConsole("[!] Fix is inside wrong folder. Closing.");
            }

            else
            {
                try
                {
                    // V's Fix is inside bin folder

                    // Is 2.0 Patch applied?
                    if (!(System.IO.File.Exists(Application.StartupPath + "\\_patch2.0_applied.sss")))
                    {
                        //Nope

                        //Better inform the user

                        Ocelot.showMessage("tip_patcher");

                        Ocelot.PrintToDebugConsole("[ ] Game is not patched. Applying V's 2.0 Homemade Patcher");

                        Unzip.UnZippa("1_homemade_patcher.zip");

                        Process cmd;

                        cmd = Process.Start(new ProcessStartInfo("AreaChecker.exe"));
                        cmd.WaitForExit();
                        Ocelot.PrintToDebugConsole("[ ] || [X] AreaChecker.exe finished");

                        cmd = Process.Start(new ProcessStartInfo("VOXPatch.exe"));

                        cmd.WaitForExit();
                        Ocelot.PrintToDebugConsole("[ ] || [X] VOXPatch.exe finished");

                        File.Delete(Application.StartupPath + "\\AreaChecker.exe");
                        File.Delete(Application.StartupPath + "\\VOXPatch.exe");

                        File.Create(Application.StartupPath + "\\_patch2.0_applied.sss");

                        Ocelot.PrintToDebugConsole("[X] V's 2.0 Homemade Patcher succesfully used!");
                    }

                    // Is audio fix applied?
                    if (!(System.IO.File.Exists(Application.StartupPath + "\\_audio_fix_applied.sss")))
                    {
                        //Nope
                        Ocelot.PrintToDebugConsole("[ ] Audio not patched. Applying Audio Fix");

                        Unzip.UnZippa("2_audio_fix.zip");

                        File.Create(Application.StartupPath + "\\_audio_fix_applied.sss");

                        Ocelot.PrintToDebugConsole("[X] Audio Fix succesfully applied!");
                    }

                    // Fixed exe has been applied?
                    if (!(System.IO.File.Exists(Application.StartupPath + "\\_fixed_exe_applied.sss")))
                    {
                        //Nope
                        Ocelot.PrintToDebugConsole("[ ] Fixed exe not applied. Applying it");

                        Unzip.UnZippa("3_fixed_exe.zip", true);

                        File.Create(Application.StartupPath + "\\_fixed_exe_applied.sss");

                        Ocelot.PrintToDebugConsole("[X] Fixed Exe succesfully applied!");
                    }


                    // Boycott useless original setupper
                    // MGS2SConfig.exe

                    if (System.IO.File.Exists(Application.StartupPath + "\\MGS2SConfig.exe"))
                    {
                        if (System.IO.File.Exists(Application.StartupPath + "\\_MGS2SConfig.oldandcrappy"))
                        {
                            File.Delete(Application.StartupPath + "\\_MGS2SConfig.oldandcrappy");
                            Ocelot.PrintToDebugConsole("[X] _MGS2SConfig.oldandcrappy deleted");
                        }

                        System.IO.File.Move("MGS2SConfig.exe", "_MGS2SConfig.oldandcrappy");
                        Ocelot.PrintToDebugConsole("[X] MSG2Config.exe nuked");
                    }

                    // Boycott useless original config .ini file
                    // MGS2SSET.ini

                    if (System.IO.File.Exists(Application.StartupPath + "\\MGS2SSET.ini"))
                    {
                        if (System.IO.File.Exists(Application.StartupPath + "\\_MGS2SSET.oldandcrappy"))
                        {
                            File.Delete(Application.StartupPath + "\\_MGS2SSET.oldandcrappy");
                            Ocelot.PrintToDebugConsole("[X] _MGS2SSET.oldandcrappy deleted");
                        }

                        System.IO.File.Move("MGS2SSET.ini", "_MGS2SSET.oldandcrappy");
                        Ocelot.PrintToDebugConsole("[X] MGS2SSET.ini nuked");
                    }

                    // Boycott useless non-sse executable
                    // mgs2.exe

                    if (System.IO.File.Exists(Application.StartupPath + "\\mgs2.exe"))
                    {
                        if (System.IO.File.Exists(Application.StartupPath + "\\_mgs2.exe.oldandcrappy"))
                        {
                            File.Delete(Application.StartupPath + "\\_mgs2.exe.oldandcrappy");
                            Ocelot.PrintToDebugConsole("[X] _mgs2.exe.oldandcrappy deleted");
                        }

                        System.IO.File.Move("mgs2.exe", "_mgs2.exe.oldandcrappy");
                        Ocelot.PrintToDebugConsole("[X] mgs2.exe nuked");
                    }

                    // V's Setupper has been used in the past?

                    if (!(System.IO.File.Exists(Application.StartupPath + "\\Configuration_file.ini")))
                    {
                        //Nope
                        // Deploying a basic .ini
                        Ocelot.PrintToDebugConsole("[ ] No Configuration_file.ini . Deploying it");

                        Unzip.UnZippa("Configuration_file.zip");

                        Ocelot.PrintToDebugConsole("[X] Configuration_file.ini now it's there!");
                    }

                    // Someone has messed with Configuration_file.ini?
                    // Let's check it out

                    Ocelot.checkConfFileIntegrity();
                }
                catch (Exception e)
                {
                    Ocelot.PrintToDebugConsole(e.ToString());
                    forbidStart = true;
                }

                if (forbidStart == false)
                {
                    // All file cleaned.
                    // All patch applied.
                    // Now I'm sure there aren't old files inside the directory

                    Ocelot.PrintToDebugConsole("[!] forbidStart is false. Starting winform");

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new Form1());
                }

                else
                {
                    Ocelot.showMessage("UAC_error");

                    // Tell the user about "Debug mode"

                    if (Ocelot.debugMode)
                    {
                        Ocelot.showMessage("debugModeEnabled");
                    }
                    else
                    {
                        Ocelot.showMessage("debugModeDisabled");
                    }


                    Ocelot.PrintToDebugConsole("[!] forbidStart is true. Closing.");
                }
            }
        }
Exemple #2
0
        static void Main()
        {
            // ENTRY POINT

            // Set to unzipper my working path
            Unzip.ApplicationPath = Application.StartupPath;

            // All patch must be applied to start the fix!
            bool forbidStart = false;

            // Check running directory
            // V's fix is designed to work in GAME FOLDER/bin

            if (!(System.IO.File.Exists(Application.StartupPath + "\\mgs2_sse.exe")))
            {
                MessageBox.Show(
                    "V's Fix isn't in the correct place.\nPut it into GAME DIRECTORY/bin folder",
                    "Guru meditation", MessageBoxButtons.OK, MessageBoxIcon.Error);

                //Form is never created
                //Neither fix will try to install/extract anything
                //V's Fix will now close
            }

            else
            {
                try
                {
                    // V's Fix is inside bin folder

                    // Is 2.0 Patch applied?
                    if (!(System.IO.File.Exists(Application.StartupPath + "\\_patch2.0_applied.sss")))
                    {
                        //Nope
                        Console.WriteLine("-- Game is not patched. Applying V's 2.0 Homemade Patcher");

                        Unzip.UnZippa("1_homemade_patcher.zip");

                        Process cmd;

                        cmd = Process.Start(new ProcessStartInfo("AreaChecker.exe"));
                        cmd.WaitForExit();
                        Console.WriteLine("-- || -- AreaChecker.exe finished");

                        try
                        {
                            cmd = Process.Start(new ProcessStartInfo("VOXPatch.exe"));

                            cmd.WaitForExit();
                            Console.WriteLine("-- || -- VOXPatch.exe finished");

                            File.Delete(Application.StartupPath + "\\AreaChecker.exe");
                            File.Delete(Application.StartupPath + "\\VOXPatch.exe");

                            File.Create(Application.StartupPath + "\\_patch2.0_applied.sss");

                            Console.WriteLine("-- V's 2.0 Homemade Patcher succesfully used!");
                        }

                        catch
                        {
                            // UAC Blocked?
                            Ocelot.showUacWarning();
                            forbidStart = true;
                        }
                    }

                    // Is audio fix applied?
                    if (!(System.IO.File.Exists(Application.StartupPath + "\\_audio_fix_applied.sss")))
                    {
                        //Nope
                        Console.WriteLine("-- Audio not patched. Applying Audio Fix");

                        Unzip.UnZippa("2_audio_fix.zip");

                        File.Create(Application.StartupPath + "\\_audio_fix_applied.sss");

                        Console.WriteLine("-- Audio Fix succesfully applied!");
                    }

                    // Fixed exe has been applied?
                    if (!(System.IO.File.Exists(Application.StartupPath + "\\_fixed_exe_applied.sss")))
                    {
                        //Nope
                        Console.WriteLine("-- Fixed exe not applied. Applying it");

                        Unzip.UnZippa("3_fixed_exe.zip", true);

                        File.Create(Application.StartupPath + "\\_fixed_exe_applied.sss");

                        Console.WriteLine("-- Fixed Exe succesfully applied!");
                    }


                    // Boycott useless original setupper
                    // MGS2SConfig.exe

                    if (System.IO.File.Exists(Application.StartupPath + "\\MGS2SConfig.exe"))
                    {
                        if (System.IO.File.Exists(Application.StartupPath + "\\_MGS2SConfig.oldandcrappy"))
                        {
                            File.Delete(Application.StartupPath + "\\_MGS2SConfig.oldandcrappy");
                        }

                        System.IO.File.Move("MGS2SConfig.exe", "_MGS2SConfig.oldandcrappy");
                        Console.WriteLine("--- MSG2Config.exe nuked");
                    }

                    // Boycott useless original config .ini file
                    // MGS2SSET.ini

                    if (System.IO.File.Exists(Application.StartupPath + "\\MGS2SSET.ini"))
                    {
                        if (System.IO.File.Exists(Application.StartupPath + "\\_MGS2SSET.oldandcrappy"))
                        {
                            File.Delete(Application.StartupPath + "\\_MGS2SSET.oldandcrappy");
                        }

                        System.IO.File.Move("MGS2SSET.ini", "_MGS2SSET.oldandcrappy");
                        Console.WriteLine("--- MGS2SSET.ini nuked");
                    }

                    // Boycott useless non-sse executable
                    // mgs2.exe

                    if (System.IO.File.Exists(Application.StartupPath + "\\mgs2.exe"))
                    {
                        if (System.IO.File.Exists(Application.StartupPath + "\\_mgs2.exe.oldandcrappy"))
                        {
                            File.Delete(Application.StartupPath + "\\_mgs2.exe.oldandcrappy");
                        }

                        System.IO.File.Move("mgs2.exe", "_mgs2.exe.oldandcrappy");
                        Console.WriteLine("--- mgs2.exe nuked");
                    }

                    // V's Setupper has been used in the past?

                    if (!(System.IO.File.Exists(Application.StartupPath + "\\Configuration_file.ini")))
                    {
                        //Nope
                        // Deploying a basic .ini
                        Console.WriteLine("-- No Configuration_file.ini . Deploying it");

                        Unzip.UnZippa("Configuration_file.zip");

                        Console.WriteLine("-- Configuration_file.ini now it's there!");
                    }

                    // Someone has messed with Configuration_file.ini?
                    // Let's check it out

                    Ocelot.checkConfFileIntegrity();
                }
                catch (Exception)
                {
                    Ocelot.showUacWarning();
                }

                if (forbidStart == false)
                {
                    // All file cleaned.
                    // All patch applied.
                    // Now I'm sure there aren't old files inside the directory

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new Form1());
                }
            }
        }
Exemple #3
0
        internal static void load_InternalConfig_SetTo_MGS()
        {
            // Delete already existing mgs.ini

            File.Delete(Application.StartupPath + "\\mgs2.ini");

            File.Create(Application.StartupPath + "\\mgs2.ini").Close();

            // NB: Operation are done following the usual pattern
            //  Resolution -> Controls -> Graphics -> Sound

            using (StreamWriter ini = new StreamWriter(Application.StartupPath + "\\mgs2.ini", true))
            {
                byte[]        ba;
                StringBuilder hexString = new StringBuilder();
                int           opcode;

                //////
                //--------- Resolution
                //////

                // Width

                hexString.Clear();
                hexString.Append(string.Format("{0:x}", Int32.Parse(Ocelot.InternalConfiguration.Resolution["Width"])).ToUpper());

                while (hexString.Length < 4)
                {
                    // Need 0 padding to left
                    hexString.Insert(0, 0);
                }

                ini.WriteLine("0003" + "\t" + hexString.ToString());

                // Heigth

                hexString.Clear();
                hexString.Append(string.Format("{0:x}", Int32.Parse(Ocelot.InternalConfiguration.Resolution["Height"])).ToUpper());

                while (hexString.Length < 4)
                {
                    // Need 0 padding to left
                    hexString.Insert(0, 0);
                }

                ini.WriteLine("0004" + "\t" + hexString.ToString());

                hexString.Clear();

                // WideScreenFIX

                // 0: delete all (if present) existing WideScreenFIX files/directory

                if (Directory.Exists(Application.StartupPath + "\\scripts"))
                {
                    Directory.Delete(Application.StartupPath + "\\scripts", true);
                    File.Delete(Application.StartupPath + "\\d3d8.dll");
                    File.Delete(Application.StartupPath + "\\dsound_x64.dll");
                }

                if (Ocelot.InternalConfiguration.Resolution["WideScreenFIX"].Equals("true"))
                {
                    // 1: WSF.zip must be extracted
                    // 2: Resolution must be set inside scripts/mgs2w.ini


                    // 1
                    Unzip.UnZippa("WSF.zip");

                    // 2

                    IniFile ws_ini = new IniFile(Application.StartupPath + "\\scripts\\mgs2w.ini");

                    ws_ini.Write("Width", Ocelot.InternalConfiguration.Resolution["Width"], "MAIN");
                    ws_ini.Write("Height", Ocelot.InternalConfiguration.Resolution["Height"], "MAIN");
                }

                // GraphicAdapterName

                hexString.Clear();
                ba        = Encoding.Default.GetBytes(Ocelot.InternalConfiguration.Resolution["GraphicAdapterName"]);
                hexString = new StringBuilder(BitConverter.ToString(ba));
                hexString = hexString.Replace("-", "");

                opcode = 70;

                while (hexString.Length > 8)
                {
                    ini.WriteLine("00" + opcode + "\t" + hexString.ToString().Substring(0, 8));

                    opcode++;
                    hexString = hexString.Remove(0, 8);
                }

                if (hexString.Length <= 8)
                {
                    while (hexString.Length < 8)
                    {
                        // Need 0 padding to right
                        hexString = hexString.Insert(hexString.Length, 0);
                    }

                    ini.WriteLine("00" + opcode + "\t" + hexString.ToString());
                }

                // FIX FOR ATI/NVIDIA

                using (var stream = new FileStream(Application.StartupPath + "\\mgs2_sse.exe", FileMode.Open, FileAccess.ReadWrite))
                {
                    // First things to do: sabotage certain API call

                    // P
                    stream.Position = 0x5FD83C;
                    stream.WriteByte(0x50);

                    // A
                    stream.Position = 0x5FD83D;
                    stream.WriteByte(0x41);

                    // C
                    stream.Position = 0x5FD83E;
                    stream.WriteByte(0x43);

                    // H
                    stream.Position = 0x5FD83F;
                    stream.WriteByte(0x48);

                    // I
                    stream.Position = 0x5FD840;
                    stream.WriteByte(0x49);

                    // N
                    stream.Position = 0x5FD841;
                    stream.WriteByte(0x4E);

                    // K
                    stream.Position = 0x5FD842;
                    stream.WriteByte(0x4B);

                    if (Ocelot.InternalConfiguration.Resolution["GraphicAdapterName"].Contains("GeForc"))
                    {
                        // NVidia Card. Apply NVidia FIX

                        // G
                        stream.Position = 0x5FD834;
                        stream.WriteByte(0x47);

                        // e
                        stream.Position = 0x5FD835;
                        stream.WriteByte(0x65);

                        // F
                        stream.Position = 0x5FD836;
                        stream.WriteByte(0x46);

                        // o
                        stream.Position = 0x5FD837;
                        stream.WriteByte(0x6F);

                        // r
                        stream.Position = 0x5FD838;
                        stream.WriteByte(0x72);

                        // c
                        stream.Position = 0x5FD839;
                        stream.WriteByte(0x63);
                    }

                    if (Ocelot.InternalConfiguration.Resolution["GraphicAdapterName"].Contains("Radeon"))
                    {
                        // RADEON Card. Apply RADEON FIX

                        // R
                        stream.Position = 0x5FD834;
                        stream.WriteByte(0x52);

                        // a
                        stream.Position = 0x5FD835;
                        stream.WriteByte(0x61);

                        // d
                        stream.Position = 0x5FD836;
                        stream.WriteByte(0x64);

                        // e
                        stream.Position = 0x5FD837;
                        stream.WriteByte(0x65);

                        // o
                        stream.Position = 0x5FD838;
                        stream.WriteByte(0x6F);

                        // n
                        stream.Position = 0x5FD839;
                        stream.WriteByte(0x6E);
                    }

                    if (Ocelot.InternalConfiguration.Resolution["GraphicAdapterName"].Contains("Intel"))
                    {
                        // Intel Graphics. Apply Intel Fix

                        // I
                        stream.Position = 0x5FD834;
                        stream.WriteByte(0x49);

                        // N
                        stream.Position = 0x5FD835;
                        stream.WriteByte(0x6E);

                        // T
                        stream.Position = 0x5FD836;
                        stream.WriteByte(0x74);

                        // E
                        stream.Position = 0x5FD837;
                        stream.WriteByte(0x65);

                        // L
                        stream.Position = 0x5FD838;
                        stream.WriteByte(0x6C);

                        // (
                        stream.Position = 0x5FD839;
                        stream.WriteByte(0x28);
                    }

                    // Laptop FIX

                    // Patching mgs2_sse.exe for dual graphics machine

                    // This will fix shadow/water bug for those has an Intel integrated gpu AND are on a laptop
                    // THAT BUG OCCUR EVEN IF GAME WILL RUN ON A DEDICATED GRAPHICS

                    foreach (string vganame in vgaList)
                    {
                        if ((Ocelot.InternalConfiguration.Resolution["LaptopMode"] == "true") && (vganame.Contains("Intel")))
                        {
                            //Time to apply the fix

                            // I
                            stream.Position = 0x5FD834;
                            stream.WriteByte(0x49);

                            // N
                            stream.Position = 0x5FD835;
                            stream.WriteByte(0x6E);

                            // T
                            stream.Position = 0x5FD836;
                            stream.WriteByte(0x74);

                            // E
                            stream.Position = 0x5FD837;
                            stream.WriteByte(0x65);

                            // L
                            stream.Position = 0x5FD838;
                            stream.WriteByte(0x6C);

                            // (
                            stream.Position = 0x5FD839;
                            stream.WriteByte(0x28);
                        }
                    }
                }

                // WindowMode

                if (Ocelot.InternalConfiguration.Resolution["WindowMode"].Equals("true"))
                {
                    ini.WriteLine("0001" + "\t" + "0001");
                }

                ini.WriteLine("0005" + "\t" + "0001");

                //////
                //--------- Controls
                //////

                // 360Gamepad

                // 0: delete all (if present) existing 360Gamepad files

                /*File.Delete(Application.StartupPath + "\\Dinput.dll");
                 * File.Delete(Application.StartupPath + "\\Dinput8.dll");
                 * File.Delete(Application.StartupPath + "\\XInput1_3.dll");
                 * File.Delete(Application.StartupPath + "\\XInputPlus.ini");*/

                // It copy only my custom config. Before this it need the original dll
                //  from XInput Plus. Check github page for instruction

                if (Ocelot.InternalConfiguration.Controls["360Gamepad"].Equals("true"))
                {
                    // 1: 360Gamepad.zip must be extracted

                    Unzip.UnZippa("360Gamepad.zip", true);
                }

                //////
                //--------- Graphics
                //////

                // ! Important thing !
                //  These switch can be more optimized with clever use of 'break'
                //   and removing some redundant 'case'
                //    I choosed to not do it cause I think it's much more simple to
                //     overhaul and mantain it in second time.

                // RenderingSize

                switch (Ocelot.InternalConfiguration.Graphics["RenderingSize"])
                {
                case "low":
                    ini.WriteLine("0006" + "\t" + "0200");
                    ini.WriteLine("0007" + "\t" + "0100");
                    break;

                case "medium":
                    ini.WriteLine("0006" + "\t" + "0400");
                    ini.WriteLine("0007" + "\t" + "0200");
                    break;

                case "high":
                    ini.WriteLine("0006" + "\t" + "0800");
                    ini.WriteLine("0007" + "\t" + "0400");
                    break;
                }

                // ShadowDetail

                switch (Ocelot.InternalConfiguration.Graphics["ShadowDetail"])
                {
                case "low":
                    ini.WriteLine("0031" + "\t" + "0020");
                    ini.WriteLine("0032" + "\t" + "0020");
                    break;

                case "medium":
                    ini.WriteLine("0031" + "\t" + "0100");
                    ini.WriteLine("0032" + "\t" + "0100");
                    ini.WriteLine("0040" + "\t" + "0001");
                    break;

                case "high":
                    ini.WriteLine("0031" + "\t" + "0200");
                    ini.WriteLine("0032" + "\t" + "0200");
                    ini.WriteLine("0040" + "\t" + "0001");
                    break;
                }

                // ModelQuality

                switch (Ocelot.InternalConfiguration.Graphics["ModelQuality"])
                {
                case "low":
                    // Do nothing
                    break;

                case "medium":
                    ini.WriteLine("0010" + "\t" + "0001");
                    break;

                case "high":
                    ini.WriteLine("0010" + "\t" + "0001");
                    // Disabled cause they broke the graphics
                    //ini.WriteLine("0020" + "\t" + "0001");
                    //ini.WriteLine("0021" + "\t" + "0001");
                    break;
                }

                // RenderingClearness

                switch (Ocelot.InternalConfiguration.Graphics["RenderingClearness"])
                {
                case "low":
                    ini.WriteLine("0034" + "\t" + "F000");
                    ini.WriteLine("0035" + "\t" + "F000");
                    break;

                case "medium":
                    ini.WriteLine("0034" + "\t" + "7000");
                    ini.WriteLine("0035" + "\t" + "7000");
                    break;

                case "high":
                    // Do nothing
                    break;
                }

                // CrossFade

                switch (Ocelot.InternalConfiguration.Graphics["CrossFade"])
                {
                case "low":
                    ini.WriteLine("0033" + "\t" + "0007");
                    break;

                case "medium":
                    ini.WriteLine("0033" + "\t" + "0007");
                    ini.WriteLine("0047" + "\t" + "0001");
                    break;

                case "high":
                    ini.WriteLine("0047" + "\t" + "0001");
                    break;
                }

                // EffectQuantity

                switch (Ocelot.InternalConfiguration.Graphics["EffectQuantity"])
                {
                case "low":
                    // Nothing
                    break;

                case "medium":
                    ini.WriteLine("0048" + "\t" + "0090");
                    ini.WriteLine("0049" + "\t" + "0090");
                    break;

                case "high":
                    ini.WriteLine("0048" + "\t" + "0100");
                    ini.WriteLine("0049" + "\t" + "0100");
                    break;
                }

                // BunchOfCoolEffect

                if (Ocelot.InternalConfiguration.Graphics["BunchOfCoolEffect"].Equals("true"))
                {
                    ini.WriteLine("0041" + "\t" + "0001");
                    ini.WriteLine("0042" + "\t" + "0001");
                    ini.WriteLine("0043" + "\t" + "0001");
                    ini.WriteLine("004A" + "\t" + "0001");
                }

                // MotionBlur

                if (Ocelot.InternalConfiguration.Graphics["MotionBlur"].Equals("true"))
                {
                    ini.WriteLine("0044" + "\t" + "0001");
                    ini.WriteLine("0045" + "\t" + "0001");
                }


                //////
                //--------- Sound
                //////

                // SoundAdapterName

                hexString.Clear();
                ba        = Encoding.Default.GetBytes(Ocelot.InternalConfiguration.Sound["SoundAdapterName"]);
                hexString = new StringBuilder(BitConverter.ToString(ba));
                hexString = hexString.Replace("-", "");

                opcode = 90;

                while (hexString.Length > 8)
                {
                    ini.WriteLine("00" + opcode + "\t" + hexString.ToString().Substring(0, 8));

                    opcode++;
                    hexString = hexString.Remove(0, 8);
                }

                if (hexString.Length <= 8)
                {
                    while (hexString.Length < 8)
                    {
                        // Need 0 padding to right
                        hexString = hexString.Insert(hexString.Length, 0);
                    }

                    ini.WriteLine("00" + opcode + "\t" + hexString.ToString());
                }

                // Quality

                switch (Ocelot.InternalConfiguration.Sound["Quality"])
                {
                case "low":
                    // Nothing
                    break;

                case "medium":
                    ini.WriteLine("009D" + "\t" + "0001");
                    break;

                case "high":
                    ini.WriteLine("009D" + "\t" + "0002");
                    break;
                }

                // SE

                switch (Ocelot.InternalConfiguration.Sound["SE"])
                {
                case "low":
                    // Nothing
                    break;

                case "medium":
                    ini.WriteLine("009E" + "\t" + "0005");
                    break;

                case "high":
                    ini.WriteLine("009E" + "\t" + "0009");
                    break;
                }

                // Sound Quality

                switch (Ocelot.InternalConfiguration.Sound["SE"])
                {
                case "low":
                    // Nothing
                    break;

                case "medium":
                    ini.WriteLine("009F" + "\t" + "0001");
                    break;

                case "high":
                    ini.WriteLine("009F" + "\t" + "0002");
                    break;
                }

                //////
                //--------- Extra Opcode
                //////

                // No idea what they do.
                //  Pachinko Opcode?

                ini.WriteLine("0002" + "\t" + "0001");
                ini.WriteLine("0030" + "\t" + "0004");
                ini.WriteLine("0046" + "\t" + "0001");

                //End Using
            }

            Console.WriteLine("[+] InternalConfig succesfully exported into mgs2.ini");

            return;
        }