Skip to content

Commit

Permalink
updated DC-ARK-Maker GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
krazynez committed Apr 15, 2024
1 parent d9c82c3 commit ee5d99c
Showing 1 changed file with 72 additions and 17 deletions.
89 changes: 72 additions & 17 deletions contrib/PC/MagicMemoryCreator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@
m=tk.Tk()
m.title('DC-ARK Maker')

# variable setups
var = tk.StringVar(m)
var.set(possible_drive[0])
check = tk.BooleanVar(m)

#disk_check = tk.StringVar(m)
#disk_check.set(0)
disk_check = tk.StringVar(m)
disk_check.set(0)


# globals
go = False

if platform.system().lower() != 'linux' and platform.system().lower() != 'darwin':
import wmi
Expand All @@ -52,17 +58,40 @@
for i in out:
possible_drive.append(i)

def disable_go_check():
if check.get():
go_check['state'] = 'disabled'
check.set(1)
else:
go_check['state'] = 'normal'
check.set(0)

def refresh():
m.destroy()
os.execv(sys.argv[0], sys.argv)

def cleanup() -> None:
shutil.rmtree("661")
os.remove('661.PBP')
os.remove('661.PBP.dec')
global go
if go:
shutil.rmtree("661_GO")
os.remove('661_GO.PBP')
os.remove('661_GO.PBP.dec')
else:
shutil.rmtree("661")
os.remove('661.PBP')
os.remove('661.PBP.dec')
for f in glob.glob("pspdecrypt*"):
os.remove(f)

def go_update():
global go
if go:
go = False
legacy['state'] = 'normal'
else:
go = True
legacy['state'] = 'disabled'

def toggle_run(toggle) -> None:
if toggle != '-':
b['state'] = 'normal'
Expand All @@ -73,6 +102,7 @@ def run() -> None:
b['state'] = "disabled"
x['state'] = "disabled"
b['text'] = "Please Wait..."
global go


# Download pspdecrypt from John
Expand All @@ -82,7 +112,7 @@ def run() -> None:
f.write(resp.content)
with ZipFile('pspdecrypt-1.0-linux.zip', 'r') as zObject:
zObject.extractall(path=f'{os.getcwd()}/')
os.system('chmod 755 pspdecrypt')
os.system('oschmod 755 pspdecrypt')
x['state'] = "normal"
elif platform.system() == 'Windows':
resp = requests.get('https://github.com/John-K/pspdecrypt/releases/download/1.0/pspdecrypt-1.0-windows.zip', verify=False)
Expand All @@ -105,18 +135,35 @@ def run() -> None:
return

# Download 6.61 OFW
resp = requests.get('http://du01.psp.update.playstation.org/update/psp/image/us/2014_1212_6be8878f475ac5b1a499b95ab2f7d301/EBOOT.PBP', verify=False)
with open('661.PBP', 'wb') as f:
f.write(resp.content)
if go:
print('wft no get out of here?')
sys.exit(1)
resp = requests.get('http://du01.psp.update.playstation.org/update/psp/image2/us/2014_1212_fd0f7d0798b4f6e6d32ef95836740527/EBOOT.PBP', verify=False)
with open('661_GO.PBP', 'wb') as f:
f.write(resp.content)
else:
resp = requests.get('http://du01.psp.update.playstation.org/update/psp/image/us/2014_1212_6be8878f475ac5b1a499b95ab2f7d301/EBOOT.PBP', verify=False)
with open('661.PBP', 'wb') as f:
f.write(resp.content)

if platform.system() == 'Linux' or platform.system() == 'Darwin':
os.system('./pspdecrypt -e 661.PBP')
shutil.copytree("661/F0", "TM/DCARK", dirs_exist_ok=True)
shutil.copytree("661/F1", "TM/DCARK", dirs_exist_ok=True)
if go:
os.system('./pspdecrypt -e 661_GO.PBP')
shutil.copytree("661_GO/F0", "TM/DCARK", dirs_exist_ok=True)
shutil.copytree("661_GO/F1", "TM/DCARK", dirs_exist_ok=True)
else:
os.system('./pspdecrypt -e 661.PBP')
shutil.copytree("661/F0", "TM/DCARK", dirs_exist_ok=True)
shutil.copytree("661/F1", "TM/DCARK", dirs_exist_ok=True)
else:
os.system('.\\pspdecrypt.exe -e 661.PBP')
shutil.copytree("661\\F0\\", "TM\\DCARK\\", dirs_exist_ok=True)
shutil.copytree("661\\F1\\", "TM\\DCARK\\", dirs_exist_ok=True)
if go:
os.system('.\\pspdecrypt.exe -e 661_GO.PBP')
shutil.copytree("661_GO\\F0\\", "TM\\DCARK\\", dirs_exist_ok=True)
shutil.copytree("661_GO\\F1\\", "TM\\DCARK\\", dirs_exist_ok=True)
else:
os.system('.\\pspdecrypt.exe -e 661.PBP')
shutil.copytree("661\\F0\\", "TM\\DCARK\\", dirs_exist_ok=True)
shutil.copytree("661\\F1\\", "TM\\DCARK\\", dirs_exist_ok=True)

# Download msipl_installer from Draan (forked for macOS support)
#resp = requests.get('https://raw.githubusercontent.com/krazynez/msipl_installer/main/msipl_installer.py', verify=False)
Expand Down Expand Up @@ -179,7 +226,7 @@ def run() -> None:


# Setup
m.minsize(320, 120)
m.minsize(320, 180)

disk = tk.OptionMenu(m, var, *possible_drive, command=toggle_run)
disk.grid(row=0,column=1)
Expand All @@ -190,10 +237,18 @@ def run() -> None:
#internal=tk.Checkbutton(m, text='Show Internal Disk', variable=disk_check, onvalue=1, offvalue=0)
#internal.grid(row=3, column=1)

go_check=tk.Checkbutton(m, text='PSP GO Model (ONLY!)', command=go_update)
go_check.grid(sticky="W", row=2, column=0)

legacy=tk.Checkbutton(m, text="Legacy IPL ( 1K' and early 2K's ONLY )", variable=check, command=disable_go_check)
legacy.grid(row=3, column=0)


b=tk.Button(m, text='Run', command=run)
b.grid(row=1,column=1)
r=tk.Button(m, text='Refresh', command=refresh)
r.grid(row=3, column=0)
r.grid(row=4, column=0)




Expand Down

0 comments on commit ee5d99c

Please sign in to comment.