Skip to content

Commit 66c0a87

Browse files
committed
check free space on inject only
1 parent 47847df commit 66c0a87

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

MSET9_installer_script/mset9.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ def getInput(options):
183183

184184
# Section: sdWritable
185185
def writeProtectCheck():
186-
global fs
187186
prinfo("Checking if SD card is writeable...")
188187
if not is_writable():
189188
prbad("Error 02: Your SD card is write protected! If using a full size SD card, ensure that the lock switch is facing upwards.")
@@ -192,15 +191,6 @@ def writeProtectCheck():
192191
else:
193192
prgood("SD card is writeable!")
194193

195-
# Section: SD card free space
196-
# ensure 16MB free space
197-
freeSpace = shutil.disk_usage(scriptroot).free
198-
if not freeSpace >= 16 * 1024 * 1024:
199-
prbad(f"Error 06: You need at least 16MB free space on your SD card, you have {(freeSpace / 1000000):.2f} bytes!")
200-
prbad("Error 06: You need at least 16MB free space on your SD card!")
201-
prinfo("Please free up some space and try again.")
202-
exitOnEnter()
203-
204194
clearScreen()
205195
print(f"MSET9 {VERSION} SETUP by zoogie, Aven, DannyAAM and thepikachugamer")
206196
print("What is your console model and version?")
@@ -254,7 +244,7 @@ def writeProtectCheck():
254244
triggerFilePath = ""
255245

256246
def createHaxID1():
257-
global fs, ID0, hackedID1Path, realID1Path, realID1BackupTag
247+
global ID0, hackedID1Path, realID1Path, realID1BackupTag
258248

259249
print("\033[0;33m=== DISCLAIMER ===\033[0m") # 5;33m? The blinking is awesome but I also don't want to frighten users lol
260250
print()
@@ -317,7 +307,7 @@ def createHaxID1():
317307
miiPlazaExtdata = False
318308

319309
def sanity():
320-
global fs, hackedID1Path, titleDatabasesGood, menuExtdataGood, miiExtdataGood, miiPlazaExtdata
310+
global hackedID1Path, titleDatabasesGood, menuExtdataGood, miiExtdataGood, miiPlazaExtdata
321311

322312
prinfo("Checking databases...")
323313
checkTitledb = softcheck(hackedID1Path + "/dbs/title.db", 0x31E400)
@@ -380,7 +370,7 @@ def sanityReport():
380370
print()
381371

382372
def injection(create=True):
383-
global fs, haxState, hackedID1Path, trigger
373+
global haxState, hackedID1Path, trigger
384374

385375
triggerFilePath = hackedID1Path + "/extdata/" + trigger
386376

@@ -392,6 +382,11 @@ def injection(create=True):
392382
os.remove(abs(triggerFilePath))
393383
haxState = 4
394384
prgood("Removed trigger file.")
385+
freeSpace = shutil.disk_usage(scriptroot).free
386+
if freeSpace < 16 * 1024 * 1024:
387+
prbad(f"Error 06: You need at least 16MB free space on your SD card, you have {(freeSpace / 1000000):.2f} bytes!")
388+
prbad("Error 06: You need at least 16MB free space on your SD card!")
389+
prinfo("Please free up some space and try again.")
395390
return
396391

397392
prinfo("Injecting trigger file...")
@@ -403,7 +398,7 @@ def injection(create=True):
403398
exitOnEnter()
404399

405400
def remove():
406-
global fs, ID0, ID1, hackedID1Path, realID1Path, realID1BackupTag, titleDatabasesGood
401+
global ID0, ID1, hackedID1Path, realID1Path, realID1BackupTag, titleDatabasesGood
407402

408403
prinfo("Removing MSET9...")
409404

@@ -425,7 +420,6 @@ def remove():
425420
prgood("Successfully removed MSET9!")
426421

427422
def softcheck(keyfile, expectedSize = None, crc32 = None):
428-
global fs
429423
filename = keyfile.rsplit("/")[-1]
430424

431425
if not os.path.exists(abs(keyfile)):

0 commit comments

Comments
 (0)