Exemple #1
0
def cleanup():
    color.text(" * Powering down...", color.FG_GREEN)
    # cleanup curses
    # curses.nocbreak(); stdscr.keypad(0); curses.echo(); curses.endwin()

    # screw curses
    sys.exit()
def cleanup():
    color.text(" * Powering down...", color.FG_GREEN)
    # cleanup curses
    # curses.nocbreak(); stdscr.keypad(0); curses.echo(); curses.endwin()

    # screw curses
    sys.exit()
def check():
    c = wmi.WMI()
    drive = None
    names = ["ROCKRAIDERS", "ROCK RAIDERS"]

    for cdrom in c.Win32_CDROMDrive():
        color.text(" * CD Drives: ", color.FG_GREEN)
        vname = cdrom.VolumeName if cdrom.VolumeName is not None else "[None]"

        if u'OK' in cdrom.Status and cdrom.mediaLoaded:
            color.text(u" - %s | " % cdrom.Drive, color.FG_GREEN, nl=False)
        else:
            color.text(u" - %s | " % cdrom.Drive, color.FG_LIGHT_RED, nl=False)

        if vname.upper() in names:
            color.text(vname, color.FG_GREEN)
            drive = cdrom.Drive
        else:
            color.text(vname, color.FG_LIGHT_RED)
    print

    if drive is not None:
        print "Valid Rock Raiders disc detected"

        location = os.path.join(os.path.expanduser("~"), "Desktop",
                                "LEGO Rock Raiders")

        if not os.path.exists(location):
            os.makedirs(location)
        install(drive, location)

    else:
        tex = textwrap.wrap(
            "Could not detect a valid Rock Raiders disc. " +
            "This may because you have a different version.  If you are ABSOLUTELY"
            +
            "sure that the disk is a Rock Raiders disk, type the letter of the drive. "
            + "If not, then just hit enter.")
        for t in tex:
            print " " + t

        try:
            r = str(sys.stdin.readline()[:-1])
        except:
            r = None
        # add check for if r is a real drive.  Probably make a list of drives when checking them above
        if r:
            location = os.path.join(os.path.expanduser("~"), "Desktop",
                                    "LEGO Rock Raiders")

            if not os.path.exists(location):
                os.makedirs(location)
            install(r.upper()[0] + ':', location)

        else:
            return False
Exemple #4
0
def preloadchecks():
    color.text("Running preload checks...", color.FG_GREEN)

    pd(os.getcwd())
    if DEBUG:
        pd("Cheating, moving to")
        os.chdir(r"C:/Users/Daniel/Desktop/lrr-notprime")  # TEMPORARY HACK
        pd(os.getcwd())

    try:
        with open('LegoRR.exe') as f:
            pd("Executable located.")
            global WADSAREPRIME
            WADSAREPRIME = wadtool.checkwads()
            if not os.path.exists("d3drm.dll"):
                if hasattr(sys, "frozen") and sys.frozen in ("windows_exe",
                                                             "console_exe"):
                    zipf = zipfile.ZipFile(sys.executable)
                    zipf.extract("d3drm.dll")
    except BaseException, e:
        global LMSREADY
        LMSREADY = False
        if not r"C:/Program Files" in os.getcwd():
            print ""
            tex = textwrap.wrap(
                "Game not found.  I'm going to go now. " +
                "I suggest you put this in the same folder as the Rock Raiders exe, like you were told to do.\n"
            )
            # add search function?
            for t in tex:
                print " " + t
            cleanup()
        else:
            tex = textwrap.wrap(
                "You've got the game installed, but you shouldn't mess with the copy in Program"
                +
                "Files.  Usually you copy it elsewhere for modding, so you have a clean copy"
                +
                "for when it inevitably breaks.  Your Desktop is usually a good place for it.\n"
                + "Want me to do that for you?\n")
            for t in tex:
                print " " + t

            print "[YES/no] ",
            sys.stdout.flush()
            try:
                r = str(sys.stdin.readline()[:-1])
            except:
                r = None
            if 'yes' in r.lower() or r is None:
                # add testing for files
                shutil.copytree(
                    os.getcwd(),
                    os.path.join(os.path.expanduser('~/Desktop/'),
                                 os.path.basename(os.getcwd())))
