public bool FrameAdvance(IController controller, bool render, bool renderSound = true) { Frame++; if (controller.IsPressed("Power")) { LibmGBA.BizReset(Core); // BizReset caused memorydomain pointers to change. WireMemoryDomainPointers(); } LibmGBA.BizSetTraceCallback(Core, Tracer.Enabled ? _tracecb : null); IsLagFrame = LibmGBA.BizAdvance( Core, LibmGBA.GetButtons(controller), render ? _videobuff : _dummyvideobuff, ref _nsamp, renderSound ? _soundbuff : _dummysoundbuff, RTCTime(), (short)controller.AxisValue("Tilt X"), (short)controller.AxisValue("Tilt Y"), (short)controller.AxisValue("Tilt Z"), (byte)(255 - controller.AxisValue("Light Sensor"))); if (IsLagFrame) { LagCount++; } // this should be called in hblank on the appropriate line, but until we implement that, just do it here _scanlinecb?.Invoke(); return(true); }