LeoReadDiskID LeoReadDiskID (function)

Obtains the disk ID


#include <PR/leo.h>     /* leo.h */

s32 LeoReadDiskID(LEOCmd *cmdBlock, LEODiskID *id, OSMesgQueue *mq);

typedef struct
   u8 pad;
   u8 yearhi;
   u8 yearlo;
   u8 month;
   u8 day;
   u8 hour;
   u8 minute;
   u8 second;
} LEODiskTime;

typedef struct
   u64 lineNumber;
   LEODiskTime time;
} LEOSerialNum;

typedef struct
   u8 gameName[4];
   u8 gameVersion;
   u8 diskNumber;
   u8 ramUsage;
   u8 diskUsage;
   LEOSerialNum serialNumber;
   u64 reserve;
} LEODiskID;


Note: None of the N64 Disk Drive-related instructions involve ROM DMA (including DMA to ROM in the drive). In fact, the instructions are designed on the assumption that ROM DMA will not be carried out. Please see the "Programming Cautions" section of the N64 Disk Drive Programming Manual to learn more about this.

LeoReadDiskID gets the disk ID of the current N64 Disk Drive disk from the system area of the disk.
Each disk has its own personal number. For details, please see the "Chapter 6: Disk ID" section of the N64 Disk Drive Programming Manual.

Whenever a MEDIUM_MAY_HAVE_CHANGED error is returned upon execution of any function, you must call the LeoReadDiskID function to check the disk ID. For details about the processing sequence, please the "Chapter 10: Error-Handling" section of the N64 Disk Drive Programming Manual.

Nothing needs to be set for the command block cmdBlock argument. When processing of this function ends, an error code is returned to the message queue mq. An error could arise, so the programmer needs to check this error code.

For more information about the errors that may be returned, their causes, and ways to deal with them, please see "Chapter 10: Error-Handling" of the N64 Disk Drive Programming Manual.

The return value is -1 if Leo Manager has not been created, and 0 if it has. Usually no check is necessary.


LEOCmd cmdBlock;
LEODiskID diskID;
u32 error;
LeoReadDiskID(&cmdBlock, &diskID, &diskQ);
osRecvMesg(&diskQ, (OSMesg *)&error, OS_MESG_BLOCK);

See Also


Revision History

04/30/1999 Changed Format