private bool CaptureLoadsXBOX() { bool isLoad = false; if ((timerStart.Ticks - liveSplitState.Run.Offset.Ticks) <= DateTime.Now.Ticks) { framesSinceLastManualSplit++; //Console.WriteLine("TIME NOW: {0}", DateTime.Now - lastTime); //Console.WriteLine("TIME DIFF START: {0}", DateTime.Now - lastTime); //lastTime = DateTime.Now; wasBlackScreen = isBlackScreen; //Capture image using the settings defined for the component Bitmap capture = settings.CaptureImage(); isBlackScreen = FeatureDetector.IsBlackScreen(ref capture, settings.blacklevel); BitmapToPixConverter btp = new BitmapToPixConverter(); //if (!testSaved) //{ // Bitmap jpntestbmp = new Bitmap("cutout.bmp"); // FeatureDetector.ClearBackgroundPostLoad(ref jpntestbmp); // jpntestbmp.Save("jpntest.bmp"); // Pix jpntest = btp.Convert(jpntestbmp); // using (var page = engine.Process(jpntest, PageSegMode.SingleChar)) // { // Console.WriteLine(page.GetText()); // } // testSaved = true; //} if (wasBlackScreen && !isBlackScreen) { //This could be a pre-load transition, start timing it transitionStart = DateTime.Now; waitOnLoad = true; } if (!isBlackScreen && !waitOnFadeIn && waitOnLoad) { specialLoad = FeatureDetector.ClearBackground(ref capture, settings.blacklevel); Pix img = btp.Convert(capture); string ResultText = ""; using (var page = engine.Process(img, PageSegMode.SingleChar)) { ResultText = page.GetText(); } int counter = 0; foreach (char c in expectedResultEng) { if (ResultText.Contains(c)) { counter++; } } if (counter > 5 && ResultText.Length == 8) { isLoading = true; isLoad = true; } } timer.CurrentState.IsGameTimePaused = isLoading || isBlackScreen; if (waitOnFadeIn && !specialLoad) { capture = settings.CaptureImagePostLoad(); int lowestBitLast = lowestBit; lowestBit = FeatureDetector.ClearBackgroundPostLoad(ref capture, settings.blacklevel); if (lowestBit == lowestBitLast && lowestBit != 0) { Pix img = btp.Convert(capture); using (var page = engine.Process(img, PageSegMode.SingleChar)) { string result = page.GetText(); if (result != "\n") { Console.WriteLine(page.GetText()); waitOnFadeIn = false; isLoading = false; lowestBit = 0; //the lifecounter coming in from the top takes a quarter of a second to stop TimeSpan quarter = new TimeSpan(2500000); timer.CurrentState.SetGameTime(timer.CurrentState.GameTimePauseTime + quarter); } } } } if (waitOnFadeIn && isBlackScreen && !specialLoad) { waitOnFadeIn = false; isLoading = false; } if (waitOnFadeIn && specialLoad && FeatureDetector.IsEndOfSpecialLoad(ref capture, settings.blacklevel)) { specialLoad = false; waitOnFadeIn = false; isLoading = false; } if (isLoading && waitOnLoad) { // This was a pre-load transition, subtract the gametime TimeSpan delta = (DateTime.Now - transitionStart); timer.CurrentState.SetGameTime(timer.CurrentState.GameTimePauseTime - delta); waitOnLoad = false; waitOnFadeIn = true; } } return(isLoad); }