mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-28 14:47:16 +08:00
Compare commits
3 Commits
52145d7c04
...
3457dcb5df
| Author | SHA1 | Date | |
|---|---|---|---|
| 3457dcb5df | |||
| 73059190d2 | |||
| d21e8c04d2 |
@@ -108,7 +108,7 @@ pub trait ScriptBuilder: std::fmt::Debug {
|
||||
/// Checks if the given filename and buffer match this script format.
|
||||
/// * `filename` - The name of the file to check.
|
||||
/// * `buf` - The buffer containing the script data.
|
||||
/// * `buf_len` - The length of the buffer.
|
||||
/// * `buf_len` - The length of the valid data in the buffer (it MUST <= buf.len()).
|
||||
///
|
||||
/// Returns a score (0-255) indicating how well the format matches.
|
||||
/// A higher score means a better match.
|
||||
|
||||
@@ -5,6 +5,7 @@ use crate::scripts::base::*;
|
||||
use crate::types::*;
|
||||
use crate::utils::encoding::{decode_to_string, encode_string};
|
||||
use anyhow::Result;
|
||||
use overf::overflowing;
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Circus MES Script Builder
|
||||
@@ -51,13 +52,13 @@ fn try_parse_header(mut data: MemReaderRef<'_>) -> Result<u8> {
|
||||
let head0 = data.read_i32()?;
|
||||
let head1 = data.read_i32()?;
|
||||
if head1 == 0x3 {
|
||||
let offset = head0 as u64 * 0x6 + 0x4;
|
||||
let offset = overflowing!(head0 as u64 * 0x6 + 0x4);
|
||||
let version = data.peek_u16_at(offset)?;
|
||||
if ScriptInfo::query_by_version(version).is_some() {
|
||||
return Ok(10);
|
||||
}
|
||||
} else {
|
||||
let offset = head0 as u64 * 0x4 + 0x4;
|
||||
let offset = overflowing!(head0 as u64 * 0x4 + 0x4);
|
||||
let version = data.peek_u16_at(offset)?;
|
||||
if ScriptInfo::query_by_version(version).is_some() {
|
||||
return Ok(10);
|
||||
|
||||
@@ -669,7 +669,7 @@ fn default_artemis_asb_end_tags() -> std::sync::Arc<std::collections::HashSet<St
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)]
|
||||
/// Script type
|
||||
pub enum ScriptType {
|
||||
#[cfg(feature = "artemis")]
|
||||
|
||||
Reference in New Issue
Block a user