Archived

This topic is now archived and is closed to further replies.

voodoo

Iniatializing PR, different ways??

Recommended Posts

The last function in devdlg.c returns the device and driver to PR. All you need to do is pick the right numbers and return it.

To detect a primary HAL driver, you'll have to enumerate everything and look for HAL in the names. Newer versions of PR do this and store the result in a FoundHAL variable.

To make it show the dialog only once, you could store values in the registry or configuration file and only call the dialog box if they can't be found.

Share this post


Link to post
Share on other sites
Hi,
I use a similar system. by saving a config file. (within this file is a flag for displaying the dialog) I have also set up the dialog flag so that it enables the dialog if the program doesn't exit normally.
ie When you start it saves the flag as on. when the game exits normally, it resets it to off.

Cheers
Darrin

Share this post


Link to post
Share on other sites
ChrisE you mean this...

void PR_ChooseDDraw_Driver (int *driver, int *driver2, int *device)
{
DialogBox (ghInstance, MAKEINTRESOURCE (IDD_DEVDIALOG), hWndMain, (DLGPROC)DevDlgProc);

*driver = PickedDriver;
*driver2 = PickedDriver2;
*device = PickedDevice;
}

Well I know how to test whether or not to call the dialogue box. It's prety trivial and tehre's different ways of
doing it, by using flags etc...

But what I want to know is the following...

Let's say I run the app for the first time and the config file is not set up. I want to call up the dialogue box.
Once the user has pressed ok. I want to write out the drivers and options(32bit rendering, filtering etc..) to the
cinfig file. What exact structures or vars do I write to the file.

Now let's say the app is beeing run for the second time. If the config file is not screwed up in any way. Just read
the values directly from the file. Now how do I prevent the dialogue box from popping up let's say the flag is set
to read the file. And also where do I store the stuff I have read from the file. I know about PR_Settings thats ok
but I am more concerned about the drivers and devices.


Thanx

Share this post


Link to post
Share on other sites
Is this what I have to write to the file??

PR_D3D_Drivers[PickedDriver].Name
PR_DisplayDevices[PickedDevice].guid

And when I read the file store the values back into them??

I looked through the refference doc I couldn't find info on them.

Share this post


Link to post
Share on other sites
void PR_ChooseDDraw_Driver (int *driver, int *driver2, int *device)
{
DialogBox (ghInstance, MAKEINTRESOURCE (IDD_DEVDIALOG), hWndMain, (DLGPROC)DevDlgProc);

*driver = PickedDriver;
*driver2 = PickedDriver2;
*device = PickedDevice;
}

Instead of calling the dialog, get the Picked values from a file. These are just numbers, and represent the indices of the devices and drivers in the enumerated lists.
For the other options like 32 bit color, check the code in the dialog box procedure where it stores the results (when you click on the OK button).


Share this post


Link to post
Share on other sites
Yeah but what do I have to write to the file? What values..

What I want to do is when the perosn clciks ok is to write out to the text file the current driever and device he picked and next time the app start it uses thoses instead.

Share this post


Link to post
Share on other sites
Ok I think I get it now...

*driver = PickedDriver;
*driver2 = PickedDriver2;
*device = PickedDevice;

Inside my own cpp file I dont have acces to driver, driver2 or device

So what I write to the file is these values
right?

PickedDriver;
PickedDriver2;
PickedDevice;

Now lets say I have read the values then what?? please expl;ain alittle more and also how would I prevent the box from popping!

Share this post


Link to post
Share on other sites
Ok ChrisE I get it!!! hehehehe

Ok when I comment out
DialogBox (ghInstance, MAKEINTRESOURCE (IDD_DEVDIALOG), hWndMain, (DLGPROC)DevDlgProc);

from PR_ChooseDDraw_Driver

PR starts with the default I guess. I am right??

I want to know what excatly do I have to write to the file is it PickedDriver??

And also lets sya I have read the values from the text file what fuunction do I call to pass thoses values??

Share this post


Link to post
Share on other sites
It's ok I figured it out. I wasn't sure how the PR_ChooseDDraw_Driver Worked but I got iy top work

PR_ChooseDDraw_Driver()
{
read config file

If failed to read config file
call dialogue function
else fill in drver, driver2 and device values
}

I didn't know the first line called the dialogue box and that the driver values where filed in after the clicking OK. But I figured it, thanx anyways.

Share this post


Link to post
Share on other sites
Just don't forget that the dialog proc also contains

if (Button_GetCheck (GetDlgItem(hDlg, IDC_CHECK1)))
D3DDataStr.Use32Bit = 1;
else
D3DDataStr.Use32Bit = 0;

if (Button_GetCheck (GetDlgItem(hDlg, IDC_CHECK2)))
D3DDataStr.UseAGP = 1;
else
D3DDataStr.UseAGP = 0;

if (Button_GetCheck (GetDlgItem(hDlg, IDC_CHECK3)))
D3DDataStr.UseTrilinearFiltering = 1;
else
D3DDataStr.UseTrilinearFiltering = 0;

if (Button_GetCheck (GetDlgItem(hDlg, IDC_CHECK4)))
D3DDataStr.UseTripleBuffering = 1;
else
D3DDataStr.UseTripleBuffering = 0;


if you don't load these settings from the config file as well, these options won't work for you.


Just as a side note: You may want to look into using the registry instead of a configuration file. It was designed for these types of things, but it also may be more hassle than it's worth.


Gary

[This message has been edited by Gary (edited November 18, 1999).]

[This message has been edited by Gary (edited November 19, 1999).]

Share this post


Link to post
Share on other sites
Let's say I want to make a game that will only work in d3d hal. How I would I intialize pr without using the dialog box. Can it be done if so what fucntion cal do I have to make to do this.

Also if I want write a little config file that will save the current driver and device that where selected through the dialogue box and have the game read the file insted of the
getting the theinfo from the dialogue box after the first time. What structures and vars would I need to get from the devdlg.c file and also prevent the dailogue box from popping up!

You help would be appreciated!

Share this post


Link to post
Share on other sites