[ENABLE] {$lua} local signatures={paint="48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 54 41 55 41 56 41 57 48 83 EC 40 8B 84 24 98 00 00 00 49 8B F1 44 0F B6 BC 24 A8 00 00 00 49 8B E8 4C 8B A4 24 A0 00 00 00 4C 8B F2 4C 8B AC 24 90 00 00 00 48 8B F9 44 88 7C 24 38 4C 89 64 24 30 89 44 24 28 4C 89 6C 24 20 E8 ?? ?? ?? ?? 48 8B 8F ?? ?? ?? ?? 8B D8 48 85 C9 74 37 E8 ?? ?? ?? ??",objects="44 8B 49 04 45 85 C9 74 ?? 8B 01 85 C0 78 ?? 3B 05 ?? ?? ?? ?? 7D ?? 8B C8 0F B7 C0 48 C1 E9 10 48 8D 14 40 48 8B 05 ?? ?? ?? ?? 48 8B 0C C8 4C 8D 04 D1",world="48 8B 05 ?? ?? ?? ?? 48 85 C0 75 ?? 80 3D ?? ?? ?? ?? 02 72 ?? 48 8D 15 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 33 C0 48 83 C4 20 5B C3",names="89 03 48 8B C3 89 7B 04 48 8B 5C 24 48 48 83 C4 30 5F C3 80 3D ?? ?? ?? ?? 00 74 09 48 8D 05 ?? ?? ?? ?? EB 13 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? C6 05 ?? ?? ?? ?? 01 0F 28 44 24 20"} local state={pid=getOpenedProcessID(),nameCache={},classCache={}} local function ptr(p) return type(p)=='number' and p>0x10000 and p<0x7FFFFFFFFFFF end local function q(p) return ptr(p) and readQword(p) or nil end local function finite(x) return type(x)=='number' and x==x and math.abs(x)<1e12 end local function vector(p) if not ptr(p) then return end local x,y,z=readDouble(p),readDouble(p+8),readDouble(p+16) if finite(x) and finite(y) and finite(z) then return {x,y,z} end end local function array(p,limit) local data,num,cap=q(p),readInteger(p+8),readInteger(p+12) if not num or not cap or num>limit or cap1000000 then return end if num>0 and not ptr(data) then return end return data,num end local function exactString(p,n,wide) local bytes=readBytes(p,n*(wide and 2 or 1),true) if not bytes or #bytes~=n*(wide and 2 or 1) then return '' end if not wide then return string.char(table.unpack(bytes)) end local chars={};local i=1 while i<=#bytes do local unit=bytes[i]+bytes[i+1]*256;i=i+2 if unit>=0xD800 and unit<=0xDBFF and i<#bytes then local low=bytes[i]+bytes[i+1]*256 if low>=0xDC00 and low<=0xDFFF then unit=0x10000+(unit-0xD800)*1024+low-0xDC00;i=i+2 else unit=0xFFFD end elseif unit>=0xD800 and unit<=0xDFFF then unit=0xFFFD end if unit==0 then break end chars[#chars+1]=utf8.char(unit) end return table.concat(chars) end local function fname(p) local id=readInteger(p) if not id then return '' end local text=state.nameCache[id] if not text then local block=id>>16 if block>8191 then return '' end local b=q(state.namePool+0x10+block*8) if not ptr(b) then return '' end local entry=b+(id&0xFFFF)*2 local h=readSmallInteger(entry) if not h then return '' end local n=h>>6 if n<1 or n>1023 then return '' end text=exactString(entry+2,n,(h&1)~=0) if not text then return '' end state.nameCache[id]=text end local number=readInteger(p+4) if number and number>0 then text=text..'_'..tostring(number-1) end return text end local function fstring(p) local data,n=array(p,1024) if not data or n<2 then return '' end return exactString(data,n-1,true) end local function meta(cl) if not ptr(cl) then return end local nameId=q(cl+0x18) local super=q(cl+0x40) if not nameId or super==nil then return end local old=state.classCache[cl] if old and old.nameId==nameId and old.super==super then return old end local m={nameId=nameId,super=super,name=fname(cl+0x18)} state.classCache[cl]=m return m end local function properties(cl) local m=meta(cl);if not m then return {} end if m.fields then return m.fields end local fields={};local f=q(cl+0x50);local seen={} for i=1,512 do if not ptr(f) or seen[f] then break end seen[f]=true local off,size=readInteger(f+0x44),readInteger(f+0x34) if off and off<0x100000 and size and size<0x100000 then fields[fname(f+0x20)]={offset=off,size=size,type=q(f+0x70), byte=readBytes(f+0x71,1),mask=readBytes(f+0x72,1)} end f=q(f+0x10) end m.fields=fields;return fields end local function field(cl,name,required) local seen={} for i=1,32 do if not ptr(cl) or seen[cl] then break end seen[cl]=true local p=properties(cl)[name];if p then return p end local m=meta(cl);cl=m and m.super end if required then error('Missing reflected field: '..name) end end local function offset(cl,name) return field(cl,name,true).offset end local function classOf(a) return q(a+0x10) end local function nativeFunction(cl,name) local visited={} for i=1,32 do if not ptr(cl) or visited[cl] then break end visited[cl]=true local f=q(cl+0x48);local seen={} for j=1,1024 do if not ptr(f) or seen[f] then break end seen[f]=true if fname(f+0x18)==name then return q(f+0x128) end f=q(f+0x28) end local m=meta(cl);cl=m and m.super end end local function flag(a,f) if not f or not f.byte or not f.mask then return false end local b=readBytes(a+f.offset+f.byte,1) return b and (b&f.mask)~=0 end local function uniqueScan(pattern) local scan=createMemScan();local found=createFoundList(scan) local ok,result=pcall(function() local base=getAddress('PBZ.exe') scan.firstScan(soExactValue,vtByteArray,rtRounded,pattern,'',base,base+getModuleSize('PBZ.exe')-1, '+X',fsmNotAligned,'1',true,false,false,false) scan.waitTillDone();found.initialize() if found.Count~=1 then error('ESP signature expected 1 match; found '..found.Count) end return getAddress(found.Address[0]) end) found.destroy();scan.destroy() if not ok then error(result) end return result end local paint=uniqueScan(signatures.paint) local weak=uniqueScan(signatures.objects) local worldRef=uniqueScan(signatures.world) local worldSlot=worldRef+7+readInteger(worldRef+3,true) local poolRef=uniqueScan(signatures.names)+0x1C state.namePool=poolRef+7+readInteger(poolRef+3,true) local chunksSlot=weak+0x2B+readInteger(weak+0x27,true) local countSlot=weak+0x15+readInteger(weak+0x11,true) local chunks,num=q(chunksSlot),readInteger(countSlot) if not ptr(chunks) or not num or num<1 or num>8000000 then error('Map Fog: unsupported object-array layout') end local rootClass;local names={};local chunkCache={} for i=0,num-1 do local block=i>>16;local base=chunkCache[block] if not base then base=q(chunks+block*8);chunkCache[block]=base end if ptr(base) then local item=base+(i&0xFFFF)*24 local flags=readInteger(item+4) if flags and (flags&0x10200000)==0 then local a=q(item+8) if ptr(a) and readInteger(a+0xC)==i then local cl=classOf(a) if ptr(cl) then local n=names[cl] if not n then n=fname(cl+0x18);names[cl]=n end if n=='WB_MapNew_C' then rootClass=cl;break end end end end end end if not rootClass then error('Open the in-game map once, then enable Disable Map Fog again') end local region=field(rootClass,'MaskWidgetInstance',true) local overview=field(rootClass,'W_MapMask_BigMap',true) if region.size~=8 or overview.size~=8 or region.offset==overview.offset then error('Map Fog: unsupported fog widget fields') end local world=q(worldSlot) if not ptr(world) then error('Load a save before enabling Disable Map Fog') end local giOffset=offset(classOf(world),'OwningGameInstance') local gi=q(world+giOffset) if not ptr(gi) then error('Map Fog: local game instance unavailable') end local ownerOffset=readInteger(paint+0x63) if not ownerOffset or ownerOffset<0x100 or ownerOffset>0x1000 then error('Map Fog: unsupported Slate owner layout') end local bytes=readBytes(paint,15,true) local expected={0x48,0x89,0x5C,0x24,8,0x48,0x89,0x6C,0x24,0x10,0x48,0x89,0x74,0x24,0x18} if not bytes then error('Map Fog: paint entry is unreadable') end for i=1,15 do if bytes[i]~=expected[i] then error('Map Fog: paint prologue changed') end end local cfg={paint=paint,worldSlot=worldSlot,giOffset=giOffset,ownerOffset=ownerOffset, rootName=q(rootClass+0x18),regionOffset=region.offset,overviewOffset=overview.offset} local definitions={} local function define(name,value) definitions[#definitions+1]=('define(%s,%X)'):format(name,value) end define('PBZ_MF_Paint',cfg.paint);define('PBZ_MF_WorldSlot',cfg.worldSlot) define('PBZ_MF_GI',cfg.giOffset);define('PBZ_MF_WidgetObject',cfg.ownerOffset) define('PBZ_MF_MapRootName',cfg.rootName);define('PBZ_MF_RegionMask',cfg.regionOffset) define('PBZ_MF_OverviewMask',cfg.overviewOffset) return table.concat(definitions,'\n')..'\n'..[====[ alloc(PBZ_MF_Code,$2000) label(PBZ_MF_Original) label(PBZ_MF_RootName) label(PBZ_MF_HiddenPaints) label(PBZ_MF_Pass) label(PBZ_MF_Owner) label(PBZ_MF_Walk) label(PBZ_MF_Hide) registersymbol(PBZ_MF_Code) registersymbol(PBZ_MF_Original) registersymbol(PBZ_MF_HiddenPaints) registersymbol(PBZ_MF_Paint) PBZ_MF_Code: pushfq push rax push r10 push r11 mov r11,[rcx+PBZ_MF_WidgetObject] test r11,r11 je PBZ_MF_Pass mov rax,[r11+20] test rax,rax je PBZ_MF_Pass mov rax,[rax+20] test rax,rax je PBZ_MF_Pass mov r10,[rax+10] test r10,r10 je PBZ_MF_Pass mov r10,[r10+18] cmp r10,[PBZ_MF_RootName] jne PBZ_MF_Pass cmp [rax+PBZ_MF_RegionMask],r11 je PBZ_MF_Owner cmp [rax+PBZ_MF_OverviewMask],r11 jne PBZ_MF_Pass PBZ_MF_Owner: mov r10,PBZ_MF_WorldSlot mov r10,[r10] test r10,r10 je PBZ_MF_Pass mov r10,[r10+PBZ_MF_GI] test r10,r10 je PBZ_MF_Pass mov r11d,20 PBZ_MF_Walk: cmp rax,r10 je PBZ_MF_Hide mov rax,[rax+20] test rax,rax je PBZ_MF_Pass dec r11d jne PBZ_MF_Walk jmp PBZ_MF_Pass PBZ_MF_Hide: lock inc qword ptr [PBZ_MF_HiddenPaints] pop r11 pop r10 pop rax popfq mov eax,[rsp+30] ret PBZ_MF_Pass: pop r11 pop r10 pop rax popfq readmem(PBZ_MF_Paint,$0F) db FF 25 00 00 00 00 dq PBZ_MF_Paint+0F align 10 PBZ_MF_Original: readmem(PBZ_MF_Paint,$0F) align 8 PBZ_MF_RootName: dq PBZ_MF_MapRootName PBZ_MF_HiddenPaints: dq 0 PBZ_MF_Paint: db FF 25 00 00 00 00 dq PBZ_MF_Code nop ]====] {$asm} [DISABLE] {$lua} if syntaxcheck then return end local hook=getAddressSafe('PBZ_MF_Paint') local code=getAddressSafe('PBZ_MF_Code') local original=getAddressSafe('PBZ_MF_Original') if not hook or hook==0 or not code or code==0 or not original or original==0 then error('Map Fog restore symbols are missing; keep state for repair') end local h=readBytes(hook,6,true) if not h or h[1]~=0xFF or h[2]~=0x25 or h[3]~=0 or h[4]~=0 or h[5]~=0 or h[6]~=0 or readQword(hook+6)~=code then error('Map Fog hook ownership changed; refusing an unverified restore') end local expected={0x48,0x89,0x5C,0x24,8,0x48,0x89,0x6C,0x24,0x10,0x48,0x89,0x74,0x24,0x18} local b=readBytes(original,15,true) if not b or #b~=15 then error('Map Fog original instruction buffer is unreadable') end for i=1,15 do if b[i]~=expected[i] then error('Map Fog saved instruction bytes do not match') end end return ('%X:\n readmem(%X,$0F)\n'):format(hook,original)..[====[ dealloc(PBZ_MF_Code) unregistersymbol(PBZ_MF_Paint) unregistersymbol(PBZ_MF_HiddenPaints) unregistersymbol(PBZ_MF_Original) unregistersymbol(PBZ_MF_Code) ]====] {$asm}