mirror of
https://github.com/ihaveamac/custom-install.git
synced 2026-01-21 14:06:02 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d12684d8bf | ||
|
|
54ae8a504c | ||
|
|
d97e11e4ec | ||
|
|
c3448c388e |
27
ci-gui.py
27
ci-gui.py
@@ -6,7 +6,7 @@
|
||||
|
||||
from os import environ, scandir
|
||||
from os.path import abspath, basename, dirname, join, isfile
|
||||
from sys import exc_info, platform
|
||||
import sys
|
||||
from threading import Thread, Lock
|
||||
from time import strftime
|
||||
from traceback import format_exception
|
||||
@@ -29,9 +29,15 @@ if TYPE_CHECKING:
|
||||
from os import PathLike
|
||||
from typing import Dict, List, Union
|
||||
|
||||
is_windows = platform == 'win32'
|
||||
frozen = getattr(sys, 'frozen', None)
|
||||
is_windows = sys.platform == 'win32'
|
||||
taskbar = None
|
||||
if is_windows:
|
||||
if frozen:
|
||||
# attempt to fix loading tcl/tk when running from a path with non-latin characters
|
||||
tkinter_path = dirname(tk.__file__)
|
||||
tcl_path = join(tkinter_path, 'tcl8.6')
|
||||
environ['TCL_LIBRARY'] = 'lib/tkinter/tcl8.6'
|
||||
try:
|
||||
import comtypes.client as cc
|
||||
|
||||
@@ -39,7 +45,7 @@ if is_windows:
|
||||
|
||||
taskbar = cc.CreateObject('{56FDF344-FD6D-11D0-958A-006097C9A090}', interface=tbl.ITaskbarList3)
|
||||
taskbar.HrInit()
|
||||
except ModuleNotFoundError:
|
||||
except (ModuleNotFoundError, UnicodeEncodeError, AttributeError):
|
||||
pass
|
||||
|
||||
file_parent = dirname(abspath(__file__))
|
||||
@@ -492,7 +498,7 @@ class CustomInstallGUI(ttk.Frame):
|
||||
self.log(f'custom-install {CI_VERSION} - https://github.com/ihaveamac/custom-install', status=False)
|
||||
|
||||
if is_windows and not taskbar:
|
||||
self.log('Note: comtypes module not found.')
|
||||
self.log('Note: Could not load taskbar lib.')
|
||||
self.log('Note: Progress will not be shown in the Windows taskbar.')
|
||||
|
||||
self.log('Ready.')
|
||||
@@ -636,7 +642,6 @@ class CustomInstallGUI(ttk.Frame):
|
||||
for path in self.readers.keys():
|
||||
self.update_status(path, InstallStatus.Waiting)
|
||||
self.disable_buttons()
|
||||
self.log('Starting install...')
|
||||
|
||||
if taskbar:
|
||||
taskbar.SetProgressState(self.hwnd, tbl.TBPF_NORMAL)
|
||||
@@ -646,6 +651,16 @@ class CustomInstallGUI(ttk.Frame):
|
||||
skip_contents=self.skip_contents_var.get() == 1,
|
||||
overwrite_saves=self.overwrite_saves_var.get() == 1)
|
||||
|
||||
if not installer.check_for_id0():
|
||||
self.show_error(f'id0 {installer.crypto.id0.hex()} was not found inside "Nintendo 3DS" on the SD card.\n'
|
||||
f'\n'
|
||||
f'Before using custom-install, you should use this SD card on the appropriate console.\n'
|
||||
f'\n'
|
||||
f'Otherwise, make sure the correct movable.sed is being used.')
|
||||
return
|
||||
|
||||
self.log('Starting install...')
|
||||
|
||||
# use the treeview which has been sorted alphabetically
|
||||
readers_final = []
|
||||
for k in self.treeview.get_children():
|
||||
@@ -711,7 +726,7 @@ class CustomInstallGUI(ttk.Frame):
|
||||
"Either title.db doesn't exist, or save3ds_fuse couldn't be run.")
|
||||
self.open_console()
|
||||
except:
|
||||
installer.event.on_error(exc_info())
|
||||
installer.event.on_error(sys.exc_info())
|
||||
finally:
|
||||
self.enable_buttons()
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ if is_windows:
|
||||
else:
|
||||
from os import statvfs
|
||||
|
||||
CI_VERSION = '2.1b4'
|
||||
CI_VERSION = '2.1'
|
||||
|
||||
# used to run the save3ds_fuse binary next to the script
|
||||
frozen = getattr(sys, 'frozen', False)
|
||||
@@ -271,6 +271,10 @@ class CustomInstall:
|
||||
free_space = get_free_space(self.sd)
|
||||
return total_size, free_space
|
||||
|
||||
def check_for_id0(self):
|
||||
sd_path = join(self.sd, 'Nintendo 3DS', self.crypto.id0.hex())
|
||||
return isdir(sd_path)
|
||||
|
||||
def start(self):
|
||||
if frozen:
|
||||
save3ds_fuse_path = join(script_dir, 'bin', 'save3ds_fuse')
|
||||
@@ -723,6 +727,10 @@ if __name__ == "__main__":
|
||||
installer.event.update_percentage += percent_handle
|
||||
installer.event.on_error += error
|
||||
|
||||
if not installer.check_for_id0():
|
||||
installer.event.on_error(f'Could not find id0 directory {installer.crypto.id0.hex()} '
|
||||
f'inside Nintendo 3DS directory.')
|
||||
|
||||
installer.prepare_titles(args.cia)
|
||||
|
||||
if not args.skip_contents:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
mkdir build
|
||||
mkdir dist
|
||||
cxfreeze ci-gui.py --target-dir=build\custom-install-standalone --base-name=Win32GUI
|
||||
python setup-cxfreeze.py build_exe --build-exe=build\custom-install-standalone
|
||||
mkdir build\custom-install-standalone\bin
|
||||
copy TaskbarLib.tlb build\custom-install-standalone
|
||||
copy bin\win32\save3ds_fuse.exe build\custom-install-standalone\bin
|
||||
@@ -8,5 +8,6 @@ copy bin\README build\custom-install-standalone\bin
|
||||
copy custom-install-finalize.3dsx build\custom-install-standalone
|
||||
copy title.db.gz build\custom-install-standalone
|
||||
copy extras\windows-quickstart.txt build\custom-install-standalone
|
||||
copy extras\run_with_cmd.bat build\custom-install-standalone
|
||||
copy LICENSE.md build\custom-install-standalone
|
||||
python -m zipfile -c dist\custom-install-standalone.zip build\custom-install-standalone
|
||||
|
||||
19
setup-cxfreeze.py
Normal file
19
setup-cxfreeze.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import sys
|
||||
from cx_Freeze import setup, Executable
|
||||
|
||||
if sys.platform == 'win32':
|
||||
executables = [
|
||||
Executable('ci-gui.py', target_name='ci-gui-console'),
|
||||
Executable('ci-gui.py', target_name='ci-gui', base='Win32GUI'),
|
||||
]
|
||||
else:
|
||||
executables = [
|
||||
Executable('ci-gui.py', target_name='ci-gui'),
|
||||
]
|
||||
|
||||
setup(
|
||||
name = "ci-gui",
|
||||
version = "2.1b4",
|
||||
description = "Installs a title directly to an SD card for the Nintendo 3DS",
|
||||
executables = executables
|
||||
)
|
||||
Reference in New Issue
Block a user