Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / tools / client / client_config / database.cpp
blob18ec56f637f9dd37ba105b9bc5e5a859283dc587
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "stdafx.h"
20 #include "database.h"
21 #include "resource.h"
22 #include "client_config.h"
24 using namespace NLMISC;
25 using namespace std;
27 // ***************************************************************************
28 // Bitmaps
29 // ***************************************************************************
31 const CBitmapId BitmapId[BitmapCount] =
33 { IDB_DISPLAY },
34 { IDB_DISPLAY_DETAILS },
35 { IDB_DISPLAY_ADVANCED },
36 { IDB_CARD },
37 { IDB_GENERAL },
38 { IDB_NETWORK },
39 { IDB_SOUND },
40 { IDB_UPDATE },
41 { IDB_TOP_RIGHT },
42 { IDB_WELCOME },
45 // ***************************************************************************
46 // Pages
47 // ***************************************************************************
49 CPage Root;
51 // ***************************************************************************
53 CPage Pages[PageCount];
55 // ***************************************************************************
57 void CreateDataBase ()
59 Pages[PageGeneral].init (PageGeneral, "uiConfigGeneral", true, BitmapGeneral, IDD_GENERAL, &Root);
60 Pages[PageDisplay].init (PageDisplay, "uiConfigDisplay", true, BitmapDisplay, IDD_DISPLAY, &Root);
61 Pages[PageDisplayDetails].init (PageDisplayDetails, "uiConfigDisplayDetails", false, BitmapDisplayDetails, IDD_DISPLAY_DETAILS, &Pages[PageDisplay]);
62 Pages[PageDisplayAdvanced].init (PageDisplayAdvanced, "uiConfigDisplayAdvanced", false, BitmapDisplayAdvanced, IDD_DISPLAY_ADVANCED, &Pages[PageDisplay]);
63 Pages[PageSound].init (PageSound, "uiConfigSound", true, BitmapSound, IDD_SOUND, &Root);
64 Pages[PageDisplaySysInfo].init (PageDisplaySysInfo, "uiConfigDisplaySysInfo", true, BitmapGeneral, IDD_SYSTEM_INFO, &Root);
65 Pages[PageDisplayOpenGLInfo].init (PageDisplayOpenGLInfo, "uiConfigDisplayOpenGLInfo", false, BitmapCard, IDD_DISPLAY_INFO, &Pages[PageDisplaySysInfo]);
66 Pages[PageDisplayOpenD3DInfo].init (PageDisplayOpenD3DInfo, "uiConfigDisplayD3DInfo", false, BitmapCard, IDD_DISPLAY_D3D, &Pages[PageDisplaySysInfo]);
69 // ***************************************************************************
71 CPage::CPage ()
73 Parent = NULL;
74 ChildId = 0xffffffff;
77 // ***************************************************************************
79 void CPage::init (uint id, const char *name, bool bold, uint icon, uint resid, CPage *parent)
81 PageId = id;
82 Parent = parent;
83 Icon = icon;
84 ResId = resid;
85 ChildId = (uint)parent->Children.size ();
86 if (parent)
87 parent->Children.push_back (this);
88 Name = name;
89 Bold = bold;
92 // ***************************************************************************
94 void CPage::select ()
99 // ***************************************************************************
100 // Config File default
101 // ***************************************************************************
103 NLMISC::CConfigFile ConfigFileDefault;
105 void LoadConfigFileDefault ()
109 ConfigFileDefault.load (CONFIG_DEFAULT_FILE_NAME);
111 catch (Exception &e)
113 theApp.error (CI18N::get ("uiConfigErrorReadingTheFile")+" "CONFIG_FILE_NAME" : "+string (e.what ()));
117 // ***************************************************************************
118 // Merge method
119 // ***************************************************************************
121 struct CMergeDescriptor
123 const char *Name;
124 TMergeMethod Method;
127 // ***************************************************************************
129 static const CMergeDescriptor MergeDescriptor[] =
131 { "DivideTextureSizeBy2", PreferSuperior },
132 { "LandscapeThreshold", PreferInferior },
133 { "MicroVeget", PreferFalse },
134 { "HDEntityTexture", PreferFalse },
135 { "Shadows", PreferFalse },
136 { "DisableDXTC", PreferFalse },
137 { "DisableVtxProgram", PreferTrue },
138 { "DisableVtxAGP", PreferTrue },
139 { "DisableTextureShdr", PreferTrue },
140 { "SoundOn", PreferFalse },
141 { "UseEax", PreferFalse },
142 { "MaxTrack", PreferSuperior },
145 // ***************************************************************************
147 TMergeMethod GetMergeMethod (const char *varName)
149 const uint count = sizeof (MergeDescriptor) / sizeof (CMergeDescriptor);
150 uint i;
151 for (i=0; i<count; i++)
153 if (strcmp (MergeDescriptor[i].Name, varName) == 0)
154 return MergeDescriptor[i].Method;
156 return PreferInferior;
159 // ***************************************************************************
161 const float QualityToLandscapeThreshold[QUALITY_STEP] =
163 100.0f,
164 200.0f,
165 1000.0f,
166 2000.0f,
169 // ***************************************************************************
171 const float QualityToZFar[QUALITY_STEP] =
173 200,
174 300,
175 500,
176 1000,
179 // ***************************************************************************
181 const float QualityToLandscapeTileNear[QUALITY_STEP] =
186 100,
189 // ***************************************************************************
191 const int QualityToSkinNbMaxPoly[QUALITY_STEP] =
193 15000,
194 30000,
195 50000,
196 100000,
199 // ***************************************************************************
200 const int QualityToNbMaxSkeletonNotCLod[QUALITY_STEP] =
209 // ***************************************************************************
211 const int QualityToFxNbMaxPoly[QUALITY_STEP] =
213 2500,
214 5000,
215 10000,
216 20000,
219 // ***************************************************************************