コード例 #1
0
ファイル: demo.cpp プロジェクト: thug1src/thug
void prepare_to_exit()
{
	printf ("******  Exiting THPS Demo *****\n");

	//Nx::CEngine::sSuspendEngine();		// turn off Nx engine interrupts
	NxPs2::SuspendEngine();				// 
	
	Sfx::CSfxManager* sfx_manager =  Sfx::CSfxManager::Instance();
	sfx_manager->PauseSounds( );
	if (!Config::CD())
	{
		printf ("Re-initializing the CD/DVD drive\n");
		// if we did not come from a CD, then we need to initilaize the CD here
		// so we can test exiting back to the bootstrap program
	    sceCdInit(SCECdINIT);
	    sceCdMmode(SCECdDVD);
	    sceCdDiskReady(0);
	}
	else
	{
		printf ("Stopping streaming etc, on CD/DVD drive\n");
		Pcm::StopStreams(  );
		Pcm::StopMusic(  );
		sceCdStStop();				// also stop streaming....	   Yes!!
		sceCdStop();				// stop Cd
		sceCdSync(0);				// wait for commands to execute
		sceCdDiskReady(0);		   	// wait for Cd to be ready again
	}	

	scePadEnd();				// Another Sony reccomendation (from James Wang, newgroup post, 6/11/2002)

}
コード例 #2
0
ファイル: libcdvd.c プロジェクト: przemekh/ps2sdk
s32 sceCdSearchFile(sceCdlFILE * file, const char *name)
{
	s32 i;

	sceCdSemaInit();
	if (PollSema(nCmdSemaId) != nCmdSemaId)
		return 0;
	nCmdNum = CD_SERVER_SEARCHFILE;
	ReferThreadStatus(sceCdThreadId, &sceCdThreadParam);
	if (sceCdSync(1)) {
		SignalSema(nCmdSemaId);
		return 0;
	}
	SifInitRpc(0);
	if (bindSearchFile < 0) {
		while (1) {
			if (SifBindRpc(&clientSearchFile, CD_SERVER_SEARCHFILE, 0) < 0) {
				if (sceCdDebug > 0)
					printf("libsceCdvd bind err sceCdSearchFile\n");
			}
			if (clientSearchFile.server != 0)
				break;

			i = 0x10000;
			while (i--);
		}
		bindSearchFile = 0;
	}

	strncpy(searchFileSendBuff.name, name, 255);
	searchFileSendBuff.name[255] = '\0';
	searchFileSendBuff.dest = &searchFileSendBuff;

	if (sceCdDebug > 0)
		printf("ee call cmd search %s\n", searchFileSendBuff.name);
	if (SifCallRpc(&clientSearchFile, 0, 0, &searchFileSendBuff, sizeof(SearchFilePkt), nCmdRecvBuff, 4, 0, 0) < 0) {
		SignalSema(nCmdSemaId);
		return 0;
	}

	memcpy(file, UNCACHED_SEG(&searchFileSendBuff), 32);

	if (sceCdDebug > 0) {
		printf("search name %s\n", file->name);
		printf("search size %d\n", file->size);
		printf("search loc lnn %d\n", file->lsn);
		printf("search loc date %02X %02X %02X %02X %02X %02X %02X %02X\n",
		       file->date[0], file->date[1], file->date[2], file->date[3],
		       file->date[4], file->date[5], file->date[6], file->date[7]);
		printf("search loc date %02d %02d %02d %02d %02d %02d %02d %02d\n",
		       file->date[0], file->date[1], file->date[2], file->date[3],
		       file->date[4], file->date[5], file->date[6], file->date[7]);
	}

	SignalSema(nCmdSemaId);
//	return 1;
	return *(s32*)UNCACHED_SEG(nCmdRecvBuff);
}
コード例 #3
0
ファイル: libcdvd.c プロジェクト: przemekh/ps2sdk
CdCBFunc sceCdCallback(CdCBFunc newFunc)
{
	CdCBFunc oldFunc = sceCdCallbackFunc;

	if (sceCdSync(1))
		return 0;

	sceCdCallbackFunc = newFunc;
	return oldFunc;
}