public Oppai.pp_calc GetRealTimePP(int end_time, ModsInfo mods, int n100, int n50, int nmiss, int max_combo)
        {
            int pos = GetPosition(end_time);

            bool need_update = false;

            need_update = need_update || _pos != pos;
            need_update = need_update || _n100 != n100;
            need_update = need_update || _n50 != n50;
            need_update = need_update || _nmiss != nmiss;
            need_update = need_update || _max_combo != max_combo;

            if (need_update)
            {
                _pos       = pos;
                _n100      = n100;
                _n50       = n50;
                _nmiss     = nmiss;
                _max_combo = max_combo;

                Oppai.rtpp_params args;
                args.combo = max_combo;
                args.mods  = (uint)mods.Mod;
                args.n100  = n100;
                args.n50   = n50;
                args.nmiss = nmiss;

                if (!Oppai.get_ppv2(m_beatmap_raw, (uint)pos, ref args, false, null, ref _rtpp_result))
                {
                    return(Oppai.pp_calc.Empty);
                }
            }

            return(_rtpp_result);
        }
        protected PPTuple GetPPFromOppai(ModsInfo mods, OsuPlayMode mode)
        {
            if (Beatmap == null)
            {
                return(PPTuple.Empty);
            }

            Oppai.Beatmap = Beatmap;

            PPTuple pp_tuple;
            var     result = Oppai.GetMaxPP(mods, mode);

            pp_tuple.MaxPP         = result.total;
            pp_tuple.MaxAimPP      = result.aim;
            pp_tuple.MaxSpeedPP    = result.speed;
            pp_tuple.MaxAccuracyPP = result.acc;

            AccuracyRound(Accuracy, Beatmap.ObjectsCount, CountMiss, out int n300, out int n100, out int n50);

            result = Oppai.GetIfFcPP(mods, n300, n100, n50, mode);
            pp_tuple.FullComboPP         = result.total;
            pp_tuple.FullComboAimPP      = result.aim;
            pp_tuple.FullComboSpeedPP    = result.speed;
            pp_tuple.FullComboAccuracyPP = result.acc;

            result = Oppai.GetRealTimePP(Time, mods, Count100, Count50, CountMiss, MaxCombo, mode);
            pp_tuple.RealTimePP         = result.total;
            pp_tuple.RealTimeAimPP      = result.aim;
            pp_tuple.RealTimeSpeedPP    = result.speed;
            pp_tuple.RealTimeAccuracyPP = result.acc;

            return(pp_tuple);
        }
        /*
         * 因为MemoryReader扫Status比Mod快,如果使用Status来做是否开始打图的依据会无法及时获取当前MOD的信息.因此按Mod来判断是否开始打图,null为非打图状态
         */

        public override void OnCurrentModsChange(ModsInfo mod)
        {
            if (current_mod.Mod == mod.Mod)
            {
                return;
            }

            current_mod = mod;

            if (mod.Mod == ModsInfo.Mods.Unknown)
            {
                //Not Playing
                //RefPlugin.OnBeatmapChanged(null);
            }
            else
            {
                //Start to play
                //if (mod.Mod!=ModsInfo.Mods.None&&current_status == OsuStatus.Playing)
                {
                    var beatmap = GetCurrentBeatmap();

                    beatmap.OutputType = CurrentOutputType = OutputType.Play;

                    RefPanelPlugin.OnBeatmapChanged(new BeatmapChangedParameter()
                    {
                        beatmap = beatmap
                    });
                }
            }
        }
