/[pcsx2_0.9.7]/trunk/pcsx2/gui/AppConfig.h
ViewVC logotype

Contents of /trunk/pcsx2/gui/AppConfig.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 2 months ago) by william
File MIME type: text/plain
File size: 8543 byte(s)
re-commit (had local access denied errors when committing)
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16 #pragma once
17
18 #include "AppForwardDefs.h"
19 #include "PathDefs.h"
20 #include "CDVD/CDVDaccess.h"
21
22 enum DocsModeType
23 {
24 // uses /home/user or /cwd for the program data
25 DocsFolder_User,
26
27 // uses the current working directory for program data
28 //DocsFolder_CWD,
29
30 // uses a custom location for program data
31 DocsFolder_Custom,
32 };
33
34 namespace PathDefs
35 {
36 // complete pathnames are returned by these functions
37 // For 99% of all code, you should use these.
38
39 extern wxDirName GetUserLocalDataDir();
40 extern wxDirName GetDocuments();
41 extern wxDirName GetDocuments( DocsModeType mode );
42 extern wxDirName GetThemes();
43 }
44
45 extern DocsModeType DocsFolderMode; //
46 extern wxDirName SettingsFolder; // dictates where the settings folder comes from, *if* UseDefaultSettingsFolder is FALSE.
47 extern wxDirName CustomDocumentsFolder; // allows the specification of a custom home folder for PCSX2 documents files.
48 extern bool UseDefaultSettingsFolder; // when TRUE, pcsx2 derives the settings folder from the UseAdminMode
49 extern wxDirName Logs;
50 extern bool UseDefaultLogs;
51
52 wxDirName GetSettingsFolder();
53 wxString GetSettingsFilename();
54 wxDirName GetLogFolder();
55
56 enum AspectRatioType
57 {
58 AspectRatio_Stretch,
59 AspectRatio_4_3,
60 AspectRatio_16_9,
61 AspectRatio_MaxCount
62 };
63
64 // =====================================================================================================
65 // Pcsx2 Application Configuration.
66 // =====================================================================================================
67
68 class AppConfig
69 {
70 public:
71 // ------------------------------------------------------------------------
72 struct ConsoleLogOptions
73 {
74 bool Visible;
75 // if true, DisplayPos is ignored and the console is automatically docked to the main window.
76 bool AutoDock;
77 // Display position used if AutoDock is false (ignored otherwise)
78 wxPoint DisplayPosition;
79 wxSize DisplaySize;
80
81 // Size of the font in points.
82 int FontSize;
83
84 // Color theme by name!
85 wxString Theme;
86
87 ConsoleLogOptions();
88 void LoadSave( IniInterface& conf, const wxChar* title );
89 };
90
91 // ------------------------------------------------------------------------
92 struct FolderOptions
93 {
94 BITFIELD32()
95 bool
96 UseDefaultPlugins:1,
97 UseDefaultSettings:1,
98 UseDefaultBios:1,
99 UseDefaultSnapshots:1,
100 UseDefaultSavestates:1,
101 UseDefaultMemoryCards:1,
102 UseDefaultLogs:1;
103 BITFIELD_END
104
105 wxDirName
106 Plugins,
107 Bios,
108 Snapshots,
109 Savestates,
110 MemoryCards,
111 Logs;
112
113 wxDirName RunIso; // last used location for Iso loading.
114 wxDirName RunELF; // last used location for ELF loading.
115
116 FolderOptions();
117 void LoadSave( IniInterface& conf );
118 void ApplyDefaults();
119
120 void Set( FoldersEnum_t folderidx, const wxString& src, bool useDefault );
121
122 const wxDirName& operator[]( FoldersEnum_t folderidx ) const;
123 wxDirName& operator[]( FoldersEnum_t folderidx );
124 bool IsDefault( FoldersEnum_t folderidx ) const;
125 };
126
127 // ------------------------------------------------------------------------
128 struct FilenameOptions
129 {
130 wxFileName Bios;
131 wxFileName Plugins[PluginId_Count];
132
133 void LoadSave( IniInterface& conf );
134
135 const wxFileName& operator[]( PluginsEnum_t pluginidx ) const;
136 };
137
138 // ------------------------------------------------------------------------
139 // Options struct for each memory card.
140 //
141 struct McdOptions
142 {
143 wxFileName Filename; // user-configured location of this memory card
144 bool Enabled; // memory card enabled (if false, memcard will not show up in-game)
145 };
146
147 // ------------------------------------------------------------------------
148 // The GS window receives much love from the land of Options and Settings.
149 //
150 struct GSWindowOptions
151 {
152 // Closes the GS/Video port on escape (good for fullscreen activity)
153 bool CloseOnEsc;
154
155 bool DefaultToFullscreen;
156 bool AlwaysHideMouse;
157 bool DisableResizeBorders;
158 bool DisableScreenSaver;
159
160 AspectRatioType AspectRatio;
161
162 wxSize WindowSize;
163 wxPoint WindowPos;
164 bool IsMaximized;
165 bool IsFullscreen;
166
167 GSWindowOptions();
168
169 void LoadSave( IniInterface& conf );
170 void SanityCheck();
171 };
172
173 struct FramerateOptions
174 {
175 bool SkipOnLimit;
176 bool SkipOnTurbo;
177
178 Fixed100 NominalScalar;
179 Fixed100 TurboScalar;
180 Fixed100 SlomoScalar;
181
182 FramerateOptions();
183
184 void LoadSave( IniInterface& conf );
185 void SanityCheck();
186 };
187
188 public:
189 wxPoint MainGuiPosition;
190
191 // Because remembering the last used tab on the settings panel is cool (tab is remembered
192 // by it's UTF/ASCII name).
193 wxString SysSettingsTabName;
194 wxString McdSettingsTabName;
195 wxString ComponentsTabName;
196 wxString AppSettingsTabName;
197 wxString GameDatabaseTabName;
198
199 // Currently selected language ID -- wxWidgets version-specific identifier. This is one side of
200 // a two-part configuration that also includes LanguageCode.
201 wxLanguage LanguageId;
202
203 // Current language in use (correlates to the universal language codes, such as "en_US", "de_DE", etc).
204 // This code is not always unique, which is why we use the language ID also.
205 wxString LanguageCode;
206
207 int RecentIsoCount; // number of files displayed in the Recent Isos list.
208
209 // String value describing the desktop theme to use for pcsk2 (icons and background images)
210 // The theme name is used to look up files in the themes folder (relative to the executable).
211 wxString DeskTheme;
212
213 // Specifies the size of icons used in Listbooks; specifically the PCSX2 Properties dialog box.
214 // Realistic values range from 96x96 to 24x24.
215 int Listbook_ImageSize;
216
217 // Specifies the size of each toolbar icon, in pixels (any value >= 2 is valid, but realistically
218 // values should be between 64 and 16 for usability reasons)
219 int Toolbar_ImageSize;
220
221 // Enables display of toolbar text labels.
222 bool Toolbar_ShowLabels;
223
224 // uses automatic ntfs compression when creating new memory cards (Win32 only)
225 #ifdef __WXMSW__
226 bool McdCompressNTFS;
227 #endif
228
229 // Master toggle for enabling or disabling all speedhacks in one fail-free swoop.
230 // (the toggle is applied when a new EmuConfig is sent through AppCoreThread::ApplySettings)
231 bool EnableSpeedHacks;
232 bool EnableGameFixes;
233
234 wxString CurrentIso;
235 wxString CurrentELF;
236 CDVD_SourceType CdvdSource;
237
238 // Memorycard options - first 2 are default slots, last 6 are multitap 1 and 2
239 // slots (3 each)
240 McdOptions Mcd[8];
241
242 ConsoleLogOptions ProgLogBox;
243 FolderOptions Folders;
244 FilenameOptions BaseFilenames;
245 GSWindowOptions GSWindow;
246 FramerateOptions Framerate;
247
248 // PCSX2-core emulation options, which are passed to the emu core prior to initiating
249 // an emulation session. Note these are the options saved into the GUI ini file and
250 // which are shown as options in the gui preferences, but *not* necessarily the options
251 // used by emulation. The gui allows temporary per-game and commandline level overrides.
252 Pcsx2Config EmuOptions;
253
254 public:
255 AppConfig();
256
257 wxString FullpathToBios() const;
258 wxString FullpathToMcd( uint slot ) const;
259 wxString FullpathTo( PluginsEnum_t pluginId ) const;
260
261 bool FullpathMatchTest( PluginsEnum_t pluginId, const wxString& cmpto ) const;
262
263 void LoadSaveUserMode( IniInterface& ini, const wxString& cwdhash );
264
265 void LoadSave( IniInterface& ini );
266 void LoadSaveRootItems( IniInterface& ini );
267 void LoadSaveMemcards( IniInterface& ini );
268 };
269
270 extern void AppLoadSettings();
271 extern void AppSaveSettings();
272 extern void AppApplySettings( const AppConfig* oldconf=NULL );
273
274 extern void ConLog_LoadSaveSettings( IniInterface& ini );
275 extern void SysTraceLog_LoadSaveSettings( IniInterface& ini );
276
277
278 extern wxFileConfig* OpenFileConfig( const wxString& filename );
279 extern void RelocateLogfile();
280 extern void AppConfig_OnChangedSettingsFolder( bool overwrite = false );
281 extern wxConfigBase* GetAppConfig();
282
283 extern ScopedPtr<AppConfig> g_Conf;

  ViewVC Help
Powered by ViewVC 1.1.22