Disc Swap API etc.

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
emptythought
DC Developer
DC Developer
Posts: 2015
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Wed Jan 30, 2002 9:14 am
Location: UNITED STATES NRN
Has thanked: 0
Been thanked: 0
Contact:

Disc Swap API etc.

Post by emptythought »

Does anyone have a sample of any disc swapping in KOS' 1.3.x API? I wanted to use it in Wolf4SDL; I don't have a Dreamcast (or emulator that supports disc swapping [open\close]) to test it on).

DoomDC by BlackAura has somewhere to start, I just haven't gotten around to it.
speewave
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 18
Joined: Sun Feb 28, 2010 9:29 pm
Has thanked: 0
Been thanked: 0

Re: Disc Swap API etc.

Post by speewave »

the program won't shut off when the eject button is pressed prematurely ... it sits there ... so a "Insert Disc and Press Start" method should work... (you can probably do a test for the correct files)
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Re: Disc Swap API etc.

Post by BlackAura »

KOS handles disc swapping mostly automatically. If the disc has been changed, the file system will be reinitialized as soon as you try to open a new file handle.

You can also spin down the disc by calling cdrom_spin_down, and you can check the drive's status using cdrom_get_status, like so:

Code: Select all

int status, disc_type;
if(cdrom_get_status(&status, &disc_type) != -1) {
    switch(status) {
        case CD_STATUS_OPEN:
            // Drive door is open
            break;
        case CD_STATUS_NO_DISC:
            // Drive door is closed, no disc is inserted
            break;
    }
}
I don't remember off-hand how to detect if there's actually a disc in the drive. I think the status passes through CD_STATUS_SCANNING, and then settles on CD_STATUS_STANDBY, so you could probably wait for that.

Those constants are all defined in kos/kernel/arch/dreamcast/include/dc/cdrom.h
Post Reply