XboxDev / nxdk

The cross-platform, open-source SDK to develop for original Xbox: *new* xdk
445 stars 68 forks source link

Eject-button doesn't reset to Dashboard #370

Open InternalLoss opened 4 years ago

InternalLoss commented 4 years ago

When booting a burnt DVD of a sample (used for testing https://github.com/XboxDev/nxdk/issues/369 on hardware), the Xbox does not respond to the disc being ejected from either being launched in UnleashX or from boot. In contrast, a retail copy of MechAssault (and presumably all other games that are retail) will return to the user dashboard. As IGR doesn't work in NXDK applications (it's probably reliant on something XDK specific?), this would be important if any big NXDK-using app or game came out that was distributed on DVD.

InternalLoss commented 4 years ago

Also, for posterity: My Xbox is a 1.4, with EvoX M8+ being ran via an OpenXenium; I cannot replicate the behaviour on a soft mod haha yes good typo as my other Xbox is completely stock.

thrimbor commented 4 years ago

Afaik this behavior is controlled by HalEnableSecureTrayEject() (https://github.com/XboxDev/nxdk/blob/master/lib/xboxkrnl/xboxkrnl.h#L4086), and you have to manually enable it. I'm not sure how the XDK handles it, it may or may not call it automatically based on some flag or something. I'm not sure whether we want to enable this in our samples, but this may be a candidate for a new wiki page for Xbox-specific things to keep in mind.

As for IGR: I assume the kernel patches the XDK's USB stack to get notified when the user hits the IGR button combination. Such patches ofc won't work with our USB stack, it's the same reason why nxdk apps don't work in Cxbx-Reloaded.

InternalLoss commented 4 years ago

It'd be useful for devs if they wished to use DVD-R(W) media for testing; I haven't looked at XDK but all retail games do Reset when ejected.

IGR I assumed used some weird XDK hooks, it'd be potentially useful to support what it does (even if you just lie and handle a reset) since NKPatcher and various custom BIOSes all support IGR.

thrimbor commented 4 years ago

It'd be useful for devs if they wished to use DVD-R(W) media for testing; I haven't looked at XDK but all retail games do Reset when ejected.

I just quickly checked the Halo and dashboard xbe and I was slightly mistaken. It's not the game that calls HalEnableSecureTrayEject(), it's the dashboard, directly before it launches the xbe from the DVD drive. I don't know if this is different when using UDF, but in theory you should get the same behavior with nxdk.

IGR I assumed used some weird XDK hooks, it'd be potentially useful to support what it does

I'm suspecting this will be almost impossible to do properly. Depending on how the kernel does the patching, we could be required to include MS code to get a pattern match, and then the patched in code wouldn't be compatible, so we'd have to detect whether code was patched in and react to that.

InternalLoss commented 4 years ago

I did a few more tests, and:

I need to make and burn a UDF of an XDK game and an XISO of a NXDK demo, but that'll be later. It's also known that Xbox Live titles were able to disc-swap (but it might have used dashboard as an interim, we're not far along enough to confirm this.)