dword FIS_vPlaybackPaused (void) { dword *p; static dword vPlaybackPaused = 0; if (!vPlaybackPaused) { if (!LibInitialized) InitTAPex(); if (!LibInitialized) return 0; p = (dword*)FindInstructionSequence ("0019ce00 0019cfc2 0000a025 333000ff 0c05676c 24040001 16c00003 24180001 00008025 24180001 56d8000c a38084d0 3c1e81a0 93de1ce0", "ffe007ff ffe007ff fc0007ff fc00ffff fc000000 ffffffff fc1f0000 ffe0ffff fc0007ff ffe0ffff fc000000 ffff0000 ffe00000 fc000000", 0x800c0000, 0x80180000, 11, FALSE); if (!p) p = (dword*)FindInstructionSequence ("0019ce00 0c054ced 0019afc2 8faf0048 55e00003 8fb90048 0000a825 8fb90048 24180001 5738000c a38084dc 3c1681b7 92d6aff0", "ffe007ff fc000000 ffe007ff ffc00000 fc000000 ffc00000 fc0007ff ffc00000 ffe00001 fc000000 ffff0000 ffe00000 fc000000", 0x800c0000, 0x80180000, 10, FALSE); if (!p) return 0; vPlaybackPaused = FWgp + (short)(*p & 0xffff); } return vPlaybackPaused; }
dword FIS_vOSDMap (void) { dword *p; static dword vOSDMap = 0; if (!vOSDMap) { if (!LibInitialized) InitTAPex(); if (!LibInitialized) return 0; p = (dword*)FindInstructionSequence //("0000c012 3332ffff 33d67fff 3c118033 0218c021 93a40067 2631d574 0016c900", // "ffff07ff fc00ffff fc00ffff ffe00000 fc0007ff ffe00000 fc000000 ffe007ff", //(c)R2-D2 :-) ("33d98000 26108bd0 0000c012 3332ffff 33d67fff 3c118033 0218c021", "fc00ffff ffe00000 ffff07ff fc00ffff fc00ffff ffe00000 fc0007ff", 0x80090000, 0x80280000, 3, FALSE); //The TF6xxx series seems to use a completely different mechanism. if (!p) return 0; vOSDMap = (p[0] << 16) + (short)(p[3] & 0xffff); } return vOSDMap; }
bool EnqueueEvent (word Event, dword Parameter) { if (!LibInitialized) InitTAPex(); if (!LibInitialized) return FALSE; return (CallFirmware ((dword) EnqueueEventAddress, Event, Parameter, 0, 0) != 0); }
//--------------------------------------- HDD_TAP_SendEvent -------------------------------- // dword HDD_TAP_SendEvent (dword TAPID, bool AllowParamInterception, word event, dword param1, dword param2) { dword Ret, i; if (!LibInitialized) InitTAPex(); if (!LibInitialized) return 0; if (TAPID) { int Index = HDD_TAP_GetIndexByID (TAPID); if (Index < 0 || Index >= TAP_MAX) return 0; Ret = SendEvent (Index, event, param1, param2); if ((Ret == 0) && AllowParamInterception) return 0; } else { for (i = 0 ; i < TAP_MAX; ++i) { //if (i != TAP_TableIndex) // don't call ourselves { Ret = SendEvent (i, event, param1, param2); // Zero return value should mean don't pass the value on to other TAPs // In this case we don't even call the remaining TAPs if ((Ret == 0) && AllowParamInterception) return 0; } } } return param1; }
bool HDD_TAP_isDisabledAll(void) { TRACEENTER(); dword i; tTMSTAPTaskTable *TMSTAPTaskTable; TMSTAPTaskTable = (tTMSTAPTaskTable*)FIS_vTAPTable(); if(!TMSTAPTaskTable || (!LibInitialized && !InitTAPex())) { TRACEEXIT(); return FALSE; } for(i = 0; i < TAP_MAX; i++) { if((i != TAP_TableIndex) && (TMSTAPTaskTable[i].Status == 1) && (TMSTAPTaskTable[i].unused5 == 0)) { TRACEEXIT(); return FALSE; } } TRACEEXIT(); return TRUE; }
//--------------------------------------- FlashRemoveServiceByIndexString -------------------------------- // dword FlashRemoveServiceByIndexString (char* ChannelIndex, bool TVService) { dword lChannelIndex; if (!LibInitialized) InitTAPex (); if (!LibInitialized || (FlashOffset == 0)) return 0; lChannelIndex=atol (ChannelIndex); return FlashRemoveServiceByIndex (lChannelIndex, TVService); }
int HDD_TAP_GetCurrentDirCluster (void) { tTAPTableInfo pTAPInfo; if (!LibInitialized) InitTAPex (); if (!LibInitialized) return -1; //Get some information about ourselve HDD_TAP_GetInfo (TAP_TableIndex, &pTAPInfo); return pTAPInfo.LoadAddress ? *(int*)(pTAPInfo.pDotDirStructure + 8) : -1; }
//--------------------------------------- FlashInitialize -------------------------------- // dword FlashInitialize (dword SystemID) { dword i; tToppyInfo *ToppyInfo; tFWDATHeader *FWDatHeader; if (FlashOffset != 0) return FlashOffset; if (!LibInitialized) InitTAPex (); if (!LibInitialized) return 0; //Get toppy information if (!LoadFirmwareDat(&FWDatHeader, &ToppyInfo, NULL)) return 0; for (i = 0; i < FWDatHeader->NrOfToppyInfoEntries; i++, ToppyInfo++) { if (ToppyInfo->SysID == SystemID) { SystemType = ToppyInfo->SystemType; break; } } //Copy the appropriate offset table switch (SystemType) { case ST_DVBS : memcpy (FlashBlockOffset, FlashBlockOffsetS, (BLOCKS + 1) * sizeof (dword)); break ; case ST_DVBT : memcpy (FlashBlockOffset, FlashBlockOffsetT, (BLOCKS + 1) * sizeof (dword)); break ; case ST_DVBC : memcpy (FlashBlockOffset, FlashBlockOffsetC, (BLOCKS + 1) * sizeof (dword)); break ; case ST_DVBT5700: memcpy (FlashBlockOffset, FlashBlockOffsetT5700, (BLOCKS + 1) * sizeof (dword)); break ; default: return 0; } //The following code searches for the start of the Flash in the RAM. It uses the following method: //the Flash starts with the CRC which is never 0xFFFF. The word after the CRC is always 0xFFFF and the next word isn't 0xFFFF again. if (!(FlashOffset = FIS_vFlash())) return 0; //Add the start of the flash to the FlashBlockOffset array to make its address entries absolute. for (i = TVServices; i <= BLOCKS; i++) FlashBlockOffset [i] += FlashOffset; return FlashOffset; }
//--------------------------------------- FlashGetTransponderCByIndex -------------------------------- // TYPE_TpInfoC *FlashGetTransponderCByIndex (word TpIdx) { dword offset; if (!LibInitialized) InitTAPex (); if (!LibInitialized || (FlashOffset == 0 || SystemType != ST_DVBC)) return NULL; offset = FlashBlockOffset[Transponders] + 4; // sanity check of the parameter if ((dword) TpIdx >= *(dword *) offset) return NULL; return (TYPE_TpInfoC *) (offset + 4 + TpIdx * sizeof(TYPE_TpInfoC)); }
//--------------------------------------- HDD_TAP_Terminate -------------------------------- // void HDD_TAP_Terminate (dword TAPID) { int TAPIndex; if (!LibInitialized) InitTAPex (); if (!LibInitialized) return; //Return if that entry is not in use TAPIndex = HDD_TAP_GetIndexByID (TAPID); if (TAPIndex < 0) return; if (*(dword *)(TAP_TableAddress + (TAPIndex << 5) + 12) == 0) return; *(char*)(TAP_TableAddress + (TAPIndex << 5) + 28) |= 0x01; }
//--------------------------------------- HDD_TAP_Callback -------------------------------- // dword HDD_TAP_Callback (dword TAPID, void *ProcedureAddress, dword param1, dword param2, dword param3, dword param4) { dword Ret = 0; if (!LibInitialized) InitTAPex(); if (!LibInitialized) return 0; if (TAPID) { int Index = HDD_TAP_GetIndexByID (TAPID); if (Index >= 0 && Index < TAP_MAX) Ret = Callback (Index, ProcedureAddress, param1, param2, param3, param4); } return Ret; }
//--------------------------------------- FlashFindEndOfServiceTableAddress -------------------------------- // dword FlashFindEndOfServiceTableAddress (bool TVService) { TYPE_Service *TvSvc; if (!LibInitialized) InitTAPex (); if (!LibInitialized || (FlashOffset == 0)) return 0; if (TVService)(dword) TvSvc = FlashBlockOffset [TVServices] + 4; else (dword) TvSvc = FlashBlockOffset [RadioServices] + 4; while (TvSvc->TunerNum != 0) TvSvc++; #ifdef DEBUG_FIREBIRDLIB TAP_Print ("FireBirdLib: FindEndOfServiceTable @ 0x%8.8x\n", (dword) TvSvc); #endif return (dword) TvSvc; }
TAPCOM_Channel TAPCOM_OpenChannel(dword TargetID, dword ServiceID, dword ParamBlockVersion, void *ParamBlock) { TRACEENTER(); TAPCOM_InternalMesBuf *mesBuf = NULL; if(!LibInitialized && !InitTAPex()) { TRACEEXIT(); return NULL; } mesBuf = (TAPCOM_InternalMesBuf *) TAP_MemAlloc(sizeof(TAPCOM_InternalMesBuf)); if(mesBuf) { // Speicherbereich für Nachrichtenaustausch anlegen mesBuf->tapcomSignature = TAPCOM_SIGNATURE; mesBuf->tapcomVersion = TAPCOM_VERSION; mesBuf->ServerAlive = 0; mesBuf->FromID = __tap_ud__; mesBuf->ToID = TargetID; mesBuf->ServiceID = ServiceID; mesBuf->ParamBlockVersion = ParamBlockVersion; mesBuf->ParamBlock = ParamBlock; mesBuf->Status = TAPCOM_Status_OPEN; mesBuf->ReturnVal = 0; mesBuf->Reserved = 0; //Existiert der Ziel-Server überhaupt? if((TargetID != TAPCOM_App_BROADCAST) && !HDD_TAP_isRunning(TargetID)) { mesBuf->Status = TAPCOM_Status_SERVER_NOT_AVAILABLE; } else { // TAPCOM Event mit der Adresse des Message-Buffers versenden. HDD_TAP_SendEvent(TargetID, FALSE, EVT_TAPCOM, (dword) mesBuf, 0); } } TRACEEXIT(); return (TAPCOM_Channel) mesBuf; }
//--------------------------------------- HDD_TAP_GetIndexByID -------------------------------- // // Return codes: 0..15 = Position in the TAP table // -1 = TAPID not found // int HDD_TAP_GetIndexByID (dword TAPID) { dword LoadAddress; int i; if (!LibInitialized) InitTAPex (); if (!LibInitialized) return -1; for (i = 0; i < TAP_MAX; i++) { LoadAddress = *(dword*) (TAP_TableAddress + (i << 5) + 12); if (LoadAddress != 0) { if (*(dword*)(LoadAddress + 0x0020) == TAPID) return i; } } return -1; }
dword FIS_vPinStatus (void) { dword *EP; static dword pIRDLocked = 0; if (!pIRDLocked) { if (!LibInitialized) InitTAPex (); if (!LibInitialized) return 0; EP = (dword*) FindInstructionSequence ("3404e300 02a02825 00003025 0c054965 240700f1 8f988974", "ffffffff fc1fffff ffffffff fc000000 ffffffff ffe00000", 0x80150000, 0x80200000, 5, FALSE); if (EP) pIRDLocked = (FWgp + (short) (EP [0] & 0x0000ffff)); } return pIRDLocked; }
bool HDD_TAP_SetCurrentDirCluster (dword DirCluster) { tTAPTableInfo pTAPInfo; byte DataBuffer [512]; if (!LibInitialized) InitTAPex (); if (!LibInitialized) return FALSE; //Get some information about ourselve HDD_TAP_GetInfo (TAP_TableIndex, &pTAPInfo); if (*(dword*)(pTAPInfo.pDotDirStructure + 8) == DirCluster) return TRUE; HDD_ReadSectorDMA ((DirCluster + 1) * HDD_GetClusterSize(), 1, DataBuffer); if ((DataBuffer [0] != 0xf1) && (DataBuffer [0x14] != '.')) return FALSE; memcpy ((byte*)pTAPInfo.pDotDirStructure, DataBuffer, 128); return TRUE; }
dword FIS_vHddInfoStructure1 (void) { dword vHddInfoStructure1 = 0; if (!vHddInfoStructure1) { if (!LibInitialized) InitTAPex (); if (!LibInitialized) return 0; vHddInfoStructure1 = FindInstructionSequence("3402fe00 10000019 00000000 8f998380 8f9897d4 00000000 00000000 03380019 00000000 0000c812 00000000 0019cac2", "ffffffff ffff0000 ffffffff ffe00000 ffe00000 ffffffff ffffffff fc00ffff ffffffff ffff07ff ffffffff ffc007ff", 0x80090000, 0x80180000, 3, FALSE); if (vHddInfoStructure1) { vHddInfoStructure1 += sizeof (dword); vHddInfoStructure1 = FWgp + (short)(*(dword*)vHddInfoStructure1 & 0xffff); } } return vHddInfoStructure1; }
//--------------------------------------- HDD_TAP_DisableAll -------------------------------- // dword HDD_TAP_DisableAll (bool DisableEvents) { dword i, TAPID, count = 0; if (!LibInitialized) InitTAPex (); if (!LibInitialized) return FALSE; for (i = 0; i < TAP_MAX; i++) { if (i != TAP_TableIndex) { TAPID = HDD_TAP_GetIDByIndex (i); if (TAPID != 0) { if (!HDD_TAP_Disable(TAPID, DisableEvents)) count++; } } } return count; }
dword FlashRemoveServiceByPartOfName (char* ChannelName, bool TVService) { TYPE_Service *TvSvc, *TvSvcSource, *TvSvcDest; dword RemovedCount = 0; int ServiceIndex = 0; char ServiceName [MAX_SvcName]; if (!LibInitialized) InitTAPex (); if (!LibInitialized || (FlashOffset == 0 || SystemType == ST_UNKNOWN)) return 0; if (TVService) TvSvc = (TYPE_Service *) (FlashBlockOffset[TVServices] + 4); else TvSvc = (TYPE_Service *) (FlashBlockOffset[RadioServices] + 4); while (TvSvc->TunerNum != 0) { strncpy (ServiceName, (char *) (FlashBlockOffset [ServiceNames] + 4 + TvSvc->NameOffset), MAX_SvcName); ServiceName[MAX_SvcName - 1] = '\0'; if (stricstr (ServiceName, ChannelName) || stricstr (ValidFileName (ServiceName, NonPrintableChars), ChannelName)) { RemovedCount++; TvSvcDest = TvSvc; TvSvcSource = TvSvc; TvSvcSource++; do { memcpy(TvSvcDest, TvSvcSource, sizeof (TYPE_Service)); TvSvcSource++; TvSvcDest++; } while (TvSvcDest->TunerNum != 0); //A channel has been removed, reindex the timer table FlashReindexTimers(ServiceIndex, (TVService ? SVC_TYPE_Tv :SVC_TYPE_Radio), delete); //Also re-index the favourites tables FlashReindexFavourites(ServiceIndex, (TVService ? SVC_TYPE_Tv :SVC_TYPE_Radio), delete); } else {
bool FlashAddFavourite (char *FavName, word Idx, bool TVService) { TYPE_Fav *Favs; byte i; if (!LibInitialized) InitTAPex (); if (!LibInitialized || (FlashOffset == 0)) return FALSE; if (!FavName || !*FavName || !FlashGetServiceByIndex(Idx, TVService)) return FALSE; Favs = (TYPE_Fav *) (FlashBlockOffset[Favourites] + 4); for (i = 0; i < MAXFAVS; i++, Favs++) { if (strncmp(FavName, Favs->FavName, sizeof(Favs->FavName)) == 0) { if (Favs->Flags[0] != (TVService ? SVC_TYPE_Tv : SVC_TYPE_Radio)) return FALSE; if (Favs->NrOfEntries >= sizeof(Favs->ServiceIndex) / sizeof(word)) return FALSE; Favs->ServiceIndex[Favs->NrOfEntries] = Idx; Favs->Flags[Favs->NrOfEntries] = (TVService ? SVC_TYPE_Tv : SVC_TYPE_Radio); Favs->NrOfEntries++; return TRUE; } else if (*Favs->FavName == '\0') { strncpy(Favs->FavName, FavName, sizeof(Favs->FavName)); Favs->ServiceIndex[0] = Idx; Favs->Flags[0] = (TVService ? SVC_TYPE_Tv : SVC_TYPE_Radio); Favs->NrOfEntries = 1; return TRUE; } } return FALSE; }
//--------------------------------------- GetTAPInfo -------------------------------- // void HDD_TAP_GetInfo (int TAPIndex, tTAPTableInfo *pTAPInfo) { if (!LibInitialized) InitTAPex (); if (!LibInitialized) return; memcpy (pTAPInfo, (void *) (TAP_TableAddress + 32 * TAPIndex), 32); if (pTAPInfo->LoadAddress == 0) { pTAPInfo->TAPName [0] = 0; pTAPInfo->TAPAuthor [0] = 0; pTAPInfo->TAPDescription [0] = 0; pTAPInfo->TAPID = 0; memset (&pTAPInfo->AddressTableAddress, 0, 0x0400); } else { strcpy (pTAPInfo->TAPName , (char *) (pTAPInfo->LoadAddress + 0x0040)); strcpy (pTAPInfo->TAPAuthor , (char *) (pTAPInfo->LoadAddress + 0x0080)); strcpy (pTAPInfo->TAPDescription , (char *) (pTAPInfo->LoadAddress + 0x00C0)); memcpy (&pTAPInfo->TAPID , (void *) (pTAPInfo->LoadAddress + 0x0020), 4); memcpy (&pTAPInfo->AddressTable [0], (void *) pTAPInfo->AddressTableAddress, 0x0400); } }
//--------------------------------------- FlashFindTransponderIndex -------------------------------- // int FlashFindTransponderIndex (dword SatIndex, dword NetworkID, dword TSID) { dword TrCount, i; int Ret = -1; if (!LibInitialized) InitTAPex (); if (!LibInitialized || (FlashOffset == 0)) return 0; switch (SystemType) { case ST_DVBS: { TYPE_TpInfoS *Transponder; #ifdef DEBUG_FIREBIRDLIB TAP_Print ("FireBirdLib: FindTransponderIndex: Sat=%d, TSID=%d ", SatIndex, TSID); #endif TrCount = *((dword *) (FlashBlockOffset [Transponders] + 4)); Transponder = (TYPE_TpInfoS *) (FlashBlockOffset [Transponders] + 4 + 4); i=-1; while (TrCount > 0) { if (Transponder->SatIdx == SatIndex) i++; if ((Transponder->SatIdx == SatIndex) && (Transponder->TSID == TSID)) break; Transponder++; TrCount--; } if (TrCount != 0) { #ifdef DEBUG_FIREBIRDLIB TAP_Print ("@ 0x%8.8x (Index %d)\n", (dword) Transponder, i); #endif Ret = i; } else { #ifdef DEBUG_FIREBIRDLIB TAP_Print ("not found\n"); #endif Ret = -1; } break; } case ST_DVBT: case ST_DVBT5700: { byte *Transponder; #ifdef DEBUG_FIREBIRDLIB TAP_Print ("FireBirdLib: FindTransponderIndex: NetworkID=%d, TSID=%d ", NetworkID, TSID); #endif TrCount = *((dword *) (FlashBlockOffset [Transponders] + 4)); Transponder = (byte *) (FlashBlockOffset [Transponders] + 4 + 4); i=-1; while (TrCount > 0) { i++; // fortunately, the structures are identical until NetworkID (and TSID) if ((((TYPE_TpInfoT *) Transponder)->NetworkID == NetworkID) && (((TYPE_TpInfoT *) Transponder)->TSID == TSID)) break; Transponder += (SystemType == ST_DVBT ? sizeof(TYPE_TpInfoT) : sizeof(TYPE_TpInfoT5700)); TrCount--; } if (TrCount != 0) { #ifdef DEBUG_FIREBIRDLIB TAP_Print ("@ 0x%8.8x (Index %d)\n", (dword) Transponder, i); #endif Ret = i; } else { #ifdef DEBUG_FIREBIRDLIB TAP_Print ("not found\n"); #endif Ret = -1; } break; } case ST_DVBC: { TYPE_TpInfoC *Transponder; #ifdef DEBUG_FIREBIRDLIB TAP_Print ("FireBirdLib: FindTransponderIndex: NetworkID=%d, TSID=%d ", NetworkID, TSID); #endif //2005-15-11 Mod: Run from the last entry towards the first entry. This should prevent to hit a dummy 47MHz Premiere transponder TrCount = *((dword *) (FlashBlockOffset [Transponders] + 4)); Transponder = (TYPE_TpInfoC *) (FlashBlockOffset [Transponders] + 4 + 4 + sizeof(TYPE_TpInfoC) * (TrCount -1)); while (TrCount > 0) { if ((Transponder->NetworkID == NetworkID) && (Transponder->TSID == TSID)) break; Transponder--; TrCount--; } if (TrCount != 0) { #ifdef DEBUG_FIREBIRDLIB TAP_Print ("@ 0x%8.8x (Index %d)\n", (dword) Transponder, TrCount-1); #endif Ret = (TrCount-1); } else { #ifdef DEBUG_FIREBIRDLIB TAP_Print ("not found\n"); #endif Ret = -1; } break; } case ST_UNKNOWN: { break; } } return Ret; }
bool SDS(void) { TRACEENTER(); static dword Timeout = 0; static tHookHandlerState LastHHS = HHS_Exit; static dword EF00FilterTimeout = 0; if(LastHHS != HookHandlerState) { switch(HookHandlerState) { case HHS_Init: WriteLog("HHS_Init"); break; case HHS_Idle: WriteLog("HHS_Idle"); break; case HHS_EF00Received: WriteLog("HHS_EF00Received"); break; case HHS_PowerOffCancel: WriteLog("HHS_PowerOffCancel"); break; case HHS_ShutdownTimerDiags: WriteLog("HHS_ShutdownTimerDiags"); break; case HHS_Shutdown: WriteLog("HHS_Shutdown"); break; case HHS_Exit: WriteLog("HHS_Exit"); break; } LastHHS = HookHandlerState; } switch(HookHandlerState) { case HHS_Init: { char *TAPFileName; tTAPInfo TAPInfo; CreateRootDir(); //Init some firmware routines if(!__DevFront_PowerOffReply) { __DevFront_PowerOffReply = (void*)FIS_fwDevFront_PowerOffReply(); if(!__DevFront_PowerOffReply) { if(LastStatus != -1) WriteLog("Failed to resolve DevFront_PowerOffReply()"); LastStatus = -1; HookHandlerState = HHS_Exit; TRACEEXIT(); return FALSE; } } if(!__DevFront_PowerOffCancel) { __DevFront_PowerOffCancel = (void*)FIS_fwDevFront_PowerOffCancel(); if(!__DevFront_PowerOffCancel) { if(LastStatus != -2) WriteLog("Failed to resolve DevFront_PowerOffCancel()"); LastStatus = -2; HookHandlerState = HHS_Exit; TRACEEXIT(); return FALSE; } } //Modify the handler pointer of the ef00 event queue if(!SetHandler(0xef00, Hooked_ApplEvent_CallHandler, (void*)&OrigHandler)) { TRACEEXIT(); return FALSE; } if(!LibInitialized && !InitTAPex()) { TRACEEXIT(); return FALSE; } if(HDD_TAP_GetFileNameByIndex(TAP_TableIndex, &TAPFileName)) { if(!HDD_TAP_GetInfo(TAPFileName, &TAPInfo)) strcpy(TAPInfo.TAPName, "???"); } else strcpy(TAPInfo.TAPName, "???"); TAP_SPrint(Log, "SDS has been activated by '%s'", TAPInfo.TAPName); WriteLog(Log); HookHandlerState = HHS_Idle; break; } case HHS_Idle: { if(EF00FilterTimeout && TAP_GetTick() > EF00FilterTimeout) EF00FilterTimeout = 0; if(ShutdownHooked) { HookHandlerState = HHS_EF00Received; ShutdownHooked = FALSE; } break; } case HHS_EF00Received: { __DevFront_PowerOffReply(); if(EF00FilterTimeout) { Timeout = TAP_GetTick() + 50; HookHandlerState = HHS_PowerOffCancel; } else { dword ret = HDD_TAP_SendEvent(0, TRUE, EVT_STOP, 2, 0); if(ret == 0) { if(LastStatus != -4) WriteLog("A TAP has intercepted the shutdown notfication"); LastStatus = -4; Timeout = TAP_GetTick() + 50; HookHandlerState = HHS_PowerOffCancel; } else { HookHandlerState = HHS_ShutdownTimerDiags; } } break; } case HHS_PowerOffCancel: { if(TAP_GetTick() > Timeout) { if(LastStatus != -5) WriteLog("The shutdown has been canceled"); LastStatus = -5; __DevFront_PowerOffCancel(); EF00FilterTimeout = TAP_GetTick() + 200; HookHandlerState = HHS_Idle; } break; } case HHS_ShutdownTimerDiags: { if(LastStatus != -6) WriteLog("Notifiying TimerDiags about the shutdown"); LastStatus = -6; HDD_TAP_SendEvent(0x8E0A4224, FALSE, EVT_STOP, 0, 0); Timeout = TAP_GetTick() + 200; HookHandlerState = HHS_Shutdown; break; } case HHS_Shutdown: { if(TAP_GetTick() > Timeout) { if(OrigHandler) { SetHandler(0xef00, OrigHandler, NULL); OrigHandler = NULL; } if(LastStatus != -7) WriteLog("Notifiying all TAPs about the shutdown"); LastStatus = -7; HDD_TAP_SendEvent(0, FALSE, EVT_STOP, 0, 0); //TAP_Exit(); if(LastStatus != -8) WriteLog("Enqueuing the shutdown event"); LastStatus = -8; Shutdown(TaskPower); HookHandlerState = HHS_Exit; } break; } case HHS_Exit: { if(OrigHandler) { SetHandler(0xef00, OrigHandler, NULL); OrigHandler = NULL; if(LastStatus != -9) WriteLog("SDS has been deactivated"); LastStatus = -9; } TRACEEXIT(); return FALSE; } } TRACEEXIT(); return TRUE; }
int TAP_Main (void) { AddTime(0, 0); BMP_WriteHeader(NULL, 0, 0); BootReason(); BuildWindowBorder(); BuildWindowInfo(); BuildWindowLine(); BuildWindowLineSelected(); BuildWindowScrollBar(); BuildWindowTitle(); busyWait(); CalcAbsSectorFromFAT(NULL, 0); CalcPrepare(); CalcTopIndex(0, 0); Callback(0, NULL, 0, 0, 0, 0); CallbackHelper(NULL, NULL, 0, 0, 0, 0); CallBIOS(0, 0, 0, 0, 0); CallFirmware(0, 0, 0, 0, 0); CallTraceEnable(FALSE); CallTraceEnter(NULL); CallTraceExit(NULL); CallTraceInit(); CaptureScreen(0, 0, 0, NULL, 0, 0); ChangeDirRoot(); CheckSelectable(0, 0); combineVfdData(NULL, NULL); compact(NULL, 0); CompressBlock(NULL, 0, NULL); CompressedTFDSize(NULL, 0, NULL); CompressTFD(NULL, 0, NULL, 0, 0, NULL); CRC16(0, NULL, 0); CRC32 (0, NULL, 0); Delay(0); DialogEvent(NULL, NULL, NULL); DialogMsgBoxButtonAdd(NULL, FALSE); DialogMsgBoxExit(); DialogMsgBoxInit(NULL, NULL, NULL, NULL); DialogMsgBoxShow(); DialogMsgBoxShowInfo(0); DialogMsgBoxShowOK(); DialogMsgBoxShowOKCancel(0); DialogMsgBoxShowYesNo(0); DialogMsgBoxShowYesNoCancel(0); DialogMsgBoxTitleSet(NULL, NULL); DialogProfileChange(NULL); DialogProfileCheck(NULL, NULL, FALSE); DialogProfileLoad(NULL); DialogProfileLoadDefault(); DialogProfileLoadMy(NULL, FALSE); DialogProfileSave(NULL); DialogProfileSaveDefault(); DialogProfileScrollBehaviourChange(FALSE, FALSE); DialogProgressBarExit(); DialogProgressBarInit(NULL, NULL, 0, 0, NULL, 0, 0); DialogProgressBarSet(0, 0); DialogProgressBarShow(); DialogProgressBarTitleSet(NULL); DialogWindowChange(NULL, FALSE); DialogWindowCursorChange(FALSE); DialogWindowCursorSet(0); DialogWindowExit(); DialogWindowHide(); DialogWindowInfoAddIcon(0, 0, NULL); DialogWindowInfoAddS(0, 0, 0, NULL, 0, 0, 0, 0, 0); DialogWindowInfoDeleteAll(); DialogWindowInit(NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, 0, 0, 0); DialogWindowItemAdd(NULL, 0, NULL, 0, FALSE, FALSE, 0, NULL); DialogWindowItemAddSeparator(); DialogWindowItemChangeFlags(0, FALSE, FALSE); DialogWindowItemChangeIcon(0, 0, NULL); DialogWindowItemChangeParameter(0, NULL, 0); DialogWindowItemChangeValue(0, NULL, 0); DialogWindowItemDelete(0); DialogWindowItemDeleteAll(); DialogWindowRefresh(); DialogWindowReInit(0, 0, 0, 0, 0, 0); DialogWindowScrollDown(); DialogWindowScrollDownPage(); DialogWindowScrollUp(); DialogWindowScrollUpPage(); DialogWindowShow(); DialogWindowTabulatorSet(0, 0); DialogWindowTitleChange(NULL, NULL, NULL); DialogWindowTypeChange(0); DrawMsgBoxButtons(); DrawMsgBoxTitle(); DrawOSDLine(0, 0, 0, 0, 0, 0); DrawProgressBarBar(0, 0); DrawProgressBarTitle(); DrawWindowBorder(); DrawWindowInfo(); DrawWindowLine(0); DrawWindowLines(); DrawWindowScrollBar(); DrawWindowTitle(); EndMessageWin(); exitHook(); ExtractLine(NULL, NULL); FileSelector(NULL, NULL, NULL, 0); FileSelectorKey(0, 0); FindDBTrack(); FindInstructionSequence(NULL, NULL, 0, 0, 0, 0); findSendToVfdDisplay(0, 0); FlashAddFavourite(NULL, 0, FALSE); FlashDeleteFavourites(); FlashFindEndOfServiceNameTableAddress(); FlashFindEndOfServiceTableAddress(0); FlashFindServiceAddress(0, 0, 0, 0); FlashFindTransponderIndex(0, 0, 0); FlashGetBlockStartAddress(0); FlashGetChannelNumber(0, 0, 0, 0); FlashGetSatelliteByIndex(0); FlashGetServiceByIndex(0, FALSE); FlashGetServiceByName (NULL, FALSE); FlashGetTransponderCByIndex(0); FlashGetTransponderSByIndex(0, 0); FlashGetTransponderTByIndex(0); FlashGetTrueLocalTime(0, 0); FlashGetType(); FlashInitialize(0); FlashProgram(); FlashReindexFavourites(0, 0, 0); FlashReindexTimers(0, 0, 0); FlashRemoveCASServices(FALSE); FlashRemoveServiceByIndex(0, FALSE); FlashRemoveServiceByIndexString(NULL, FALSE); FlashRemoveServiceByLCN(NULL, FALSE); FlashRemoveServiceByName(NULL, FALSE); FlashRemoveServiceByPartOfName(NULL, FALSE); FlashRemoveServiceByUHF(NULL, FALSE, FALSE); FlashServiceAddressToServiceIndex(NULL); FlashWrite(NULL, NULL, 0, NULL); FlushCache(NULL, 0); FreeOSDRegion(0); fwHook(0); GetAudioTrackPID(0, NULL); GetClusterPointer(0); GetCurrentEvent(NULL); GetEEPROMAddress(); GetEEPROMPin(); GetFrameBufferPixel(0, 0); GetFrameSize(0, 0); GetFWInfo(0, 0, 0, 0, 0, 0, 0, 0); GetHeapParameter(NULL, 0); GetLine(NULL, 0); GetOSDMapAddress(); GetOSDRegionHeight(0); GetOSDRegionWidth(0); GetPinStatus(); GetPIPPosition(NULL, NULL, NULL, NULL); getRECSlotAddress(); GetSysOsdControl(0); GetToppyString(0); HasEnoughItemMemory(); HDD_AAM_Disable(); HDD_AAM_Enable(0); HDD_APM_Disable(); HDD_APM_Enable(0); HDD_BigFile_Read(NULL, 0, 0, NULL); HDD_BigFile_Size(NULL); HDD_BigFile_Write(NULL, 0, 0, NULL); HDD_ChangeDir(NULL); HDD_DecodeRECHeader(NULL, NULL); HDD_EncodeRECHeader(NULL, NULL, 0); HDD_FappendOpen(NULL); HDD_FappendWrite(NULL, NULL); HDD_FindPCR(NULL, 0); HDD_FindPMT(NULL, 0, NULL); HDD_FreeSize(); HDD_GetClusterSize(); HDD_GetFileDir(NULL, 0, NULL); HDD_GetFirmwareDirCluster(); HDD_GetHddID(NULL, NULL, NULL); HDD_IdentifyDevice(NULL); HDD_isAnyRecording(); HDD_isCryptedStream(NULL, 0); HDD_isRecording(0); HDD_LiveFS_GetChainLength(0); HDD_LiveFS_GetFAT1Address(); HDD_LiveFS_GetFAT2Address(); HDD_LiveFS_GetFirstCluster(0); HDD_LiveFS_GetLastCluster(0); HDD_LiveFS_GetNextCluster(0); HDD_LiveFS_GetPreviousCluster(0); HDD_LiveFS_GetRootDirAddress(); HDD_LiveFS_GetSuperBlockAddress(); HDD_MakeNewRecName(NULL, 0); HDD_Move(NULL, NULL, NULL); HDD_ReadClusterDMA(0, NULL); HDD_ReadSector(0, 0); HDD_ReadSectorDMA(0, 0, NULL); HDD_RECSlotGetAddress(0); HDD_RECSlotIsPaused(0); HDD_RECSlotPause(0, FALSE); HDD_RECSlotSetDuration(0, 0); HDD_SetCryptFlag(NULL, 0); HDD_SetFileDateTime(NULL, 0, 0, 0); HDD_SetSkipFlag (NULL, FALSE); HDD_SetStandbyTimer(0); HDD_Smart_DisableAttributeAutoSave(); HDD_Smart_DisableOperations(); HDD_Smart_EnableAttributeAutoSave(); HDD_Smart_EnableOperations(); HDD_Smart_ExecuteOfflineImmediate(0); HDD_Smart_ReadData(0); HDD_Smart_ReadThresholdData(0); HDD_Smart_ReturnStatus(); HDD_Stop(); HDD_TAP_Callback(0, NULL, 0, 0, 0, 0); HDD_TAP_Disable(0, 0); HDD_TAP_DisableAll(0); HDD_TAP_DisabledEventHandler(0, 0, 0); HDD_TAP_GetCurrentDir(NULL); HDD_TAP_GetCurrentDirCluster(); HDD_TAP_GetIDByFileName(NULL); HDD_TAP_GetIDByIndex(0); HDD_TAP_GetIndexByID(0); HDD_TAP_GetInfo(0, NULL); HDD_TAP_GetStartParameter(); HDD_TAP_isAnyRunning(); HDD_TAP_isBatchMode(); HDD_TAP_isDisabled(0); HDD_TAP_isDisabledAll(); HDD_TAP_isRunning(0); HDD_TAP_SendEvent(0, FALSE, 0, 0, 0); HDD_TAP_SetCurrentDirCluster(0); HDD_TAP_Start(NULL, FALSE, NULL, NULL); HDD_TAP_StartedByTAP(); HDD_TAP_Terminate(0); HDD_TouchFile(NULL); HDD_TranslateDirCluster(0, NULL); HDD_TruncateFile(NULL, 0); HDD_Write(NULL, 0, NULL); HDD_WriteClusterDMA(0, NULL); HDD_WriteSectorDMA(0, 0, NULL); HookEnable(0, 0); HookExit(); HookIsEnabled(0); HookMIPS_Clear(0, 0, 0); HookMIPS_Set(0, 0, 0); HookSet(0, 0); IMEM_Alloc(0); IMEM_Init(0); IMEM_isInitialized(); IMEM_Compact(); IMEM_Free(NULL); IMEM_GetInfo(NULL, NULL); IMEM_Kill(); InfoTestGrid(); INICloseFile(); INIFindStartEnd(NULL, NULL, NULL, 0); INIGetARGB(NULL, NULL, NULL, NULL, NULL, 0); INIGetHexByte(NULL, 0, 0, 0); INIGetHexDWord(NULL, 0, 0, 0); INIGetHexWord(NULL, 0, 0, 0); INIGetInt(NULL, 0, 0, 0); INIGetString(NULL, NULL, NULL, 0); INIKillKey(NULL); INIOpenFile(NULL); INISaveFile(NULL); INISetARGB(NULL, 0, 0, 0, 0); INISetComment(NULL); INISetHexByte(NULL, 0); INISetHexDWord(NULL, 0); INISetHexWord(NULL, 0); INISetInt(NULL, 0); INISetString(NULL, NULL); initCodeWrapper(0); InitTAPAPIFix(); InitTAPex(); InteractiveGetStatus(); InteractiveSetStatus(FALSE); intLock(); intUnlock(0); isAnyOSDVisible(0, 0, 0, 0); isLegalChar(0, 0); isMasterpiece(); isMPMenu(); iso639_1(0); isOSDRegionAlive(0); isValidChannel(NULL); LangGetString(0); LangLoadStrings(NULL, 0, 0); LangUnloadStrings(); Log(NULL, NULL, FALSE, 0, NULL); LowerCase(NULL); MakeValidFileName(NULL, 0); MHEG_Status(); MPDisplayClearDisplay(); MPDisplayClearSegments(0, 0); MPDisplayDisplayLongString(NULL); MPDisplayDisplayShortString(NULL); MPDisplayGetDisplayByte(0); MPDisplayGetDisplayMask(0); MPDisplayInstallMPDisplayFwHook(); MPDisplaySetAmFlag(0); MPDisplaySetColonFlag(0); MPDisplaySetDisplayByte(0, 0); MPDisplaySetDisplayMask(0, 0); MPDisplaySetDisplayMemory(NULL); MPDisplaySetDisplayMode(0); MPDisplaySetPmFlag(0); MPDisplaySetSegments(0, 0); MPDisplayToggleSegments(0, 0); MPDisplayUninstallMPDisplayFwHook(); MPDisplayUpdateDisplay(); Now(NULL); OSDCopy(0, 0, 0, 0, 0, 0, 0); OSDLinesForeDirty(FALSE); ParseLine(NULL, NULL, 0); ProfileDirty(); ProfileInit(); ProfileLoad(NULL, FALSE); ProfileMayReload(); ReadEEPROM(0, 0, NULL); ReadIICRegister(0, 0, 0, 0, NULL); Reboot(0); ReceiveSector(0); RTrim(NULL); SaveBitmap(NULL, 0, 0, NULL); SendEvent(0, 0, 0, 0); SendEventHelper(NULL, 0, 0, 0); SendHDDCommand(0, 0, 0, 0, 0, 0, 0); SendToFP(NULL); SeparatePathComponents(NULL, NULL, NULL, NULL); SetCrashBehaviour(0); setSymbol14(0, 0); setSymbol17(0, 0); ShowMessageWin(NULL, NULL, NULL, 0); ShowMessageWindow(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0); Shutdown(0); SoundSinus(0, 0, 0); StrEndsWith(NULL, NULL); stricstr(NULL, NULL); SubtitleGetStatus(); SubtitleSetStatus(FALSE); SuppressedAutoStart(); SwapDWords(0); SwapWords(0); TAP_Osd_PutFreeColorGd(0, 0, 0, NULL, FALSE, 0); TAPCOM_CloseChannel(NULL); TAPCOM_Finish(NULL, 0); TAPCOM_GetChannel(0, NULL, NULL, NULL, NULL); TAPCOM_GetReturnValue(NULL); TAPCOM_GetStatus(NULL); TAPCOM_LastAlive(NULL); TAPCOM_OpenChannel(0, 0, 0, NULL); TAPCOM_Reject(NULL); TAPCOM_StillAlive(NULL); TFDSize(NULL); TimeDiff(0, 0); TimeFormat(0, 0, 0); TunerGet(0); TunerSet(0); UncompressBlock(NULL, 0, NULL, 0); UncompressedFirmwareSize(NULL); UncompressedLoaderSize(NULL); UncompressedTFDSize(NULL); UncompressFirmware(NULL, NULL, NULL); UncompressLoader(NULL, NULL, NULL); UncompressTFD(NULL, NULL, NULL); UpperCase(NULL); ValidFileName(NULL, 0); WindowDirty(); WriteIICRegister(0, 0, 0, 0, NULL); YUV2RGB(0, 0, 0, NULL, NULL, NULL); YUV2RGB2(0, 0, 0, NULL, NULL, NULL); return 0; }
//--------------------------------------- HDD_DecodeRECHeader -------------------------------- // SYSTEM_TYPE HDD_DecodeRECHeader (char *Buffer, tRECHeaderInfo *RECHeaderInfo) { dword Frq, SR; byte Modulation, Polarization, BandWidth, LPHPStream; dword p; dword sPoints = 0, tPoints = 0, cPoints = 0; word v1, v2; memset (RECHeaderInfo, 0, sizeof (tRECHeaderInfo)); RECHeaderInfo->HeaderType = ST_UNKNOWN; if (!LibInitialized) InitTAPex (); if (!LibInitialized) return RECHeaderInfo->HeaderType; //Is this a REC header? p = 0; RECHeaderInfo->HeaderMagic = *(dword*)(&Buffer [p + 0]); if (RECHeaderInfo->HeaderMagic != 0x54467263) return RECHeaderInfo->HeaderType; //Header block RECHeaderInfo->HeaderVersion = *( word*)(&Buffer [p + 4]); memcpy (RECHeaderInfo->HeaderReserved1, &Buffer [p + 6], 2); RECHeaderInfo->HeaderDuration = *( word*)(&Buffer [p + 8]); RECHeaderInfo->HeaderSvcNumber = *( word*)(&Buffer [p + 10]); RECHeaderInfo->HeaderSvcType = *( word*)(&Buffer [p + 12]); p += 14; //Service Info block RECHeaderInfo->SISatIndex = *( byte*)(&Buffer [p + 0]); RECHeaderInfo->SIReserved1 = *( byte*)(&Buffer [p + 1]); RECHeaderInfo->SITPIdx = *( word*)(&Buffer [p + 2]) >> 6; RECHeaderInfo->SITunerNum = (*( word*)(&Buffer [p + 2]) >> 4) & 3; RECHeaderInfo->SIDelFlag = (*( word*)(&Buffer [p + 2]) >> 3) & 1; RECHeaderInfo->SICASFlag = (*( word*)(&Buffer [p + 2]) >> 2) & 1; RECHeaderInfo->SILockFlag = (*( word*)(&Buffer [p + 2]) >> 1) & 1; RECHeaderInfo->SISkipFlag = (*( word*)(&Buffer [p + 2]) ) & 1; RECHeaderInfo->SIServiceID = *( word*)(&Buffer [p + 4]); RECHeaderInfo->SIPMTPID = *( word*)(&Buffer [p + 6]); RECHeaderInfo->SIPCRPID = *( word*)(&Buffer [p + 8]); RECHeaderInfo->SIVideoPID = *( word*)(&Buffer [p + 10]); RECHeaderInfo->SIAudioPID = *( word*)(&Buffer [p + 12]); if (RECHeaderInfo->HeaderVersion == 0x5010) { memcpy (RECHeaderInfo->SISvcName, &Buffer [p + 14], 28); p += 42; } else { memcpy (RECHeaderInfo->SISvcName, &Buffer [p + 14], 24); p += 38; } //Use the following rules for the type decision (thx to jkIT) //Count 1 point for every matching rule //for dvb-s: // Transponder_Info.Polarity & 0x6F == 0 ? // Transponder_Info.Symbol_Rate in [2000...30000] ? // Transponder_Info.Frequency in [10700...12800] ? //for dvb-t // Transponder_Info.Bandwidth in [6..8] ? // Transponder_Info.Frequency in [174000...230000] or [470000...862000] ? // Transponder_Info.LP_HP_Stream & 0xFE == 0 ? //for dvb-c // Transponder_Info.Frequency in [47000...862000] ? // Transponder_Info.Symbol_Rate in [2000...30000] ? // Transponder_Info.Modulation <= 4 ? //Count cable points Frq = *(dword*)(&Buffer [p + 0]); SR = *(word*)(&Buffer [p + 4]); Modulation = *(byte *) (&Buffer [p + 10]); if ((Frq >= 47000) && (Frq <= 862000)) cPoints++; if ((SR >= 2000) && (SR <= 30000)) cPoints++; if (Modulation <= 4) cPoints++; //Count sat points Frq = *(dword*)(&Buffer [p + 4]); SR = *(word*)(&Buffer [p + 8]); Polarization = *(byte *) (&Buffer [p + 1]); if ((Frq >= 10700) && (Frq <= 12800)) sPoints++; if ((SR >= 2000) && (SR <= 30000)) sPoints++; if ((Polarization & 0x6F) == 0) sPoints++; //Count terrestrial points BandWidth = *(byte *) (&Buffer [p + 2]); LPHPStream = *(byte *) (&Buffer [p + 10]); if (((Frq >= 174000) && (Frq <= 230000)) || ((Frq >= 470000) && (Frq <= 862000))) tPoints++; if ((BandWidth >= 6) && (BandWidth <= 8)) tPoints++; if ((LPHPStream & 0xFE) == 0) tPoints++; //If one system has 3 points and all other have less than 3, use that DVB system if ((sPoints == 3) && (tPoints < 3) && (cPoints < 3)) RECHeaderInfo->HeaderType = ST_DVBS; if ((sPoints < 3) && (tPoints == 3) && (cPoints < 3)) { //Try to find out if this is a TF5700 Header: compare the date v1 = *(word*)(&Buffer [84]); // StartMJD v2 = *(word*)(&Buffer [88]); // EndMJD RECHeaderInfo->HeaderType = (v1 && v2 && (v1 == v2 || v1 + 1 == v2) ? ST_DVBT5700 : ST_DVBT); } if ((sPoints < 3) && (tPoints < 3) && (cPoints == 3)) RECHeaderInfo->HeaderType = ST_DVBC; #ifdef DEBUG_FIREBIRDLIB TAP_Print ("FireBirdLib: DecodeRCEHeader: DVBs=%d, DVBt=%d, DVBc=%d\n", sPoints, tPoints, cPoints); #endif //Transponder block switch (RECHeaderInfo->HeaderType) { case ST_DVBS: { RECHeaderInfo->TPSatIndex = *( byte*)(&Buffer [p + 0]); RECHeaderInfo->TPPolarization = *( byte*)(&Buffer [p + 1]) >> 7; RECHeaderInfo->TPMode = (*( byte*)(&Buffer [p + 1]) >> 4) & 7; RECHeaderInfo->TPReserved3 = (*( byte*)(&Buffer [p + 1]) ) & 15; memcpy (RECHeaderInfo->TPReserved1, &Buffer [p + 2], 2); RECHeaderInfo->TPFrequency = *(dword*)(&Buffer [p + 4]); RECHeaderInfo->TPSymbolRate = *( word*)(&Buffer [p + 8]); RECHeaderInfo->TPTSID = *( word*)(&Buffer [p + 10]); memcpy (RECHeaderInfo->TPReserved2, &Buffer [p + 12], 2); RECHeaderInfo->TPNetworkID = *( word*)(&Buffer [p + 14]); p += 16; break; } case ST_DVBT: case ST_DVBT5700: { RECHeaderInfo->TPChannelNumber = *( word*)(&Buffer [p + 0]); RECHeaderInfo->TPBandwidth = *( byte*)(&Buffer [p + 2]); RECHeaderInfo->TPReserved3 = *( byte*)(&Buffer [p + 3]); RECHeaderInfo->TPFrequency = *(dword*)(&Buffer [p + 4]); RECHeaderInfo->TPTSID = *( word*)(&Buffer [p + 8]); RECHeaderInfo->TPLPHPStream = *( byte*)(&Buffer [p + 10]); RECHeaderInfo->TPReserved4 = *( byte*)(&Buffer [p + 11]); RECHeaderInfo->TPNetworkID = *( word*)(&Buffer [p + 12]); memcpy (RECHeaderInfo->TPUnknown1, &Buffer [p + 14], 2); p += 16; if (RECHeaderInfo->HeaderType == ST_DVBT5700) { memcpy(RECHeaderInfo->TPUnknown2, &Buffer[p + 16], 8); p += 8; } break; } case ST_DVBC: { RECHeaderInfo->TPFrequency = *(dword*)(&Buffer [p + 0]); RECHeaderInfo->TPSymbolRate = *( word*)(&Buffer [p + 4]); RECHeaderInfo->TPTSID = *( word*)(&Buffer [p + 6]); RECHeaderInfo->TPNetworkID = *( word*)(&Buffer [p + 8]); RECHeaderInfo->TPModulation = *( byte*)(&Buffer [p + 10]); RECHeaderInfo->TPReserved5 = *( byte*)(&Buffer [p + 11]); p += 12; break; } default: { p += 16; break; } } //Event block memcpy (RECHeaderInfo->EventUnknown2, &Buffer [p], 2); RECHeaderInfo->EventDurationHour = *( byte*)(&Buffer [p + 2]); RECHeaderInfo->EventDurationMin = *( byte*)(&Buffer [p + 3]); RECHeaderInfo->EventEventID = *(dword*)(&Buffer [p + 4]); memcpy (&RECHeaderInfo->EventStartTime, &Buffer [p + 8], 4); memcpy (&RECHeaderInfo->EventEndTime , &Buffer [p + 12], 4); RECHeaderInfo->EventRunningStatus = *( byte*)(&Buffer [p + 16]); RECHeaderInfo->EventTextLength = *( byte*)(&Buffer [p + 17]); RECHeaderInfo->EventParentalRate = *( byte*)(&Buffer [p + 18]); memcpy (RECHeaderInfo->EventEventName, &Buffer [p + 19], RECHeaderInfo->EventTextLength); memcpy (RECHeaderInfo->EventEventDescription, &Buffer [p + 19 + RECHeaderInfo->EventTextLength], 257 - RECHeaderInfo->EventTextLength); memcpy (RECHeaderInfo->EventUnknown1, &Buffer [p + 276], 18); p += 294; //Extended Event block RECHeaderInfo->ExtEventTextLength = *( word*)(&Buffer [p + 0]); RECHeaderInfo->ExtEventEventID = *(dword*)(&Buffer [p + 2]); memcpy (RECHeaderInfo->ExtEventText, &Buffer [p + 6], 1024); p += 1030; //Crypt Flag block memcpy (RECHeaderInfo->CryptReserved1, &Buffer [p], 4); RECHeaderInfo->CryptFlag = *( byte*)(&Buffer [p + 4]); memcpy (RECHeaderInfo->CryptReserved2, &Buffer [p + 5], 3); p += 8; //Bookmark block memcpy (RECHeaderInfo->Bookmark, &Buffer [p], 64 * sizeof (dword)); p += 256; RECHeaderInfo->Resume = *( dword*)(&Buffer [p + 0]); return RECHeaderInfo->HeaderType; }