static void frontend_ps2_deinit(void *data) { (void)data; #if defined(HAVE_FILE_LOGGER) verbosity_disable(); command_event(CMD_EVENT_LOG_FILE_DEINIT, NULL); #endif _free_ps2_io(); CDVD_Stop(); padEnd(); audsrv_quit(); fileXioExit(); Exit(0); }
void PadDeinitPads(void) { padPortClose(0, 0); padPortClose(1, 0); padEnd(); }
s32 padInit(void * ee_addr) { iop_thread_t thread; int intr_state; iop_event_t event; if(padman_init == 1) { M_PRINTF("Refresh request from EE\n."); padEnd(); } vblankData.padEnd = 0; vblankData.init = 0; vblankData.stopTransfer = 1; pad_ee_addr = ee_addr; pad_port = 0; pad_slot = 0; mainThreadCount2 = 0; pad_portdata[0] = 0; pad_portdata[1] = 0; sif_buffer[0] = 0; sio2cmdReset(); sio2cmdInitFindPads(); sio2cmdInitMouse(); sio2cmdInitNegicon(); sio2cmdInitKonamiGun(); sio2cmdInitDigital(); sio2cmdInitJoystick(); sio2cmdInitNamcoGun(); sio2cmdInitAnalog(); sio2cmdInitJogcon(); sio2cmdInitConfig(); pdReset(); openSlots[0] = 0; openSlots[1] = 0; event.attr = EA_MULTI; event.bits = 0; vblankData.eventflag = CreateEventFlag(&event); if( vblankData.eventflag == 0) { M_PRINTF("padInit: CreateEventFlag failed (%d).\n", vblankData.eventflag); return 0; } thread.attr = TH_C; thread.thread = &TransferThread; thread.stacksize = 0x800; thread.priority = thpri_hi; vblankData.tid_2 = CreateThread(&thread); if(vblankData.tid_2 == 0) { M_PRINTF("padInit: CreateThread TransferThread failed (%d)\n.", vblankData.tid_2); return 0; } StartThread(vblankData.tid_2, NULL); thread.attr = TH_C; thread.thread = MainThread; thread.stacksize = 0x1000; thread.priority = thpri_lo; vblankData.tid_1 = CreateThread(&thread); if(vblankData.tid_1 == 0) { M_PRINTF("padInit: CreateThread MainThread failed (%d)\n.", vblankData.tid_1); return 0; } StartThread(vblankData.tid_1, NULL); CpuSuspendIntr(&intr_state); RegisterVblankHandler(0, 16, &VblankStart, (void*)&vblankData); RegisterVblankHandler(1, 16, &VblankEnd, (void*)&vblankData); CpuResumeIntr(intr_state); //Original BUG: was originally a call to CpuEnableIntr with intr_state as an argument vblankData.init = 1; padman_init = 1; return 1; }
s32 padInit(void * ee_addr) { iop_event_t event; if(freepad_init == 1) { M_PRINTF("Refresh request from EE\n."); padEnd(); } vblankData.padEnd = 0; vblankData.init = 0; vblankData.stopTransfer = 0; pad_ee_addr = ee_addr; pad_port = 0; pad_slot = 0; mainThreadCount2 = 0; pad_portdata[0] = 0; pad_portdata[1] = 0; sif_buffer[0] = 0; sio2cmdReset(); sio2cmdInitFindPads(); sio2cmdInitMouse(); sio2cmdInitNegicon(); sio2cmdInitKonamiGun(); sio2cmdInitDigital(); sio2cmdInitJoystick(); sio2cmdInitNamcoGun(); sio2cmdInitAnalog(); sio2cmdInitJogcon(); sio2cmdInitConfig(); pdReset(); openSlots[0] = 0; openSlots[1] = 0; event.attr = 2; event.bits = 0; vblankData.eventflag = CreateEventFlag(&event); if( vblankData.eventflag == 0) M_PRINTF("padInit: CreateEventFlag failed (%i).\n", (int)vblankData.eventflag); if(vblankData.eventflag != 0) { iop_thread_t thread; int intr_state; thread.attr = TH_C; thread.thread = TransferThread; thread.stacksize = 0x800; thread.priority = 20; vblankData.tid_2 = CreateThread(&thread); if(vblankData.tid_2 == 0) { M_PRINTF("padInit: CreateThread TransferThread failed (%i)\n.", (int)vblankData.tid_2); return 0; } StartThread(vblankData.tid_2, 0); thread.attr = TH_C; thread.thread = MainThread; thread.stacksize = 0x1000; thread.priority = 46; vblankData.tid_1 = CreateThread(&thread); if(vblankData.tid_1 == 0) { M_PRINTF("padInit: CreateThread MainThread failed (%i)\n.", (int)vblankData.tid_1); return 0; } StartThread(vblankData.tid_1, 0); CpuSuspendIntr(&intr_state); RegisterVblankHandler(0, 16, (void*)VblankStart, (void*)&vblankData); RegisterVblankHandler(1, 16, (void*)VblankEnd, (void*)&vblankData); CpuResumeIntr(intr_state); vblankData.init = 1; freepad_init = 1; D_PRINTF("padInit: Success\n"); return 1; } D_PRINTF("padInit: Failed\n"); return 0; }