/*
	Gdfs Sample
	
	COPYRIGHT (C) SEGA ENTERSRISES,LTD.
	
	open test
	
	1998.10.27
*/

#include <shinobi.h>


static Sint32 Abort;


void errfunc(void *obj, Sint32 err)
{
	if (err == GDD_ERR_TRAYOPEND || err == GDD_ERR_UNITATTENT) {
		Abort = 1;
 	}
}


/*** main routine ***/


void njUserInit(void)
{
	njSetBorderColor( 0 ) ;
	sbInitSystem( NJD_RESOLUTION_320x240_NTSCNI, NJD_FRAMEBUFFER_MODE_RGB565, 1 );
	njInitVertexBuffer( 100000, 0, 100000, 0, 0 );
	njInitPrint(NULL, 0, 0);
	
	njSetBackColor(0x00000000,0x00000000,0x000000FF);
	
	Abort = 0;
	
	gdFsEntryErrFuncAll(errfunc, (void *) 0);
}



Sint32 njUserMain(void)
{
	static Sint32 vcnt = 0;
	Sint32 dstat;
	
	vcnt++;
	njPrintC(NJM_LOCATION(2,2), "GDFS OPEN TEST");
	
	/* check the drive status */
	dstat = gdFsGetDrvStat();
	if (dstat == GDD_DRVSTAT_OPEN || dstat == GDD_DRVSTAT_BUSY) {
		gdFsReqDrvStat();
	}
	
	if (Abort) return NJD_USER_EXIT;
	return NJD_USER_CONTINUE;
}



void njUserExit(void)
{
	njExitPrint();
	sbExitSystem();
	syBtExit();
}

/* eof */
