mika76 / mamesaver

Mamesaver is a mame emulated screensaver - get all the good ol' games playing their demo modes while you procrastinate and enjoy!
https://mika76.github.io/mamesaver/
MIT License
37 stars 10 forks source link

Added hotkey support #22

Closed nullpainter closed 6 years ago

nullpainter commented 6 years ago

As per #13, this PR adds hotkey support to Mamesaver.

Hotkeys are currently enabled by default. When enabled, the following hotkeys are enabled in-game:

I have added the option on a separate tab, which allows listing of the keys.

Deselecting a game updates the game store and shows the next game. If there is only a single game, the game isn't deselected.

This PR also includes unrelated logging and a small bit of tidying.

mika76 commented 6 years ago

Hey awesome - not at my Windows PC currently but will try asap - one thing pops in mind - what if someone has chosen to display logon screen on resume? Will that cause a problem? I think it's quite a common setting as work...

nullpainter commented 6 years ago

Do you mean in the context of its interaction when the user has selected to play a game? I imagine the login screen will just display when MAME exits. I'll give it a test in the morning.

mika76 commented 6 years ago

Ok so I tried it:

  1. The commands work perfectly - back, forward work as they should, enter and delete too. 👍
  2. The password kicks in after exiting playing the game so that works fine too 👍
  3. The game seems to start on the laptop screen, while my external screen is set as the main one - so maybe this can be controlled somehow? Might be tricky to get right. The other screen goes blank so that's good. ❔
  4. The key instructions do not appear anywhere - I made sure I tried with the option selected and deselected and nothing showed. ❌

Not sure it helps but here's the log file:

2018-08-30 12:43:47.220 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:43:47.291 +02:00 [INF] Mamesaver started with args 
2018-08-30 12:43:53.412 +02:00 [INF] GameListStore settings saved
2018-08-30 12:43:53.431 +02:00 [INF] GeneralSettingsStore settings saved
2018-08-30 12:43:53.471 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:43:53.474 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:43:56.784 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:43:56.849 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:43:56.896 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:43:56.900 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:43:56.913 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:43:56.953 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:43:59.999 +02:00 [INF] Running game Hammerin' Harry (World, M81) 1990 Irem on display \\.\DISPLAY1
2018-08-30 12:44:00.040 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:44:00.159 +02:00 [INF] Invoking MAME with arguments: hharry -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:44:03.599 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:44:03.810 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:44:03.840 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:44:03.840 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:44:03.840 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:44:03.852 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:44:03.855 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:44:03.875 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:44:06.449 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:44:06.525 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:44:06.583 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:44:06.587 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:44:06.601 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:44:06.642 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:44:09.687 +02:00 [INF] Running game Rygar (US set 1) 1986 Tecmo on display \\.\DISPLAY1
2018-08-30 12:44:09.721 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:44:09.826 +02:00 [INF] Invoking MAME with arguments: rygar -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:44:20.598 +02:00 [INF] Skipping to previous game
2018-08-30 12:44:21.586 +02:00 [INF] Skipping to previous game
2018-08-30 12:44:21.915 +02:00 [INF] Skipping to next game
2018-08-30 12:44:22.369 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:44:22.371 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:44:22.400 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:44:22.400 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:44:22.400 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:44:22.415 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:44:22.419 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:44:22.427 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:44:26.506 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:44:26.576 +02:00 [INF] Mamesaver started with args 
2018-08-30 12:44:56.298 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:44:56.301 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:45:00.939 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:01.021 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:45:01.074 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:45:01.077 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:45:01.093 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:45:01.144 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:45:04.218 +02:00 [INF] Running game 1945k III (newer, OPCX2 PCB) 2000 Oriental Soft on display \\.\DISPLAY1
2018-08-30 12:45:04.255 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:45:04.360 +02:00 [INF] Invoking MAME with arguments: 1945kiii -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:45:16.076 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:45:16.084 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:45:16.209 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:45:16.235 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:45:16.235 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:16.235 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:45:16.237 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:16.248 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:45:34.720 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:34.789 +02:00 [INF] Mamesaver started with args 
2018-08-30 12:45:39.627 +02:00 [INF] GameListStore settings saved
2018-08-30 12:45:39.645 +02:00 [INF] GeneralSettingsStore settings saved
2018-08-30 12:45:39.690 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:39.692 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:45:42.212 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:42.287 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:45:42.341 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:45:42.343 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:45:42.357 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:45:42.398 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:45:45.436 +02:00 [INF] Running game Pang (World) 1989 Mitchell on display \\.\DISPLAY1
2018-08-30 12:45:45.471 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:45:45.581 +02:00 [INF] Invoking MAME with arguments: pang -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:45:50.019 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:45:50.030 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:45:50.166 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:45:50.204 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:45:50.205 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:50.205 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:45:50.207 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:50.219 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:45:53.149 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:53.216 +02:00 [INF] Mamesaver started with args 
2018-08-30 12:45:56.933 +02:00 [INF] GameListStore settings saved
2018-08-30 12:45:56.948 +02:00 [INF] GeneralSettingsStore settings saved
2018-08-30 12:45:57.045 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:57.047 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:45:59.802 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:45:59.879 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:45:59.927 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:45:59.929 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:45:59.943 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:45:59.985 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:46:03.014 +02:00 [INF] Running game After Burner II 1987 Sega on display \\.\DISPLAY1
2018-08-30 12:46:03.046 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:46:03.148 +02:00 [INF] Invoking MAME with arguments: aburner2 -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:46:37.724 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:46:37.731 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:46:37.860 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:46:37.899 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:46:37.900 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:46:37.900 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:46:37.901 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:46:37.910 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:46:41.475 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:46:41.544 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:46:41.593 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:46:41.596 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:46:41.607 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:46:41.646 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:46:41.727 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:46:41.728 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:46:41.735 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:46:41.735 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:46:41.735 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:46:41.739 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:46:41.740 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:46:41.756 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:46:45.844 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:46:45.918 +02:00 [INF] Mamesaver started with args 
2018-08-30 12:46:49.843 +02:00 [INF] GameListStore settings saved
2018-08-30 12:46:49.857 +02:00 [INF] GeneralSettingsStore settings saved
2018-08-30 12:46:49.896 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:46:49.903 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:46:54.407 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:46:54.471 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:46:54.519 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:46:54.521 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:46:54.533 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:46:54.574 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:46:57.609 +02:00 [INF] Running game Gals Hustler 1997 ACE International on display \\.\DISPLAY1
2018-08-30 12:46:57.641 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:46:57.749 +02:00 [INF] Invoking MAME with arguments: galhustl -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:47:13.028 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:47:13.037 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:47:13.173 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:47:13.203 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:47:13.203 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:47:13.203 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:47:13.205 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:47:13.214 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:47:39.804 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:47:39.904 +02:00 [INF] Mamesaver started with args 
2018-08-30 12:47:51.129 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:47:51.131 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:47:55.196 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:47:55.262 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:47:55.309 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:47:55.312 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:47:55.324 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:47:55.365 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:47:58.406 +02:00 [INF] Running game Cobra-Command (World/US revision 5) 1988 Data East Corporation on display \\.\DISPLAY1
2018-08-30 12:47:58.437 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:47:58.544 +02:00 [INF] Invoking MAME with arguments: cobracom -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:48:02.088 +02:00 [INF] Skipping to next game
2018-08-30 12:48:05.099 +02:00 [INF] Running game '88 Games 1988 Konami on display \\.\DISPLAY1
2018-08-30 12:48:05.107 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:48:05.212 +02:00 [INF] Invoking MAME with arguments: 88games -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:48:08.820 +02:00 [INF] Skipping to previous game
2018-08-30 12:48:11.815 +02:00 [INF] Running game Cobra-Command (World/US revision 5) 1988 Data East Corporation on display \\.\DISPLAY1
2018-08-30 12:48:11.823 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:48:11.927 +02:00 [INF] Invoking MAME with arguments: cobracom -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:48:15.764 +02:00 [INF] Skipping to next game
2018-08-30 12:48:18.783 +02:00 [INF] Running game '88 Games 1988 Konami on display \\.\DISPLAY1
2018-08-30 12:48:18.790 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:48:18.920 +02:00 [INF] Invoking MAME with arguments: 88games -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:48:27.459 +02:00 [INF] Invoking MAME with arguments: 88games
2018-08-30 12:49:31.824 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:49:31.825 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:49:31.831 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:49:31.831 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:49:31.831 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:49:32.212 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:49:32.213 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:49:32.219 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:49:38.116 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:49:38.184 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:49:38.232 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:49:38.234 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:49:38.247 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:49:38.286 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:49:41.329 +02:00 [INF] Running game Teenage Mutant Ninja Turtles (World 4 Players, version X) 1989 Konami on display \\.\DISPLAY1
2018-08-30 12:49:41.360 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:49:41.464 +02:00 [INF] Invoking MAME with arguments: tmnt -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:49:46.006 +02:00 [INF] Skipping to next game
2018-08-30 12:49:49.014 +02:00 [INF] Running game Jr. Pac-Man (11/9/83) 1983 Bally Midway on display \\.\DISPLAY1
2018-08-30 12:49:49.025 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:49:49.140 +02:00 [INF] Invoking MAME with arguments: jrpacman -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:49:54.627 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:49:54.707 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:49:54.739 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:49:54.739 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:49:54.739 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:49:54.746 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:49:54.747 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:49:54.759 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:50:00.936 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:50:01.021 +02:00 [INF] Mamesaver started with args /S
2018-08-30 12:50:01.075 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:50:01.078 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:50:01.093 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:50:01.145 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:50:04.218 +02:00 [INF] Deselecting shinobi
2018-08-30 12:50:04.229 +02:00 [INF] GameListStore settings saved
2018-08-30 12:50:04.239 +02:00 [INF] Running game Gals Hustler 1997 ACE International on display \\.\DISPLAY1
2018-08-30 12:50:04.271 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:50:04.377 +02:00 [INF] Invoking MAME with arguments: galhustl -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:50:07.131 +02:00 [INF] Skipping to previous game
2018-08-30 12:50:10.123 +02:00 [INF] Running game Track & Field 1983 Konami on display \\.\DISPLAY1
2018-08-30 12:50:10.130 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:50:10.232 +02:00 [INF] Invoking MAME with arguments: trackfld -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:50:13.116 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:50:13.215 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:50:13.251 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:50:13.251 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:50:13.251 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:50:13.259 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:50:13.261 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:50:13.282 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:50:18.374 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:50:18.450 +02:00 [INF] Mamesaver started with args 
2018-08-30 12:50:25.314 +02:00 [INF] GameListStore settings saved
2018-08-30 12:50:25.327 +02:00 [INF] GeneralSettingsStore settings saved
2018-08-30 12:50:25.356 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:50:25.359 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:51:47.099 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:51:47.175 +02:00 [INF] Mamesaver started with args /s
2018-08-30 12:51:47.230 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:51:47.232 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:51:47.246 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:51:47.290 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:51:48.483 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:51:48.494 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:51:48.496 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:51:48.519 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:51:48.520 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:51:48.520 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:51:48.524 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:51:48.531 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:51:48.952 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:51:49.018 +02:00 [INF] Mamesaver started with args /p,3606250
2018-08-30 12:51:49.064 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:51:49.065 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-30 12:52:51.206 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:52:51.275 +02:00 [INF] Mamesaver started with args /s
2018-08-30 12:52:51.328 +02:00 [INF] 46 selected games out of 46 games
2018-08-30 12:52:51.331 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:52:51.344 +02:00 [INF] Initialised primary MAME screen
2018-08-30 12:52:51.386 +02:00 [INF] Destination screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-30 12:52:54.403 +02:00 [INF] Running game Avengers (US set 1) 1987 Capcom on display \\.\DISPLAY1
2018-08-30 12:52:54.439 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:52:54.545 +02:00 [INF] Invoking MAME with arguments: avengers -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:53:03.541 +02:00 [INF] Skipping to next game
2018-08-30 12:53:06.552 +02:00 [INF] Running game Bad Lands 1989 Atari Games on display \\.\DISPLAY1
2018-08-30 12:53:06.559 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-30 12:53:06.670 +02:00 [INF] Invoking MAME with arguments: badlands -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY1" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-30 12:53:11.621 +02:00 [INF] Invoking MAME with arguments: badlands
2018-08-30 12:54:19.509 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:54:19.509 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-30 12:54:19.512 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY1
2018-08-30 12:54:19.512 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:54:19.512 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-30 12:54:19.513 +02:00 [DBG] BlankScreen Dispose()
2018-08-30 12:54:19.513 +02:00 [DBG] MameScreen Dispose()
2018-08-30 12:54:19.521 +02:00 [DBG] LayoutBuilder Dispose()
mika76 commented 6 years ago

One other thing I notice - when moving left or right, the current mame takes a while to close - I wonder if the minimise process function that @andyvans talked about would help make it a bit more seamless...

nullpainter commented 6 years ago

The game seems to start on the laptop screen, while my external screen is set as the main one - so maybe this can be controlled somehow?

Interesting. I'm invoking MAME with no arguments apart from passing the game name. Can I verify if you see the same behaviour when running MAME from the command prompt?

The key instructions do not appear anywhere - I made sure I tried with the option selected and deselected and nothing showed.

I decided that I couldn't quite justify the effort of enhancing the layout builder to accept multiple bezels, calculations for positions and actually making the artwork. Instead I put the keys on the Hotkeys tab and in the README.md. I was also a little concerned that a hotkey graphic may distract from the game itself.

One other thing I notice - when moving left or right, the current mame takes a while to close - I wonder if the minimise process function that @andyvans talked about would help make it a bit more seamless...

I added more logging, shaved ~100ms off layout construction for in-game titles (I was invoking MAME to get the art path each time instead of just once), and ~50ms on stopping MAME by running it on a fire and forget Task.

I am using @andyvans's minimisation code, but only to consolidate MAME closing logic. This minimisation technique alone won't help much because the majority of the time is taken by MAME itself.

The reason you see the MAME logo, even when the splash screen is disabled, is because MAME has started but hasn't yet created a window. You can verify this by looking at the timings in the logs and, less scientifically, by looking at your mouse pointer change - it changes to a spinner as soon as the MAME process is started.

