Skip to content

Commit

Permalink
MagicMemoryCreator fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoti committed Apr 16, 2024
1 parent 96f8e1a commit 4b65909
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 21 deletions.
41 changes: 26 additions & 15 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 Down Expand Up @@ -104,28 +105,30 @@ def run() -> None:
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 +139,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
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

0 comments on commit 4b65909

Please sign in to comment.