Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / dbPerformChecklistForDisplayModes() not detecting certain display devices

Author
Message
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Jul 2011 20:46
I am currently on vacation at home and I wanted to show off one of my new games. My family's computers all crash when I get to changing from the main menu to the actual game. I don't have my programming machine with me, so I'm stuck with figuring it out without being able to program. I narrowed it down to an idea:
When the game initializes, it gets the current screen resolution and uses that for the main menu. It then calls dbPerformChecklistForDisplayModes(); and goes through a process to fill in a list of available display modes. This is where the problem occurs. On those machines, this generates nothing! When I get home, I can make a work-around, but I would like to know what is actually causing this....

The common difference is that all my computers have Win7 and the ones that don't work with the game have XP.

I would like to know if anyone else that is using XP has the same problem.
https://docs.google.com/leaf?id=0BySKIgkx3OcbNjY1N2U2OGQtZDQzYi00YjAxLTk1ODItMzA0ZTc4MTRlZjEz&hl=en_US
This is the zip with the game. I would like to know if anyone has an idea to correct this problem.....

The fastest code is the code never written.
TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 18th Jul 2011 22:20 Edited at: 18th Jul 2011 22:23
Hi.

Yes, I get that problem. Using XP SP3, fully up to date, latest nVidia drivers, etc.

When I looked at the display settings box, there were no options to select.

Without seeing your code, I couldn't guess at why you're are having this problem. But on my Dark GDK games I use the following code.



PS You can't use it exactly "as-is", because I created a new type of dbSetWindowLayout(5,0,0); that sets it to windowed mode but at full-screen resolution with no borders. That way it looks as if it is full-screen, but I can ALT/TAB in and out without it crashing.

Amazing Simulation
www.amazing-forum.com
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Jul 2011 23:02
dbSetWindowLayout(5,0,0);
That's a good idea.... thanks. I'll put that in as an option. I had a feeling that XP was the common issue. I would like others to confirm that. I would also like a developer to tell me what is different... Here is the entire code for my main menu:
bo

If you followed my GUI posts, you may recognize that MainGUI is a pointer for my GUI class. It's immaterial to this problem; just know that the "MainGUI.MenuItem[ResolutionList]" part holds the available resolutions discovered by dbPerformChecklistForDisplayModes();

As I said earlier, I can't do anything to change the code right now, because I'm not at my programming PC. If someone sees something wrong with my code, please let me know so I can fix it(in about a week). Thanks.

The fastest code is the code never written.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 24th Jul 2011 22:03 Edited at: 24th Jul 2011 22:04
OK. Here are some resolutions that my video card can handle:

** The x 16 is duplicated with x 32 depth **
If there is a resolution that some other video cards will handle between 1024x768 and 1920x1080, let me know and I'll put it in the list. Remember, this is only a work-around for XP users.

I also discovered a sound issue and I'm working on that now. I'll post a new version when I think I have the sound fixed. It doesn't happen on my PC, but all others that can run my program seem to crash when they go to listen to the audio log..... Has anyone else had that issue?

The fastest code is the code never written.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 24th Jul 2011 22:37
OK. Here is the updated game. Please test it as fully as possible.
https://docs.google.com/leaf?id=0BySKIgkx3OcbNjk1NDM4MmMtODViZi00YmQ2LTg2NTAtMGM1YWZlNWJlZTQ2&hl=en_US
Too bad there's not a "Test my game" section in this forum...

The fastest code is the code never written.
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 25th Jul 2011 20:46 Edited at: 25th Jul 2011 22:13
@TerryRussell:

Contrary to all good C++ practices, Dark GDK checklists are indexed from 1 to array size. The code subtracts one from the index, and it raises a runtime error (which you don't see but it can cause problems in the program nonetheless) when the index is out of this range. Adjust your loop.

EDIT: I suppose this is a remainder from Basic. It's not documented in the help.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 25th Jul 2011 22:14
So this part:

should be:

?
If that's not what you are talking about, then what do you mean?

The fastest code is the code never written.
TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 26th Jul 2011 01:12 Edited at: 26th Jul 2011 01:31
Mireben is referring to this line:
for (int i=0;i<dbChecklistQuantity();i++){

In his view it should be
for (int i=1;i<dbChecklistQuantity();i++){

Mireben, which line in which part of the GDK source has that subtraction to which you refer?

It is just possible that I have modified some part of the video library and missed that, of course. As I've said a few times, my Dark GDK is now heavily modified, to rid it of some of the worst bugs and to add a few features that I needed. Perhaps one of those has fixed whatever error Mireben refers to. But I couldn't see it.

Hawkblood, in your code snippet it starts with
if (dbCheckDisplayMode (ScreenW, ScreenH, 32 )==0){
But I couldn't see where ScreenW and ScreenH come from. Where are they declared or derived?

The reason I ask is that I think that the menu dialog is being drawn off-screen, which is why I can't see it. Then when I go to the game, it crashes because of some invalid value for the width or height. Just guessing at the moment, but it would fit the observed facts if either the height or width values were in excess of the actual values.

Amazing Simulation
www.amazing-forum.com
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2011 02:22
ScreenW, ScreenH is declared in another part of the program:

I do all my globals first (if I can). You may recognize-- these get the current display mode (I set the depth to 32 as default).

for (int i=1;i<dbChecklistQuantity();i++){ is not in my code. I use

What I was asking was about ND. Does that need to be dbGetNumberOfDisplayModes()-1?

The fastest code is the code never written.
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 26th Jul 2011 02:40
You don't have to use DarkGDK's dbGetNumberOfDisplayModes. You can use Win32 directly to call EnumDisplaySettings:

http://msdn.microsoft.com/en-us/library/dd162611(v=vs.85).aspx

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2011 03:05
I had assumed GDK used it to get the list.... Am I wrong?

The fastest code is the code never written.
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 26th Jul 2011 03:35
As you said:

Quote: "dbPerformChecklistForDisplayModes() not detecting certain display devices"


You can try using the Win32 API and see if maybe it was implemented incorrectly or insufficiently. Maybe it will solve your initial problem.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2011 04:58
Thanks for the tip. I've put this issue on the back burner for now since I have a work-around. I REALLY need someone to help me on my "Terrain question" post though.

The fastest code is the code never written.
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 26th Jul 2011 21:23
This line:



Should be changed to:



Note the 1 and also the <= in the upper limit! It's not a bug, it's a feature. But it's not documented in the help, so I figured it out by observing the result lists I got from various check lists. If I index a display mode list, for example, the "correct" way from zero, then the first set of values I get is 0,0,0 and the last resolution is obviously missing. I had the same result with limbs. I had a suspicion that they index from 1 because it must be compatible with Dark Basic, so I tried and voila... It still works this way in the last update, I tested my display mode list before answering.

These are the source code extracts that prove it. I have a code snapshot from last September or so, because since then I don't have an SVN client installed, but I doubt this code has changed since then. They are in the shared/system directory, file CSystemC.cpp.

Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 26th Jul 2011 21:27
P.S. I don't know what causes the display detection problem, because of which you originally posted. I wanted to test it as well because I have both XP and Windows 7, but didn't have the time... Maybe later, at least I could confirm if it's really dependent on the operating system.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Jul 2011 23:23
Yea. I have Win7 and all the machines that didn't work were XP. Could be a coinsidence, but that's 4XP machines that didn't work.

The fastest code is the code never written.
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 27th Jul 2011 00:04
I have done some tests. I took the following program:



and compiled it on a Windows 7 (64 bit) machine with Dark GDK versions 7.3, 7.4 and 7.5, in release mode. Then I ran it on the Win7 machine and also on XP SP3 machines with ATI and with NVidia video cards. All versions work normally.

Then I tried the reverse: compiled the program on an XP machine with different Dark GDK versions and ran it on the XP and on the Win7 machine. Again, all combinations work.

Can you try the above test code on your problematic machines too? If it works, it should be easy to modify the code to use the checklist value functions instead of dbGetNumberOfDisplayModes etc.
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 27th Jul 2011 07:59
I did another quick test, using the functions that you use in your code, with this test program:



This DOESN'T WORK either on Windows 7 or on XP. While dbChecklistQuantity correctly returns the number of display modes, dbGetNumberOfDisplayModes returns always 0.

So, I think the only problem is that the functions you use don't belong together. I don't know what dbGetNumberOfDisplayModes and dbGetDisplayMode are used for (they are not in the help), but maybe they require other functions to be called before and they don't use the checklist. If you make a checklist, read it with the checklist value functions and it should work. It would even be easier to make a string out of integer numbers than to break up a string with strtok.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Jul 2011 15:29
I have not had a problem on either of my Win7 computers with my functions. If you are having problems on your Win7 computer, then there is a problem. I'll make some adjustments to my code and post the results when I'm finished.
I'll steal a little from the code you posted earlier since that seemed to work on both platforms without problems. Thanks.

The fastest code is the code never written.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 31st Jul 2011 01:13
OK. I've changed the way it looks for the resolutions. Please test this version out:
https://docs.google.com/leaf?id=0BySKIgkx3OcbNTZjN2E0MTItNzJiYS00MDA0LWI3MjUtN2EzYzUwYTM4MWI3&hl=en_US

Here is the way I am doing it now:

I still have my fall-back method, so if the resolutions you normally have are not listed, then let me know......

The fastest code is the code never written.
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 2nd Aug 2011 05:56 Edited at: 2nd Aug 2011 06:07
I was putting together some code for the PureGDK documentation for this on how to query the Win32 API for compatible display modes. I thought and I thought you might be interested.

This example will output all resolutions supported by the user's monitor matching the current display depth, refresh rate, and aspect ratio of the desktop:



Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 2nd Aug 2011 15:51
I think I have something that will work already. I am waiting for someone to test my program on an XP machine (several people would be best) to let me know how it works. I appreciate your post, but I wanted to use GDK as much as possible.

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-05-18 11:09:05
Your offset time is: 2024-05-18 11:09:05