Skip to content

Commit a235cee

Browse files
committed
can now update twilight menu!
1 parent 17be26b commit a235cee

File tree

2 files changed

+295
-46
lines changed

2 files changed

+295
-46
lines changed

main.py

Lines changed: 67 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# Created by YourKalamity
3-
#https://github.com/YourKalamity/lazy-dsi-file-downloader
3+
#https://github.com/YourKalamity/lazy-dsi-file-downloader
44

55

66
import tkinter
@@ -15,6 +15,8 @@
1515
import shutil
1616
from subprocess import Popen
1717
import zipfile
18+
import distutils
19+
from distutils import dir_util
1820

1921
if(sys.version_info.major < 3):
2022
print("This program will ONLY work on Python 3 and above")
@@ -125,53 +127,61 @@ def start():
125127
temp = directory + "/tmp/"
126128
Path(temp).mkdir(parents=True,exist_ok=True)
127129

128-
#Download Memory Pit
129-
memoryPitLocation = directory + "/private/ds/app/484E494A/"
130-
Path(memoryPitLocation).mkdir(parents=True, exist_ok=True)
131-
r = requests.get(memoryPitDownload, allow_redirects=True)
132-
memoryPitLocation = memoryPitLocation + "pit.bin"
133-
open(memoryPitLocation, 'wb').write(r.content)
134-
outputbox("Memory Pit Downloaded ")
135-
136-
#Download TWiLight Menu
137-
r = requests.get(getLatestTWLmenu(), allow_redirects=True)
138-
TWLmenuLocation = temp + "TWiLightMenu.7z"
139-
open(TWLmenuLocation,'wb').write(r.content)
140-
outputbox("TWiLight Menu ++ Downloaded ")
141-
142-
#Extract TWiLight Menu
143-
proc = Popen([ _7za, 'x', TWLmenuLocation, '-o' + temp, '_nds', 'DSi - CFW users',
130+
if downloadmemorypit.get() == 1:
131+
#Download Memory Pit
132+
memoryPitLocation = directory + "/private/ds/app/484E494A/"
133+
Path(memoryPitLocation).mkdir(parents=True, exist_ok=True)
134+
r = requests.get(memoryPitDownload, allow_redirects=True)
135+
memoryPitLocation = memoryPitLocation + "pit.bin"
136+
open(memoryPitLocation, 'wb').write(r.content)
137+
outputbox("Memory Pit Downloaded ")
138+
print("Memory Pit Downloaded")
139+
140+
if downloadtwlmenu.get() == 1:
141+
#Download TWiLight Menu
142+
r = requests.get(getLatestTWLmenu(), allow_redirects=True)
143+
TWLmenuLocation = temp + "TWiLightMenu.7z"
144+
open(TWLmenuLocation,'wb').write(r.content)
145+
outputbox("TWiLight Menu ++ Downloaded ")
146+
print("TWiLight Menu ++ Downloaded")
147+
148+
#Extract TWiLight Menu
149+
proc = Popen([ _7za, 'x', TWLmenuLocation, '-y' , '-o' + temp, '_nds', 'DSi - CFW users',
144150
'DSi&3DS - SD card users', 'roms' ])
145-
ret_val = proc.wait()
146-
147-
while True:
148-
if ret_val == 0:
149-
outputbox("TWiLight Menu ++ Extracted ")
150-
break
151-
else:
152-
continue
153-
154-
#Move TWiLight Menu
155-
shutil.copy(temp + "DSi&3DS - SD card users/BOOT.NDS", directory)
156-
shutil.move(temp + "_nds/" , directory)
157-
shutil.move(temp + "DSi - CFW users/SDNAND root/hiya", directory)
158-
shutil.move(temp + "DSi - CFW users/SDNAND root/title", directory)
159-
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-nightly.nds", directory + "/_nds")
160-
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-release.nds", directory + "/_nds")
161-
outputbox("TWiLight Menu ++ placed ")
162-
163-
#Download dumpTool
164-
r = requests.get(getLatestdumpTool(), allow_redirects=True)
165-
dumpToolLocation = directory + "/dumpTool.nds"
166-
open(dumpToolLocation,'wb').write(r.content)
167-
outputbox("dumpTool Downloaded ")
151+
ret_val = proc.wait()
152+
153+
while True:
154+
if ret_val == 0:
155+
outputbox("TWiLight Menu ++ Extracted ")
156+
print("TWiLight Menu ++ Extracted to", temp)
157+
break
158+
159+
#Move TWiLight Menu
160+
shutil.copy(temp + "DSi&3DS - SD card users/BOOT.NDS", directory)
161+
distutils.dir_util.copy_tree(temp + "_nds/" , directory +"/_nds/")
162+
distutils.dir_util.copy_tree(temp + "DSi - CFW users/SDNAND root/hiya", directory+"hiya/")
163+
distutils.dir_util.copy_tree(temp + "DSi - CFW users/SDNAND root/title", directory+"hiya/")
164+
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-nightly.nds", directory + "/_nds")
165+
shutil.copy(temp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-release.nds", directory + "/_nds")
166+
Path(directory + "/roms/").mkdir(parents=True,exist_ok=True)
167+
print("TWiLight Menu ++ placed in", directory)
168+
outputbox("TWiLight Menu ++ placed ")
169+
170+
if downloaddumptool.get() == 1:
171+
#Download dumpTool
172+
r = requests.get(getLatestdumpTool(), allow_redirects=True)
173+
dumpToolLocation = directory + "/dumpTool.nds"
174+
open(dumpToolLocation,'wb').write(r.content)
175+
print("dumpTool downloaded")
176+
outputbox("dumpTool Downloaded ")
168177

169178
if unlaunchNeeded == 1 :
170179
#Download Unlaunch
171180
url = "https://problemkaputt.de/unlaunch.zip"
172181
r = requests.get(url, allow_redirects=True)
173182
unlaunchLocation = temp + "unlaunch.zip"
174183
open(unlaunchLocation,'wb').write(r.content)
184+
print("Unlaunch Downloaded")
175185
outputbox("Unlaunch Downloaded ")
176186

177187
#Extract Unlaunch
@@ -180,11 +190,11 @@ def start():
180190
zip_ref.close()
181191

182192

183-
#Delete tmp folder
184-
shutil.rmtree(directory + '/tmp')
193+
#Delete tmp folder
194+
shutil.rmtree(directory + '/tmp')
195+
print("Done!")
196+
outputbox("Done!")
185197

186-
outputbox("Done!")
187-
188198

189199
def chooseDir():
190200
window.sourceFolder = filedialog.askdirectory(parent=window, initialdir= "/", title='Please select the directory of your SD card')
@@ -196,6 +206,12 @@ def chooseDir():
196206
b_chooseDir.width = 100
197207
b_chooseDir.height = 50
198208

209+
downloadmemorypit = tkinter.IntVar(value=1)
210+
downloadmemorypitCheck = tkinter.Checkbutton(window, text = "Download Memory pit exploit?", variable = downloadmemorypit)
211+
212+
downloadtwlmenu = tkinter.IntVar(value=1)
213+
downloadtwlmenuCheck = tkinter.Checkbutton(window, text = "Download / Update TWiLight menu?", variable = downloadtwlmenu)
214+
199215
firmwareLabel = tkinter.Label(text = "Select your DSi firmware : ")
200216
firmwareLabel.width = 100
201217

@@ -204,10 +220,13 @@ def chooseDir():
204220
selector = tkinter.OptionMenu(window, firmwareVersion, *dsiVersions)
205221
selector.width = 100
206222

223+
downloaddumptool = tkinter.IntVar(value=1)
224+
downloaddumptoolCheck = tkinter.Checkbutton(window, text ="Download dumpTool?", variable=downloaddumptool)
225+
207226
unlaunch = tkinter.IntVar(value=1)
208227
unlaunchCheck = tkinter.Checkbutton(window, text = "Download Unlaunch?", variable =unlaunch)
209228

210-
startButton = tkinter.Button(window, text = "Start", width = 25, command = start)
229+
startButton = tkinter.Button(window, text = "Start", font = ("TkDefaultFont",12,'bold'), width = 25, command = start)
211230
outputLabel = tkinter.Label(text="Output")
212231
outputLabel.width = 100
213232
outputBox = tkinter.Text(window,state='disabled', width = 30, height = 10)
@@ -219,11 +238,13 @@ def chooseDir():
219238
SDlabel.pack()
220239
SDentry.pack()
221240
b_chooseDir.pack()
241+
downloadmemorypitCheck.pack()
222242
firmwareLabel.pack()
223243
selector.pack()
244+
downloadtwlmenuCheck.pack()
245+
downloaddumptoolCheck.pack()
224246
unlaunchCheck.pack()
225247
startButton.pack()
226248
outputLabel.pack()
227249
outputBox.pack()
228250
window.mainloop()
229-

0 commit comments

Comments
 (0)