public static void setupres() {
        if (ResCache.global != null)
            Resource.addcache(ResCache.global);
        if (Config.resurl != null)
            Resource.addurl(Config.resurl);
        if (ResCache.global != null) {
            try {
                Resource.loadlist(ResCache.global.fetch("tmp/allused"), -10);
            } catch (IOException e) {
            }
        }
        if (!Config.nopreload) {
            try {
                InputStream pls;
                pls = Resource.class.getResourceAsStream("res-preload");
                if (pls != null)
                    Resource.loadlist(pls, -5);
                pls = Resource.class.getResourceAsStream("res-bgload");
                if (pls != null)
                    Resource.loadlist(pls, -10);
            } catch (IOException e) {
                throw (new Error(e));
            }
        }
    }