[UPADTE] - Media parse
This commit is contained in:
parent
cd6d1bad76
commit
945d0ecab0
Binary file not shown.
|
Before Width: | Height: | Size: 221 KiB After Width: | Height: | Size: 647 KiB |
@ -1,10 +1,8 @@
|
||||
ROM_NAME: 1942b
|
||||
|
||||
Name: 1942 (First Version) (clone of: 1942 )
|
||||
Year: 1984
|
||||
Manufacturer: Capcom
|
||||
Category: Shooter_/_Flying_Vertical
|
||||
Status: good
|
||||
Emulation: good
|
||||
Color: good
|
||||
Sound:
|
||||
name 1942b
|
||||
description 1942 set 3
|
||||
year 1984
|
||||
manufacturer Capcom
|
||||
video screen raster orientation vertical x 224 y 256
|
||||
sound channels 1
|
||||
input players 2 control joy8way buttons 2
|
||||
genre: Shooter / Flying Vertical
|
||||
|
||||
1
media/nodoc.txt
Normal file
1
media/nodoc.txt
Normal file
@ -0,0 +1 @@
|
||||
NO DATA
|
||||
BIN
media/nosnap.png
Normal file
BIN
media/nosnap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 134 KiB |
181
start.py
181
start.py
@ -3,9 +3,13 @@
|
||||
global cpt
|
||||
global Origcpt
|
||||
global EmuMod
|
||||
global RomCpt
|
||||
global MaxRomCpt
|
||||
global CurentEmu
|
||||
|
||||
FirstRun = 1
|
||||
cpt = 0
|
||||
RomCpt =0
|
||||
import configparser
|
||||
from collections import Counter
|
||||
from tkinter import *
|
||||
@ -32,38 +36,74 @@ import os
|
||||
|
||||
|
||||
|
||||
def ViewRom(EmuName):
|
||||
|
||||
def ViewRom(EmuName,RomCpt):
|
||||
|
||||
print("Canevas ROM MEDIA : " + str(Cnv.find_all()))
|
||||
|
||||
for IdCanvas in Cnv.find_all():
|
||||
if IdCanvas != 1:
|
||||
Cnv.delete(IdCanvas)
|
||||
BackgroundRom(str(CurentEmu))
|
||||
print("DEBUG MAX ROM: " + str(MaxRomCpt))
|
||||
|
||||
WheelEmu="./data/roms/"+str(EmuName)+"/media/wheel/" + str(EmuName) + "_wheel.png"
|
||||
IsWheelEmu = IsImgExist(WheelEmu,"wheelemu")
|
||||
|
||||
IsWheelEmu = IsFileExist(WheelEmu,"wheelemu")
|
||||
OpenWheelEmu=Image.open(IsWheelEmu)
|
||||
ResizeOpenWheelEmu=OpenWheelEmu.resize((RomUpSquareSizeX,RomUpSquareSizeY))
|
||||
TkOpenWheelEmu=ImageTk.PhotoImage(ResizeOpenWheelEmu)
|
||||
LabelResizeOpenWheelEmu=Label(arkadeus, image=TkOpenWheelEmu)
|
||||
LabelResizeOpenWheelEmu.TkOpenWheelEmu = TkOpenWheelEmu
|
||||
print("AHHHHHHHHHHHHHHHHHH : " + str(IsWheelEmu))
|
||||
|
||||
Wheel="./data/roms/"+str(EmuName)+"/media/wheel/" + str(RomRes[RomCpt]) + ".png"
|
||||
print("Wheel : "+ Wheel)
|
||||
IsWheel = IsFileExist(Wheel,"wheelemu")
|
||||
OpenWheel=Image.open(IsWheel)
|
||||
ResizeOpenWheel=OpenWheel.resize((RomMiddleSquareSizeX,RomMiddleSquareSizeY))
|
||||
TkOpenWheel=ImageTk.PhotoImage(ResizeOpenWheel)
|
||||
LabelResizeOpenWheel=Label(arkadeus, image=TkOpenWheel)
|
||||
LabelResizeOpenWheel.TkOpenWheel = TkOpenWheel
|
||||
|
||||
Wheel="./data/roms/"+str(EmuName)+"/media/wheel/" + str(RomRes[RomCpt]) + ".png"
|
||||
IsWheel = IsFileExist(Wheel,"wheelemu")
|
||||
OpenWheel=Image.open(IsWheel)
|
||||
ResizeOpenWheel=OpenWheel.resize((RomBottomSquareSizeX,RomBottomSquareSizeY))
|
||||
TkOpenWheel=ImageTk.PhotoImage(ResizeOpenWheel)
|
||||
LabelResizeOpenWheel=Label(arkadeus, image=TkOpenWheel)
|
||||
LabelResizeOpenWheel.TkOpenWheel = TkOpenWheel
|
||||
|
||||
Text="./data/roms/"+str(EmuName)+"/media/doc/" + str(RomRes[RomCpt]) + ".txt"
|
||||
IsText = IsFileExist(Text,"doc")
|
||||
with open(IsText, 'rb') as RomFile:
|
||||
DataRomFile = RomFile.read().rstrip()
|
||||
|
||||
SnapEmu="./data/roms/"+str(EmuName)+"/media/snap/" + str(RomRes[RomCpt]) + ".png"
|
||||
IsSnapEmu = IsFileExist(SnapEmu,"snap")
|
||||
OpenSnapEmu=Image.open(IsSnapEmu)
|
||||
ResizeOpenSnapEmu=OpenSnapEmu.resize((RomLeftSquareSizeX,RomLeftSquareSizeY))
|
||||
TkOpenSnapEmu=ImageTk.PhotoImage(ResizeOpenSnapEmu)
|
||||
LabelResizeOpenSnapEmu=Label(arkadeus, image=TkOpenSnapEmu)
|
||||
LabelResizeOpenSnapEmu.TkOpenSnapEmu = TkOpenSnapEmu
|
||||
|
||||
BoxText=Cnv.create_text(RomBottomSquareX,RomBottomSquareY,width= RomBottomSquareSizeX, text=DataRomFile,fill="white",font="Times 20 bold")
|
||||
BoxRect=Cnv.create_rectangle(RomBottomSquareTxtUpX,RomBottomSquareTxtUpY,RomBottomSquareTxtBottomX,RomBottomSquareTxtBottomY ,fill='black')
|
||||
Cnv.tag_lower(BoxRect,BoxText)
|
||||
Cnv.create_image(RomUpSquareX, RomUpSquareY, image=TkOpenWheelEmu)
|
||||
Cnv.create_image(RomMiddleSquareX, RomMiddleSquareY, image=TkOpenWheel)
|
||||
#Cnv.create_image(RomBottomSquareX, RomBottomSquareY, image=TkOpenWheel)
|
||||
Cnv.create_image(RomLeftSquareX, RomLeftSquareY, image=TkOpenSnapEmu)
|
||||
|
||||
Cnv.pack(fill = "both", expand = True)
|
||||
# for IdCanvas in Cnv.find_all():
|
||||
# if IdCanvas != 1:
|
||||
# Cnv.delete(IdCanvas)
|
||||
|
||||
Cnv.create_image(RomUpSquareX, RomUpSquareY, image=TkOpenWheelEmu)
|
||||
print(str(RomUpSquareX) + " : " + str(RomUpSquareY) + "(" + str(RomUpSquareSizeX) + ":" + str(RomUpSquareSizeY) +")")
|
||||
print("Curent Emu : " + str(EmuRes[RomCpt]))
|
||||
|
||||
|
||||
|
||||
def BackgroundRom(Emu):
|
||||
|
||||
|
||||
|
||||
print("Canevas ROM : " + str(Cnv.find_all()))
|
||||
|
||||
|
||||
|
||||
EmuBgFile = "./data/emu/media/" + str(Emu) +"_bg.png"
|
||||
EmuBgFile = IsImgExist(EmuBgFile,"bg")
|
||||
EmuBgFile = IsFileExist(EmuBgFile,"bg")
|
||||
|
||||
OpenEmuBgfile=Image.open(EmuBgFile)
|
||||
PhotoEmuBgFile=OpenEmuBgfile.resize((Xsize,Ysize))
|
||||
@ -73,7 +113,7 @@ def BackgroundRom(Emu):
|
||||
Cnv.create_image(0, 0, image=TkPhotoEmuBgFile, anchor = "nw")
|
||||
|
||||
|
||||
def IsImgExist(AbsPathFile,TypeMedia):
|
||||
def IsFileExist(AbsPathFile,TypeMedia):
|
||||
if not os.path.exists(AbsPathFile):
|
||||
match TypeMedia:
|
||||
case "emu":
|
||||
@ -83,7 +123,7 @@ def IsImgExist(AbsPathFile,TypeMedia):
|
||||
case "wheel":
|
||||
return "./media/nowheel.png"
|
||||
case "snap":
|
||||
return "./media/nopsnap.png"
|
||||
return "./media/nosnap.png"
|
||||
case "wheelemu":
|
||||
return "./media/nowheelemu.png"
|
||||
case "doc":
|
||||
@ -102,24 +142,30 @@ def BackgroundEmu():
|
||||
def EnterEmu(GetEmuMod):
|
||||
global EmuMod
|
||||
global cpt
|
||||
if EmuMod == 0:
|
||||
EmuMod=1
|
||||
runMcpt = cpt + 1
|
||||
if runMcpt > EmuCpt:
|
||||
runMcpt = 0
|
||||
print("Emu : " + str(EmuRes[runMcpt]))
|
||||
global RomCpt
|
||||
RomCpt=0
|
||||
if GetEmuMod == 0:
|
||||
RomCpt = 1
|
||||
EmuMod = 1
|
||||
print("Emu : " + str(CurentEmu))
|
||||
#Cnv.delete("all")
|
||||
BackgroundRom(str(EmuRes[runMcpt]))
|
||||
GenRomListPerGame(str(EmuRes[runMcpt]))
|
||||
#BackgroundRom(str(CurentEmu))
|
||||
GenRomListPerGame(str(CurentEmu))
|
||||
|
||||
|
||||
#if RomCpt > MaxRomCpt:
|
||||
# RomCpt = 0
|
||||
print("ENTER MODE : " + str(EmuRes[RomCpt]) + " ID :" + str(RomCpt))
|
||||
ViewRom(CurentEmu,RomCpt)
|
||||
|
||||
|
||||
def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR):
|
||||
NfL="./data/emu/media/" + EmuRes[cL] + ".png"
|
||||
NfL = IsImgExist(NfL,"emu")
|
||||
NfL = IsFileExist(NfL,"emu")
|
||||
NfM="./data/emu/media/" + EmuRes[cM] + ".png"
|
||||
NfM = IsImgExist(NfM,"emu")
|
||||
NfM = IsFileExist(NfM,"emu")
|
||||
NfR="./data/emu/media/" + EmuRes[cR] + ".png"
|
||||
NfR = IsImgExist(NfR,"emu")
|
||||
NfR = IsFileExist(NfR,"emu")
|
||||
|
||||
|
||||
OpenNfL=Image.open(NfL)
|
||||
@ -153,6 +199,7 @@ def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR):
|
||||
|
||||
def leftKey(GetEmuMod):
|
||||
if GetEmuMod == 0:
|
||||
global CurentEmu
|
||||
global cpt
|
||||
cpt = cpt - 1
|
||||
if cpt < 0:
|
||||
@ -166,15 +213,20 @@ def leftKey(GetEmuMod):
|
||||
if Rcpt > EmuCpt:
|
||||
Rcpt = 0
|
||||
print("DEBUG : " + str(EmuMod) + " Emu : " + str(cpt))
|
||||
CurentEmu = EmuRes[Mcpt]
|
||||
ViewEmu(Lcpt,EmuLeftSquareX, EmuLeftSquareY,Mcpt,EmuMiddleSquareX, EmuMiddleSquareY,Rcpt,EmuRightSquareX, EmuRightSquareY)
|
||||
if GetEmuMod == 1:
|
||||
global RomCpt
|
||||
print ("get in ")
|
||||
ViewRom(EmuRes[RomCpt])
|
||||
RomCpt=RomCpt - 1
|
||||
if RomCpt < 0:
|
||||
RomCpt = MaxRomCpt
|
||||
print("Running - : " + str(RomCpt) + " ROM : " + str(RomRes[RomCpt]))
|
||||
ViewRom(CurentEmu,RomCpt)
|
||||
|
||||
def rightKey(GetEmuMod):
|
||||
|
||||
if GetEmuMod == 0:
|
||||
global CurentEmu
|
||||
global cpt
|
||||
cpt = cpt + 1
|
||||
if cpt > EmuCpt:
|
||||
@ -189,10 +241,15 @@ def rightKey(GetEmuMod):
|
||||
Rcpt = 0
|
||||
print("DEBUG : " + str(EmuMod) + " Emu : " + str(cpt))
|
||||
ViewEmu(Lcpt,EmuLeftSquareX, EmuLeftSquareY,Mcpt,EmuMiddleSquareX, EmuMiddleSquareY,Rcpt,EmuRightSquareX, EmuRightSquareY)
|
||||
CurentEmu = EmuRes[Mcpt]
|
||||
if GetEmuMod == 1:
|
||||
global RomCpt
|
||||
print ("get in ")
|
||||
ViewRom(EmuRes[RomCpt])
|
||||
RomCpt=RomCpt + 1
|
||||
if RomCpt > MaxRomCpt:
|
||||
RomCpt = 0
|
||||
print("Running + : " + str(RomCpt) + " ROM : " + str(RomRes[RomCpt]))
|
||||
|
||||
ViewRom(CurentEmu,RomCpt)
|
||||
|
||||
|
||||
def Escape(GetEmuMod):
|
||||
@ -229,6 +286,7 @@ def GenEmuList():
|
||||
def GenRomListPerGame(Emu):
|
||||
global RomRes
|
||||
RomRes.clear()
|
||||
print("DEBUG Gen List ROM : " + str(Emu))
|
||||
DirRomPath='./data/roms/'+Emu+'/roms'
|
||||
dir_rom_path = r''+DirRomPath
|
||||
|
||||
@ -244,8 +302,9 @@ def GenRomListPerGame(Emu):
|
||||
|
||||
cntrom = Counter(RomRes)
|
||||
global RomCpt
|
||||
RomCpt=len(cntrom) - 1
|
||||
print("Nmbre de roms : " + str(RomCpt))
|
||||
global MaxRomCpt
|
||||
MaxRomCpt=len(cntrom) - 1
|
||||
print("Nmbre de roms : " + str(MaxRomCpt))
|
||||
print ("ListROms : " + str(RomRes))
|
||||
print ("TEST 1942 : " + str(RomRes[0]) )
|
||||
|
||||
@ -258,13 +317,10 @@ global RomRes
|
||||
EmuRes = []
|
||||
RomRes = []
|
||||
|
||||
|
||||
EmuMod = 0
|
||||
|
||||
GenEmuList()
|
||||
|
||||
|
||||
|
||||
config_obj = configparser.ConfigParser()
|
||||
config_obj.read("./conf/config.ini")
|
||||
Media = config_obj["Media"]
|
||||
@ -294,10 +350,6 @@ else:
|
||||
Ysize = arkadeus.winfo_screenheight()
|
||||
|
||||
|
||||
print("res : " + str(Xsize) + ":" + str(Ysize) )
|
||||
|
||||
|
||||
|
||||
################ Carto Emu Mode ####################
|
||||
EmuMiddleSquareX=(Xsize/2)
|
||||
EmuMiddleSquareY=(Ysize/2)
|
||||
@ -326,46 +378,27 @@ RomUpSquareSizeY=round(((Ysize-(RomIndiceY*4))/3))
|
||||
RomUpSquareX=round(RomIndiceX + RomUpSquareSizeX/2)
|
||||
RomUpSquareY=round(RomIndiceY + RomUpSquareSizeY/2)
|
||||
|
||||
|
||||
|
||||
RomMiddleSquareX=RomIndiceX
|
||||
RomMiddleSquareY=(RomIndiceY*2) + RomUpSquareSizeY
|
||||
RomMiddleSquareSizeX=RomUpSquareSizeX
|
||||
RomMiddleSquareSizeY=RomUpSquareSizeY
|
||||
RomMiddleSquareX=RomUpSquareX
|
||||
RomMiddleSquareY=RomUpSquareY*2 + RomUpSquareSizeY/2
|
||||
|
||||
RomBottomSquareX=RomIndiceX
|
||||
RomBottomSquareY=(RomIndiceY*3) + (RomUpSquareSizeY*2)
|
||||
RomBottomSquareSizeX=RomUpSquareSizeX
|
||||
RomBottomSquareSizeY=RomUpSquareSizeY
|
||||
RomBottomSquareX=RomUpSquareX
|
||||
RomBottomSquareY=RomUpSquareY*3 + RomUpSquareSizeY
|
||||
|
||||
RomLeftSquareX=(RomIndiceX*2) + RomUpSquareSizeX
|
||||
RomLeftSquareY=RomIndiceY
|
||||
RomLeftSquareSizeX=round(((Xsize-(RomIndiceX*3))/2))
|
||||
RomBottomSquareTxtUpX=RomIndiceX
|
||||
RomBottomSquareTxtUpY= RomIndiceY*3+RomUpSquareSizeY*2
|
||||
|
||||
RomBottomSquareTxtBottomX=RomBottomSquareTxtUpX + RomBottomSquareSizeX
|
||||
RomBottomSquareTxtBottomY=RomBottomSquareTxtUpY +RomUpSquareSizeY
|
||||
|
||||
|
||||
RomLeftSquareSizeX=RomUpSquareSizeX - RomIndiceX
|
||||
RomLeftSquareSizeY=round((Ysize-(RomIndiceY*2)))
|
||||
|
||||
|
||||
|
||||
|
||||
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))
|
||||
|
||||
RomLeftSquareX=RomIndiceX+ RomLeftSquareSizeX/2 + Xsize/2
|
||||
RomLeftSquareY=round(RomIndiceY + RomLeftSquareSizeY/2)
|
||||
|
||||
####################################################
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user