Closed andyvans closed 6 years ago
Awesome man, I'll try it out this morning...
Hey @andyvans - The mame game works like a bomb 💣 - but the splash screen is still not stretching...
Hey @mika76 what resolutions are your monitors?
All the details should be in log file in %temp%\mamesaver\logs. I suspect I need to grab the right amount of the source/destination Rect when they have different ratios.
Argh! Sorry I totally forgot to post the log
Here's the relevant bits...
2018-08-29 09:57:23.876 +02:00 [INF] Mamesaver started with args /S
2018-08-29 09:57:23.919 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-29 09:57:23.937 +02:00 [INF] Initialised primary MAME screen
2018-08-29 09:57:23.977 +02:00 [INF] Source screen found \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080}
2018-08-29 09:57:23.977 +02:00 [INF] Destination screen found \\.\DISPLAY1 {X=0,Y=0,Width=1440,Height=900}
2018-08-29 09:57:27.013 +02:00 [INF] Running game Moon Patrol 1982 Irem on display \\.\DISPLAY2
2018-08-29 09:57:27.048 +02:00 [INF] Invoking MAME with arguments: -showconfig
2018-08-29 09:57:27.149 +02:00 [INF] Invoking MAME with arguments: mpatrol -skip_gameinfo -nowindow -noswitchres -sleep -triplebuffer -sound none -screen "\\.\DISPLAY2" -artpath D:\MAME\artwork;C:\Users\mmiha\AppData\Local\Temp\Mamesaver\Layouts
2018-08-29 09:58:10.418 +02:00 [INF] Closing screen \\.\DISPLAY1
2018-08-29 09:58:10.429 +02:00 [INF] Closing primary MAME screen \\.\DISPLAY2
2018-08-29 09:58:10.554 +02:00 [INF] Closing screen \\.\DISPLAY2
2018-08-29 09:58:10.561 +02:00 [DBG] BlankScreen Dispose()
2018-08-29 09:58:10.561 +02:00 [DBG] MameScreen Dispose()
2018-08-29 09:58:10.561 +02:00 [DBG] BlankScreen Dispose()
2018-08-29 09:58:10.563 +02:00 [DBG] MameScreen Dispose()
2018-08-29 09:58:10.569 +02:00 [DBG] LayoutBuilder Dispose()
2018-08-29 09:58:15.450 +02:00 [DBG] MameScreen Dispose()
Basically I have a laptop 1920x1080 and a screen (same res) - I change the screen to 1440x900 and then try it - the splash opens small (not covering the whole screen) but mame works fine now...
PS: Would probably be a good idea to log the chosen configs before running the screen saver...
Hmm. I can't reproduce this. Are you saying that the splash screen on the 1440x900 monitor doesn't cover the entire screen at first, but then resizes once mame starts?
Interestingly it looks like this on both screens:
I assume it's not opening full screen on the larger resolution but then getting cloned to the larger resolution...
PS: I accepted a PR from @nullpainter so you might want to merge from master...
It's not anything silly to do with a high pixel density display, is it @andyvans? That logo isn't even centred...
I can try a debug it maybe tomorrow if I have time in case you still can't re-create...
Hi @mika76. I think I have a solution. It is related to the high dpi screen you have. Windows tells lies to non-highdpi aware applications. That is why the screen is small.
Hey @andyvans thanks - I'll give it a try as soon as I can...
Just tried the last commit - same result - not covering the whole screen...
Ok. Thanks. I will have a go with a high dpi screen in the weekend.
I cloned your repo so will try debug myself and see if I can help out - only thing is I'm kinda busy today and travelling tonight so might only get to it over the weekend. Will keep you posted...
I managed to have a quick look and I think I might know what is causing the issue (config wise not code wise)
I have a laptop to which I've connected a screen. The external screen is set to the Main Display and is the one that I drop the resolution of to 1600x or 1400x. If I change the Main Display to be the laptop (larger res) screen then all works fine.
I assume there is some issue in CaptureScreen and what handle it's getting for the DesktopWindow maybe?
I just can't seem to figure it out - but an interesting anecodote is that if I change the BackgroundForm.FormBorderStyle
from None
to something else like Sizeable
then it seems to fill the screen (albeit with the border which looks crap)
So setting the border to it's normal Sizeable
and then using SetWindowLong to a compatible style seems to get us most of the way - I just have not been able to get rid of the caption AND the border...
Hey @andyvans I merged #22 but I see this has now caused a conflict - sorry about that - I was trying to get to the bottom of the small window mystery and thought I'd merge after that but now I've caused a problem. Would you mind updating?
The most interesting of article so far about this issue: https://stackoverflow.com/questions/22874211/setwindowpos-and-multiple-monitors-with-different-resolutions
@mika76 done. I had a go the in weekend, but still cannot reproduce the issue. I think it is because the only high dpi monitor I have is only my laptop.
And I just fixed the logging of the dpi details. It now shows
2018-09-03 09:53:04.531 +12:00 [INF] Blank screen resized \\.\DISPLAY2 {X=-1920,Y=0,Width=1920,Height=1080} xDpi 96 yDpi 96
2018-09-03 09:53:04.550 +12:00 [INF] Blank screen resized \\.\DISPLAY1 {X=0,Y=0,Width=1920,Height=1080} xDpi 96 yDpi 96
Regarding that SO post above, perhaps the window first needs to be moved to the selected screen and then resized. Not sure. Just an idea
Basically I have a laptop 1920x1080 and a screen (same res) - I change the screen to 1440x900 and then try
@mika76 do you only see the problem when running screens at non-native resolutions? Was this because you enjoy 1440x900 🤢 or you were testing the cloning at different resolutions?
Also, was the issue still present after rebooting / logging off? I've been able to replicate it, but haven't investigated yet if it is a persistent or temporary issue.
FWIW, my primary monitor isn't high DPI but my laptop is.
@mika76 Give the latest a go (commit id 80255c6). While you may see some temporary window resizing, I think it sorts itself out now and runs in full screen.
Hey @andyvans unfortunately the last commit didn't do anything different. But I think I figured it out...
diff --git a/Mamesaver/BackgroundForm.Designer.cs b/Mamesaver/BackgroundForm.Designer.cs
index 5b32aad..e3f0de5 100644
--- a/Mamesaver/BackgroundForm.Designer.cs
+++ b/Mamesaver/BackgroundForm.Designer.cs
@@ -103,9 +103,7 @@ namespace Mamesaver
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.TopMost = true;
- this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
((System.ComponentModel.ISupportInitialize)(this.mameLogo)).EndInit();
this.ResumeLayout(false);
It seems by removing the FormWindowState.Maximized
it solved the issue - I removed the startup position as well since SetWindowPos does the work for you.
Cool. Good spotting. I had added that change to my branch
Fantastic - Mamesaver is looking and working so nice now 😄