#include #include "libFireBird.h" tRECSlot *FindTSSlot() { tRECSlot *rs; int i; for(i = 0; i < 2; i++) { rs = HDD_RECSlotGetAddress(i); if(rs && rs->RecMode == 0x3) return rs; } return NULL; } // "secs" is number of secs of buffer to include (if possible) // "dur" is total duration of recording (in minutes) // returns 0 on failure // (crudely sets a bookmark to return to current viewed position -- TAP_Hdd_StopTs() causes a crash) // (and sometimes change_ts_pos with 0 works for going to Live) dword RecordTSBuffer(dword secs, word dur) { static dword change_ts_pos = 0; static dword* TSBuffSecs = NULL; static dword* TSBuffPos = NULL; static dword* TSBuffIndex = NULL; tRECSlot *rs = FindTSSlot(); if(rs == NULL) return 0; if (TSBuffSecs == NULL) { short *pTS; InitTAPex (); pTS = (short*)FindInstructionSequence( "3C1381B7 26736230 00157880 026F7821 26B90001 24180E10 ADF60000 AF9687A8 0338001B 00000810 17000002 0020C821 0007000D AF999F00 8F969F08 2AC10E10", "FFF90000 FF390000 FFE8FFFF FF3FFFFF FD0FFFFF FFFFFFFF FFF7FFFF FFF70000 FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFF0000 FFF70000 FEFFFFFF", 0x80080000, 0x80180000, 0, FALSE ); if(pTS == NULL) return 0; TSBuffSecs = (dword*)(FWgp + pTS[29]); TSBuffPos = (dword*)(FWgp + pTS[27]); TSBuffIndex = (dword*)((pTS[1] << 16) + pTS[3]); } if(change_ts_pos == 0) { /* change_ts_pos = FindInstructionSequence( "00001025 14800015 2419FFF6 00002025 0C05CC1B 00002825 AF808908 AF809F0C 8F99A13C", "FFFFFFFF FFFFFFFE FFFFFFFF FFFFFFFF FC000000 FFFFFFFF FFFF0000 FFFF0000 FFFF0000", 0x80100000, 0x80200000, 0, TRUE ); */ change_ts_pos = FindInstructionSequence( "8F829F08 0004C023 0058082A 50200003 8F839F0C 10000037 00001025", "FFFE0000 FFFFFFFF FF5FFFFF FFFFFFFF FFFE0000 FFFFFF00 FFFFFFFF", 0x80100000, 0x80200000, 0, TRUE ); if(change_ts_pos == 0) return 0; } if(secs > *TSBuffSecs) secs = *TSBuffSecs; TAP_Hdd_SetBookmark(); if(CallFirmware(change_ts_pos,-secs,0,0,0) == 0) return 0; if(TAP_Hdd_StartRecord()) { rs->Duration = dur; TAP_Hdd_GotoBookmark(); return 1; } return 0; }