Skip to content

Commit

Permalink
Support MacOS version <= 10.14.X
Browse files Browse the repository at this point in the history
  • Loading branch information
MCMi460 committed Jun 1, 2023
1 parent 7ded71f commit 39b1905
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import threading, time, sqlite3, os, sys, datetime
import threading, time, sqlite3, os, sys, datetime, platform
if not sys.platform.startswith('darwin'):
sys.exit('OpenEmu is a macOS exclusive application.')

Expand All @@ -13,9 +13,16 @@
# Define menu bar object and run it
class Client(rumps.App):
def __init__(self):
if not self.check_permissions():
self.request_permissions()
self.handle_error('Failed to receive permissions.', True)
try:
if not self.check_permissions():
self.request_permissions()
self.handle_error('Failed to receive permissions.', True)
except AttributeError as error:
ver = platform.mac_ver()[0].split('.')
if ver[0] == '10' and int(ver[1]) < 15:
print('running pre-screen-recording permissions macos')
else:
raise error
self.rpc = None
self.games = None
self.connect()
Expand Down Expand Up @@ -112,7 +119,7 @@ def get_artwork(self, title:str):
cursor = con.cursor()

# Get sources from image db
cursor.execute("SELECT ZBOX, ZSOURCE FROM ZIMAGE")
cursor.execute('SELECT ZBOX, ZSOURCE FROM ZIMAGE')
art = [(i[0], i[1]) for i in cursor.fetchall()]
cursor.execute('SELECT ZGAMETITLE FROM ZGAME')
games = [ i[0] for i in cursor.fetchall() ]
Expand All @@ -121,24 +128,6 @@ def get_artwork(self, title:str):
games = [ [zpk[i], games[i]] for i in range(len(games)) ]
con.close()

# Ahem, Future Delta here.
# I do not want to mess with past me's stuff.
# I fear no man.
# But this?
# This scares me.

# Reorganize list in case of irregular OpenEmu shennanigans
# i = 0
# for e in games:
# if not e[1]:
# games.remove(e)
# h = i
# for n in range(i, len(games)):
# h += 1
# games[n][0] = h
# i -= 1
# i += 1

# Find game in sources
for i in games:
if not i[1]: # Prevent irregular games from prematurely ending the recursion
Expand Down

0 comments on commit 39b1905

Please sign in to comment.