Coder Social home page Coder Social logo

mika76 / mamesaver Goto Github PK

View Code? Open in Web Editor NEW
35.0 8.0 10.0 2.25 MB

Mamesaver is a mame emulated screensaver - get all the good ol' games playing their demo modes while you procrastinate and enjoy!

Home Page: https://mika76.github.io/mamesaver/

License: MIT License

C# 100.00%
games screensaver mame retrogaming emulator

mamesaver's People

Contributors

andyvans avatar azure-pipelines[bot] avatar mika76 avatar nullpainter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mamesaver's Issues

Hotkey to switch from screensaver to gameplay

Occasionally when watching the MAME screensaver (instead of doing work), I've thought it'd be nice to actually play the game being displayed. Unfortunately any interaction naturally stops the screensaver.

What are your thoughts about an optionally-configurable hot key (or maybe just tab?) which allows users to enter the game itself? It should be fairly trivial to implement.

Layout creation crashes if missing rotation and game unavailable

If the rotation attribute is missing from gamelist.xml and in-game titles are enabled, the rotation is fetched from MAME on game run.

However, this results in a crash if the game was added when the imperfect emulation flag was enabled, but when this flag has been subsequently disabled:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Mamesaver.Layout.LayoutBuilder.GetRotation(Game game) in C:\code\mamesaver-fork\Mamesaver\Layout\LayoutBuilder.cs:line 105
   at Mamesaver.Layout.LayoutBuilder.EnsureLayout(Game game, Int32 monitorWidth, Int32 monitorHeight) in C:\code\mamesaver-fork\Mamesaver\Layout\LayoutBuilder.cs:line 52
   at Mamesaver.MameScreen.RunGame() in C:\code\mamesaver-fork\Mamesaver\MameScreen.cs:line 352
   at Mamesaver.MameScreen.SplashTimerTick(Object sender, EventArgs e) in C:\code\mamesaver-fork\Mamesaver\MameScreen.cs:line 212

A reasonable fix would be to pass a flag to skip the status check when calling GetRomDetails() in-game.

Missing games should result in deselection

If a game is present in gamelist.xml but is subsequently removed from the filesystem, Mamesaver just displays the splash screen for X minutes.

A better solution could be to deselect the game and move onto the next game.

Power options might not work when settings set to never turn off screen

From log

2018-09-06 11:55:00.468 +02:00 [INF] Connected to AC power; sleeping after 15372286728.091293 minutes
2018-09-06 11:55:00.477 +02:00 [ERR] Failed to run screensaver
System.ArgumentException: '-2147483648' is not a valid value for 'Interval'. 'Interval' must be greater than 0.
   at System.Timers.Timer.set_Interval(Double value)
   at Mamesaver.Power.PowerManager.Initialise()
   at Mamesaver.MameOrchestrator.Run()

My settings are set to never sleep and never turn off display (running in vm)...
screen shot 2018-09-06 at 12 02 53

Game list building improvements

On my laptop (i7, 2.9Ghz, 32GB RAM), building the game list consumes 3Gb of RAM and takes almost 7 minutes. Whereas this is possibly unavoidable for the first run, it becomes tedious having to rebuild the entire game list every time a new game is added.

A couple of suggestions:

  1. If possible, some manner of progress dialog would be useful. Not sure if we can guess the expected size of the output XML file and provide a semi-accurate progress dialog.
  2. A separate 'Rescan games' button. This would require the full XML game list being stored alongside the existing gamelist.xml. Instead of running MAME to generate the full list again, it would just rely on the XML file already downloaded. This way, the full list rebuild would only be required on the very first time or if MAME was upgraded.

I haven't performed any analysis as to why it's taking so long or consuming so much RAM. Generating the list from the command line and piping to a file takes 30 seconds. I know that XPath isn't that performant on large XML files (and perhaps my slightly lazy //machine XPath may not be helping).

If you don't have the time or inclination to do this work, I may be able to submit a pull request.

Power management

@andyvans and I were chatting the other day about power management, as it doesn't make much sense for MAME to keep running while the screen has gone to sleep. Apart from environmental concerns, my laptop's fan ends up sounding like a jet engine in the morning.

Unfortunately it appears that MAME prevents the screen (and computer!) from going to sleep so the obvious solution of interrogating power events won't work.

Instead, I have a PoC which:

  1. Reads the configured screen sleep time for AC and DC
  2. Determines whether the computer is on AC or DC
  3. Puts the screens to sleep and stops MAME when the sleep time is reached

What do you think? It's not the most beautiful approach, but it seems to work well. We can also extend this to read computer sleep configuration.

