Last active
February 21, 2022 19:45
-
-
Save bigfarts/f396d19af4eb985f182bb9afc6a4d2db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| band = bit.band | |
| function flaginfo_to_string(tbl) | |
| local result = "" | |
| for k, v in pairs(tbl) do | |
| if v then | |
| result = result .. '\n' .. k | |
| end | |
| end | |
| return result:sub(2) | |
| end | |
| readu8 = memory.readbyte | |
| readu16 = memory.read_u16_le | |
| reads16 = memory.read_s16_le | |
| readu32 = memory.read_u32_le | |
| reads32 = memory.read_s32_le | |
| function readobj(objptr) | |
| return { | |
| animation = readu8(objptr + 0x10), | |
| x = readu8(objptr + 0x12), | |
| y = readu8(objptr + 0x13), | |
| nextx = readu8(objptr + 0x14), | |
| nexty = readu8(objptr + 0x15), | |
| team = readu8(objptr + 0x16), | |
| flip = readu8(objptr + 0x17), | |
| hp = readu16(objptr + 0x24), | |
| maxhp = readu16(objptr + 0x26), | |
| collisionptr = readu32(objptr + 0x54), | |
| } | |
| end | |
| function unpackcollisionflags(flags) | |
| return { | |
| shielding = band(flags, 0x00000001) ~= 0, | |
| unk2 = band(flags, 0x00000002) ~= 0, | |
| unk3 = band(flags, 0x00000004) ~= 0, | |
| invincible = band(flags, 0x00000008) ~= 0, | |
| airshoes = band(flags, 0x00000010) ~= 0, | |
| floatshoes = band(flags, 0x00000020) ~= 0, | |
| moving = band(flags, 0x00000040) ~= 0, | |
| unk8 = band(flags, 0x00000080) ~= 0, | |
| deleted = band(flags, 0x00000100) ~= 0, | |
| flashing = band(flags, 0x00000200) ~= 0, | |
| flinching = band(flags, 0x00000400) ~= 0, | |
| paralyzed = band(flags, 0x00000800) ~= 0, | |
| sliding = band(flags, 0x00001000) ~= 0, | |
| blinded = band(flags, 0x00002000) ~= 0, | |
| immobilized = band(flags, 0x00004000) ~= 0, | |
| confused = band(flags, 0x00008000) ~= 0, | |
| frozen = band(flags, 0x00010000) ~= 0, | |
| superarmor = band(flags, 0x00020000) ~= 0, | |
| undershirt = band(flags, 0x00040000) ~= 0, | |
| movedone = band(flags, 0x00080000) ~= 0, | |
| dragged = band(flags, 0x00100000) ~= 0, | |
| angry = band(flags, 0x00200000) ~= 0, | |
| usingaction = band(flags, 0x00400000) ~= 0, | |
| unk24 = band(flags, 0x00800000) ~= 0, | |
| unk25 = band(flags, 0x01000000) ~= 0, | |
| respectsice = band(flags, 0x02000000) ~= 0, | |
| ignorespoison = band(flags, 0x04000000) ~= 0, | |
| unk28 = band(flags, 0x08000000) ~= 0, | |
| unk29 = band(flags, 0x10000000) ~= 0, | |
| unk30 = band(flags, 0x20000000) ~= 0, | |
| unk31 = band(flags, 0x40000000) ~= 0, | |
| bubbled = band(flags, 0x80000000) ~= 0, | |
| } | |
| end | |
| function readcollision(collisionptr) | |
| return { | |
| paralyzedtimeleft = readu16(collisionptr + 0x1c), | |
| confusedtimeleft = readu16(collisionptr + 0x1e), | |
| blindedtimeleft = readu16(collisionptr + 0x20), | |
| immobilizedtimeleft = readu16(collisionptr + 0x22), | |
| flashingtimeleft = readu16(collisionptr + 0x24), | |
| invincibletimeleft = readu16(collisionptr + 0x26), | |
| frozentimeleft = readu16(collisionptr + 0x28), | |
| bubbledtimeleft = readu16(collisionptr + 0x2a), | |
| flags = readu32(collisionptr + 0x3c), | |
| } | |
| end | |
| function readtile(tileptr) | |
| return { | |
| visible = readu8(tileptr + 0x00), | |
| type = readu8(tileptr + 0x02), | |
| owner = readu8(tileptr + 0x03), | |
| animation = readu8(tileptr + 0x06), | |
| x = readu8(tileptr + 0x0a), | |
| y = readu8(tileptr + 0x0b), | |
| timeleft = readu16(tileptr + 0x0e), | |
| flags = readu32(tileptr + 0x14), | |
| } | |
| end | |
| function unpacktileflags(flags) | |
| return { | |
| enemyowned = band(flags, 0x00000020) ~= 0, | |
| movinginto = band(flags, 0x00000080) ~= 0, | |
| occupied2 = band(flags, 0x00200000) ~= 0, | |
| occupied = band(flags, 0x04000000) ~= 0, | |
| } | |
| end | |
| local objoffset = 0x0203A9B0 | |
| local objsize = 0xd8 | |
| local tileoffset = 0x02039AE0 | |
| local tilesize = 0x20 | |
| FONT_SIZE = 12 | |
| gui.use_surface("client") | |
| -- client.SetClientExtraPadding(100, 0, 0, 0) | |
| while true do | |
| emu.frameadvance() | |
| gui.drawText(0, 0, "hello") | |
| -- gui.clearGraphics() | |
| -- gui.drawText(2, 2, flaginfo_to_string(unpackcollisionflags(readcollision(readobj(objoffset).collisionptr).flags)), 0xffff0000, 0xffffffff, FONT_SIZE) | |
| -- gui.drawText(2, 2 + FONT_SIZE, flaginfo_to_string(unpackcollisionflags(readcollision(readobj(objoffset + objsize).collisionptr).flags)), 0xff00ff00, 0xffffffff, FONT_SIZE) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment