Ejecting a disc using cIOS

Discussion in 'Wii - Hacking' started by twofive, Apr 6, 2009.

  1. twofive
    OP

    twofive GBAtemp Regular

    Member
    1
    Nov 20, 2008
    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
     
  2. Det1re

    Det1re det1re.de

    Member
    2
    Oct 28, 2008
    Gambia, The
    Germany
    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;
    }
     
  3. twofive
    OP

    twofive GBAtemp Regular

    Member
    1
    Nov 20, 2008
    Poland
    I tried that already, it comes into conflict with libcios, so I can't use that.

    -- twofive
     
  4. twofive
    OP

    twofive GBAtemp Regular

    Member
    1
    Nov 20, 2008
    Poland
    Anybody? [​IMG]
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice