Exemple #1
0
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Daten zur Quellgruppe.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-T Quellgruppe handelt.</returns>
        private bool SendChannel(TerrestrialGroup group)
        {
            // Not us
            if (group == null)
            {
                return(false);
            }

            // Validate
            if (FrontendType != FrontendType.Terrestrial)
            {
                throw new DVBException("Expected " + FrontendType.ToString() + " Channel");
            }

            // Helper
            var channel =
                new Channel_T
            {
                Frequency = group.Frequency,
                Inversion = SpectrumInversion.Off,
                Scan      = false,
            };

            // Check supported modes
            switch (group.Bandwidth)
            {
            case Bandwidths.Six: channel.Bandwidth = BandwidthType.Six; break;

            case Bandwidths.Seven: channel.Bandwidth = BandwidthType.Seven; break;

            case Bandwidths.Eight: channel.Bandwidth = BandwidthType.Eight; break;

            case Bandwidths.NotDefined: channel.Bandwidth = BandwidthType.None; break;

            default: channel.Bandwidth = BandwidthType.Auto; break;
            }

            // Process
            CheckChannel(CDVBFrontend_SetChannel(m_Class.ClassPointer, channel, false));

            // Check up for synchronisation
            Channel_T rVal1, rVal2;

            // Get channel twice
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out rVal1));
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out rVal2));

            // Did it
            return(true);
        }
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Daten zur Quellgruppe.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-T Quellgruppe handelt.</returns>
        private Channel_T?Tune(TerrestrialGroup group)
        {
            // Not us
            if (group == null)
            {
                return(null);
            }

            // Validate
            if (FrontendType != FrontendType.Terrestrial)
            {
                throw new DVBException("Expected " + FrontendType.ToString() + " Channel");
            }

            // Helper
            var data =
                new Channel_T
            {
                Frequency = group.Frequency,
                Inversion = SpectrumInversion.Off,
                Scan      = false,
            };

            // Check supported modes
            switch (group.Bandwidth)
            {
            case Bandwidths.Six: data.Bandwidth = BandwidthType.Six; break;

            case Bandwidths.Seven: data.Bandwidth = BandwidthType.Seven; break;

            case Bandwidths.Eight: data.Bandwidth = BandwidthType.Eight; break;

            case Bandwidths.NotDefined: data.Bandwidth = BandwidthType.None; break;

            default: data.Bandwidth = BandwidthType.Auto; break;
            }

            // Process
            return(data.SetChannel(this));
        }
        public async Task ToggleMenu()
        {
            IsVisible = !IsVisible;
            if (IsVisible)
            {
                while (IsPauseMenuActive() || IsPauseMenuRestarting() || IsFrontendFading())
                {
                    SetFrontendActive(false);
                    await BaseScript.Delay(0);
                }

                //RestartFrontendMenu(menuType == FrontendType.FE_MENU_VERSION_CORONA ? (uint)GetHashKey("FE_MENU_VERSION_CORONA") : (uint)GetHashKey("FE_MENU_VERSION_CORONA_RACE"), -1);
                RestartFrontendMenu((uint)GetHashKey(menuType.ToString()), -1);

                //AddFrontendMenuContext((uint)GetHashKey("FM_TUTORIAL"));
                //AddFrontendMenuContext((uint)GetHashKey("AUTOFILL_CORONA"));
                //AddFrontendMenuContext((uint)GetHashKey("CORONA_TOURNAMENT"));
                //AddFrontendMenuContext((uint)GetHashKey("AUTOFILL_CONTINUE"));
                //AddFrontendMenuContext(2010410515);
                //ObjectDecalToggle((uint)Int64.Parse("-228602367"));

                //ActivateFrontendMenu(menuType == FrontendType.FE_MENU_VERSION_CORONA ? (uint)GetHashKey("FE_MENU_VERSION_CORONA") : (uint)GetHashKey("FE_MENU_VERSION_CORONA_RACE"), false, -1);
                ActivateFrontendMenu((uint)GetHashKey(menuType.ToString()), false, -1);

                // start a call
                while (!IsPauseMenuActive() || IsPauseMenuRestarting())
                {
                    await BaseScript.Delay(0);
                }

                //AddFrontendMenuContext((uint)GetHashKey("FM_TUTORIAL"));
                //AddFrontendMenuContext((uint)GetHashKey("AUTOFILL_CORONA"));
                //AddFrontendMenuContext((uint)GetHashKey("CORONA_TOURNAMENT"));
                //AddFrontendMenuContext((uint)GetHashKey("AUTOFILL_CONTINUE"));


                N_0xb9449845f73f5e9c("SHIFT_CORONA_DESC");       // start call function - BeginScaleformMovieMethodV
                PushScaleformMovieFunctionParameterBool(true);   // push frontend title menu up.
                PushScaleformMovieFunctionParameterBool(false);  // show extra top border line
                PopScaleformMovieFunction();                     // end call function

                N_0xb9449845f73f5e9c("SET_HEADER_TITLE");        // Call set header function

                //BeginTextCommandScaleformString("STRING");
                //AddTextComponentSubstringPlayerName(name);        // Set the title
                //EndTextCommandScaleformString();
                PushScaleformMovieFunctionParameterString(name);        // Set the title

                PushScaleformMovieFunctionParameterBool(false);         // purpose unknown, is always 0 in decompiled scripts.


                PushScaleformMovieFunctionParameterString(subtitle);    // set the subtitle.

                //BeginTextCommandScaleformString("STRING");
                //AddTextComponentSubstringPlayerName(subtitle);        // Set the subtitle
                //EndTextCommandScaleformString();

                PushScaleformMovieFunctionParameterBool(true);          // purpose unknown, is always 1 in decompiled scripts.
                PopScaleformMovieFunctionVoid();                        // finish the set header function



                //await BaseScript.Delay(500);
                await BaseScript.Delay(100);

                UpdateSettings();
                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                PushScaleformMovieFunctionParameterInt(1);
                PopScaleformMovieFunctionVoid();

                await BaseScript.Delay(100);

                UpdateDetails();
                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                PushScaleformMovieFunctionParameterInt(0);
                PopScaleformMovieFunctionVoid();

                await BaseScript.Delay(100);
                await UpdateList();

                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                PushScaleformMovieFunctionParameterInt(3);
                PopScaleformMovieFunctionVoid();

                ///// ACTIVATE THE FIRST COLUMN (FOCUS).
                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("SET_COLUMN_FOCUS");
                PushScaleformMovieFunctionParameterInt(0); // column index // _loc7_
                PushScaleformMovieFunctionParameterInt(1); // highlightIndex // _loc6_
                PushScaleformMovieFunctionParameterInt(1); // scriptSetUniqID // _loc4_
                PushScaleformMovieFunctionParameterInt(0); // scriptSetMenuState // _loc5_
                PopScaleformMovieFunctionVoid();
            }
            else
            {
                SetFrontendActive(false);
            }
        }
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Daten zur Quellgruppe.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-C Quellgruppe handelt.</returns>
        private Channel_C?Tune(CableGroup group)
        {
            // Not us
            if (group == null)
            {
                return(null);
            }

            // Validate
            if (FrontendType != FrontendType.Cable)
            {
                throw new DVBException("Expected " + FrontendType.ToString() + " Channel");
            }

            // Helper
            var data =
                new Channel_C
            {
                Frequency  = group.Frequency,
                SymbolRate = group.SymbolRate,
            };

            // Spectrum inversion
            switch (group.SpectrumInversion)
            {
            case SpectrumInversions.On: data.Inversion = SpectrumInversion.On; break;

            case SpectrumInversions.Off: data.Inversion = SpectrumInversion.Off; break;

            case SpectrumInversions.Auto: data.Inversion = SpectrumInversion.Auto; break;

            default: data.Inversion = SpectrumInversion.Auto; break;
            }

            // Modulation
            switch (group.Modulation)
            {
            case CableModulations.QAM16: data.Qam = Qam.Qam16; break;

            case CableModulations.QAM32: data.Qam = Qam.Qam32; break;

            case CableModulations.QAM64: data.Qam = Qam.Qam64; break;

            case CableModulations.QAM128: data.Qam = Qam.Qam128; break;

            case CableModulations.QAM256: data.Qam = Qam.Qam256; break;

            default: data.Qam = Qam.Qam64; break;
            }

            // Check supported modes
            switch (group.Bandwidth)
            {
            case Bandwidths.Six: data.Bandwidth = BandwidthType.Six; break;

            case Bandwidths.Seven: data.Bandwidth = BandwidthType.Seven; break;

            case Bandwidths.Eight: data.Bandwidth = BandwidthType.Eight; break;

            case Bandwidths.NotDefined: data.Bandwidth = BandwidthType.None; break;

            default: data.Bandwidth = BandwidthType.Auto; break;
            }

            // Process
            return(data.SetChannel(this));
        }
        /// <summary>
        /// Wählt eine Quellgruppe aus.
        /// </summary>
        /// <param name="group">Díe Daten der Quellgruppe.</param>
        /// <param name="location">Die Wahl des Ursprungs, über den die Quellgruppe empfangen werden kann.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-S Quellgruppe handelt.</returns>
        private Channel_S?Tune(SatelliteGroup group, SatelliteLocation location)
        {
            // Not us
            if (location == null)
            {
                return(null);
            }
            if (group == null)
            {
                return(null);
            }

            // Validate
            if (FrontendType != FrontendType.Satellite)
            {
                throw new DVBException("Expected " + FrontendType.ToString() + " Channel");
            }

            // Create channel
            var data =
                new Channel_S
            {
                Mode       = group.UsesS2Modulation ? DVBSMode.DVB_S2 : DVBSMode.DVB_S,
                Inversion  = SpectrumInversion.Auto,
                SymbolRate = group.SymbolRate,
                Frequency  = group.Frequency,
            };


            // Attach to the DiSEqC setting
            var selector = StandardDiSEqC.FromSourceGroup(group, location);

            // See if the message is different from the last one
            if (!selector.Equals(m_lastMessage))
            {
                // Remember
                m_lastMessage = selector.Clone();

                // As long as necessary
                for (int nCount = selector.Repeat; nCount-- > 0; Thread.Sleep(120))
                {
                    // Send it
                    DVBException.ThrowOnError(_SendDiSEqCMsg(m_Class.ClassPointer, selector.Request, (byte)selector.Request.Length, selector.Burst), "Could not send DiSEqC message");

                    // Set repeat flag
                    if (selector.Request.Length > 0)
                    {
                        selector.Request[0] |= 1;
                    }
                }
            }

            // Calculated items
            data.b22kHz = (group.Frequency >= location.SwitchFrequency) ? 1 : 0;
            data.LOF    = (0 == data.b22kHz) ? location.Frequency1 : location.Frequency2;

            // Power modes
            switch (group.Polarization)
            {
            case Polarizations.Horizontal: data.LNBPower = PowerMode.Horizontal; break;

            case Polarizations.Vertical: data.LNBPower = PowerMode.Vertical; break;

            case Polarizations.NotDefined: data.LNBPower = PowerMode.Off; break;

            default: throw new ArgumentException(group.Polarization.ToString(), "Polarization");
            }

            // Process
            return(data.SetChannel(this, false));
        }
