1
- ui .echo (" Testing!\n \n This is a test.\n \n I will now try to verify finalize.romfs." )
1
+ ui .show_text (" NEW SUPER FINALIZE SCRIPT XL & KNUCKLES" )
2
+ ui .echo (" Testing!\n \n This is a test." )
2
3
4
+ print (" Checking embedded backup..." )
5
+ local embedded = sys .check_embedded_backup ()
6
+ if embedded == false then
7
+ ui .echo (" The embedded backup is required\n to run this script." )
8
+ sys .reboot ()
9
+ elseif embedded == nil then
10
+ ui .echo (" Unusual situation alert!\n \n The embedded backup doesn't exist,\n \n and was not auto-created...?" )
11
+ sys .reboot ()
12
+ end
13
+
14
+ print (" Checking Raw RTC..." )
15
+ local rtc_set = false
16
+ while not rtc_set do
17
+ rtc_set = sys .check_raw_rtc ()
18
+ if not rtc_set then
19
+ local retry = ui .ask (" If the Raw RTC is not set,\n the date in GodMode9 will be incorrect.\n \n Retry?" )
20
+ if not retry then
21
+ sys .reboot ()
22
+ end
23
+ end
24
+ end
25
+
26
+ -- maybe later when we build GM9 without the stock permission prompts
27
+ -- we can remove this warning, but for now, let's pre-allow ourselves
28
+ -- (makes it easier too in case of finalize.romfs being misplaced in "Nintendo 3DS"
29
+
30
+ ui .echo (" This script needs permission\n to access your SD card software\n to install some stuff." )
31
+ local allowed = fs .allow (" 0:/Nintendo 3DS" )
32
+ if not allowed then
33
+ ui .echo (" I was not given permission\n so I guess I'll go away..." )
34
+ sys .power_off ()
35
+ end
36
+
37
+ -- these are not used for anything yet
38
+ -- but you could use these with fs.find
39
+ local paths = {
40
+ " 0:/finalize (*).romfs" ,
41
+ " 0:/3ds/finalize (*).romfs" ,
42
+ " 0:/luma/payloads/finalize (*).romfs" ,
43
+ " 0:/luma/finalize (*).romfs" ,
44
+ " 0:/DCIM/finalize (*).romfs" ,
45
+ " 0:/Nintendo 3DS/finalize (*).romfs" ,
46
+ " 0:/finalize.romfs" ,
47
+ " 0:/3ds/finalize.romfs" ,
48
+ " 0:/luma/payloads/finalize.romfs" ,
49
+ " 0:/luma/finalize.romfs" ,
50
+ " 0:/DCIM/finalize.romfs" ,
51
+ " 0:/Nintendo 3DS/finalize.romfs"
52
+ }
53
+
54
+ print (" Getting expected hash..." )
55
+ -- the use of CURRDIR here lets us run the script directly as long as the txt is next to it
3
56
local success , hash_expected = pcall (fs .read_file , CURRDIR .. " /finalize-romfs-hash.txt" , 0 , 64 )
4
57
if not success then
5
58
ui .echo (" Failed to read hash txt?\n " .. hash_expected )
6
59
sys .power_off ()
7
60
end
8
61
9
62
print (" Expected:" , hash_expected )
63
+ -- this could search several paths for finalize.romfs, but for a test, this path is hardcoded
10
64
local success , hash_got = pcall (fs .hash_file , " 0:/finalize.romfs" , 0 , 0 )
11
65
if not success then
12
- ui .echo (" Failed to hash finalize.romfs\n " .. hash_got )
66
+ ui .echo (" Failed to hash finalize.romfs\n " .. hash_got )
13
67
sys .power_off ()
14
68
end
15
69
@@ -22,3 +76,11 @@ if hash_got == hash_expected then
22
76
else
23
77
ui .echo (" Failure..." )
24
78
end
79
+
80
+ local sel = ui .ask_selection (" This is where the test ends.\n \n Select what to do now.\n Or press B to power off." , {" Reboot" , " Power off" })
81
+ if sel == 1 then
82
+ sys .reboot ()
83
+ elseif sel == 2 then
84
+ sys .power_off ()
85
+ end
86
+ sys .power_off ()
0 commit comments