mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58:50 +01:00
add patch for mame2003plus
This commit is contained in:
parent
277d3afdf9
commit
dc4f61ee92
252
Menu/GameShell/80_SETTINGS/Cores/__init__.py
Normal file
252
Menu/GameShell/80_SETTINGS/Cores/__init__.py
Normal file
@ -0,0 +1,252 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import platform
|
||||
import pygame
|
||||
import glob
|
||||
#import math
|
||||
import commands
|
||||
|
||||
#from beeprint import pp
|
||||
from libs.roundrects import aa_round_rect
|
||||
#import gobject
|
||||
#from wicd import misc
|
||||
## local UI import
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.util_funcs import midRect,FileExists,IsExecutable,ArmSystem,CmdClean
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.icon_item import IconItem
|
||||
from UI.confirm_page import ConfirmPage
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.multilabel import MultiLabel
|
||||
from UI.info_page_list_item import InfoPageListItem
|
||||
from UI.info_page_selector import InfoPageSelector
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
|
||||
class DeleteCoreConfirmPage(ConfirmPage):
|
||||
|
||||
_ConfirmText = MyLangManager.Tr("Awaiting Input")
|
||||
_FootMsg = ["Nav","","","Cancel","OK"]
|
||||
CallbackA = None
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
self._Screen._MsgBox.SetText("Applying")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
pygame.time.delay(638)
|
||||
|
||||
self.CallbackA()
|
||||
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
class CoresPage(Page):
|
||||
_FootMsg = ["Nav","Del","Scan","Back",""]
|
||||
_MyList = []
|
||||
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||
|
||||
_AList = {}
|
||||
|
||||
_Scrolled = 0
|
||||
|
||||
_BGwidth = 320
|
||||
_BGheight = 240-24-20
|
||||
|
||||
_DrawOnce = False
|
||||
_Scroller = None
|
||||
|
||||
_EasingDur = 30
|
||||
|
||||
_CORES_PATH = "%s/apps/emulators" % os.path.expanduser('~')
|
||||
|
||||
_Config =None
|
||||
_AllowedExts = [".so",".bin"]
|
||||
_HiddenSos = ["chailove_libretro.so","nxengine_libretro.so"]
|
||||
|
||||
def __init__(self):
|
||||
Page.__init__(self)
|
||||
self._Icons = {}
|
||||
|
||||
if "arm" in platform.machine():
|
||||
pass
|
||||
|
||||
def GenList(self):
|
||||
|
||||
self._MyList = []
|
||||
## map ini to self._AList
|
||||
files_path = glob.glob(self._CORES_PATH+"/*")
|
||||
|
||||
start_x = 10
|
||||
start_y = 0
|
||||
counter = 0
|
||||
for i,v in enumerate( files_path):
|
||||
if os.path.basename(v) in self._HiddenSos:
|
||||
continue
|
||||
|
||||
filename, file_extension = os.path.splitext(v)
|
||||
|
||||
alias_file = filename+file_extension + ".alias"
|
||||
|
||||
if file_extension in self._AllowedExts:
|
||||
li = InfoPageListItem()
|
||||
li._Parent = self
|
||||
li._PosX = start_x
|
||||
li._PosY = start_y + counter*InfoPageListItem._Height
|
||||
li._Width = Width-10
|
||||
li._Fonts["normal"] = self._ListFontObj
|
||||
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||
li._ReadOnly = True
|
||||
|
||||
if os.path.isfile(alias_file):
|
||||
fp = open(alias_file, "r")
|
||||
alias = fp.read()
|
||||
alias = alias.strip()
|
||||
label_text = alias.decode("utf8")
|
||||
li.Init( label_text )
|
||||
fp.close()
|
||||
else:
|
||||
li.Init( os.path.basename(v) )
|
||||
li._Flag = v
|
||||
##li.SetSmallText( v )
|
||||
|
||||
self._MyList.append(li)
|
||||
counter += 1
|
||||
|
||||
def Init(self):
|
||||
if self._Screen != None:
|
||||
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
|
||||
self._PosX = self._Index*self._Screen._Width
|
||||
self._Width = self._Screen._Width ## equal to screen width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
ps = InfoPageSelector()
|
||||
ps._PosX = 11
|
||||
ps._Parent = self
|
||||
ps._Width = self._Width-10
|
||||
self._Ps = ps
|
||||
self._PsIndex = 0
|
||||
|
||||
self._Scroller = ListScroller()
|
||||
self._Scroller._Parent = self
|
||||
self._Scroller._PosX = 2
|
||||
self._Scroller._PosY = 2
|
||||
self._Scroller.Init()
|
||||
|
||||
self._ConfirmBox = DeleteCoreConfirmPage()
|
||||
self._ConfirmBox._Screen = self._Screen
|
||||
self._ConfirmBox._Name = "Confirm to Delete?"
|
||||
self._ConfirmBox._Parent = self
|
||||
self._ConfirmBox.Init()
|
||||
|
||||
def ReScan(self):
|
||||
self.GenList()
|
||||
self.RefreshPsIndex()
|
||||
|
||||
def ConfirmBoxCallbackA(self):
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
cur_li = self._MyList[self._PsIndex]
|
||||
|
||||
os.system("rm %s" % CmdClean(cur_li._Flag))
|
||||
self.GenList()
|
||||
self.RefreshPsIndex()
|
||||
|
||||
def OnLoadCb(self):
|
||||
self._Scrolled = 0
|
||||
self._PosY = 0
|
||||
self._DrawOnce = False
|
||||
self.GenList()
|
||||
|
||||
def OnReturnBackCb(self):
|
||||
pass
|
||||
|
||||
def KeyDown(self,event):
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["X"]: #Scan current
|
||||
self.ReScan()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Y"]: #del
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
self._ConfirmBox.CallbackA = self.ConfirmBoxCallbackA
|
||||
|
||||
self._Screen.PushPage(self._ConfirmBox)
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Up"]:
|
||||
self.ScrollUp()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Down"]:
|
||||
self.ScrollDown()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
|
||||
|
||||
def Draw(self):
|
||||
self.ClearCanvas()
|
||||
self._Ps.Draw()
|
||||
|
||||
if len(self._MyList) > 0:
|
||||
for i in self._MyList:
|
||||
i.Draw()
|
||||
|
||||
self._Scroller.UpdateSize( len(self._MyList)*InfoPageListItem._Height,
|
||||
self._PsIndex*InfoPageListItem._Height)
|
||||
self._Scroller.Draw()
|
||||
|
||||
|
||||
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
_Page = None
|
||||
def __init__(self):
|
||||
pass
|
||||
def Init(self,main_screen):
|
||||
self._Page = CoresPage()
|
||||
self._Page._Screen = main_screen
|
||||
self._Page._Name ="Retroarch cores manager"
|
||||
self._Page.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
if main_screen !=None:
|
||||
main_screen.PushPage(self._Page)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
OBJ = APIOBJ()
|
||||
def Init(main_screen):
|
||||
OBJ.Init(main_screen)
|
||||
def API(main_screen):
|
||||
OBJ.API(main_screen)
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ class ListPage(Page):
|
||||
["","Languages","Languages"],
|
||||
["","Notification","Notification"],
|
||||
["","Update", ""],
|
||||
["","Cores", "Retroarch cores manager"],
|
||||
["","About", "About"],
|
||||
["","PowerOFF","Power OFF"],
|
||||
["","ButtonsLayout","Buttons Layout"],
|
||||
|
||||
@ -58,14 +58,14 @@ class DownloadProcessPage(Page):
|
||||
self._PngSize["needwifi_bg"] = (253,132)
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["rom_download"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("rom_download")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
||||
self._Icons["bg"] = bgpng
|
||||
|
||||
needwifi_bg = IconItem()
|
||||
needwifi_bg._ImgSurf = MyIconPool._Icons["needwifi_bg"]
|
||||
needwifi_bg._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
|
||||
needwifi_bg._MyType = ICON_TYPES["STAT"]
|
||||
needwifi_bg._Parent = self
|
||||
needwifi_bg.Adjust(0,0,self._PngSize["needwifi_bg"][0],self._PngSize["needwifi_bg"][1],0)
|
||||
@ -84,7 +84,7 @@ class DownloadProcessPage(Page):
|
||||
|
||||
|
||||
def OnExitCb(self,event):
|
||||
print("DownloadProcessPage OnExitCb")
|
||||
#print("DownloadProcessPage OnExitCb")
|
||||
if self._Downloader == None:
|
||||
return
|
||||
try:
|
||||
@ -97,7 +97,7 @@ class DownloadProcessPage(Page):
|
||||
if self._Screen.CurPage() == self:
|
||||
if self._Downloader.isFinished():
|
||||
if self._Downloader.isSuccessful():
|
||||
print("Success!")
|
||||
print("Download Success!")
|
||||
# Do something with obj.get_dest()
|
||||
filename = os.path.basename(self._Downloader.get_dest())
|
||||
cur_dir = os.getcwd()
|
||||
@ -116,6 +116,7 @@ class DownloadProcessPage(Page):
|
||||
os.system( "rm -rf " + filename)
|
||||
|
||||
os.chdir(cur_dir)
|
||||
self.DownloadPostJob()
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
@ -155,6 +156,20 @@ class DownloadProcessPage(Page):
|
||||
else:
|
||||
return False
|
||||
|
||||
def DownloadPostJob(self):
|
||||
cur_dir = os.getcwd()
|
||||
|
||||
arr = self._URL.rsplit('/', 1)
|
||||
if len(arr) > 1:
|
||||
downloaded_filename = arr[1]
|
||||
try:
|
||||
os.chdir(os.path.join(cur_dir,"patches",downloaded_filename))
|
||||
os.system("/bin/sh Run.sh")
|
||||
except:
|
||||
pass
|
||||
|
||||
os.chdir(cur_dir)
|
||||
|
||||
def StartDownload(self,url,dst_dir):
|
||||
if is_wifi_connected_now() == False:
|
||||
return
|
||||
|
||||
@ -587,6 +587,11 @@ class Page(Widget):
|
||||
for i in range(0, len(self._MyList)):
|
||||
self._MyList[i]._PosY += self._MyList[i]._Height*dy
|
||||
|
||||
def RefreshPsIndex(self):
|
||||
if len(self._MyList) == 0:
|
||||
self._PsIndex = 0
|
||||
elif self._PsIndex > (len(self._MyList) -1):
|
||||
self._PsIndex = len(self._MyList) -1
|
||||
|
||||
def FScrollDown(self,Step=1):
|
||||
if len(self._MyList) == 0:
|
||||
|
||||
46
sys.py/patches/mame2003_plus_libretro.so.zip/Run.sh
Executable file
46
sys.py/patches/mame2003_plus_libretro.so.zip/Run.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
cat >~/.config/retroarch/retroarch-core-options.cfg<<'EOF'
|
||||
mame2003-plus_analog = "digital"
|
||||
mame2003-plus_art_resolution = "1"
|
||||
mame2003-plus_brightness = "1.0"
|
||||
mame2003-plus_cheat_input_ports = "disabled"
|
||||
mame2003-plus_core_save_subfolder = "enabled"
|
||||
mame2003-plus_core_sys_subfolder = "enabled"
|
||||
mame2003-plus_dcs_speedhack = "disabled"
|
||||
mame2003-plus_deadzone = "20"
|
||||
mame2003-plus_display_artwork = "enabled"
|
||||
mame2003-plus_display_setup = "disabled"
|
||||
mame2003-plus_four_way_emulation = "disabled"
|
||||
mame2003-plus_frameskip = "0"
|
||||
mame2003-plus_gamma = "1.2"
|
||||
mame2003-plus_input_interface = "retropad"
|
||||
mame2003-plus_machine_timing = "enabled"
|
||||
mame2003-plus_mame_remapping = "enabled"
|
||||
mame2003-plus_mouse_device = "mouse"
|
||||
mame2003-plus_neogeo_bios = "default"
|
||||
mame2003-plus_rstick_to_btns = "enabled"
|
||||
mame2003-plus_sample_rate = "48000"
|
||||
mame2003-plus_skip_disclaimer = "disabled"
|
||||
mame2003-plus_skip_warnings = "disabled"
|
||||
mame2003-plus_tate_mode = "disabled"
|
||||
mame2003_art_resolution = "1"
|
||||
mame2003_brightness = "1.0"
|
||||
mame2003_core_save_subfolder = "enabled"
|
||||
mame2003_core_sys_subfolder = "enabled"
|
||||
mame2003_dcs_speedhack = "enabled"
|
||||
mame2003_display_artwork = "enabled"
|
||||
mame2003_display_setup = "disabled"
|
||||
mame2003_four_way_emulation = "disabled"
|
||||
mame2003_frameskip = "0"
|
||||
mame2003_gamma = "1.0"
|
||||
mame2003_input_interface = "simultaneous"
|
||||
mame2003_mame_remapping = "enabled"
|
||||
mame2003_mouse_device = "mouse"
|
||||
mame2003_neogeo_bios = "default"
|
||||
mame2003_rstick_to_btns = "enabled"
|
||||
mame2003_sample_rate = "48000"
|
||||
mame2003_skip_disclaimer = "disabled"
|
||||
mame2003_skip_warnings = "disabled"
|
||||
mame2003_tate_mode = "disabled"
|
||||
EOF
|
||||
Loading…
x
Reference in New Issue
Block a user