private void StartFfb()
        {
            // TODO: NOT TESTED BEFORE COMMIT
            var t = new Thread(() => FfbHelper.UseForceFeedback(_parrotData, ref _endCheckBox));

            t.Start();
        }
Beispiel #2
0
        private void CreateGameProcess()
        {
            // TODO: PUT ALL IN SEPARATE FUNCTIONS INSTEAD OF THIS DIHARREA THX
            var gameThread = new Thread(() =>
            {
                string loaderExe;

                if (_gameProfile.IsOpenParrot)
                {
                    loaderExe = _gameProfile.Is64Bit ? "OpenParrotLoader64.exe" : "OpenParrotLoader.exe";
                }
                else
                {
                    loaderExe = _gameProfile.Is64Bit ? "ParrotLoader64.exe" : "ParrotLoader.exe";
                }

                if (_gameProfile.EmulationProfile == EmulationProfile.Outrun2SPX ||
                    _gameProfile.EmulationProfile == EmulationProfile.AfterBurnerClimax ||
                    _gameProfile.EmulationProfile == EmulationProfile.SegaInitialDLindbergh ||
                    _gameProfile.EmulationProfile == EmulationProfile.Vt3Lindbergh ||
                    _gameProfile.EmulationProfile == EmulationProfile.SegaRtv)
                {
                    loaderExe = "BudgieLoader.exe";
                }
                ProcessStartInfo info;
                if (_isTest)
                {
                    if (_testMenuIsExe)
                    {
                        info = new ProcessStartInfo(loaderExe,
                                                    $"\"{Path.Combine(Path.GetDirectoryName(_gameLocation), _testMenuExe)}\" {_testMenuString}");
                    }
                    else
                    {
                        if (_gameProfile.EmulationProfile == EmulationProfile.AfterBurnerClimax &&
                            _gameProfile.ConfigValues.Any(x => x.FieldName == "Windowed" && x.FieldValue == "0"))
                        {
                            info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\" {_testMenuString} -full");
                        }
                        else
                        {
                            info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\" {_testMenuString}");
                        }
                    }
                }
                else
                {
                    // TODO: CLEAN THIS SHIT UP!
                    if (_gameProfile.EmulationProfile == EmulationProfile.TaitoTypeXBattleGear &&
                        _gameProfile.ConfigValues.Any(x => x.FieldName == "Windowed" && x.FieldValue == "0"))
                    {
                        info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\" " + "_MTS_FULL_SCREEN_");
                    }
                    else if (_gameProfile.EmulationProfile == EmulationProfile.NamcoMachStorm &&
                             _gameProfile.ConfigValues.Any(x => x.FieldName == "Windowed" && x.FieldValue == "0"))
                    {
                        info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\" " + "-fullscreen");
                    }
                    else if (_gameProfile.EmulationProfile == EmulationProfile.SegaInitialDLindbergh &&
                             _gameProfile.ConfigValues.Any(x => x.FieldName == "Windowed" && x.FieldValue == "1"))
                    {
                        info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\"");
                        info.EnvironmentVariables.Add("tp_windowed", "1");
                    }
                    else if (_gameProfile.EmulationProfile == EmulationProfile.Outrun2SPX &&
                             _gameProfile.ConfigValues.Any(x => x.FieldName == "Windowed" && x.FieldValue == "1"))
                    {
                        info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\"");
                        info.EnvironmentVariables.Add("tp_windowed", "1");
                    }
                    else if (_gameProfile.EmulationProfile == EmulationProfile.Vt3Lindbergh &&
                             _gameProfile.ConfigValues.Any(x => x.FieldName == "Windowed" && x.FieldValue == "1"))
                    {
                        info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\"");
                        info.EnvironmentVariables.Add("tp_windowed", "1");
                    }
                    else if (_gameProfile.EmulationProfile == EmulationProfile.SegaRtv &&
                             _gameProfile.ConfigValues.Any(x => x.FieldName == "Windowed" && x.FieldValue == "1"))
                    {
                        info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\"");
                        info.EnvironmentVariables.Add("tp_windowed", "1");
                    }
                    else if (_gameProfile.EmulationProfile == EmulationProfile.AfterBurnerClimax &&
                             _gameProfile.ConfigValues.Any(x => x.FieldName == "Windowed" && x.FieldValue == "1"))
                    {
                        info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\"");
                        info.EnvironmentVariables.Add("tp_windowed", "1");
                    }
                    else if (_gameProfile.EmulationProfile == EmulationProfile.AfterBurnerClimax &&
                             _gameProfile.ConfigValues.Any(x => x.FieldName == "Windowed" && x.FieldValue == "0"))
                    {
                        info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\" -full");
                    }
                    else
                    {
                        info = new ProcessStartInfo(loaderExe, $"\"{_gameLocation}\"");
                    }
                }
                if (_gameProfile.EmulationProfile == EmulationProfile.Outrun2SPX ||
                    _gameProfile.EmulationProfile == EmulationProfile.AfterBurnerClimax ||
                    _gameProfile.EmulationProfile == EmulationProfile.SegaInitialDLindbergh ||
                    _gameProfile.EmulationProfile == EmulationProfile.Vt3Lindbergh ||
                    _gameProfile.EmulationProfile == EmulationProfile.SegaRtv)
                {
                    if (_gameProfile.EmulationProfile == EmulationProfile.SegaInitialDLindbergh)
                    {
                        info.EnvironmentVariables.Add("TEA_DIR", Path.GetDirectoryName(_gameLocation) + "\\");
                    }
                    info.WorkingDirectory = Path.GetDirectoryName(_gameLocation);
                    info.UseShellExecute  = false;
                }
                else
                {
                    info.UseShellExecute = false;
                }
                info.WindowStyle = ProcessWindowStyle.Normal;

                if (InputCode.ButtonMode == EmulationProfile.NamcoMkdx)
                {
                    // TODO: LOL CLEAN UP PLS
                    var isOriginalVersion = true;

                    if (File.Exists(Path.Combine(Path.GetDirectoryName(_gameLocation), "AMCUS", "AMAuthd.exe")))
                    {
                        isOriginalVersion = false;
                    }

                    if (File.Exists(Path.Combine(Path.GetDirectoryName(_gameLocation), "AMCUS", "iauthdll.dll")))
                    {
                        isOriginalVersion = false;
                    }

                    if (!isOriginalVersion)
                    {
                        // Write WritableConfig.ini
                        File.WriteAllText(
                            Path.Combine(Path.GetDirectoryName(_gameLocation), "AMCUS", "WritableConfig.ini"),
                            "[RuntimeConfig]\r\nmode=SERVER\r\nnetID=ABGN\r\nserialID=\r\n[MuchaChargeData]\r\ncamode-ch_token_consumed=0\r\ncamode-ch_token_charged=0\r\ncamode-ch_token_unit=0\r\ncamode-ch_token_lower=0\r\ncamode-ch_token_upper=0\r\ncamode-ch_token_month=0\r\n");

                        // Write AMConfig.ini
                        File.WriteAllText(Path.Combine(Path.GetDirectoryName(_gameLocation), "AMCUS", "AMConfig.ini"),
                                          "[AMUpdaterConfig] \r\n;; AMUpdater\r\namucfg-title=COCO\r\namucfg-lang=JP\r\namucfg-countdown=5\r\namucfg-h_resol=1360\r\namucfg-v_resol=768\r\namucfg-logfile=amupdater.log\r\namucfg-game_rev=1\r\n\r\n[AMAuthdConfig]\r\n;; AMAuthd\r\namdcfg-authType=ALL.NET\r\namdcfg-sleepTime=50\r\namdcfg-resoNameTimeout=180\r\namdcfg-writableConfig=WritableConfig.ini\r\namdcfg-showConsole=ENABLE\r\namdcfg-logfile=- ;\r\namdcfg-export_log=AmAuthdLog.zip ;\r\n\r\n[AllnetConfig] \r\n;; ALL.Net\r\nallcfg-gameID=SBZB\r\nallcfg-gameVer=1.10\r\n;allcfg-tenpoAddr=;\r\n;allcfg-authServerAddr=;\r\n\r\n[AllnetOptionRevalTime]\r\n;; ALL.Net\r\nallopt-reval_hour=7\r\nallopt-reval_minute=0\r\nallopt-reval_second=0\r\n\r\n[AllnetOptionTimeout]\r\n;; ALL.Net\r\nallopt-timeout_connect=60000  \r\nallopt-timeout_send=60000\r\nallopt-timeout_recv=60000\r\n\r\n[MuchaAppConfig]\r\n;; mucha_app\r\nappcfg-logfile=muchaapp.log;\r\nappcfg-loglevel=INFO ;\r\n\r\n[MuchaSysConfig]\r\n;; MUCHA\r\nsyscfg-daemon_exe=.\\MuchaBin\\muchacd.exe\r\nsyscfg-daemon_pidfile=muchacd.pid ;\r\nsyscfg-daemon_logfile=muchacd.log ;\r\nsyscfg-daemon_loglevel=INFO ;\r\nsyscfg-daemon_listen=tcp:0.0.0.0:8765\r\nsyscfg-client_connect=tcp:127.0.0.1:8765\r\n\r\n[MuchaCAConfig]\r\n;; MUCHA\r\ncacfg-game_cd=MK31 ;\r\ncacfg-game_ver=10.22\r\ncacfg-game_board_type=0\r\ncacfg-game_board_id=PCB\r\ncacfg-auth_server_url=https://127.0.0.1:443/mucha_front/\r\ncacfg-auth_server_sslverify=1\r\ncacfg-auth_server_sslcafile=.\\MuchaBin\\cakey_mk3.pem\r\ncacfg-auth_server_timeout=0\r\ncacfg-interval_ainfo_renew=1800\r\ncacfg-interval_ainfo_retry=60\r\ncacfg-auth_place_id=JPN0128C ;\r\n;cacfg-auth_store_router_ip=\r\n\r\n[MuchaDtConfig]\r\n;; MUCHA\r\ndtcfg-dl_product_id=0x4d4b3331\r\ndtcfg-dl_chunk_size=65536\r\ndtcfg-dl_image_path=//./H:\r\ndtcfg-dl_image_size=0\r\ndtcfg-dl_image_type=RAW\r\ndtcfg-dl_image_crypt_key=0xfedcba9876543210\r\ndtcfg-dl_log_level=INFO ;\r\ndtcfg-dl_lan_crypt_key=0xfedcba9876543210\r\ndtcfg-dl_lan_broadcast_interval=1000\r\ndtcfg-dl_lan_udp_port=9026\r\ndtcfg-dl_lan_bandwidth_limit=0\r\ndtcfg-dl_lan_broadcast_address=0.0.0.0\r\ndtcfg-dl_wan_retry_limit=\r\ndtcfg-dl_wan_retry_interval=\r\ndtcfg-dl_wan_send_timeout=\r\ndtcfg-dl_wan_recv_timeout=\r\ndtcfg-dl_lan_retry_limit=\r\ndtcfg-dl_lan_retry_interval=\r\ndtcfg-dl_lan_send_timeout=\r\ndtcfg-dl_lan_recv_timeout=\r\n\r\n[MuchaDtModeConfig]\r\n;; MUCHA\r\ndtmode-io_dir=.\\ ;\r\ndtmode-io_file=MK3_JP_\r\ndtmode-io_conv=DECEXP\r\ndtmode-io_passphrase=ktinkynhgimbt\r\n");

                        // Register iauthd.dll
                        Register_Dlls(Path.Combine(Path.GetDirectoryName(_gameLocation), "AMCUS", "iauthdll.dll"));

                        // Start AMCUS
                        StartAmcus(loaderExe,
                                   $"\"{Path.Combine(Path.GetDirectoryName(_gameLocation), "AMCUS", "AMAuthd.exe")}\"");
                    }
                }

                if (InputCode.ButtonMode == EmulationProfile.SegaInitialD)
                {
                    var newCard = _gameProfile.ConfigValues.FirstOrDefault(x => x.FieldName == "EnableNewCardCode");
                    if (newCard == null)
                    {
                        StartPicodaemon(loaderExe, $"\"{Path.Combine(Path.GetDirectoryName(_gameLocation), "picodaemon.exe")}");
                    }
                    else if (newCard.FieldValue == "0")
                    {
                        StartPicodaemon(loaderExe, $"\"{Path.Combine(Path.GetDirectoryName(_gameLocation), "picodaemon.exe")}");
                    }
                }

                var process = Process.Start(info);
                if (_parrotData.UseHaptic)
                {
                    if (InputCode.ButtonMode == EmulationProfile.SegaRacingClassic ||
                        InputCode.ButtonMode == EmulationProfile.EuropaRSegaRally3 ||
                        InputCode.ButtonMode == EmulationProfile.EuropaRFordRacing ||
                        InputCode.ButtonMode == EmulationProfile.SegaInitialD ||
                        InputCode.ButtonMode == EmulationProfile.WackyRaces ||
                        InputCode.ButtonMode == EmulationProfile.ChaseHq2 ||
                        InputCode.ButtonMode == EmulationProfile.NamcoWmmt5 ||
                        InputCode.ButtonMode == EmulationProfile.Outrun2SPX)
                    {
                        // TODO: NOT TESTED BEFORE COMMIT
                        var t = new Thread(() => FfbHelper.UseForceFeedback(_parrotData, ref _endCheckBox));
                        t.Start();
                    }
                }
                while (!process.HasExited)
                {
                    if (_JvsOverride)
                    {
                        Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(this.DoCheckBoxesDude));
                    }

                    Thread.Sleep(500);
                }

                _gameRunning = false;
                TerminateThreads();

                Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(this.Close));
            });

            gameThread.Start();
        }
