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

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

Closed mika76 closed 6 years ago

mika76 commented 6 years ago

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

mika76 commented 6 years ago

I will try debug this when I'm at my VS2017 machine...

mika76 commented 6 years ago

I can confirm if I change the turn off display setting to 1 Min, then Mamesaver works. Putting back to Never crashes again.

nullpainter commented 6 years ago

Oops, I also fixed this by making the TimeSpan nullable. Will create PR for you to look over. Having it nullable and only conditionally create the timer is a bit less hacky than using min/max value.

nullpainter commented 6 years ago

Actually, it'll end up with a merge conflict if I just create a PR. Here's my version of the fix: https://github.com/nullpainter/mamesaver/commit/c9c42a44d6ba77a0990dd800611860990b5c7b3c

There's logging and no timer creation if there's no sleep configured.

nullpainter commented 6 years ago

Unrelated, but I also added some fixes suggested by VS code analysis in https://github.com/nullpainter/mamesaver/commit/ca5deae5ab42a8caea1fd916dfdaf0ea862bc420

mika76 commented 6 years ago

Hey @nullpainter I'm happy to accept your fixes - is there some way I can add these manually? Can't you just merge master into your branch and overwrite my changes?

nullpainter commented 6 years ago

Yep, I can do that. Probably be this evening though (so, in around six hours).

mika76 commented 6 years ago

No stress - I'll be sleeping from now till then 🤣

nullpainter commented 6 years ago

All done. Sorry about that - I fixed it before I saw that you already had 😁

btw, do you only have two games currently or are you worried about implied copyright issues? Also - and hardly an issue (just me being a little OCD) - but the MAME icon looks a bit gross against your brown. Wondering whether the bog-standard Windows 10 colour scheme may look better for sample screenshots?

mika76 commented 6 years ago

All done. Sorry about that - I fixed it before I saw that you already had 😁

No prob at all - you were a little quiet so I thought you were busy and I would help you out a bit 😊

btw, do you only have two games currently or are you worried about implied copyright issues? Also - and hardly an issue (just me being a little OCD) - but the MAME icon looks a bit gross against your brown. Wondering whether the bog-standard Windows 10 colour scheme may look better for sample screenshots?

Hah it's my theme on my parallels VM - looks much better with the brownish background I guess. Yeah it's not the best. I wanted to include all the settings as screenshots and some demo ones too. I'll update when I get back to my other laptop - just been a bit busy to sit with it.

I only had 2 roms because I don't really use mame on my mac.

nullpainter commented 6 years ago

No prob at all - you were a little quiet so I thought you were busy and I would help you out a bit 😊

Thanks; appreciated! Defects are shameful so I felt a moral responsibility to fix 😉

mika76 commented 6 years ago

Watch out @nullpainter, that's how they get us! 😉

I'll merge, sort out the releases and the screenshots some time today. Also time to update the website...