dolphin icon indicating copy to clipboard operation
dolphin copied to clipboard

Add option to report empty GC disc drive as closed (issue 11840)

Open blaahaj opened this issue 5 years ago • 16 comments

https://bugs.dolphin-emu.org/issues/11840

This gives important doot-doot-doot music and bouncy cube.

Only problem: when an empty disc drive is reported as closed, the IPL encounters a read error:

The disc could not be read.

Please read the NINTENDO GAMECUBE
Instruction Booklet for more information.

This means the menu does not load afterwards.

I don't know why that happens. I wasn't able to fix it. So setting is off by default.

blaahaj avatar Sep 09 '19 21:09 blaahaj

Unless I misread the issue report, having an IPL dump, disabling "Skip Main Menu" option in Dolphin's settings then holding B button on GC Controller 1 when booting any GameCube game should achieve the same, no?

mbc07 avatar Sep 09 '19 21:09 mbc07

Yeah you misread the issue report. This applies when booting the IPL directly without a disc (Tools > Load GameCube Main Menu).

Techjar avatar Sep 09 '19 21:09 Techjar

Do you think “The disc could not be read.” prevents merging this? I do not expect that this error is a regression. I think it is likelier that it was simply hidden before, because Dolphin did not ever report the drive as empty and closed at the same time when the IPL runs. The new option I add does not default to on, in order that it would not break anything for users unless they should choose to edit the setting.

ghost avatar Sep 23 '19 18:09 ghost

It's probably because the drive isn't returning the proper error code. If I recall correctly from my earlier tests, the high byte should be 0x03000000 (ERROR_NO_DISK_L) and the low bytes should be 0x023a00 (ERROR_NO_DISK_H). I think, at least.

Note that my tests were on the Wii, and were based on a rather silly edge case; the Wii will report the cover being closed with no disc if you insert something other than a DVD in it, such as an audio CD. This also causes the disc channel to be confused, same as in dolphin. I don't have a gamecube (and as such, I don't have an IPL dump), so I can't say whether the same thing would work here.

You probably need to add another case here:

https://github.com/dolphin-emu/dolphin/blob/b29ba7119a6695f6302da4d0f59ea50d02ee65b7/Source/Core/Core/HW/DVD/DVDInterface.cpp#L718-L734

Pokechu22 avatar Sep 23 '19 18:09 Pokechu22

It's probably because the drive isn't returning the proper error code. If I recall correctly from my earlier tests, the high byte should be 0x03000000 (ERROR_NO_DISK_L) and the low bytes should be 0x023a00 (ERROR_NO_DISK_H). I think, at least.

If I am remembering right, I did exactly what you said and it did not work. But, I will try this again, it could have been another combination of bits.

ghost avatar Sep 23 '19 18:09 ghost

Oh, I should also note that it should probably be returning ERROR_COVER for the high bits in the current case, and that I locally renamed ERROR_COVER_H to ERROR_NO_DISK_H, which is probably why you didn't run into that...

Pokechu22 avatar Sep 23 '19 18:09 Pokechu22

@Pokechu22 The current code s_error_code = ERROR_NO_DISK | ERROR_COVER_H; is already those hex values.

ghost avatar Sep 23 '19 18:09 ghost

Can you run it with the DVD Interface (DVD) log enabled, and then post the log file? Also, can you post a screenshot of the disc could not be read screen?

Pokechu22 avatar Sep 23 '19 21:09 Pokechu22

@Pokechu22

Log level is Info.

34:40:891 Core/HW/DVD/DVDInterface.cpp:928 I[DVD]: Read DiscID 00000000
34:40:909 Core/HW/DVD/DVDInterface.cpp:1070 I[DVD]: DVDLowStopMotor  kill!

Screenshot

I apologise that I did not see your comment sooner.

ghost avatar Sep 29 '19 11:09 ghost

I'm not entirely sure what to make of that, unfortunately. It doesn't seem to have even requested the error, which doesn't match up with my expectations.

What happens if you boot the IPL with a Wii disc set as the default disc (both before and after this change)?

(As a side note, the DVDLowStopMotor kill! message having kill! in it is a bug, but shouldn't be causing this issue; it's using DICMDBUF1 and DICMDBUF2 as its params which are instead set off of the previous read disc ID (so DICMDBUF1 is 0, and DICMDBUF2 is 0x20). The wii DVDLowStopMotor command takes 2 parameters, but those parameters aren't passed directly to the actual drive interface and are instead put into DICMDBUF0; the oddness here is caused by dolphin implementing Wii ioctls and the actual DI commands in the same place. I'm working on something to fix that, but it's not done yet. I haven't tested it, but I highly doubt that the gamecube even has those parameters since one of them is for ejecting the disc...)

Pokechu22 avatar Oct 01 '19 01:10 Pokechu22

What happens if you boot the IPL with a Wii disc set as the default disc (both before and after this change)?

  • With 'Report disc drive as closed when empty' - same error message
  • Without 'Report disc drive as closed when empty' - same lack of doot doot doot

Apologise again for slow response.

ghost avatar Oct 18 '19 21:10 ghost

Rebased code.

It seems the error message was fixed?

ghost avatar Apr 03 '21 15:04 ghost

Now:

  • With 'Report disc drive as closed when empty' - doot doot doot. No error message. ✔️
  • Without 'Report disc drive as closed when empty' - no doot doot doot. No error message. ✔️

PAL & NTSC-U IPL tested.

ghost avatar Apr 04 '21 11:04 ghost

Could some one remove the " WIP / do not merge "?

ghost avatar Apr 07 '21 20:04 ghost

What happened with this pr? :(

Rumi-Larry avatar Aug 07 '21 18:08 Rumi-Larry

What's the status of this?

Zopolis4 avatar Sep 13 '22 04:09 Zopolis4

Can you rebase this?

AdmiralCurtiss avatar Jan 30 '23 08:01 AdmiralCurtiss

Rebased as #11570

AdmiralCurtiss avatar Feb 16 '23 00:02 AdmiralCurtiss