Skip to content

Commit 491fedb

Browse files
committed
refactor: extract bridge-api and rework IPC data model
1 parent ab81ba2 commit 491fedb

31 files changed

Lines changed: 382 additions & 365 deletions

Cargo.lock

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ run-emulator: build-debug
3131
adb shell "chmod +x /data/local/tmp/zynx"
3232
adb shell "(su 0 killall zynx || true) && sleep 1"
3333
adb shell su 0 setenforce 0
34-
adb shell "RUST_LOG=debug RUST_LOG_STYLE=always RUST_BACKTRACE=1 su 0 /data/local/tmp/zynx --cfg-enable-zygisk"
34+
adb shell "RUST_LOG=debug RUST_LOG_STYLE=always RUST_BACKTRACE=1 su 0 /data/local/tmp/zynx --cfg-enable-zygisk --cfg-enable-debugger"
3535
3636
setup-ondk:
3737
@python3 scripts/setup-ondk.py --version {{ONDK_VERSION}}

src/bridge-api/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "zynx-bridge-api"
3+
version.workspace = true
4+
edition.workspace = true
5+
6+
[dependencies]
7+
anyhow = { workspace = true }
8+
zynx-bridge-shared = { path = "../bridge-shared" }
9+
10+
[lints]
11+
workspace = true

src/bridge-api/src/injector.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use crate::zygote::ProviderBundle;
2+
use anyhow::Result;
3+
use zynx_bridge_shared::zygote::{ProviderType, SpecializeArgs};
4+
5+
pub trait ProviderHandler: Send + Sync + 'static {
6+
const TYPE: ProviderType;
7+
8+
fn on_specialize_pre(_args: &mut SpecializeArgs, _bundle: &mut ProviderBundle) -> Result<()> {
9+
Ok(())
10+
}
11+
12+
fn on_specialize_post(_args: &SpecializeArgs, _bundle: &mut ProviderBundle) -> Result<()> {
13+
Ok(())
14+
}
15+
}

src/bridge-api/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod injector;
2+
pub mod zygote;

src/bridge-api/src/zygote.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use std::os::fd::OwnedFd;
2+
use zynx_bridge_shared::zygote::ProviderType;
3+
4+
#[derive(Debug)]
5+
pub struct Attachment {
6+
pub fd: Option<OwnedFd>,
7+
pub data: Option<Vec<u8>>,
8+
}
9+
10+
#[derive(Debug)]
11+
pub struct ProviderBundle {
12+
pub ty: ProviderType,
13+
pub attachments: Vec<Attachment>,
14+
pub data: Option<Vec<u8>>,
15+
}

src/bridge-shared/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ name = "zynx-bridge-shared"
33
version.workspace = true
44
edition.workspace = true
55

6-
[features]
7-
zygisk = []
8-
96
[dependencies]
107
anyhow = { workspace = true }
118
bytemuck = { workspace = true }

src/bridge-shared/src/injector.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/bridge-shared/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub mod injector;
21
pub mod policy;
32
pub mod remote_lib;
43
pub mod zygote;

src/bridge-shared/src/policy.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
pub mod debugger;
2+
pub mod liteloader;
3+
pub mod zygisk;

0 commit comments

Comments
 (0)