So, I don't think there's a huge amount we can do about this, unless there's some way to send a message to a running MAME process to change the currently executing game (and refresh the layout).

nullpainter commented 6 years ago

I've just found that the cloned screens aren't closed when selecting to play a game. I'll see about fixing this this weekend.

nullpainter commented 6 years ago

Also, the fire and forget task sucks. As I feared, MAME doesn't always like multiple instances running.

mika76 commented 6 years ago

Can I verify if you see the same behaviour when running MAME from the command prompt?

I'll try it out a little later and let you know

I decided that I couldn't quite justify the effort of enhancing the layout builder

Ah that's fine, I was just confused 😊

Minimization

Yeah I wasn't too sure but suspected MAME was causing this itself. Not a biggie - it all happens so fast anyway really.

cloned screens

Not sure it's a bad thing? Currently it seems the other screen goes blank so no cloning seems to be happening unless it's cloning the wrong one or something 😆 but without the cloning will the screens go blank or go back to desktop - if it goes back to desktop it might be a problem with the password after screensaver restore feature...

mika76 commented 6 years ago

But FYI this feature is 🥇 gold! I left it running a while yesterday and just pressed delete to remove games with nag screens I missed (these still come up a little does that mean the advanced option is not working?) and was going back and forth. Great feature - totally brings something new to Mamesaver... 👍

