Exemple #1
0
def main(mcp_dir):
    print 'Using mcp dir: %s' % mcp_dir
    print 'Using base dir: %s' % base_dir
    sys.path.append(mcp_dir)
    os.chdir(mcp_dir)

    reobf = os.path.join(mcp_dir, 'reobf', 'minecraft')
    try:
        pass
        shutil.rmtree(reobf)
    except OSError:
        pass

    print("Recompiling...")
    from runtime.mcp import recompile_side, reobfuscate_side
    from runtime.commands import Commands, CLIENT
    commands = Commands(None, verify=True)
    recompile_side(commands, CLIENT)

    print("Reobfuscating...")
    commands.creatergcfg(reobf=True,
                         keep_lvt=True,
                         keep_generics=True,
                         srg_names=False)
    reobfuscate_side(commands, CLIENT)
    create_install(mcp_dir)
Exemple #2
0
def main(mcp_dir):
    print 'Using mcp dir: %s' % mcp_dir
    print 'Using base dir: %s' % base_dir
    
    print("Refreshing dependencies...")
    download_deps( mcp_dir, False )
    
    sys.path.append(mcp_dir)
    os.chdir(mcp_dir)

    reobf = os.path.join(mcp_dir,'reobf','minecraft')
    try:
        pass
        shutil.rmtree(reobf)
    except OSError:
        pass
        
    # Update Minecrift version
    minecraft_java_file = os.path.join(mcp_dir,'src','minecraft','net','minecraft','client','Minecraft.java')
    if os.path.exists(minecraft_java_file):
        print "Updating Minecraft.java with Minecrift version: [Minecrift %s %s] %s" % ( minecrift_version_num, minecrift_build, minecraft_java_file ) 
        replacelineinfile( minecraft_java_file, "public final String minecriftVerString",     "    public final String minecriftVerString = \"Minecrift %s %s\";\n" % (minecrift_version_num, minecrift_build) );        

    print("Recompiling...")
    from runtime.mcp import recompile_side, reobfuscate_side
    from runtime.commands import Commands, CLIENT
    commands = Commands(None, verify=True)
    recompile_side( commands, CLIENT)

    print("Reobfuscating...")
    commands.creatergcfg(reobf=True, keep_lvt=True, keep_generics=True, srg_names=False)
    reobfuscate_side( commands, CLIENT )
    create_install( mcp_dir )
Exemple #3
0
def main(mcp_dir):
    print 'Using mcp dir: %s' % mcp_dir
    print 'Using base dir: %s' % base_dir
    
    print("Refreshing dependencies...")
    download_deps( mcp_dir, False )
    
    sys.path.append(mcp_dir)
    os.chdir(mcp_dir)

    reobf = os.path.join(mcp_dir,'reobf','minecraft')
    srg = os.path.join(mcp_dir,'class','srg')
    obf = os.path.join(mcp_dir,'class','obf')
    
    from runtime.commands import reallyrmtree

    reallyrmtree(reobf)
    reallyrmtree(srg)
    reallyrmtree(obf)
		       
    # Update Minecrift version
    minecraft_java_file = os.path.join(mcp_dir,'src','minecraft','net','minecraft','client','Minecraft.java')
    if os.path.exists(minecraft_java_file):
        print "Updating Minecraft.java with Vivecraft version: [Vivecraft %s %s] %s" % ( minecrift_version_num, minecrift_build, minecraft_java_file ) 
        replacelineinfile( minecraft_java_file, "public final String minecriftVerString",     "    public final String minecriftVerString = \"Vivecraft %s %s\";\n" % (minecrift_version_num, minecrift_build) );        

    print("Recompiling...")
    from runtime.mcp import recompile_side, reobfuscate_side
    from runtime.commands import Commands, CLIENT
    commands = Commands(None, verify=True)
    recompile_side( commands, CLIENT)

    print("Reobfuscating...")
    commands.creatergcfg(reobf=True, keep_lvt=True, keep_generics=True, srg_names=True)
    reobfuscate_side( commands, CLIENT , srg_names=True)
  

    try:   
        pass
        shutil.move(reobf, srg)
    except OSError:
        quit
   
    commands.creatergcfg(reobf=True, keep_lvt=True, keep_generics=True, srg_names=False)
    reobfuscate_side( commands, CLIENT )
    
    try:   
        pass
        shutil.move(reobf, obf)
    except OSError:
        quit
        
    create_install( mcp_dir )
Exemple #4
0
def main(mcp_dir):
    print 'Using mcp dir: %s' % mcp_dir
    print 'Using base dir: %s' % base_dir

    print("Refreshing dependencies...")
    download_deps(mcp_dir, False)

    sys.path.append(mcp_dir)
    os.chdir(mcp_dir)

    reobf = os.path.join(mcp_dir, 'reobf', 'minecraft')
    try:
        pass
        shutil.rmtree(reobf)
    except OSError:
        pass

        # Read Minecrift lib versions
        jRiftPom = os.path.join(base_dir, 'JRift', 'JRift', 'pom.xml')
        jRiftLibraryPom = os.path.join(base_dir, 'JRift', 'JRiftLibrary',
                                       'pom.xml')
        jRiftVer = readpomversion(jRiftPom)
        print 'JRift: %s' % jRiftVer
        jRiftLibraryVer = readpomversion(jRiftLibraryPom)
        print 'JRiftLibrary: %s' % jRiftLibraryVer

    # Update Minecrift version
    minecraft_java_file = os.path.join(mcp_dir, 'src', 'minecraft', 'net',
                                       'minecraft', 'client', 'Minecraft.java')
    if os.path.exists(minecraft_java_file):
        print "Updating Minecraft.java with Vivecraft version: [Vivecraft %s %s] %s" % (
            minecrift_version_num, minecrift_build, minecraft_java_file)
        replacelineinfile(
            minecraft_java_file, "public final String minecriftVerString",
            "    public final String minecriftVerString = \"Vivecraft %s %s\";\n"
            % (minecrift_version_num, minecrift_build))

    print("Recompiling...")
    from runtime.mcp import recompile_side, reobfuscate_side
    from runtime.commands import Commands, CLIENT
    commands = Commands(None, verify=True)
    recompile_side(commands, CLIENT)

    print("Reobfuscating...")
    commands.creatergcfg(reobf=True,
                         keep_lvt=True,
                         keep_generics=True,
                         srg_names=False)
    reobfuscate_side(commands, CLIENT)
    create_install(mcp_dir)
