Exemplo n.º 1
0
inline jack_nframes_t JackClient::CycleWaitAux()
{
    if (!WaitSync()) {
        Error();   // Terminates the thread
    }
    CallSyncCallbackAux();
    return GetEngineControl()->fBufferSize;
}
void displayTime()
{
	static 	BOOL 	showSeparators;
	DisplayBufferInfo	di;

	CString timeStr = systemTime().longCString();

	WaitSync();
	GetDisplayBufferInfo(&di);
	MoveToXY(di.screenwidth - 7, di.screenheight);
	setTextAttr(setupInfo.statusTextForeColor, setupInfo.statusTextBackColor);

	showSeparators = !showSeparators;
	PCHAR ts = (PCHAR)(CPCHAR)timeStr;

	ts[5] = '\0';

	if (!showSeparators)
		{
		ts[2] = ' ';
		}

	if (*ts == '0')
		*ts = ' ';

	tprintf("%s%s", ts, &ts[8]);

	if (messageTime > 0 && --messageTime == 0)
		{
		messageTime = gMessageClearTime;
		displayStdStatusLine();
		}

	MoveToXY(di.x, di.y);
	ClearSync();

	// check if the current file has changed
	if (gCurrFile != -1 && App::GetViewedFiles()[gCurrFile]->fileHasChanged())
		{
		WaitSync();
		GetDisplayBufferInfo(&di);
		App::GetViewedFiles()[gCurrFile]->displayFileInfo();
		MoveToXY(di.x, di.y);
		ClearSync();
		}
}
Exemplo n.º 3
0
bool
SharedSurface_ANGLEShareHandle::WaitSync_ContentThread_Impl()
{
    if (mFence) {
        mGL->MakeCurrent();
        mGL->fFinishFence(mFence);
        return true;
    }

    return WaitSync();
}
Exemplo n.º 4
0
void JackClient::DummyCycle()
{
    WaitSync();
    SignalSync();
}
Exemplo n.º 5
0
EXPORT_C_(void) s2r_replay(HWND hwnd, HINSTANCE hinst, LPSTR filename, int nCmdShow)
{
#ifndef ENABLE_NEW_IOPDMA_SPU2
	int events=0;

	Running = true;

#ifdef WIN32
	AllocConsole();
	SetConsoleCtrlHandler(HandlerRoutine, TRUE);
	
	conprintf("Playing %s file on %x...",filename,hwnd);

#endif

	// load file
	FILE *file=fopen(filename,"rb");

	if(!file)
	{
		conprintf("Could not open the replay file.");
		return;
	}
	// if successful, init the plugin

#define TryRead(dest,size,count,file) if(fread(dest,size,count,file)<count) { conprintf("Error reading from file.");  goto Finish;  /* Need to exit the while() loop and maybe also the switch */ }

	TryRead(&CurrentIOPCycle,4,1,file);
	
	replay_mode=true;

	InitWaitSync(); // Initialize the WaitSync stuff

	SPU2init();
	SPU2irqCallback(dummy1,dummy4,dummy7);
	SPU2setClockPtr(&CurrentIOPCycle);
	SPU2open(&hwnd);

	CurrentIOPCycle=0;

	SPU2async(0);

	while(!feof(file) && Running)
	{
		u32 ccycle=0;
		u32 evid=0;
		u32 sval=0;
		u32 tval=0;

		TryRead(&ccycle,4,1,file);
		TryRead(&sval,4,1,file);

		evid=sval>>29;
		sval&=0x1FFFFFFF;

		u32 TargetCycle = ccycle * 768;

		while(TargetCycle > CurrentIOPCycle)
		{
			u32 delta = WaitSync(TargetCycle);
			SPU2async(delta);
		}
		
		switch(evid)
		{
		case 0:
			SPU2read(sval);
			break;
		case 1:
			TryRead(&tval,2,1,file);
			SPU2write(sval,tval);
			break;
		case 2:
			TryRead(dmabuffer,sval,2,file);
			SPU2writeDMA4Mem(dmabuffer,sval);
			break;
		case 3:
			TryRead(dmabuffer,sval,2,file);
			SPU2writeDMA7Mem(dmabuffer,sval);
			break;
		default:
			// not implemented
			return;
			break;
		}
		events++;
	}

Finish:

	//shutdown
	SPU2close();
	SPU2shutdown();
	fclose(file);

	conprintf("Finished playing %s file (%d cycles, %d events).",filename,CurrentIOPCycle,events);

#ifdef WIN32
	FreeConsole();
#endif

	replay_mode=false;
#endif
}