#!/system/bin/sh
PKG="com.tencent.igce"
ACT="com.epicgames.ue4.GameActivity"
TARGET_DIR="/data/data/$PKG"
INJECT_BIN="动态库文件"
SO_FILE="libs/arm64-v8a/libBETA.so"
RAND_SUFFIX=$(mktemp -u XXXXXXXX)
NEW_SO_NAME="libBETA_${RAND_SUFFIX}.so"
NEW_INJECT_NAME="动态库文件_${RAND_SUFFIX}"
echo "正在复制并随机重命名文件..."
cp "$INJECT_BIN" "${TARGET_DIR}/${NEW_INJECT_NAME}"
cp "$SO_FILE" "${TARGET_DIR}/${NEW_SO_NAME}"
echo "正在修改权限..."
chmod 777 "${TARGET_DIR}/${NEW_INJECT_NAME}"
chmod 777 "${TARGET_DIR}/${NEW_SO_NAME}"
echo "正在启动游戏..."
am start -n "$PKG/$ACT" && sleep 6
echo "正在注入..."
"${TARGET_DIR}/${NEW_INJECT_NAME}" -n "$PKG" -so "${TARGET_DIR}/${NEW_SO_NAME}"
INJECT_RESULT=$?
echo "正在清理临时文件..."
rm -f "${TARGET_DIR}/${NEW_INJECT_NAME}"
rm -f "${TARGET_DIR}/${NEW_SO_NAME}"
echo "操作完成，注入返回值: $INJECT_RESULT"
