Skip to content

Commit

Permalink
pop-fe-ps3: add a preview that shows what the game will look like on …
Browse files Browse the repository at this point in the history
…the xmb

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
  • Loading branch information
sahlberg committed Aug 13, 2022
1 parent 86f9aae commit 86a162f
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 23 deletions.
36 changes: 18 additions & 18 deletions gamedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6788,31 +6788,31 @@
'id': 'SLUS00421',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLUS00592': {
'url': "games/U/R/SLUS-00421.html",
'id': 'SLUS00592',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLUS00748': {
'url': "games/U/R/SLUS-00748.html",
'id': 'SLUS00748',
'title': "RESIDENT EVIL 2 (DUAL SHOCK VERSION)",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLUS00756': {
'url': "games/U/R/SLUS-00748.html",
'id': 'SLUS00756',
'title': "RESIDENT EVIL 2 (DUAL SHOCK VERSION)",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLUS00923': {
Expand Down Expand Up @@ -19300,79 +19300,79 @@
'id': 'SLES00972',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES10972': {
'url': "games/P/R/SLES-00972.html",
'id': 'SLES10972',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES00973': {
'url': "games/P/R/SLES-00973.html",
'id': 'SLES00973',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES10973': {
'url': "games/P/R/SLES-00973.html",
'id': 'SLES10973',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES00974': {
'url': "games/P/R/SLES-00974.html",
'id': 'SLES00974',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES10974': {
'url': "games/P/R/SLES-00974.html",
'id': 'SLES10974',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES00975': {
'url': "games/P/R/SLES-00975.html",
'id': 'SLES00975',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES10975': {
'url': "games/P/R/SLES-00975.html",
'id': 'SLES10975',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES00976': {
'url': "games/P/R/SLES-00976.html",
'id': 'SLES00976',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES10976': {
'url': "games/P/R/SLES-00976.html",
'id': 'SLES10976',
'title': "RESIDENT EVIL 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLES02529': {
Expand Down Expand Up @@ -25583,31 +25583,31 @@
'url': "games/J/B/SLPS-01222.html",
'id': 'SLPS01222',
'title': "BIOHAZARD 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLPS01223': {
'url': "games/J/B/SLPS-01222.html",
'id': 'SLPS01223',
'title': "BIOHAZARD 2",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLPS01510': {
'url': "games/J/B/SLPS-01510.html",
'id': 'SLPS01510',
'title': "BIOHAZARD 2 - DUAL SHOCK",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
'SLPS01511': {
'url': "games/J/B/SLPS-01510.html",
'id': 'SLPS01511',
'title': "BIOHAZARD 2 - DUAL SHOCK",
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss2.jpg',
'pic0': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss17.jpg',
'pic1': 'https://psxdatacenter.com/images/screens/P/R/SLES-00976/ss3.jpg',
'snd0': 'https://www.youtube.com/watch?v=UF4mYv4WagM&list=PLmAjrkj1KHpL3nA9S31EJwp8nc0m_p9x6&index=6'
},
Expand Down
26 changes: 25 additions & 1 deletion pop-fe-ps3.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def __init__(self, master=None):
self.pic0_tk = None
self.pic1 = None
self.pic1_tk = None
self.preview_tk = None
self.pkgdir = None

self.master = master
Expand Down Expand Up @@ -125,6 +126,7 @@ def init_data(self):
self.pic0_tk = None
self.pic1 = None
self.pic1_tk = None
self.preview_tk = None
self.pkgdir = None
for idx in range(1,5):
self.builder.get_object('disc' + str(idx), self.master).config(filetypes=[('Image files', ['.cue', '.bin', '.img']), ('All Files', ['*.*', '*'])])
Expand All @@ -138,6 +140,23 @@ def init_data(self):
self.builder.get_variable('title_variable').set('')
self.builder.get_object('snd0', self.master).config(filetypes=[('Audio files', ['.wav']), ('All Files', ['*.*', '*'])])


