Merge pull request #8 from y52en/chatgpt/android-runtime-restoration-v2

fix(android): restore protected IL2CPP runtime state
This commit is contained in:
Momoko-Ayase authored and GitHub committed 2026-09-27 13:54:37 +08:00
commit f7d2d8b7e1
2 files changed
+1081 -53

No files matched your search

@@ -6,6 +6,11 @@ use serde_json::Value;
use super::error::{Error, Result, invalid}; use super::error::{Error, Result, invalid};
const REQUIRED_IDS: [u32; 3] = [0x9b, 0x9d, 0x9e]; const REQUIRED_IDS: [u32; 3] = [0x9b, 0x9d, 0x9e];
const OPTIONAL_IDS: [u32; 2] = [0x96, 0x98];
fn wanted_id(command_id: u32) -> bool {
REQUIRED_IDS.contains(&command_id) || OPTIONAL_IDS.contains(&command_id)
}
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct Artifact { pub(crate) struct Artifact {
@@ -27,7 +32,7 @@ pub(crate) fn load_artifacts(index_path: &Path) -> Result<BTreeMap<u32, Artifact
}; };
let command_id = u32::try_from(command_id) let command_id = u32::try_from(command_id)
.map_err(|_| Error::Invalid("module command ID exceeds u32".to_owned()))?; .map_err(|_| Error::Invalid("module command ID exceeds u32".to_owned()))?;
if !REQUIRED_IDS.contains(&command_id) { if !wanted_id(command_id) {
continue; continue;
} }
let Some(path) = item.get("image_path").and_then(Value::as_str) else { let Some(path) = item.get("image_path").and_then(Value::as_str) else {
@@ -57,7 +62,7 @@ pub(crate) fn load_artifacts(index_path: &Path) -> Result<BTreeMap<u32, Artifact
}; };
let command_id = u32::try_from(command_id) let command_id = u32::try_from(command_id)
.map_err(|_| Error::Invalid("record command ID exceeds u32".to_owned()))?; .map_err(|_| Error::Invalid("record command ID exceeds u32".to_owned()))?;
if !REQUIRED_IDS.contains(&command_id) { if !wanted_id(command_id) {
continue; continue;
} }
let Some(image) = record.get("image") else { let Some(image) = record.get("image") else {
File diff suppressed because it is too large. Load diff