Exemple #5
0
def main(mcp_dir):
    print 'Using mcp dir: %s' % mcp_dir
    print 'Using base dir: %s' % base_dir
    sys.path.append(mcp_dir)
    os.chdir(mcp_dir)

    reobf = os.path.join(mcp_dir,'reobf','minecraft')
    try:
        pass
        shutil.rmtree(reobf)
    except OSError:
        pass

    print("Recompiling...")
    from runtime.mcp import recompile_side, reobfuscate_side
    from runtime.commands import Commands, CLIENT
    commands = Commands(None, verify=True)
    recompile_side( commands, CLIENT)

    print("Reobfuscating...")
    commands.creatergcfg(reobf=True, keep_lvt=True, keep_generics=True, srg_names=False)
    reobfuscate_side( commands, CLIENT )
    create_install( mcp_dir )
Exemple #6
0
def main(mcp_dir):
    print 'Using mcp dir: %s' % mcp_dir
    print 'Using base dir: %s' % base_dir
    sys.path.append(mcp_dir)
    os.chdir(mcp_dir)

    reobf = os.path.join(mcp_dir,'reobf','minecraft')
    try:
        pass
        shutil.rmtree(reobf)
    except OSError:
        pass

    print("Recompiling...")
    from runtime.mcp import recompile_side, reobfuscate_side
    from runtime.commands import Commands, CLIENT
    commands = Commands(None, verify=True)
    recompile_side( commands, CLIENT)

    print("Reobfuscating...")
    commands.creatergcfg(reobf=True, keep_lvt=True, keep_generics=True, srg_names=False)
    reobfuscate_side( commands, CLIENT )

    print("Creating Installer...")
    
    in_mem_zip = StringIO.StringIO()
    with zipfile.ZipFile( in_mem_zip,'w', zipfile.ZIP_DEFLATED) as zipout:
        for abs_path, _, filelist in os.walk(reobf, followlinks=True):
            arc_path = os.path.relpath( abs_path, reobf ).replace('\\','/').replace('.','')+'/'
            for cur_file in fnmatch.filter(filelist, '*.class'):
                if cur_file=='blk.class': #skip SoundManager
                    continue
                in_file= os.path.join(abs_path,cur_file) 
                arcname =  arc_path + cur_file
                zipout.write(in_file, arcname)

    os.chdir( base_dir )

    
    in_mem_zip.seek(0)
    json_str = ""

    mc_ver ="1.6.2"
    if os.getenv("RELEASE_VERSION"):
        version = os.getenv("RELEASE_VERSION")
    elif os.getenv("BUILD_NUMBER"):
        version = "b"+os.getenv("BUILD_NUMBER")
    else:
        version = "LOCAL"

    version = mc_ver+"-"+version
    json_id = "minecrift-"+version
    lib_id = "com.mtbs3d:minecrift:"+version
    
    with  open(os.path.join("installer",mc_ver+".json"),"rb") as f:
        json_obj = json.load(f)
        time = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S-05:00")
        json_obj["id"] = json_id
        json_obj["time"] = time
        json_obj["releaseTime"] = time
        json_obj["libraries"].insert(0,{"name":lib_id}) #Insert at beginning
        json_obj["libraries"].append({"name":"net.minecraft:Minecraft:"+mc_ver}) #Insert at end
        json_str = json.dumps( json_obj, indent=1 )

    installer_id = json_id+"-installer"
    installer = os.path.join( installer_id+".jar" ) 
    shutil.copy( os.path.join("installer","installer.jar"), installer )
    with zipfile.ZipFile( installer,'a', zipfile.ZIP_DEFLATED) as install_out: #append to installer.jar
        install_out.writestr( "version.json", json_str )
        install_out.writestr( "version.jar", in_mem_zip.read() )
        install_out.writestr( "version", json_id+":"+version )

    print("Creating Installer exe...")
    with open( os.path.join("installer","launch4j.xml"),"r" ) as inlaunch:
        with open( "launch4j.xml", "w" ) as outlaunch:
            outlaunch.write( inlaunch.read().replace("installer",installer_id))
    subprocess.Popen( 
        cmdsplit("java -jar \"%s\" \"%s\""% (
                os.path.join( base_dir,"installer","launch4j","launch4j.jar"),
                os.path.join( base_dir, "launch4j.xml"))), 
            cwd=os.path.join(base_dir,"installer","launch4j"),
            bufsize=-1).communicate()
    os.unlink( "launch4j.xml" )