def runEmuMIPS(name, cmd, workdir, config, rom): name = config["name"] cmd = config["cmd"] if "cmd" in config else None workdir = config["workingDir"] if "workingDir" in config else None overclock = config["overclock"] if "overclock" in config else None params = config["params"] if "params" in config else None if (workdir == None and not cmd == None): workdir = os.path.abspath(os.path.join(cmd, os.pardir)) fileName = "run" file = open("/tmp/" + fileName, "w") file.write("#!/bin/sh\n") file.write("cd \"" + workdir + "\"\n") if (params != None): file.write(cmd + " " + params.replace("$f", "\"" + rom + "\"") + "\n") else: file.write(cmd + " \"" + rom + "\"\n") file.close() st = os.stat('/tmp/' + fileName) os.chmod('/tmp/' + fileName, st.st_mode | stat.S_IEXEC) showLaunchImage() if (overclock != None and not Configuration.isOpenDinguX()): try: Overclock.setClock(overclock) except Exception as ex: pass TaskHandler.addPeriodicTask(0, sys.exit, delay=100)
def runNativeMIPS(cmd, config): cmd = config["cmd"] if "cmd" in config else None screen = config["screen"] if "screen" in config else None overclock = config["overclock"] if "overclock" in config else None selection = config["selection"] if "selection" in config else "" params = config["params"] if "params" in config else None fileName = "run" file = open("/tmp/" + fileName, "w") file.write("#!/bin/sh\n") parent = os.path.abspath(os.path.join(cmd, os.pardir)) file.write("cd \"" + parent + "\"\n") if (params != None): file.write(cmd + " " + params.replace("$f", "\"" + selection + "\"") + "\n") else: file.write("\"" + cmd + "\" \"" + selection + "\"\n") file.close() st = os.stat('/tmp/' + fileName) os.chmod('/tmp/' + fileName, st.st_mode | stat.S_IEXEC) showLaunchImage() if (overclock != None): try: Overclock.setClock(overclock) except Exception as ex: pass TaskHandler.addPeriodicTask(0, sys.exit, delay=100)
def __init__(self, height): self.headerHeight = height self.updateHeader() try: self.usbDevice = open("/sys/devices/platform/musb_hdrc.0/uh_cable", "r") self.battery = open("/proc/jz/battery", "r") self.updateBattery() except Exception as ex: print("Could not open devices" + str(ex)) TaskHandler.addPeriodicTask(1000, self.updateBattery)
def updatePreview(self): self.preview_final = self.previewPath self.anim = None self.image = None self.renderAnim = False TaskHandler.removePeriodicTask(self.animTask) self.animTask = TaskHandler.addPeriodicTask(1000, self.onShowAnim, 1000) RenderControl.setDirty()
def addBrignessTask(self): if (self.brightnessTaskId is not None): TaskHandler.removePeriodicTask(self.brightnessTaskId) displayTimeout = self.config["options"]["displayTimeout"] if (displayTimeout == "off"): return self.brightnessTaskId = TaskHandler.addPeriodicTask( 0, self.disableScreen, float(displayTimeout) * 1000)
def addSuspendTask(self): if (self.suspendTaskId is not None): TaskHandler.removePeriodicTask(self.suspendTaskId) suspendTime = self.config["options"]["suspendTimeout"] if (suspendTime == "off"): return self.suspendTaskId = TaskHandler.addPeriodicTask( 0, self.suspend, float(suspendTime) * 1000 * 60)
def handleEvents(self, events): for event in events: if event.type == pygame.KEYDOWN: self.keyDown = True if (not len(self.entryList) <= 1): self.preview_final = None if event.key == Keys.DINGOO_BUTTON_UP: if (not len(self.entryList) <= 1): self.up() self.onChange() RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_DOWN: if (not len(self.entryList) <= 1): self.down() self.onChange() RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_L: self.up(self.maxListEntries) self.onChange() RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_R: self.down(self.maxListEntries) self.onChange() RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_A: self.onSelect() RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_B: ResumeHandler.clearResume() self.onExit() RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_Y: self.toggleSidebar(not self.useSidebar) RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_X: self.previewEnabled = not self.previewEnabled RenderControl.setDirty() if event.type == pygame.KEYUP: self.keyDown = False self.preview_final = self.previewPath self.anim = None self.image = None self.renderAnim = False TaskHandler.removePeriodicTask(self.animTask) self.animTask = TaskHandler.addPeriodicTask( 1000, self.onShowAnim, 1000) RenderControl.setDirty()
def __init__(self, height): self.headerHeight = height self.updateHeader() try: if(not Configuration.isOpenDinguX()): self.usbDevice = open("/sys/devices/platform/musb_hdrc.0/uh_cable", "r") if(Configuration.isOpenDinguX()): self.battery = open("/sys/class/power_supply/battery/voltage_now", "r") self.usbDevice = open("/sys/devices/platform/gpio-charger.1/power_supply/usb/online", "r") else: self.battery = open("/proc/jz/battery", "r") self.updateBattery() except Exception as ex: print("Could not open devices" + str(ex)) TaskHandler.addPeriodicTask(1000, self.updateBattery)
def runCMD(self, cmd): os.environ['PYTHONUNBUFFERED'] = "1" self.proc = subprocess.Popen(cmd, shell=True, bufsize=1, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) thread = Thread(target=self.updateList, args=()) thread.start() RenderControl.setDirty() self.updateTask = TaskHandler.addPeriodicTask(100, RenderControl.setDirty, delay=0)