Beispiel #1
0
        private static void FindScoreSubmission(ClassObj @class, MethodDef methodDef, IList <Instruction> instructions)
        {
            var containsExit     = false;
            var containsDateTime = false;

            foreach (var insn in instructions)
            {
                if (insn.OpCode != OpCodes.Call)
                {
                    continue;
                }
                if (insn.ToString().EndsWith("System.Environment::Exit(System.Int32)"))
                {
                    containsExit = true;
                }
                if (containsExit && insn.ToString().Contains("System.DateTime::get_Now()"))
                {
                    containsDateTime = true;
                }
            }

            if (containsDateTime)
            {
                @class.AddMethod("SubmitScore", methodDef.Name);
            }
        }
Beispiel #2
0
        public override void GetMethods(string className, TypeDef type, IList <MethodDef> methodDefs)
        {
            ClassObj @class = null;

            foreach (var method in methodDefs)
            {
                var strings = GetMethodStrings(method);

                if (!ClrHelper.MatchesSig(method, "Mods", "Boolean", "Boolean", "Boolean", "Boolean"))
                {
                    continue;
                }

                if (!strings.Contains("DoubleTime") || !strings.Contains("DT") ||
                    !strings.Contains("None") || !strings.Contains("Cinema"))
                {
                    continue;
                }

                @class = MappingManager.GetClass(UnobfuscatedName)
                         .OrElse(new ClassObj(UnobfuscatedName, className));
                MappingManager.AddClass(@class);
                @class.AddMethod("GetJoinedMods", method.Name); //Mods mods, bool abreviated, bool displayNone, bool parens, bool ?space?
            }

            if (@class == null)
            {
                return;
            }

            foreach (var method in methodDefs)
            {
                if (!ClrHelper.MatchesSig(method, "Mods"))
                {
                    continue;
                }

                if (method.Body.Instructions.Count == 5)
                {
                    @class.AddMethod("IsModActive", method.Name); //Mods mods
                }
            }
        }
        private void FindSubmitRequest(ClassObj @class, IList <MethodDef> methodDefs)
        {
            foreach (var method in methodDefs)
            {
                if (!HasStrings(method, "https://osu.ppy.sh/web/osu-submit-modular.php"))
                {
                    continue;
                }

                @class.AddMethod("SubmitRequest", method.Name);
                return;
            }
        }
Beispiel #4
0
        private static void FindAddCallback(ClassObj clazz, IList <MethodDef> methodDefs)
        {
            foreach (var method in methodDefs)
            {
                var insn          = method.Body.Instructions;
                var isAddCallback = insn.Any(f => f.ToString().Contains("Delegate::Combine"));
                if (!isAddCallback)
                {
                    continue;
                }

                clazz.AddMethod("AddToggleCallback", method.Name);

                MappingManager.AddClass(new ClassObj("CheckboxCheckedDelegate", method.MethodSig.Params[0].FullName));
                return;
            }
        }
Beispiel #5
0
        public override void GetMethods(string className, TypeDef type, IList <MethodDef> methodDefs)
        {
            var HasCtor = methodDefs.Where(m => ClrHelper.MatchesSig(m,
                                                                     "String", "Single", "Vector2", "Vector2", "Single", "Boolean", "Color", "Boolean"));
            var ContainsStrings = methodDefs.Where(m => HasStrings(m, "Text: "));

            //string text, float textSize, Vector2 startPosition, Vector2 bounds, float drawDepth, bool alwaysDraw, Color colour, bool shadow = true
            if (!HasCtor.Any() || !ContainsStrings.Any())
            {
                return;
            }

            var clazz = new ClassObj("CompLabel", className);

            MappingManager.AddClass(clazz);

            var str = methodDefs.First(m => ClrHelper.MatchesSig(m, "String"));

            clazz.AddMethod("SetText", str.Name); //MethodSig (1): String
        }
        private void FindKeyPressMethod(ClassObj classObj, IList <MethodDef> methodDefs)
        {
            var keyPressMethod = methodDefs.First(m => HasStrings(m, "Skin reload queued."));

            classObj.AddMethod("OnKeyPress", keyPressMethod.Name);
        }
        private void FindSetTooltip(ClassObj classObj, IList <MethodDef> methodDefs)
        {
            var setTooltipMethod = methodDefs.First(m => ClrHelper.MatchesSig(m, "String"));

            classObj.AddMethod("SetTooltip", setTooltipMethod.Name);
        }