INT32 Cps1Frame() { INT32 nDisplayEnd, nNext, i; if (CpsReset) { DrvReset(); } SekNewFrame(); if (Cps1Qs == 1) { QsndNewFrame(); } else { if (!Cps1DisablePSnd) { ZetOpen(0); PsndNewFrame(); } } if (CpsRunFrameStartCallbackFunction) { CpsRunFrameStartCallbackFunction(); } nCpsCycles = (INT32)((INT64)nCPS68KClockspeed * nBurnCPUSpeedAdjust >> 8); CpsRwGetInp(); // Update the input port values nDisplayEnd = (nCpsCycles * (nFirstLine + 224)) / nCpsNumScanlines; // Account for VBlank SekOpen(0); SekIdle(nCpsCyclesExtra); SekRun(nCpsCycles * nFirstLine / nCpsNumScanlines); // run 68K for the first few lines CpsObjGet(); // Get objects for (i = 0; i < 4; i++) { nNext = ((i + 1) * nCpsCycles) >> 2; // find out next cycle count to run to if (i == 2 && CpsRunFrameMiddleCallbackFunction) { CpsRunFrameMiddleCallbackFunction(); } if (SekTotalCycles() < nDisplayEnd && nNext > nDisplayEnd) { SekRun(nNext - nDisplayEnd); // run 68K memcpy(CpsSaveReg[0], CpsReg, 0x100); // Registers correct now SekSetIRQLine(Cps1VBlankIRQLine, SEK_IRQSTATUS_AUTO); // Trigger VBlank interrupt } SekRun(nNext - SekTotalCycles()); // run 68K // if (pBurnDraw) { // CpsDraw(); // Draw frame // } } //if (pBurnDraw) { CpsDraw(); // Draw frame if (Cps1Qs == 1) { QsndEndFrame(); } else { if (!Cps1DisablePSnd) { PsndSyncZ80(nCpsZ80Cycles); PsmUpdate(nBurnSoundLen); ZetClose(); } } if (CpsRunFrameEndCallbackFunction) { CpsRunFrameEndCallbackFunction(); } nCpsCyclesExtra = SekTotalCycles() - nCpsCycles; SekClose(); return 0; }
INT32 Cps1Frame() { INT32 nDisplayEnd, nNext, i; if (CpsReset) { DrvReset(); } SekNewFrame(); if (Cps1Qs == 1) { QsndNewFrame(); } else { if (!Cps1DisablePSnd) { ZetOpen(0); PsndNewFrame(); } } if (CpsRunFrameStartCallbackFunction) { CpsRunFrameStartCallbackFunction(); } nCpsCycles = (INT32)((INT64)nCPS68KClockspeed * nBurnCPUSpeedAdjust >> 8); CpsRwGetInp(); // Update the input port values //HACK for 'follow finger' touchpad mode if (glob_ffingeron&&virtual_stick_on) { if ( wait_control==0 ) PatchMemory68KFFinger(); else wait_control--; } //8 bits => 0/1: touch off/on switch // 1/2: posX // 2/4: posY // 3/8: input0 // 4/16: input1 // 5/32: ... // 6/64: // 7/128: if ((glob_replay_mode==REPLAY_RECORD_MODE)&&(glob_replay_data_index<MAX_REPLAY_DATA_BYTES-MAX_REPLAY_FRAME_SIZE)) { if (glob_replay_flag) { //STORE FRAME_INDEX glob_replay_data_stream[glob_replay_data_index++]=glob_framecpt&0xFF; //frame index glob_replay_data_stream[glob_replay_data_index++]=(glob_framecpt>>8)&0xFF; //frame index glob_replay_data_stream[glob_replay_data_index++]=(glob_framecpt>>16)&0xFF; //frame index glob_replay_data_stream[glob_replay_data_index++]=(glob_framecpt>>24)&0xFF; //frame index //STORE FLAG glob_replay_data_stream[glob_replay_data_index++]=glob_replay_flag; if (glob_replay_flag&REPLAY_FLAG_POSX) { //MEMX HAS CHANGED glob_replay_data_stream[glob_replay_data_index++]=glob_replay_last_dx16&0xFF; glob_replay_data_stream[glob_replay_data_index++]=(glob_replay_last_dx16>>8)&0xFF; } if (glob_replay_flag&REPLAY_FLAG_POSY) { //MEMY HAS CHANGED glob_replay_data_stream[glob_replay_data_index++]=glob_replay_last_dy16&0xFF; glob_replay_data_stream[glob_replay_data_index++]=(glob_replay_last_dy16>>8)&0xFF; } if (glob_replay_flag&REPLAY_FLAG_IN0) { //INPUT0 HAS CHANGED glob_replay_data_stream[glob_replay_data_index++]=last_DrvInput[0]; } if (glob_replay_flag&REPLAY_FLAG_IN1) { //INPUT1 HAS CHANGED glob_replay_data_stream[glob_replay_data_index++]=last_DrvInput[1]; } if (glob_replay_flag&REPLAY_FLAG_IN2) { //INPUT2 HAS CHANGED glob_replay_data_stream[glob_replay_data_index++]=last_DrvInput[2]; } if (glob_replay_flag&REPLAY_FLAG_IN3) { //INPUT3 HAS CHANGED glob_replay_data_stream[glob_replay_data_index++]=last_DrvInput[3]; } if (glob_replay_flag&REPLAY_FLAG_IN4) { //INPUT4 HAS CHANGED glob_replay_data_stream[glob_replay_data_index++]=last_DrvInput[4]; } }