void emulateLua() { pcejin.isLagFrame = true; S9xUpdateJoypadButtons(); pcejin.pads[0] = joypads [0]; pcejin.pads[1] = joypads [1]; pcejin.pads[2] = joypads [2]; pcejin.pads[3] = joypads [3]; pcejin.pads[4] = joypads [4]; VTLineWidths[VTBackBuffer][0].w = ~0; memset(&espec, 0, sizeof(EmulateSpecStruct)); espec.pixels = (uint32 *)VTBuffer[VTBackBuffer]; espec.LineWidths = (MDFN_Rect *)VTLineWidths[VTBackBuffer]; espec.SoundBuf = &sound; espec.SoundBufSize = &ssize; espec.soundmultiplier = 1; MOV_AddInputState(); MDFNGameInfo->Emulate(&espec); if (pcejin.isLagFrame) pcejin.lagFrameCounter++; }
void emulate(){ if(!pcejin.started || !pcejin.romLoaded) return; if (startPaused) { pcejin.pause(); startPaused = false; //This should never be set true except from ParseCmdLine! } pcejin.isLagFrame = true; S9xUpdateJoypadButtons(); pcejin.pads[0] = joypads [0]; pcejin.pads[1] = joypads [1]; pcejin.pads[2] = joypads [2]; pcejin.pads[3] = joypads [3]; pcejin.pads[4] = joypads [4]; VTLineWidths[VTBackBuffer][0].w = ~0; memset(&espec, 0, sizeof(EmulateSpecStruct)); espec.pixels = (uint32 *)VTBuffer[VTBackBuffer]; espec.LineWidths = (MDFN_Rect *)VTLineWidths[VTBackBuffer]; espec.SoundBuf = &sound; espec.SoundBufSize = &ssize; espec.soundmultiplier = 1; if(pcejin.fastForward && currFrameCounter%30 && !DRV_AviIsRecording()) espec.skip = 1; else espec.skip = 0; CallRegisteredLuaFunctions(LUACALL_BEFOREEMULATION); MOV_AddInputState(); MDFNGameInfo->Emulate(&espec); CallRegisteredLuaFunctions(LUACALL_AFTEREMULATION); UpdateToolWindows(); soundDriver->write((u16*)*espec.SoundBuf, *espec.SoundBufSize); DRV_AviSoundUpdate(*espec.SoundBuf, *espec.SoundBufSize); DRV_AviVideoUpdate((uint16*)espec.pixels, &espec); if (pcejin.frameAdvance) { pcejin.frameAdvance = false; pcejin.started = false; } if (pcejin.isLagFrame) pcejin.lagFrameCounter++; if(pcejin.slow && !pcejin.fastForward) while(SpeedThrottle()) { } //adelikat: For commandline loadstate, I know this is a hacky place to do it, but 1 frame needs to be emulated before loadstates are possible if (stateToLoad != -1) { HK_StateLoadSlot(stateToLoad); stateToLoad = -1; //Never set this other than from ParseCmdLine } }
void emulate(){ /* //NEWTODO fix these pcejin.pads[0] = joypads [0]; vbjinEmulate(); */ if(!pcejin.started || !pcejin.romLoaded) return; if (startPaused) { pcejin.pause(); startPaused = false; //This should never be set true except from ParseCmdLine! } pcejin.isLagFrame = true; S9xUpdateJoypadButtons(); pcejin.pads[0] = joypads [0]; // pcejin.pads[1] = joypads [1]; // pcejin.pads[2] = joypads [2]; // pcejin.pads[3] = joypads [3]; // pcejin.pads[4] = joypads [4]; FCEUMOV_AddInputState(); VTLineWidths[VTBackBuffer][0].w = ~0; memset(&espec, 0, sizeof(EmulateSpecStruct)); espec.surface = (MDFN_Surface *)VTBuffer[VTBackBuffer]; //espec.surface->pixels = (uint32 *)VTBuffer[VTBackBuffer]; espec.LineWidths = (MDFN_Rect *)VTLineWidths[VTBackBuffer]; //espec.SoundBuf = sound; //espec.SoundBufSize = ssize; espec.soundmultiplier = 1; espec.SoundBuf = EmuModBuffer; espec.SoundBufMaxSize = EmuModBufferSize; if(pcejin.fastForward && currFrameCounter%30 && !DRV_AviIsRecording()) espec.skip = 1; else espec.skip = 0; CallRegisteredLuaFunctions(LUACALL_BEFOREEMULATION); MDFNGameInfo->Emulate(&espec); CallRegisteredLuaFunctions(LUACALL_AFTEREMULATION); UpdateToolWindows(); //NEWTODO soundDriver->write((u16*)espec.SoundBuf, espec.SoundBufSize); DRV_AviSoundUpdate((u16*)espec.SoundBuf, espec.SoundBufSize); DRV_AviVideoUpdate((uint16*)espec.surface->pixels, &espec); // espec.SoundBufSize is a count of the 16 bit channel pairs. // Casting to uint32* cycles through all the data accurately. DRV_WriteWaveData((uint32*)espec.SoundBuf, espec.SoundBufSize); if (pcejin.frameAdvance) { pcejin.frameAdvance = false; pcejin.started = false; } if (pcejin.isLagFrame) pcejin.lagFrameCounter++; if(!pcejin.fastForward)//pcejin.slow && while(SpeedThrottle()) { } //adelikat: For commandline loadstate, I know this is a hacky place to do it, but 1 frame needs to be emulated before loadstates are possible if (stateToLoad != -1) { HK_StateLoadSlot(stateToLoad); stateToLoad = -1; //Never set this other than from ParseCmdLine } }