diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 29a960b..abbae25 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -19,8 +19,8 @@
-
-
+
+
@@ -28,19 +28,10 @@
-
-
-
-
-
-
-
-
-
-
+
@@ -50,7 +41,7 @@
-
+
@@ -61,7 +52,7 @@
-
+
@@ -73,7 +64,7 @@
-
+
@@ -82,8 +73,8 @@
-
-
+
+
@@ -91,31 +82,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -150,6 +120,7 @@
print(
read_re
datetime
+ down
utils.make_dir
@@ -394,9 +365,9 @@
+
-
@@ -422,14 +393,15 @@
+
-
+
-
+
@@ -441,7 +413,7 @@
-
+
@@ -500,42 +472,40 @@
-
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -545,39 +515,22 @@
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -586,8 +539,8 @@
-
-
+
+
diff --git a/FinTrinity.py b/FinTrinity.py
index 3cad39c..33ca5b2 100644
--- a/FinTrinity.py
+++ b/FinTrinity.py
@@ -20,14 +20,17 @@ def __init__(self):
def read_config(self):
try:
+ username = None
+ account = None
+
if platform.uname().system == "Windows":
self.apps_path = Path(Utils.read_hkcu(r"Software\codestation\qcma", 'appsPath')) / 'PGAME'
account = Utils.read_hkcu(r"Software\codestation\qcma", 'lastAccountId')
username = Utils.read_hkcu(r"Software\codestation\qcma", 'lastOnlineId')
elif platform.uname().system == "Linux":
- self.apps_path = Path(Utils.read_conf('Linux', 'appsPath'))
- account = Utils.read_conf('Linux', 'lastAccountId')
- username = Utils.read_conf('Linux', 'lastOnlineId')
+ self.apps_path = Path(Utils.read_conf('appsPath')) / 'PGAME'
+ account = Utils.read_conf('lastAccountId')
+ username = Utils.read_conf('lastOnlineId')
if not os.path.exists(self.apps_path):
print(f"{self.apps_path} does not exist. Please ensure you have run QCMA and backed up your game.")
@@ -68,10 +71,15 @@ def backup_game(self):
def download_dependencies(self):
print(f"Downloading and Extracting Dependencies")
+ psvimgtools = None
+ if platform.uname().system == "Windows":
+ psvimgtools = "https://github.com/yifanlu/psvimgtools/releases/download/v0.1/psvimgtools-0.1-win64.zip"
+ elif platform.uname().system == "Linux":
+ psvimgtools = "https://github.com/yifanlu/psvimgtools/releases/download/v0.1/psvimgtools-0.1-linux64.zip"
+
Utils.download('https://github.com/TheOfficialFloW/Trinity/releases/download/v1.0/PBOOT.PBP', self.working_dir)
- Utils.download('https://github.com/yifanlu/psvimgtools/releases/download/v0.1/psvimgtools-0.1-win64.zip',
- self.working_dir)
- Utils.extract(self.working_dir / 'psvimgtools-0.1-win64.zip', self.decrypt_dir)
+ Utils.download(psvimgtools, self.working_dir)
+ Utils.extract(self.working_dir / psvimgtools.split("/")[-1], self.decrypt_dir)
def hack(self):
print(f"Applying Trinity Hack:\n\n\n")
diff --git a/classes/Utils.py b/classes/Utils.py
index f01ac81..87b6140 100644
--- a/classes/Utils.py
+++ b/classes/Utils.py
@@ -1,17 +1,20 @@
import os
import shutil
-import winreg
from urllib import request
from zipfile import ZipFile
import datetime
from pathlib import Path
import sys
+import platform
+import stat
def decrypt_game(key, src, pboot, game_id):
print("Decrypting:\n")
os.chdir(src)
- command = f'psvimg-extract -K {key} game/game.psvimg game_dec'
+ if platform.uname().system == "Linux":
+ os.chmod("./psvimg-extract", stat.S_IRWXU)
+ command = f'./psvimg-extract -K {key} game/game.psvimg game_dec'
print(command)
if os.system(command) != 0:
print("Decryption failed with the above information.")
@@ -22,7 +25,9 @@ def decrypt_game(key, src, pboot, game_id):
def encrypt_game(key, src, dst):
print("\nEncrypting:\n")
os.chdir(src)
- command = f'psvimg-create -n game -K {key} game_dec "{dst}/game"'
+ if platform.uname().system == "Linux":
+ os.chmod("./psvimg-create", stat.S_IRWXU)
+ command = f'./psvimg-create -n game -K {key} game_dec "{dst}/game"'
print(command)
if os.system(command) != 0:
print("Game Creation failed with the above information.")
@@ -38,10 +43,18 @@ def make_dir(d):
def read_hkcu(key: str, val: str):
+ import winreg
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, key, 0, winreg.KEY_READ) as key:
return winreg.QueryValueEx(key, val)[0]
+def read_conf(val: str):
+ with open(os.path.expanduser('~/.config/codestation/qcma.conf')) as config:
+ for line in config.readlines():
+ if line.startswith(val):
+ return line.split("=")[1].replace("\n", "")
+
+
def download(url, dst):
request.urlretrieve(url, f'{dst}/{url.split("/")[-1]}')
diff --git a/classes/__pycache__/Game.cpython-37.pyc b/classes/__pycache__/Game.cpython-37.pyc
index f70391f..8275469 100644
Binary files a/classes/__pycache__/Game.cpython-37.pyc and b/classes/__pycache__/Game.cpython-37.pyc differ
diff --git a/classes/__pycache__/User.cpython-37.pyc b/classes/__pycache__/User.cpython-37.pyc
index ce41f0c..e1f0e2f 100644
Binary files a/classes/__pycache__/User.cpython-37.pyc and b/classes/__pycache__/User.cpython-37.pyc differ
diff --git a/classes/__pycache__/Utils.cpython-37.pyc b/classes/__pycache__/Utils.cpython-37.pyc
index edbab0b..6c12b94 100644
Binary files a/classes/__pycache__/Utils.cpython-37.pyc and b/classes/__pycache__/Utils.cpython-37.pyc differ