Beispiel #4
0
        public override void OnCurrentModsChange(ModsInfo mod)
        {
            //如果mod相同或者mod是unknown的就不管了
            if (current_mod == mod || mod.Mod.HasFlag(OsuRTDataProvider.Mods.ModsInfo.Mods.Unknown))
            {
                return;
            }
            current_mod = mod;

            //在打图过程中mod变了,那可能就是ortdp要背锅了.jpg
            if (CurrentOutputType == OutputType.Play)
            {
                return;
            }

            //在选图界面改变Mods会输出,会重新计算PP并输出相关信息
            var beatmap = GetCurrentBeatmap();

            beatmap.OutputType = CurrentOutputType;

            RefPanelPlugin.OnBeatmapChanged(new BeatmapChangedParameter()
            {
                beatmap = beatmap
            });
        }
        public Oppai.pp_calc GetIfFcPP(ModsInfo mods, int n300, int n100, int n50, int nmiss)
        {
            double acc = Oppai.acc_calc(n300, n100, n50, nmiss) * 100.0;

            Oppai.acc_round(acc, m_cache.nobjects, nmiss, out n300, out n100, out n50);

            bool need_update = false;

            need_update = need_update || _fc_n100 != n100;
            need_update = need_update || _fc_n50 != n50;


            if (need_update)
            {
                _fc_n100 = n100;
                _fc_n50  = n50;

                Oppai.rtpp_params args;
                args.combo = Oppai.FullCombo;
                args.mods  = (uint)mods.Mod;
                args.n100  = n100;
                args.n50   = n50;
                args.nmiss = 0;

                Oppai.get_ppv2(m_beatmap_raw, (uint)m_beatmap_raw.Length, ref args, true, m_cache, ref _fc_result);
            }

            return(_fc_result);
        }
Beispiel #6
0
        public static ModsInfo ToModsInfo(this uint mods)
        {
            ModsInfo m = new ModsInfo();

            m.Mod = (ModsInfo.Mods)mods;
            return(m);
        }
