14 Commits
1.0.0 ... 1.1.1

Author SHA1 Message Date
Kalam :p
a02c0baf3e Merge branch 'master' of https://github.com/YourKalamity/lazy-dsi-file-downloader 2020-07-01 22:23:46 +01:00
Kalam :p
a44a740953 made more efficient 2020-07-01 22:23:38 +01:00
Kalam :p
f971825bfc Update README.md 2020-07-01 20:10:13 +01:00
Kalam :p
c92cb202fb fixed extraction to wrong folder 2020-07-01 19:33:01 +01:00
Kalam :p
c72caf837f Merge pull request #1 from SNBeast/master
Fix hiya being copied to the wrong directory
2020-07-01 19:30:40 +01:00
SNBeast
71ac0f0ee8 Fix hiya being copied to the wrong directory
Attack of the unplaced backslashes
2020-07-01 14:27:24 -04:00
Kalam :p
3430f130bb Update README.md 2020-06-30 19:48:10 +01:00
Kalam :p
7ab299dc25 Update README.md 2020-06-30 19:47:28 +01:00
Kalam :p
0b7bc51c7d added new screenshot 2020-06-30 18:47:29 +01:00
Kalam :p
a235cee468 can now update twilight menu! 2020-06-30 17:55:43 +01:00
Kalam :p
17be26b13e Update README.md 2020-06-29 14:58:25 +01:00
Kalam :p
388b2aede8 Merge branch 'master' of https://github.com/YourKalamity/lazy-dsi-file-downloader 2020-06-29 14:55:31 +01:00
Kalam :p
5b6cadeb67 added a smol screenshot 2020-06-29 14:55:23 +01:00
Kalam :p
93a7b3eaf3 made it look better :) 2020-06-28 20:40:43 +01:00
16 changed files with 652 additions and 49 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,7 @@
# Lazy DSi file downloader (for dsi.cfw.guide)
![a screenshot of the program](https://github.com/YourKalamity/lazy-dsi-file-downloader/raw/master/assets/files/screenshots/app%20v1.1.0.png "Lazy DSi file downloader on Windows 10")
Automatically downloads
- Memory Pit
- TWiLight Menu ++
@@ -10,6 +12,7 @@ and places them in the correct folders on the SD card
`dumpTool.nds` and `UNLAUNCH.DSI` are placed on the root of the SD card
Can now be used to update TWiLight Menu ++!
## Requirements:
@@ -22,7 +25,8 @@ and places them in the correct folders on the SD card
At least Python 3.5 with the Tkinter library
## Credits:
## Credits
- [SNBeast](https://github.com/SNBeast) for testing, pointing out bugs and for being a huge help in general
- [NightScript](https://github.com/NightYoshi370) for the idea
- [shutterbug2000](https://gbatemp.net/members/shutterbug2000.354863/) for creating Memory Pit
- [TWiLight Menu ++ developers](https://github.com/DS-Homebrew/TWiLightMenu) for creating TWiLight Menu++

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,85 @@
{
"version": "auto-py-to-exe-configuration_v1",
"pyinstallerOptions": [
{
"optionDest": "noconfirm",
"value": true
},
{
"optionDest": "filenames",
"value": "C:/Users/kalam/Documents/GitHub/just-a-dsi-cfw-installer/main.py"
},
{
"optionDest": "onefile",
"value": true
},
{
"optionDest": "console",
"value": true
},
{
"optionDest": "icon_file",
"value": "C:/Users/kalam/Documents/GitHub/just-a-dsi-cfw-installer/lazy.ico"
},
{
"optionDest": "name",
"value": "lazy-dsi-file-downloader"
},
{
"optionDest": "ascii",
"value": false
},
{
"optionDest": "clean_build",
"value": false
},
{
"optionDest": "strip",
"value": false
},
{
"optionDest": "noupx",
"value": false
},
{
"optionDest": "uac_admin",
"value": false
},
{
"optionDest": "uac_uiaccess",
"value": false
},
{
"optionDest": "win_private_assemblies",
"value": false
},
{
"optionDest": "win_no_prefer_redirects",
"value": false
},
{
"optionDest": "bootloader_ignore_signals",
"value": false
},
{
"optionDest": "datas",
"value": "C:/Users/kalam/Documents/GitHub/just-a-dsi-cfw-installer/certifi;certifi/"
},
{
"optionDest": "datas",
"value": "C:/Users/kalam/Documents/GitHub/just-a-dsi-cfw-installer/requests;requests/"
},
{
"optionDest": "datas",
"value": "C:/Users/kalam/Documents/GitHub/just-a-dsi-cfw-installer/urllib3;urllib3/"
},
{
"optionDest": "datas",
"value": "C:/Users/kalam/Documents/GitHub/just-a-dsi-cfw-installer/lazy.ico;."
}
],
"nonPyinstallerOptions": {
"increaseRecursionLimit": true,
"manualArguments": ""
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

129
main.py
View File

@@ -1,4 +1,8 @@
# Created by YourKalamity
#https://github.com/YourKalamity/lazy-dsi-file-downloader
import tkinter
from tkinter import messagebox
from tkinter import filedialog
@@ -11,6 +15,8 @@ from pathlib import Path
import shutil
from subprocess import Popen
import zipfile
import distutils
from distutils import dir_util
if(sys.version_info.major < 3):
print("This program will ONLY work on Python 3 and above")
@@ -22,11 +28,13 @@ memoryPitLinks = ["https://github.com/YourKalamity/just-a-dsi-cfw-installer/raw/
window = tkinter.Tk()
window.sourceFolder = ''
window.sourceFile = ''
appTitle = tkinter.Label(text="Lazy DSi file downloader")
appTitle = tkinter.Label(text="Lazy DSi file downloader",font=('Verdana', 14), fg="white", bg="black")
appTitle.width = 100
SDlabel = tkinter.Label(text = "SD card directory")
appAuthor = tkinter.Label(text="by YourKalamity",font=('Verdana', 10, 'italic'), anchor="w")
appAuthor.width = 100
SDlabel = tkinter.Label(text = "Enter your SD card's directory")
SDlabel.width = 100
SDentry = tkinter.Entry()
SDentry = tkinter.Entry(width=30)
SDentry.width = 100
def getLatestTWLmenu():
@@ -72,6 +80,9 @@ def start():
sysname = platform.system()
_7za = os.path.join(sysname, '7za')
_7z = None
if sysname == "Darwin" :
import stat
os.chmod(_7za, stat.S_IRWXU)
if sysname == "Windows":
from winreg import OpenKey, QueryValueEx, HKEY_LOCAL_MACHINE, KEY_READ, KEY_WOW64_64KEY
print('Searching for 7-Zip in the Windows registry...')
@@ -117,55 +128,64 @@ def start():
memoryPitDownload = memoryPitLinks[0]
temp = directory + "/tmp/"
Path(temp).mkdir(parents=True,exist_ok=True)
cwdtemp = os.getcwd() + "/lazy-dsi-file-downloader-tmp/"
Path(cwdtemp).mkdir(parents=True,exist_ok=True)
#Download Memory Pit
memoryPitLocation = directory + "/private/ds/app/484E494A/"
Path(memoryPitLocation).mkdir(parents=True, exist_ok=True)
r = requests.get(memoryPitDownload, allow_redirects=True)
memoryPitLocation = memoryPitLocation + "pit.bin"
open(memoryPitLocation, 'wb').write(r.content)
outputbox("Memory Pit Downloaded ")
if downloadmemorypit.get() == 1:
#Download Memory Pit
memoryPitLocation = directory + "/private/ds/app/484E494A/"
Path(memoryPitLocation).mkdir(parents=True, exist_ok=True)
r = requests.get(memoryPitDownload, allow_redirects=True)
memoryPitLocation = memoryPitLocation + "pit.bin"
open(memoryPitLocation, 'wb').write(r.content)
outputbox("Memory Pit Downloaded ")
print("Memory Pit Downloaded")
#Download TWiLight Menu
r = requests.get(getLatestTWLmenu(), allow_redirects=True)
TWLmenuLocation = temp + "TWiLightMenu.7z"
open(TWLmenuLocation,'wb').write(r.content)
outputbox("TWiLight Menu ++ Downloaded ")
if downloadtwlmenu.get() == 1:
#Download TWiLight Menu
r = requests.get(getLatestTWLmenu(), allow_redirects=True)
TWLmenuLocation = cwdtemp + "TWiLightMenu.7z"
open(TWLmenuLocation,'wb').write(r.content)
outputbox("TWiLight Menu ++ Downloaded ")
print("TWiLight Menu ++ Downloaded")
print(TWLmenuLocation)
#Extract TWiLight Menu
proc = Popen([ _7za, 'x', TWLmenuLocation, '-o' + temp, '_nds', 'DSi - CFW users',
'DSi&3DS - SD card users', 'roms' ])
ret_val = proc.wait()
#Extract TWiLight Menu
proc = Popen([_7za,"x", "-aoa", TWLmenuLocation, '-o'+cwdtemp, 'DSi - CFW users/SDNAND root/', '_nds', 'DSi&3DS - SD card users', 'roms', 'BOOT.NDS'])
ret_val = proc.wait()
while True:
if ret_val == 0:
outputbox("TWiLight Menu ++ Extracted ")
break
else:
continue
while True:
if ret_val == 0:
outputbox("TWiLight Menu ++ Extracted ")
print("TWiLight Menu ++ Extracted to", temp)
break
#Move TWiLight Menu
shutil.copy(temp + "DSi&3DS - SD card users/BOOT.NDS", directory)
shutil.move(temp + "_nds/" , directory)
shutil.move(temp + "DSi - CFW users/SDNAND root/hiya", directory)
shutil.move(temp + "DSi - CFW users/SDNAND root/title", directory)
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-nightly.nds", directory + "/_nds")
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-release.nds", directory + "/_nds")
outputbox("TWiLight Menu ++ placed ")
#Move TWiLight Menu
shutil.copy(cwdtemp + "DSi&3DS - SD card users/BOOT.NDS", directory)
distutils.dir_util.copy_tree(cwdtemp + "_nds/" , directory +"/_nds/")
distutils.dir_util.copy_tree(cwdtemp + "DSi - CFW users/SDNAND root/hiya", directory+"/hiya/")
distutils.dir_util.copy_tree(cwdtemp + "DSi - CFW users/SDNAND root/title", directory+"/title/")
shutil.copy(cwdtemp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-nightly.nds", directory + "/_nds")
shutil.copy(cwdtemp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-release.nds", directory + "/_nds")
Path(directory + "/roms/").mkdir(parents=True,exist_ok=True)
print("TWiLight Menu ++ placed in", directory)
outputbox("TWiLight Menu ++ placed ")
#Download dumpTool
r = requests.get(getLatestdumpTool(), allow_redirects=True)
dumpToolLocation = directory + "/dumpTool.nds"
open(dumpToolLocation,'wb').write(r.content)
outputbox("dumpTool Downloaded ")
if downloaddumptool.get() == 1:
#Download dumpTool
r = requests.get(getLatestdumpTool(), allow_redirects=True)
dumpToolLocation = directory + "/dumpTool.nds"
open(dumpToolLocation,'wb').write(r.content)
print("dumpTool downloaded")
outputbox("dumpTool Downloaded ")
if unlaunchNeeded == 1 :
#Download Unlaunch
url = "https://problemkaputt.de/unlaunch.zip"
r = requests.get(url, allow_redirects=True)
unlaunchLocation = temp + "unlaunch.zip"
unlaunchLocation = cwdtemp + "unlaunch.zip"
open(unlaunchLocation,'wb').write(r.content)
print("Unlaunch Downloaded")
outputbox("Unlaunch Downloaded ")
#Extract Unlaunch
@@ -174,11 +194,12 @@ def start():
zip_ref.close()
#Delete tmp folder
shutil.rmtree(directory + '/tmp')
#Delete tmp folder
shutil.rmtree(cwdtemp)
print("Done!")
outputbox("Done!")
outputbox("Done!")
def chooseDir():
window.sourceFolder = filedialog.askdirectory(parent=window, initialdir= "/", title='Please select the directory of your SD card')
@@ -186,11 +207,17 @@ def chooseDir():
SDentry.insert(0, window.sourceFolder)
b_chooseDir = tkinter.Button(window, text = "Choose Folder", width = 20, command = chooseDir)
b_chooseDir = tkinter.Button(window, text = "Click to select folder", width = 25, command = chooseDir)
b_chooseDir.width = 100
b_chooseDir.height = 50
firmwareLabel = tkinter.Label(text = "Select your DSi firmware")
downloadmemorypit = tkinter.IntVar(value=1)
downloadmemorypitCheck = tkinter.Checkbutton(window, text = "Download Memory pit exploit?", variable = downloadmemorypit)
downloadtwlmenu = tkinter.IntVar(value=1)
downloadtwlmenuCheck = tkinter.Checkbutton(window, text = "Download / Update TWiLight menu?", variable = downloadtwlmenu)
firmwareLabel = tkinter.Label(text = "Select your DSi firmware : ")
firmwareLabel.width = 100
firmwareVersion = tkinter.StringVar(window)
@@ -198,10 +225,13 @@ firmwareVersion.set(dsiVersions[0])
selector = tkinter.OptionMenu(window, firmwareVersion, *dsiVersions)
selector.width = 100
downloaddumptool = tkinter.IntVar(value=1)
downloaddumptoolCheck = tkinter.Checkbutton(window, text ="Download dumpTool?", variable=downloaddumptool)
unlaunch = tkinter.IntVar(value=1)
unlaunchCheck = tkinter.Checkbutton(window, text = "Download Unlaunch?", variable =unlaunch)
startButton = tkinter.Button(window, text = "Start", width = 20, command = start)
startButton = tkinter.Button(window, text = "Start", font = ("TkDefaultFont",12,'bold'), width = 25, command = start)
outputLabel = tkinter.Label(text="Output")
outputLabel.width = 100
outputBox = tkinter.Text(window,state='disabled', width = 30, height = 10)
@@ -209,14 +239,17 @@ outputBox = tkinter.Text(window,state='disabled', width = 30, height = 10)
window.title("Lazy DSi file downloader")
window.resizable(0, 0)
appTitle.pack()
appAuthor.pack()
SDlabel.pack()
SDentry.pack()
b_chooseDir.pack()
downloadmemorypitCheck.pack()
firmwareLabel.pack()
selector.pack()
downloadtwlmenuCheck.pack()
downloaddumptoolCheck.pack()
unlaunchCheck.pack()
startButton.pack()
outputLabel.pack()
outputBox.pack()
window.mainloop()

228
old version/1.0.0.py Normal file
View File

@@ -0,0 +1,228 @@
# Created by YourKalamity
#https://github.com/YourKalamity/lazy-dsi-file-downloader
import tkinter
from tkinter import messagebox
from tkinter import filedialog
import os
import platform
import sys
import requests
import json
from pathlib import Path
import shutil
from subprocess import Popen
import zipfile
if(sys.version_info.major < 3):
print("This program will ONLY work on Python 3 and above")
sys.exit()
dsiVersions = ["1.0 - 1.3 (USA, EUR, AUS, JPN)", "1.4 - 1.4.5 (USA, EUR, AUS, JPN)", "All versions (KOR, CHN)"]
memoryPitLinks = ["https://github.com/YourKalamity/just-a-dsi-cfw-installer/raw/master/assets/files/memoryPit/256/pit.bin","https://github.com/YourKalamity/just-a-dsi-cfw-installer/raw/master/assets/files/memoryPit/768_1024/pit.bin"]
window = tkinter.Tk()
window.sourceFolder = ''
window.sourceFile = ''
appTitle = tkinter.Label(text="Lazy DSi file downloader",font=('Verdana', 14), fg="white", bg="black")
appTitle.width = 100
appAuthor = tkinter.Label(text="by YourKalamity",font=('Verdana', 10, 'italic'), anchor="w")
appAuthor.width = 100
SDlabel = tkinter.Label(text = "Enter your SD card's directory")
SDlabel.width = 100
SDentry = tkinter.Entry(width=30)
SDentry.width = 100
def getLatestTWLmenu():
release = json.loads(requests.get("https://api.github.com/repos/DS-Homebrew/TWiLightMenu/releases/latest").content)
url = release["assets"][0]["browser_download_url"]
return url
def getLatestdumpTool():
release = json.loads(requests.get("https://api.github.com/repos/zoogie/dumpTool/releases/latest").content)
url = release["assets"][0]["browser_download_url"]
return url
def outputbox(message):
outputBox.configure(state='normal')
outputBox.insert('end', message)
outputBox.configure(state='disabled')
def validateDirectory(directory):
try:
directory = str(directory)
except TypeError:
outputbox("That's not a valid directory")
return False
try:
string = directory + "/test.file"
with open(string, 'w') as file:
file.close()
os.remove(string)
except FileNotFoundError:
outputbox("That's not a valid directory")
outputbox(" or you do not have the")
outputbox(" permission to write there")
return False
except PermissionError:
outputbox("You do not have write")
outputbox(" access to that folder")
return False
else:
return True
def start():
outputBox.delete(0, tkinter.END)
sysname = platform.system()
_7za = os.path.join(sysname, '7za')
_7z = None
if sysname == "Windows":
from winreg import OpenKey, QueryValueEx, HKEY_LOCAL_MACHINE, KEY_READ, KEY_WOW64_64KEY
print('Searching for 7-Zip in the Windows registry...')
try:
with OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\7-Zip', 0, KEY_READ | KEY_WOW64_64KEY) as hkey:
_7z = os.path.join(QueryValueEx(hkey, 'Path')[0], '7z.exe')
if not os.path.exists(_7z):
raise WindowsError
_7za = _7z
except WindowsError:
print('Searching for 7-Zip in the 32-bit Windows registry...')
try:
with OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\7-Zip') as hkey:
_7z = os.path.join(QueryValueEx(hkey, 'Path')[0], '7z.exe')
if not os.path.exists(_7z):
raise WindowsError
_7za = _7z
except WindowsError:
print("7-Zip not found, please install it before using")
outputbox("7-Zip not found")
return
print("7-Zip found!")
outputBox.configure(state='normal')
outputBox.delete('1.0', tkinter.END)
outputBox.configure(state='disabled')
#Variables
directory = SDentry.get()
version = firmwareVersion.get()
unlaunchNeeded = unlaunch.get()
directoryValidated = validateDirectory(directory)
if directoryValidated == False:
return
if dsiVersions.index(version) == 1:
memoryPitDownload = memoryPitLinks[1]
elif dsiVersions.index(version) in [0,2]:
memoryPitDownload = memoryPitLinks[0]
temp = directory + "/tmp/"
Path(temp).mkdir(parents=True,exist_ok=True)
#Download Memory Pit
memoryPitLocation = directory + "/private/ds/app/484E494A/"
Path(memoryPitLocation).mkdir(parents=True, exist_ok=True)
r = requests.get(memoryPitDownload, allow_redirects=True)
memoryPitLocation = memoryPitLocation + "pit.bin"
open(memoryPitLocation, 'wb').write(r.content)
outputbox("Memory Pit Downloaded ")
#Download TWiLight Menu
r = requests.get(getLatestTWLmenu(), allow_redirects=True)
TWLmenuLocation = temp + "TWiLightMenu.7z"
open(TWLmenuLocation,'wb').write(r.content)
outputbox("TWiLight Menu ++ Downloaded ")
#Extract TWiLight Menu
proc = Popen([ _7za, 'x', TWLmenuLocation, '-o' + temp, '_nds', 'DSi - CFW users',
'DSi&3DS - SD card users', 'roms' ])
ret_val = proc.wait()
while True:
if ret_val == 0:
outputbox("TWiLight Menu ++ Extracted ")
break
else:
continue
#Move TWiLight Menu
shutil.copy(temp + "DSi&3DS - SD card users/BOOT.NDS", directory)
shutil.move(temp + "_nds/" , directory)
shutil.move(temp + "DSi - CFW users/SDNAND root/hiya", directory)
shutil.move(temp + "DSi - CFW users/SDNAND root/title", directory)
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-nightly.nds", directory + "/_nds")
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-release.nds", directory + "/_nds")
outputbox("TWiLight Menu ++ placed ")
#Download dumpTool
r = requests.get(getLatestdumpTool(), allow_redirects=True)
dumpToolLocation = directory + "/dumpTool.nds"
open(dumpToolLocation,'wb').write(r.content)
outputbox("dumpTool Downloaded ")
if unlaunchNeeded == 1 :
#Download Unlaunch
url = "https://problemkaputt.de/unlaunch.zip"
r = requests.get(url, allow_redirects=True)
unlaunchLocation = temp + "unlaunch.zip"
open(unlaunchLocation,'wb').write(r.content)
outputbox("Unlaunch Downloaded ")
#Extract Unlaunch
with zipfile.ZipFile(unlaunchLocation, 'r') as zip_ref:
zip_ref.extractall(directory)
zip_ref.close()
#Delete tmp folder
shutil.rmtree(directory + '/tmp')
outputbox("Done!")
def chooseDir():
window.sourceFolder = filedialog.askdirectory(parent=window, initialdir= "/", title='Please select the directory of your SD card')
SDentry.delete(0, tkinter.END)
SDentry.insert(0, window.sourceFolder)
b_chooseDir = tkinter.Button(window, text = "Click to select folder", width = 25, command = chooseDir)
b_chooseDir.width = 100
b_chooseDir.height = 50
firmwareLabel = tkinter.Label(text = "Select your DSi firmware : ")
firmwareLabel.width = 100
firmwareVersion = tkinter.StringVar(window)
firmwareVersion.set(dsiVersions[0])
selector = tkinter.OptionMenu(window, firmwareVersion, *dsiVersions)
selector.width = 100
unlaunch = tkinter.IntVar(value=1)
unlaunchCheck = tkinter.Checkbutton(window, text = "Download Unlaunch?", variable =unlaunch)
startButton = tkinter.Button(window, text = "Start", width = 25, command = start)
outputLabel = tkinter.Label(text="Output")
outputLabel.width = 100
outputBox = tkinter.Text(window,state='disabled', width = 30, height = 10)
window.title("Lazy DSi file downloader")
window.resizable(0, 0)
appTitle.pack()
appAuthor.pack()
SDlabel.pack()
SDentry.pack()
b_chooseDir.pack()
firmwareLabel.pack()
selector.pack()
unlaunchCheck.pack()
startButton.pack()
outputLabel.pack()
outputBox.pack()
window.mainloop()

253
old version/1.1.0.py Normal file
View File

@@ -0,0 +1,253 @@
# Created by YourKalamity
#https://github.com/YourKalamity/lazy-dsi-file-downloader
import tkinter
from tkinter import messagebox
from tkinter import filedialog
import os
import platform
import sys
import requests
import json
from pathlib import Path
import shutil
from subprocess import Popen
import zipfile
import distutils
from distutils import dir_util
if(sys.version_info.major < 3):
print("This program will ONLY work on Python 3 and above")
sys.exit()
dsiVersions = ["1.0 - 1.3 (USA, EUR, AUS, JPN)", "1.4 - 1.4.5 (USA, EUR, AUS, JPN)", "All versions (KOR, CHN)"]
memoryPitLinks = ["https://github.com/YourKalamity/just-a-dsi-cfw-installer/raw/master/assets/files/memoryPit/256/pit.bin","https://github.com/YourKalamity/just-a-dsi-cfw-installer/raw/master/assets/files/memoryPit/768_1024/pit.bin"]
window = tkinter.Tk()
window.sourceFolder = ''
window.sourceFile = ''
appTitle = tkinter.Label(text="Lazy DSi file downloader",font=('Verdana', 14), fg="white", bg="black")
appTitle.width = 100
appAuthor = tkinter.Label(text="by YourKalamity",font=('Verdana', 10, 'italic'), anchor="w")
appAuthor.width = 100
SDlabel = tkinter.Label(text = "Enter your SD card's directory")
SDlabel.width = 100
SDentry = tkinter.Entry(width=30)
SDentry.width = 100
def getLatestTWLmenu():
release = json.loads(requests.get("https://api.github.com/repos/DS-Homebrew/TWiLightMenu/releases/latest").content)
url = release["assets"][0]["browser_download_url"]
return url
def getLatestdumpTool():
release = json.loads(requests.get("https://api.github.com/repos/zoogie/dumpTool/releases/latest").content)
url = release["assets"][0]["browser_download_url"]
return url
def outputbox(message):
outputBox.configure(state='normal')
outputBox.insert('end', message)
outputBox.configure(state='disabled')
def validateDirectory(directory):
try:
directory = str(directory)
except TypeError:
outputbox("That's not a valid directory")
return False
try:
string = directory + "/test.file"
with open(string, 'w') as file:
file.close()
os.remove(string)
except FileNotFoundError:
outputbox("That's not a valid directory")
outputbox(" or you do not have the")
outputbox(" permission to write there")
return False
except PermissionError:
outputbox("You do not have write")
outputbox(" access to that folder")
return False
else:
return True
def start():
outputBox.delete(0, tkinter.END)
sysname = platform.system()
_7za = os.path.join(sysname, '7za')
_7z = None
if sysname == "Darwin" :
import stat
os.chmod(_7za, stat.S_IRWXU)
if sysname == "Windows":
from winreg import OpenKey, QueryValueEx, HKEY_LOCAL_MACHINE, KEY_READ, KEY_WOW64_64KEY
print('Searching for 7-Zip in the Windows registry...')
try:
with OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\7-Zip', 0, KEY_READ | KEY_WOW64_64KEY) as hkey:
_7z = os.path.join(QueryValueEx(hkey, 'Path')[0], '7z.exe')
if not os.path.exists(_7z):
raise WindowsError
_7za = _7z
except WindowsError:
print('Searching for 7-Zip in the 32-bit Windows registry...')
try:
with OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\7-Zip') as hkey:
_7z = os.path.join(QueryValueEx(hkey, 'Path')[0], '7z.exe')
if not os.path.exists(_7z):
raise WindowsError
_7za = _7z
except WindowsError:
print("7-Zip not found, please install it before using")
outputbox("7-Zip not found")
return
print("7-Zip found!")
outputBox.configure(state='normal')
outputBox.delete('1.0', tkinter.END)
outputBox.configure(state='disabled')
#Variables
directory = SDentry.get()
version = firmwareVersion.get()
unlaunchNeeded = unlaunch.get()
directoryValidated = validateDirectory(directory)
if directoryValidated == False:
return
if dsiVersions.index(version) == 1:
memoryPitDownload = memoryPitLinks[1]
elif dsiVersions.index(version) in [0,2]:
memoryPitDownload = memoryPitLinks[0]
temp = directory + "/tmp/"
Path(temp).mkdir(parents=True,exist_ok=True)
if downloadmemorypit.get() == 1:
#Download Memory Pit
memoryPitLocation = directory + "/private/ds/app/484E494A/"
Path(memoryPitLocation).mkdir(parents=True, exist_ok=True)
r = requests.get(memoryPitDownload, allow_redirects=True)
memoryPitLocation = memoryPitLocation + "pit.bin"
open(memoryPitLocation, 'wb').write(r.content)
outputbox("Memory Pit Downloaded ")
print("Memory Pit Downloaded")
if downloadtwlmenu.get() == 1:
#Download TWiLight Menu
r = requests.get(getLatestTWLmenu(), allow_redirects=True)
TWLmenuLocation = temp + "TWiLightMenu.7z"
open(TWLmenuLocation,'wb').write(r.content)
outputbox("TWiLight Menu ++ Downloaded ")
print("TWiLight Menu ++ Downloaded")
#Extract TWiLight Menu
proc = Popen([ _7za, 'x', TWLmenuLocation, '-y' , '-o' + temp, '_nds', 'DSi - CFW users',
'DSi&3DS - SD card users', 'roms' ])
ret_val = proc.wait()
while True:
if ret_val == 0:
outputbox("TWiLight Menu ++ Extracted ")
print("TWiLight Menu ++ Extracted to", temp)
break
#Move TWiLight Menu
shutil.copy(temp + "DSi&3DS - SD card users/BOOT.NDS", directory)
distutils.dir_util.copy_tree(temp + "_nds/" , directory +"/_nds/")
distutils.dir_util.copy_tree(temp + "DSi - CFW users/SDNAND root/hiya", directory+"/hiya/")
distutils.dir_util.copy_tree(temp + "DSi - CFW users/SDNAND root/title", directory+"/title/")
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-nightly.nds", directory + "/_nds")
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-release.nds", directory + "/_nds")
Path(directory + "/roms/").mkdir(parents=True,exist_ok=True)
print("TWiLight Menu ++ placed in", directory)
outputbox("TWiLight Menu ++ placed ")
if downloaddumptool.get() == 1:
#Download dumpTool
r = requests.get(getLatestdumpTool(), allow_redirects=True)
dumpToolLocation = directory + "/dumpTool.nds"
open(dumpToolLocation,'wb').write(r.content)
print("dumpTool downloaded")
outputbox("dumpTool Downloaded ")
if unlaunchNeeded == 1 :
#Download Unlaunch
url = "https://problemkaputt.de/unlaunch.zip"
r = requests.get(url, allow_redirects=True)
unlaunchLocation = temp + "unlaunch.zip"
open(unlaunchLocation,'wb').write(r.content)
print("Unlaunch Downloaded")
outputbox("Unlaunch Downloaded ")
#Extract Unlaunch
with zipfile.ZipFile(unlaunchLocation, 'r') as zip_ref:
zip_ref.extractall(directory)
zip_ref.close()
#Delete tmp folder
shutil.rmtree(directory + '/tmp')
print("Done!")
outputbox("Done!")
def chooseDir():
window.sourceFolder = filedialog.askdirectory(parent=window, initialdir= "/", title='Please select the directory of your SD card')
SDentry.delete(0, tkinter.END)
SDentry.insert(0, window.sourceFolder)
b_chooseDir = tkinter.Button(window, text = "Click to select folder", width = 25, command = chooseDir)
b_chooseDir.width = 100
b_chooseDir.height = 50
downloadmemorypit = tkinter.IntVar(value=1)
downloadmemorypitCheck = tkinter.Checkbutton(window, text = "Download Memory pit exploit?", variable = downloadmemorypit)
downloadtwlmenu = tkinter.IntVar(value=1)
downloadtwlmenuCheck = tkinter.Checkbutton(window, text = "Download / Update TWiLight menu?", variable = downloadtwlmenu)
firmwareLabel = tkinter.Label(text = "Select your DSi firmware : ")
firmwareLabel.width = 100
firmwareVersion = tkinter.StringVar(window)
firmwareVersion.set(dsiVersions[0])
selector = tkinter.OptionMenu(window, firmwareVersion, *dsiVersions)
selector.width = 100
downloaddumptool = tkinter.IntVar(value=1)
downloaddumptoolCheck = tkinter.Checkbutton(window, text ="Download dumpTool?", variable=downloaddumptool)
unlaunch = tkinter.IntVar(value=1)
unlaunchCheck = tkinter.Checkbutton(window, text = "Download Unlaunch?", variable =unlaunch)
startButton = tkinter.Button(window, text = "Start", font = ("TkDefaultFont",12,'bold'), width = 25, command = start)
outputLabel = tkinter.Label(text="Output")
outputLabel.width = 100
outputBox = tkinter.Text(window,state='disabled', width = 30, height = 10)
window.title("Lazy DSi file downloader")
window.resizable(0, 0)
appTitle.pack()
appAuthor.pack()
SDlabel.pack()
SDentry.pack()
b_chooseDir.pack()
downloadmemorypitCheck.pack()
firmwareLabel.pack()
selector.pack()
downloadtwlmenuCheck.pack()
downloaddumptoolCheck.pack()
unlaunchCheck.pack()
startButton.pack()
outputLabel.pack()
outputBox.pack()
window.mainloop()