Fixed bug in .bin format detection.

This commit is contained in:
Daan Vanden Bosch 2020-01-02 15:39:55 +01:00
parent f4b8b30590
commit f36b102ec1
2 changed files with 5 additions and 4 deletions

View File

@ -50,13 +50,13 @@ export function parse_bin(
entry_labels: number[] = [0], entry_labels: number[] = [0],
lenient: boolean = false, lenient: boolean = false,
): BinFile { ): BinFile {
const dc_gc_format = cursor.u8_at(0) !== 4652;
const object_code_offset = cursor.u32(); const object_code_offset = cursor.u32();
const label_offset_table_offset = cursor.u32(); // Relative offsets const label_offset_table_offset = cursor.u32(); // Relative offsets
const size = cursor.u32(); const size = cursor.u32();
cursor.seek(4); // Always seems to be 0xFFFFFFFF for BB. cursor.seek(4); // Always seems to be 0xFFFFFFFF for BB.
const dc_gc_format = object_code_offset !== 4652;
let quest_id: number; let quest_id: number;
let language: number; let language: number;
@ -300,7 +300,7 @@ function parse_object_code(
// Should never happen either. // Should never happen either.
if (!segment) { if (!segment) {
logger.error(`Couldn't create segment for offset ${offset}.`); logger.error(`Couldn't create segment for offset ${offset}.`);
continue; break;
} }
} }

View File

@ -78,8 +78,9 @@ exports[`Renders correctly. 1`] = `
</span> </span>
</span> </span>
<input <input
accept=".qst" accept=".bin, .dat, .qst"
class="core_FileButton_input core_Button_inner" class="core_FileButton_input core_Button_inner"
multiple=""
type="file" type="file"
/> />
</label> </label>