--ELGG专用UI --作者骤降 TLOGO="打工人反胃" gg.alert("打工人范围(测试中)") -- 全局变量提前初始化【修复关键点】 local xgsl = 0 local xgjg = false --[[ 为保证UI加载效率,UI内图片全部使用本地图片而不是云端调用 脚本的图片资源全部存储在/storage/emulated/0/NyaYAN/极简宽/res/这个目录下 ]] function 下载图片() local 图片表={ {"目标名称","外链"}, {"目标名称","外链"}, } if 图片表[1][2]~="外链" then for i=1,#图片表 do file.download(图片表[i][2],"/storage/emulated/0/NyaYAN/极简宽/res/"..图片表[i][1]) end end end loadYunLuaGroup("5C3C4E3813681C4C204C35346F1B4C2F7EFF612D2B22175F195D410B6EE1B0AE82D284F56ABFA8") -- 主题配置 function 添加主题() return {LinearLayout, layout_height="-2"; layout_width="-1"; orientation="vertical", themebtn(1,"简约白",{0xEFFFFEFE,0xEBC3E0F6,0xFF404B7C,0xFF303030,0xFF0084FF}), themebtn(2,"温馨黄",{0xEFf9f4dc,0xEDDADADA,0xFFfba414,0xFFd85916,0xFFfa5d19}), } end --==================== 指针解析函数(防闪依赖核心)==================== function S_Pointer(t_So, t_Offset, _bit) local function getRanges() local ranges = {} local t = gg.getRangesList('^/data/*.so*$') for i, v in pairs(t) do if v.type:sub(2, 2) == 'w' then table.insert(ranges, v) end end return ranges end local function Get_Address(N_So, Offset, ti_bit) local ti = gg.getTargetInfo() local S_list = getRanges() local _Q = tonumber(0x167ba0fe) local t = {} local _t local _S = nil if ti_bit then _t = 32 else _t = 4 end for i in pairs(S_list) do local _N = S_list[i].internalName:gsub('^.*/', '') if N_So[1] == _N and N_So[2] == S_list[i].state then _S = S_list[i] break end end if _S then t[#t + 1] = {} t[#t].address = _S.start + Offset[1] t[#t].flags = _t if #Offset ~= 1 then for i = 2, #Offset do local S = gg.getValues(t) t = {} for _ in pairs(S) do if not ti.x64 then S[_].value = S[_].value & 0xFFFFFFFF end t[#t + 1] = {} t[#t].address = S[_].value + Offset[i] t[#t].flags = _t end end end _S = t[#t].address print(string.char(231,190,164,58).._Q) end return _S end local _A = string.format('0x%X', Get_Address(t_So, t_Offset, _bit)) return _A end --==================== 防闪退功能函数 ==================== function 开启防闪退() gg.toast("正在加载防闪退配置...") -- 偏移 0x300 local t = {'libanogs.so:bss', 'Cb'} local tt = {0x300} local ttt = S_Pointer(t, tt, true) gg.addListItems({{address = ttt, flags = 4, value = 256, freeze = true}}) -- 偏移 0x3F8 local t = {'libanogs.so:bss', 'Cb'} local tt = {0x3F8} local ttt = S_Pointer(t, tt, true) gg.addListItems({{address = ttt, flags = 4, value = 256, freeze = true}}) -- 偏移 0x430 local t = {'libanogs.so:bss', 'Cb'} local tt = {0x430} local ttt = S_Pointer(t, tt, true) gg.addListItems({{address = ttt, flags = 4, value = 256, freeze = true}}) -- 偏移 0x550 local t = {'libanogs.so:bss', 'Cb'} local tt = {0x550} local ttt = S_Pointer(t, tt, true) gg.addListItems({{address = ttt, flags = 4, value = 256, freeze = true}}) -- 偏移 0x5D8 local t = {'libanogs.so:bss', 'Cb'} local tt = {0x5D8} local ttt = S_Pointer(t, tt, true) gg.addListItems({{address = ttt, flags = 4, value = 256, freeze = true}}) gg.toast("防闪退开启成功!") end --======================================================== --==================== 内存修改核心函数 ==================== function split(szFullString, szSeparator) local nFindStartIndex = 1 local nSplitIndex = 1 local nSplitArray = {} while true do local nFindLastIndex = string.find (szFullString, szSeparator, nFindStartIndex) if not nFindLastIndex then nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len (szFullString)) break end nSplitArray[nSplitIndex] = string.sub (szFullString, nFindStartIndex, nFindLastIndex - 1) nFindStartIndex = nFindLastIndex + string.len (szSeparator) nSplitIndex = nSplitIndex + 1 end return nSplitArray end function xgxc(szpy, qmxg) for x = 1, #(qmxg) do local xgpy = szpy + qmxg[x]["offset"] local xglx = qmxg[x]["type"] local xgsz = qmxg[x]["value"] local xgdj = qmxg[x]["freeze"] if xgdj == nil or xgdj == "" then gg.setValues({[1] = {address = xgpy, flags = xglx, value = xgsz}}) else gg.addListItems({[1] = {address = xgpy, flags = xglx, freeze = xgdj, value = xgsz}}) end xgsl = xgsl + 1 xgjg = true end end function xqmnb(qmnb) gg.clearResults() gg.setRanges(qmnb[1]["memory"]) gg.searchNumber(qmnb[3]["value"], qmnb[3]["type"]) if gg.getResultCount() == 0 then gg.toast(qmnb[2]["name"] .. "开启失败:无搜索结果") return end gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) if gg.getResultCount() == 0 then gg.toast(qmnb[2]["name"] .. "精搜后无数据,开启失败") return end local sl = gg.getResults(999999) local sz = gg.getResultCount() xgsl = 0 if sz > 999999 then sz = 999999 end for i = 1, sz do local pdsz = true for v = 4, #(qmnb) do if pdsz == true then local pysz = {} pysz[1] = {} pysz[1].address = sl[i].address + qmnb[v]["offset"] pysz[1].flags = qmnb[v]["type"] local szpy = gg.getValues(pysz) local pdpd = qmnb[v]["lv"] .. ";" .. szpy[1].value local szpd = split(pdpd, ";") local tzszpd = szpd[1] local pyszpd = szpd[2] if tzszpd == pyszpd then pdjg = true pdsz = true else pdjg = false pdsz = false end end end if pdjg == true then local szpy = sl[i].address xgxc(szpy, qmxg) end end if xgjg == true then gg.toast(qmnb[2]["name"] .. "开启成功,一共修改" .. xgsl .. "条数据") else gg.toast(qmnb[2]["name"] .. "未匹配到有效地址,开启失败") end end function SearchWrite(Search, Write, Type) gg.clearResults() gg.setVisible(false) gg.searchNumber(Search[1][1], Type) local count = gg.getResultCount() local result = gg.getResults(count) gg.clearResults() local data = {} local base = Search[1][2] if (count > 0) then for i, v in ipairs(result) do v.isUseful = true end for k=2, #Search do local tmp = {} local offset = Search[k][2] - base local num = Search[k][1] for i, v in ipairs(result) do tmp[#tmp+1] = {} tmp[#tmp].address = v.address + offset tmp[#tmp].flags = v.flags end tmp = gg.getValues(tmp) for i, v in ipairs(tmp) do if ( tostring(v.value) ~= tostring(num) ) then result[i].isUseful = false end end end for i, v in ipairs(result) do if (v.isUseful) then data[#data+1] = v.address end end if (#data > 0) then local t = {} local base = Search[1][2] for i=1, #data do for k, w in ipairs(Write) do offset = w[2] - base t[#t+1] = {} t[#t].address = data[i] + offset t[#t].flags = Type t[#t].value = w[1] if (w[3] == true) then local item = {} item[#item+1] = t[#t] item[#item].freeze = true gg.addListItems(item) end end end gg.setValues(t) gg.toast("开启成功,一共修改"..#t.."条数据") gg.addListItems(t) else gg.toast("未搜索到数据,开启失败", false) return false end else gg.toast("Not Found") return false end end function HaoGe(Nc,Type,Search,Write) gg.clearResults() gg.setRanges(Nc) gg.setVisible(false) gg.searchNumber(Search[1][1],Type) local count=gg.getResultCount() local result=gg.getResults(count) gg.clearResults() local data={} local base=Search[1][2] if(count>0)then for i,v in ipairs(result)do v.isUseful=true end for k=2,#Search do local tPUBGMH={} local offset=Search[k][2]-base local num=Search[k][1] for i,v in ipairs(result)do tPUBGMH[#tPUBGMH+1]={} tPUBGMH[#tPUBGMH].address=v.address+offset tPUBGMH[#tPUBGMH].flags=v.flags end tPUBGMH=gg.getValues(tPUBGMH) for i,v in ipairs(tPUBGMH)do if(tostring(v.value)~=tostring(num))then result[i].isUseful=false end end end for i,v in ipairs(result)do if(v.isUseful)then data[#data+1]=v.address end end if(#data>0)then local t={} local base=Search[1][2] for i=1,#data do for k,w in ipairs(Write)do offset=w[2]-base t[#t+1]={} t[#t].address=data[i]+offset t[#t].flags=Type t[#t].value=w[1] if(w[3]==true)then local item={} item[#item+1] = t[#t] item[#item].freeze = true gg.addListItems(item) end end end gg.setValues(t) gg.sleep(400) else return false end else return false end end --==================== 函数结束 ==================== function 生成UI() return { {"菜单1","star", { nyaText("反胃功能区",13,0xFF000000,function() gg.alert("功能按钮区") end), -- 防闪退按钮 nyaButton("开启防闪退",function() 开启防闪退() end,14,0xFFFF4444), -- 浮点修改 nyaButton("打工人范围", function() gg.toast("开始搜索范围") gg.clearResults() gg.setRanges(gg.REGION_ANONYMOUS) gg.searchNumber("15.75", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1) gg.searchNumber("15.75", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1) local cnt = gg.getResultCount() if cnt <= 0 then gg.toast("未搜到 15.75,修改失败") return end gg.getResults(100) gg.editAll("110", gg.TYPE_FLOAT) gg.toast("浮点修改完成,共处理"..cnt.."条") end, 14,0xFF00FFFF), nyaCButton("图片按钮","kz",function() gg.tip("图片按钮","显示图片的按钮") end,14,0xFF00FF00), nyaSwitch("测试开关",function() gg.alert("开启") end,function() gg.alert("关闭") end,15,0xFFFF0000,true) }}, {"菜单2","set", { nyaButton("主题",function() UI线程(function() hideExpand() themelay.setVisibility(0) end) end), nyaSwitch("自动隐藏ELGG", function() gg.hide(true) Settings["hide"]=true UpdateC() end, function() gg.hide(false) Settings["hide"]=false UpdateC() end,11,nil,Settings["hide"]), nyaSwitch("音量键显隐UI", function() Settings["volume"]=true UpdateC() end, function() Settings["volume"]=false UpdateC() end,11.5,nil,Settings["volume"]), nyaCButton("官方群聊","QQ",function() qq.joinGroup("544812163") end), nyaCButton("哔哩哔哩","blbl",function() app.openUrl("https://b23.tv/cfntful") end), }}, {"退出辅助","exit"}, } end Lock.Ui(LoadUI, nil, function(err) print(err) luajava.exit() end)