Beispiel #7
0
        public void OutputBeatmapInfomation(BeatmapEntry current_beatmap, ModsInfo mod)
        {
            sw.Restart();

            string beatmap_osu_file = current_beatmap.OsuFilePath;

            if (string.IsNullOrEmpty(beatmap_osu_file))
            {
                return;
            }
            string osuFileContent = File.ReadAllText(beatmap_osu_file);
            string beatmap_folder = Directory.GetParent(beatmap_osu_file).FullName;

            if (!OutputInfomation(current_beatmap.OutputType, current_beatmap, mod))
            {
                Log.Warn($"Cant output info {current_beatmap.BeatmapSetId}.");
                return;
            }

            #region OutputBackgroundImage

            var    match  = Regex.Match(osuFileContent, @"\""((.+?)\.((jpg)|(png)|(jpeg)))\""", RegexOptions.IgnoreCase);
            string bgPath = beatmap_folder + @"\" + match.Groups[1].Value;

            if (bgPath != current_bg_file_path)
            {
                OutputBackgroundImage(bgPath, current_beatmap.OutputType);
            }

            current_bg_file_path = bgPath;

            #endregion OutputBackgroundImage

            #region Mods Ouptut

            if (EnableOutputModPicture.ToBool() && mods_pic_output == null)
            {
                //init mods_pic_output
                TryCreateModsPictureGenerator(out mods_pic_output);
            }

            if (mods_pic_output != null && mod != prev_mods)
            {
                prev_mods = mod;

                var mod_list = mod.Name.Split(',');

                using (Bitmap result = mods_pic_output.GenerateModsPicture(mod_list))
                {
                    result.Save(OutputModImageFilePath, ImageFormat.Png);
                }
            }

            #endregion Mods Ouptut

            EventBus.RaiseEvent(new OutputInfomationEvent(current_beatmap.OutputType));

            Log.Output($"Done!time:{sw.ElapsedMilliseconds}ms output_type:{current_beatmap.OutputType} setid:{current_beatmap.BeatmapSetId} mod:{mod}");
        }
 public void SetCurrentMods(ModsInfo mods)
 {
     Invoke(new Setter <ModsInfo>((value) =>
     {
         this.CurrentMods = value;
         IO.CurrentIO.Write($"[GIF Player] Set mods: {CurrentMods}");
         this.ModifierDelayMultiply = value.TimeRate;
     }), mods);
 }
        public bool Output(OutputType output_type, string osu_file_path, ModsInfo mods, Dictionary <string, object> extra)
        {
            if (output_type == OutputType.Listen && String.IsNullOrWhiteSpace(osu_file_path))
            {
                ListenClean();
                return(true);
            }

            return(InfoOutputter.TrigOutput(output_type, osu_file_path, mods, extra));
        }
Beispiel #10
0
        private void ApplyPPCalculate(int mode, ModsInfo mods, float acc)
        {
            Debug.Assert(pp_instance != null);

            pp_instance.info.Acc  = acc;
            pp_instance.info.Mods = (OppaiWNet.Wrap.Mods)(int) mods.Mod;
            pp_instance.info.Mode = mode;

            pp_instance.info.ApplyChange();
        }
 private object MakeModsInfo(ModsInfo mods)
 {
     return(new
     {
         timeRate = mods.TimeRate,
         shortName = mods.ShortName,
         name = mods.Name,
         mods = mods.Mod
     });
 }
Beispiel #12
0
        private bool OutputInfomation(OutputType output_type, BeatmapEntry entry, ModsInfo mods)
        {
            var extra = entry.ExtraParam ?? new Dictionary <string, object>();

            extra.Add("osu_file_path", entry.OsuFilePath);
            extra.Add("beatmap_id", entry.BeatmapId.ToString());
            extra.Add("beatmap_setid", entry.BeatmapSetId.ToString());

            return(PPShowPluginInstance.Output(output_type, entry.OsuFilePath, mods, extra));
        }
        private static ModsInfo FilteVailedMod(ModsInfo mods)
        {
            ModsInfo result = default;

            foreach (var vaild_mod in (from mod in OPPAI_SUPPORT_MODS where mods.HasMod(mod) select mod))
            {
                result.Mod |= vaild_mod;
            }

            return(result);
        }
Beispiel #14
0
        private void ListenerManagerOnModsChanged(ModsInfo mods)
        {
            Mods.ClearMod();
            foreach (var mod in ModList.FromInteger((int)mods.Mod).Mods.Where(m => m.CheckAndSetForMode(CurrentMode)))
            {
                OsuGameMode?mode = null;
                if (CurrentMode is ILegacyMode legacyMode)
                {
                    mode = legacyMode.LegacyMode;
                }
                Mods.Add(mod, mode);
            }

            CanFail = Mods.AllowsFail;
        }
Beispiel #15
0
        public void Clear()
        {
            _pos         = -1;
            _n100        = -1;
            _n50         = -1;
            _nmiss       = -1;
            _max_combo   = -1;
            _rtpp_result = Oppai.pp_calc.Empty;

            _fc_n100   = -1;
            _fc_n50    = -1;
            _fc_result = Oppai.pp_calc.Empty;

            _max_mods   = ModsInfo.Empty;
            _max_result = Oppai.pp_calc.Empty;
        }
Beispiel #16
0
        private bool ApplyBeatmapInfomationforOsuRTDataProvider(BeatmapEntry current_beatmap)
        {
            RealtimeDataProvideWrapperBase OsuRTDataProviderWrapperInstance = SourceWrapper as RealtimeDataProvideWrapperBase;

            ModsInfo mod = default(ModsInfo);

            //添加Mods
            if (OsuRTDataProviderWrapperInstance.current_mod.Mod != OsuRTDataProvider.Mods.ModsInfo.Mods.Unknown)
            {
                //处理不能用的PP
                mod.Mod = (ModsInfo.Mods)((uint)OsuRTDataProviderWrapperInstance.current_mod.Mod);
            }

            OutputBeatmapInfomation(current_beatmap, mod);

            return(true);
        }
        public DisplayerController(OsuListenerManager mamger)
        {
            var listenerManager = mamger;

            listenerManager.OnCount300Changed        += c => _n300 = c;
            listenerManager.OnCountGekiChanged       += c => _ngeki = c;
            listenerManager.OnCountKatuChanged       += c => _nkatu = c;
            listenerManager.OnCount100Changed        += c => _n100 = c;
            listenerManager.OnCount50Changed         += c => _n50 = c;
            listenerManager.OnCountMissChanged       += c => _nmiss = c;
            listenerManager.OnScoreChanged           += s => _score = s;
            listenerManager.OnErrorStatisticsChanged += es => _error_statistics = es;
            listenerManager.OnPlayerChanged          += p => _playername = p;

            listenerManager.OnComboChanged += (combo) =>
            {
                if (_status != OsuStatus.Playing)
                {
                    return;
                }
                int fullCombo = GetFullCombo(GetCalculator(_mode));
                if (combo <= (fullCombo == 0 ? 20000 : fullCombo))
                {
                    _combo    = combo;
                    _maxCombo = Math.Max(_maxCombo, _combo);
                }
            };

            listenerManager.OnModsChanged += (mods) =>
            {
                if (Setting.IgnoreTouchScreenDecrease)
                {
                    mods.Mod = (mods.Mod & ~ModsInfo.Mods.TouchDevice);
                }
                _curMods = mods;
                if (_status != OsuStatus.Playing)
                {
                    GetCalculator(_mode).ClearCache();
                }
            };

            listenerManager.OnPlayModeChanged    += RtppOnPlayModeChanged;
            listenerManager.OnStatusChanged      += RtppOnStatusChanged;
            listenerManager.OnBeatmapChanged     += RtppOnBeatmapChanged;
            listenerManager.OnPlayingTimeChanged += RtppOnPlayingTimeChanged;
        }
        public override void OnCurrentModsChange(ModsInfo mod)
        {
            if (current_mod == mod)
            {
                return;
            }
            current_mod = mod;

            if (CurrentOutputType)
            {
                return;
            }

            //选图界面改变Mods会输出

            this.FireEvent(OsuFilePath, this.beatmapSetID, this.beatmapID, CurrentOutputType);
        }
Beispiel #19
0
        private bool ApplyBeatmapInfomationforDifficultParamModifyPlugin(BeatmapEntry current_beatmap)
        {
            var wrapper = SourceWrapper as DifficultParamModifyPluginSourceWrapper;

            ModsInfo mod = default(ModsInfo);

            //添加Mods
            if (wrapper.CurrentMod.Mod != Mods.ModsInfo.Mods.Unknown)
            {
                //处理不能用的PP
                mod.Mod = wrapper.CurrentMod.Mod;
            }

            OutputBeatmapInfomation(current_beatmap, mod);

            return(true);
        }
Beispiel #20
0
        public void Clear()
        {
            _realTimeData = new pp_params();

            _pos        = -1;
            _n100       = -1;
            _n50        = -1;
            _nmiss      = -1;
            _maxCombo   = -1;
            _rtppResult = pp_calc.Empty;

            _fcN100   = -1;
            _fcN50    = -1;
            _fcResult = pp_calc.Empty;

            _maxMods   = ModsInfo.Empty;
            _maxResult = pp_calc.Empty;
        }
        public PPControl(OsuListenerManager mamger, int?id)
        {
            m_listener_manager = mamger;

            m_listener_manager.OnModsChanged    += (mods) => m_cur_mods = mods;
            m_listener_manager.On300HitChanged  += c => m_n300 = c;
            m_listener_manager.On100HitChanged  += c => m_n100 = c;
            m_listener_manager.On50HitChanged   += c => m_n50 = c;
            m_listener_manager.OnMissHitChanged += c => m_nmiss = c;
            m_listener_manager.OnStatusChanged  += (last, cur) =>
            {
                m_status = cur;
                if (cur == OsuStatus.Listening || cur == OsuStatus.Editing)//Clear Output
                {
                    m_combo     = 0;
                    m_max_combo = 0;
                    m_n100      = 0;
                    m_n50       = 0;
                    m_nmiss     = 0;
                    foreach (var p in m_displayers)
                    {
                        p.Value.Clear();
                    }
                    m_beatmap_reader?.Clear();
                }
            };

            m_listener_manager.OnComboChanged += (combo) =>
            {
                if (m_status != OsuStatus.Playing)
                {
                    return;
                }
                if (combo <= m_beatmap_reader?.FullCombo)
                {
                    m_combo     = combo;
                    m_max_combo = Math.Max(m_max_combo, m_combo);
                }
            };

            m_listener_manager.OnBeatmapChanged     += RTPPOnBeatmapChanged;
            m_listener_manager.OnPlayingTimeChanged += RTPPOnPlayingTimeChanged;
        }
Beispiel #22
0
        public double GetIfFCPPMania(ModsInfo mods, int curr_score, double curr_acc)
        {
            bool need_update = false;

            need_update = need_update || mods != _max_mods;

            if (need_update)
            {
                _max_mods = mods;

                ppmania_params args;
                args.mods  = (uint)mods.Mod;
                args.score = curr_score; // Provide current score
                args.acc   = curr_acc;

                get_ppmania(m_beatmap_raw, (uint)m_beatmap_raw.Length, ref args, ref _max_result);
            }
            return(_max_result);
        }
Beispiel #23
0
        public double GetMaxPPMania(ModsInfo mods)
        {
            bool need_update = false;

            need_update = need_update || mods != _max_mods;

            if (need_update)
            {
                _max_mods = mods;

                ppmania_params args;
                args.mods  = (uint)mods.Mod;
                args.score = 1000000;
                args.acc   = 100.0;

                get_ppmania(m_beatmap_raw, (uint)m_beatmap_raw.Length, ref args, ref _max_result);
            }
            return(_max_result);
        }
        public DisplayerController(OsuListenerManager mamger)
        {
            var listenerManager = mamger;

            listenerManager.OnCount300Changed  += c => _n300 = c;
            listenerManager.OnCountGekiChanged += c => _ngeki = c;
            listenerManager.OnCountKatuChanged += c => _nkatu = c;
            listenerManager.OnCount100Changed  += c => _n100 = c;
            listenerManager.OnCount50Changed   += c => _n50 = c;
            listenerManager.OnCountMissChanged += c => _nmiss = c;
            listenerManager.OnScoreChanged     += s => _score = s;
            listenerManager.OnComboChanged     += (combo) =>
            {
                if (_status != OsuStatus.Playing)
                {
                    return;
                }
                if (combo <= ((_ppCalculator as OppaiPerformanceCalculator)?.Oppai.FullCombo ?? 20000))
                {
                    _combo    = combo;
                    _maxCombo = Math.Max(_maxCombo, _combo);
                }
            };

            listenerManager.OnModsChanged += (mods) =>
            {
                if (Setting.IgnoreTouchScreenDecrease)
                {
                    mods.Mod = (mods.Mod & ~ModsInfo.Mods.TouchDevice);
                }
                _curMods = mods;
                if (_status != OsuStatus.Playing)
                {
                    _ppCalculator.ClearCache();
                }
            };

            listenerManager.OnPlayModeChanged    += RtppOnPlayModeChanged;
            listenerManager.OnStatusChanged      += RtppOnStatusChanged;
            listenerManager.OnBeatmapChanged     += RtppOnBeatmapChanged;
            listenerManager.OnPlayingTimeChanged += RtppOnPlayingTimeChanged;
        }
Beispiel #25
0
        public double GetRealTimePPMania(ModsInfo mods, int offset, int curr_score, double curr_acc)
        {
            bool need_update = false;

            need_update = need_update || mods != _max_mods;

            if (need_update)
            {
                _max_mods = mods;

                ppmania_params args;
                args.mods  = (uint)mods.Mod;
                args.score = curr_score; // Provide current score
                args.acc   = curr_acc;

                // m_beatmap_raw should be limited to the given offset
                get_ppmania(m_beatmap_raw, (uint)m_beatmap_raw.Length, ref args, ref _max_result);
            }
            return(_max_result);
        }
Beispiel #26
0
        public pp_calc GetMaxPP(ModsInfo mods, OsuPlayMode mode)
        {
            bool needUpdate = mods != _maxMods;

            if (needUpdate)
            {
                _maxMods = mods;

                rtpp_params args;
                args.combo = FULL_COMBO;
                args.mods  = (uint)mods.Mod;
                args.n100  = 0;
                args.n50   = 0;
                args.nmiss = 0;
                args.mode  = (uint)mode;

                //Cache Beatmap
                get_ppv2(Beatmap.RawData, (uint)Beatmap.RawData.Length, ref args, false, _cache, ref _maxResult);
            }
            return(_maxResult);
        }
        public Oppai.pp_calc GetMaxPP(ModsInfo mods)
        {
            bool need_update = false;

            need_update = need_update || mods != _max_mods;

            if (need_update)
            {
                _max_mods = mods;

                Oppai.rtpp_params args;
                args.combo = Oppai.FullCombo;
                args.mods  = (uint)mods.Mod;
                args.n100  = 0;
                args.n50   = 0;
                args.nmiss = 0;

                //Cache Beatmap
                Oppai.get_ppv2(m_beatmap_raw, (uint)m_beatmap_raw.Length, ref args, false, m_cache, ref _max_result);
            }
            return(_max_result);
        }
        public override PPTuple GetPP(ModsInfo mods)
        {
            if (Beatmap == null)
            {
                return(PPTuple.Empty);
            }
            if (Beatmap.Mode != s_mode)
            {
                return(PPTuple.Empty);
            }

            if (!_init || m_mods != mods)
            {
                m_mods = mods;
                CalculateStrainValues(Beatmap.ObjectsCount);
                m_beatmap_stars = CalculateDifficulty(Beatmap.ObjectsCount) * STAR_SCALING_FACTOR;
                CalculatePerformance(m_beatmap_stars, 1000000, 100.0, Beatmap.ObjectsCount, out tuple.MaxPP, out tuple.MaxSpeedPP, out tuple.MaxAccuracyPP);
                Sync.Tools.IO.CurrentIO.Write($"Difficulty:{m_beatmap_stars}*");
                _init = true;
            }

            int nobjects = GetCurrentObjectCount(Time);

            if (nobjects != _nobjects)
            {
                ReinitializeObjects();

                CalculateStrainValues(nobjects);
                double stars = CalculateDifficulty(nobjects) * STAR_SCALING_FACTOR;

                double acc = ManiaCalculateAccuracy(Count300, CountGeki, CountKatu, Count100, Count50, CountMiss) * 100.0;

                CalculatePerformance(stars, RealScore, acc, nobjects, out tuple.RealTimePP, out tuple.RealTimeSpeedPP, out tuple.RealTimeAccuracyPP);
                _nobjects = nobjects;
            }
            //No Fc pp

            return(tuple);
        }
        /*
         * 因为MemoryReader扫Status比Mod快,如果使用Status来做是否开始打图的依据会无法及时获取当前MOD的信息.因此按Mod来判断是否开始打图,null为非打图状态
         */

        public override void OnCurrentModsChange(ModsInfo mod)
        {
            if (current_mod.Mod == mod.Mod)
            {
                return;
            }

            current_mod = mod;

            if (mod.Mod == ModsInfo.Mods.Unknown)
            {
                //Not Playing
                //RefPlugin.OnBeatmapChanged(null);
            }
            else
            {
                //Start to play
                //if (mod.Mod!=ModsInfo.Mods.None&&current_status == OsuStatus.Playing)
                {
                    FireEvent(OsuFilePath, this.beatmapSetID, this.beatmapID, CurrentOutputType);
                }
            }
        }
Beispiel #30
0
        public pp_calc GetMaxPP(ModsInfo mods, OsuPlayMode mode)
        {
            bool need_update = false;

            need_update = need_update || mods != _max_mods;

            if (need_update)
            {
                _max_mods = mods;

                Oppai.rtpp_params args;
                args.combo = Oppai.FULL_COMBO;
                args.mods  = (uint)mods.Mod;
                args.n100  = 0;
                args.n50   = 0;
                args.nmiss = 0;
                args.mode  = (uint)mode;

                //Cache Beatmap
                Oppai.get_ppv2(Beatmap.RawData, (uint)Beatmap.RawData.Length, ref args, false, m_cache, ref _max_result);
            }
            return(_max_result);
        }