gg.clearResults() -- 获取基址(Xa段第一个) local function getXaBase() local ranges = gg.getRangesList('libil2cpp.so') for _, r in ipairs(ranges) do if r.state == 'Xa' then return r.start end end return nil end local xa = getXaBase() if not xa then gg.alert("未找到 libil2cpp.so 的 Xa 段,请先选择游戏进程") os.exit() end -- ================= 功能定义 ================= local features = { -- 解锁类 ["解锁全部宠物"] = { category = "解锁", off = 0x26bd350, openVal = 400408267, closeVal = -1447208970, retVal = 0 }, ["解锁全部坐骑"] = { category = "解锁", off = 0x26bd350, openVal = 400408162, closeVal = -1447208970, retVal = 0 }, ["解锁全部人物"] = { category = "解锁", off = 0x26bd350, openVal = 400407983, closeVal = -1447208970, retVal = 0 }, ["解锁全部成就"] = { category = "解锁", off = 0x1d97a64, multiSwitch = true, openVals = { -763363296, -763363295, -698416192 }, closeVals = { -1447145484, -1459520515, -1862253571 } }, ["解锁全地图"] = { category = "解锁", off = 0x26bd350, openVal = 400408376, closeVal = -1447208970, retVal = 0, warning = "开启后记得关闭,否则切换地图会疯狂调用弹窗" }, ["全角色满等级"] = { category = "解锁", off = 0x26bd350, openVal = 400408456, closeVal = -1447208970, retVal = 0 }, -- 娱乐类 ["人物速度"] = { category = "娱乐", off = 0x1b0d914, openInstr = 469762112, -- LDR S0, [PC,#0x8] retInstr = -698416192, -- RET needInput = true, desc = "速度值", example = "500", valueType = gg.TYPE_FLOAT, hasClose = true, closeFixed = true, closeInstr = -65204248, closeRet = -1459531788, closeValue = -1459454979 -- 原始速度值 }, ["加速"] = { category = "娱乐", off = 0x207e0f8, openVal = 402651977, closeVal = -788397057, retVal = 0 }, ["人物无敌"] = { category = "娱乐", off = 0x207c7cc, openVal = 1384120352, retVal = -698416192, closeVal = 960569352, origVal = 889192552 }, -- 修改资源类 ["金币数量"] = { category = "修改资源", off = 0x2268c5c, openInstr = 402653248, -- LDR W0, [PC,#0x8] retInstr = -698416192, needInput = true, desc = "金币数量", example = "99999", valueType = gg.TYPE_DWORD, hasClose = false }, ["账号等级"] = { category = "修改资源", off = 0x2268b98, openInstr = 1476395072, retInstr = -698416192, needInput = true, desc = "账号等级", example = "100", valueType = gg.TYPE_DWORD, hasClose = false }, ["内购"] = { category = "修改资源", off = 0x1d23bc8, openVal = 335548176, closeVal = -117407742, retVal = 0 } } -- 状态记录 local enabled = {} for name in pairs(features) do enabled[name] = false end -- 存储每个功能对应的 Switch 节点,方便刷新 local switchNodes = {} -- ================= 修改函数 ================= local function applyModify(name, enable) local cfg = features[name] local addr = xa + cfg.off -- 处理多地址开关 if cfg.multiSwitch then if enable then gg.setValues({ {address = addr, flags = gg.TYPE_DWORD, value = cfg.openVals[1]}, {address = addr + 4, flags = gg.TYPE_DWORD, value = cfg.openVals[2]}, {address = addr + 8, flags = gg.TYPE_DWORD, value = cfg.openVals[3]} }) else gg.setValues({ {address = addr, flags = gg.TYPE_DWORD, value = cfg.closeVals[1]}, {address = addr + 4, flags = gg.TYPE_DWORD, value = cfg.closeVals[2]}, {address = addr + 8, flags = gg.TYPE_DWORD, value = cfg.closeVals[3]} }) end gg.toast(name .. (enable and " 开启" or " 关闭")) enabled[name] = enable gg.clearResults() -- 刷新开关 local node = switchNodes[name] if node then node.isCheck = enable if node.update then node.update() end end return end -- 需要输入数值的功能 if cfg.needInput and enable then local desc = cfg.desc or "数值" local example = cfg.example or "0" local warning = cfg.warning or "" local promptText = "输入" .. desc .. " (" .. example .. ")" if warning ~= "" then promptText = promptText .. "\n" .. warning end local input = gg.prompt({promptText}, {""}, {"number"}) if not input then return end local val = tonumber(input[1]) if not val or val <= 0 then gg.alert("无效数值") return end gg.setValues({ {address = addr, flags = gg.TYPE_DWORD, value = cfg.openInstr}, {address = addr + 4, flags = gg.TYPE_DWORD, value = cfg.retInstr}, {address = addr + 8, flags = cfg.valueType or gg.TYPE_DWORD, value = val} }) gg.toast(name .. " 已开启:" .. val) enabled[name] = true gg.clearResults() local node = switchNodes[name] if node then node.isCheck = true if node.update then node.update() end end return end -- 普通开关 if cfg.openVal then if enable then if cfg.retVal and cfg.retVal ~= 0 then gg.setValues({ {address = addr, flags = gg.TYPE_DWORD, value = cfg.openVal}, {address = addr + 4, flags = gg.TYPE_DWORD, value = cfg.retVal} }) else gg.setValues({{address = addr, flags = gg.TYPE_DWORD, value = cfg.openVal}}) end -- 如果有警告,弹窗提醒 if cfg.warning then gg.alert(cfg.warning) end else if cfg.retVal and cfg.retVal ~= 0 and cfg.origVal then gg.setValues({ {address = addr, flags = gg.TYPE_DWORD, value = cfg.closeVal}, {address = addr + 4, flags = gg.TYPE_DWORD, value = cfg.origVal} }) else gg.setValues({{address = addr, flags = gg.TYPE_DWORD, value = cfg.closeVal}}) end end else -- 带关闭固定值的开关(如人物速度关闭) if enable then gg.setValues({ {address = addr, flags = gg.TYPE_DWORD, value = cfg.openInstr}, {address = addr + 4, flags = gg.TYPE_DWORD, value = cfg.retInstr} }) else if cfg.closeFixed then gg.setValues({ {address = addr, flags = gg.TYPE_DWORD, value = cfg.closeInstr}, {address = addr + 4, flags = gg.TYPE_DWORD, value = cfg.closeRet}, {address = addr + 8, flags = cfg.valueType or gg.TYPE_DWORD, value = cfg.closeValue} }) else -- 备份还原未实现,这里暂不处理 end end end gg.toast(name .. (enable and " 开启" or " 关闭")) enabled[name] = enable gg.clearResults() local node = switchNodes[name] if node then node.isCheck = enable if node.update then node.update() end end end -- ================= Compose UI ================= local windowConfig = { title = "", showCloseButton= true, closeAction = "hide", sizeMode = "centerFixed", width = 270, height = 380, themeMode = "day", accentColor = "#2196F3", floatingBall = true, ballImage = "/storage/emulated/0/ball.png", ballSize = 40, radius = 24, blurBehind = 30, contentPadding = 6, panelOpacity = 1.0 } -- 菜单名称 local menus = { func = function(position) end, "解锁", "娱乐", "修改资源", "设置" } -- 小号开关 local function smallSwitch(name) local node = { composeType = "Switch", text = name, isCheck = enabled[name] or false, textSize = 12, height = 32, radius = 8, func = function(check) applyModify(name, check) end } switchNodes[name] = node return node end -- 解锁页面 local unlockPage = { composeType = "Column", padding = 4, spaced = 2 } for _, name in ipairs({"解锁全部宠物", "解锁全部坐骑", "解锁全部人物", "解锁全部成就", "解锁全地图", "全角色满等级"}) do table.insert(unlockPage, smallSwitch(name)) end -- 娱乐页面 local funPage = { composeType = "Column", padding = 4, spaced = 1 } for _, name in ipairs({"人物速度", "加速", "人物无敌"}) do table.insert(funPage, smallSwitch(name)) end -- 修改资源页面 local resPage = { composeType = "Column", padding = 4, spaced = 2 } for _, name in ipairs({"金币数量", "账号等级", "内购"}) do table.insert(resPage, smallSwitch(name)) end -- 设置页面 local settingPage = { composeType = "Setting" } local mainConfig = { name = "神庙逃亡辅助", icon = "/storage/emulated/0/head.png", selectedPosition = -1 } local root = { composeType = "RailMenu", window = windowConfig, main = mainConfig, menus = menus, compose = { unlockPage, funPage, resPage, settingPage } } local ui = gg.composeUi(root, "神庙逃亡辅助") while true do gg.sleep(1000) end