Eternal Darkness backup&retail disc in a loader

Post Reply
WiiPower
Posts: 127
Joined: Sun May 23, 2010 5:57 pm

Eternal Darkness backup&retail disc in a loader

Post by WiiPower » Sun May 30, 2010 1:22 pm

I don't know where else to ask, sorry if this is the wrong place.

I have a loader for retail&backup gamecube games on a wii, while the actual loader runs in gamecube mode. Currently i can't run Eternal Darkness retail disc, because i get a read error on the startup screen. Then i read that ejecting and reinserting the disc helps, so i tried that and the drive didn't read anything after ejecting the disc once. Then i found this function in the code which i'm not using:

Code: Select all

/** After calling this function, the DVD drive can be reseted (needed for disc change). */
void wii_dvd_reset_unlock(void)
{
	volatile unsigned long *pi_cmd = (unsigned long *) 0xCC003024;
	volatile unsigned long *ios_magic = (unsigned long *) 0x800030F8;
	volatile unsigned long *ios_sync_base = (unsigned long *) 0x800030E0;
	volatile unsigned long *phys_ios_magic = (unsigned long *) 0xC00030F8;

	debug_printf("wii_dvd_reset_unlock()\n");

	/* I assume this will synchronize with Starlet/MIOS. */
	*pi_cmd |= 7;

	*ios_magic = 0xDEAEBEEF;
	DCFlushRange((void *) ios_sync_base, 32);

	while(*phys_ios_magic != 0) {
		/* I assume this waits for Starlet. */
	}
}
And i try this code to reset the drive:

Code: Select all

unsigned long ack_cover_interrupt(void)
{
	unsigned int val;

	val = dvd[0];
	//debug_printf("DISR 0x%x\n", val);
	dvd[0] = val;

	return val;
}

unsigned long get_cover_status(void)
{
	unsigned int val;

	val = dvd[1];
	//debug_printf("DICVR 0x%x\n", val);
	dvd[1] = val;

	return val & 0x05;
}

void dvd_reset(void)
{
	unsigned long v;

	debug_printf("dvd_reset()\n");

	/* Clear cover interrupt. */
	dvd[1] = 2;

	v = piio[9];

	piio[9] = (v & ~4) | 1;
	usleep(1000);
	piio[9] = v | 5;
}

	// reset the drive
	unsigned int cvstatus;
	
	ack_cover_interrupt();
	dvd_reset();

	/* Wait until reset is finished. */
	do {
		cvstatus = get_cover_status();
	} while ((cvstatus & 0x01) != 0);
But it only partly helps, here are all my results:

Code: Select all

Eternal Darkness ## retail ## drive not allowed to reset ## no reset in the loader
read error on startup screen, ejecting and reinserting disc does nothing

Eternal Darkness ## retail ## drive allowed to reset ## no reset in the loader
read error on startup screen, ejecting and reinserting disc helps to skip this

Eternal Darkness ## retail ## drive allowed to reset ## force reset in the loader
*edit: read error on startup screen, ejecting and reinserting disc helps to skip this

Eternal Darkness ## backup on multi game disc ## drive not allowed to reset ## no reset in the loader
no error on startup screen, ejecting and reinserting disc does nothing

Eternal Darkness ## backup on multi game disc ## drive allowed to reset ## no reset in the loader
read error on startup screen, ejecting and reinserting disc does nothing

Eternal Darkness ## backup on multi game disc ## drive allowed to reset ## force reset in the loader
read error on startup screen, ejecting and reinserting disc does nothing
I don't expect any help on the backup code, but maybe it helps to figure out what's going on. I would be happy if i would get the code that makes Eternal Darkness retail disc boot without an error.

Maybe this is important as well, i call this function too, and it returns true for this game.

Code: Select all

bool dvd_set_streaming(void)
{
	u8 dvdheader[0x20];
	memcpy(dvdheader,(void*)0x80000000,0x20);
	if (dvdheader[8] == 0x01)
	{
		dvd[0] = 0x2E;
		dvd[2] = 0xE4010000;
		dvd[7] = 1;
		while (dvd[7] & 1);
		return true;
	}
	else
	{		
		dvd[0] = 0x2E;
		dvd[2] = 0xE4000000;
		dvd[7] = 1;
		while (dvd[7] & 1);
		return false;
	}
}
I would be thankful for any help or suggestions.
Last edited by WiiPower on Sun May 30, 2010 1:45 pm, edited 1 time in total.
WiiPower
Posts: 127
Joined: Sun May 23, 2010 5:57 pm

Re: Eternal Darkness backup&retail disc in a loader

Post by WiiPower » Sun May 30, 2010 1:44 pm

Ok, i fixed the read error on the disc id for the retail disc. I forgot that for retail discs, the regular read disc id call needs to be done after the reset or else it's impossible to read anything from the disc.
User avatar
emu_kidid
Site Admin
Posts: 4927
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: Eternal Darkness backup&retail disc in a loader

Post by emu_kidid » Sun May 30, 2010 11:35 pm

Try this sequence of events:

1. Reset the DVD Drive
2. Send a disc read ID command and grab the 32 byte header back
3. Check from that disc ID byte 0x08, if it's not zero, enable audio streaming
4. Check that the error code returned here is 0x00000000, otherwise you have not properly enabled audio streaming.

Note, if you're using the 0xD0 reading commands to circumvent things and run backups, you're going to have issues enabling audio streaming since the attempts to stream internally on the drive will fail.
Image
WiiPower
Posts: 127
Joined: Sun May 23, 2010 5:57 pm

Re: Eternal Darkness backup&retail disc in a loader

Post by WiiPower » Sat Jul 10, 2010 12:26 pm

Thanks for the help. Now i'm stuck at getting:
0x052402 as error code if i ask for the error after enabling the audio streaming. According to YAGCD it's "Configuration out of permitted period", but that doesn't help me. Strange is that the Eternal Darkness backup freezes now when i ask for the error, at a point _after_ the read error that happens on the retail disc.

For backups the whole thing is not a problem as i just return 1 for all audio related commands the games use. But it's kinda annoying that the retail discs don't work properly while the backup versions of the same games work.
WiiPower
Posts: 127
Joined: Sun May 23, 2010 5:57 pm

Re: Eternal Darkness backup&retail disc in a loader

Post by WiiPower » Wed Jul 14, 2010 10:11 am

Yay, it finally works(after some help from Crediar). The reset, read id and set streaming mode need to be directly next to each other, or otherwise it will result in that error. Too bad that setting the streaming mode always returns an error on backups, i think that's the problem for 1 or 2 incompatbile games.
User avatar
emu_kidid
Site Admin
Posts: 4927
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: Eternal Darkness backup&retail disc in a loader

Post by emu_kidid » Wed Jul 14, 2010 12:52 pm

Yes as I said they need to be next to each other. when I said to check the byte at 0x08 I meant from the data returned from the disc read id.
Image
Post Reply