コード例 #1
0
ファイル: Cpu.c プロジェクト: TwitchPlaysPokemon/project64
__declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles ) {
	extern BOOL AudioHle, GraphicsHle;
	DWORD TaskType = *(DWORD*)(RSPInfo.DMEM + 0xFC0);
	
	if (TaskType == 1 && GraphicsHle) {
		if (RSPInfo.ProcessDList != NULL) {
			RSPInfo.ProcessDList();
		}
		*RSPInfo.SP_STATUS_REG |= (0x0203 );
		if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
			*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
			RSPInfo.CheckInterrupts();
		}

		*RSPInfo.DPC_STATUS_REG &= ~0x0002;
		return Cycles;
	} else if (TaskType == 2 && AudioHle) {
		if (RSPInfo.ProcessAList != NULL) {
			RSPInfo.ProcessAList();
		}
		*RSPInfo.SP_STATUS_REG |= (0x0203 );
		if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
			*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
			RSPInfo.CheckInterrupts();
		}
		return Cycles;
	} else if (TaskType == 7) {
		RSPInfo.ShowCFB();		
	}

	/* 
	*RSPInfo.SP_STATUS_REG |= (0x0203 );
	if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
		*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
		RSPInfo.CheckInterrupts();
	}
	return Cycles;
	*/

#if !defined(EXTERNAL_RELEASE)
	if (Profiling) {
		StopTimer();
		if (!IndvidualBlock) { StartTimer("RSP Running"); }
	}
#endif

	WaitForSingleObjectEx(hMutex, INFINITE, FALSE);
	switch (CPUCore) {
	case RecompilerCPU:
		RunRecompilerCPU(Cycles);
		break;
	case InterpreterCPU:
		RunInterpreterCPU(Cycles);
		break;
	}
	ReleaseMutex(hMutex);

#if !defined(EXTERNAL_RELEASE)
	if (Profiling) {
		StopTimer();
		StartTimer("r4300i code");
	}
#endif

	return Cycles;
}
コード例 #2
0
__declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles ) {
    extern BOOL AudioHle, GraphicsHle;
    DWORD TaskType = *(DWORD*)(RSPInfo.DMEM + 0xFC0);

    /*	if (*RSPInfo.SP_STATUS_REG & SP_STATUS_SIG0) {
    		*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_SIG0;
    		*RSPInfo.MI_INTR_REG |= MI_INTR_SP;
    		RSPInfo.CheckInterrupts();
    		return Cycles;
    	}
    */
    if (TaskType == 1 && GraphicsHle && *(DWORD*)(RSPInfo.DMEM + 0x0ff0) != 0) {
        if (RSPInfo.ProcessDList != NULL) {
            RSPInfo.ProcessDList();
        }
        *RSPInfo.SP_STATUS_REG |= (0x0203 );
        if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
            *RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
            RSPInfo.CheckInterrupts();
        }

        *RSPInfo.DPC_STATUS_REG &= ~0x0002;
        return Cycles;
    } else if (TaskType == 2 && AudioHle) {
        if (RSPInfo.ProcessAList != NULL) {
            RSPInfo.ProcessAList();
        }
        *RSPInfo.SP_STATUS_REG |= (0x0203 );
        if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
            *RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
            RSPInfo.CheckInterrupts();
        }
        return Cycles;
    } else if (TaskType == 7) {
        RSPInfo.ShowCFB();
    }

    Compiler.bAudioUcode = (TaskType == 2) ? TRUE : FALSE;

    /*
    	*RSPInfo.SP_STATUS_REG |= (0x0203 );
    	if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
    		*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
    		RSPInfo.CheckInterrupts();
    	}
    	//return Cycles;
    */

    if (Profiling && !IndvidualBlock) {
        StartTimer(Timer_RSP_Running);
    }

    WaitForSingleObjectEx(hMutex, 1000 * 100, FALSE);

    if (BreakOnStart)
    {
        Enter_RSP_Commands_Window();
    }
    RSP_MfStatusCount = 0;

    switch (CPUCore) {
    case RecompilerCPU:
        RunRecompilerCPU(Cycles);
        break;
    case InterpreterCPU:
        RunInterpreterCPU(Cycles);
        break;
    }
    ReleaseMutex(hMutex);

    if (Profiling && !IndvidualBlock) {
        StartTimer(Timer_R4300_Running);
    }

    return Cycles;
}