nullpainter commented 6 years ago

Currently it seems the other screen goes blank so no cloning seems to be happening unless it's cloning the wrong one or something

Interesting. Unless I inadvertently introduced a regression with my recent commits, I was seeing the cloned screens remain with the last frame that was rendered. Going black is what's intended!

In any case, MameScreen is a little too all-singing-all-dancing for my liking (managing background forms, and key events, and mouse events, and executing MAME) so I'm going to do a bit of tidying.

But FYI this feature is 🥇 gold! I left it running a while yesterday and just pressed delete to remove games with nag screens I missed (these still come up a little does that mean the advanced option is not working?)

Yay! Remember the advanced option isn't magic - it does depend on a patched version of MAME which explicitly comments out the nag code.

mika76 commented 6 years ago

Remember the advanced option isn't magic - it does depend on a patched version of MAME which explicitly comments out the nag code.

But leaving the option off means that only "good" games are included in list right? Does that not mean games which still have issues like screen rotating and stuff are left out?

nullpainter commented 6 years ago

But leaving the option off means that only "good" games are included in list right?

Yes, that's correct. I am now logging which games are ignored and why - are you able to remember the problem game in question? You should see an entry similar to:

salmndr2 not added to game list because it has a status of preliminary

mika76 commented 6 years ago

I'm not at that PC currently but will send through when I can...

mika76 commented 6 years ago
D:\MAME> .\mame64.exe -verifyroms hharry
romset hharry is good
1 romsets found, 1 were OK.

But it comes up with a "Screen flipping in cocktail mode is unsupported" error. Seems we can't do anything about this... 😞

But hey the del button works like a bomb 😀

mika76 commented 6 years ago

Can I verify if you see the same behaviour when running MAME from the command prompt?

I also checked this - it seems MAME starts on screen0 which is my laptop screen - even though my external is set as my primary.

Also found this: https://www.reddit.com/r/MAME/comments/66abdw/mame64_automatically_keeps_outputting_to_second/

nullpainter commented 6 years ago

Interesting! I figure that by not passing in any explicit display arguments when playing the game, it allows the user to just set whatever they need to in their mame.ini.

In any case, MameScreen is a little too all-singing-all-dancing for my liking (managing background forms, and key events, and mouse events, and executing MAME) so I'm going to do a bit of tidying.

I haven't tested multiple displays yet, but things are now far tidier and decoupled, particularly around event handling and shutdown. Will hopefully get this to you later this weekend and that should be it for this PR.

nullpainter commented 6 years ago

e850d09 contains mostly under-the-hood changes, but it also clears cloned screens when the user selects to play a game.

The primary changes apart from this are:

  1. Centralised keyboard and mouse event handling in new HotKeyManager and ScreenManager classes. The former manages hot key events affecting gameplay and the latter handles key and mouse events affecting screens.

    These changes reduce the responsibilities of MameScreen to just handling game execution, and the responsibilities of BlankScreen to just rendering. Previously, each screen - including cloned screens - were handling input events.

  2. Added and tidied logging.

  3. Changed MAME stopping to be less brutal if it has created a window.

  4. Analysed object disposal, removed explicit and decentralised object disposal, consolidated ad-hoc close code to Dispose(), added IDisposable implementations where missing, removed unnecessary duplicate disposal.

    Because we are using Simple Container to manage the lifecycle of most classes, a single call to Application.Exit() disposes all container managed objects in the correct order based on class dependencies.

    Doing this means that closing the screensaver is now far simpler, centralised, controlled and reliable.

mika76 commented 6 years ago

I'm really happy with this one - is it ready to marge or do you want to do more?

nullpainter commented 6 years ago

It's ready!