예제 #1
0
void CheckTimer (usf_state_t * state) {
	int32_t count;

	for (count = 0; count < MaxTimers; count++) {
		if (!state->Timers->Active[count]) { continue; }
		if (!(count == CompareTimer && state->Timers->NextTimer[count] == 0x7FFFFFFF)) {
			state->Timers->NextTimer[count] += state->Timers->Timer;
		}
	}
	state->Timers->CurrentTimerType = -1;
	state->Timers->Timer = 0x7FFFFFFF;
	for (count = 0; count < MaxTimers; count++) {
		if (!state->Timers->Active[count]) { continue; }
		if (state->Timers->NextTimer[count] >= state->Timers->Timer) { continue; }
		state->Timers->Timer = state->Timers->NextTimer[count];
		state->Timers->CurrentTimerType = count;
	}
	if (state->Timers->CurrentTimerType == -1) {
		DisplayError(state, "No active timers ???\nEmulation Stopped");
		StopEmulation(state);
	}
	for (count = 0; count < MaxTimers; count++) {
		if (!state->Timers->Active[count]) { continue; }
		if (!(count == CompareTimer && state->Timers->NextTimer[count] == 0x7FFFFFFF)) {
			state->Timers->NextTimer[count] -= state->Timers->Timer;
		}
	}

	if (state->Timers->NextTimer[CompareTimer] == 0x7FFFFFFF) {
		uint32_t NextCompare = COMPARE_REGISTER - COUNT_REGISTER;
		if ((NextCompare & 0x80000000) == 0 && NextCompare != 0x7FFFFFFF) {
			ChangeCompareTimer(state);
		}
	}
}
예제 #2
0
파일: main.c 프로젝트: 9a3eedi/Droidsound
void DisplayError (usf_state_t * state, char * Message, ...) {
	va_list ap;
    
    size_t len = strlen( state->error_message );
    
    if ( len )
        state->error_message[ len++ ] = '\n';

	va_start( ap, Message );
	vsprintf( state->error_message + len, Message, ap );
	va_end( ap );
    
    state->last_error = state->error_message;
    StopEmulation( state );

	//printf("Error: %s\n", Msg);
}
예제 #3
0
파일: plugin.c 프로젝트: 9a3eedi/Droidsound
void HleWarnMessage(void* user_defined, const char *message, ...)
{
    usf_state_t* state;
    va_list ap;
    size_t len;
    
    state = (usf_state_t*)user_defined;
    len = strlen( state->error_message );
    
    if ( len )
        state->error_message[ len++ ] = '\n';
    
    va_start( ap, message );
    vsprintf( state->error_message + len, message, ap );
    va_end( ap );
    
    state->last_error = state->error_message;
    StopEmulation( state );
}
예제 #4
0
bool TNekoDriver::RunDemoBin( const QString& filename )
{
    if (filename.isEmpty()) {
        //LoadDemoNor(QApplication::applicationDirPath() + "/mario.bin");
        LoadBROM(QApplication::applicationDirPath() + "/obj.bin");
        LoadFullNorFlash(QApplication::applicationDirPath() + "/cc800.fls");
        //fixedram0000[io00_bank_switch] = 2;
        //SwitchNorBank(2);
        //*(unsigned short*)&(pmemmap[mapE000][0x1FFC]) = 0x4018; // mario.bin
    } else {
        LoadDemoNor(filename);
        fixedram0000[io00_bank_switch] = 1;
        SwitchNorBank(1);
        *(unsigned short*)&(pmemmap[mapE000][0x1FFC]) = 0x4018; // mario.bin
    }
    //fEmulatorThread->start(QThread::InheritPriority);
    StopEmulation();
    StartEmulation();
    return true;
}
예제 #5
0
void InPermLoop ( usf_state_t * state ) {
	// *** Changed ***/
	if (state->CPU_Action->DoInterrupt) { return; }

	/* Interrupts enabled */
	if (( STATUS_REGISTER & STATUS_IE  ) == 0 ) { goto InterruptsDisabled; }
	if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) { goto InterruptsDisabled; }
	if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) { goto InterruptsDisabled; }
	if (( STATUS_REGISTER & 0xFF00) == 0) { goto InterruptsDisabled; }

	/* check sound playing */

	/* check RSP running */
	/* check RDP running */
	if (state->Timers->Timer >= 0) {
		COUNT_REGISTER += state->Timers->Timer + 1;
		state->Timers->Timer = -1;
	}
	return;

InterruptsDisabled:
	DisplayError(state, "Stuck in Permanent Loop");
	StopEmulation(state);
}