Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/PSP-Archive/ARK-4
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseAaronLopezGarcia committed Apr 16, 2024
2 parents 3734900 + aa32b2e commit 13ec7dc
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 31 deletions.
68 changes: 44 additions & 24 deletions contrib/PC/MagicMemoryCreator/main.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env python3
import tkinter as tk
import platform
import os
import time
import sys
import ctypes
import glob
import os
import platform
import requests
import subprocess
import shutil
import subprocess
import sys
import time
import msipl_installer
import urllib3; urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
from zipfile import ZipFile

if platform.system().lower() != 'linux' and platform.system().lower() != 'windows' and platform.system().lower() != 'darwin':
Expand All @@ -26,6 +27,7 @@
var = tk.StringVar(m)
var.set(possible_drive[0])
check = tk.BooleanVar(m)
format_ms_check = tk.BooleanVar(m)

disk_check = tk.StringVar(m)
disk_check.set(0)
Expand Down Expand Up @@ -58,6 +60,13 @@
for i in out:
possible_drive.append(i)

def fmt_ms():
legacy['state'] = 'disabled'
go_check['state'] = 'disabled'
status.config(text='Formatting Memory Stick\nSelected!')
b.config(text='Format')
m.update()

def disable_go_check():
if check.get():
go_check['state'] = 'disabled'
Expand All @@ -68,8 +77,9 @@ def disable_go_check():

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

p = sys.executable
os.execl(p, p, *sys.argv)

def cleanup() -> None:
global go
if go:
Expand All @@ -95,37 +105,41 @@ def go_update():
def toggle_run(toggle) -> None:
if toggle != '-':
b['state'] = 'normal'
format_ms.grid(row=4, column=0, sticky="W")
else:
b['state'] = 'disabled'
format_ms.grid_remove()

def run() -> None:
b['state'] = "disabled"
x['state'] = "disabled"
b['text'] = "Please Wait..."
global go


# Download pspdecrypt from John
if platform.system() == 'Linux':
resp = requests.get('https://github.com/John-K/pspdecrypt/releases/download/1.0/pspdecrypt-1.0-linux.zip', verify=False)
resp = requests.get('https://github.com/John-K/pspdecrypt/releases/download/1.0/pspdecrypt-1.0-linux.zip', timeout=10, verify=False)
with open('pspdecrypt-1.0-linux.zip', 'wb') as f:
f.write(resp.content)
resp.close()
with ZipFile('pspdecrypt-1.0-linux.zip', 'r') as zObject:
zObject.extractall(path=f'{os.getcwd()}/')
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)
resp = requests.get('https://github.com/John-K/pspdecrypt/releases/download/1.0/pspdecrypt-1.0-windows.zip', timeout=10, verify=False)
with open('pspdecrypt-1.0-windows.zip', 'wb') as f:
f.write(resp.content)
resp.close()
with ZipFile('pspdecrypt-1.0-windows.zip', 'r') as zObject:
zObject.extractall(path=f'{os.getcwd()}\\')
os.system('oschmod 755 pspdecrypt.exe')
x['state'] = "normal"
elif platform.system() == 'Darwin':
resp = requests.get('https://github.com/John-K/pspdecrypt/releases/download/1.0/pspdecrypt-1.0-macos.zip', verify=False)
resp = requests.get('https://github.com/John-K/pspdecrypt/releases/download/1.0/pspdecrypt-1.0-macos.zip', timeout=10, verify=False)
with open('pspdecrypt-1.0-macos.zip', 'wb') as f:
f.write(resp.content)
resp.close()
with ZipFile('pspdecrypt-1.0-macos.zip', 'r') as zObject:
zObject.extractall(path=f'{os.getcwd()}/')
os.system('oschmod 755 pspdecrypt')
Expand All @@ -136,13 +150,21 @@ def run() -> None:

# Download 6.61 OFW
if go:
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)
resp = requests.get('http://du01.psp.update.playstation.org/update/psp/image2/us/2014_1212_fd0f7d0798b4f6e6d32ef95836740527/EBOOT.PBP', timeout=10, verify=False)
if resp:
with open('661_GO.PBP', 'wb') as f:
f.write(resp.content)
resp.close()
else:
print(resp.status_code)
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)
resp = requests.get('http://du01.psp.update.playstation.org/update/psp/image/us/2014_1212_6be8878f475ac5b1a499b95ab2f7d301/EBOOT.PBP', timeout=10, verify=False)
if resp:
with open('661.PBP', 'wb') as f:
f.write(resp.content)
resp.close()
else:
print(resp.status_code)

