void Journal::callEntry(const char *funcName, Functor *theCall) { if(mCurrentMode == Playback) return; TNLAssert(mInsideEntrypoint == false, "Journal entries cannot be reentrant!"); mInsideEntrypoint = true; S32 entryIndex; for(entryIndex = 0; entryIndex < JournalEntryRecord::mEntryVector->size(); entryIndex++) { if(!strcmp((*JournalEntryRecord::mEntryVector)[entryIndex]->mFunctionName, funcName)) break; } TNLAssert(entryIndex != JournalEntryRecord::mEntryVector->size(), "No entry point found!"); if(mCurrentMode == Record) { #ifdef TNL_ENABLE_BIG_JOURNALS TNL_JOURNAL_WRITE( (U16(0x1234)) ); #endif mWriteStream.writeRangedU32(entryIndex, 0, JournalEntryRecord::mEntryVector->size() - 1); theCall->write(mWriteStream); #ifdef TNL_ENABLE_BIG_JOURNALS TNL_JOURNAL_WRITE( (U16(0x5678)) ); #endif syncWriteStream(); } theCall->dispatch(this); mInsideEntrypoint = false; }
void Journal::endBlock(U32 blockId, bool writeBlock) { if(writeBlock) { #ifdef TNL_ENABLE_BIG_JOURNALS TNL_JOURNAL_WRITE( (U16(0x5678 ^ blockId)) ); #endif syncWriteStream(); } else { #ifdef TNL_ENABLE_BIG_JOURNALS U16 endToken; TNL_JOURNAL_READ( (&endToken) ); if((endToken ^ 0x5678) != blockId) { logprintf("Expected token %s - got %s", JournalBlockTypeToken::findName(blockId), JournalBlockTypeToken::findName(endToken ^ 0x5678)); TNL_DEBUGBREAK(); } #endif checkReadPosition(); } }