|
local wb, ww, wd = memory.write_u8, memory.write_u16_le, memory.write_u32_le |
|
local rb, rbs, rw, rws, rd = memory.read_u8, memory.read_s8, memory.read_u16_le, memory.read_s16_le, memory.read_u32_le |
|
|
|
--Box Colors |
|
hurtfill = 0x60004080 |
|
hurtout = 0xFF0040ff |
|
|
|
--------------------------- |
|
axis_length = 8 |
|
invalidTimer = 10 |
|
comboCount = 0 |
|
lastCombo = 0 |
|
lastDamage = 0 |
|
comboDamage = 0 |
|
damage = 0 |
|
|
|
function players() |
|
adr = 0x0F80 |
|
|
|
for i = 0,3,1 do -- Repeats the set up |
|
adr = adr + 0x80 -- Address offset(example 0x0F80 + 0x80 = player 1 0x1000 for player 2 it adds p1 address 0x1000 + 0x80) |
|
--Data Player memory |
|
local px = rb(adr + 0x28) |
|
local py = rb(adr + 0x2A) |
|
local life = rb(adr + 0x49) |
|
|
|
local flipb = rb(adr + 0x09) -- Flip flag if byte is anything but zero means the sprite was fliped |
|
|
|
local movex = rws(adr + 0x30) -- Movement Speed on X |
|
local movey = rws(adr + 0x32) -- Movement Speed on Y |
|
|
|
local damage = rb(adr + 0x45) -- How much Damage attacks do single hit |
|
local atkflag = rb(adr + 0x44) -- Fire, Knockdown, Electric, etc.. |
|
|
|
|
|
if rb(adr) ~= 0 then -- If active |
|
--Text |
|
if i < 2 then -- Player Data |
|
gui.text(24+i*128,30,"Life: " .. life) |
|
gui.text(52+i*108,40,"X,Y: " .. px .. ", " .. py) |
|
gui.text(52+i*128,212,"Move X: " .. movex) |
|
gui.text(52+i*128,204,"Move Y: " .. movey) |
|
|
|
else -- Projectile Data |
|
gui.text(98,180+i*8,"PX, PY: " .. px .. "," .. py) |
|
gui.text(98,140+i*8,"MX, MY: " .. movex .. "," .. movey) |
|
|
|
end |
|
|
|
|
|
--Axis |
|
gui.drawLine(px,py+axis_length,px,py-axis_length) |
|
gui.drawLine(px+axis_length,py,px-axis_length,py) |
|
|
|
--Example Box Set up |
|
--If boxes use one cordinate set up setup could be different though this is the usual set up I've seen in fighters |
|
--[[ |
|
if flipb ~= 0 then |
|
flip = -1 |
|
else |
|
flip = 1 |
|
end |
|
|
|
x1 = px + (-4 * flip) |
|
x2 = x1 + (0x12 * flip) |
|
y1 = py + 8 |
|
y2 = y1 - 80 |
|
|
|
gui.drawBox(x1,y1,x2,y2,hurtout,hurtfill) |
|
--]] |
|
|
|
end |
|
end |
|
end |
|
|
|
function cheat() |
|
--Timer |
|
wb(0x7e0803, 0x07) |
|
wb(0x7e0804, 0x00) |
|
|
|
--Super |
|
wb(0x7e080e, 0x0e) |
|
wb(0x7e0810, 0x0e) |
|
wb(0x7e0812, 0x0e) |
|
wb(0x7e0814, 0x0e) |
|
|
|
--P1 Health |
|
if rb(0x001049) <= 24 then |
|
wb(0x001049, 0x60) |
|
wb(0x000800, 0xC0) |
|
end |
|
|
|
--p2 health |
|
if rb(0x0010C9) <= 1 then |
|
wb(0x0010C9, 0x60) |
|
wb(0x000801, 0xC0) |
|
end |
|
end |
|
|
|
function combocheck() |
|
if memory.read_u8(0x0010D7) == 0 then |
|
if memory.read_u8(0x0010C6) == 160 then |
|
text = "Knockdown" |
|
elseif memory.read_u8(0x0010D5) == 16 then |
|
text = "Blockstun" |
|
elseif memory.read_u8(0x0010D5) == 128 then |
|
text = "Hitstun" |
|
elseif lastFrame == 1 then |
|
text = "Hitstun" |
|
elseif memory.read_u8(0x0010D5) == 0 then |
|
text = "Neutral" |
|
if comboCount ~= 0 then |
|
lastCombo = comboCount |
|
lastDamage = comboDamage |
|
end |
|
comboCount = 0 |
|
comboDamage = 0 |
|
memory.write_u8(0x0010C9, 0x60) |
|
end |
|
lastFrame = 0 |
|
lastHealth = memory.read_u8(0x0010C9) |
|
else |
|
if lastFrame == 0 then |
|
comboCount = comboCount + 1 |
|
damage = lastHealth - memory.read_u8(0x0010C9) |
|
comboDamage = comboDamage + damage |
|
end |
|
if memory.read_u8(0x0010D5) < 128 then |
|
text = "Hitstun" |
|
end |
|
lastFrame = memory.read_u8(0x0010D7) |
|
end |
|
gui.text(164,46,text) |
|
|
|
if comboCount > 0 then |
|
gui.text(164,52,"Current Combo:") |
|
gui.text(164,58,comboCount .. " hits, " .. comboDamage .. " damage.") |
|
else |
|
gui.text(164,52,"Last Combo:") |
|
gui.text(164,58,lastCombo .." hits, " .. lastDamage .. " damage.") |
|
end |
|
|
|
if lastState ~= text then |
|
if lastState == "Hitstun" then |
|
invalidTimer = 10 |
|
memory.write_u8(0x000801, 0xC0) |
|
elseif lastState == "Neutral" then |
|
if invalidTimer > 0 then |
|
invalidState = true |
|
else |
|
invalidState = false |
|
end |
|
end |
|
end |
|
|
|
if invalidState == true then |
|
gui.text(220,52,"INVALID!") |
|
if text ~= "Neutral" then |
|
invalidTimer = 30 |
|
end |
|
end |
|
|
|
if invalidTimer == 0 then |
|
invalidState = false |
|
else invalidTimer = invalidTimer - 1 |
|
end |
|
|
|
lastState = text |
|
end |
|
|
|
while true do |
|
players() |
|
cheat() |
|
combocheck() |
|
emu.frameadvance() |
|
end |