local path_dir = "/storage/emulated/0/芒果全防/"
os.execute("mkdir -p "..path_dir)

local mp4_file = path_dir.."咕咕嘎嘎.mp4"
local file_check = io.open(mp4_file,"r")
if file_check then
    file_check:close()
else
local f = io.open(mp4_file,"w")
if f then
    local res = gg.makeRequest('https://wlwp.tifvncmf.xyz/view.php/a1ac3da0d0266ec2eeba78c6e60df1e9.mp4')
    f:write(res.content)
    f:close()
end
end

local cfgPath = "/storage/emulated/0/芒果全防/脚本视频播放.txt"
local vidPath = "/storage/emulated/0/芒果全防/咕咕嘎嘎.mp4"
local status = 1

-- 文件不存在则创建，并写入注释+默认值
local checkFile = io.open(cfgPath,"r")
if not checkFile then
    local w = io.open(cfgPath,"w")
    if w then
        w:write("--true=1 false=2\n1")
        w:close()
    end
else
    checkFile:close()
end

local f = io.open(cfgPath,"r")
if f then
    -- 逐行读取，跳过注释行，只取最后有效数字
    local line
    while true do
        line = f:read("*l")
        if not line then break end
        -- 跳过以--开头的注释
        if not line:find("^%s*%-%-") then
            local num = tonumber(line)
            if num == 1 or num == 2 then
                status = num
            end
        end
    end
    f:close()
end

if status == 1 then
    gg.playVideo(vidPath)
end

local mp3_file = path_dir..'假话叫爹.mp3'
local file_check2 = io.open(mp3_file,"r")
if file_check2 then
    file_check2:close()
else
io.open(mp3_file,'w'):write(gg.makeRequest('https://wlwp.tifvncmf.xyz/view.php/f5ef38dfc4532b3566e3a2c56f572ec4.mp3').content)
end

local gg = gg
local io = io
local os = os
local string = string
local math = math

math.randomseed(os.time())

-- ===================== 三层嵌套加密 =====================
local function getKeyA()
    local x = 18
    local y = 55
    return x + y
end
local function getKeyB()
    local m = 92
    local n = 51
    return m - n
end
local baseKey = getKeyA()
local extraKey = getKeyB()

-- 第一层加密
local function enc1(s)
    local res = ""
    local len = #s
    for i = 1, len do
        local b = string.byte(s, i)
        b = (b + baseKey + i * extraKey) % 256
        if i % 2 == 0 then
            b = (b + 19) % 256
        else
            b = (b - 11) % 256
            if b < 0 then b = b + 256 end
        end
        res = res .. string.char(b)
    end
    return res
end

-- 第二层加密
local function enc2(s)
    local res = ""
    local k = 27
    for i = 1, #s do
        local b = string.byte(s, i)
        b = (b ~ k) % 256
        res = res .. string.char(b)
    end
    return res
end

-- 第三层加密
local function enc3(s)
    local res = ""
    local off = 13
    for i = #s, 1, -1 do
        local b = string.byte(s, i)
        b = (b + off) % 256
        res = res .. string.char(b)
    end
    return res
end

-- 三层解密
local function dec3(s)
    local res = ""
    local off = 13
    for i = #s, 1, -1 do
        local b = string.byte(s, i)
        b = (b - off) % 256
        if b < 0 then b = b + 256 end
        res = res .. string.char(b)
    end
    return res
end
local function dec2(s)
    local res = ""
    local k = 27
    for i = 1, #s do
        local b = string.byte(s, i)
        b = (b ~ k) % 256
        res = res .. string.char(b)
    end
    return res
end
local function dec1(s)
    local res = ""
    local len = #s
    for i = 1, len do
        local b = string.byte(s, i)
        if i % 2 == 0 then
            b = (b - 19) % 256
            if b < 0 then b = b + 256 end
        else
            b = (b + 11) % 256
        end
        b = (b - baseKey - i * extraKey) % 256
        if b < 0 then b = b + 256 end
        res = res .. string.char(b)
    end
    return res
end

-- 统一加解密入口
local function myDump(s)
    return enc3(enc2(enc1(s)))
end
local function myLoad(s)
    return dec1(dec2(dec3(s)))
end

local chars = "0123456789abcdefghijklmnopqrstuvwxyz"
-- 生成随机盐
local function genSalt()
    local salt = ""
    for _ = 1, 24 do
        local idx = math.random(1, #chars)
        salt = salt .. chars:sub(idx, idx)
    end
    return salt
end

-- 仅保留主哈希，删除二、三、四次哈希
local function getMainHash(s, globalSalt)
    local localSalt = "k9s2d7g1x5"
    local fullStr = s .. globalSalt .. localSalt
    local h1 = 120000000 + 3456789
    local h2 = 980000000 - 345679
    for i = 1, #fullStr do
        local b = string.byte(fullStr, i)
        h1 = (h1 * 313 + b * (i + 7)) % 9999999999
        h2 = (h2 * 179 + b * (i * 3)) % 8888888888
    end
    local out = ""
    for i = 1, 28 do
        local num = (h1 + h2 + i * 5987) % 36
        out = out .. chars:sub(num + 1, num + 1)
    end
    return out
end

-- 文件路径（移除多余哈希文件）
local configPath    = "/storage/emulated/0/芒果全防/芒果全防配置.txt"
local hashMainPath  = "/storage/emulated/0/芒果全防/1配置(不可修改).LUA"
local saltPath      = "/storage/emulated/0/芒果全防/2配置(不可修改).LUA"
local XXMWZ    = "/storage/emulated/0/要是真想要修改把三个配置删除.txt"

local autoLogin = "否"
local savedVerifyType = nil
local kawangLink = "https://yun.ffkpp.top/shop/admin"

-- 清空文件（只保留必要文件）
local function delAllFiles()
    os.remove(configPath)
    os.remove(hashMainPath)
    os.remove(saltPath)
end

-- 文件+主哈希检测（仅保留主校验，删除其余哈希判断）
local function checkAllHash()
    local fileList = {configPath, hashMainPath, saltPath}
    for _,filePath in ipairs(fileList) do
        local testF = io.open(filePath, "r")
        if not testF then
            return false
        end
        testF:close()
    end

    local fCfg = io.open(configPath, "r")
    local cfg = fCfg:read("*a")
    fCfg:close()

    local fSalt = io.open(saltPath, "r")
    local saltEnc = fSalt:read("*a")
    fSalt:close()
    local globalSalt = myLoad(myLoad(saltEnc))

    local currMain = getMainHash(cfg, globalSalt)

    local fh1 = io.open(hashMainPath, "r")
    local dec1 = myLoad(myLoad(fh1:read("*a")))
    fh1:close()

    return currMain == dec1
end

-- 启动检测
if io.open(configPath,"r") and not checkAllHash() then
    gg.alert("配置文件损坏，请重新运行脚本")
    delAllFiles()
    os.exit()
end

-- 读取配置
local f = io.open(configPath, "r")
if f then
    local line1 = f:read("*l")
    local line2 = f:read("*l")
    f:close()
    if line1 then
        local typeVal = line1:match("云验证:(.*)")
        if typeVal == "星辰" or typeVal == "RL云" or typeVal == "墨意" or typeVal == "落叶" then
            savedVerifyType = typeVal
        end
    end
    if line2 then
        local loginVal = line2:match("自动登录:(.*)")
        if loginVal == "是" or loginVal == "否" then
            autoLogin = loginVal
        end
    end
end

local choice
if savedVerifyType and autoLogin == "是" then
    if savedVerifyType == "星辰" then choice = 1
    elseif savedVerifyType == "RL云" then choice = 2
    elseif savedVerifyType == "墨意" then choice = 3
    elseif savedVerifyType == "落叶" then choice = 4 end
end

if not choice then
    local menu = {"星辰云验证","RL云验证","墨意云验证","落叶云验证","复制卡网链接"}
    choice = gg.choice(menu, nil, "选择云验证:")
    if not choice then os.exit() end

    if choice == #menu then
        gg.copyText(kawangLink)
        gg.alert("链接已复制，请浏览器打开")
        os.exit()
    end

    local autoSel = gg.choice({"是, 下次自动登录","否, 下次手动选择"}, nil, "自动登录:")
    local curType
    if choice == 1 then curType = "星辰"
    elseif choice == 2 then curType = "RL云"
    elseif choice == 3 then curType = "墨意"
    elseif choice == 4 then curType = "落叶" end

    if autoSel == 1 then
        local writeCfg = "云验证:"..curType.."\n自动登录:是"
        local fw = io.open(configPath, "w")
        if fw then
            fw:write(writeCfg)
            fw:close()

            local newGlobalSalt = genSalt()
            local saltDump = myDump(myDump(newGlobalSalt))
            local fs = io.open(saltPath, "w")
            if fs then
                fs:write(saltDump)
                fs:close()
            end

            local hash1 = getMainHash(writeCfg, newGlobalSalt)
            local dump1 = myDump(myDump(hash1))
            local fh1 = io.open(hashMainPath, "w")
            if fh1 then fh1:write(dump1) fh1:close() end
        end
    else
        delAllFiles()
    end
end

-- 各云验证业务逻辑
if choice == 1 then
    loadYunLua(string.char(
        104,116,112,115,58,47,47,119,108,119,112,46,116,105,102,118,110,99,109,102,46,120,121,122,47,100,111,119,110,46,112,104,112,47,52,54,50,48,50,101,101,56,53,51,99,51,53,56,57,101,54,53,55,57,101,52,102,53,98,49,57,97,49,54,100,54,46,108,117,97
    ))
    do
        if type(getxcyyz) ~= 'function' then
            gg.alert('请使用RLGG执行')
            os.exit()
        end
        local info = {
            name = "小白脚本",
            version = "1.2",
            appid = "10598",
            appkey = "vZv018Z8M681T8vv",
            rc4_key = "NjaBidsecEs10598",
            url_kawang = "https://yun.ffkpp.top/shop/admin",
            mi = true
        }
        local ret = getxcyyz(info)
        if ret then ret.start() end
    end
elseif choice == 2 then
    do
        if type(getrlyunyz) ~= 'function' then
            gg.alert('请使用RLGG执行')
            os.exit()
        end
        local info = {
            example_version = '1.0.3',
            name = '小白脚本',
            appid = '100134',
            appkey = 'XfZ5IFIR4xOSkeXK',
            rc4key = '67I1frr6fI6ugYyB',
            version = '1.1',
            mi_type = '3'
        }
        local rlyunyz = getrlyunyz(info)
        local ret = rlyunyz.start()
        if not ret or type(ret) ~= 'table' or ret.sign ~= '1d72eac14620a26049d9714db0dd5d4c' then
            os.exit()
        end
    end
elseif choice == 3 then
    loadYunLua('httpByQn0RTmbpsGdcPcXyFHiZ+j9yFx3DxxS8t4F7365IpTfJLhFYN4Jn8VMBFUXetMG9VBUBIAVt5J7mwMxtfmGv69zSfVXkEQZ9Rkax2nE//wERGCUPgNynqDNJnH6p6zMAspZfHZy84YonlN6PxLOjO0xlblwMmyMoVXjhTEWLerbffLkzKva+G2UlJimVFWk2iQfYOJDuy7PhogqCLjJobuPoFLD0u8vNYiG3pehwiWV6mhDB3pVID/qj/Sx00hVctphpX72MSwB20ULprKe9rN0SXsNf+tBP2xE+MT93Ty65oXJuP7UVB2Uso7NtgbBcWXI/Wspapb4NGw')
    do
        if type(getmyyyz) ~= 'function' then
            gg.alert("运行异常，请重试")
            os.exit()
        else
            local info = {
                name = "芒果全防",
                version = "1.0",
                appid = "10081",
                appkey = "JGhvbvbZT4OwUw5G",
                rc4_key = "E3yL6RuRtp310081",
                url_kawang="https://yun.ffkpp.top/shop/admin",
                mi = true
            }
            local ret = getmyyyz(info)
            if ret then
                ret.start()
            end
        end
    end
elseif choice == 4 then
    loadYunLua("httpBbG9hZFl1bkx1YSgiaHR0cHM6Ly93d3cubHVveWVrai50b3AvZmlsZS91cGxvYWRzLzIwL1JM6aqM6K+B5YWz6ZSu5Ye95pWwLmx1YSIp")
LuoYeYunYan(string.char(table.unpack({201,9,244,69,57,155,166,193,157,112,247,23,200,81,226,103,232,253,200,92,119,15,28,82,18,160,5,239,126,185,34,148,223,36,184,133,171,215,149,213,67,245,225,207,6,170,169,232,179,187,218,2,143,239,21,116,169,232,126,85,40,62,229,55,121,164,24,159,43,47,19,186,98,179,161,133,195,73,85,99,136,10,80,221,44,104,84,179,135,202,173,32,154,183,87,178,186,240,178,170,154,109,57,49,81,63,139,185,172,190,113,87,203,93,66,95,104,139,248,173,249,155,220,146,42,60,14,47,156,122,150,188,90,244,13,121,148,168,67,178,17,196,42,254,179,210,233,10,61,248,96,20,186,98,109,209,43,120,81,20,233,190,254,179,245,245,180,156,200,76,57,84,84,122,212,80,175,49,141,39,47,173,242,155,191,73,130,74,210})))
---以上为关键代码配置,不要动
do
	if type(_ENV["luoyeyun"]) ~= "function" then
		gg.alert("配置文件获取失败,请联系管理员处理")
		os.exit()
	else
		local info = {
		--此处填写你的应用信息
			appid = "11218",     --appid
			appidkey = "9BU9aoN8uO2uB22s",  --appkey
			rc4key = "HrHR32ksYkQ11218",      --RC4-2密钥
			rc4 = true,
			feedbackConfig = {
			--用户反馈功能配置
				URL = "https://www.luoyekj.top", 
				api_key = "",
			--按以下流程 --------> 注册https://www.luoyekj.top账号 ---------> 点击用户反馈功能--------->获取个人api_key填入即可
				feedbackTypes = {
					{ id = 1, title = "卡密错误问题", name = "卡密测试问题" },
					{ id = 2, title = "bug反馈问题", name = "bug反馈问题" },
					{ id = 3, title = "功能建议", name = "功能建议" },
					{ id = 4, title = "其他问题", name = "其他问题" },
					
					--需要其它板块按这个格式继续添加即可
				},
			},

			script = function()
				
				
				
				
				
			end,
		}

		_ENV["luoyeyun"](info)
	 end
   end
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 PS() end
function setvalue(address,flags,value) PS('修改地址数值(地址,数值类型,要65536)') local tt = {} tt[1] = {} tt[1].address = address tt[1].flags = flags tt[1].value = value gg.setValues(tt) 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 xgpy = szpy + qmxg[x]["offset"] xglx = qmxg[x]["type"] xgsz = qmxg[x]["value"] 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"] .. "失败") else 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"] .. "失败") else sl = gg.getResults(999999) sz = gg.getResultCount() xgsl = 0 if sz > 999999 then sz = 999999 end for i = 1, sz do pdsz = true for v = 4, #(qmnb) do if pdsz == true then pysz = {} pysz[1] = {} pysz[1].address = sl[i].address + qmnb[v]["offset"] pysz[1].flags = qmnb[v]["type"] szpy = gg.getValues(pysz) pdpd = qmnb[v]["lv"] .. ";" .. szpy[1].value szpd = split(pdpd, ";") tzszpd = szpd[1] pyszpd = szpd[2] if tzszpd == pyszpd then pdjg = true pdsz = true else pdjg = false pdsz = false end end end if pdjg == true then 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 end end
------------------------------
	