if platform.system() == 'Linux' or platform.system() == 'Darwin':
if go:
Expand Down Expand Up @@ -175,17 +197,13 @@ def run() -> None:
status.config(text="COPYING PLEASE WAIT!")
m.update()
shutil.copytree("TM", get_mountpoint, dirs_exist_ok=True)
#os.system('oschmod 755 msipl_installer.py')
#os.system(f'sudo python3 ./msipl_installer.py --devname {var.get()} --clear')
#os.system(f'sudo python3 ./msipl_installer.py --devname {var.get()} --insert msipl.bin')
msipl_installer.main(msipl_installer.Args(f'{var.get()}', False, None, False, True ))
msipl_installer.main(msipl_installer.Args(f'{var.get()}', False, 'msipl.bin', False, False ))
status.config(fg='green', text="DONE!")
elif platform.system() == 'Darwin':
subprocess.run(['diskutil', 'umountDisk', 'force', f'/dev/{var.get()}'])
subprocess.run(['sync'])
time.sleep(2)
#msipl_installer.main(msipl_installer.Args(f'{var.get()}', False, None, False, True ))
msipl_installer.main(msipl_installer.Args(f'{var.get()}', False, 'msipl.bin', False, False ))
subprocess.run(['diskutil', 'umountDisk', 'force', f'/dev/{var.get()}'])
subprocess.run(['mkdir', '/Volumes/__psp__'])
Expand Down Expand Up @@ -242,12 +260,14 @@ def run() -> None:
legacy.grid(row=3, column=0)



format_ms=tk.Checkbutton(m, text='Format Memory Stick', variable=format_ms_check, command=fmt_ms)


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=4, column=0)


r.grid(row=5, column=0)


x=tk.Button(m, text='Exit', command=m.destroy)
Expand Down
10 changes: 5 additions & 5 deletions contrib/PC/MagicMemoryCreator/msipl_installer.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python3
import argparse
import struct
import math
import os
import time
import platform
import math
import subprocess
import re
import struct
import subprocess
import time

is_windows = os.name == 'nt'
is_macos = platform.system() == 'Darwin'
Expand Down Expand Up @@ -54,7 +55,6 @@ def __init__(self, data):


def main(args):

if is_windows:
diskID = f'\\\\.\\PHYSICALDRIVE{args.pdisk}'

Expand Down
2 changes: 2 additions & 0 deletions contrib/PC/MagicMemoryCreator/prep_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
python.exe -m pip install -r requirements.txt
3 changes: 2 additions & 1 deletion contrib/PC/MagicMemoryCreator/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
oschmod==0.3.12
wmi==1.5.1; sys_platform == 'Windows'
psutil==5.9.8; sys_platform == 'win32'
requests==2.31.0
wmi==1.5.1; sys_platform == 'win32'
10 changes: 10 additions & 0 deletions contrib/PC/MagicMemoryCreator/run_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@echo off
fltmc >nul 2>&1 || (
echo.
echo Run as Admin!
echo.
pause
goto :eof
)
cd /d %~dp0
pythonw.exe main.py
11 changes: 11 additions & 0 deletions contrib/PC/MagicMemoryCreator/run_windows_debug.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off
fltmc >nul 2>&1 || (
echo.
echo Run as Admin!
echo.
pause
goto :eof
)
cd /d %~dp0
python.exe main.py
pause
2 changes: 1 addition & 1 deletion extras/apps/uninstaller/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main(int argc, char *args[]) {
sceKernelDelayThread(3000000);
sceKernelExitGame();
}
printf("Make sure you do not have a cIPL/Infinty installed. \nIt is safest to just use ChronoSwitch to reinstall OFW without ARK-4 modules.\n\nPress X to continue\nPress O to quit...\n");
printf("Make sure you do not have a cIPL/Infinity installed. \nIt is safest to just use ChronoSwitch to reinstall OFW without ARK-4 modules.\n\nPress X to continue\nPress O to quit...\n");
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS)
Expand Down

0 comments on commit 13ec7dc

Please sign in to comment.