Exemple #6
0
        /// <summary>
        /// Toggles the menu visibility and sets up all the necessary data for the menu.
        /// </summary>
        /// <returns></returns>
        public async Task ToggleMenu()
        {
            if (!IsVisible)
            {
                if (IsPauseMenuActive() || IsPauseMenuRestarting() || IsFrontendFading())
                {
                    SetFrontendActive(false);
                }

                while (IsPauseMenuActive() || IsPauseMenuRestarting() || IsFrontendFading())
                {
                    SetFrontendActive(false);
                    await BaseScript.Delay(0);
                }

                RestartFrontendMenu((uint)GetHashKey(menuType.ToString()), -1);
                ActivateFrontendMenu((uint)GetHashKey(menuType.ToString()), false, -1);

                // wait for it to start.
                while (!IsPauseMenuActive() || IsPauseMenuRestarting())
                {
                    await BaseScript.Delay(0);
                }

                // don't use this: you'll regret it. It disables the navigation keys on keyboard. Not sure about controller.
                // N_0xec9264727eec0f28(); this disables the key.s
                // N_0x14621bb1df14e2b2(); this enables the keys again.

                BeginScaleformMovieMethodV("SHOW_HEADING_DETAILS"); // stops ped info from showing up (top right of the screen)
                PushScaleformMovieMethodParameterBool(false);       // also fixes the subtitle of the frontend menu from line-breaking really early.
                PopScaleformMovieFunctionVoid();


                /// some weird stuff that needs more research
                //BeginScaleformMovieMethodV("SET_ALL_HIGHLIGHTS");
                //PushScaleformMovieMethodParameterBool(true);
                //PushScaleformMovieMethodParameterInt(123);
                //PopScaleformMovieFunctionVoid();


                // move the header down and stuff.
                BeginScaleformMovieMethodV("SHIFT_CORONA_DESC");        // start call function - BeginScaleformMovieMethodV
                PushScaleformMovieFunctionParameterBool(true);          // push frontend title menu up.
                PushScaleformMovieFunctionParameterBool(false);         // show extra top border line
                PopScaleformMovieFunction();                            // end call function


                // Set header title.
                BeginScaleformMovieMethodV("SET_HEADER_TITLE");         // Call set header function
                PushScaleformMovieMethodParameterButtonName(name);      // Set the title
                PushScaleformMovieFunctionParameterBool(false);         // purpose unknown, is always 0 in decompiled scripts.
                PushScaleformMovieFunctionParameterString(subtitle);    // set the subtitle.
                PushScaleformMovieFunctionParameterBool(true);          // purpose unknown, is always 1 in decompiled scripts.
                PopScaleformMovieFunctionVoid();                        // finish the set header function



                // column 0 (settings)
                await BaseScript.Delay(100);

                UpdateSettings();
                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                PushScaleformMovieFunctionParameterInt(0);
                PopScaleformMovieFunctionVoid();


                // column 1 (right side mission details)
                await SetDetailsMissionName("Hunters VS Runners", null, null);

                await BaseScript.Delay(100);

                UpdateDetails();
                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                PushScaleformMovieFunctionParameterInt(1);
                PopScaleformMovieFunctionVoid();

                // column 3 (middle column: players list)
                await BaseScript.Delay(100);
                await UpdateList();

                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT");
                PushScaleformMovieFunctionParameterInt(3);
                PopScaleformMovieFunctionVoid();


                // ACTIVATE THE FIRST COLUMN (FOCUS).
                await BaseScript.Delay(100);

                PushScaleformMovieFunctionN("SET_COLUMN_FOCUS");
                PushScaleformMovieFunctionParameterInt(0);     // column index // _loc7_
                PushScaleformMovieFunctionParameterBool(true); // highlightIndex // _loc6_
                PushScaleformMovieFunctionParameterBool(true); // scriptSetUniqID // _loc4_
                PushScaleformMovieFunctionParameterBool(true); // scriptSetMenuState // _loc5_
                PopScaleformMovieFunctionVoid();

                // Trigger the frontend music. Can be disabled using the option in the menu.
                SoundController.TriggerSuspenseMusicEvent();
            }
            else
            {
                SetFrontendActive(false);
            }
        }
