In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

System Menu/BS2

From WiiBrew
Jump to navigation Jump to search

States taken from System Menu 257 (3.1U)

Types

State number action next states
0 prints out status flags ("No Disk", "Drive Reset", "Wait Spinup", "Boot from Cache"), delay?, enable waiting-for-disk? 2, 52
1 delay 2
2 delay, enable waiting-for-disk?, DVDResetAsync 3
3 bs2_issue_dvd_command, delay, __DVDGetCoverStatusAsync, create cache.dat? 4
4 ReadDriveInfo via cache.dat or DVDInquiryAsync 5
5 wait for dvd command to finish, update cache.dat if necessary, setup 800030E6 [16bit] based on drive info and console type 8
6 DVDDownRotationAsync 7
7 bs2_issue_dvd_command? 8
8 Read 0x20 bytes of disk id [from cache.dat or disk via DVDReadDiskID] 9
9/10 wait for dvd command to finish, update cache.dat if necessary, copy the 0x20 byte long disk id to 0x80000000.

if [disk_id + 0x18] is 0x5d1c9ea3, and the [disk_id + 0] is not 'RAAE', treat as a wii disc.

otherwise, if [disk_id + 0x1c] is 0xc2339f3d, treat as gamecube disk

otherwise, the disk type is unknown

gamecube disk = 11, wii disk = 15, unknown = 54
11 if not waiting for a disk, exit to state 50

if waiting, disable the waiting-for-disk and check streaming [0x80000008]

if streaming and no streaming buffer size defined [0x80000009], set to size 10

if streaming, setup via __DVDAudioBufferConfig

go to state 12

12, 50
12 wait for DVD command to finish 13
13 async unencrypted 0x2000 byte dvd read 14
14 wait for DVD command to finish

once finished, check game region

region ok = 50

region not match = 54

15 unknown check can switch to state 70

read 0x20 bytes from disk (game toc?)

16
16 wait for dvd command to finish, update cache.dat if necessary 17
17 read partition info from disk 18
18 wait for dvd command to finish, update cache.dat if necessary

go through the game partition, making note of those of type 0 and 1

19
19 read 0x2000 bytes from disk 20
20 wait for dvd command to finish, update cache.dat if necessary

if 0xc3f81a8e not found at the end of read block, go to state 54

if region check fails, go to state 54

if BS2IsValidDisc check fails, go to state 54

if booting from cache, go to state 37

if there's a partition of type 1, go to state 21

if there's a partition of type 0, go to state 37

otherwise, go to state 54

21,37,54
21 DVDOpenPartitionAsync 22
22 bs2_issue_dvd_command?, print out TMD info 23
23 DVDReadAbsAsyncForBS 24
24 bs2_issue_dvd_command? 24, 25 (non-wii disc), 35 (wii disc)
25 DVDReadAbsAsyncForBS 26
26 bs2_issue_dvd_command

print out appLoaderLength / appLoaderFunc1

27
27 DVDReadAbsAsyncForBS 28
28 call apploader init func 29
29 call apploader main func

print "Addr [0x%x] length [0x%x] offset [0x%x]" DVDReadAbsAsyncForBS

30 (apploader main returned non-zero)

31 (apploader main returned zero)

30 bs2_issue_dvd_command 29
31 __DVDFSInit

BS2UpdateInit

32
32 BS2UpdateState

if an update exists:

BS2GetUpdateEntryNum
BS2UpdateState
BS2GetUpdateEntryNum
BS2Report("%d entries")
__DVDGetCoverStatusAsync
state 33

otherwise:

__DVDGetDriveStatus
based on status (?), DVDCancelAllAsync
32

1 (no update) 33 (update present) 35 ("No Entry"?)

33 bs2_issue_dvd_command?

BS2UpdateState __DVDGetCoverStatusAsync

33 or 34
34 BS2UpdateState

__DVDGetDriveStatus based on status (?), DVDCancelAllAsync based on return code of BS2UpdateState, print "Update success", "Update success\nPlease reboot", or "Update failed"

34

35 (update success) 58 (update failed)

35 DVDClosePartitionAsync 36
36 bs2_issue_dvd_command?

BS2UpdateState

37

54 65

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72