Stefano Teso initially found this way back in 2003. The farthest he got was an array of function pointers in memory, one of which points to 0x50208, which in turn enters the debug menu. The patch places this address into the first element of the function pointer table. I just spent about 15 minutes looking at it and discovered that there does indeed appear to be a bit of code that will select this element in the table

Let's keep our fingers crossed that this is activated with buttons and not via some serial port interface or something crazy like that.
- Code: Select all
0x00059B54: 0x806D8094 lwz r3,-0x7F6C(r13)
0x00059B58: 0x5460E801 rlwinm. r0,r3,29,0x80000000
0x00059B5C: 0x40820010 bf cr0[eq],0x00059B6C
0x00059B60: 0x54600001 and. r0,r3,0x80000000
0x00059B64: 0x40820008 bf cr0[eq],0x00059B6C
0x00059B68: 0x4800000C b 0x00059B74
0x00059B6C: 0x3860003C li r3,0x0000003C <-- this gets us to debug menu
0x00059B70: 0x986DC006 stb r3,-0x3FFA(r13)
0x00059B74: 0x4E800020 bclr 0x14,0
Now just need to work backwards. I'll have to really dig in on Friday because I don't think I'll have time in the next couple of days. Unfortunately, useful though it will be, it won't solve most of the lighting equation problems
Re: shading, perhaps "IsNotShaded()" in the manual refers to sun vector shading only and not ambient? Or, it refers to the lighting components (sun_vector+ambient) but NOT fixed intensity. If the latter is true, it would mean, I think, that lighting disabled and (not shaded and not fixed shaded) are equivalent states.
This could mean that there are bits for each of these:
1. Shading enable/disable
2. Flat/smooth (if fixed shading enabled, smooth shading disables sun vector entirely?)
3. Fixed shading enable/disable
An alternative is to have a fourth sun vector bit, allowing some weird illegal state where both smooth-shaded sun vector and fixed lighting are enabled, with the API in charge of preventing this, but seems unlikely.