maclarian 0.1.3

Larian file format library for Baldur's Gate 3 - PAK, LSF, LSX, GR2, DDS, and more
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Public accessor methods for `GtpFile`.

use super::GtpFile;
use std::io::{Read, Seek};

impl<R: Read + Seek> GtpFile<R> {
    /// Get the number of pages in this GTP file.
    pub fn num_pages(&self) -> usize {
        self.chunk_offsets.len()
    }

    /// Get the number of chunks in a specific page.
    pub fn num_chunks(&self, page_index: usize) -> usize {
        self.chunk_offsets
            .get(page_index)
            .map_or(0, std::vec::Vec::len)
    }
}