Exemple #7
0
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Daten zur Quellgruppe.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-C Quellgruppe handelt.</returns>
        private bool SendChannel(CableGroup group)
        {
            // Not us
            if (group == null)
            {
                return(false);
            }

            // Validate
            if (FrontendType != FrontendType.Cable)
            {
                throw new DVBException("Expected " + FrontendType.ToString() + " Channel");
            }

            // Helper
            var channel =
                new Channel_C
            {
                Frequency  = group.Frequency,
                SymbolRate = group.SymbolRate,
            };

            // Spectrum inversion
            switch (group.SpectrumInversion)
            {
            case SpectrumInversions.On: channel.Inversion = SpectrumInversion.On; break;

            case SpectrumInversions.Off: channel.Inversion = SpectrumInversion.Off; break;

            case SpectrumInversions.Auto: channel.Inversion = SpectrumInversion.Auto; break;

            default: channel.Inversion = SpectrumInversion.Auto; break;
            }

            // Modulation
            switch (group.Modulation)
            {
            case CableModulations.QAM16: channel.Qam = Qam.Qam16; break;

            case CableModulations.QAM32: channel.Qam = Qam.Qam32; break;

            case CableModulations.QAM64: channel.Qam = Qam.Qam64; break;

            case CableModulations.QAM128: channel.Qam = Qam.Qam128; break;

            case CableModulations.QAM256: channel.Qam = Qam.Qam256; break;

            default: channel.Qam = Qam.Qam64; break;
            }

            // Check supported modes
            switch (group.Bandwidth)
            {
            case Bandwidths.Six: channel.Bandwidth = BandwidthType.Six; break;

            case Bandwidths.Seven: channel.Bandwidth = BandwidthType.Seven; break;

            case Bandwidths.Eight: channel.Bandwidth = BandwidthType.Eight; break;

            case Bandwidths.NotDefined: channel.Bandwidth = BandwidthType.None; break;

            default: channel.Bandwidth = BandwidthType.Auto; break;
            }

            // Process
            CheckChannel(CDVBFrontend_SetChannel(m_Class.ClassPointer, channel, false));

            // Check up for synchronisation
            Channel_C val1, val2;

            // Get channel twice
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out val1));
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out val2));

            // Did it
            return(true);
        }
