コード例 #1
0
ファイル: Memory.cpp プロジェクト: mfitz21/pcsx2-rr
mem16_t __fastcall _ext_memRead16(u32 mem)
{
	switch (p)
	{
		case 1: // hwm
			return hwRead16(mem);
		case 2: // psh
			return psxHwRead16(mem);
		case 4: // b80
			MEM_LOG("b800000 Memory read16 address %x\n", mem);
			return 0;
		case 5: // ba0
			return ba0R16(mem);
		case 6: // gsm
			return gsRead16(mem);

		case 7: // dev9
		{
			mem16_t retval = DEV9read16(mem & ~0xa4000000);
			SysPrintf("DEV9 read16 %8.8lx: %4.4lx\n", mem & ~0xa4000000, retval);
			return retval;
		}

		case 8: // spu2
			return SPU2read(mem);
	}
	MEM_LOG("Unknown Memory read16  from address %8.8x\n", mem);
	cpuTlbMissR(mem, cpuRegs.branch);
	return 0;
}
コード例 #2
0
ファイル: Memory.cpp プロジェクト: madnessw/thesnow
static mem16_t __fastcall _ext_memRead16(u32 mem)
{
	switch (p)
	{
		case 4: // b80
			MEM_LOG("b800000 Memory read16 address %x", mem);
			return 0;
		case 5: // ba0
			return ba0R16(mem);
		case 6: // gsm
			return gsRead16(mem);

		case 7: // dev9
		{
			mem16_t retval = DEV9read16(mem & ~0xa4000000);
			Console.WriteLn("DEV9 read16 %8.8lx: %4.4lx", mem & ~0xa4000000, retval);
			return retval;
		}

		case 8: // spu2
			return SPU2read(mem);
	}
	MEM_LOG("Unknown Memory read16  from address %8.8x", mem);
	cpuTlbMissR(mem, cpuRegs.branch);
	return 0;
}
コード例 #3
0
ファイル: IopMemory.cpp プロジェクト: ferraristealer/R3000air
static mem16_t __fastcall _spu2_read16( u32 addr )				{ return SPU2read( addr ); }
コード例 #4
0
ファイル: Spu2replay.cpp プロジェクト: madnessw/thesnow
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
}