mirror of
https://github.com/Momoko-Ayase/Senbei.git
synced 2026-09-19 03:57:59 -04:00
refactor: align platform crate boundaries
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::common::MAGIC;
|
||||
|
||||
/// Seed embedded in the current `libil2cpp` module `0x0C`.
|
||||
pub const DEFAULT_METHOD_TOKEN_SEED: u32 = 0xa6fa_e968;
|
||||
|
||||
const MAGIC: u32 = 0xfab1_1baf;
|
||||
const SUPPORTED_V29: u32 = 29;
|
||||
const SUPPORTED_V31: u32 = 31;
|
||||
const HDR_METHODS: usize = 0x30;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
//! Shared IL2CPP metadata header primitives.
|
||||
|
||||
/// IL2CPP global-metadata sanity magic.
|
||||
pub(crate) const MAGIC: u32 = 0xFAB1_1BAF;
|
||||
|
||||
/// Cheap check used by both platform scanners before opening a full metadata
|
||||
/// file.
|
||||
#[must_use]
|
||||
pub fn is_metadata(data: &[u8]) -> bool {
|
||||
data.get(0..4)
|
||||
.is_some_and(|bytes| u32::from_le_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]) == MAGIC)
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
//! Unity il2cpp metadata restoration.
|
||||
|
||||
pub mod android;
|
||||
mod common;
|
||||
mod structural;
|
||||
pub mod windows;
|
||||
|
||||
pub use windows::*;
|
||||
pub use common::is_metadata;
|
||||
pub use structural::*;
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
//! metadata (its tokens already equal `local_index + 1`), so it is safe to run on
|
||||
//! any il2cpp game — `remapped == 0` then reports that nothing changed.
|
||||
|
||||
/// il2cpp `global-metadata.dat` sanity magic (`Il2CppGlobalMetadataHeader.sanity`).
|
||||
const MAGIC: u32 = 0xFAB1_1BAF;
|
||||
use crate::common::MAGIC;
|
||||
|
||||
/// Metadata format version this de-obfuscator understands. The struct strides
|
||||
/// and header field offsets below are specific to it; other versions are left
|
||||
@@ -1,5 +1,3 @@
|
||||
//! Windows metadata restoration.
|
||||
//! Compatibility namespace for the shared structural metadata transform.
|
||||
|
||||
mod metadata;
|
||||
|
||||
pub use metadata::*;
|
||||
pub use crate::structural::*;
|
||||
|
||||
Reference in New Issue
Block a user