private void cbCrashSoundEffect_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cbCrashSoundEffect.SelectedIndex)
            {
            case 0:
                var PlatesHdFiles = Directory.GetFiles(RTC_Core.rtcDir + "\\ASSETS\\PLATESHD");
                RTC_NetCoreSettings.loadedSounds = PlatesHdFiles.Select(it => new SoundPlayer(it)).ToArray();
                break;

            case 1:
                RTC_NetCoreSettings.loadedSounds = new SoundPlayer[] { new SoundPlayer(RTC_Core.rtcDir + "\\ASSETS\\crash.wav") };
                break;

            case 2:
                RTC_NetCoreSettings.loadedSounds = null;
                break;

            case 3:
                var CrashSoundsFiles = Directory.GetFiles(RTC_Core.rtcDir + "\\ASSETS\\CRASHSOUNDS");
                RTC_NetCoreSettings.loadedSounds = CrashSoundsFiles.Select(it => new SoundPlayer(it)).ToArray();
                break;
            }

            RTC_Params.SetParam("CRASHSOUND", cbCrashSoundEffect.SelectedIndex.ToString());
        }
Exemple #2
0
        private void RTC_Form_Load(object sender, EventArgs e)
        {
            btnLogo.Text = "    Version " + RTC_Core.RtcVersion;


            if (!RTC_Params.IsParamSet("DISCLAIMER_READ"))
            {
                MessageBox.Show(File.ReadAllText(RTC_Core.rtcDir + "\\LICENSES\\DISCLAIMER.TXT").Replace("[ver]", RTC_Core.RtcVersion), "RTC", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RTC_Params.SetParam("DISCLAIMER_READ");
            }

            RTC_Core.CheckForProblematicProcesses();

            if (RTC_Core.isStandalone)
            {
                GhostBoxInvisible(btnEasyMode);
                GhostBoxInvisible(btnEngineConfig);
                GhostBoxInvisible(btnGlitchHarvester);
                GhostBoxInvisible(btnStockpilePlayer);
                GhostBoxInvisible(btnRTCMultiplayer);
                GhostBoxInvisible(btnManualBlast);
                GhostBoxInvisible(btnAutoCorrupt);
                GhostBoxInvisible(pnCrashProtection);
            }
            else
            {
                btnEngineConfig_Click(sender, e);
                pnCrashProtectionUnavailable.Visible = true;
            }
        }
Exemple #3
0
        public static void MAINFORM_RESIZEEND()
        {
            if (DisableRTC)
            {
                return;
            }

            RTC_Params.SaveBizhawkWindowState();
        }
        private void cbAllowCrossCoreCorruption_CheckedChanged(object sender, EventArgs e)
        {
            if (cbAllowCrossCoreCorruption.Checked)
            {
                RTC_Params.SetParam("ALLOW_CROSS_CORE_CORRUPTION");
            }
            else
            {
                RTC_Params.RemoveParam("ALLOW_CROSS_CORE_CORRUPTION");
            }

            RTC_Core.AllowCrossCoreCorruption = cbAllowCrossCoreCorruption.Checked;
        }
        private void cbDisableBizhawkOSD_CheckedChanged(object sender, EventArgs e)
        {
            if (cbDisableBizhawkOSD.Checked)
            {
                RTC_Params.RemoveParam("ENABLE_BIZHAWK_OSD");
            }
            else
            {
                RTC_Params.SetParam("ENABLE_BIZHAWK_OSD");
            }

            RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.BIZHAWK_SET_OSDDISABLED)
            {
                objectValue = cbDisableBizhawkOSD.Checked
            });
        }
Exemple #6
0
        public static void MAINFORM_FORM_LOAD_END()
        {
            if (DisableRTC)
            {
                return;
            }

            //RTC_Hooks.LOAD_GAME_DONE();

            RTC_Core.Start();

            RTC_Core.LoadDefaultRom();

            RTC_Params.LoadBizhawkWindowState();

            GlobalWin.MainForm.Focus();
        }