def initLMS():

    #check for update

    global LMSREADY
    LMSREADY = True
    preloadobserve()
    preloadchecks()
    if LMSREADY:
        color.text("System online, initalizing interface (but not really)...", color.FG_LIGHT_GREEN)
        initGUI()
Exemple #6
0
def initLMS():

    #check for update

    global LMSREADY
    LMSREADY = True
    preloadobserve()
    preloadchecks()
    if LMSREADY:
        color.text("System online, initalizing interface (but not really)...",
                   color.FG_LIGHT_GREEN)
        initGUI()
Exemple #7
0
def mainmenu():
    global WADSAREPRIME
    while True:
        print
        print " Game: ",
        if LMSREADY:
            color.text("Ready", color.FG_LIGHT_GREEN)
            print " WADs: ",
            if WADSAREPRIME:
                color.text("Primed for Data Method", color.FG_LIGHT_GREEN)
            else:
                color.text("Not primed", color.FG_LIGHT_YELLOW)

        else:
            color.text("Not ready", color.FG_LIGHT_RED)
        print

        menu_main = menu.Menu([("Launch LRR", launchGame),
                               ("Prime WADs", primeWADs), ("Quit", cleanup)])
        menu_main.indent = 1
        menu_main.prompt = ">"
        menu_main.prefix = '['
        menu_main.suffix = ']'
        selectedopt = menu_main.open()
        selectedopt()

        cls()
def mainmenu():
    global WADSAREPRIME
    while True:
        print
        print " Game: ",
        if LMSREADY:
            color.text("Ready", color.FG_LIGHT_GREEN)
            print " WADs: ",
            if WADSAREPRIME:
                color.text("Primed for Data Method", color.FG_LIGHT_GREEN)
            else:
                color.text("Not primed", color.FG_LIGHT_YELLOW)

        else: color.text("Not ready", color.FG_LIGHT_RED)
        print

        menu_main = menu.Menu([("Launch LRR", launchGame), ("Prime WADs", primeWADs), ("Quit", cleanup)])
        menu_main.indent = 1
        menu_main.prompt = ">"
        menu_main.prefix = '['
        menu_main.suffix = ']'
        selectedopt = menu_main.open()
        selectedopt()

        cls()
def check():
    c = wmi.WMI()
    drive = None
    names = ["ROCKRAIDERS", "ROCK RAIDERS"]

    for cdrom in c.Win32_CDROMDrive():
        color.text(" * CD Drives: ", color.FG_GREEN)
        vname = cdrom.VolumeName if cdrom.VolumeName is not None else "[None]"

        if u'OK' in cdrom.Status and cdrom.mediaLoaded:
            color.text(u" - %s | " % cdrom.Drive, color.FG_GREEN, nl=False)
        else:
            color.text(u" - %s | " % cdrom.Drive, color.FG_LIGHT_RED, nl=False)

        if vname.upper() in names:
            color.text(vname, color.FG_GREEN)
            drive = cdrom.Drive
        else:
            color.text(vname, color.FG_LIGHT_RED)
    print;

    if drive is not None:
        print "Valid Rock Raiders disc detected"

        location = os.path.join(os.path.expanduser("~"), "Desktop",
             "LEGO Rock Raiders")

        if not os.path.exists(location):
            os.makedirs(location)
        install(drive, location)

    else:
        tex = textwrap.wrap("Could not detect a valid Rock Raiders disc. " +
        "This may because you have a different version.  If you are ABSOLUTELY" +
        "sure that the disk is a Rock Raiders disk, type the letter of the drive. " +
        "If not, then just hit enter.")
        for t in tex: print " " + t

        try: r = str(sys.stdin.readline()[:-1])
        except: r = None
        # add check for if r is a real drive.  Probably make a list of drives when checking them above
        if r:
            location = os.path.join(os.path.expanduser("~"), "Desktop",
             "LEGO Rock Raiders")

            if not os.path.exists(location):
                os.makedirs(location)
            install(r.upper()[0]+':', location)

        else: return False