About tab

I've just realised that we don't currently show the version number anywhere. Adding an About tab wouldn't be silly idea. Feel free to assign to me.

Screensaver not always gracefully exiting

Particularly when jiggling mouse before MAME, an unhandled exception is thrown. This appears to be a recent regression and the unhandled exception handling doesn't appear to be catching it.

Feel free to assign this to me.

Preserving previous selections

Hi again,

Just a heads up that I'll write some code to preserve game selections across list rebuilds. This seems a fairly uncontroversial feature. Will hope to get a PR to you by the weekend.

M

Enhancement - game filtering

After game list construction, we have enough data from listxml to add the following filters, if users wish to select games in a more controlled fashion:

  • Manufacturer
  • Year range

Another useful thing to filter by wold be category. This would be via catver.ini, but this isn't bundled with MAME. So we could have a button which downloads it (perhaps from here?)

Thoughts?

Updates required to parse new MAME XML structure

The MAME XML structure has changed very subtly since this project was created. All that is required to get it to work with new versions of MAME is to change the following line in Mamesaver.cs from:

XmlNode xmlGame = doc.SelectSingleNode(string.Format("mame/game[@name='{0}']", key));

to:

XmlNode xmlGame = doc.SelectSingleNode(string.Format("//machine[@name='{0}']", key));

Terminal flashes when game starts

The fix for this appears to be to set the WindowStyle when creating the MAME process to run the game:

ProcessStartInfo psi = new ProcessStartInfo(execPath);
psi.Arguments = game.Name + " " + Settings.CommandLineOptions;
psi.WorkingDirectory = Directory.GetParent(execPath).ToString();
psi.WindowStyle = ProcessWindowStyle.Hidden;

Error when used with MAME 0.227

I installed Mamesaver v3, under configurations I changed the directory where MAME was located on my system, then tried to rebuild the game list under Game List and got this error:

Error running MAME; verify that the configuration is correct

I don't know if it's because the MAME executable went from being called MAME64 to just MAME, but that is the really the only thing I noticed that changed. I even ran MAME by itself just in case there was a configuration file that had not been created that Mamesever needed to find. I didn't change any of the command line options.

Thoughts?

Layout options

@andyvans was asking if there was an option to turn the titles off or change the font. Sounds like it could be a reasonable feature, particularly if you have some cool retro fonts.

So, perhaps another tab called 'layout' with:

  1. System font list, defaulted
  2. Font size, defaulted
  3. Titles on/off checkbox, defaulted to on
  4. Reset to defaults button

What do you think? We could also include a colour picker, but I'm not convinced that it'd add much value.

Not finding games

The screensaver doesn't seem to be finding available roms. Its list of games in setting is empty. It might have to do with them being stored outside of MAME's internal roms folder, but shouldn't the screensaver be able to find the rom collection from MAME's config?

I'm using Mamesaver 3.0, and MAME 244, on Windows 10.

I have tried it with MAME 200, with no difference.

Copying the files to MAME's roms folder, on the other hand, seems like it works. (It doesn't fail immediately, but puts its progress bar up for a while. I'll supply more information once its done building.)

Multi-monitor support

Hey there. I work with Matt and have also been playing around with your code. A nice distraction.

I have been toying with multi-support. At present only the primary monitor shows anything. I have tried a few options:

  1. Show a black screen on all but the primary monitor. A bit boring, but ok.
  2. Run multiple instances of mame e.g. one per monitor. The downside is that this needs more ram and opengl in mame. DirectX in mame fails to start due to a directx handle conflict.
  3. Run a single mame on the primary monitor and clone this screen to all other monitors.

Option 3 seem best, but still need to test it a bit more. I have made either option 1 or 3 available via a checkbox setting. You can check it out here if you are interested.

https://github.com/andyvans/mamesaver/commits/master

MAME configuration parsing fails when paths enclosed in speech marks

For example:

rompath "roms;E:\MAME 0.195 ROMs (merged);E:\MAME 0.190 ROMs (merged)\MAME 0.190 ROMs"

If enclosing speech-marks exist, they should be removed. The splitting code should also be taken out of GameListBuilder and split into a separate parser class so we can effectively write unit tests against it.

Additionally, this failure doesn't appear to result in any log entry being written.

@mika76, feel free to assign this to me.

Crash on shutdown

I haven't been able to replicate, but this is in the logs. May just be a race condition:

System.InvalidOperationException: No process is associated with this object.
   at System.Diagnostics.Process.EnsureState(State state)
   at System.Diagnostics.Process.get_HasExited()
   at Mamesaver.GamePlayManager.Dispose(Boolean disposing)
   at Mamesaver.GamePlayManager.Dispose()
   at SimpleInjector.Scope.DisposeInstancesInReverseOrder(List`1 disposables, Int32 startingAsIndex)
   at SimpleInjector.Scope.DisposeAllRegisteredDisposables()
   at SimpleInjector.Scope.DisposeRecursively(Boolean operatingInException)
   at SimpleInjector.Scope.Dispose(Boolean disposing)
   at SimpleInjector.Scope.Dispose()
   at Mamesaver.Program.Main(String[] args)
2018-09-14 11:43:18.652 +12:00 [DBG] MAME started; pid: 23272
2018-09-14 11:43:18.653 +12:00 [ERR] Unable to start game
System.NullReferenceException: Object reference not set to an instance of an object.
   at Mamesaver.MameScreen.OnGameStarted(Object sender, EventArgs args)
   at Mamesaver.GamePlayManager.RunGame()
2018-09-14 11:43:21.805 +12:00 [DBG] Resetting sleep timer
2018-09-14 11:43:21.812 +12:00 [ERR] Thread exception
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Timer'.
   at System.Timers.Timer.set_Enabled(Boolean value)
   at Mamesaver.Power.PowerManager.ResetTimer()
   at Mamesaver.Hotkeys.HotKeyManager.OnKeyDown(Object sender, KeyEventArgs e)
   at Mamesaver.Windows.UserActivityHook.KeyboardHookProc(Int32 nCode, Int32 wParam, IntPtr lParam)

Mac port

What better way to maintain momentum than to launch straight into the next thing? ๐Ÿ˜œ

I'm only being partly facetious. I'm a Mac guy at home, I've never done OS X development and there's a dearth of good screensavers out there...

Filter mechanical games, improve BIOS identification

As noted on arcadecontrols.com, mechanical games (i.e., fruit machines) shouldn't be included in the game list.

I suspect we are implicitly filtering these anyway as the majority appear to only be partially emulated, however there is an ismechanical attribute for mechanical games in the listxml output, so it makes sense to filter by this.

There are also isbios and isrunnable flags so we should also check for these rather than just rely on the emulation status. Adding these checks pared down my list of games slightly, so clearly our status check wasn't quite good enough.

Screensaver not working properly anymore since mame 0.223 (possibly earlier)

Sicne mame 0.223, now the screensaver will forcibly shpow the "emulation/sound is not workingp ress any key to continue", obviously pressing any key will just quit the screensaver and goes back to Windows. For some weird reasons, only neogeo games are actually shown as attract mode screensaver, all the other games will just show this static screen and nothing else

Game info display

I was watching some games today, didn't know what they were and was thinking that instead of the current splash screen and its associated 10s delay, it may be far nicer to overlay the same details while each game is playing.

Is this something you had considered? What are your thoughts? I'm assuming it's possible...

Artwork not showing

I've been at this for a week. My Mame bevels (horizont and vertical) display fine whether from exe from within folder or cmd line but never from the screensaver. I've tried various command line options but none seem to read my mame.ini file. Is this not supported? I've tried to point to my -inipath, -fallback_artwork and -artpath in Command line options within the screensaver options but this doesn't work. On the other hand -video bgfx and -brightness etc. do work. I'm doing 1080X1080 on a flipped 16:9 TV. I have searched for days but most posts are about filtering games and nothing about setting video options such as "small" or "large" which trigger bevels. Do I need a cmd line "Large" command in the Command line options for Mamesaver? Any help would be appreciated for this screensaver which is a vital part of my machine and cabinet. Thank you very much.

Attribution

Vanity request - any chance of changing my attribution to 'Matt Painter'? ๐Ÿ˜‰

Mamesaver.scr - This application could not be started. Do you want to view information about this issue? ...

After downloading https://github.com/mika76/mamesaver/releases/download/3.0/Mamesaver.scr and moving into my updated 64-bit W7 HPE SP1's c:\windows\system32, I couldn't configure and run it due to "Mamesaver.scr - This application could not be started. Do you want to view information about this issue? Yes No". I clicked yes and was taken to https://docs.microsoft.com/en-us/dotnet/framework/deployment/initialization-errors-managing-the-user-experience?version=(null)&processName=Mamesaver.scr&platform=0009&osver=5&isServer=0&shimver=4.0.30319.0 -- ".NET Framework initialization errors: Managing the user experience..."

Generic error message if ROM path not found

If an invalid ROM path is present in mame.ini, a generic dialog is displayed indicating that the path to MAME is incorrect. This should be changed to display the offending path in question.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.