Merge pull request #117 from cuu/master

Emulator skip ROM_SO checks if no needs for rom so
This commit is contained in:
GNU 2018-11-19 15:50:04 +08:00 committed by GitHub
commit e314631a5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 102 additions and 42 deletions

View File

@ -318,26 +318,29 @@ class FavListPage(Page):
print("Run ",path)
# check ROM_SO exists
if FileExists(self._Emulator["ROM_SO"]):
escaped_path = CmdClean( path)
custom_config = ""
if self._Emulator["RETRO_CONFIG"] != "" and len(self._Emulator["RETRO_CONFIG"]) > 5:
custom_config = " -c " + self._Emulator["RETRO_CONFIG"]
cmdpath = " ".join( (self._Emulator["LAUNCHER"],self._Emulator["ROM_SO"], custom_config, escaped_path))
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
return
if self._Emulator["FILETYPE"] == "dir":
escaped_path = CmdClean(path)
else:
escaped_path = CmdClean(path)
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
self._Screen.Draw()
self._Screen.SwapAndShow()
custom_config = ""
if self._Emulator["RETRO_CONFIG"] != "" and len(self._Emulator["RETRO_CONFIG"]) > 5:
custom_config = " -c " + self._Emulator["RETRO_CONFIG"]
cmdpath = " ".join( (self._Emulator["LAUNCHER"],self._Emulator["ROM_SO"], custom_config, escaped_path))
if self._Emulator["ROM_SO"] =="": #empty means No needs for rom so
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
else:
if FileExists(self._Emulator["ROM_SO"]):
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
else:
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
self._Screen.Draw()
self._Screen.SwapAndShow()
return
return
self._Screen.Draw()
self._Screen.SwapAndShow()

View File

@ -357,27 +357,30 @@ class RomListPage(Page):
path = cur_li._Path
print("Run ",path)
# check ROM_SO exists
if FileExists(self._Emulator["ROM_SO"]):
if self._Emulator["FILETYPE"] == "dir":
escaped_path = CmdClean(path)
else:
escaped_path = CmdClean(path)
custom_config = ""
if self._Emulator["RETRO_CONFIG"] != "" and len(self._Emulator["RETRO_CONFIG"]) > 5:
custom_config = " -c " + self._Emulator["RETRO_CONFIG"]
cmdpath = " ".join( (self._Emulator["LAUNCHER"],self._Emulator["ROM_SO"], custom_config, escaped_path))
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
return
if self._Emulator["FILETYPE"] == "dir":
escaped_path = CmdClean(path)
else:
escaped_path = CmdClean(path)
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
self._Screen.Draw()
self._Screen.SwapAndShow()
custom_config = ""
if self._Emulator["RETRO_CONFIG"] != "" and len(self._Emulator["RETRO_CONFIG"]) > 5:
custom_config = " -c " + self._Emulator["RETRO_CONFIG"]
cmdpath = " ".join( (self._Emulator["LAUNCHER"],self._Emulator["ROM_SO"], custom_config, escaped_path))
if self._Emulator["ROM_SO"] =="": #empty means No needs for rom so
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
else:
if FileExists(self._Emulator["ROM_SO"]):
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
else:
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
self._Screen.Draw()
self._Screen.SwapAndShow()
return
self._Screen.Draw()
self._Screen.SwapAndShow()

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
import pygame
import base64
## local package import
from full_screen import FullScreen
from skin_manager import SkinManager
from createby_clockworkpi import createby_clockworkpi_b64
from constants import Width,Height
class CreateByScreen(FullScreen):
_BG = None
_BGColor = SkinManager().GiveColor('Black')
def Init(self):
self._BG = pygame.image.frombuffer(base64.b64decode(createby_clockworkpi_b64 ),(Width,Height),"RGBA")
self._CanvasHWND = pygame.Surface((self._Width,self._Height))
def Draw(self):
self._CanvasHWND.fill( self._BGColor )
self._CanvasHWND.blit(self._BG,(0,0,Width,Height))

View File

@ -42,6 +42,7 @@ from UI.foot_bar import FootBar
from UI.main_screen import MainScreen
from UI.above_all_patch import SoundPatch
from UI.icon_pool import MyIconPool
from UI.createby_screen import CreateByScreen
from libs.DBUS import setup_dbus
@ -67,6 +68,9 @@ last_brt = -1
gobject_flash_led1 = -1
gobject_flash_led1_counter = 0
Keys = []
crt_screen = None
def gobject_loop():
"""
here to receive dbus signal
@ -268,6 +272,25 @@ def InspectionTeam(main_screen):
return True
def RecordKeyDns(thekey,main_screen):
global Keys,crt_screen
if len(Keys) < 10:
Keys.append(thekey)
else:
Keys = []
Keys.append(thekey)
keys = ''.join(map(str,Keys))
print(keys)
if keys == "273273274274276276275275106107":##uuddllrrab
crt_screen.Draw()
crt_screen.SwapAndShow()
main_screen._TitleBar._InLowBackLight = 0 ##pause titlebar drawing
return True
return False
def event_process(event,main_screen):
global sound_patch
global everytime_keydown
@ -373,11 +396,11 @@ def event_process(event,main_screen):
if event.key == pygame.K_ESCAPE:
pygame.event.clear()
key_down_cb = getattr(main_screen,"KeyDown",None)
if key_down_cb != None:
if callable( key_down_cb ):
main_screen.KeyDown(event)
if RecordKeyDns(event.key,main_screen) == False:
key_down_cb = getattr(main_screen,"KeyDown",None)
if key_down_cb != None:
if callable( key_down_cb ):
main_screen.KeyDown(event)
return
@ -551,6 +574,9 @@ if __name__ == '__main__':
else:
os.system("sudo iw wlan0 set power_save on")
crt_screen = CreateByScreen()
crt_screen.Init()
crt_screen._HWND = screen
big_loop()