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

Changes

Jump to navigation Jump to search
Line 10: Line 10:  
In order to better understand the mechanism, it’s worth looking at the individual messages as they are exchanged with IOS. Here’s what it might look like:
 
In order to better understand the mechanism, it’s worth looking at the individual messages as they are exchanged with IOS. Here’s what it might look like:
   −
PowerPCIOS
+
PowerPCIOS
Initializing STM
+
Initializing STM
open(path=”/dev/stm/immediate”)
+
open(path=”/dev/stm/immediate”)
open() fd = 1
+
open() fd = 1
open(path=”/dev/stm/eventhook”)
+
open(path=”/dev/stm/eventhook”)
open() fd = 2
+
open() fd = 2
ioctl(fd=2, num=EVENTHOOK, evbuf=0×12345600)
+
ioctl(fd=2, num=EVENTHOOK, evbuf=0×12345600)
Time passes, user presses button
+
Time passes, user presses button
Write event code to 0×12345600
+
Write event code to 0×12345600
ioctl(fd=2) result = 0
+
ioctl(fd=2) result = 0
Read event code from 0×12345600
+
Read event code from 0×12345600
ioctl(fd=2, num=EVENTHOOK, evbuf=0×12345600)
+
ioctl(fd=2, num=EVENTHOOK, evbuf=0×12345600)
Time passes, software decides to shut down STM
+
Time passes, software decides to shut down STM
ioctl(fd=1, num=RELEASE)
+
ioctl(fd=1, num=RELEASE)
Write 0 event code to 0×12345600
+
Write 0 event code to 0×12345600
ioctl(fd=2) result = 0
+
ioctl(fd=2) result = 0
ioctl(fd=1) result = 0
+
ioctl(fd=1) result = 0
close(2)
+
close(2)
close(2) result = 0
+
close(2) result = 0
close(1)
+
close(1)
close(1) result = 0
+
close(1) result = 0
    
Things didn’t work well when using the [[Twilight Hack]] because Zelda’s STM eventhook was still active, and STM won’t let you register a new one. So an STM eventhook release was added to the Twilight Hack. One slight issue is that we can’t know if there was an old eventhook or not, depending on what the state of the machine was (since the Twilight Hack can be relaunched from software, as an SD loader of sorts, and this was popular in the early days), so we just make it attempt to release the eventhook always. This is fine, as the release function will return an error if there is no eventhook active.
 
Things didn’t work well when using the [[Twilight Hack]] because Zelda’s STM eventhook was still active, and STM won’t let you register a new one. So an STM eventhook release was added to the Twilight Hack. One slight issue is that we can’t know if there was an old eventhook or not, depending on what the state of the machine was (since the Twilight Hack can be relaunched from software, as an SD loader of sorts, and this was popular in the early days), so we just make it attempt to release the eventhook always. This is fine, as the release function will return an error if there is no eventhook active.
1

edit

Navigation menu