From 53802cee596f6cbb17b580d6e0a572ccf2c6b5a1 Mon Sep 17 00:00:00 2001 From: LemonHaze420 <35783139+LemonHaze420@users.noreply.github.com> Date: Tue, 16 Apr 2024 11:13:09 +0100 Subject: [PATCH 1/4] Fixed Infinity typo --- extras/apps/uninstaller/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/apps/uninstaller/main.c b/extras/apps/uninstaller/main.c index 84b7a520..419a59ee 100644 --- a/extras/apps/uninstaller/main.c +++ b/extras/apps/uninstaller/main.c @@ -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) From 4b65909d5af44add53fbf36a1e431dcf5225a269 Mon Sep 17 00:00:00 2001 From: yoti Date: Tue, 16 Apr 2024 13:15:08 +0300 Subject: [PATCH 2/4] MagicMemoryCreator fixes --- contrib/PC/MagicMemoryCreator/main.py | 41 ++++++++++++------- .../PC/MagicMemoryCreator/msipl_installer.py | 10 ++--- .../PC/MagicMemoryCreator/prep_windows.bat | 2 + .../PC/MagicMemoryCreator/requirements.txt | 3 +- contrib/PC/MagicMemoryCreator/run_windows.bat | 10 +++++ .../MagicMemoryCreator/run_windows_debug.bat | 11 +++++ 6 files changed, 56 insertions(+), 21 deletions(-) create mode 100644 contrib/PC/MagicMemoryCreator/prep_windows.bat create mode 100644 contrib/PC/MagicMemoryCreator/run_windows.bat create mode 100644 contrib/PC/MagicMemoryCreator/run_windows_debug.bat diff --git a/contrib/PC/MagicMemoryCreator/main.py b/contrib/PC/MagicMemoryCreator/main.py index 6031df34..29d9c13e 100755 --- a/contrib/PC/MagicMemoryCreator/main.py +++ b/contrib/PC/MagicMemoryCreator/main.py @@ -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': @@ -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') @@ -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: diff --git a/contrib/PC/MagicMemoryCreator/msipl_installer.py b/contrib/PC/MagicMemoryCreator/msipl_installer.py index 72a780f3..92c05af0 100755 --- a/contrib/PC/MagicMemoryCreator/msipl_installer.py +++ b/contrib/PC/MagicMemoryCreator/msipl_installer.py @@ -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' @@ -54,7 +55,6 @@ def __init__(self, data): def main(args): - if is_windows: diskID = f'\\\\.\\PHYSICALDRIVE{args.pdisk}' diff --git a/contrib/PC/MagicMemoryCreator/prep_windows.bat b/contrib/PC/MagicMemoryCreator/prep_windows.bat new file mode 100644 index 00000000..1db7e0ef --- /dev/null +++ b/contrib/PC/MagicMemoryCreator/prep_windows.bat @@ -0,0 +1,2 @@ +@echo off +python.exe -m pip install -r requirements.txt \ No newline at end of file diff --git a/contrib/PC/MagicMemoryCreator/requirements.txt b/contrib/PC/MagicMemoryCreator/requirements.txt index 0e0c401a..f454a1b2 100644 --- a/contrib/PC/MagicMemoryCreator/requirements.txt +++ b/contrib/PC/MagicMemoryCreator/requirements.txt @@ -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' diff --git a/contrib/PC/MagicMemoryCreator/run_windows.bat b/contrib/PC/MagicMemoryCreator/run_windows.bat new file mode 100644 index 00000000..d9c3db24 --- /dev/null +++ b/contrib/PC/MagicMemoryCreator/run_windows.bat @@ -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 \ No newline at end of file diff --git a/contrib/PC/MagicMemoryCreator/run_windows_debug.bat b/contrib/PC/MagicMemoryCreator/run_windows_debug.bat new file mode 100644 index 00000000..9d4f8652 --- /dev/null +++ b/contrib/PC/MagicMemoryCreator/run_windows_debug.bat @@ -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 \ No newline at end of file From 3a4ae7460d7f47d2dd2934436272de6d1f61ebc3 Mon Sep 17 00:00:00 2001 From: LemonHaze420 <35783139+LemonHaze420@users.noreply.github.com> Date: Tue, 16 Apr 2024 11:40:58 +0100 Subject: [PATCH 3/4] Fix refresh button in MagicMemoryCreator --- contrib/PC/MagicMemoryCreator/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/PC/MagicMemoryCreator/main.py b/contrib/PC/MagicMemoryCreator/main.py index 6031df34..d089b617 100755 --- a/contrib/PC/MagicMemoryCreator/main.py +++ b/contrib/PC/MagicMemoryCreator/main.py @@ -68,8 +68,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: From aa32b2ee267fc76877868288f69cfef6bc1a61a3 Mon Sep 17 00:00:00 2001 From: Brennen Murphy Date: Tue, 16 Apr 2024 07:07:45 -0400 Subject: [PATCH 4/4] Format option (not working yet) --- contrib/PC/MagicMemoryCreator/main.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/contrib/PC/MagicMemoryCreator/main.py b/contrib/PC/MagicMemoryCreator/main.py index 62990187..3f254efb 100755 --- a/contrib/PC/MagicMemoryCreator/main.py +++ b/contrib/PC/MagicMemoryCreator/main.py @@ -27,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) @@ -59,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' @@ -97,8 +105,10 @@ 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" @@ -187,9 +197,6 @@ 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!") @@ -197,7 +204,6 @@ def run() -> None: 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__']) @@ -254,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)