Gamestudio Links
Zorro Links
Newest Posts
Gracefully closing a panel
by Zheka. 07/17/19 15:02
MaxDD in %
by Zheka. 07/17/19 14:51
New Zorro version 2.15
by jcl. 07/17/19 12:21
Issues with converting .csv to .t6
by jcl. 07/16/19 14:46
IG plugin initial release
by YG8. 07/16/19 10:02
First Steps for backtesting with ASCII data
by Charttrader. 07/16/19 08:50
Beginners Workshop
by jcl. 07/15/19 06:29
Dukascopy plugin (yet another version)
by dh85. 07/15/19 05:03
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
12 registered members (jyd, kvm, Peeyotch, Grat, AndrewAMD, FLD, TradingMax, Quad, Matt_Aufderheide, 1 invisible), 705 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Charttrader, bjomu, catharticlapse, carmyss121, Evox
18255 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Multi Monitor Info, resolutions, graphics cards #477009
05/02/19 09:17
05/02/19 09:17
Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
I want to share a code snippet with you that I had made some time ago to enumerate all available monitor resolutions (at the current frequency - you can get others as well, easy to change) on all connected monitors.

Screenshot of the test program:


Download: http://www.pogostuck.com/multiMonitorInfo.zip

How to use: Have a look at the test program. You only need to call multiMonitorGetInfo() once.
Open multiMonitorInfo.h and check what info is available.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Multi Monitor Info, resolutions, graphics cards [Re: Superku] #477012
05/02/19 11:27
05/02/19 11:27
Joined: Jul 2007
Posts: 514
Turkey, izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 514
Turkey, izmir
Thank you Felix! You are generous as always.

There is just one little thing. Not a big deal for me but i want to let you know, because since your game is already on market, maybe you'd like to change it. (though it is not necessary for my opinion.)

Your codes can't detect virtual super resolution, until i select one of them. For example; my monitor support maximum 1920x1080. With super resolution option, it's reach 3840x2160.

When i run the code, i get this (desktop resolution is 1920x1080);


then i set the resolution 2304x1296 and i get all resolution;



So, as long as the resolution is in 1920x1080, pogostuck can't detect higher (virtual) resolutions.

Re: Multi Monitor Info, resolutions, graphics cards [Re: Emre] #477013
05/02/19 11:46
05/02/19 11:46
Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Interesting, I did not know that was a thing (super resolutions).
However, I'm using Windows functions to grab all available resolutions, and what you see is what Windows reports.
Can you pick higher/ super resolutions in other games?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Multi Monitor Info, resolutions, graphics cards [Re: Superku] #477014
05/02/19 11:55
05/02/19 11:55
Joined: Jul 2007
Posts: 514
Turkey, izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 514
Turkey, izmir
Yes. Tomb Raider series, Resident Evil 7, Dying Light, even Dishonored (very old game) detect and list all resolution. (no need to change desktop resolution )

Edit: i understand it's windows reports but it's also odd that it doesn't list super resolutions, until i change desktop resolution to higher. it doesn't happen in other games. Maybe other developers are using another method to get resolution list. i don't know.

Last edited by Emre; 05/02/19 12:17.
Re: Multi Monitor Info, resolutions, graphics cards [Re: Emre] #477015
05/02/19 12:22
05/02/19 12:22
Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Okay, thank you. Will look that up later or the next couple of days!


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Multi Monitor Info, resolutions, graphics cards [Re: Superku] #477018
05/02/19 14:38
05/02/19 14:38
Joined: Jul 2007
Posts: 514
Turkey, izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 514
Turkey, izmir
You are welcome! And be ready, i think i found the cause of the problem and it's bigger than i thought.

it's about desktop refresh rate. When it is set to the highest freq (60 hz), your code can list all resolutions. But, when it was set to 59, it can't detect all resolutions.

i realized; when i set resolution to 2304x1296, refresh rate automatically change to 60 hz. that is why your code detect all resolutions when desktop resolution is 2304x1296.

Most interesting thing is, when i set it 50hz, i just get two resolution:


image upload


as far as i understand, it's related with this code: "displayMode.RefreshRate == multiMonitorInfo.currentFrequency", but you are the expert.

Re: Multi Monitor Info, resolutions, graphics cards [Re: Emre] #477021
05/02/19 15:28
05/02/19 15:28
Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,842
Kiel (Germany)
Oh, good find!
Yeah, I included that line to not have to deal with different frequencies. Did not know that that's resolution dependent.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Multi Monitor Info, resolutions, graphics cards [Re: Superku] #477022
05/02/19 18:18
05/02/19 18:18
Joined: Jul 2007
Posts: 514
Turkey, izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 514
Turkey, izmir
Here is a quick solution;

Code:
if(multiMonitorInfo.numMonitors)
	{
		int count = 0;
		// get screen rects
		multiMonitorInfo.monitorInfo = (MYMONITORINFO*)sys_malloc(sizeof(MYMONITORINFO)*multiMonitorInfo.numMonitors);
		EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&count);
		
		// get display modes
		D3DDISPLAYMODE displayMode;
		int i,j;
		int last_res[2];
		last_res[0]=0;
		last_res[1]=0;
		for(i = 0; i < multiMonitorInfo.numMonitors; i++)
		{
			MYMONITORINFO *pinfo = &(multiMonitorInfo.monitorInfo)[i];
			int maxModes = pd3dKu->GetAdapterModeCount(i,D3DFMT_X8R8G8B8);
			for(j = 0; j < maxModes; j++)
			{
				if(D3D_OK != pd3dKu->EnumAdapterModes(i,D3DFMT_X8R8G8B8,j,&displayMode)) break;
				if(displayMode.Width >= MMminWidth && displayMode.Height >= MMminHeight/* && displayMode.RefreshRate == multiMonitorInfo.currentFrequency*/) 
				{
					if(displayMode.Width==last_res[0]&&displayMode.Height==last_res[1])
					{
						//skip
					}
					else
					{
						pinfo->numModes++;	
						last_res[0]=displayMode.Width;
						last_res[1]=displayMode.Height;
					}
					
				}
				
				
			}
			if(pinfo->numModes)
			{
				last_res[0]=0;
				last_res[1]=0;
				pinfo->displayModes = (DISPLAYMODE*)sys_malloc(sizeof(DISPLAYMODE)*pinfo->numModes);
				int k = 0;
				for(j = 0; j < maxModes; j++)
				{
					if(D3D_OK != pd3dKu->EnumAdapterModes(i,D3DFMT_X8R8G8B8,j,&displayMode)) break;
					if(displayMode.Width >= MMminWidth && displayMode.Height >= MMminHeight /*&& displayMode.RefreshRate == multiMonitorInfo.currentFrequency*/)
					{
						
						if(displayMode.Width==last_res[0]&&displayMode.Height==last_res[1])
						{
							//skip
						}
						else
						{
							DISPLAYMODE* pMode = &(pinfo->displayModes)[k];
							pMode->Width = displayMode.Width;
							pMode->Height = displayMode.Height;
							k++;	
							last_res[0]=displayMode.Width;
							last_res[1]=displayMode.Height;	
						}
						
						
						
					}
				}
			}
			else pinfo->displayModes = NULL;
			MMInfoSortDisplayModes(pinfo,0);
		}
	}



Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1