Beispiel #3
0
        private void GameRunning_OnLoaded(object sender, RoutedEventArgs e)
        {
            PrivateInitJvs();
            if (InputCode.ButtonMode == EmulationProfile.EuropaRFordRacing || InputCode.ButtonMode == EmulationProfile.EuropaRSegaRally3)
            {
                if (_europa == null)
                {
                    _europa = new EuropaRPipeHandler();
                }
                _europa.StartListening(InputCode.ButtonMode == EmulationProfile.EuropaRSegaRally3);
            }
            if (InputCode.ButtonMode == EmulationProfile.FastIo)
            {
                if (_specialControl == null)
                {
                    _specialControl = new SpecialControlPipe();
                }
                _specialControl.StartListening(SpecialControlPipe.PipeModes.FastIo);
            }
            if (_rawInputListener == null)
            {
                _rawInputListener = new RawInputListener();
            }

            if (InputCode.ButtonMode == EmulationProfile.SegaJvsLetsGoIsland)
            {
                InputCode.AnalogBytes[0] = 127;
                InputCode.AnalogBytes[2] = 127;
                InputCode.AnalogBytes[4] = 127;
                InputCode.AnalogBytes[6] = 127;
            }
            else
            {
                InputCode.AnalogBytes[0] = 0;
                InputCode.AnalogBytes[2] = 0;
                InputCode.AnalogBytes[4] = 0;
                InputCode.AnalogBytes[6] = 0;
            }

            if (_parrotData.UseMouse && (InputCode.ButtonMode == EmulationProfile.SegaJvsLetsGoIsland || InputCode.ButtonMode == EmulationProfile.SegaJvsDreamRaiders || InputCode.ButtonMode == EmulationProfile.SegaJvsGoldenGun))
            {
                _rawInputListener.ListenToDevice(InputCode.ButtonMode == EmulationProfile.SegaJvsGoldenGun);
            }

            if (InputCode.ButtonMode == EmulationProfile.NamcoPokken)
            {
                _pokkenControlSender.StartListening();
            }

            if (InputCode.ButtonMode == EmulationProfile.ExBoard)
            {
                _exBoardControlSender.StartListening();
            }

            if (InputCode.ButtonMode == EmulationProfile.GtiClub3)
            {
                _gtiClub3ControlSender.StartListening();
            }

            if (InputCode.ButtonMode == EmulationProfile.SegaJvsLetsGoIsland || InputCode.ButtonMode == EmulationProfile.SegaJvsDreamRaiders || InputCode.ButtonMode == EmulationProfile.SegaJvsGoldenGun)
            {
                KillGunListener = false;
                LgiThread       = new Thread(HandleLgiControls);
                LgiThread.Start();
            }

            if (!_runEmuOnly)
            {
                WriteConfigIni();
            }

            if (InputCode.ButtonMode != EmulationProfile.EuropaRFordRacing && InputCode.ButtonMode != EmulationProfile.EuropaRSegaRally3 && InputCode.ButtonMode != EmulationProfile.FastIo)
            {
                // TODO: MAYBE MAKE THESE XML BASED?
                JvsPackageEmulator.JvsSwitchCount = 0x0E;
                switch (InputCode.ButtonMode)
                {
                case EmulationProfile.VirtuaRLimit:
                {
                    JvsPackageEmulator.JvsCommVersion     = 0x10;
                    JvsPackageEmulator.JvsVersion         = 0x20;
                    JvsPackageEmulator.JvsCommandRevision = 0x13;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                    JvsPackageEmulator.EnableTaito        = true;
                    JvsPackageEmulator.JvsSwitchCount     = 0x18;
                }
                break;

                case EmulationProfile.ChaseHq2:
                case EmulationProfile.WackyRaces:
                {
                    JvsPackageEmulator.JvsCommVersion     = 0x10;
                    JvsPackageEmulator.JvsVersion         = 0x20;
                    JvsPackageEmulator.JvsCommandRevision = 0x13;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                    JvsPackageEmulator.EnableTaito        = true;
                    JvsPackageEmulator.JvsSwitchCount     = 0x18;
                }
                break;

                case EmulationProfile.TaitoTypeXBattleGear:
                {
                    JvsPackageEmulator.JvsCommVersion        = 0x10;
                    JvsPackageEmulator.JvsVersion            = 0x30;
                    JvsPackageEmulator.JvsCommandRevision    = 0x13;
                    JvsPackageEmulator.JvsIdentifier         = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                    JvsPackageEmulator.EnableTaitoStick      = true;
                    JvsPackageEmulator.EnableTaitoBattleGear = true;
                    JvsPackageEmulator.JvsSwitchCount        = 0x18;
                }
                break;

                case EmulationProfile.TaitoTypeXGeneric:
                {
                    JvsPackageEmulator.JvsCommVersion     = 0x10;
                    JvsPackageEmulator.JvsVersion         = 0x30;
                    JvsPackageEmulator.JvsCommandRevision = 0x13;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                    JvsPackageEmulator.EnableTaitoStick   = true;
                    JvsPackageEmulator.JvsSwitchCount     = 0x18;
                }
                break;

                case EmulationProfile.BorderBreak:
                {
                    JvsPackageEmulator.JvsCommVersion     = 0x10;
                    JvsPackageEmulator.JvsVersion         = 0x20;
                    JvsPackageEmulator.JvsCommandRevision = 0x13;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                    InputCode.AnalogBytes[0] = 0x7F;     // Center analog
                    InputCode.AnalogBytes[2] = 0x7F;     // Center analog
                }
                break;

                case EmulationProfile.NamcoPokken:
                {
                    JvsPackageEmulator.JvsVersion         = 0x31;
                    JvsPackageEmulator.JvsCommVersion     = 0x31;
                    JvsPackageEmulator.JvsCommandRevision = 0x31;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_NBGI_Pokken;
                    JvsPackageEmulator.EnableNamco        = true;
                }
                break;

                case EmulationProfile.NamcoWmmt5:
                case EmulationProfile.NamcoMkdx:
                {
                    JvsPackageEmulator.JvsVersion         = 0x31;
                    JvsPackageEmulator.JvsCommVersion     = 0x31;
                    JvsPackageEmulator.JvsCommandRevision = 0x31;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_NBGI_MarioKart3;
                    JvsPackageEmulator.EnableNamco        = true;
                    JvsPackageEmulator.JvsSwitchCount     = 0x18;
                }
                break;

                case EmulationProfile.NamcoMachStorm:
                {
                    JvsPackageEmulator.JvsVersion         = 0x31;
                    JvsPackageEmulator.JvsCommVersion     = 0x31;
                    JvsPackageEmulator.JvsCommandRevision = 0x31;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_StarWars;
                    JvsPackageEmulator.EnableNamco        = true;
                    JvsPackageEmulator.JvsSwitchCount     = 0x18;
                }
                break;

                case EmulationProfile.ShiningForceCrossRaid:
                {
                    JvsPackageEmulator.JvsCommVersion     = 0x10;
                    JvsPackageEmulator.JvsVersion         = 0x20;
                    JvsPackageEmulator.JvsCommandRevision = 0x13;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                }
                break;

                case EmulationProfile.SegaJvsGoldenGun:
                case EmulationProfile.AfterBurnerClimax:
                {
                    JvsPackageEmulator.JvsCommVersion     = 0x10;
                    JvsPackageEmulator.JvsVersion         = 0x20;
                    JvsPackageEmulator.JvsCommandRevision = 0x13;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                }
                break;

                case EmulationProfile.SegaSonicAllStarsRacing:
                {
                    JvsPackageEmulator.JvsCommVersion     = 0x10;
                    JvsPackageEmulator.JvsVersion         = 0x20;
                    JvsPackageEmulator.JvsCommandRevision = 0x13;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                }
                break;

                case EmulationProfile.DevThing1:
                {
                    JvsPackageEmulator.JvsCommVersion         = 0x10;
                    JvsPackageEmulator.JvsVersion             = 0x30;
                    JvsPackageEmulator.JvsCommandRevision     = 0x13;
                    JvsPackageEmulator.JvsIdentifier          = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                    JvsPackageEmulator.EnableTaitoStick       = true;
                    JvsPackageEmulator.EnableTaitoBattleGear  = true;
                    JvsPackageEmulator.EnableDualJvsEmulation = true;
                    JvsPackageEmulator.JvsSwitchCount         = 0x18;
                }
                break;

                case EmulationProfile.VirtuaTennis4:
                case EmulationProfile.ArcadeLove:
                {
                    JvsPackageEmulator.JvsCommVersion         = 0x10;
                    JvsPackageEmulator.JvsVersion             = 0x20;
                    JvsPackageEmulator.JvsCommandRevision     = 0x13;
                    JvsPackageEmulator.JvsIdentifier          = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                    JvsPackageEmulator.EnableDualJvsEmulation = true;
                }
                break;

                case EmulationProfile.LGS:
                {
                    JvsPackageEmulator.JvsCommVersion     = 0x30;
                    JvsPackageEmulator.JvsVersion         = 0x30;
                    JvsPackageEmulator.JvsCommandRevision = 0x30;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_SegaLetsGoSafari;
                }
                break;

                case EmulationProfile.SegaJvs:
                case EmulationProfile.SegaJvsLetsGoIsland:
                case EmulationProfile.SegaJvsDreamRaiders:
                case EmulationProfile.ProjectDivaNu:
                case EmulationProfile.SegaInitialD:
                case EmulationProfile.SegaInitialDLindbergh:
                case EmulationProfile.SegaRacingClassic:
                default:
                {
                    JvsPackageEmulator.JvsCommVersion     = 0x10;
                    JvsPackageEmulator.JvsVersion         = 0x20;
                    JvsPackageEmulator.JvsCommandRevision = 0x13;
                    JvsPackageEmulator.JvsIdentifier      = JvsHelper.JVS_IDENTIFIER_Sega2005Jvs14572;
                }
                break;
                }
                _serialPortHandler.StopListening();
                Thread.Sleep(1000);
                _jvsThread = new Thread(() => _serialPortHandler.ListenPipe("TeknoParrot_JVS"));
                _jvsThread.Start();
                _processQueueThread = new Thread(_serialPortHandler.ProcessQueue);
                _processQueueThread.Start();
            }

            if (_parrotData.UseMouse && (InputCode.ButtonMode == EmulationProfile.SegaJvsLetsGoIsland || InputCode.ButtonMode == EmulationProfile.SegaJvsDreamRaiders || InputCode.ButtonMode == EmulationProfile.SegaJvsGoldenGun))
            {
                _diThread?.Abort(0);
                _diThread = null;
            }
            else
            {
                _diThread?.Abort(0);
                _diThread = CreateInputListenerThread(_parrotData.XInputMode);
            }

            // Wait before launching second thread.
            if (!_runEmuOnly)
            {
                Thread.Sleep(1000);
                _gameRunning = true;
                CreateGameProcess();
            }
            else
            {
                if (_parrotData.UseHaptic)
                {
                    if (InputCode.ButtonMode == EmulationProfile.SegaRacingClassic ||
                        InputCode.ButtonMode == EmulationProfile.EuropaRSegaRally3 ||
                        InputCode.ButtonMode == EmulationProfile.EuropaRFordRacing ||
                        InputCode.ButtonMode == EmulationProfile.SegaInitialD ||
                        InputCode.ButtonMode == EmulationProfile.WackyRaces ||
                        InputCode.ButtonMode == EmulationProfile.ChaseHq2 ||
                        InputCode.ButtonMode == EmulationProfile.NamcoWmmt5 ||
                        InputCode.ButtonMode == EmulationProfile.Outrun2SPX)
                    {
                        // TODO: NOT TESTED BEFORE COMMIT
                        var t = new Thread(() => FfbHelper.UseForceFeedback(_parrotData, ref _endCheckBox));
                        t.Start();
                    }
                }
            }
        }