Corrected vpDataOffset, now use ftell to obtain file offset after reading in header and toc. Added better verification that the TOC was actually read.

md1702
vk7js 2022-07-04 22:54:16 +10:00 zatwierdzone przez Silvano Seva
rodzic e09ce7e95a
commit 6b83af622c
1 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -114,13 +114,14 @@ void vpCacheInit(void)
return;
fseek(voice_prompt_file, 0L, SEEK_SET);
vpDataOffset += fread((void*)&header, sizeof(header), 1, voice_prompt_file);
fread((void*)&header, sizeof(header), 1, voice_prompt_file);
if (vpCheckHeader((uint32_t*)&header))
{ // read in the TOC.
vpDataOffset += fread((void*)&tableOfContents, sizeof(tableOfContents), 1, voice_prompt_file);
vpDataIsLoaded = true;
fread((void*)&tableOfContents, sizeof(tableOfContents), 1, voice_prompt_file);
vpDataOffset = ftell(voice_prompt_file);
if(vpDataOffset == (sizeof(voicePromptsDataHeader_t) + sizeof(tableOfContents)))
vpDataIsLoaded = true;
}
if (vpDataIsLoaded)
{ // if the hash key is down, set vpLevel to high, if beep or less.