User File #638459887754146781

Upload All User Files

#638459887754146781 - ManualSetLag.lua

ManualSetLag.lua
16 downloads
Uploaded 3/14/2024 4:52 AM by CoolHandMike (see all 22)
On Line 15 Find an address that seems to correspond without taking any input and input that address to be read. This will determine whether TasStudio will mark the frame as not accepting input.
--https://github.com/TASEmulators/BizHawk/issues/3447
--Originally from vadosnaprimer 

--CoolHandMike for Karnov Arcade
--local function main()	
	if emu.registerafter ~= nil then
		-- -- FCEUX
		-- emu.registerafter(function()
			-- emu.setlagflag(memory.readbyte(0xCC) ~= 0)
		-- end)
	else
		-- BizHawk
		--Was able to find an address 0x60000 that seems to correspond without taking any input.
		event.onframeend(function()
			local lag = memory.readbyte(0x60000) == 0
			emu.setislagged(lag)
			tastudio.setlag(emu.framecount(), lag)
			lagcount = emu.lagcount()
			if lag then
				lagcount = lagcount+1
				emu.setlagcount(lagcount)
			end
		end)

		event.onloadstate(function()
			lagcount = emu.lagcount()
		end)
	end
--end

while true do
	--main();
	emu.frameadvance();
end