Exemple #7
0
        private void RTC_ConnectionStatus_Form_Load(object sender, EventArgs e)
        {
            int crashSound = 0;

            if (RTC_Params.IsParamSet("CRASHSOUND"))
            {
                crashSound = Convert.ToInt32(RTC_Params.ReadParam("CRASHSOUND"));
            }

            RTC_Core.sForm.cbCrashSoundEffect.SelectedIndex = crashSound;

            RTC_Core.sForm.cbNetCoreCommandTimeout.SelectedIndex = 0;

            if (File.Exists(RTC_Core.bizhawkDir + "\\WGH\\WindowsGlitchHarvester.exe"))
            {
                lbWindowsGlitchHarvester.Visible = true;
                pnWindowsGlitchHarvester.Visible = true;
            }
        }
Exemple #8
0
        public static void SelectRTCColor()
        {
            // Show the color dialog.
            Color        color;
            ColorDialog  cd     = new ColorDialog();
            DialogResult result = cd.ShowDialog();

            // See if user pressed ok.
            if (result == DialogResult.OK)
            {
                // Set form background to the selected color.
                color = cd.Color;
            }
            else
            {
                return;
            }

            SetRTCColor(color);

            RTC_Params.SaveRTCColor(color);
        }
Exemple #9
0
        //This is the entry point of RTC. Without this method, nothing will load.
        public static void Start(Form _standaloneForm = null)
        {
            //Timed releases. Only for exceptionnal cases.
            bool     Expires      = false;
            DateTime ExpiringDate = DateTime.Parse("2017-03-03");

            if (Expires && DateTime.Now > ExpiringDate)
            {
                RTC_RPC.SendToKillSwitch("CLOSE");
                MessageBox.Show("This version has expired");
                GlobalWin.MainForm.Close();
                RTC_Core.coreForm.Close();
                RTC_Core.ghForm.Close();
                Application.Exit();
                return;
            }

            coreForm = new RTC_Core_Form();
            ecForm   = new RTC_EngineConfig_Form();
            spForm   = new RTC_StockpilePlayer_Form();
            ghForm   = new RTC_GlitchHarvester_Form();
            sForm    = new RTC_Settings_Form();

            multiForm           = new RTC_Multiplayer_Form();
            multipeerpopoutForm = new RTC_MultiPeerPopout_Form();
            sbForm      = new RTC_StockpileBlastBoard_Form();
            beForm      = new RTC_BlastEditor_Form();
            vmdPoolForm = new RTC_VmdPool_Form();
            vmdGenForm  = new RTC_VmdGen_Form();
            vmdActForm  = new RTC_VmdAct_Form();

            standaloneForm = _standaloneForm;


            if (!Directory.Exists(RTC_Core.rtcDir + "\\TEMP\\"))
            {
                Directory.CreateDirectory(RTC_Core.rtcDir + "\\TEMP\\");
            }

            if (!Directory.Exists(RTC_Core.rtcDir + "\\TEMP2\\"))
            {
                Directory.CreateDirectory(RTC_Core.rtcDir + "\\TEMP2\\");
            }

            if (!Directory.Exists(RTC_Core.rtcDir + "\\TEMP3\\"))
            {
                Directory.CreateDirectory(RTC_Core.rtcDir + "\\TEMP3\\");
            }

            if (!Directory.Exists(RTC_Core.rtcDir + "\\TEMP4\\"))
            {
                Directory.CreateDirectory(RTC_Core.rtcDir + "\\TEMP4\\");
            }


            //Loading RTC PArams
            RTC_Params.LoadRTCColor();
            RTC_Core.sForm.cbDisableBizhawkOSD.Checked        = !RTC_Params.IsParamSet("ENABLE_BIZHAWK_OSD");
            RTC_Core.sForm.cbAllowCrossCoreCorruption.Checked = RTC_Params.IsParamSet("ALLOW_CROSS_CORE_CORRUPTION");

            //Initiation of loopback TCP, only in DETACHED MODE
            if (RTC_Hooks.isRemoteRTC || RTC_Core.isStandalone)
            {
                RemoteRTC         = new RTC_NetCore();
                RemoteRTC.port    = 42042;
                RemoteRTC.address = "";
            }

            //Initialize RemoteRTC server
            if (RTC_Hooks.isRemoteRTC && !RTC_Core.isStandalone)
            {
                //Bizhawk has started in REMOTERTC mode, no RTC form will be loaded
                RemoteRTC.StartNetworking(NetworkSide.CLIENT, true);
                RemoteRTC.SendCommand(new RTC_Command(CommandType.REMOTE_EVENT_BIZHAWKSTARTED), false, true);
            }
            else
            {
                //Setup of Detached-exclusive features
                if (RTC_Core.isStandalone)
                {
                    coreForm.Text = "RTC : Detached Mode";

                    if (csForm == null)
                    {
                        csForm = new RTC_ConnectionStatus_Form();
                    }

                    RTC_Core.coreForm.showPanelForm(csForm);

                    RemoteRTC.ServerStarted += new EventHandler((ob, ev) =>
                    {
                        RemoteRTC_SupposedToBeConnected = false;
                        Console.WriteLine("RemoteRTC.ServerStarted");


                        if (csForm != null && !csForm.IsDisposed)
                        {
                            if (RTC_Core.csForm == null)
                            {
                                csForm = new RTC_ConnectionStatus_Form();
                            }

                            RTC_Core.coreForm.showPanelForm(csForm);
                        }

                        if (ghForm != null && !ghForm.IsDisposed)
                        {
                            ghForm.pnHideGlitchHarvester.BringToFront();
                            ghForm.pnHideGlitchHarvester.Show();
                        }
                    });

                    RemoteRTC.ServerConnected += new EventHandler((ob, ev) =>
                    {
                        RemoteRTC_SupposedToBeConnected = true;
                        Console.WriteLine("RemoteRTC.ServerConnected");
                        csForm.lbConnectionStatus.Text = "Connection status: Connected";

                        if (FirstConnection)
                        {
                            FirstConnection = false;
                            coreForm.btnEngineConfig_Click(ob, ev);
                        }
                        else
                        {
                            coreForm.showPanelForm(coreForm.previousForm, false);
                        }

                        ghForm.pnHideGlitchHarvester.Hide();
                        csForm.btnStartEmuhawkDetached.Text = "Restart BizHawk";

                        RTC_RPC.Heartbeat = true;
                        RTC_RPC.Freeze    = false;
                    });


                    RemoteRTC.ServerConnectionLost += new EventHandler((ob, ev) =>
                    {
                        RemoteRTC_SupposedToBeConnected = false;
                        Console.WriteLine("RemoteRTC.ServerConnectionLost");


                        if (csForm != null && !csForm.IsDisposed)
                        {
                            csForm.lbConnectionStatus.Text = "Connection status: Bizhawk timed out";
                            coreForm.showPanelForm(csForm);
                        }

                        if (ghForm != null && !ghForm.IsDisposed)
                        {
                            ghForm.lbConnectionStatus.Text = "Connection status: Bizhawk timed out";
                            ghForm.pnHideGlitchHarvester.BringToFront();
                            ghForm.pnHideGlitchHarvester.Show();
                        }

                        RTC_GameProtection.Stop();
                    });

                    RemoteRTC.ServerDisconnected += new EventHandler((ob, ev) =>
                    {
                        RemoteRTC_SupposedToBeConnected = false;
                        Console.WriteLine("RemoteRTC.ServerDisconnected");
                        csForm.lbConnectionStatus.Text = "Connection status: NetCore Shutdown";
                        ghForm.lbConnectionStatus.Text = "Connection status: NetCore Shutdown";
                        coreForm.showPanelForm(csForm);

                        ghForm.pnHideGlitchHarvester.BringToFront();
                        ghForm.pnHideGlitchHarvester.Show();

                        RTC_GameProtection.Stop();
                    });

                    RemoteRTC.StartNetworking(NetworkSide.SERVER, false, false);
                }
                else if (RTC_Hooks.isRemoteRTC)
                {                 //WILL THIS EVER HAPPEN? TO BE REMOVED IF NOT
                    RemoteRTC.StartNetworking(NetworkSide.SERVER, false, true);
                }

                // Show the main RTC Form
                coreForm.Show();
            }

            //Starting UDP loopback for Killswitch and External Rom Plugins
            RTC_RPC.Start();


            //Refocus on Bizhawk
            if (GlobalWin.MainForm != null)
            {
                GlobalWin.MainForm.Focus();
            }


            //Force create bizhawk config file if it doesn't exist
            if (!File.Exists(RTC_Core.bizhawkDir + "\\config.ini"))
            {
                RTC_Hooks.BIZHAWK_SAVE_CONFIG();
            }

            //Fetch NetCore aggressiveness
            if (RTC_Hooks.isRemoteRTC)
            {
                RTC_Core.SendCommandToRTC(new RTC_Command(CommandType.GETAGGRESSIVENESS));
            }
        }