mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-26 13:47:08 +08:00
Add document
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//! Kirikiri DPAK-referenced Image File (.dref)
|
||||
use crate::ext::io::*;
|
||||
use crate::ext::psb::*;
|
||||
use crate::scripts::base::*;
|
||||
@@ -12,9 +13,11 @@ use std::path::{Path, PathBuf};
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Kirikiri DREF Script Builder
|
||||
pub struct DrefBuilder {}
|
||||
|
||||
impl DrefBuilder {
|
||||
/// Creates a new instance of `DrefBuilder`
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
@@ -174,6 +177,7 @@ impl DpakLoader {
|
||||
}
|
||||
}
|
||||
|
||||
/// Kirikiri DREF Script
|
||||
pub struct Dref {
|
||||
urls: Vec<Url>,
|
||||
dir: PathBuf,
|
||||
@@ -190,6 +194,13 @@ impl std::fmt::Debug for Dref {
|
||||
}
|
||||
|
||||
impl Dref {
|
||||
/// Create a new dref script
|
||||
///
|
||||
/// * `buf` - The buffer containing the dref script data
|
||||
/// * `encoding` - The encoding of the script
|
||||
/// * `filename` - The name of the file
|
||||
/// * `config` - Extra configuration options
|
||||
/// * `archive` - Optional archive containing additional resources
|
||||
pub fn new(
|
||||
buf: Vec<u8>,
|
||||
encoding: Encoding,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//! Kirikiri Images
|
||||
pub mod dref;
|
||||
pub mod pimg;
|
||||
pub mod tlg;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//! Kirikiri Multiple Image File (.pimg)
|
||||
use crate::ext::io::*;
|
||||
use crate::ext::psb::*;
|
||||
use crate::scripts::base::*;
|
||||
@@ -12,9 +13,11 @@ use std::io::{Read, Seek};
|
||||
use std::path::Path;
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Kirikiri PImg Script Builder
|
||||
pub struct PImgBuilder {}
|
||||
|
||||
impl PImgBuilder {
|
||||
/// Creates a new instance of `PImgBuilder`
|
||||
pub const fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
@@ -94,12 +97,18 @@ impl ScriptBuilder for PImgBuilder {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Kirikiri PImg Script
|
||||
pub struct PImg {
|
||||
psb: VirtualPsbFixed,
|
||||
overlay: Option<bool>,
|
||||
}
|
||||
|
||||
impl PImg {
|
||||
/// Create a new PImg script
|
||||
///
|
||||
/// * `reader` - The reader containing the PImg script data
|
||||
/// * `filename` - The name of the file
|
||||
/// * `config` - Extra configuration options
|
||||
pub fn new<R: Read + Seek>(reader: R, filename: &str, config: &ExtraConfig) -> Result<Self> {
|
||||
let mut psb = PsbReader::open_psb(reader)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to open PSB from {}: {:?}", filename, e))?;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//! Kirikiri TLG Image File (.tlg)
|
||||
use crate::ext::io::*;
|
||||
use crate::scripts::base::*;
|
||||
use crate::types::*;
|
||||
@@ -6,9 +7,11 @@ use libtlg_rs::*;
|
||||
use std::io::{Read, Seek};
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Kirikiri TLG Script Builder
|
||||
pub struct TlgImageBuilder {}
|
||||
|
||||
impl TlgImageBuilder {
|
||||
/// Creates a new instance of `TlgImageBuilder`
|
||||
pub const fn new() -> Self {
|
||||
TlgImageBuilder {}
|
||||
}
|
||||
@@ -54,11 +57,16 @@ impl ScriptBuilder for TlgImageBuilder {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Kirikiri TLG Script
|
||||
pub struct TlgImage {
|
||||
data: Tlg,
|
||||
}
|
||||
|
||||
impl TlgImage {
|
||||
/// Create a new TLG script
|
||||
///
|
||||
/// * `data` - The reader containing the TLG script data
|
||||
/// * `config` - Extra configuration options
|
||||
pub fn new<T: Read + Seek>(data: T, _config: &ExtraConfig) -> Result<Self> {
|
||||
let tlg = load_tlg(data)?;
|
||||
Ok(TlgImage { data: tlg })
|
||||
|
||||
Reference in New Issue
Block a user