Hacking Ejecting a disc using cIOS

twofive

Well-Known Member
Member
Joined
Nov 20, 2008
Messages
148
Trophies
0
XP
108
Country
Poland
Hi!

I need to eject a Wii disc from the Wii's DVD drive from homebrew using the cIOS. Is there any way I can do this?
It's possible from DVDX but I haven't found any function to do that using cIOS.

-- twofive
 

Det1re

det1re.de
Member
Joined
Oct 28, 2008
Messages
1,272
Trophies
0
Age
32
Location
Germany
Website
det1re.de
XP
244
Country
Gambia, The
http://wiibrew.org/wiki/Eject_DVD

It doesn't use cIOS, but it will likely eject your DVD. Source is included:

CODE#include
#include
#include
#include

static void *xfb = NULL;
static GXRModeObj *rmode = NULL;

//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------
ÂÂÂÂ// Initialise the DVD system
ÂÂÂÂDI_Init();
ÂÂÂÂ
ÂÂÂÂ// Initialise the video system
ÂÂÂÂVIDEO_Init();
ÂÂÂÂ
ÂÂÂÂ// Obtain the preferred video mode from the system
ÂÂÂÂ// This will correspond to the settings in the Wii menu
ÂÂÂÂrmode = VIDEO_GetPreferredMode(NULL);

ÂÂÂÂ// Allocate memory for the display in the uncached region
ÂÂÂÂxfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
ÂÂÂÂ
ÂÂÂÂ// Initialise the console, required for printf
ÂÂÂÂconsole_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
ÂÂÂÂ
ÂÂÂÂ// Set up the video registers with the chosen mode
ÂÂÂÂVIDEO_Configure(rmode);
ÂÂÂÂ
ÂÂÂÂ// Tell the video hardware where our display memory is
ÂÂÂÂVIDEO_SetNextFramebuffer(xfb);
ÂÂÂÂ
ÂÂÂÂ// Make the display visible
ÂÂÂÂVIDEO_SetBlack(FALSE);

ÂÂÂÂ// Flush the video register changes to the hardware
ÂÂÂÂVIDEO_Flush();

ÂÂÂÂ// Wait for Video setup to complete
ÂÂÂÂVIDEO_WaitVSync();
ÂÂÂÂif(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

ÂÂÂÂ// The console understands VT terminal escape codes
ÂÂÂÂ// This positions the cursor on row 2, column 0
ÂÂÂÂ// we can use variables for this with format codes too
ÂÂÂÂ// e.g. printf ("\x1b[%d;%dH", row, column );
ÂÂÂÂprintf("\x1b[2;0H");
ÂÂÂÂÂÂÂÂ
ÂÂÂÂprintf("Eject DVD 0.1 - (c) 2008 hOTzENpLOTz\n\n");
ÂÂÂÂ
ÂÂÂÂ// Check if a DVD is in the drive
ÂÂÂÂuint32_t val;
ÂÂÂÂDI_GetCoverRegister(&val);ÂÂÂÂ
ÂÂÂÂif (!(val&0x2))
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("No DVD in drive.");
ÂÂÂÂ}
ÂÂÂÂelse
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprintf("Ejecting DVD... ");
ÂÂÂÂÂÂÂÂif (DI_Eject() == 0) {
ÂÂÂÂÂÂÂÂÂÂÂÂprintf("OK.");
ÂÂÂÂÂÂÂÂ} else {
ÂÂÂÂÂÂÂÂÂÂÂÂprintf("\nCould not eject DVD!");
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂprintf("\n\nExiting...\n");

ÂÂÂÂreturn 0;
}
 

twofive

Well-Known Member
Member
Joined
Nov 20, 2008
Messages
148
Trophies
0
XP
108
Country
Poland
Anybody?
smileipb2.png
 

Site & Scene News

General chit-chat
Help Users
    kenenthk @ kenenthk: More mighty then the sword