4 Commits
v2.1b4 ... v2.1

Author SHA1 Message Date
Ian Burgwin
d12684d8bf version 2.1 2021-09-12 09:02:27 -07:00
Ian Burgwin
54ae8a504c check for id0 (closes #49) 2021-09-12 08:50:59 -07:00
Ian Burgwin
d97e11e4ec use setup script to build cx-freeze standalone 2021-07-26 11:31:34 -07:00
Ian Burgwin
c3448c388e ci-gui: use relative path when loading tcl (to fix non-latin characters in the absolute path), prevent taskbar lib errors from causing an exit 2021-07-13 07:08:36 -07:00
4 changed files with 51 additions and 8 deletions

View File

@@ -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()

View File

@@ -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:

View File

@@ -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
View 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
)