Previous Thread
Next Thread
Print Thread
Page 331 of 426 1 2 329 330 331 332 333 425 426
Joined: Aug 2019
Posts: 28
N
Member
Member
N Offline
Joined: Aug 2019
Posts: 28
Sorry for the double post but crazyc, I edited your script and got it to work 100%! Alarms work too.
Code
[{
	"desc": "Set clock to current time",
	"space": {
		"cpu": {
			"tag": ":maincpu",
			"type": "data"
		}
	},
	"script": {
		"run": "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+12) + (((lt.hour > 12) or (lt.hour == 12)) and -10 or 20))"
	}
}]


Edit: the alarm is still finicky but it kinda works?? Seconds might have to be secretly synced as well for it to go off properly.

Last edited by notknown; 09/12/19 05:19 AM.
Joined: May 2004
Posts: 1,782
Likes: 38
H
Very Senior Member
Very Senior Member
H Offline
Joined: May 2004
Posts: 1,782
Likes: 38
if you're forcing the value every frame then it probably won't go off as the game likely checks the time vs alarm when it ticks over internally, which you'd be preventing from happening.

really you want to set it to current system time at startup and leave it.

remember, forcing the system time into memory like this is a hack, it's going to cause abnormal behavior, it isn't how the machine worked, the original machine was 'always on' and once the time was set, would just increment it every 'frame' this cheat is a convenience feature only to work around the fact that with MAME as soon as you quit you turning the machine off, which in reality you never really do.


Joined: Aug 2019
Posts: 28
N
Member
Member
N Offline
Joined: Aug 2019
Posts: 28
I figured the reason why it was doing that is because the second timer is going from minute to minute is what checks the time and then checks whether to set the alarm, and it's true because if I hold down fast forward, the alarm will go off multiple times because of the internal timer reaching 60 or 0 or whatever.


I'm glad that it's working correctly now, Thank you so much for the wonderful script. I also edited it and got it to work with the registries in super mario bros!

We could try to make a zip of the cheats for each game I suppose

Code
[{
	"desc": "Set clock to current time",
	"space": {
		"cpu": {
			"tag": ":maincpu",
			"type": "data"
		}
	},
	"script": {
		"run": "local lt = os.date('*t') local sec = lt.sec+1 if sec>=60 then sec=sec-60 end if sec >0 and sec<59 then cpu:write_u8(38,sec // 10) cpu:write_u8(39,sec % 10) end cpu:write_u8(37, lt.min % 10) cpu:write_u8(36, 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(35, hour % 10) cpu:write_u8(34, (hour // 10+12) + (((lt.hour > 12) or (lt.hour == 12)) and -10 or 20))"
	}
}]

Edit: I made an edit to incorporate seconds to trigger the alarm. it syncs seconds besides the between 59 to 0 to activate the trigger for the alarm. Works pretty well.

I get what you mean by having the sync script just run on startup to minimize issues. I do think it could be fixable by having a variable that keeps track of a minute change and syncs each starting second back to 0 when the system clock starts at 0 seconds. If you think it would cause gameplay behavior to change I can test it out. Messing around with values in the registry suggest that a lot of timed events during gameplay have their own timers not correlated to the clock, and even if it was, it would probably be using the timer that counts seconds, not the seconds, minutes, or hours themselves. Maybe if these values influence pseudo random generation then maybe, otherwise maybe not.



By the way, What's a good way to read the hex registries in mame when running a game for debugging?

Last edited by notknown; 09/12/19 09:57 AM.
Joined: Mar 2001
Posts: 17,326
Likes: 286
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,326
Likes: 286
"hex registries"?

Joined: Aug 2019
Posts: 28
N
Member
Member
N Offline
Joined: Aug 2019
Posts: 28
Originally Posted by R. Belmont
"hex registries"?

The raw memory laid out as hexadecimals per byte.

Like FCUEX's live hex editor.
[Linked Image from fceux.com]

To help find which addresses in the memory store time in each game, and maybe some other debug stuff.
The only way I could find SMB's time addresses was by blanket searching and editing addresses until the time was affected.

Luckily G&W has such small RAM it's easy to try to locate, but it would be easier to be able to observe the memory while the rom was running.

Last edited by notknown; 09/12/19 08:17 PM.
Joined: Jan 2012
Posts: 894
Likes: 19
C
Senior Member
Senior Member
C Offline
Joined: Jan 2012
Posts: 894
Likes: 19
Run mame with -debug and you'll get a debug window. From from Debug menu you can open a memory window. Select data space from the drop down to see the mcu work ram address space.

Joined: Aug 2019
Posts: 28
N
Member
Member
N Offline
Joined: Aug 2019
Posts: 28
Originally Posted by crazyc
Run mame with -debug and you'll get a debug window. From from Debug menu you can open a memory window. Select data space from the drop down to see the mcu work ram address space.

Thank you. Got the script to work on Bombsweeper as well. Was fun messing around and seeing how SMB worked as well.

Joined: Jul 2018
Posts: 167
Likes: 60
H
Senior Member
Senior Member
H Offline
Joined: Jul 2018
Posts: 167
Likes: 60
G&W Judge has now been preserved in MAME smile

The dump has been done from the first (green) issue of the game which contains a game scoring issue which was fixed in a later (purple) version of the game. As the other early games, this game is based on the SM5A.

This is a screenshot from the game:
[Linked Image from i.imgur.com]

Thanks to Mr. Do for providing the game and Sean for shipping the game to me and scanning inlays and pcb!

Joined: Jan 2019
Posts: 91
H
Member
Member
H Offline
Joined: Jan 2019
Posts: 91
Added Judge and changed tons of games. Mainly remade all of the Wide Screen games

[Linked Image from ]

Thanks for the info about the bubbles and stuff, sorry I haven't been replying to it all, I've been trying to make loads of adjustments. I added bubbles to more games than you said, like Chef and Popeye because I saw them on some pictures but if no one likes them, just override them with some blank pngs.

Joined: Jan 2019
Posts: 91
H
Member
Member
H Offline
Joined: Jan 2019
Posts: 91
I don't know why I didn't think of this sooner but if you double the screen and fade it, you can get a shadow for the LCD... So I added this to all of the G&W games and Konami ones for now, but it may be a little strong, tell me what you think. It has no blur but I've tried to match the background shadow though maybe I can take the LCD shadow down to 10% from 25.

[Linked Image from i.imgur.com]


Page 331 of 426 1 2 329 330 331 332 333 425 426

Link Copied to Clipboard
Who's Online Now
1 members (Olivier Galibert), 293 guests, and 3 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,408
Posts122,987
Members5,094
Most Online3,327
Nov 10th, 2025
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Powered by UBB.threads™ PHP Forum Software 8.0.0