TGB 1.1.2 Mac - Odd fullscreen video resolution bug
by Don Schaper · in Torque Game Builder · 10/26/2006 (8:38 am) · 3 replies
TGB 1.1.2 Mac - PPC Mac mini - OS X 10.4.8
No matter what I do, the engine at startup writes to /common/Preferences/prefs.cs a BBP other than what it should. Instead of "16" or "32" it always writes some huge number.
$pref::Video::Resolution = "1024 768 452920";
Manually editing the prefs.cs file back to what I want has no affect; since it will change back to 452920 just by running the game. The same goes with setting options. They will appear to be set to 32, but magically return to 452920 the next time I run the engine. Even if I force the engine to not exec either /common/options.cs or my own, the result is the same. Deleting prefs.cs entirely results in a new one created; with the dreaded 452920!
I started fresh, with a brand new copy of TGB 1.1.2, opening to the default project, and set the preferences to fullscreen; resulting in the normal $pref::Video::Resolution = "1024 768 32";
The very next time I started the engine I got $pref::Video::Resolution = "1024 768 452648";
I have no idea why the huge number suddenly changed, but it remains 452648 no matter what I do!
It makes no difference what fullscreen resolutions I try; or what my monitor's resolution is set at.
On my computer, this has absolutely no affect on how the engine looks; though it certainly messes up the whole concept of setting preferences. On a friends computer, the problem "results in loss of video signal (V & H signals out of range) and forces a restart" of his G4 PowerMac.
The standard code:
I went through the common scripts, in an effort to find exactly when this magical change from "32" to "huge number" happens...
In /common/gamescripts/canvas.cs > function initializeCanvas(%windowName)
the change happens in createCanvas(%windowName).
So... This led me to Xcode and macCarbOGLVideo.cc. Here is where I discovered that the engine is automatically rewriting $pref::Video::resolution (among other preferences!). Unfortunately, I don't have enough experience in dealing with the source to be able figure out why BPP is being set to the huge number when the canvas is created. From my reading of the code, it is supposed to clamp the BPP to 16 or 32 if anything else pops up; but that is obviously not happening. Frankly, I'm at a loss in trying to figure out the code.
TGB 1.1.1 did not show this odd behavior.
This issue is driving me nuts! Any thoughts people might have about what's going on would be greatly appreciated.
No matter what I do, the engine at startup writes to /common/Preferences/prefs.cs a BBP other than what it should. Instead of "16" or "32" it always writes some huge number.
$pref::Video::Resolution = "1024 768 452920";
Manually editing the prefs.cs file back to what I want has no affect; since it will change back to 452920 just by running the game. The same goes with setting options. They will appear to be set to 32, but magically return to 452920 the next time I run the engine. Even if I force the engine to not exec either /common/options.cs or my own, the result is the same. Deleting prefs.cs entirely results in a new one created; with the dreaded 452920!
I started fresh, with a brand new copy of TGB 1.1.2, opening to the default project, and set the preferences to fullscreen; resulting in the normal $pref::Video::Resolution = "1024 768 32";
The very next time I started the engine I got $pref::Video::Resolution = "1024 768 452648";
I have no idea why the huge number suddenly changed, but it remains 452648 no matter what I do!
It makes no difference what fullscreen resolutions I try; or what my monitor's resolution is set at.
On my computer, this has absolutely no affect on how the engine looks; though it certainly messes up the whole concept of setting preferences. On a friends computer, the problem "results in loss of video signal (V & H signals out of range) and forces a restart" of his G4 PowerMac.
The standard code:
%resList = getResolutionList(%device);
%resCount = getFieldCount(%resList);
%count = 0;
for (%i = 0; %i < %resCount; %i++)
{
%bpp = getWord(getField(%resList, %i), 2);
// Only add to list if it isn't there already.
if (%this.findText(%bpp) == -1)
{
%this.add(%bpp, %count);
%count++;
}
}results in "16", "32" & the huge number!I went through the common scripts, in an effort to find exactly when this magical change from "32" to "huge number" happens...
In /common/gamescripts/canvas.cs > function initializeCanvas(%windowName)
the change happens in createCanvas(%windowName).
So... This led me to Xcode and macCarbOGLVideo.cc. Here is where I discovered that the engine is automatically rewriting $pref::Video::resolution (among other preferences!). Unfortunately, I don't have enough experience in dealing with the source to be able figure out why BPP is being set to the huge number when the canvas is created. From my reading of the code, it is supposed to clamp the BPP to 16 or 32 if anything else pops up; but that is obviously not happening. Frankly, I'm at a loss in trying to figure out the code.
TGB 1.1.1 did not show this odd behavior.
This issue is driving me nuts! Any thoughts people might have about what's going on would be greatly appreciated.
#2
In _MacCarbGetInitialRes() in macCarbWindow.cc
Change
and change
I limited the valid values to 0, 16 and 32 since later on in findValidPixelFormat() those are the only values that will be accepted anyway.
Hopefully that solves the problem.
10/31/2006 (6:27 pm)
I just noticed that my prefs.cs file had a huge number for the bpp as well. Delving into it, it looks like the problem is an uninitialized variable. Fortunately it's an easy fix if you have the source:In _MacCarbGetInitialRes() in macCarbWindow.cc
Change
char *tempBuf, *s;to
char *tempBuf;
and change
if (fullScreen)
{
s = dAtoi( dStrtok( NULL, "[[62818e69f3606]]" ) );
if( ! bpp > 0 ) bpp = 16;
}toif (fullScreen)
{
bpp = dAtoi( dStrtok( NULL, "[[62818e69f36e3]]" ) );
if (bpp != 0 && bpp != 16 && bpp != 32)
bpp = 16;
}I limited the valid values to 0, 16 and 32 since later on in findValidPixelFormat() those are the only values that will be accepted anyway.
Hopefully that solves the problem.
#3
10/31/2006 (8:17 pm)
Ken, thank you for the fix. Hopefully, someone at GG will notice this issue and fix it in the release version. For the time-being, I'll try out your solution.
Torque Owner Don Schaper
XIX Software
His monitor is a a LaCie Electron 19 Blue, connected with a BNC-5 connector. His computer is a G4 PowerMac, running OS X 10.4.8.
He also sent me the ATI Display Crash Long; which I can send to anybody who wants to tackle this problem.