def main():
    color.text("Powering up LMS...", color.FG_GREEN)
    try:
        initLMS()
        mainmenu()
    except SystemExit: return
    except BaseException as e:
        print "Something bad has happened, due most likely to my ineptitude."
        print "This is what happened.  Paste this in the LMS topic or somehow tell Doc.\n"
        print '*' * term.getX()
        print
        print e
        print
        print '*' * term.getX()
        print
    cleanup()
Exemple #11
0
def main():
    color.text("Powering up LMS...", color.FG_GREEN)
    try:
        initLMS()
        mainmenu()
    except SystemExit:
        return
    except BaseException as e:
        print "Something bad has happened, due most likely to my ineptitude."
        print "This is what happened.  Paste this in the LMS topic or somehow tell Doc.\n"
        print '*' * term.getX()
        print
        print e
        print
        print '*' * term.getX()
        print
    cleanup()
def preloadchecks():
    color.text("Running preload checks...", color.FG_GREEN)

    pd(os.getcwd())
    if DEBUG:
        pd("Cheating, moving to")
        os.chdir(r"C:/Users/Daniel/Desktop/lrr-notprime")  # TEMPORARY HACK
        pd(os.getcwd())

    try:
        with open('LegoRR.exe') as f:
            pd("Executable located.")
            global WADSAREPRIME
            WADSAREPRIME = wadtool.checkwads()
            if not os.path.exists("d3drm.dll"):
                if hasattr(sys, "frozen") and sys.frozen in ("windows_exe", "console_exe"):
                    zipf = zipfile.ZipFile(sys.executable)
                    zipf.extract("d3drm.dll")
    except BaseException, e:
        global LMSREADY
        LMSREADY = False
        if not r"C:/Program Files" in os.getcwd():
            print ""
            tex = textwrap.wrap("Game not found.  I'm going to go now. " +
            "I suggest you put this in the same folder as the Rock Raiders exe, like you were told to do.\n")
            # add search function?
            for t in tex: print " " + t
            cleanup()
        else:
            tex = textwrap.wrap(
            "You've got the game installed, but you shouldn't mess with the copy in Program" +
            "Files.  Usually you copy it elsewhere for modding, so you have a clean copy" +
            "for when it inevitably breaks.  Your Desktop is usually a good place for it.\n" +
            "Want me to do that for you?\n")
            for t in tex: print " " + t

            print "[YES/no] ",
            sys.stdout.flush()
            try: r = str(sys.stdin.readline()[:-1])
            except: r = None
            if 'yes' in r.lower() or r is None:
                # add testing for files
                shutil.copytree(os.getcwd(), os.path.join(os.path.expanduser('~/Desktop/'), os.path.basename(os.getcwd())))
Exemple #13
0
def preloadobserve():
    color.text("Gathering environment varibles...", color.FG_GREEN)
    if 'Program Files' in os.getcwd():
        color.text(
            "Warning: Running from Program Files folder.  Not advised.  [insert stuff/menu here]",
            color.FG_LIGHT_YELLOW)
Exemple #14
0
def primeWADs():
    if not wadtool.checkwads(): WADSAREPRIME = wadtool.primewads()
    else: color.text("Wad check failed.", color.FG_YELLOW)
Exemple #15
0
def pd(i):
    if DEBUG: color.text(" @ " + str(i), color.FG_CYAN)
def pd(i):
    if DEBUG: color.text(" @ " + str(i), color.FG_CYAN)
def preloadobserve():
    color.text("Gathering environment varibles...", color.FG_GREEN)
    if 'Program Files' in os.getcwd():
        color.text("Warning: Running from Program Files folder.  Not advised.  [insert stuff/menu here]", color.FG_LIGHT_YELLOW)
def primeWADs():
    if not wadtool.checkwads(): WADSAREPRIME = wadtool.primewads()
    else: color.text("Wad check failed.", color.FG_YELLOW)