Exemple #8
0
        /// <summary>
        /// Wählt eine Quellgruppe aus.
        /// </summary>
        /// <param name="group">Díe Daten der Quellgruppe.</param>
        /// <param name="location">Die Wahl des Ursprungs, über den die Quellgruppe empfangen werden kann.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-S Quellgruppe handelt.</returns>
        private bool SendChannel(SatelliteGroup group, SatelliteLocation location)
        {
            // Not us
            if (location == null)
            {
                return(false);
            }
            if (group == null)
            {
                return(false);
            }

            // Validate
            if (FrontendType != FrontendType.Satellite)
            {
                throw new DVBException("Expected " + FrontendType.ToString() + " Channel");
            }

            // Create channel
            var channel =
                new Channel_S
            {
                Inversion  = SpectrumInversion.Auto,
                SymbolRate = group.SymbolRate,
                Frequency  = group.Frequency,
            };

            // Attach to the DiSEqC setting
            var selector = StandardDiSEqC.FromSourceGroup(group, location);

            // See if the message is different from the last one
            if (!selector.Equals(m_lastMessage))
            {
                // Remember
                m_lastMessage = selector.Clone();

                // As long as necessary
                for (int nCount = selector.Repeat; nCount-- > 0; Thread.Sleep(120))
                {
                    // Send it
                    DVBException.ThrowOnError(CDVBFrontend_SendDiSEqCMsg(m_Class.ClassPointer, selector.Request, (byte)selector.Request.Length, selector.Burst), "Could not send DiSEqC Message");

                    // Set repeat flag
                    if (selector.Request.Length > 0)
                    {
                        selector.Request[0] |= 1;
                    }
                }
            }

            // Calculated items
            channel.b22kHz = (group.Frequency >= location.SwitchFrequency) ? 1 : 0;
            channel.LOF    = (0 == channel.b22kHz) ? location.Frequency1 : location.Frequency2;

            // Power modes
            switch (group.Polarization)
            {
            case Polarizations.Horizontal: channel.LNBPower = PowerMode.Horizontal; break;

            case Polarizations.Vertical: channel.LNBPower = PowerMode.Vertical; break;

            case Polarizations.NotDefined: channel.LNBPower = PowerMode.Off; break;

            default: throw new ArgumentException(group.Polarization.ToString(), "Polarization");
            }

            // Process
            CheckChannel(CDVBFrontend_SetChannel(m_Class.ClassPointer, channel, false));

            // Check up for synchronisation
            Channel_S val1, val2;

            // Get channel twice
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out val1));
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out val2));

            // Did it
            return(true);
        }