User File #18056860788839309

Upload All User Files

#18056860788839309 -

Donkey-Kong-Country-2.lua
1208 downloads
Uploaded 10/14/2014 4:15 AM by Amaraticando (see all 21)
Small improvement over this script.
Now, the script shows everything correctly in fullscreen mode. The font doesn't look so good because of this issue.
Tested on Donkey Kong Country 2 - Diddy's Kong Quest (G) (V1.0).smc
--Donkey Kong Country 2 BizHawk TAS script
while true do
	
   local scount = 0 
   local cx = memory.read_s16_le(0x0017BA)
   local cy = memory.read_s16_le(0x0017C0)
   local x = memory.read_u16_le(0x000A2A)
   local y = memory.read_u16_le(0x000A2C)
   local spx = memory.read_s16_le(0x000A30) 
   local spy1 = memory.read_s16_le(0x000E06)
   local spy2 = memory.read_s16_le(0x000E64)
   local saru = memory.read_u8(0x0008A4)
   local hold = memory.read_u16_le(0x000D7A)
   local rope = memory.read_u8(0x000AEB)
   xm = client.screenwidth() / 256
   ym = client.screenheight() / 224

   if hold == 0 then		
	disphold = 0
   else
	disphold = 1
   end

   for id = 0, 21 do 
         local stat = memory.read_u16_le(0x000E9E+id*94) 
         local sx = memory.read_u16_le(0x000EA4+id*94) 
         local sy = memory.read_u16_le(0x000EA8+id*94) 
         local sspx = memory.read_s16_le(0x000EBE+id*94) 
         local sspy = memory.read_s16_le(0x000EC2+id*94) 
         local num = memory.read_u16_le(0x000ED4+id*94) 

         if id < 7 then 
            if stat ~= 0 then 
               color = 0x00FF00FF
            else 
               color = 0xFF0000FF 
            end 
            gui.text(2, 80+id*12, string.format("%d(%x, %d, %d)", id, num, sx, sy))    
         end 

         color = 0xFF0000FF 
         if stat ~= 0 then 
            
            -- Tries to discover if the emulator has lateral gaps or not. Useful while in fullscreen.
            if xm == ym then
                gui.text(sx*xm-cx*ym-4, sy*xm-cy*ym-(id%4)*8, string.format("%d(%x)", id, num))
            else
                gui.drawText(sx-cx-2, sy-cy-(id%4)*4, string.format("%d(%x)", id, num), "white", 12, "Arial", "bold")
            end
            
            scount = scount + 1 
         end 
   end 

   if saru == 0 then 
      spy = spy1 
   else 
      spy = spy2 
   end

   gui.text(2, 178, string.format("speed: %d, %d", spx, spy)) 
   gui.text(2, 190, string.format("position: %d, %d", x, y))
	if disphold == 1 then
		gui.text(2, 166, string.format("Holding ID: %d", (hold-3742)/94))
	end
   gui.text(2, 68, string.format("SPR:%02d", scount)) 

emu.frameadvance()
end