forked from Oxwald/PS4-pkg-viewer
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d46ac6
commit 5ff2c7f
Showing
55 changed files
with
4,308 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> | ||
<Costura /> | ||
</Weavers> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import re | ||
|
||
class IllegalNameCheck: | ||
@staticmethod | ||
def is_valid_file_name(expression, platform_independent): | ||
s_pattern = r"^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\";|/]+$" | ||
if platform_independent: | ||
s_pattern = r"^(([a-zA-Z]:|\\)\\)?(((\.)|(\.\.)|([^\\/:\*\?\"<>\. ](([^\\/:\*\?\"<>\. ])|([^\\/:\*\?\"<>]*[^\\/:\*\?\"<>\. ]))?))\\)*[^\\/:\*\?\"<>\. ](([^\\/:\*\?\"<>\. ])|([^\\/:\*\?\"<>]*[^\\/:\*\?\"<>\. ]))?$" | ||
return re.match(s_pattern, expression) is not None |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"pkg_directories": [], | ||
"scan_recursive": false, | ||
"play_bgm": false, | ||
"show_directory_settings_at_startup": true, | ||
"auto_sort_row": false, | ||
"local_server_ip": "", | ||
"ps4_ip": "", | ||
"nodejs_installed": false, | ||
"http_server_installed": false, | ||
"official_update_download_directory": "", | ||
"pkg_color_label": false, | ||
"game_pkg_forecolor": -2302756, | ||
"patch_pkg_forecolor": -2302756, | ||
"addon_pkg_forecolor": -2302756, | ||
"app_pkg_forecolor": -2302756, | ||
"game_pkg_backcolor": -12828863, | ||
"patch_pkg_backcolor": -12828863, | ||
"addon_pkg_backcolor": -12828863, | ||
"app_pkg_backcolor": -12828863, | ||
"rename_custom_format": "", | ||
"ps5bc_json_download_date": "", | ||
"psvr_neo_ps5bc_check": false, | ||
"pkg_titleId_column": true, | ||
"pkg_contentId_column": true, | ||
"pkg_region_column": true, | ||
"pkg_minimum_firmware_column": true, | ||
"pkg_version_column": true, | ||
"pkg_type_column": true, | ||
"pkg_category_column": true, | ||
"pkg_size_column": true, | ||
"pkg_location_column": true, | ||
"pkg_backport_column": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
|
||
import os | ||
import sys | ||
from PyInstaller.utils.hooks import collect_all | ||
|
||
block_cipher = None | ||
|
||
# Ottieni il percorso della directory corrente | ||
current_dir = os.path.dirname(os.path.abspath('__main__')) | ||
|
||
# Funzione per verificare l'esistenza di un file o una directory | ||
def resource_path(relative_path): | ||
path = os.path.join(current_dir, relative_path) | ||
if not os.path.exists(path): | ||
print(f"Warning: {path} not found") | ||
return path | ||
|
||
# Raccogli tutti i dati necessari per Crypto | ||
crypto_datas, crypto_binaries, crypto_hiddenimports = collect_all('Crypto') | ||
|
||
a = Analysis( | ||
['main.py'], | ||
pathex=[current_dir], | ||
binaries=crypto_binaries, | ||
datas=crypto_datas, | ||
hiddenimports=[ | ||
'PyQt5', | ||
'PIL', | ||
'kiwisolver', | ||
'concurrent.futures', | ||
'Utilities', | ||
'Utilities.Trophy', | ||
'repack', | ||
] + crypto_hiddenimports, | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False, | ||
) | ||
|
||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
[], | ||
name='PkgToolBox', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
runtime_tmpdir=None, | ||
console=False, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) | ||
|
||
# Crea una cartella per i file temporanei | ||
temp_folder = 'PS4PKGToolTemp' | ||
if not os.path.exists(temp_folder): | ||
os.makedirs(temp_folder) | ||
|
||
# Copia la cartella PS4PKGToolTemp nell'eseguibile | ||
import shutil | ||
shutil.copytree(temp_folder, os.path.join(DISTPATH, temp_folder), dirs_exist_ok=True) | ||
|
||
print(f"Build completed. Executable should be in {DISTPATH}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class ImageIconExtractionType: | ||
ALL = "ALL" | ||
IMAGE = "IMAGE" | ||
ICON = "ICON" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class NamingFormat: | ||
TITLE = "{TITLE}" | ||
TITLE_ID = "{TITLE_ID}" | ||
APP_VERSION = "{APP_VERSION}" | ||
VERSION = "{VERSION}" | ||
CATEGORY = "{CATEGORY}" | ||
CONTENT_ID = "{CONTENT_ID}" | ||
CONTENT_ID2 = "{CONTENT_ID2}" | ||
REGION = "{REGION}" | ||
SYSTEM_VERSION = "{SYSTEM_VERSION}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class PKGCategory: | ||
GAME = "Game" | ||
PATCH = "Patch" | ||
ADDON = "Addon" | ||
APP = "App" | ||
UNKNOWN = "Unknown" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class PKGRegion: | ||
UK = "UK" | ||
EU = "EU" | ||
US = "US" | ||
JAPAN = "JAPAN" | ||
HONG_KONG = "HONG KONG" | ||
ASIA = "ASIA" | ||
KOREA = "KOREA" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class PKGSelectionType: | ||
ALL = "ALL" | ||
SELECTED = "SELECTED" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class PKGState: | ||
FAKE = "Fake" | ||
OFFICIAL = "Official" | ||
ADDON_UNLOCKER = "Addon_Unlocker" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .ImageIconExtractionType import ImageIconExtractionType | ||
from .NamingFormat import NamingFormat | ||
from .PKGCategory import PKGCategory | ||
from .PKGRegion import PKGRegion | ||
from .PKGSelectionType import PKGSelectionType | ||
from .PKGState import PKGState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Extension: | ||
@staticmethod | ||
def get_until_or_empty(text, stop_at="-"): | ||
if text: | ||
char_location = text.find(stop_at) | ||
if char_location > 0: | ||
return text[:char_location] | ||
return "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from PyQt5.QtWidgets import QTreeWidgetItem | ||
|
||
class TreeView: | ||
@staticmethod | ||
def get_all_nodes(node): | ||
list_nodes = [node] | ||
for i in range(node.childCount()): | ||
list_nodes.extend(TreeView.get_all_nodes(node.child(i))) | ||
return list_nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .Extension import Extension | ||
from .TreeView import TreeView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This file is not necessary in Python as imports are handled differently. | ||
# However, we can use it to define some common global imports. | ||
|
||
from PyQt5.QtWidgets import QMessageBox | ||
from PyQt5.QtGui import QColor | ||
import os | ||
import json | ||
import struct | ||
import io | ||
import zipfile | ||
from typing import List, Optional | ||
|
||
# Imports from custom utilities | ||
from Utilities.PS4PKGToolHelper.Helper import Helper | ||
from Utilities.PS4PKGToolHelper.MessageBoxHelper import MessageBoxHelper | ||
from Utilities.Settings.AppSettings import AppSettings | ||
from Utilities.Settings.SettingsManager import SettingsManager | ||
|
||
# Other common imports can be added here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem | ||
from PyQt5.QtGui import QColor, QBrush | ||
|
||
class ListViewDraw: | ||
@staticmethod | ||
def color_list_view_header(tree_widget, back_color, fore_color): | ||
for i in range(tree_widget.columnCount()): | ||
tree_widget.headerItem().setBackground(i, QBrush(back_color)) | ||
tree_widget.headerItem().setForeground(i, QBrush(fore_color)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import logging | ||
import sys | ||
|
||
class Logger: | ||
@staticmethod | ||
def setup_logger(): | ||
logging.basicConfig(filename='PS4PKGToolLog.txt', level=logging.DEBUG, | ||
format='%(asctime)s - %(levelname)s: %(message)s', | ||
datefmt='%Y-%m-%d %H:%M:%S') | ||
console = logging.StreamHandler(sys.stdout) | ||
console.setLevel(logging.INFO) | ||
formatter = logging.Formatter('%(levelname)s: %(message)s') | ||
console.setFormatter(formatter) | ||
logging.getLogger('').addHandler(console) | ||
|
||
@staticmethod | ||
def log_information(message): | ||
try: | ||
logging.info(message) | ||
except Exception as e: | ||
logging.error(f"Errore nel logging: {str(e)}") | ||
|
||
@staticmethod | ||
def log_error(message): | ||
try: | ||
logging.error(message) | ||
except Exception as e: | ||
logging.error(f"Errore nel logging: {str(e)}") | ||
|
||
@staticmethod | ||
def log_warning(message): | ||
try: | ||
logging.warning(message) | ||
except Exception as e: | ||
logging.error(f"Errore nel logging: {str(e)}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from PyQt5.QtWidgets import QFileDialog | ||
|
||
class DialogHelper: | ||
@staticmethod | ||
def show_folder_browser_dialog(): | ||
dialog = QFileDialog() | ||
dialog.setFileMode(QFileDialog.Directory) | ||
if dialog.exec_(): | ||
return dialog.selectedFiles()[0] | ||
return None | ||
|
||
@staticmethod | ||
def show_save_file_dialog(title, filter): | ||
dialog = QFileDialog() | ||
dialog.setAcceptMode(QFileDialog.AcceptSave) | ||
dialog.setNameFilter(filter) | ||
dialog.setWindowTitle(title) | ||
if dialog.exec_(): | ||
return dialog.selectedFiles()[0] | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import os | ||
import json | ||
from datetime import datetime | ||
from PyQt5.QtWidgets import QMessageBox | ||
from PyQt5.QtGui import QPixmap | ||
from PyQt5.QtCore import QByteArray, Qt | ||
|
||
class Helper: | ||
first_launch = True | ||
finalize_pkg_process = True | ||
ps4pkg_tool_temp_directory = "path/to/temp/directory" | ||
orbis_pub_cmd = os.path.join(ps4pkg_tool_temp_directory, "orbis-pub-cmd.exe") | ||
ps5_bc_json_file = os.path.join(ps4pkg_tool_temp_directory, "ps5bc.json") | ||
ps4pkg_tool_log_file = os.path.join(ps4pkg_tool_temp_directory, "PS4PKGToolLog.txt") | ||
|
||
@staticmethod | ||
def round_bytes(num): | ||
if num < 1024: | ||
return f"{num} bytes" | ||
elif num < 1048576: | ||
return f"{round(num / 1024, 2)} KB" | ||
elif num < 1073741824: | ||
return f"{round(num / 1048576, 2)} MB" | ||
elif num < 1099511627776: | ||
return f"{round(num / 1073741824, 2)} GB" | ||
else: | ||
return f"{round(num / 1099511627776, 2)} TB" | ||
|
||
@staticmethod | ||
def extract_resources(): | ||
pass | ||
|
||
@classmethod | ||
def get_backport_info_file(cls): | ||
return os.path.join(cls.ps4pkg_tool_temp_directory, "backport.json") | ||
|
||
class Backport: | ||
backport_info_file = None | ||
pkg_file_list = [] | ||
|
||
@staticmethod | ||
def check_pkg_backported(pkg_file): | ||
if Backport.backport_info_file is None: | ||
Backport.backport_info_file = Helper.get_backport_info_file() | ||
with open(Backport.backport_info_file, 'r') as f: | ||
Backport.pkg_file_list = json.load(f) | ||
matching_file = next((file for file in Backport.pkg_file_list if file["FilePath"].lower() == pkg_file.lower()), None) | ||
return matching_file["Backported"] if matching_file else None | ||
|
||
@staticmethod | ||
def save_data(data_grid_view): | ||
updated_pkg_file_list = [] | ||
for row in data_grid_view: | ||
file_path = os.path.join(row[12], row[0]) | ||
backported = "No" if row[13] == "No" else row[13] | ||
updated_pkg_file_list.append({"FilePath": file_path, "Backported": backported}) | ||
with open(Backport.backport_info_file, 'w') as f: | ||
json.dump(updated_pkg_file_list, f, indent=4) | ||
|
||
class Bitmap: | ||
pic0 = None | ||
pic1 = None | ||
fail_extract_image_list = "" | ||
|
||
@staticmethod | ||
def bytes_to_bitmap(img_bytes): | ||
pixmap = QPixmap() | ||
pixmap.loadFromData(QByteArray(img_bytes)) | ||
return pixmap | ||
|
||
@staticmethod | ||
def resize_image(image, width, height): | ||
return image.scaled(width, height, aspectRatioMode=Qt.KeepAspectRatio, transformMode=Qt.SmoothTransformation) | ||
|
||
class Trophy: | ||
trophy = None | ||
id_entry_list = [] | ||
name_entry_list = [] | ||
image_to_extract_list = [] | ||
trophy_filename_to_extract_list = [] | ||
trophy_temp_folder = os.path.join(Helper.ps4pkg_tool_temp_directory, "TrophyFile") | ||
out_path = "" | ||
|
||
@staticmethod | ||
def resize_image(image, width, height): | ||
return image.scaled(width, height, aspectRatioMode=Qt.KeepAspectRatio, transformMode=Qt.SmoothTransformation) |
Oops, something went wrong.