Exemplo n.º 1
0
        public static void InstallDetour()
        {
            MethodBase origFunction = typeof(HierarchyUtil).GetMethod("CompileID", BindingFlags.Static | BindingFlags.Public);
            MethodBase newFunction  = typeof(SDTest).GetMethod("NewCompileID", BindingFlags.Static | BindingFlags.Public);

            compileIDDetour = new AsmUtils.Detour(origFunction, newFunction);
            compileIDDetour.Install();
        }
Exemplo n.º 2
0
        internal static void TuneFacilities()
        {
            MethodInfo originalCall = typeof(EditorEnumExtensions).GetMethod("GetFacility", BindingFlags.Public | BindingFlags.Static);
            MethodInfo improvedCall = typeof(KKSpaceCenter).GetMethod("GetFacility", BindingFlags.Public | BindingFlags.Static);

            AsmUtils.Detour getFacDetour = new AsmUtils.Detour(originalCall, improvedCall);
            getFacDetour.Install();
        }
Exemplo n.º 3
0
        internal static void PrepareSystem()
        {
            MethodBase oldFindVesselFunction = typeof(ShipConstruction).GetMethods(BindingFlags.Static | BindingFlags.Public)
                                               .Where(mi => mi.Name == "FindVesselsLandedAt" && mi.GetParameters().Length == 6).FirstOrDefault();
            MethodBase newFindVesselFunction = typeof(LaunchSiteChecks).GetMethod("FindVesselsLandedAtKK", BindingFlags.Static | BindingFlags.Public);

            findVesselDetour = new AsmUtils.Detour(oldFindVesselFunction, newFindVesselFunction);
            findVesselDetour.Install();

            MethodBase oldFindVesselFunction2 = typeof(ShipConstruction).GetMethods(BindingFlags.Static | BindingFlags.Public)
                                                .Where(mi => mi.Name == "FindVesselsLandedAt" && mi.GetParameters().Length == 2).FirstOrDefault();
            MethodBase newFindVesselFunction2 = typeof(LaunchSiteChecks).GetMethod("FindVesselsLandedAt2", BindingFlags.Static | BindingFlags.Public);

            findVesselDetour2 = new AsmUtils.Detour(oldFindVesselFunction2, newFindVesselFunction2);
            findVesselDetour2.Install();


            CPLC.RegisterCheck(GetSizeCheck);
            CPLC.RegisterCheck(GetMassCheck);
            CPLC.RegisterCheck(GetPartCheck);
        }