Modifcation size Roms

This commit is contained in:
Guillaume Astier Ruiz 2022-12-05 01:34:57 +01:00
parent 316561a5da
commit 94bf7170b5

124
start.py
View File

@ -30,9 +30,33 @@ import os
#def EmuMod(): #def EmuMod():
def ViewRom(EmuName):
WheelEmu="./data/roms/"+str(EmuName)+"/media/wheel/" + str(EmuName) + "_wheel.png"
NfL = IsImgExist(NfL,"emu")
OpenNfL=Image.open(NfL)
PhotoNfL=OpenNfL.resize((Square,Square))
TkNfL=ImageTk.PhotoImage(PhotoNfL)
LabelPNfL=Label(arkadeus, image=TkNfL)
LabelPNfL.TkNfL = TkNfL
Cnv.pack(fill = "both", expand = True)
# for IdCanvas in Cnv.find_all():
# if IdCanvas != 1:
# Cnv.delete(IdCanvas)
Cnv.create_image(xL, yL, image=TkNfL)
print("Curent Emu : " + str(EmuRes[cM]))
def BackgroundRom(Emu): def BackgroundRom(Emu):
EmuBgFile = "./data/emu/media/" + str(Emu) +"_bg.png" EmuBgFile = "./data/emu/media/" + str(Emu) +"_bg.png"
EmuBgFile = IsImgExist(EmuBgFile,"bg") EmuBgFile = IsImgExist(EmuBgFile,"bg")
@ -83,9 +107,6 @@ def EnterEmu(GetEmuMod):
GenRomListPerGame(str(EmuRes[runMcpt])) GenRomListPerGame(str(EmuRes[runMcpt]))
#def ParseEmu():
def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR): def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR):
NfL="./data/emu/media/" + EmuRes[cL] + ".png" NfL="./data/emu/media/" + EmuRes[cL] + ".png"
NfL = IsImgExist(NfL,"emu") NfL = IsImgExist(NfL,"emu")
@ -139,6 +160,9 @@ def leftKey(GetEmuMod):
Rcpt = 0 Rcpt = 0
print("DEBUG : " + str(EmuMod) + " Emu : " + str(cpt)) print("DEBUG : " + str(EmuMod) + " Emu : " + str(cpt))
ViewEmu(Lcpt,EmuLeftSquareX, EmuLeftSquareY,Mcpt,EmuMiddleSquareX, EmuMiddleSquareY,Rcpt,EmuRightSquareX, EmuRightSquareY) ViewEmu(Lcpt,EmuLeftSquareX, EmuLeftSquareY,Mcpt,EmuMiddleSquareX, EmuMiddleSquareY,Rcpt,EmuRightSquareX, EmuRightSquareY)
if GetEmuMod == 1:
print ("get in ")
ViewRom(EmuRes[Mcpt])
def rightKey(GetEmuMod): def rightKey(GetEmuMod):
@ -164,16 +188,40 @@ def Escape(GetEmuMod):
arkadeus.quit() arkadeus.quit()
if GetEmuMod == 1: if GetEmuMod == 1:
global EmuMod global EmuMod
global cpt
EmuMod = 0 EmuMod = 0
cpt = 0
BackgroundEmu() BackgroundEmu()
ViewEmu(0,EmuLeftSquareX, EmuLeftSquareY,1,EmuMiddleSquareX, EmuMiddleSquareY,2,EmuRightSquareX, EmuRightSquareY) ViewEmu(0,EmuLeftSquareX, EmuLeftSquareY,1,EmuMiddleSquareX, EmuMiddleSquareY,2,EmuRightSquareX, EmuRightSquareY)
def GenEmuList():
global EmuRes
dir_path = r'./data/emu/bin/'
for path in os.listdir(dir_path):
if os.path.isfile(os.path.join(dir_path, path)):
FileName=os.path.splitext(path)[0]
EmuRes.append(FileName)
print("DEBUG : " + FileName)
cnt = Counter(EmuRes)
global EmuCpt
EmuCpt=len(cnt) - 1
print(" Nmbre emulateur : " + str(EmuCpt))
def GenRomListPerGame(Emu): def GenRomListPerGame(Emu):
global RomRes global RomRes
RomRes.clear() RomRes.clear()
dir_rom_path = r'./data/roms/'+Emu+'/roms/' DirRomPath='./data/roms/'+Emu+'/roms'
dir_rom_path = r''+DirRomPath
isDirRom = os.path.isdir(DirRomPath)
print ("Dir : " + DirRomPath + " : status:" + str(isDirRom))
if isDirRom == True:
for RomFile in os.listdir(dir_rom_path): for RomFile in os.listdir(dir_rom_path):
if os.path.isfile(os.path.join(dir_rom_path, RomFile)): if os.path.isfile(os.path.join(dir_rom_path, RomFile)):
@ -197,20 +245,11 @@ global RomRes
EmuRes = [] EmuRes = []
RomRes = [] RomRes = []
dir_path = r'./data/emu/bin/'
EmuMod = 0 EmuMod = 0
# Iterate directory
for path in os.listdir(dir_path):
if os.path.isfile(os.path.join(dir_path, path)):
FileName=os.path.splitext(path)[0]
EmuRes.append(FileName)
print("DEBUG : " + FileName)
cnt = Counter(EmuRes) GenEmuList()
global EmuCpt
EmuCpt=len(cnt) - 1
print(" Nmbre emulateur : " + str(EmuCpt))
config_obj = configparser.ConfigParser() config_obj = configparser.ConfigParser()
@ -258,30 +297,57 @@ EmuRightSquareY=(Ysize/3)
################ Carto Rom Mode #################### ################ Carto Rom Mode ####################
RomIndice = 32 RomIndice = 40
RomIndiceX = Xsize / 32 #RomIndiceX = round(Xsize / RomIndice)
RomIndiceY = Ysize / 32 #RomIndiceY = round(Ysize / RomIndice)
RomIndiceX = RomIndice
RomIndiceY = RomIndice
RomUpSquareX=RomIndiceX RomUpSquareX=RomIndiceX
RomUpSquareY=RomIndiceY RomUpSquareY=RomIndiceY
RomUpSquareSizeX=15*RomIndiceX #RomUpSquareSizeX=round((Xsize/2)-(RomIndiceX/2)-RomIndiceX)
RomUpSquareSizeY=5*RomIndiceY #RomUpSquareSizeY=round((Ysize/3)-(RomIndiceY*4))
RomUpSquareSizeX=((Xsize-(RomIndiceX*3))/2)
RomUpSquareSizeY=(Ysize-(RomIndiceY))
RomMiddleSquareX=RomIndiceX RomMiddleSquareX=RomIndiceX
RomMiddleSquareY=RomIndiceY*6 RomMiddleSquareY=(RomIndiceY*2) + RomUpSquareSizeY
RomMiddleSquareSizeX=15*RomIndiceX RomMiddleSquareSizeX=RomUpSquareSizeX
RomMiddleSquareSizeY=5*RomIndiceY RomMiddleSquareSizeY=RomUpSquareSizeY
RomBottomSquareX=RomIndiceX RomBottomSquareX=RomIndiceX
RomBottomSquareY=RomIndiceY*12 RomBottomSquareY=(RomIndiceY*3) + (RomUpSquareSizeY*2)
RomBottomSquareSizeX=15*RomIndiceX RomBottomSquareSizeX=RomUpSquareSizeX
RomBottomSquareSizeY=5*RomIndiceY RomBottomSquareSizeY=RomUpSquareSizeY
RomLeftSquareX=RomIndiceX*16 RomLeftSquareX=(RomIndiceX*2) + RomUpSquareSizeX
RomLeftSquareY=RomIndiceY RomLeftSquareY=RomIndiceY
RomLeftSquareSizeX=15*RomIndiceX RomLeftSquareSizeX=RomUpSquareSizeX - RomIndiceX
RomLeftSquareSizeY=18*RomIndiceY RomLeftSquareSizeY=(RomIndiceY*2) + (RomUpSquareSizeY*3)
print("RomIndice :" + str(RomIndice))
print("RomIndiceX :" + str(RomIndiceX))
print("RomIndiceY :" + str(RomIndiceY))
print("RomUpSquareX :" + str(RomUpSquareX))
print("RomUpSquareY :" + str(RomUpSquareY))
print("RomUpSquareSizeX :" + str(RomUpSquareSizeX))
print("RomUpSquareSizeY :" + str(RomUpSquareSizeY))
print("RomMiddleSquareX :" + str(RomMiddleSquareX))
print("RomMiddleSquareY :" + str(RomMiddleSquareY))
print("RomMiddleSquareSizeX :" + str(RomMiddleSquareSizeX))
print("RomMiddleSquareSizeY :" + str(RomMiddleSquareSizeY))
print("RomBottomSquareX :" + str(RomBottomSquareX))
print("RomBottomSquareY :" + str(RomBottomSquareY))
print("RomBottomSquareSizeX :" + str(RomBottomSquareSizeX))
print("RomBottomSquareSizeY :" + str(RomBottomSquareSizeY))
print("RomLeftSquareX :" + str(RomLeftSquareX))
print("RomLeftSquareY :" + str(RomLeftSquareY))
print("RomLeftSquareSizeX :" + str(RomLeftSquareSizeX))
print("RomLeftSquareSizeY :" + str(RomLeftSquareSizeY))
#################################################### ####################################################