[gnw_zelda] set clock

This forum is for posting cheats for any non-arcade game in M.A.M.E. ( aka the M.E.S.S. games ) including any softwarelist game. Requests will be fulfilled here....but please keep the requests to the requests forum.
Post Reply
crazyc
Posts: 20
Joined: Sat Apr 30, 2016 4:49 pm

[gnw_zelda] set clock

Post by crazyc » Tue Sep 10, 2019 3:08 am

Code: Select all

[{
	"desc": "Set clock to current time",
	"space": {
		"cpu": {
			"tag": ":maincpu",
			"type": "data"
		}
	},
	"script": {
		"on": "local lt = os.date('*t') cpu:write_u8(16, lt.min % 10) cpu:write_u8(17, lt.min // 10) local hour = (lt.hour > 12) and (lt.hour - 12) or lt.hour if lt.hour == 0 then hour = 12 end cpu:write_u8(18, hour % 10) cpu:write_u8(19, (hour // 10) + (((lt.hour > 12) or (lt.hour == 0)) and 10 or 0))"
	}
}]

Post Reply