def download_hekate(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) common.copy_module_file('hekate', 'bootlogo.bmp', os.path.join(temp_directory, 'bootloader', 'bootlogo.bmp')) common.copy_module_file('hekate', 'hekate_ipl.ini', os.path.join(temp_directory, 'bootloader', 'hekate_ipl.ini')) common.sed('KOSMOS_VERSION', kosmos_version, os.path.join(temp_directory, 'bootloader', 'hekate_ipl.ini')) payload = common.find_file(os.path.join(temp_directory, 'hekate_ctcaer_*.bin')) if len(payload) != 0: shutil.copyfile(payload[0], os.path.join(temp_directory, 'bootloader', 'update.bin')) common.mkdir(os.path.join(temp_directory, 'atmosphere')) shutil.copyfile(payload[0], os.path.join(temp_directory, 'atmosphere', 'reboot_payload.bin')) if not kosmos_build: common.mkdir(os.path.join(temp_directory, '..', 'must_have')) shutil.move(os.path.join(temp_directory, 'bootloader'), os.path.join(temp_directory, '..', 'must_have')) shutil.move(os.path.join(temp_directory, 'atmosphere'), os.path.join(temp_directory, '..', 'must_have')) return release.tag_name
def download_hekate_icons(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) shutil.move( os.path.join(temp_directory, 'bootloader', 'res', 'icon_payload.bmp'), os.path.join(temp_directory, 'bootloader', 'res', 'icon_payload_hue.bmp')) shutil.move( os.path.join(temp_directory, 'bootloader', 'res', 'icon_payload_custom.bmp'), os.path.join(temp_directory, 'bootloader', 'res', 'icon_payload.bmp')) shutil.move( os.path.join(temp_directory, 'bootloader', 'res', 'icon_switch.bmp'), os.path.join(temp_directory, 'bootloader', 'res', 'icon_switch_hue.bmp')) shutil.move( os.path.join(temp_directory, 'bootloader', 'res', 'icon_switch_custom.bmp'), os.path.join(temp_directory, 'bootloader', 'res', 'icon_switch.bmp')) return get_version(module, release, 0)
def download_atmosphere(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) common.delete_path( os.path.join(temp_directory, 'switch', 'reboot_to_payload.nro')) common.delete_path(os.path.join(temp_directory, 'switch')) common.delete_path( os.path.join(temp_directory, 'atmosphere', 'reboot_payload.bin')) payload_path = download_asset(module, release, 1) if payload_path is None: return None common.mkdir(os.path.join(temp_directory, 'bootloader', 'payloads')) shutil.move( payload_path, os.path.join(temp_directory, 'bootloader', 'payloads', 'fusee-primary.bin')) common.copy_module_file( 'atmosphere', 'system_settings.ini', os.path.join(temp_directory, 'atmosphere', 'config', 'system_settings.ini')) if not kosmos_build: common.delete_path(os.path.join(temp_directory, 'hbmenu.nro')) return get_version(module, release, 0)
def download_tesla_menu(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) return release.tag_name
def download_savemii(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None common.mkdir(os.path.join(temp_directory, 'wiiu', 'apps')) with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(os.path.join(temp_directory, 'wiiu', 'apps')) common.delete_path(bundle_path) return get_version(module, release, 0)
def download_sys_ftpd_light(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) if kosmos_build: common.delete_path(os.path.join(temp_directory, 'atmosphere', 'contents', '420000000000000E', 'flags', 'boot2.flag')) return release.tag_name
def download_appstore(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) common.mkdir(os.path.join(temp_directory, 'switch', 'appstore')) shutil.move(os.path.join(temp_directory, 'appstore.nro'), os.path.join(temp_directory, 'switch', 'appstore', 'appstore.nro')) return release.name
def download_sys_clk(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) common.mkdir(os.path.join(temp_directory, 'atmosphere', 'contents')) shutil.move( os.path.join(temp_directory, 'atmosphere', 'titles', '00FF0000636C6BFF'), os.path.join(temp_directory, 'atmosphere', 'contents', '00FF0000636C6BFF')) common.delete_path(os.path.join(temp_directory, 'atmosphere', 'titles')) if kosmos_build: common.delete_path( os.path.join(temp_directory, 'atmosphere', 'contents', '00FF0000636C6BFF', 'flags', 'boot2.flag')) common.delete_path(os.path.join(temp_directory, 'README.md')) common.copy_module_file( 'sys-clk', 'toolbox.json', os.path.join(temp_directory, 'atmosphere', 'contents', '00FF0000636C6BFF', 'toolbox.json')) return release.tag_name
def download_haxchi(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) common.delete_path(os.path.join(temp_directory, 'haxchi', 'config.txt')) common.copy_module_file( 'haxchi', 'config.txt', os.path.join(temp_directory, 'haxchi', 'config.txt')) common.copy_module_file( 'haxchi', 'homebrew_launcher.elf', os.path.join(temp_directory, 'haxchi', 'homebrew_launcher.elf')) return get_version(module, release, 0)
def download_ldn_mitm(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) if kosmos_build: common.delete_path( os.path.join(temp_directory, 'atmosphere', 'contents', '4200000000000010', 'flags', 'boot2.flag')) common.copy_module_file( 'ldn_mitm', 'toolbox.json', os.path.join(temp_directory, 'atmosphere', 'contents', '4200000000000010', 'toolbox.json')) return get_version(module, release, 0)
def download_emuiibo(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(bundle_path) common.mkdir(os.path.join(temp_directory, 'atmosphere', 'contents')) shutil.move( os.path.join(temp_directory, 'SdOut', 'atmosphere', 'contents', '0100000000000352'), os.path.join(temp_directory, 'atmosphere', 'contents', '0100000000000352')) common.mkdir(os.path.join(temp_directory, 'switch', '.overlays')) shutil.move( os.path.join(temp_directory, 'SdOut', 'switch', '.overlays', 'emuiibo.ovl'), os.path.join(temp_directory, 'switch', '.overlays', 'emuiibo.ovl')) common.delete_path(os.path.join(temp_directory, 'SdOut')) if kosmos_build: common.delete_path( os.path.join(temp_directory, 'atmosphere', 'contents', '0100000000000352', 'flags', 'boot2.flag')) common.copy_module_file( 'emuiibo', 'toolbox.json', os.path.join(temp_directory, 'atmosphere', 'contents', '0100000000000352', 'toolbox.json')) return release.tag_name
def download_mocha(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) bundle_path = download_asset(module, release, 0) if bundle_path is None: return None common.mkdir(os.path.join(temp_directory, 'wiiu', 'apps', 'mocha')) with zipfile.ZipFile(bundle_path, 'r') as zip_ref: zip_ref.extractall( os.path.join(temp_directory, 'wiiu', 'apps', 'mocha')) common.delete_path(bundle_path) common.copy_module_file( 'mocha', 'config.ini', os.path.join(temp_directory, 'wiiu', 'apps', 'mocha', 'config.ini')) common.copy_module_file( 'mocha', 'icon.png', os.path.join(temp_directory, 'wiiu', 'apps', 'mocha', 'icon.png')) common.copy_module_file( 'mocha', 'meta.xml', os.path.join(temp_directory, 'wiiu', 'apps', 'mocha', 'meta.xml')) return get_version(module, release, 0)
def download_homebrew_launcher(module, temp_directory, kosmos_version, kosmos_build): release = get_latest_release(module) app_path = download_asset(module, release, 0) if app_path is None: return None with zipfile.ZipFile(app_path, 'r') as zip_ref: zip_ref.extractall(temp_directory) common.delete_path(app_path) channel_path = download_asset(module, release, 1) if channel_path is None: return None common.mkdir(os.path.join(temp_directory, 'install', 'hbc')) with zipfile.ZipFile(channel_path, 'r') as zip_ref: zip_ref.extractall(os.path.join(temp_directory, 'install', 'hbc')) common.delete_path(channel_path) return get_version(module, release, 0)
temp_directory = common.generate_temp_path() os.makedirs(temp_directory) kosmos_version = get_kosmos_version(args) auto_build = False if hasattr(args, 'auto'): auto_build = args.auto version_messages = init_version_messages(args, kosmos_version) is_kosmos_build = args.command == common.Command.Kosmos build_messages = modules.build(temp_directory, kosmos_version, is_kosmos_build, auto_build) common.delete_path(args.output) if build_messages is not None: version_messages += build_messages if is_kosmos_build: shutil.make_archive( os.path.splitext(args.output)[0], 'zip', temp_directory) else: shutil.move(temp_directory, args.output) common.delete_path(os.path.join(os.getcwd(), 'tmp')) for message in version_messages: print(message) else: