AnFwDisplayBackgroundUpdate

INT64 __fastcall AnFwDisplayBackgroundUpdate(UINT8 Enable){
  INT64 result; 
  UINT64 v2; 
  ULONGLONG v3; 
  __int64 v4; 
  ULONGLONG pullResult; 
  unsigned __int64 v6; 
  pullResult = 0i64;
  v6 = 0i64;
  if( (dword_140C13310 & 0x4000000) == 0 )
    return 0i64;
  if( !Enable )
  {
    AnFwDisableBackgroundUpdateTimer();
    return 0i64;
  }
  if( byte_140CF4D20 )
    return 3221225473i64;
  v2 = ((__int64(__fastcall *)(unsigned __int64 *))off_140C007F0)(&v6);
  LODWORD(result) = RtlULongLongMult(v2, 0x3E8ui64, &pullResult);
  if( (int)result >= 0 )
  {
    v3 = pullResult / v6;
    if( qword_140C133B0 + v3 < v3 )
      return 3221225621i64;
    v4 = v3 + qword_140C133B0;
    DbgPrintEx(0x65u, 0, "BGFX Display Ready Time(ms): %d\n", (unsigned int)v3);
    DbgPrintEx(0x65u, 0, "BGFX Secondary Logo Bitmap Display Time GOAL(ms): %d\n", (unsigned int)v4);
    if( (unsigned __int64)qword_140C133B0 >= 0x64 )
    {
      qword_140C133B0 = v4;
      KeInitializeTimerEx((PKTIMER)qword_140CF93E0, NotificationTimer);
      KeInitializeDpc(&stru_140CF9420, AnFwpBackgroundUpdateTimer, 0i64);
      if( KeSetCoalescableTimer((PKTIMER)qword_140CF93E0, 0i64, 0x64u, 0, &stru_140CF9420) )
      {
        KeCancelTimer((PKTIMER)qword_140CF93E0);
        byte_140CF4D20 = 0;
LABEL_15:
        LODWORD(result) = BgpClearScreen((unsigned int)Color);
        return result;
      }
      byte_140CF4D20 = 1;
      result = 0i64;
    }
    else
    {
      BgpClearScreen((unsigned int)Color);
      DbgPrintEx(0x65u, 0, "BGFX Secondary Logo Bitmap Display Time(ms): %d\n", (unsigned int)v3);
      result = BgpGxDrawBitmapImage(qword_140C13358, (unsigned __int64)&qword_140C1336C);
    }
    if( (int)result < 0 )
      goto LABEL_15;
  }
  return result;
}

Referenced by:

BgDisplayBackgroundUpdate