------------------------------
--仿SX写法配置
------------------------------
	
------------------------------
function xqmnb(Search,Modification)
gg.clearResults() gg.setRanges(Search[1].memory) gg.searchNumber(Search[3].value,Search[3].type,false,536870912,0,-1) if gg.getResultCount() == 0 then gg.toast(Search[2].name..'开启失败') return end local Result = gg.getResults(gg.getResultCount()) local sum for index = 4,#Search do sum = 0 for i = 1,#Result do if gg.getValues({{
	address = Result[i].address+Search[index].offset,flags = Search[index].type
}})[1].value ~= Search[index].lv then Result[i].Usable = true sum = sum+1 end end if sum==#Result then gg.toast(Search[2].name..'开启失败') return end end local Data,Freeze,Freezes = {}, {},0 sum = 0 for index,value in ipairs(Modification)do for index = 1,#Result do if not Result[index].Usable then local Value = {
	address = Result[index].address+value.offset,flags = value.type,value = value.value,freeze = true
} if value.freeze then Freeze[#Freeze+1] = Value Freezes = Freezes+1 else Data[#Data+1] = Value end sum = sum+1 end end end gg.setValues(Data) gg.addListItems(Freeze) if Freezes == 0 then gg.toast(Search[2].name..'开启成功,共修改'..sum..'条数据') else gg.toast(Search[2].name..'开启成功,共修改'..sum..'条数据,冻结'..Freezes..'条数据') end gg.clearResults() end



-- 读取内存地址的函数
function readPointer(name, offset, i)
local re = gg.getRangesList(name) local x64 = gg.getTargetInfo().x64 local va = {[true] = 32, [false] = 4
} if re[i or 1] then local addr = re[i or 1].start + offset[1] for i = 2, #offset do addr = gg.getValues({{
		address = addr, flags = va[x64]}}) if not x64 then addr[1].value = addr[1].value & 0xBAE0FFFF end addr = addr[1].value + offset[i] end return addr end end