def update_preview(self):
if not self.pic1:
return
c = self.builder.get_object('preview_canvas', self.master)
p1 = self.pic1.resize((382,216), Image.BILINEAR)
if self.pic0:
p0 = self.pic0.resize((int(p1.size[0] * 0.55) , int(p1.size[1] * 0.58)), Image.BILINEAR)
Image.Image.paste(p1, p0, box=(148,79))
if self.icon0:
i0 = self.icon0.resize((int(p1.size[0] * 0.10) , int(p1.size[0] * 0.10)), Image.BILINEAR)
Image.Image.paste(p1, i0, box=(100,79))
temp_files.append('pop-fe-ps3-work/PREVIEW.PNG')
p1.save('pop-fe-ps3-work/PREVIEW.PNG')
self.preview_tk = tk.PhotoImage(file = 'pop-fe-ps3-work/PREVIEW.PNG')
c = self.builder.get_object('preview_canvas', self.master)
c.create_image(0, 0, image=self.preview_tk, anchor='nw')

def on_path_changed(self, event):
cue_file = event.widget.cget('path')
Expand Down Expand Up @@ -237,6 +256,9 @@ def on_path_changed(self, event):
self.pic1_tk = tk.PhotoImage(file = 'pop-fe-ps3-work/PIC1.PNG')
c = self.builder.get_object('pic1_canvas', self.master)
c.create_image(0, 0, image=self.pic1_tk, anchor='nw')

self.update_preview()

self.builder.get_object('disc1', self.master).config(state='disabled')
self.builder.get_object('disc2', self.master).config(state='normal')
self.builder.get_object('create_button', self.master).config(state='normal')
Expand Down Expand Up @@ -271,7 +293,7 @@ def on_icon0_clicked(self, event):
self.icon0_tk = tk.PhotoImage(file = 'pop-fe-ps3-work/ICON0.PNG')
c = self.builder.get_object('icon0_canvas', self.master)
c.create_image(0, 0, image=self.icon0_tk, anchor='nw')

self.update_preview()

def on_pic0_clicked(self, event):
filetypes = [
Expand All @@ -288,6 +310,7 @@ def on_pic0_clicked(self, event):
self.pic0_tk = tk.PhotoImage(file = 'pop-fe-ps3-work/PIC0.PNG')
c = self.builder.get_object('pic0_canvas', self.master)
c.create_image(0, 0, image=self.pic0_tk, anchor='nw')
self.update_preview()

def on_pic1_clicked(self, event):
filetypes = [
Expand All @@ -304,6 +327,7 @@ def on_pic1_clicked(self, event):
self.pic1_tk = tk.PhotoImage(file = 'pop-fe-ps3-work/PIC1.PNG')
c = self.builder.get_object('pic1_canvas', self.master)
c.create_image(0, 0, image=self.pic1_tk, anchor='nw')
self.update_preview()

def on_dir_changed(self, event):
self.pkgdir = event.widget.cget('path')
Expand Down
40 changes: 36 additions & 4 deletions pop-fe-ps3.ui
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@
<property name="orient">horizontal</property>
<layout manager="grid">
<property name="column">0</property>
<property name="columnspan">2</property>
<property name="columnspan">3</property>
<property name="row">4</property>
<property name="sticky">ew</property>
</layout>
</object>
</child>
<child>
<object class="ttk.Frame" id="frame1">
<object class="ttk.Frame" id="nameofgame">
<property name="height">200</property>
<property name="width">200</property>
<layout manager="grid">
Expand Down Expand Up @@ -310,7 +310,7 @@
</object>
</child>
<child>
<object class="ttk.Frame" id="frame3">
<object class="ttk.Frame" id="outputpkg">
<property name="height">200</property>
<property name="width">200</property>
<layout manager="grid">
Expand Down Expand Up @@ -382,7 +382,7 @@
<property name="width">200</property>
<layout manager="grid">
<property name="column">0</property>
<property name="columnspan">2</property>
<property name="columnspan">3</property>
<property name="padx">10</property>
<property name="pady">5</property>
<property name="row">5</property>
Expand Down Expand Up @@ -418,5 +418,37 @@
</layout>
</object>
</child>
<child>
<object class="ttk.Frame" id="preview">
<layout manager="grid">
<property name="column">2</property>
<property name="row">0</property>
<property name="sticky">nsew</property>
</layout>
<child>
<object class="ttk.Label" id="label2">
<property name="text" translatable="yes">Preview:</property>
<layout manager="grid">
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="tk.Canvas" id="preview_canvas">
<property name="background">white</property>
<property name="borderwidth">1</property>
<property name="height">216</property>
<property name="width">384</property>
<layout manager="grid">
<property name="column">0</property>
<property name="padx">10</property>
<property name="pady">10</property>
<property name="row">1</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

0 comments on commit 86a162f

Please sign in to comment.