Thanks, RB!

If you like that one, here's a "better version" that gets called by emu.register_frame_done() so it runs after every frame as an overlay.


Code
function rem(a) print(a) end
function remp(a,b,c,d) print(a,b,c,d) end
function rem(a) end
function float(f) return string.format("%6.2f",f) end
function hex(a) return string.format("0x%02x",a) end
function calc(line) return line % 8 * 1024 + math.floor(line / 64) * 40 + math.floor((line%64) / 8) * 128 +8192 end

function myframedispatcher() if myframedispatchlist ~= nil then for i,j in pairs(myframedispatchlist) do j() end end end


function draw_crosshairs()
x,y,button,target=manager:machine():uiinput():find_mouse()
if target==nil then print ("TARGET=nil") return end 
manager:machine().screens[":screen"]:draw_line(0,0,x/target:width()*559,y/target:height()*191,0xffffffff)
boxsize=4
manager:machine().screens[":screen"]:draw_box(x/target:width()*559-boxsize*2,y/target:height()*191-boxsize,x/target:width()*559+boxsize*2,y/target:height()*191+boxsize,0x22ffffff,0xffff0000)
xsize=target:width() 
ysize=target:height() 
textx=math.min(math.floor(x/xsize*560+10),400)
texty=math.min(math.floor(y/ysize*192+10),160)
manager:machine().screens[":screen"]:draw_text(textx,texty,"x="..float(x/xsize*280).." y="..float(y/ysize*192).."\n addr="..hex(calc(math.floor(y/ysize*192))+math.floor(x/xsize*279/7)),0xffffffff,0xffff0000)
if button then
  myframedispatchlist={}
end
end

myframedispatchlist={} table.insert(myframedispatchlist,draw_crosshairs)


if alreadyregisteredmyframedispatcher==nil then
  emu.register_frame_done(myframedispatcher)
  alreadyregisteredmyframedispatcher=true
end


function clrd() myframedispatchlist={} end

If you press the button, it will clear the dispatcher and won't draw the target anymore.

If it goes runaway, you can type "clrd()" and hit return to stop the function calls.



Last edited by Golden Child; 01/31/19 03:17 AM.