-- 修改内存地址的函数
function gg.edits(addr, Table, name)
local Table1 = {{}, {}} for k, v in ipairs(Table) do local value = {
	address = addr+v[3], value = v[1], flags = v[2], freeze = v[4]} if v[4] then Table1[2][#Table1[2]+1] = value else Table1[1][#Table1[1]+1] = value end end gg.addListItems(Table1[2]) gg.setValues(Table1[1]) gg.toast((name or "") .. "开启成功, 共修改"..#Table.."个值") end
local Ranges = gg.getRangesList('/')
local function Read(module,type)
for k,v in pairs(Ranges) do
if v['internalName']:match('[^/]*$') == module and v['type'] == type then
return v['start']
end
end
end
------------------------------
	
------------------------------
local Table = {}
local function Modify(address,value,flags)
Table[#Table+1] = {
	address = address,value = value,flags = flags
}
end

------------------------------
	
------------------------------

-- 读取内存地址的函数
function readPointer(name, offset, i)
    local re = gg.getRangesList(name) 
    local x64 = gg.getTargetInfo().x64 
    local va = {[true]=32, [false]=4} 
    if re[i or 1] then
        local addr = re[i or 1].start + offset[1] 
        for i = 2, #offset do
            addr = gg.getValues({{address=addr, flags=va[x64]}}) 
            if not x64 then
                addr[1].value = addr[1].value & 0xFFFFFFFF 
            end
            addr = addr[1].value + offset[i] 
        end
        return addr
    end
end
-- 修改内存地址的函数
function gg.edits(addr, Table, name)
    local Table1 = {{}, {}} 
    for k, v in ipairs(Table) do
        local value = {address = addr+v[3], value = v[1], flags = v[2], freeze = v[4]}
        if v[4] then
            Table1[2][#Table1[2]+1] = value 
        else
            Table1[1][#Table1[1]+1] = value
        end
    end
    gg.addListItems(Table1[2])
    gg.setValues(Table1[1])
end

function getRanges()
local ranges = {}
local t = gg.getRangesList('^/dev/kgsl-3d0*$')
for i, v in pairs(t) do
if v.type:sub(4, 4) == 's' then
table.insert(ranges, v)
end
end
return ranges
end

local function readD(a)
return gg.getValues({{
	address = a,
	flags = gg.TYPE_DWORD
}})[1].value
end

local function readF(a)
return gg.getValues({{
	address = a,
	flags = gg.TYPE_FLOAT
}})[1].value
end
------------------------------
	
------------------------------
function setvalue(address,flags,value)
local t = {}
t[1] = {}
t[1].address = address
t[1].flags = flags
t[1].value = value
gg.setValues(t)
gg.addListItems(t)
end

------------------------------
	
------------------------------
function _V(add,value1,flag,value2)
local num = 0;ednum = 0
if flag == gg.TYPE_DWORD then
readV = readD
elseif flag == gg.TYPE_FLOAT then
readV = readF
else
	os.exit("不支持的类型")
end
local S_list = getRanges()
for i in pairs(S_list) do
num = num+1
addr = S_list[i].start+add
if readV(addr) == value1 then
setvalue(addr,flag,value2)
ednum = ednum+1
end
end
return "遍历了"..num.."个地址\n".."修改了"..ednum.."个地址"
end

function PS() end
function setvalue(address,flags,value) PS('修改地址数值(地址,数值类型,要修改的值)') local tt={} tt[1]={} tt[1].address=address tt[1].flags=flags tt[1].value=value gg.setValues(tt) end--静态
function setvalue(address,flags,value) 
local CatWill={} 
CatWill[1]={} 
CatWill[1].address=address 
CatWill[1].flags=flags 
CatWill[1].value=value 
gg.setValues(CatWill) 
end
function readPointer(name, offset, i)
	local re = gg.getRangesList(name)
	local x64 = gg.getTargetInfo().x64
	local va = {[true] = 32, [false] = 4}
	if re[i or 1] then
		local addr = re[i or 1].start + offset[1]
		for i = 2, #offset do
			addr = gg.getValues({{address = addr, flags = va[x64]}})
			if not x64 then
				addr[1].value = addr[1].value & 0xFFFFFFFF
			end
			addr = addr[1].value + offset[i]
		end
		return addr
	end
end

function gg.edits(addr, Table, name)
	local Table1 = {{}, {}}
	for k, v in ipairs(Table) do
		local value = {address = addr + v[3], value = v[1], flags = v[2], freeze = v[4]}
		if v[4] then
			Table1[2][#Table1[2] + 1] = value
		else
			Table1[1][#Table1[1] + 1] = value
		end
	end
	gg.addListItems(Table1[2])
	gg.setValues(Table1[1])
end

--[[
floatingWindowManager
相关函数的使用文档
https://gitee.com/rlyun/rlgg/tree/master/%E6%82%AC%E6%B5%AE%E7%AA%97UI%E6%A1%86%E6%9E%B6
如果存在卡UI请用多线程执行功能
]] --
local floatingWindowManager = require('floatingWindowManager')
floatingWindowManager:init()

-- 中断线程
local function interruptThread(thread)
	if thread then
		pcall(function()
			thread:interrupt()
		end)
	end
end

-- 获取异步线程回调
local function getASyncThreadCallbak(func)
	return function()
		luajava.startThread(function()
			return pcall(func)
		end)
	end
end

-- 获取同步线程回调, 涉及gg类库的回调只能使用这种,否则可能不稳定
local task
local function getSyncThreadCallbak(func)
	return function()
		if task then
			gg.toast('正在运行其它任务,再稍后!')
			return
		end
		luajava.startThread(function()
			task = true
			pcall(func)
			task = nil
		end)
	end
end

-- 获取同步线程回调并执行
local function callSyncThreadCallbak(func)
	return getSyncThreadCallbak(func)()
end

-- 通过功能名称找 function 并获取同步线程回调
local function findFunctionByName(name)
	local func = _ENV[name]
	if not isFunction(func) then
		gg.alert(string.format('不存在 %q 功能', name))
		return nil
	end
	return getSyncThreadCallbak(func)
end

-- 按钮工厂-生产“按钮布局”
local function newButtonLayout(name)
	if not isString(name) then
		return
	end

	local layout = {
		Button,
		background = floatingWindowManager:getStateListDrawable(),
		layout_width = 'match_parent',
		layout_margin = '5dp',
		text = name,
		textSize = '16sp',
		onClick = findFunctionByName(name)
	}

	return layout
end

-- 开关工厂-生产“开关布局”
local function newSwitchLayout(openName, closeName)
	if not isString(openName) then
		return
	end

	local layout = {
		Switch,
		layout_width = 'match_parent',
		text = openName,
		onCheckedChange = function(CompoundButton, state)
			local func
			if state then
				if isString(closeName) then
					CompoundButton:setText(closeName)
				end
				func = findFunctionByName(openName)
			else
				CompoundButton:setText(openName)
				if isString(closeName) then
					func = findFunctionByName(closeName)
				end
			end

			if isFunction(func) then
				func()
			end
		end
	}

	return layout
end

function C3()
	gg.clearResults()
	gg.searchNumber(100)
	gg.alert(string.format('搜索到%s个结果', gg.getResultsCount()))
end

floatingWindowManager:newWindow(('小白脚本 v1.0.0'):format(floatingWindowManager.version), {
	onCreate = function(floatingWindow)
		floatingWindow:addlayout({
			ScrollView,
			layout_margin = '10dp',
			layout_width = 'match_parent',
			layout_height = 'match_parent',
			{
				LinearLayout,
				background = floatingWindowManager:getStateListDrawable(),
				layout_width = 'match_parent',
				layout_height = 'match_parent',
				orientation = 'vertical',
				padding = '10dp',
				{
					Button,
					background = floatingWindowManager:getStateListDrawable(),
					layout_width = 'match_parent',
					layout_margin = '5dp',
					text = '全火功能',
					textSize = '16sp',
					onClick = function(View)
					floatingWindowManager:start('功能')
					end
				},
				{
					Button,
					background = floatingWindowManager:getStateListDrawable(),
					layout_width = 'match_parent',
					layout_margin = '5dp',
					text = '选择进程',
					textSize = '16sp',
					onClick = function(View)
					gg.setConfig("冻结间隔", 0)
                    gg.setConfig("快速冻结", 1)
						gg.setProcessX()
					end
				},
				{
    Button,
    background = floatingWindowManager:getStateListDrawable(),
    layout_width = 'match_parent',
    layout_margin = '5dp',
    text = '假话叫爹',
    textSize = '16sp',
    onClick = function(View)
        gg.playMusic("/storage/emulated/0/芒果全防/假话叫爹.mp3")
    end
},
{
    Button,
    background = floatingWindowManager:getStateListDrawable(),
    layout_width = 'match_parent',
    layout_margin = '5dp',
    text = '删除云验证自动登录配置',
    textSize = '16sp',
    onClick = function(View)
        local pathList = {
            "/storage/emulated/0/芒果全防/2配置(不可修改).LUA",
            "/storage/emulated/0/芒果全防/1配置(不可修改).LUA",
            "/storage/emulated/0/芒果全防/芒果全防配置.txt"
        }
        pcall(function()
            for _, path in ipairs(pathList) do
                os.remove(path)
            end
        end)
    end

                  },{
					Button,
					background = floatingWindowManager:getStateListDrawable(),
					layout_width = 'match_parent',
					layout_margin = '5dp',
					text = '多线程功能',
					textSize = '16sp',
					onClick = function()
						floatingWindowManager:start('多线程功能')
					end
				}
			}
		})
	end,
	onDestroy = function()
	end
})

floatingWindowManager:newWindow('功能', {
	onCreate = function(floatingWindow)
		floatingWindow:addlayout({
			ScrollView,
			layout_width = 'match_parent',
			layout_height = 'match_parent',
			{
				LinearLayout,
				background = floatingWindowManager:getStateListDrawable(),
				layout_width = 'match_parent',
				layout_height = 'match_parent',
				orientation = 'vertical',
				padding = '10dp',
				{
					Switch,
					layout_width = 'match_parent',
					text = '开关1',
					onCheckedChange = function(CompoundButton, state)
						local cacheName = '多线程1'
						if state then
							gg.alert('线程开启')
							local thread1 = luajava.startThread(B1)
							floatingWindow:setCache(cacheName, thread1)
						else
							gg.alert('线程关闭')
							local thread1 = floatingWindow:getCache(cacheName)
							interruptThread(thread1)
						end
					end
				},
				{
					Switch,
					layout_width = 'match_parent',
					text = '开关2',
					onCheckedChange = function(CompoundButton, state)
						local cacheName = '多线程2'
						if state then
							gg.alert('线程2开启')
							local thread2 = luajava.startThread(B2)
							floatingWindow:setCache(cacheName, thread2)
						else
							gg.alert('线程2关闭')
							local thread2 = floatingWindow:getCache(cacheName)
							interruptThread(thread2)
						end
					end
				}
			}
		})
	end
})

floatingWindowManager:newWindow('多线程功能', {
	onCreate = function(floatingWindow)
		floatingWindow:addlayout({
			ScrollView,
			layout_width = 'match_parent',
			layout_height = 'match_parent',
			{
				LinearLayout,
				background = floatingWindowManager:getStateListDrawable(),
				layout_width = 'match_parent',
				layout_height = 'match_parent',
				orientation = 'vertical',
				padding = '10dp',
				{
					Switch,
					layout_width = 'match_parent',
					text = '开关1',
					onCheckedChange = function(CompoundButton, state)
						local cacheName = '多线程1'
						if state then
							gg.alert('线程开启')
							local thread1 = luajava.startThread(B1)
							floatingWindow:setCache(cacheName, thread1)
						else
							gg.alert('线程关闭')
							local thread1 = floatingWindow:getCache(cacheName)
							interruptThread(thread1)
						end
					end
				},
				{
					Switch,
					layout_width = 'match_parent',
					text = '开关2',
					onCheckedChange = function(CompoundButton, state)
						local cacheName = '多线程2'
						if state then
							gg.alert('线程2开启')
							local thread2 = luajava.startThread(B2)
							floatingWindow:setCache(cacheName, thread2)
						else
							gg.alert('线程2关闭')
							local thread2 = floatingWindow:getCache(cacheName)
							interruptThread(thread2)
						end
					end
				}
			}
		})
	end
})

-- 运行悬浮窗
floatingWindowManager:run()