def sign(backup):
    if backup != '':
        accSelect_support.pushVars(backup, load)
        import sign
        sign.close_window(root)
        accSelect.vp_start_gui()
    sys.stdout.flush()
Exemple #2
0
def cmbackup():
    cmfile = tkFileDialog.askopenfilename(title='Select cmbackup',
                                          filetypes=[
                                              ('Unsigned CMA Backup Files',
                                               '*.cmbackup')
                                          ])
    if cmfile.__contains__("Gravity Rush FULL GAME (3.61 only!).cmbackup"):
        print "DO WHAT YOU WANT CAZ A PIRATE IS FREE!!"
    zf = zipfile.ZipFile(cmfile)
    try:
        zf.extract(member="load.txt", path="temp")
        zf.extract(member="TitleID.txt", path="temp")
    except KeyError:
        tkMessageBox.showerror(title="Error 094", message="Invalid .cmbackup!")
    zf.close()
    load = open('temp/load.txt', 'r')
    loadtype = load.read()
    load.close()
    backupfile = open('temp/TitleID.txt', 'r')
    CMABACKUP = backupfile.read()
    backupfile.close()
    os.remove("temp/load.txt")
    os.remove("temp/TitleID.txt")
    os.removedirs("temp")
    print "Extracting CMBackup.."
    defs.extractZip(src=cmfile,
                    dst=defs.getCmaDir() + '/EXTRACTED/' + loadtype + "/" +
                    CMABACKUP)
    os.remove(defs.getCmaDir() + '/EXTRACTED/' + loadtype + "/" + CMABACKUP +
              "/" + "load.txt")
    os.remove(defs.getCmaDir() + '/EXTRACTED/' + loadtype + "/" + CMABACKUP +
              "/" + "TitleID.txt")

    if os.path.exists(defs.getCmaDir() + '/EXTRACTED/' + loadtype + "/" +
                      CMABACKUP + '/savedata'):
        savedata = tkMessageBox.askyesno(
            title="Savedata",
            message=
            "This .cmbackup contains savedata, would you like to use this savedata?\nYou may have problems with trophy eligiby if you do."
        )
        if savedata == False:
            shutil.rmtree(defs.getCmaDir() + '/EXTRACTED/' + loadtype + "/" +
                          CMABACKUP + '/savedata')
            os.remove(defs.getCmaDir() + '/EXTRACTED/' + loadtype + "/" +
                      CMABACKUP + '/savedata.psvmd-dec')
    accSelect_support.pushVars(CMABACKUP, loadtype)
    import sign
    sign.close_window(root)
    accSelect.vp_start_gui()
    print "Removing: " + defs.getCmaDir(
    ) + '/EXTRACTED/' + loadtype + "/" + CMABACKUP
    shutil.rmtree(defs.getCmaDir() + '/EXTRACTED/' + loadtype + "/" +
                  CMABACKUP)