Tutorials are treated as AKAO segments, but they have no magic word so they're easy to locate while converting a DAT to a class object. Currently my code to detect them goes like this:
tutorial=0;
akao_count=head.nAkaoOffsets;
// determine the size of the script block
if(akao_count==0) script_size=size-mainptr[SCRIPT_TEXT];
else
{
u32* ptr=(u32*)past;
script_size=ptr[0]-mainptr[SCRIPT_TEXT];
akao=new u8*[akao_count];
akao_sizes=new int[akao_count];
for(int i=0; i<akao_count; i++)
{
// determine size
int asize/*=ahead->size*/;
if(i<akao_count-1) asize=ptr[i+1]-ptr[i];
else asize=size-ptr[i];
AKAO_HEADER *ahead=(AKAO_HEADER*)(data+ptr[i]);
if(memcmp(&ahead->magic,"AKAO",4)!=0) tutorial++;
akao[i]=new u8[asize];
// copy to class
memcpy(akao[i],data+ptr[i],asize);
akao_sizes[i]=asize;
}
past+=akao_count*4;
}
When any tutorial segments are detected I reprocess the whole AKAO area (after extracting dialogue) and dump whatever doesn't have the "AKAO" magic value. Tutorial contain not just text, but also menu commands, so you're gonna need to skip whatever is not necessary. This is how my code does it:
void DumpTutorial(CText &text, u8* data)
{
GString str;
text.Create(0,TYPE_LIST);
for(int seek=0, pos;; )
{
for(pos=0; data[seek+pos]!=0x10; pos++) if(data[seek+pos]==0x11) return;
seek+=pos+1;
str.Empty();
seek+=DecodeField(str,&data[seek]);
text.AddEntry(str,NULL);
}
}