2 Copyright (c) 2002, Thomas Kurschel
5 Part of Radeon accelerant
9 We shouldn't really need settings as this info
10 should be stored by app_server, but especially
11 BWindowScreen programs cannot now about extra
12 features/settings, so we need to store the flags
13 internally (until I have a better idea ;)
15 Especially "SwapWindow" should be mode-independant
16 (you don't swap monitors when you select another
20 #include "radeon_accelerant.h"
22 #include "GlobalData.h"
24 #include <FindDirectory.h>
28 void Radeon_ReadSettings( virtual_card
*vc
)
33 vc
->swap_displays
= false;
34 vc
->use_laptop_panel
= false;
35 vc
->tv_standard
= ts_ntsc
;
37 // this is problematic during boot: if there is multi-user support,
38 // you don't have a user when app_server gets launched;
39 // on the other hand, storing settings globally is not user-friendly...
40 if( find_directory( B_USER_SETTINGS_DIRECTORY
, &path
) != B_OK
)
43 path
.Append( "radeon" );
45 BFile
file( path
.Path(), B_READ_ONLY
);
47 if( file
.InitCheck() != B_OK
)
52 if( settings
.Unflatten( &file
) != B_OK
)
55 settings
.FindBool( "SwapDisplays", &vc
->swap_displays
);
56 settings
.FindBool( "UseLaptopPanel", &vc
->use_laptop_panel
);
57 settings
.FindInt32( "TVStandard", &tmp
);
59 if( tmp
>= 0 && tmp
<= ts_max
)
60 vc
->tv_standard
= (tv_standard_e
)tmp
;
63 void Radeon_WriteSettings( virtual_card
*vc
)
68 // this is problematic during boot: if there is multi-user support,
69 // you don't have a user when app_server gets launched;
70 // on the other hand, storing settings globally is not user-friendly...
71 if( find_directory( B_USER_SETTINGS_DIRECTORY
, &path
) != B_OK
)
74 path
.Append( "radeon" );
76 BFile
file( path
.Path(), B_CREATE_FILE
| B_WRITE_ONLY
);
78 if( file
.InitCheck() != B_OK
)
83 settings
.AddBool( "SwapDisplays", vc
->swap_displays
);
84 settings
.AddBool( "UseLaptopPanel", vc
->use_laptop_panel
);
85 tmp
= vc
->tv_standard
;
86 settings
.AddInt32( "TVStandard", tmp
);
88 settings
.Flatten( &file
);