Advertisement
Guest User

Cydia Main

a guest
Jun 13th, 2013
718
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. package com.example.cydiaexample;
  2.  
  3. import java.lang.reflect.Method;
  4. import android.util.Log;
  5. import com.saurik.substrate.MS;
  6.  
  7. public class Main {
  8.    static void initialize() {
  9.       MS.hookClassLoad("android.content.res.Resources",
  10.             new MS.ClassLoadHook() {
  11.                public void classLoaded(Class<?> resources) {
  12.  
  13.                   Method getColor;
  14.                   try {
  15.                      getColor = resources.getMethod("getColor",
  16.                         Integer.TYPE);
  17.                   } catch (NoSuchMethodException e) {
  18.                      getColor = null;
  19.                   }
  20.  
  21.                   if (getColor != null) {
  22.                      final MS.MethodPointer old = new MS.MethodPointer();
  23.                      MS.hookMethod(resources, getColor,
  24.                            new MS.MethodHook() {
  25.                               public Object invoked(Object resources,
  26.                                 Object... args)
  27.                                 throws Throwable {
  28.                                    int color = (Integer) old.invoke(resources, args);
  29.                        return color & ~0x0000ff00 | 0x00ff0000;
  30.                                     }                  
  31.                            }, old);
  32.                   }
  33.                }
  34.             });
  35.    }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement